]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/storage/DirEdit.js
remove displayfield height hack
[pve-manager.git] / www / manager6 / storage / DirEdit.js
CommitLineData
caab7a92
DM
1Ext.define('PVE.storage.DirInputPanel', {
2 extend: 'PVE.panel.InputPanel',
3
4 onGetValues: function(values) {
5 var me = this;
6
7 if (me.create) {
8 values.type = 'dir';
9 } else {
10 delete values.storage;
11 }
12
177de3de 13 values.disable = values.enable ? 0 : 1;
caab7a92
DM
14 delete values.enable;
15
16 return values;
17 },
18
19 initComponent : function() {
20 var me = this;
21
22
23 me.column1 = [
24 {
25 xtype: me.create ? 'textfield' : 'displayfield',
26 name: 'storage',
caab7a92
DM
27 value: me.storageId || '',
28 fieldLabel: 'ID',
29 vtype: 'StorageId',
30 allowBlank: false
31 },
32 {
33 xtype: me.create ? 'textfield' : 'displayfield',
caab7a92
DM
34 name: 'path',
35 value: '',
36 fieldLabel: gettext('Directory'),
37 allowBlank: false
38 },
39 {
40 xtype: 'pveContentTypeSelector',
41 name: 'content',
42 value: 'images',
43 multiSelect: true,
44 fieldLabel: gettext('Content'),
45 allowBlank: false
46 }
47 ];
48
49 me.column2 = [
50 {
51 xtype: 'pvecheckbox',
52 name: 'enable',
53 checked: true,
54 uncheckedValue: 0,
55 fieldLabel: gettext('Enable')
56 },
57 {
58 xtype: 'pvecheckbox',
59 name: 'shared',
60 uncheckedValue: 0,
61 fieldLabel: gettext('Shared')
62 },
63 {
64 xtype: 'numberfield',
65 fieldLabel: gettext('Max Backups'),
66 name: 'maxfiles',
67 minValue: 0,
68 maxValue: 365,
69 value: me.create ? '1' : undefined,
70 allowBlank: false
71 }
72 ];
73
74 if (me.create || me.storageId !== 'local') {
75 me.column2.unshift({
5198365d 76 xtype: 'pveNodeSelector',
caab7a92
DM
77 name: 'nodes',
78 fieldLabel: gettext('Nodes'),
177de3de 79 emptyText: gettext('All') + ' (' +
caab7a92
DM
80 gettext('No restrictions') +')',
81 multiSelect: true,
82 autoSelect: false
83 });
84 }
85
86 me.callParent();
87 }
88});
89
90Ext.define('PVE.storage.DirEdit', {
91 extend: 'PVE.window.Edit',
92
93 initComponent : function() {
94 var me = this;
177de3de 95
caab7a92
DM
96 me.create = !me.storageId;
97
98 if (me.create) {
99 me.url = '/api2/extjs/storage';
100 me.method = 'POST';
101 } else {
102 me.url = '/api2/extjs/storage/' + me.storageId;
103 me.method = 'PUT';
104 }
105
106 var ipanel = Ext.create('PVE.storage.DirInputPanel', {
107 create: me.create,
108 storageId: me.storageId
109 });
110
111 Ext.apply(me, {
112 subject: PVE.Utils.format_storage_type('dir'),
113 isAdd: true,
114 items: [ ipanel ]
115 });
177de3de 116
caab7a92
DM
117 me.callParent();
118
119 if (!me.create) {
120 me.load({
121 success: function(response, options) {
122 var values = response.result.data;
123 var ctypes = values.content || '';
124
125 values.content = ctypes.split(',');
126
127 if (values.nodes) {
128 values.nodes = values.nodes.split(',');
129 }
130 values.enable = values.disable ? 0 : 1;
131
132 ipanel.setValues(values);
133 }
134 });
135 }
136 }
137});