ui: move remote target datastore/ns selectors to own file
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
d895b26bb9
commit
8c29bca57c
@ -39,6 +39,7 @@ JSSRC= \
|
|||||||
form/TokenSelector.js \
|
form/TokenSelector.js \
|
||||||
form/AuthidSelector.js \
|
form/AuthidSelector.js \
|
||||||
form/RemoteSelector.js \
|
form/RemoteSelector.js \
|
||||||
|
form/RemoteTargetSelector.js \
|
||||||
form/DataStoreSelector.js \
|
form/DataStoreSelector.js \
|
||||||
form/NamespaceSelector.js \
|
form/NamespaceSelector.js \
|
||||||
form/NamespaceMaxDepth.js \
|
form/NamespaceMaxDepth.js \
|
||||||
|
188
www/form/RemoteTargetSelector.js
Normal file
188
www/form/RemoteTargetSelector.js
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
Ext.define('PBS.form.RemoteStoreSelector', {
|
||||||
|
extend: 'Proxmox.form.ComboGrid',
|
||||||
|
alias: 'widget.pbsRemoteStoreSelector',
|
||||||
|
|
||||||
|
queryMode: 'local',
|
||||||
|
|
||||||
|
valueField: 'store',
|
||||||
|
displayField: 'store',
|
||||||
|
notFoundIsValid: true,
|
||||||
|
|
||||||
|
matchFieldWidth: false,
|
||||||
|
listConfig: {
|
||||||
|
loadingText: gettext('Scanning...'),
|
||||||
|
width: 350,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
header: gettext('Datastore'),
|
||||||
|
sortable: true,
|
||||||
|
dataIndex: 'store',
|
||||||
|
renderer: Ext.String.htmlEncode,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: gettext('Comment'),
|
||||||
|
dataIndex: 'comment',
|
||||||
|
renderer: Ext.String.htmlEncode,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
doRawQuery: function() {
|
||||||
|
// do nothing.
|
||||||
|
},
|
||||||
|
|
||||||
|
setRemote: function(remote) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (me.remote === remote) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
me.remote = remote;
|
||||||
|
|
||||||
|
let store = me.store;
|
||||||
|
store.removeAll();
|
||||||
|
|
||||||
|
if (me.remote) {
|
||||||
|
me.setDisabled(false);
|
||||||
|
if (!me.firstLoad) {
|
||||||
|
me.clearValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
store.proxy.url = '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan';
|
||||||
|
store.load();
|
||||||
|
|
||||||
|
me.firstLoad = false;
|
||||||
|
} else {
|
||||||
|
me.setDisabled(true);
|
||||||
|
me.clearValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
me.firstLoad = true;
|
||||||
|
|
||||||
|
let store = Ext.create('Ext.data.Store', {
|
||||||
|
fields: ['store', 'comment'],
|
||||||
|
proxy: {
|
||||||
|
type: 'proxmox',
|
||||||
|
url: '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
store.sort('store', 'ASC');
|
||||||
|
|
||||||
|
Ext.apply(me, {
|
||||||
|
store: store,
|
||||||
|
});
|
||||||
|
|
||||||
|
me.callParent();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.define('PBS.form.RemoteNamespaceSelector', {
|
||||||
|
extend: 'Proxmox.form.ComboGrid',
|
||||||
|
alias: 'widget.pbsRemoteNamespaceSelector',
|
||||||
|
|
||||||
|
queryMode: 'local',
|
||||||
|
|
||||||
|
valueField: 'ns',
|
||||||
|
displayField: 'ns',
|
||||||
|
emptyText: PBS.Utils.render_optional_namespace(''),
|
||||||
|
notFoundIsValid: true,
|
||||||
|
|
||||||
|
matchFieldWidth: false,
|
||||||
|
listConfig: {
|
||||||
|
loadingText: gettext('Scanning...'),
|
||||||
|
width: 350,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
header: gettext('Namespace'),
|
||||||
|
sortable: true,
|
||||||
|
dataIndex: 'ns',
|
||||||
|
renderer: PBS.Utils.render_optional_namespace, // FIXME proper root-aware renderer
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: gettext('Comment'),
|
||||||
|
dataIndex: 'comment',
|
||||||
|
renderer: Ext.String.htmlEncode,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
doRawQuery: function() {
|
||||||
|
// do nothing.
|
||||||
|
},
|
||||||
|
|
||||||
|
setRemote: function(remote) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (me.remote === remote) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
me.remote = remote;
|
||||||
|
|
||||||
|
let store = me.store;
|
||||||
|
store.removeAll();
|
||||||
|
|
||||||
|
me.setDisabled(true);
|
||||||
|
me.clearValue();
|
||||||
|
},
|
||||||
|
|
||||||
|
setRemoteStore: function(remoteStore) {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
if (me.remoteStore === remoteStore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
me.remoteStore = remoteStore;
|
||||||
|
|
||||||
|
let store = me.store;
|
||||||
|
store.removeAll();
|
||||||
|
|
||||||
|
if (me.remote && me.remoteStore) {
|
||||||
|
me.setDisabled(false);
|
||||||
|
if (!me.firstLoad) {
|
||||||
|
me.clearValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
store.proxy.url = '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan/' + encodeURIComponent(me.remoteStore) + '/namespaces';
|
||||||
|
store.load();
|
||||||
|
|
||||||
|
me.firstLoad = false;
|
||||||
|
} else {
|
||||||
|
me.setDisabled(true);
|
||||||
|
me.clearValue();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
let me = this;
|
||||||
|
|
||||||
|
me.firstLoad = true;
|
||||||
|
|
||||||
|
let store = Ext.create('Ext.data.Store', {
|
||||||
|
fields: ['ns', 'comment'],
|
||||||
|
proxy: {
|
||||||
|
type: 'proxmox',
|
||||||
|
url: '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
store.sort('store', 'ASC');
|
||||||
|
|
||||||
|
Ext.apply(me, {
|
||||||
|
store: store,
|
||||||
|
});
|
||||||
|
|
||||||
|
me.callParent();
|
||||||
|
},
|
||||||
|
});
|
@ -1,193 +1,3 @@
|
|||||||
Ext.define('PBS.form.RemoteStoreSelector', {
|
|
||||||
extend: 'Proxmox.form.ComboGrid',
|
|
||||||
alias: 'widget.pbsRemoteStoreSelector',
|
|
||||||
|
|
||||||
queryMode: 'local',
|
|
||||||
|
|
||||||
valueField: 'store',
|
|
||||||
displayField: 'store',
|
|
||||||
notFoundIsValid: true,
|
|
||||||
|
|
||||||
matchFieldWidth: false,
|
|
||||||
listConfig: {
|
|
||||||
loadingText: gettext('Scanning...'),
|
|
||||||
width: 350,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
header: gettext('Datastore'),
|
|
||||||
sortable: true,
|
|
||||||
dataIndex: 'store',
|
|
||||||
renderer: Ext.String.htmlEncode,
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
header: gettext('Comment'),
|
|
||||||
dataIndex: 'comment',
|
|
||||||
renderer: Ext.String.htmlEncode,
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
doRawQuery: function() {
|
|
||||||
// do nothing.
|
|
||||||
},
|
|
||||||
|
|
||||||
setRemote: function(remote) {
|
|
||||||
let me = this;
|
|
||||||
|
|
||||||
if (me.remote === remote) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
me.remote = remote;
|
|
||||||
|
|
||||||
let store = me.store;
|
|
||||||
store.removeAll();
|
|
||||||
|
|
||||||
if (me.remote) {
|
|
||||||
me.setDisabled(false);
|
|
||||||
if (!me.firstLoad) {
|
|
||||||
me.clearValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
store.proxy.url = '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan';
|
|
||||||
store.load();
|
|
||||||
|
|
||||||
me.firstLoad = false;
|
|
||||||
} else {
|
|
||||||
me.setDisabled(true);
|
|
||||||
me.clearValue();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
initComponent: function() {
|
|
||||||
let me = this;
|
|
||||||
|
|
||||||
me.firstLoad = true;
|
|
||||||
|
|
||||||
let store = Ext.create('Ext.data.Store', {
|
|
||||||
fields: ['store', 'comment'],
|
|
||||||
proxy: {
|
|
||||||
type: 'proxmox',
|
|
||||||
url: '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
store.sort('store', 'ASC');
|
|
||||||
|
|
||||||
Ext.apply(me, {
|
|
||||||
store: store,
|
|
||||||
});
|
|
||||||
|
|
||||||
me.callParent();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Ext.define('PBS.form.RemoteNamespaceSelector', {
|
|
||||||
extend: 'Proxmox.form.ComboGrid',
|
|
||||||
alias: 'widget.pbsRemoteNamespaceSelector',
|
|
||||||
|
|
||||||
queryMode: 'local',
|
|
||||||
|
|
||||||
valueField: 'ns',
|
|
||||||
displayField: 'ns',
|
|
||||||
emptyText: PBS.Utils.render_optional_namespace(''),
|
|
||||||
notFoundIsValid: true,
|
|
||||||
|
|
||||||
matchFieldWidth: false,
|
|
||||||
listConfig: {
|
|
||||||
loadingText: gettext('Scanning...'),
|
|
||||||
width: 350,
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
header: gettext('Namespace'),
|
|
||||||
sortable: true,
|
|
||||||
dataIndex: 'ns',
|
|
||||||
renderer: PBS.Utils.render_optional_namespace, // FIXME proper root-aware renderer
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
header: gettext('Comment'),
|
|
||||||
dataIndex: 'comment',
|
|
||||||
renderer: Ext.String.htmlEncode,
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
doRawQuery: function() {
|
|
||||||
// do nothing.
|
|
||||||
},
|
|
||||||
|
|
||||||
setRemote: function(remote) {
|
|
||||||
let me = this;
|
|
||||||
|
|
||||||
if (me.remote === remote) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
me.remote = remote;
|
|
||||||
|
|
||||||
let store = me.store;
|
|
||||||
store.removeAll();
|
|
||||||
|
|
||||||
me.setDisabled(true);
|
|
||||||
me.clearValue();
|
|
||||||
},
|
|
||||||
|
|
||||||
setRemoteStore: function(remoteStore) {
|
|
||||||
let me = this;
|
|
||||||
|
|
||||||
if (me.remoteStore === remoteStore) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
me.remoteStore = remoteStore;
|
|
||||||
|
|
||||||
let store = me.store;
|
|
||||||
store.removeAll();
|
|
||||||
|
|
||||||
if (me.remote && me.remoteStore) {
|
|
||||||
me.setDisabled(false);
|
|
||||||
if (!me.firstLoad) {
|
|
||||||
me.clearValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
store.proxy.url = '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan/' + encodeURIComponent(me.remoteStore) + '/namespaces';
|
|
||||||
store.load();
|
|
||||||
|
|
||||||
me.firstLoad = false;
|
|
||||||
} else {
|
|
||||||
me.setDisabled(true);
|
|
||||||
me.clearValue();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
initComponent: function() {
|
|
||||||
let me = this;
|
|
||||||
|
|
||||||
me.firstLoad = true;
|
|
||||||
|
|
||||||
let store = Ext.create('Ext.data.Store', {
|
|
||||||
fields: ['ns', 'comment'],
|
|
||||||
proxy: {
|
|
||||||
type: 'proxmox',
|
|
||||||
url: '/api2/json/config/remote/' + encodeURIComponent(me.remote) + '/scan',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
store.sort('store', 'ASC');
|
|
||||||
|
|
||||||
Ext.apply(me, {
|
|
||||||
store: store,
|
|
||||||
});
|
|
||||||
|
|
||||||
me.callParent();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Ext.define('PBS.window.SyncJobEdit', {
|
Ext.define('PBS.window.SyncJobEdit', {
|
||||||
extend: 'Proxmox.window.Edit',
|
extend: 'Proxmox.window.Edit',
|
||||||
alias: 'widget.pbsSyncJobEdit',
|
alias: 'widget.pbsSyncJobEdit',
|
||||||
|
Loading…
Reference in New Issue
Block a user