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() {
});
+ me.targetSel.on('change', function(f, value) {
+ me.hdstoragesel.setTargetNode(value);
+ });
+
me.formatsel = Ext.create('PVE.form.DiskFormatSelector', {
name: 'diskformat',
fieldLabel: gettext('Format'),