ui: namespace selector: allow to set datastore dynamically
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
6b4d057370
commit
9d8090626c
@ -56,16 +56,28 @@ Ext.define('PBS.form.NamespaceSelector', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setDatastore: function(datastore) {
|
||||||
|
let me = this;
|
||||||
|
if (datastore ?? false) {
|
||||||
|
me.datastore = datastore;
|
||||||
|
me.store.getProxy().setUrl(`/api2/json/admin/datastore/${me.datastore}/namespace`);
|
||||||
|
if (me.isDisabled()) {
|
||||||
|
me.setDisabled(false);
|
||||||
|
}
|
||||||
|
me.store.load();
|
||||||
|
me.validate();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
if (!me.datastore) {
|
if (!me.datastore) {
|
||||||
console.error("no datastore passed");
|
me.disabled = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
me.store = Ext.create('Ext.data.Store', {
|
me.store = Ext.create('Ext.data.Store', {
|
||||||
model: 'pbs-namespaces',
|
model: 'pbs-namespaces',
|
||||||
autoLoad: true,
|
autoLoad: !!me.datastore,
|
||||||
proxy: {
|
proxy: {
|
||||||
type: 'proxmox',
|
type: 'proxmox',
|
||||||
timeout: 30 * 1000,
|
timeout: 30 * 1000,
|
||||||
@ -76,4 +88,3 @@ Ext.define('PBS.form.NamespaceSelector', {
|
|||||||
me.callParent();
|
me.callParent();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user