]> git.proxmox.com Git - pve-manager.git/blame - www/manager/storage/RBDEdit.js
disable animation of charts on load
[pve-manager.git] / www / manager / storage / RBDEdit.js
CommitLineData
74d63b33
AD
1Ext.define('PVE.storage.RBDInputPanel', {
2 extend: 'PVE.panel.InputPanel',
3
4 onGetValues: function(values) {
5 var me = this;
6
7 if (me.create) {
8 values.type = 'rbd';
74d63b33
AD
9 } else {
10 delete values.storage;
11 }
12
13 values.disable = values.enable ? 0 : 1;
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',
27 height: 22, // hack: set same height as text fields
28 value: me.storageId || '',
29 fieldLabel: 'ID',
30 vtype: 'StorageId',
31 allowBlank: false
32 },
33 {
34 xtype: me.create ? 'textfield' : 'displayfield',
35 height: 22, // hack: set same height as text fields
36 name: 'pool',
37 value: 'rbd',
38 fieldLabel: gettext('Pool'),
39 allowBlank: false
40 },
41 {
42 xtype: me.create ? 'textfield' : 'displayfield',
43 height: 22, // hack: set same height as text fields
44 name: 'monhost',
23f92e94 45 value: '',
74d63b33
AD
46 fieldLabel: gettext('Monitor Host'),
47 allowBlank: false
48 },
49 {
50 xtype: me.create ? 'textfield' : 'displayfield',
51 height: 22, // hack: set same height as text fields
52 name: 'username',
53 value: 'admin',
14b948f5 54 fieldLabel: gettext('User name'),
23f92e94 55 allowBlank: true
9bb44cc3 56 }
74d63b33
AD
57 ];
58
59 me.column2 = [
60 {
61 xtype: 'pvecheckbox',
62 name: 'enable',
63 checked: true,
64 uncheckedValue: 0,
65 fieldLabel: gettext('Enable')
6c20e90f
WL
66 },
67 {
68 xtype: 'pveContentTypeSelector',
69 cts: ['images', 'rootdir'],
70 fieldLabel: gettext('Content'),
71 name: 'content',
7216990d 72 value: ['images'],
6c20e90f
WL
73 multiSelect: true,
74 allowBlank: false
018c7524
WL
75 },
76 {
77 xtype: 'pvecheckbox',
78 name: 'krbd',
79 uncheckedValue: 0,
80 fieldLabel: gettext('KRBD')
9bb44cc3 81 }
74d63b33
AD
82 ];
83
84 if (me.create || me.storageId !== 'local') {
85 me.column2.unshift({
86 xtype: 'PVE.form.NodeSelector',
87 name: 'nodes',
88 fieldLabel: gettext('Nodes'),
89 emptyText: gettext('All') + ' (' +
90 gettext('No restrictions') +')',
91 multiSelect: true,
92 autoSelect: false
93 });
94 }
95
96 me.callParent();
97 }
98});
99
100Ext.define('PVE.storage.RBDEdit', {
101 extend: 'PVE.window.Edit',
102
103 initComponent : function() {
104 var me = this;
105
106 me.create = !me.storageId;
107
108 if (me.create) {
109 me.url = '/api2/extjs/storage';
110 me.method = 'POST';
111 } else {
112 me.url = '/api2/extjs/storage/' + me.storageId;
113 me.method = 'PUT';
114 }
115
116 var ipanel = Ext.create('PVE.storage.RBDInputPanel', {
117 create: me.create,
118 storageId: me.storageId
119 });
120
121 Ext.apply(me, {
f5b806d9 122 subject: PVE.Utils.format_storage_type('rbd'),
74d63b33
AD
123 isAdd: true,
124 items: [ ipanel ]
125 });
126
127 me.callParent();
128
129 if (!me.create) {
130 me.load({
131 success: function(response, options) {
132 var values = response.result.data;
6c20e90f
WL
133
134 var ctypes = values.content || '';
135
136 values.content = ctypes.split(',');
137
74d63b33
AD
138 if (values.nodes) {
139 values.nodes = values.nodes.split(',');
140 }
141 values.enable = values.disable ? 0 : 1;
142 ipanel.setValues(values);
143 }
144 });
145 }
146 }
147});