]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/node/ZFS.js
1 Ext
.define('PVE.node.CreateZFS', {
2 extend
: 'Proxmox.window.Edit',
5 onlineHelp
: 'chapter_zfs',
12 initComponent: function() {
16 throw "no node name specified";
19 let update_disklist = function() {
20 let grid
= me
.down('#disklist');
21 let disks
= grid
.getSelection();
23 disks
.sort(function(a
, b
) {
24 let aOrder
= a
.get('order') || 0;
25 let bOrder
= b
.get('order') || 0;
26 return aOrder
- bOrder
;
29 let selectedDevices
= disks
.map(disk
=> disk
.get('devpath')).join(';');
31 me
.down('field[name=devices]').setValue(selectedDevices
);
35 url
: `/nodes/${me.nodename}/disks/zfs`,
40 onGetValues
: values
=> values
, // FIXME leftover?
49 xtype
: 'proxmoxtextfield',
51 fieldLabel
: gettext('Name'),
55 xtype
: 'proxmoxcheckbox',
57 fieldLabel
: gettext('Add Storage'),
63 xtype
: 'proxmoxKVComboBox',
64 fieldLabel
: gettext('RAID Level'),
68 ['single', gettext('Single Disk')],
77 xtype
: 'proxmoxKVComboBox',
78 fieldLabel
: gettext('Compression'),
92 xtype
: 'proxmoxintegerfield',
93 fieldLabel
: gettext('ashift'),
104 emptyText
: gettext('No Disks unused'),
106 selModel
: 'checkboxmodel',
108 selectionchange
: update_disklist
,
113 url
: `/api2/json/nodes/${me.nodename}/disks/list?type=unused`,
118 text
: gettext('Device'),
119 dataIndex
: 'devpath',
123 text
: gettext('Model'),
128 text
: gettext('Serial'),
133 text
: gettext('Size'),
135 renderer
: Proxmox
.Utils
.render_size
,
139 header
: gettext('Order'),
140 xtype
: 'widgetcolumn',
145 xtype
: 'proxmoxintegerfield',
149 change: function(numberfield
, value
, old_value
) {
150 let record
= numberfield
.getWidgetRecord();
151 record
.set('order', value
);
152 update_disklist(record
);
162 xtype
: 'displayfield',
165 value
: 'Note: ZFS is not compatible with disks backed by a hardware ' +
166 'RAID controller. For details see <a target="_blank" href="' +
167 Proxmox
.Utils
.get_help_link('chapter_zfs') + '">the reference documentation</a>.',
173 me
.down('#disklist').getStore().load();
177 Ext
.define('PVE.node.ZFSDevices', {
178 extend
: 'Ext.tree.Panel',
179 xtype
: 'pveZFSDevices',
182 stateId
: 'grid-node-zfsstatus',
186 text
: gettext('Name'),
191 text
: gettext('Health'),
192 renderer
: PVE
.Utils
.render_zfs_health
,
208 text
: gettext('Message'),
215 let sm
= me
.getSelectionModel();
216 Proxmox
.Utils
.API2Request({
217 url
: `/nodes/${me.nodename}/disks/zfs/${me.zpool}`,
220 failure
: (response
, opts
) => Proxmox
.Utils
.setErrorMask(me
, response
.htmlStatus
),
221 success: function(response
, opts
) {
223 me
.setRootNode(response
.result
.data
);
230 selModel
: 'treemodel',
237 calculate
: data
=> data
.leaf
? `fa x-fa-tree fa-hdd-o` : undefined,
241 initComponent: function() {
245 throw "no node name specified";
248 throw "no zpool specified";
257 Ext
.define('PVE.node.ZFSStatus', {
258 extend
: 'Proxmox.grid.ObjectGrid',
259 xtype
: 'pveZFSStatus',
263 initComponent: function() {
267 throw "no node name specified";
270 throw "no zpool specified";
273 me
.url
= `/api2/extjs/nodes/${me.nodename}/disks/zfs/${me.zpool}`;
277 header
: gettext('Scan'),
278 defaultValue
: gettext('No Data'),
281 header
: gettext('Status'),
284 header
: gettext('Action'),
287 header
: gettext('Errors'),
296 Ext
.define('PVE.node.ZFSList', {
297 extend
: 'Ext.grid.Panel',
301 stateId
: 'grid-node-zfs',
304 text
: gettext('Name'),
309 header
: gettext('Size'),
310 renderer
: Proxmox
.Utils
.format_size
,
314 header
: gettext('Free'),
315 renderer
: Proxmox
.Utils
.format_size
,
319 header
: gettext('Allocated'),
320 renderer
: Proxmox
.Utils
.format_size
,
324 header
: gettext('Fragmentation'),
325 renderer: function(value
) {
326 return value
.toString() + '%';
331 header
: gettext('Health'),
332 renderer
: PVE
.Utils
.render_zfs_health
,
336 header
: gettext('Deduplication'),
338 renderer: function(value
) {
339 return value
.toFixed(2).toString() + 'x';
350 text
: gettext('Reload'),
351 iconCls
: 'fa fa-refresh',
352 handler: function() {
353 this.up('panel').reload();
357 text
: gettext('Create') + ': ZFS',
358 handler: function() {
359 let view
= this.up('panel');
360 Ext
.create('PVE.node.CreateZFS', {
361 nodename
: view
.nodename
,
363 destroy
: () => view
.reload(),
370 text
: gettext('Detail'),
373 handler: function() {
374 let view
= this.up('panel');
375 let selection
= view
.getSelection();
376 if (selection
.length
) {
377 view
.show_detail(selection
[0].get('name'));
383 show_detail: function(zpool
) {
386 let detailsgrid
= Ext
.create('PVE.node.ZFSStatus', {
388 nodename
: me
.nodename
,
392 let devicetree
= Ext
.create('PVE.node.ZFSDevices', {
393 title
: gettext('Devices'),
394 nodename
: me
.nodename
,
399 Ext
.create('Ext.window.Window', {
405 title
: gettext('Status') + ': ' + zpool
,
420 text
: gettext('Reload'),
421 iconCls
: 'fa fa-refresh',
422 handler: function() {
424 detailsgrid
.reload();
434 set_button_status: function() {
445 activate: function() {
448 selectionchange: function() {
449 this.down('#detailbtn').setDisabled(this.getSelection().length
=== 0);
451 itemdblclick: function(grid
, record
) {
452 this.show_detail(record
.get('name'));
456 initComponent: function() {
459 me
.nodename
= me
.pveSelNode
.data
.node
;
461 throw "no node name specified";
466 fields
: ['name', 'size', 'free', 'alloc', 'dedup', 'frag', 'health'],
469 url
: `/api2/json/nodes/${me.nodename}/disks/zfs`,
477 Proxmox
.Utils
.monStoreErrors(me
, me
.getStore(), true);