]>
Commit | Line | Data |
---|---|---|
9e2a4653 DC |
1 | Ext.define('PBS.window.RemoteEdit', { |
2 | extend: 'Proxmox.window.Edit', | |
3 | alias: 'widget.pbsRemoteEdit', | |
4 | mixins: ['Proxmox.Mixin.CBind'], | |
5 | ||
298c6aae OB |
6 | onlineHelp: 'backup_remote', |
7 | ||
9e2a4653 DC |
8 | userid: undefined, |
9 | ||
10 | isAdd: true, | |
11 | ||
12 | subject: gettext('Remote'), | |
13 | ||
14 | fieldDefaults: { labelWidth: 120 }, | |
15 | ||
16 | cbindData: function(initialConfig) { | |
17 | let me = this; | |
18 | ||
19 | let baseurl = '/api2/extjs/config/remote'; | |
20 | let name = initialConfig.name; | |
21 | ||
22 | me.isCreate = !name; | |
23 | me.url = name ? `${baseurl}/${name}` : baseurl; | |
24 | me.method = name ? 'PUT' : 'POST'; | |
25 | me.autoLoad = !!name; | |
26 | return { | |
27 | passwordEmptyText: me.isCreate ? '' : gettext('Unchanged'), | |
28 | }; | |
29 | }, | |
30 | ||
31 | items: { | |
32 | xtype: 'inputpanel', | |
33 | column1: [ | |
34 | { | |
35 | xtype: 'pmxDisplayEditField', | |
36 | name: 'name', | |
37 | fieldLabel: gettext('Remote'), | |
38 | renderer: Ext.htmlEncode, | |
39 | allowBlank: false, | |
40 | minLength: 4, | |
41 | cbind: { | |
42 | editable: '{isCreate}', | |
43 | }, | |
44 | }, | |
45 | { | |
46 | xtype: 'proxmoxtextfield', | |
47 | allowBlank: false, | |
48 | name: 'host', | |
49 | fieldLabel: gettext('Host'), | |
50 | }, | |
9c33683c DC |
51 | { |
52 | xtype: 'proxmoxintegerfield', | |
53 | allowBlank: true, | |
54 | minValue: 1, | |
55 | maxValue: 2**16, | |
56 | name: 'port', | |
57 | emptyText: 8007, | |
58 | deleteEmpty: true, | |
59 | fieldLabel: gettext('Port'), | |
60 | }, | |
9e2a4653 DC |
61 | ], |
62 | ||
63 | column2: [ | |
64 | { | |
65 | xtype: 'proxmoxtextfield', | |
66 | allowBlank: false, | |
67 | name: 'userid', | |
68 | fieldLabel: gettext('Userid'), | |
69 | }, | |
70 | { | |
71 | xtype: 'textfield', | |
72 | inputType: 'password', | |
73 | fieldLabel: gettext('Password'), | |
74 | name: 'password', | |
75 | cbind: { | |
76 | emptyText: '{passwordEmptyText}', | |
77 | allowBlank: '{!isCreate}', | |
78 | }, | |
79 | }, | |
80 | ], | |
81 | ||
82 | columnB: [ | |
83 | { | |
84 | xtype: 'proxmoxtextfield', | |
85 | name: 'fingerprint', | |
b37b59b7 | 86 | deleteEmpty: true, |
9e2a4653 DC |
87 | fieldLabel: gettext('Fingerprint'), |
88 | }, | |
c6887a8a DM |
89 | { |
90 | xtype: 'proxmoxtextfield', | |
91 | name: 'comment', | |
b37b59b7 | 92 | deleteEmpty: true, |
c6887a8a DM |
93 | fieldLabel: gettext('Comment'), |
94 | }, | |
9e2a4653 DC |
95 | ], |
96 | }, | |
6bba120d DC |
97 | |
98 | getValues: function() { | |
99 | let me = this; | |
100 | let values = me.callParent(arguments); | |
101 | ||
102 | if (values.password === '') { | |
103 | delete values.password; | |
104 | } | |
105 | ||
106 | return values; | |
107 | }, | |
9e2a4653 | 108 | }); |