]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
StorageSelector: alow to use new target option
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 14 May 2013 08:10:27 +0000 (10:10 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 14 May 2013 08:10:27 +0000 (10:10 +0200)
Useful for clone API to restrict storage list.

www/manager/form/StorageSelector.js
www/manager/qemu/Clone.js

index 0c306f651da3a72f87602eefb989864d82425770..922657d7938c3fc47cb97155cf0c20a05fa963f4 100644 (file)
@@ -2,26 +2,53 @@ Ext.define('PVE.form.StorageSelector', {
     extend: 'PVE.form.ComboGrid',
     alias: ['widget.PVE.form.StorageSelector'],
 
-    setNodename: function(nodename) {
+    reloadStorageList: function() {
        var me = this;
-
-       if (!nodename || (me.nodename === nodename)) {
+       if (!me.nodename) {
            return;
        }
 
-       me.nodename = nodename;
-
+       var params = {};
        var url = '/api2/json/nodes/' + me.nodename + '/storage';
        if (me.storageContent) {
-           url += '?content=' + me.storageContent;
+           params.content = me.storageContent;
+       }
+       if (me.targetNode) {
+           params.target = me.targetNode;
+           params.enabled = 1; // skip disabled storages
        }
-
        me.store.setProxy({
            type: 'pve',
-           url: url
+           url: url,
+           extraParams: params
        });
 
        me.store.load();
+    },
+
+    setTargetNode: function(targetNode) {
+       var me = this;
+
+       if (!targetNode || (me.targetNode === targetNode)) {
+           return;
+       }
+
+       me.targetNode = targetNode;
+
+       me.reloadStorageList();
+    },
+
+    setNodename: function(nodename) {
+       var me = this;
+
+       if (!nodename || (me.nodename === nodename)) {
+           return;
+       }
+
+       me.nodename = nodename;
+
+       me.reloadStorageList();
     },
 
     initComponent: function() {
index 29f849de5fc4ccdb4a9eccd305415d7c17d1f397..58b1ee7b4b48590ec8eb851b05a640274f55d9fa 100644 (file)
@@ -204,6 +204,10 @@ Ext.define('PVE.window.Clone', {
 
        });
 
+       me.targetSel.on('change', function(f, value) {
+           me.hdstoragesel.setTargetNode(value);
+       });
+
        me.formatsel = Ext.create('PVE.form.DiskFormatSelector', {
            name: 'diskformat',
            fieldLabel: gettext('Format'),