]> git.datanom.net - omvzfs.git/blame - gui/js/omv/module/admin/storage/zfs/Overview.js
Support for cloned filesystems and volumes.
[omvzfs.git] / gui / js / omv / module / admin / storage / zfs / Overview.js
CommitLineData
6b3ce31b 1// require("js/omv/tree/Panel.js")
3415404c 2// require("js/omv/module/admin/storage/zfs/TreePanel.js")
6b3ce31b 3// require("js/omv/workspace/window/Grid.js")
42856e8b
NB
4// require("js/omv/form/field/CheckboxGrid.js")
5
54b9d43e
NB
6Ext.define("OMV.module.admin.storage.zfs.ShowDetails", {
7 extend: "OMV.workspace.window.Form",
8 requires: [
9 "OMV.data.Store",
10 "OMV.data.Model",
11 "OMV.data.proxy.Rpc",
12 ],
13
14 rpcService: "ZFS",
15 title: _("Object details"),
16 autoLoadData: true,
17 hideResetButton: true,
18 hideCancelButton: true,
19 width: 550,
20 height: 350,
21 layout: 'fit',
22 okButtonText: _("Ok"),
23
24 getFormItems: function() {
25 var me = this;
26
27 return [{
28 xtype: "textareafield",
29 name: "details",
30 grow: true,
31 anchor: '100%',
32 readOnly: true
33 }];
34
35 }
36});
37
42856e8b
NB
38Ext.define("OMV.module.admin.storage.zfs.AddPool", {
39 extend: "OMV.workspace.window.Form",
40 requires: [
41 "OMV.data.Store",
42 "OMV.data.Model",
43 "OMV.data.proxy.Rpc",
44 "OMV.form.field.CheckboxGrid"
45 ],
46
47 rpcService: "ZFS",
48 rpcSetMethod: "addPool",
49 title: _("Create ZFS pool"),
50 autoLoadData: false,
51 hideResetButton: true,
52 width: 550,
7d6b772c 53 height: 350,
42856e8b
NB
54
55 getFormItems: function() {
56 var me = this;
57 return [{
58 xtype: "textfield",
59 name: "name",
60 fieldLabel: _("Name")
61 },{
62 xtype: "combo",
63 name: "pooltype",
64 fieldLabel: _("Pool type"),
65 queryMode: "local",
66 store: Ext.create("Ext.data.ArrayStore", {
67 fields: [ "value", "text" ],
68 data: [
69 [ "basic", _("Basic") ],
70 [ "mirror", _("Mirror") ],
71 [ "raidz1", _("RAID-Z1") ],
72 [ "raidz2", _("RAID-Z2") ],
73 [ "raidz3", _("RAID-Z3") ]
74 ]
75 }),
76 displayField: "text",
77 valueField: "value",
78 allowBlank: false,
79 editable: false,
80 triggerAction: "all",
81 value: "raidz1",
82 listeners: {
83 scope: me,
84 change: function(combo, value) {
85 var devicesField = this.findField("devices");
86 switch(value) {
7d6b772c
NB
87 case "basic":
88 devicesField.minSelections = 1;
42856e8b 89 break;
7d6b772c
NB
90 case "mirror":
91 devicesField.minSelections = 2;
42856e8b 92 break;
7d6b772c
NB
93 case "raidz1":
94 devicesField.minSelections = 3;
42856e8b 95 break;
7d6b772c
NB
96 case "raidz2":
97 devicesField.minSelections = 4;
47e63d33 98 break;
7d6b772c
NB
99 case "raidz3":
100 devicesField.minSelections = 5;
101 break;
102 default:
103 devicesField.minSelections = 2;
42856e8b
NB
104 break;
105 }
106 devicesField.validate();
107 }
108 }
109 },{
110 xtype: "checkboxgridfield",
111 name: "devices",
112 fieldLabel: _("Devices"),
113 valueField: "devicefile",
114 minSelections: 3, // Min. number of devices for RAIDZ-1
115 useStringValue: true,
116 height: 130,
117 store: Ext.create("OMV.data.Store", {
118 autoLoad: true,
119 model: OMV.data.Model.createImplicit({
120 idProperty: "devicefile",
121 fields: [
122 { name: "devicefile", type: "string" },
123 { name: "size", type: "string" },
124 { name: "vendor", type: "string" },
125 { name: "serialnumber", type: "string" }
126 ]
127 }),
128 proxy: {
129 type: "rpc",
130 appendSortParams: false,
131 rpcData: {
132 service: "RaidMgmt",
133 method: "getCandidates"
134 }
135 },
136 sorters: [{
137 direction: "ASC",
138 property: "devicefile"
139 }]
140 }),
141 gridConfig: {
142 stateful: true,
143 stateId: "1866b5d0-327e-11e4-8c21-0800200c9a66",
144 columns: [{
145 text: _("Device"),
146 sortable: true,
147 dataIndex: "devicefile",
148 stateId: "devicefile",
149 flex: 1
150 },{
151 xtype: "binaryunitcolumn",
152 text: _("Capacity"),
153 sortable: true,
154 dataIndex: "size",
155 stateId: "size",
156 width: 50,
157 flex: 1
158 },{
159 text: _("Vendor"),
160 sortable: true,
161 dataIndex: "vendor",
162 stateId: "vendor",
163 flex: 1
164 },{
165 text: _("Serial Number"),
166 sortable: true,
167 dataIndex: "serialnumber",
168 stateId: "serialnumber",
169 flex: 1
170 }]
171 }
c6117b32
NB
172 },{
173 xtype: "textfield",
174 name: "mountpoint",
175 fieldLabel: _("Mountpoint"),
176 plugins: [{
177 ptype: "fieldinfo",
178 text: _("Optional mountpoint for the pool. Default is to use pool name.")
179 }]
7d6b772c
NB
180 },{
181 xtype: "checkbox",
182 name: "force",
183 fieldLabel: _("Force creation"),
184 checked: false,
cc1caa78
NB
185 plugins: [{
186 ptype: "fieldinfo",
187 text: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
188 }]
42856e8b
NB
189 }];
190 },
191
192 doSubmit: function() {
193 var me = this;
194 OMV.MessageBox.show({
195 title: _("Confirmation"),
196 msg: _("Do you really want to create the ZFS pool?"),
197 buttons: Ext.Msg.YESNO,
198 fn: function(answer) {
199 if(answer === "no")
200 return;
201 me.superclass.doSubmit.call(me);
202 },
203 scope: me,
204 icon: Ext.Msg.QUESTION
205 });
206 }
207});
6b3ce31b 208
3415404c 209Ext.define("OMV.module.admin.storage.zfs.AddObject", {
6b3ce31b
MR
210 extend: "OMV.workspace.window.Form",
211 uses: [
212 "OMV.data.Store",
213 "OMV.data.Model",
214 "OMV.data.proxy.Rpc",
215 "OMV.data.reader.RpcArray"
216 ],
217
218 rpcService: "ZFS",
219 rpcSetMethod: "addObject",
220 width: 420,
221
222 getFormItems: function() {
223 var me = this;
bcf5fe52
NB
224
225 var store = new Ext.data.ArrayStore({
226 autoDestroy: true,
227 storeId: 'my_store',
228 fields: [
229 {name: 'value', type: 'string'},
230 {name: 'display', type: 'string'}
231 ]
232 });
233
234 var combodata;
235 if (me.parenttype === "Snapshot") {
236 combodata = [["clone","Clone"]];
237 } else if (me.parenttype === "Volume") {
238 combodata = [["snapshot", "Snapshot"]];
239 } else {
240 combodata = [["filesystem","Filesystem"],
241 ["volume","Volume"],
242 ["snapshot","Snapshot"]];
243 }
244 store.loadData(combodata,false);
245
6b3ce31b
MR
246 return [{
247 xtype: "combo",
248 name: "type",
249 fieldLabel: _("Object Type"),
250 queryMode: "local",
bcf5fe52 251 store: store,
6b3ce31b
MR
252 allowBlank: true,
253 editable: false,
254 triggerAction: "all",
bcf5fe52
NB
255 valueField: "value",
256 displayField: "display",
257 value: combodata[0][0],
6b3ce31b
MR
258 listeners: {
259 scope: me,
260 change: function(combo, value) {
261 var sizeField = this.findField("size");
bcf5fe52
NB
262 var cloneField = this.findField("clonename");
263 var nameField = this.findField("name");
6b3ce31b
MR
264 switch(value) {
265 case "volume":
266 sizeField.show();
bcf5fe52
NB
267 sizeField.allowBlank = false;
268 cloneField.hide();
269 nameField.show();
6b3ce31b 270 break;
bcf5fe52
NB
271 case "clone":
272 sizeField.hide();
273 sizeField.allowBlank = true;
274 cloneField.show();
275 nameField.hide();
6b3ce31b
MR
276 default:
277 sizeField.hide();
bcf5fe52
NB
278 sizeField.allowBlank = true;
279 cloneField.hide();
280 nameField.show();
6b3ce31b
MR
281 break;
282 }
283 sizeField.validate();
284 }
285 }
286 },{
287 xtype: "textfield",
288 name: "path",
289 fieldLabel: _("Prefix"),
290 allowBlank: false,
a01b6467 291 readOnly: true,
bcf5fe52
NB
292 value: me.path,
293 listeners: {
294 scope: me,
295 beforerender: function(e, eOpts) {
296 var pathField = this.findField("path");
297 if (me.parenttype === "Snapshot") {
298 pathField.fieldLabel = _("Snapshot to clone");
299 } else {
300 pathField.fieldLabel = _("Prefix");
301 }
302 }
303 }
6b3ce31b
MR
304 },{
305 xtype: "textfield",
306 name: "name",
bcf5fe52 307 id: "name",
6b3ce31b
MR
308 fieldLabel: _("Name"),
309 allowBlank: false,
310 plugins: [{
311 ptype: "fieldinfo",
312 text: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
bcf5fe52
NB
313 }],
314 listeners: {
315 scope: me,
316 beforerender: function(e, eOpts) {
317 var nameField = this.findField("name");
318 if (me.parenttype === "Snapshot") {
319 nameField.hide();
320 nameField.allowBlank = true;
321 } else {
322 nameField.show();
323 nameField.allowBlank = false;
324 }
325 }
326 }
327 },{
328 xtype: "textfield",
329 name: "clonename",
330 id: "clonename",
331 fieldLabel: _("Clone name"),
332 allowBlank: false,
333 plugins: [{
334 ptype: "fieldinfo",
335 text: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.")
336 }],
337 listeners: {
338 scope: me,
339 beforerender: function(e, eOpts) {
340 var cloneField = this.findField("clonename");
341 if (me.parenttype === "Snapshot") {
342 cloneField.show();
343 cloneField.allowBlank = false;
344 } else {
345 cloneField.hide();
346 cloneField.allowBlank = true;
347 }
348 }
349 }
6b3ce31b
MR
350 },{
351 xtype: "textfield",
352 name: "size",
bcf5fe52 353 id: "size",
6b3ce31b
MR
354 hidden: true,
355 fieldLabel: _("Size"),
356 allowBlank: true,
357 plugins: [{
358 ptype: "fieldinfo",
359 text: _("Size of the volume e.g. 5mb,100gb,1tb etc")
360 }]
361 }];
362 }
363});
364
a6c3a4dd
NB
365Ext.define("OMV.module.admin.storage.zfs.ExpandPool", {
366 extend: "OMV.workspace.window.Form",
367 uses: [
368 "OMV.data.Store",
369 "OMV.data.Model",
370 "OMV.data.proxy.Rpc",
371 "OMV.data.reader.RpcArray"
372 ],
373
374 rpcService: "ZFS",
375 rpcSetMethod: "expandPool",
376 width: 550,
377 height: 350,
378 autoLoadData: true,
379
380 getFormItems: function() {
381 var me = this;
382 return [{
383 xtype: "textfield",
384 name: "name",
385 fieldLabel: _("Name"),
386 allowBlank: false,
387 readOnly: true,
388 value: me.name
389 },{
77a007e0
NB
390 xtype: "combo",
391 name: "vdevtype",
392 fieldLabel: _("Vdev type"),
393 queryMode: "local",
394 store: Ext.create("Ext.data.ArrayStore", {
395 fields: [ "value", "text" ],
396 data: [
397 [ "basic", _("Basic") ],
398 [ "mirror", _("Mirror") ],
399 [ "raidz1", _("RAID-Z1") ],
400 [ "raidz2", _("RAID-Z2") ],
401 [ "raidz3", _("RAID-Z3") ]
402 ]
403 }),
404 displayField: "text",
405 valueField: "value",
a6c3a4dd 406 allowBlank: false,
77a007e0
NB
407 editable: false,
408 triggerAction: "all",
409 value: "raidz1",
410 listeners: {
411 scope: me,
412 change: function(combo, value) {
413 var devicesField = this.findField("devices");
414 switch(value) {
415 case "basic":
416 devicesField.minSelections = 1;
417 break;
418 case "mirror":
419 devicesField.minSelections = 2;
420 break;
421 case "raidz1":
422 devicesField.minSelections = 3;
423 break;
424 case "raidz2":
425 devicesField.minSelections = 4;
47e63d33 426 break;
77a007e0
NB
427 case "raidz3":
428 devicesField.minSelections = 5;
429 break;
430 default:
431 devicesField.minSelections = 2;
432 break;
433 }
434 devicesField.validate();
435 }
436 }
a6c3a4dd
NB
437 },{
438 xtype: "checkboxgridfield",
439 name: "devices",
440 fieldLabel: _("Devices"),
441 valueField: "devicefile",
77a007e0 442 minSelections: 3, // Min. number of devices for RAIDZ-1
a6c3a4dd
NB
443 useStringValue: true,
444 height: 130,
445 store: Ext.create("OMV.data.Store", {
446 autoLoad: true,
447 model: OMV.data.Model.createImplicit({
448 idProperty: "devicefile",
449 fields: [
450 { name: "devicefile", type: "string" },
451 { name: "size", type: "string" },
452 { name: "vendor", type: "string" },
453 { name: "serialnumber", type: "string" }
454 ]
455 }),
456 proxy: {
457 type: "rpc",
458 appendSortParams: false,
459 rpcData: {
460 service: "RaidMgmt",
461 method: "getCandidates"
462 }
463 },
464 sorters: [{
465 direction: "ASC",
466 property: "devicefile"
467 }]
468 }),
469 gridConfig: {
470 stateful: true,
77a007e0 471 stateId: "05c60750-5074-11e4-916c-0800200c9a66",
a6c3a4dd
NB
472 columns: [{
473 text: _("Device"),
474 sortable: true,
475 dataIndex: "devicefile",
476 stateId: "devicefile",
477 flex: 1
478 },{
479 xtype: "binaryunitcolumn",
480 text: _("Capacity"),
481 sortable: true,
482 dataIndex: "size",
483 stateId: "size",
484 width: 50,
485 flex: 1
486 },{
487 text: _("Vendor"),
488 sortable: true,
489 dataIndex: "vendor",
490 stateId: "vendor",
491 flex: 1
492 },{
493 text: _("Serial Number"),
494 sortable: true,
495 dataIndex: "serialnumber",
496 stateId: "serialnumber",
497 flex: 1
498 }]
499 }
47e63d33
NB
500 },{
501 xtype: "checkbox",
502 name: "force",
503 fieldLabel: _("Force creation"),
504 checked: false,
505 plugins: [{
506 ptype: "fieldinfo",
507 text: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
508 }]
a6c3a4dd
NB
509 }];
510 }
511});
6b3ce31b
MR
512
513
3415404c 514Ext.define("OMV.module.admin.storage.zfs.EditProperties", {
6b3ce31b
MR
515 extend: "OMV.workspace.window.Grid",
516 requires: [
517 "OMV.data.Store",
518 "OMV.data.Model",
519 "OMV.data.proxy.Rpc"
520 ],
521
522 rpcService: "ZFS",
523 rpcSetMethod: "setProperties",
524
525 title: _("Edit properties"),
526 width: 500,
527 height: 305,
528
529 getGridConfig: function() {
530 var me = this;
531
532 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
533 clicksToEdit: 1,
534 pluginId: 'rowEditing',
535 listeners: {
536 validateedit: function(editor, e, eOpts) {
537 e.record.set("modified", "true");
538 },
539 beforeedit: function(editor, e, eOpts) {
cc1caa78 540 if (e.record.get("newproperty") === "false") {
6b3ce31b
MR
541 e.grid.getPlugin('rowEditing').editor.form.findField("value").enable();
542 e.grid.getPlugin('rowEditing').editor.form.findField("property").disable();
543 } else {
544 e.grid.getPlugin('rowEditing').editor.form.findField("value").enable();
545 e.grid.getPlugin('rowEditing').editor.form.findField("property").enable();
546 }
547 }
548
549 }
550 });
551
552 var store = Ext.create("OMV.data.Store", {
553 autoLoad: true,
554 model: OMV.data.Model.createImplicit({
555 fields: [
556 { name: "property", type: "string" },
557 { name: "value", type: "string" },
558 { name: "source", type: "string" },
559 { name: "modified", type: "string" },
560 { name: "newproperty", type: "string", defaultValue: "false" }
561 ]
562 }),
563 proxy: {
564 type: "rpc",
565 rpcData: {
566 service: "ZFS",
567 method: "getProperties",
568 params: {
569 name: me.name,
570 type: me.type
571 }
572 }
573 }
574 });
575
576 return {
577 border: false,
578 stateful: true,
579 stateId: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
580 selType: 'rowmodel',
581 plugins: [rowEditing],
582 store: store,
583 tbar: [{
584 text: "Add property",
585 icon: "images/add.png",
586 iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
587 handler: function(view) {
588 Ext.define('Property', {
589 extend: 'Ext.data.Model',
590 fields: [
591 "property",
592 "value",
593 "source",
594 "modified",
595 "newproperty"
596 ]
597 });
598 var newProperty = Ext.create("Property", {
599 property: "",
600 value: "",
601 source: "local",
602 modified: "true",
38408c3f 603 newproperty: "true"
6b3ce31b
MR
604 });
605 rowEditing.cancelEdit();
606 store.insert(0, newProperty);
607 rowEditing.startEdit();
608 }
609 }],
610 columns: [{
611 text: _("Property"),
612 sortable: true,
613 dataIndex: "property",
614 stateId: "property",
615 editor: {
616 xtype: "textfield",
617 allowBlank: false,
618 }
619 },{
620 text: _("Value"),
621 sortable: true,
622 dataIndex: "value",
623 stateId: "value",
624 flex: 1,
625 readOnly: true,
626 editor: {
627 xtype: "textfield",
628 allowBlank: false,
629 }
630 },{
631 text: _("Source"),
632 sortable: true,
633 dataIndex: "source",
634 stateId: "source",
635 },{
636 xtype: 'actioncolumn',
637 header: 'Inherit',
638 icon: "images/checkmark.png",
639 tooltip: "Inherit",
640 handler: function(view, rowIndex, colIndex, item, e, record, row) {
641 OMV.RpcObserver.request({
642 msg : _("Updating property..."),
643 rpcData : {
644 service: "ZFS",
645 method: "inherit",
646 params: {
647 name: me.name,
648 type: me.type,
649 property: record.get("property")
650 }
651 },
652 finish : function() {
653 view.getStore().reload();
654 }
655 });
656 },
657 isDisabled: function(view, rowIdx, colIdx, item, record) {
658 var src = record.get("source");
659 if(src === "local") {
660 return false;
661 } else {
662 return true;
663 }
664 }
665 },{
666 text: _("New"),
667 dataIndex: "newproperty",
668 stateId: "newproperty",
669 sortable: false,
670 hidden: true
38408c3f 671 },{
6b3ce31b
MR
672 text: _("Modified"),
673 sortable: false,
674 dataIndex: "modified",
675 stateId: "modified",
676 hidden: true
677 }],
678 };
679 },
680
681 getRpcSetParams: function() {
682 var me = this;
683 var properties = [];
684 var values = me.getValues();
685 Ext.Array.each(values, function(value) {
686 if(value.modified === "false")
38408c3f 687 return;
6b3ce31b
MR
688 properties.push({
689 "property": value.property,
690 "value": value.value,
691 });
692 });
693 return {
694 name: me.name,
695 type: me.type,
696 properties: properties
697 };
698 }
699
700});
701
702
3415404c 703Ext.define("OMV.module.admin.storage.zfs.CreateShare", {
6b3ce31b
MR
704 extend: "OMV.workspace.window.Form",
705 uses: [
706 "OMV.data.Store",
707 "OMV.data.Model",
708 "OMV.data.proxy.Rpc",
709 "OMV.data.reader.RpcArray"
710 ],
711
712 rpcService: "ZFS",
713 rpcSetMethod: "createShare",
714 width: 500,
715
716 getFormItems: function() {
717 var me = this;
718 return [{
719 xtype: "textfield",
720 name: "sharename",
721 fieldLabel: _("Name"),
722 allowBlank: false,
723 },{
724 xtype: "textfield",
725 name: "mountpoint",
726 fieldLabel: _("Path"),
cc1caa78
NB
727 allowBlank: true,
728 readOnly: false
6b3ce31b
MR
729 },{
730 xtype: "combo",
731 name: "mode",
732 fieldLabel: _("Permissions"),
733 queryMode: "local",
734 store: Ext.create("Ext.data.ArrayStore", {
735 fields: [ "value", "text" ],
736 data: [
737 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
738 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
739 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
740 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
741 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
742 [ "777", _("Everyone: read/write") ]
743 ]
744 }),
745 displayField: "text",
746 valueField: "value",
747 allowBlank: false,
748 editable: false,
749 showItemTooltip: true,
750 triggerAction: "all",
751 value: "775",
752 plugins: [{
753 ptype: "fieldinfo",
754 text: _("The file mode of the shared folder path.")
755 }]
756 },{
757 xtype: "textarea",
758 name: "comment",
759 fieldLabel: _("Comment"),
760 allowBlank: true
761 },{
762 xtype: "textarea",
763 name: "name",
764 hidden: true
765 },{
766 xtype: "textarea",
767 name: "type",
768 hidden: true
769 }];
770 }
771});
772
773
774
38408c3f
MR
775Ext.define("OMV.module.admin.storage.zfs.Overview", {
776 extend: "OMV.module.admin.storage.zfs.TreePanel",
6b3ce31b
MR
777
778 rpcService: "ZFS",
779 rpcGetMethod: "getObjectTree",
780 requires: [
781 "OMV.data.Store",
782 "OMV.data.Model",
783 "OMV.data.proxy.Rpc"
784 ],
785
786 rootVisible: false,
787 stateful: true,
788 stateId: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
789
790 columns: [{
791 text: _("Name"),
792 xtype: 'treecolumn',
793 dataIndex: 'name',
794 sortable: true,
795 flex: 2,
bcf5fe52
NB
796 stateId: 'name',
797 renderer: function(value, p, r){
798 if (r.data['origin'] === "n/a") {
799 return r.data['name'];
800 } else {
801 return r.data['name'] + ' (' + r.data['origin'] + ')';
802 }
803 }
6b3ce31b
MR
804 },{
805 text: _("Type"),
806 dataIndex: 'type',
807 sortable: true,
808 flex: 1,
a6c3a4dd
NB
809 stateId: 'type',
810 renderer: function(value, p, r){
bcf5fe52 811 if (r.data['origin'] === "n/a") {
a6c3a4dd 812 return r.data['type'];
bcf5fe52
NB
813 } else {
814 return 'Clone';
a6c3a4dd
NB
815 }
816 }
54b9d43e
NB
817 },{
818 text: _("Size"),
819 dataIndex: 'size',
820 sortable: true,
821 flex: 1,
822 stateId: 'size'
823 },{
824 text: _("Used"),
825 dataIndex: 'used',
826 sortable: true,
827 flex: 1,
828 stateId: 'used'
829 },{
830 text: _("Available"),
831 dataIndex: 'available',
832 sortable: true,
833 flex: 1,
834 stateId: 'available'
835 },{
836 text: _("Mountpoint"),
837 dataIndex: 'mountpoint',
838 sortable: true,
839 flex: 1,
840 stateId: 'mountpoint'
6b3ce31b
MR
841 },{
842 text: _("Share"),
843 xtype: 'actioncolumn',
844 tooltip: 'Create shared folder',
845 align: 'center',
846 icon: 'images/checkmark.png',
847 handler: function(view, rowIndex, colIndex, item, e, record, row) {
848 var me = this;
38408c3f 849 Ext.create("OMV.module.admin.storage.zfs.CreateShare", {
6b3ce31b
MR
850 title: _("Create shared folder"),
851 rpcGetMethod: "getSharedParams",
852 rpcGetParams: {
853 name: record.get('path'),
854 type: record.get('type')
855 }
856 }).show();
857 },
858 isDisabled: function(view, rowIdx, colIdx, item, record) {
859 var src = record.get("type");
860 if((src === "Filesystem") && (record.get("shared") === "false")) {
861 return false;
862 } else {
863 return true;
864 }
865 }
6b3ce31b
MR
866 },{
867 text: _("Details"),
868 xtype: 'actioncolumn',
869 tooltip: 'Details',
870 align: 'center',
54b9d43e
NB
871 icon: 'images/search.png',
872 handler: function(view, rowIndex, colIndex, item, e, record, row) {
873 var me = this;
874 Ext.create("OMV.module.admin.storage.zfs.ShowDetails", {
875 title: _("Object details"),
876 rpcGetMethod: "getObjectDetails",
877 rpcGetParams: {
878 name: record.get('path'),
879 type: record.get('type')
880 }
881 }).show();
882 }
6b3ce31b
MR
883 },{
884 text: _("Shared"),
885 dataIndex: 'shared',
886 sortable: false,
887 stateId: 'shared',
888 hidden: true
889 }],
890
891 initComponent: function() {
892 var me = this;
893 this.width = 600;
894 Ext.apply(me, {
895 store: Ext.create("Ext.data.TreeStore", {
896 autoLoad: true,
897 model: OMV.data.Model.createImplicit({
898 fields: [
899 { name: "name", type: "string" },
900 { name: "type", type: "string" },
54b9d43e
NB
901 { name: "size", type: "string" },
902 { name: "used", type: "string" },
903 { name: "available", type: "string" },
904 { name: "mountpoint", type: "string" },
6b3ce31b
MR
905 { name: "id", type: "string" },
906 { name: "path", type: "string" },
907 { name: "origin", type: "string", defaultValue: "none" },
a6c3a4dd
NB
908 { name: "shared", type: "string", defaultValue: "false" },
909 { name: "pool_type", type: "string"},
910 { name: "nr_disks", type: "string"}
6b3ce31b
MR
911 ]
912 }),
913 proxy: {
914 type: "rpc",
915 rpcData: {
916 service: "ZFS",
917 method: "getObjectTree",
918 }
919 },
920 folderSort: true
921 })
922 });
923 me.callParent(arguments);
924 },
925
7d6b772c 926 onAddButton: function() {
42856e8b
NB
927 var me = this;
928 Ext.create("OMV.module.admin.storage.zfs.AddPool", {
929 listeners: {
930 scope: me,
931 submit: function() {
932 this.doReload();
933 }
934 }
935 }).show();
936 },
937
6b3ce31b
MR
938 onAddObjButton: function() {
939 var me = this;
940 var sm = me.getSelectionModel();
941 var records = sm.getSelection();
38408c3f
MR
942 var record = records[0];
943 Ext.create("OMV.module.admin.storage.zfs.AddObject", {
6b3ce31b 944 title: _("Add Object"),
a01b6467 945 path: record.get("path"),
bcf5fe52 946 parenttype: record.get("type"),
6b3ce31b
MR
947 listeners: {
948 scope: me,
949 submit: function() {
950 this.doReload();
951 }
952 }
953 }).show();
954 },
955
956 onEditButton: function() {
957 var me = this;
958 var sm = me.getSelectionModel();
959 var records = sm.getSelection();
960 var record = records[0];
38408c3f 961 Ext.create("OMV.module.admin.storage.zfs.EditProperties", {
6b3ce31b
MR
962 name: record.get("path"),
963 type: record.get("type")
964 }).show();
965 },
a6c3a4dd
NB
966
967 onExpandPoolButton: function() {
968 var me = this;
969 var sm = me.getSelectionModel();
970 var records = sm.getSelection();
971 var record = records[0];
972 Ext.create("OMV.module.admin.storage.zfs.ExpandPool", {
973 title: _("Expand Pool"),
974 name: record.get("path"),
a6c3a4dd
NB
975 listeners: {
976 scope: me,
977 submit: function() {
978 this.doReload();
979 }
980 }
981 }).show();
982 },
6b3ce31b
MR
983
984 doDeletion: function(record) {
985 var me = this;
986 OMV.Rpc.request({
987 scope: me,
988 callback: me.onDeletion,
989 rpcData: {
990 service: "ZFS",
991 method: "deleteObject",
992 params: {
993 name: record.get('path'),
994 type: record.get('type')
995 }
996 }
997 });
998 }
999
1000});
1001
1002OMV.WorkspaceManager.registerPanel({
1003 id: "overview",
38408c3f 1004 path: "/storage/zfs",
6b3ce31b
MR
1005 text: _("Overview"),
1006 position: 10,
38408c3f 1007 className: "OMV.module.admin.storage.zfs.Overview"
6b3ce31b
MR
1008});
1009
1010
1011
This page took 0.196223 seconds and 5 git commands to generate.