]>
git.proxmox.com Git - proxmox-backup.git/blob - www/window/RemoteEdit.js
bf5c11fc94d538e8f2dd5d4900bc89f3cecff115
1 Ext
.define('PBS.window.RemoteEdit', {
2 extend
: 'Proxmox.window.Edit',
3 alias
: 'widget.pbsRemoteEdit',
4 mixins
: ['Proxmox.Mixin.CBind'],
6 onlineHelp
: 'backup_remote',
12 subject
: gettext('Remote'),
14 fieldDefaults
: { labelWidth
: 120 },
16 cbindData: function(initialConfig
) {
19 let baseurl
= '/api2/extjs/config/remote';
20 let name
= initialConfig
.name
;
23 me
.url
= name
? `${baseurl}/${name}` : baseurl
;
24 me
.method
= name
? 'PUT' : 'POST';
27 passwordEmptyText
: me
.isCreate
? '' : gettext('Unchanged'),
35 xtype
: 'pmxDisplayEditField',
37 fieldLabel
: gettext('Remote'),
38 renderer
: Ext
.htmlEncode
,
42 editable
: '{isCreate}',
46 xtype
: 'proxmoxtextfield',
51 fieldLabel
: gettext('Host'),
53 change: function(field
, newvalue
) {
57 let match
= Proxmox
.Utils
.HostPort_match
.exec(newvalue
);
59 match
= Proxmox
.Utils
.HostPortBrackets_match
.exec(newvalue
);
61 match
= Proxmox
.Utils
.IP6_dotnotation_match
.exec(newvalue
);
67 if (match
[2] !== undefined) {
72 field
.up('inputpanel').down('field[name=host]').setValue(host
);
73 field
.up('inputpanel').down('field[name=port]').setValue(port
);
78 xtype
: 'proxmoxtextfield',
83 xtype
: 'proxmoxtextfield',
92 xtype
: 'proxmoxtextfield',
95 fieldLabel
: gettext('Userid'),
99 inputType
: 'password',
100 fieldLabel
: gettext('Password'),
103 emptyText
: '{passwordEmptyText}',
104 allowBlank
: '{!isCreate}',
111 xtype
: 'proxmoxtextfield',
114 fieldLabel
: gettext('Fingerprint'),
117 xtype
: 'proxmoxtextfield',
120 fieldLabel
: gettext('Comment'),
125 setValues: function(values
) {
128 let host
= values
.host
;
129 if (values
.port
!== undefined) {
130 if (Proxmox
.Utils
.IP6_match
.test(host
)) {
133 host
+= `:${values.port}`;
135 values
.hostport
= host
;
137 return me
.callParent([values
]);
140 getValues: function() {
142 let values
= me
.callParent(arguments
);
144 if (values
.password
=== '') {
145 delete values
.password
;