ui: refactor DataStoreConfig and Edit
split them into two files and put them into the respective directory refactor the DataStoreConfigPanel to controller/view and the DataStoreEdit window/inputpanel to simply an editwindow (there is no need to have a seperate inputpanel) which also prepares the window for edit (by using pmxDisplayEditFields) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
98bb3b9016
commit
98ad58fbd2
59
www/window/DataStoreEdit.js
Normal file
59
www/window/DataStoreEdit.js
Normal file
@ -0,0 +1,59 @@
|
||||
Ext.define('PBS.DataStoreEdit', {
|
||||
extend: 'Proxmox.window.Edit',
|
||||
alias: 'widget.pbsDataStoreEdit',
|
||||
mixins: ['Proxmox.Mixin.CBind'],
|
||||
|
||||
subject: gettext('Datastore'),
|
||||
isAdd: true,
|
||||
|
||||
cbindData: function(initialConfig) {
|
||||
var me = this;
|
||||
|
||||
let name = initialConfig.name;
|
||||
let baseurl = '/api2/extjs/config/datastore';
|
||||
|
||||
me.isCreate = !name;
|
||||
me.url = name ? baseurl + '/' + name : baseurl;
|
||||
me.method = name ? 'PUT' : 'POST';
|
||||
me.autoLoad = !!name;
|
||||
return {};
|
||||
},
|
||||
|
||||
items: [
|
||||
{
|
||||
xtype: 'inputpanel',
|
||||
column1: [
|
||||
{
|
||||
xtype: 'pmxDisplayEditField',
|
||||
cbind: {
|
||||
editable: '{isCreate}',
|
||||
},
|
||||
name: 'name',
|
||||
allowBlank: false,
|
||||
fieldLabel: gettext('Name'),
|
||||
},
|
||||
],
|
||||
|
||||
column2: [
|
||||
{
|
||||
xtype: 'pmxDisplayEditField',
|
||||
cbind: {
|
||||
editable: '{isCreate}',
|
||||
},
|
||||
name: 'path',
|
||||
allowBlank: false,
|
||||
fieldLabel: gettext('Backing Path'),
|
||||
emptyText: gettext('An absolute path'),
|
||||
},
|
||||
],
|
||||
|
||||
columnB: [
|
||||
{
|
||||
xtype: 'textfield',
|
||||
name: 'comment',
|
||||
fieldLabel: gettext('Comment'),
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
});
|
Reference in New Issue
Block a user