]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/storage/LVMEdit.js
update shipped appliance info index
[pve-manager.git] / www / manager6 / storage / LVMEdit.js
CommitLineData
16b294b5 1Ext.define('PVE.storage.VgSelector', {
14d9ecc4 2 extend: 'PVE.form.ComboBoxSetStoreNode',
16b294b5 3 alias: 'widget.pveVgSelector',
c2317525
DC
4 valueField: 'vg',
5 displayField: 'vg',
6 queryMode: 'local',
7 editable: false,
d420b29a
DC
8
9 listConfig: {
10 columns: [
11 {
12 dataIndex: 'vg',
13 flex: 1,
14 },
15 ],
04389e49 16 emptyText: PVE.Utils.renderNotFound('VGs'),
d420b29a
DC
17 },
18
14d9ecc4
SH
19 config: {
20 apiSuffix: '/scan/lvm',
21 },
22
d420b29a
DC
23 showNodeSelector: true,
24
14d9ecc4
SH
25 setNodeName: function(value) {
26 let me = this;
27 me.callParent([value]);
28 me.getStore().load();
29 },
30
8058410f 31 initComponent: function() {
b9e706fb 32 let me = this;
16b294b5
DM
33
34 if (!me.nodename) {
35 me.nodename = 'localhost';
36 }
37
b9e706fb 38 let store = Ext.create('Ext.data.Store', {
16b294b5 39 autoLoad: {}, // true,
8058410f 40 fields: ['vg', 'size', 'free'],
16b294b5 41 proxy: {
56a353b9 42 type: 'proxmox',
14d9ecc4 43 url: `${me.apiBaseUrl}${me.nodename}${me.apiSuffix}`,
f6710aac 44 },
16b294b5
DM
45 });
46
9e9ab96f
WL
47 store.sort('vg', 'ASC');
48
16b294b5
DM
49 Ext.apply(me, {
50 store: store,
16b294b5
DM
51 });
52
53 me.callParent();
f6710aac 54 },
16b294b5
DM
55});
56
57Ext.define('PVE.storage.BaseStorageSelector', {
58 extend: 'Ext.form.field.ComboBox',
59 alias: 'widget.pveBaseStorageSelector',
60
61 existingGroupsText: gettext("Existing volume groups"),
c2317525
DC
62 queryMode: 'local',
63 editable: false,
64 value: '',
65 valueField: 'storage',
66 displayField: 'text',
8058410f 67 initComponent: function() {
b9e706fb 68 let me = this;
16b294b5 69
b9e706fb 70 let store = Ext.create('Ext.data.Store', {
16b294b5
DM
71 autoLoad: {
72 addRecords: true,
73 params: {
f6710aac
TL
74 type: 'iscsi',
75 },
16b294b5 76 },
8058410f 77 fields: ['storage', 'type', 'content',
16b294b5
DM
78 {
79 name: 'text',
80 convert: function(value, record) {
81 if (record.data.storage) {
82 return record.data.storage + " (iSCSI)";
83 } else {
84 return me.existingGroupsText;
85 }
f6710aac 86 },
16b294b5
DM
87 }],
88 proxy: {
56a353b9 89 type: 'proxmox',
f6710aac
TL
90 url: '/api2/json/storage/',
91 },
16b294b5
DM
92 });
93
94 store.loadData([{ storage: '' }], true);
95
9e9ab96f
WL
96 store.sort('storage', 'ASC');
97
16b294b5 98 Ext.apply(me, {
f6710aac 99 store: store,
16b294b5
DM
100 });
101
102 me.callParent();
f6710aac 103 },
16b294b5
DM
104});
105
d420b29a
DC
106Ext.define('PVE.storage.LunSelector', {
107 extend: 'PVE.form.FileSelector',
108 alias: 'widget.pveStorageLunSelector',
109
110 nodename: 'localhost',
111 storageContent: 'images',
112 allowBlank: false,
113
114 initComponent: function() {
115 let me = this;
116
01740cb2 117 if (!PVE.Utils.isStandaloneNode()) {
d420b29a
DC
118 me.errorHeight = 140;
119 Ext.apply(me.listConfig ?? {}, {
120 tbar: {
121 xtype: 'toolbar',
122 items: [
123 {
124 xtype: "pveStorageScanNodeSelector",
125 autoSelect: false,
126 fieldLabel: gettext('Node to scan'),
127 listeners: {
128 change: (_field, value) => me.setNodename(value),
129 },
130 },
131 ],
132 },
04389e49 133 emptyText: me.listConfig?.emptyText ?? PVE.Utils.renderNotFound(gettext('Volume')),
d420b29a
DC
134 });
135 }
136
137 me.callParent();
138 },
139
140});
141
16b294b5 142Ext.define('PVE.storage.LVMInputPanel', {
f28ec3e4 143 extend: 'PVE.panel.StorageBase',
713742ec 144 mixins: ['Proxmox.Mixin.CBind'],
16b294b5 145
96988dfa
DC
146 onlineHelp: 'storage_lvm',
147
713742ec
DC
148 column1: [
149 {
150 xtype: 'pveBaseStorageSelector',
151 name: 'basesel',
152 fieldLabel: gettext('Base storage'),
153 cbind: {
154 disabled: '{!isCreate}',
155 hidden: '{!isCreate}',
156 },
157 submitValue: false,
158 listeners: {
159 change: function(f, value) {
160 let me = this;
161 let vgField = me.up('inputpanel').lookup('volumeGroupSelector');
162 let vgNameField = me.up('inputpanel').lookup('vgName');
163 let baseField = me.up('inputpanel').lookup('lunSelector');
164
165 vgField.setVisible(!value);
166 vgField.setDisabled(!!value);
167
168 baseField.setVisible(!!value);
169 baseField.setDisabled(!value);
170 baseField.setStorage(value);
171
172 vgNameField.setVisible(!!value);
173 vgNameField.setDisabled(!value);
174 },
175 },
176 },
177 {
178 xtype: 'pveStorageLunSelector',
179 name: 'base',
180 fieldLabel: gettext('Base volume'),
181 reference: 'lunSelector',
182 hidden: true,
183 disabled: true,
184 },
185 {
186 xtype: 'pveVgSelector',
16b294b5 187 name: 'vgname',
16b294b5 188 fieldLabel: gettext('Volume group'),
713742ec
DC
189 reference: 'volumeGroupSelector',
190 cbind: {
191 disabled: '{!isCreate}',
192 hidden: '{!isCreate}',
193 },
f6710aac 194 allowBlank: false,
713742ec
DC
195 listeners: {
196 nodechanged: function(value) {
197 this.up('inputpanel').lookup('storageNodeRestriction').setValue(value);
f6710aac 198 },
713742ec
DC
199 },
200 },
201 {
202 name: 'vgname',
203 fieldLabel: gettext('Volume group'),
204 reference: 'vgName',
205 cbind: {
206 xtype: (get) => get('isCreate') ? 'textfield' : 'displayfield',
207 hidden: '{isCreate}',
208 disabled: '{isCreate}',
209 },
210 value: '',
211 allowBlank: false,
212 },
213 {
16b294b5
DM
214 xtype: 'pveContentTypeSelector',
215 cts: ['images', 'rootdir'],
216 fieldLabel: gettext('Content'),
217 name: 'content',
218 value: ['images', 'rootdir'],
219 multiSelect: true,
f6710aac 220 allowBlank: false,
713742ec
DC
221 },
222 ],
223
224 column2: [
225 {
226 xtype: 'proxmoxcheckbox',
227 name: 'shared',
228 uncheckedValue: 0,
229 fieldLabel: gettext('Shared'),
c75ee959
AL
230 autoEl: {
231 tag: 'div',
232 'data-qtip': gettext('Enable if the LVM is located on a shared LUN.'),
233 },
713742ec 234 },
267dc2bd
FE
235 {
236 xtype: 'proxmoxcheckbox',
237 name: 'saferemove',
238 uncheckedValue: 0,
239 fieldLabel: gettext('Wipe Removed Volumes'),
240 },
713742ec 241 ],
16b294b5 242});