ui: add crud for remotes
listing/adding/editing/removing Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
de4db62c57
commit
9e2a4653b4
78
www/window/RemoteEdit.js
Normal file
78
www/window/RemoteEdit.js
Normal file
@ -0,0 +1,78 @@
|
||||
Ext.define('PBS.window.RemoteEdit', {
|
||||
extend: 'Proxmox.window.Edit',
|
||||
alias: 'widget.pbsRemoteEdit',
|
||||
mixins: ['Proxmox.Mixin.CBind'],
|
||||
|
||||
userid: undefined,
|
||||
|
||||
isAdd: true,
|
||||
|
||||
subject: gettext('Remote'),
|
||||
|
||||
fieldDefaults: { labelWidth: 120 },
|
||||
|
||||
cbindData: function(initialConfig) {
|
||||
let me = this;
|
||||
|
||||
let baseurl = '/api2/extjs/config/remote';
|
||||
let name = initialConfig.name;
|
||||
|
||||
me.isCreate = !name;
|
||||
me.url = name ? `${baseurl}/${name}` : baseurl;
|
||||
me.method = name ? 'PUT' : 'POST';
|
||||
me.autoLoad = !!name;
|
||||
return {
|
||||
passwordEmptyText: me.isCreate ? '' : gettext('Unchanged'),
|
||||
};
|
||||
},
|
||||
|
||||
items: {
|
||||
xtype: 'inputpanel',
|
||||
column1: [
|
||||
{
|
||||
xtype: 'pmxDisplayEditField',
|
||||
name: 'name',
|
||||
fieldLabel: gettext('Remote'),
|
||||
renderer: Ext.htmlEncode,
|
||||
allowBlank: false,
|
||||
minLength: 4,
|
||||
cbind: {
|
||||
editable: '{isCreate}',
|
||||
},
|
||||
},
|
||||
{
|
||||
xtype: 'proxmoxtextfield',
|
||||
allowBlank: false,
|
||||
name: 'host',
|
||||
fieldLabel: gettext('Host'),
|
||||
},
|
||||
],
|
||||
|
||||
column2: [
|
||||
{
|
||||
xtype: 'proxmoxtextfield',
|
||||
allowBlank: false,
|
||||
name: 'userid',
|
||||
fieldLabel: gettext('Userid'),
|
||||
},
|
||||
{
|
||||
xtype: 'textfield',
|
||||
inputType: 'password',
|
||||
fieldLabel: gettext('Password'),
|
||||
name: 'password',
|
||||
cbind: {
|
||||
emptyText: '{passwordEmptyText}',
|
||||
allowBlank: '{!isCreate}',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
columnB: [
|
||||
{
|
||||
xtype: 'proxmoxtextfield',
|
||||
name: 'fingerprint',
|
||||
fieldLabel: gettext('Fingerprint'),
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user