]> git.proxmox.com Git - proxmox-backup.git/blob - www/window/RemoteEdit.js
ui: add crud for remotes
[proxmox-backup.git] / www / window / RemoteEdit.js
1 Ext.define('PBS.window.RemoteEdit', {
2 extend: 'Proxmox.window.Edit',
3 alias: 'widget.pbsRemoteEdit',
4 mixins: ['Proxmox.Mixin.CBind'],
5
6 userid: undefined,
7
8 isAdd: true,
9
10 subject: gettext('Remote'),
11
12 fieldDefaults: { labelWidth: 120 },
13
14 cbindData: function(initialConfig) {
15 let me = this;
16
17 let baseurl = '/api2/extjs/config/remote';
18 let name = initialConfig.name;
19
20 me.isCreate = !name;
21 me.url = name ? `${baseurl}/${name}` : baseurl;
22 me.method = name ? 'PUT' : 'POST';
23 me.autoLoad = !!name;
24 return {
25 passwordEmptyText: me.isCreate ? '' : gettext('Unchanged'),
26 };
27 },
28
29 items: {
30 xtype: 'inputpanel',
31 column1: [
32 {
33 xtype: 'pmxDisplayEditField',
34 name: 'name',
35 fieldLabel: gettext('Remote'),
36 renderer: Ext.htmlEncode,
37 allowBlank: false,
38 minLength: 4,
39 cbind: {
40 editable: '{isCreate}',
41 },
42 },
43 {
44 xtype: 'proxmoxtextfield',
45 allowBlank: false,
46 name: 'host',
47 fieldLabel: gettext('Host'),
48 },
49 ],
50
51 column2: [
52 {
53 xtype: 'proxmoxtextfield',
54 allowBlank: false,
55 name: 'userid',
56 fieldLabel: gettext('Userid'),
57 },
58 {
59 xtype: 'textfield',
60 inputType: 'password',
61 fieldLabel: gettext('Password'),
62 name: 'password',
63 cbind: {
64 emptyText: '{passwordEmptyText}',
65 allowBlank: '{!isCreate}',
66 },
67 },
68 ],
69
70 columnB: [
71 {
72 xtype: 'proxmoxtextfield',
73 name: 'fingerprint',
74 fieldLabel: gettext('Fingerprint'),
75 },
76 ],
77 },
78 });