]> git.datanom.net - omvzfs.git/blob - gui/js/omv/module/admin/storage/zfs/Overview.js
4acc897bbcc6f3c402d0a6d243c7408dd0961475
[omvzfs.git] / gui / js / omv / module / admin / storage / zfs / Overview.js
1 // require("js/omv/tree/Panel.js")
2 // require("js/omv/module/admin/storage/zfs/TreePanel.js")
3 // require("js/omv/workspace/window/Grid.js")
4 // require("js/omv/form/field/CheckboxGrid.js")
5
6 Ext.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
38 Ext.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,
53 height: 350,
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) {
87 case "basic":
88 devicesField.minSelections = 1;
89 break;
90 case "mirror":
91 devicesField.minSelections = 2;
92 break;
93 case "raidz1":
94 devicesField.minSelections = 3;
95 break;
96 case "raidz2":
97 devicesField.minSelections = 4;
98 break;
99 case "raidz3":
100 devicesField.minSelections = 5;
101 break;
102 default:
103 devicesField.minSelections = 2;
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 }
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 }]
180 },{
181 xtype: "checkbox",
182 name: "force",
183 fieldLabel: _("Force creation"),
184 checked: false,
185 plugins: [{
186 ptype: "fieldinfo",
187 text: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
188 }]
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 });
208
209 Ext.define("OMV.module.admin.storage.zfs.AddObject", {
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;
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
246 return [{
247 xtype: "combo",
248 name: "type",
249 fieldLabel: _("Object Type"),
250 queryMode: "local",
251 store: store,
252 allowBlank: true,
253 editable: false,
254 triggerAction: "all",
255 valueField: "value",
256 displayField: "display",
257 value: combodata[0][0],
258 listeners: {
259 scope: me,
260 change: function(combo, value) {
261 var sizeField = this.findField("size");
262 var cloneField = this.findField("clonename");
263 var nameField = this.findField("name");
264 var mountField = this.findField("mountpoint");
265 switch(value) {
266 case "filesystem":
267 sizeField.hide();
268 sizeField.allowBlank = true;
269 cloneField.hide();
270 nameField.show();
271 mountField.show();
272 case "volume":
273 sizeField.show();
274 sizeField.allowBlank = false;
275 cloneField.hide();
276 nameField.show();
277 mountField.hide();
278 break;
279 case "clone":
280 sizeField.hide();
281 sizeField.allowBlank = true;
282 cloneField.show();
283 nameField.hide();
284 mountField.hide();
285 default:
286 sizeField.hide();
287 sizeField.allowBlank = true;
288 cloneField.hide();
289 nameField.show();
290 mountField.hide();
291 break;
292 }
293 sizeField.validate();
294 }
295 }
296 },{
297 xtype: "textfield",
298 name: "path",
299 fieldLabel: _("Prefix"),
300 allowBlank: false,
301 readOnly: true,
302 value: me.path,
303 listeners: {
304 scope: me,
305 beforerender: function(e, eOpts) {
306 var pathField = this.findField("path");
307 if (me.parenttype === "Snapshot") {
308 pathField.fieldLabel = _("Snapshot to clone");
309 } else {
310 pathField.fieldLabel = _("Prefix");
311 }
312 }
313 }
314 },{
315 xtype: "textfield",
316 name: "name",
317 id: "name",
318 fieldLabel: _("Name"),
319 allowBlank: false,
320 plugins: [{
321 ptype: "fieldinfo",
322 text: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
323 }],
324 listeners: {
325 scope: me,
326 beforerender: function(e, eOpts) {
327 var nameField = this.findField("name");
328 if (me.parenttype === "Snapshot") {
329 nameField.hide();
330 nameField.allowBlank = true;
331 } else {
332 nameField.show();
333 nameField.allowBlank = false;
334 }
335 }
336 }
337 },{
338 xtype: "textfield",
339 name: "mountpoint",
340 fieldLabel: _("Mountpoint"),
341 allowBlank: true,
342 plugins: [{
343 ptype: "fieldinfo",
344 text: _("Optional mountpoint of the filesystem. If left blank parent mountpoint will be prepended to name of the filesystem.")
345 }],
346 listeners: {
347 scope: me,
348 beforerender: function(e, eOpts) {
349 var mountField = this.findField("mountpoint");
350 if (combodata[0][0] === "filesystem") {
351 mountField.show();
352 } else {
353 mountField.hide();
354 }
355 }
356 }
357 },{
358 xtype: "textfield",
359 name: "clonename",
360 id: "clonename",
361 fieldLabel: _("Clone name"),
362 allowBlank: false,
363 plugins: [{
364 ptype: "fieldinfo",
365 text: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.")
366 }],
367 listeners: {
368 scope: me,
369 beforerender: function(e, eOpts) {
370 var cloneField = this.findField("clonename");
371 if (me.parenttype === "Snapshot") {
372 cloneField.show();
373 cloneField.allowBlank = false;
374 } else {
375 cloneField.hide();
376 cloneField.allowBlank = true;
377 }
378 }
379 }
380 },{
381 xtype: "textfield",
382 name: "size",
383 id: "size",
384 hidden: true,
385 fieldLabel: _("Size"),
386 allowBlank: true,
387 plugins: [{
388 ptype: "fieldinfo",
389 text: _("Size of the volume e.g. 5mb,100gb,1tb etc")
390 }]
391 }];
392 }
393 });
394
395 Ext.define("OMV.module.admin.storage.zfs.ExpandPool", {
396 extend: "OMV.workspace.window.Form",
397 uses: [
398 "OMV.data.Store",
399 "OMV.data.Model",
400 "OMV.data.proxy.Rpc",
401 "OMV.data.reader.RpcArray"
402 ],
403
404 rpcService: "ZFS",
405 rpcSetMethod: "expandPool",
406 width: 550,
407 height: 350,
408 autoLoadData: true,
409
410 getFormItems: function() {
411 var me = this;
412 return [{
413 xtype: "textfield",
414 name: "name",
415 fieldLabel: _("Name"),
416 allowBlank: false,
417 readOnly: true,
418 value: me.name
419 },{
420 xtype: "combo",
421 name: "vdevtype",
422 fieldLabel: _("Vdev type"),
423 queryMode: "local",
424 store: Ext.create("Ext.data.ArrayStore", {
425 fields: [ "value", "text" ],
426 data: [
427 [ "basic", _("Basic") ],
428 [ "mirror", _("Mirror") ],
429 [ "raidz1", _("RAID-Z1") ],
430 [ "raidz2", _("RAID-Z2") ],
431 [ "raidz3", _("RAID-Z3") ]
432 ]
433 }),
434 displayField: "text",
435 valueField: "value",
436 allowBlank: false,
437 editable: false,
438 triggerAction: "all",
439 value: "raidz1",
440 listeners: {
441 scope: me,
442 change: function(combo, value) {
443 var devicesField = this.findField("devices");
444 switch(value) {
445 case "basic":
446 devicesField.minSelections = 1;
447 break;
448 case "mirror":
449 devicesField.minSelections = 2;
450 break;
451 case "raidz1":
452 devicesField.minSelections = 3;
453 break;
454 case "raidz2":
455 devicesField.minSelections = 4;
456 break;
457 case "raidz3":
458 devicesField.minSelections = 5;
459 break;
460 default:
461 devicesField.minSelections = 2;
462 break;
463 }
464 devicesField.validate();
465 }
466 }
467 },{
468 xtype: "checkboxgridfield",
469 name: "devices",
470 fieldLabel: _("Devices"),
471 valueField: "devicefile",
472 minSelections: 3, // Min. number of devices for RAIDZ-1
473 useStringValue: true,
474 height: 130,
475 store: Ext.create("OMV.data.Store", {
476 autoLoad: true,
477 model: OMV.data.Model.createImplicit({
478 idProperty: "devicefile",
479 fields: [
480 { name: "devicefile", type: "string" },
481 { name: "size", type: "string" },
482 { name: "vendor", type: "string" },
483 { name: "serialnumber", type: "string" }
484 ]
485 }),
486 proxy: {
487 type: "rpc",
488 appendSortParams: false,
489 rpcData: {
490 service: "RaidMgmt",
491 method: "getCandidates"
492 }
493 },
494 sorters: [{
495 direction: "ASC",
496 property: "devicefile"
497 }]
498 }),
499 gridConfig: {
500 stateful: true,
501 stateId: "05c60750-5074-11e4-916c-0800200c9a66",
502 columns: [{
503 text: _("Device"),
504 sortable: true,
505 dataIndex: "devicefile",
506 stateId: "devicefile",
507 flex: 1
508 },{
509 xtype: "binaryunitcolumn",
510 text: _("Capacity"),
511 sortable: true,
512 dataIndex: "size",
513 stateId: "size",
514 width: 50,
515 flex: 1
516 },{
517 text: _("Vendor"),
518 sortable: true,
519 dataIndex: "vendor",
520 stateId: "vendor",
521 flex: 1
522 },{
523 text: _("Serial Number"),
524 sortable: true,
525 dataIndex: "serialnumber",
526 stateId: "serialnumber",
527 flex: 1
528 }]
529 }
530 },{
531 xtype: "checkbox",
532 name: "force",
533 fieldLabel: _("Force creation"),
534 checked: false,
535 plugins: [{
536 ptype: "fieldinfo",
537 text: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
538 }]
539 }];
540 }
541 });
542
543
544 Ext.define("OMV.module.admin.storage.zfs.EditProperties", {
545 extend: "OMV.workspace.window.Grid",
546 requires: [
547 "OMV.data.Store",
548 "OMV.data.Model",
549 "OMV.data.proxy.Rpc"
550 ],
551
552 rpcService: "ZFS",
553 rpcSetMethod: "setProperties",
554
555 title: _("Edit properties"),
556 width: 500,
557 height: 305,
558
559 getGridConfig: function() {
560 var me = this;
561
562 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
563 clicksToEdit: 1,
564 pluginId: 'rowEditing',
565 listeners: {
566 validateedit: function(editor, e, eOpts) {
567 e.record.set("modified", "true");
568 },
569 beforeedit: function(editor, e, eOpts) {
570 if (e.record.get("newproperty") === "false") {
571 e.grid.getPlugin('rowEditing').editor.form.findField("value").enable();
572 e.grid.getPlugin('rowEditing').editor.form.findField("property").disable();
573 } else {
574 e.grid.getPlugin('rowEditing').editor.form.findField("value").enable();
575 e.grid.getPlugin('rowEditing').editor.form.findField("property").enable();
576 }
577 }
578
579 }
580 });
581
582 var store = Ext.create("OMV.data.Store", {
583 autoLoad: true,
584 model: OMV.data.Model.createImplicit({
585 fields: [
586 { name: "property", type: "string" },
587 { name: "value", type: "string" },
588 { name: "source", type: "string" },
589 { name: "modified", type: "string" },
590 { name: "newproperty", type: "string", defaultValue: "false" }
591 ]
592 }),
593 proxy: {
594 type: "rpc",
595 rpcData: {
596 service: "ZFS",
597 method: "getProperties",
598 params: {
599 name: me.name,
600 type: me.type
601 }
602 }
603 }
604 });
605
606 return {
607 border: false,
608 stateful: true,
609 stateId: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
610 selType: 'rowmodel',
611 plugins: [rowEditing],
612 store: store,
613 tbar: [{
614 text: "Add property",
615 icon: "images/add.png",
616 iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
617 handler: function(view) {
618 Ext.define('Property', {
619 extend: 'Ext.data.Model',
620 fields: [
621 "property",
622 "value",
623 "source",
624 "modified",
625 "newproperty"
626 ]
627 });
628 var newProperty = Ext.create("Property", {
629 property: "",
630 value: "",
631 source: "local",
632 modified: "true",
633 newproperty: "true"
634 });
635 rowEditing.cancelEdit();
636 store.insert(0, newProperty);
637 rowEditing.startEdit();
638 }
639 }],
640 columns: [{
641 text: _("Property"),
642 sortable: true,
643 dataIndex: "property",
644 stateId: "property",
645 editor: {
646 xtype: "textfield",
647 allowBlank: false,
648 }
649 },{
650 text: _("Value"),
651 sortable: true,
652 dataIndex: "value",
653 stateId: "value",
654 flex: 1,
655 readOnly: true,
656 editor: {
657 xtype: "textfield",
658 allowBlank: false,
659 }
660 },{
661 text: _("Source"),
662 sortable: true,
663 dataIndex: "source",
664 stateId: "source",
665 },{
666 xtype: 'actioncolumn',
667 header: 'Inherit',
668 icon: "images/checkmark.png",
669 tooltip: "Inherit",
670 handler: function(view, rowIndex, colIndex, item, e, record, row) {
671 OMV.RpcObserver.request({
672 msg : _("Updating property..."),
673 rpcData : {
674 service: "ZFS",
675 method: "inherit",
676 params: {
677 name: me.name,
678 type: me.type,
679 property: record.get("property")
680 }
681 },
682 finish : function() {
683 view.getStore().reload();
684 }
685 });
686 },
687 isDisabled: function(view, rowIdx, colIdx, item, record) {
688 var src = record.get("source");
689 if(src === "local") {
690 return false;
691 } else {
692 return true;
693 }
694 }
695 },{
696 text: _("New"),
697 dataIndex: "newproperty",
698 stateId: "newproperty",
699 sortable: false,
700 hidden: true
701 },{
702 text: _("Modified"),
703 sortable: false,
704 dataIndex: "modified",
705 stateId: "modified",
706 hidden: true
707 }],
708 };
709 },
710
711 getRpcSetParams: function() {
712 var me = this;
713 var properties = [];
714 var values = me.getValues();
715 Ext.Array.each(values, function(value) {
716 if(value.modified === "false")
717 return;
718 properties.push({
719 "property": value.property,
720 "value": value.value,
721 });
722 });
723 return {
724 name: me.name,
725 type: me.type,
726 properties: properties
727 };
728 }
729
730 });
731
732
733 Ext.define("OMV.module.admin.storage.zfs.CreateShare", {
734 extend: "OMV.workspace.window.Form",
735 uses: [
736 "OMV.data.Store",
737 "OMV.data.Model",
738 "OMV.data.proxy.Rpc",
739 "OMV.data.reader.RpcArray"
740 ],
741
742 rpcService: "ZFS",
743 rpcSetMethod: "createShare",
744 width: 500,
745
746 getFormItems: function() {
747 var me = this;
748 return [{
749 xtype: "textfield",
750 name: "sharename",
751 fieldLabel: _("Name"),
752 allowBlank: false,
753 },{
754 xtype: "textfield",
755 name: "mountpoint",
756 fieldLabel: _("Path"),
757 allowBlank: true,
758 readOnly: false
759 },{
760 xtype: "combo",
761 name: "mode",
762 fieldLabel: _("Permissions"),
763 queryMode: "local",
764 store: Ext.create("Ext.data.ArrayStore", {
765 fields: [ "value", "text" ],
766 data: [
767 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
768 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
769 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
770 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
771 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
772 [ "777", _("Everyone: read/write") ]
773 ]
774 }),
775 displayField: "text",
776 valueField: "value",
777 allowBlank: false,
778 editable: false,
779 showItemTooltip: true,
780 triggerAction: "all",
781 value: "775",
782 plugins: [{
783 ptype: "fieldinfo",
784 text: _("The file mode of the shared folder path.")
785 }]
786 },{
787 xtype: "textarea",
788 name: "comment",
789 fieldLabel: _("Comment"),
790 allowBlank: true
791 },{
792 xtype: "textarea",
793 name: "name",
794 hidden: true
795 },{
796 xtype: "textarea",
797 name: "type",
798 hidden: true
799 }];
800 }
801 });
802
803
804
805 Ext.define("OMV.module.admin.storage.zfs.Overview", {
806 extend: "OMV.module.admin.storage.zfs.TreePanel",
807
808 rpcService: "ZFS",
809 rpcGetMethod: "getObjectTree",
810 requires: [
811 "OMV.data.Store",
812 "OMV.data.Model",
813 "OMV.data.proxy.Rpc"
814 ],
815
816 rootVisible: false,
817 stateful: true,
818 stateId: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
819
820 columns: [{
821 text: _("Name"),
822 xtype: 'treecolumn',
823 dataIndex: 'name',
824 sortable: true,
825 flex: 2,
826 stateId: 'name',
827 renderer: function(value, p, r){
828 if (r.data['origin'] === "n/a") {
829 return r.data['name'];
830 } else {
831 return r.data['name'] + ' (' + r.data['origin'] + ')';
832 }
833 }
834 },{
835 text: _("Type"),
836 dataIndex: 'type',
837 sortable: true,
838 flex: 1,
839 stateId: 'type',
840 renderer: function(value, p, r){
841 if (r.data['origin'] === "n/a") {
842 return r.data['type'];
843 } else {
844 return 'Clone';
845 }
846 }
847 },{
848 text: _("Size"),
849 dataIndex: 'size',
850 sortable: true,
851 flex: 1,
852 stateId: 'size'
853 },{
854 text: _("Used"),
855 dataIndex: 'used',
856 sortable: true,
857 flex: 1,
858 stateId: 'used'
859 },{
860 text: _("Available"),
861 dataIndex: 'available',
862 sortable: true,
863 flex: 1,
864 stateId: 'available'
865 },{
866 text: _("Mountpoint"),
867 dataIndex: 'mountpoint',
868 sortable: true,
869 flex: 1,
870 stateId: 'mountpoint'
871 },{
872 text: _("Share"),
873 xtype: 'actioncolumn',
874 tooltip: 'Create shared folder',
875 align: 'center',
876 icon: 'images/checkmark.png',
877 handler: function(view, rowIndex, colIndex, item, e, record, row) {
878 var me = this;
879 Ext.create("OMV.module.admin.storage.zfs.CreateShare", {
880 title: _("Create shared folder"),
881 rpcGetMethod: "getSharedParams",
882 rpcGetParams: {
883 name: record.get('path'),
884 type: record.get('type')
885 }
886 }).show();
887 },
888 isDisabled: function(view, rowIdx, colIdx, item, record) {
889 var src = record.get("type");
890 if((src === "Filesystem") && (record.get("shared") === "false")) {
891 return false;
892 } else {
893 return true;
894 }
895 }
896 },{
897 text: _("Details"),
898 xtype: 'actioncolumn',
899 tooltip: 'Details',
900 align: 'center',
901 icon: 'images/search.png',
902 handler: function(view, rowIndex, colIndex, item, e, record, row) {
903 var me = this;
904 Ext.create("OMV.module.admin.storage.zfs.ShowDetails", {
905 title: _("Object details"),
906 rpcGetMethod: "getObjectDetails",
907 rpcGetParams: {
908 name: record.get('path'),
909 type: record.get('type')
910 }
911 }).show();
912 }
913 },{
914 text: _("Shared"),
915 dataIndex: 'shared',
916 sortable: false,
917 stateId: 'shared',
918 hidden: true
919 }],
920
921 initComponent: function() {
922 var me = this;
923 this.width = 600;
924 Ext.apply(me, {
925 store: Ext.create("Ext.data.TreeStore", {
926 autoLoad: true,
927 model: OMV.data.Model.createImplicit({
928 fields: [
929 { name: "name", type: "string" },
930 { name: "type", type: "string" },
931 { name: "size", type: "string" },
932 { name: "used", type: "string" },
933 { name: "available", type: "string" },
934 { name: "mountpoint", type: "string" },
935 { name: "id", type: "string" },
936 { name: "path", type: "string" },
937 { name: "origin", type: "string", defaultValue: "none" },
938 { name: "shared", type: "string", defaultValue: "false" },
939 { name: "pool_type", type: "string"},
940 { name: "nr_disks", type: "string"}
941 ]
942 }),
943 proxy: {
944 type: "rpc",
945 rpcData: {
946 service: "ZFS",
947 method: "getObjectTree",
948 }
949 },
950 folderSort: true
951 })
952 });
953 me.callParent(arguments);
954 },
955
956 onAddButton: function() {
957 var me = this;
958 Ext.create("OMV.module.admin.storage.zfs.AddPool", {
959 listeners: {
960 scope: me,
961 submit: function() {
962 this.doReload();
963 }
964 }
965 }).show();
966 },
967
968 onAddObjButton: function() {
969 var me = this;
970 var sm = me.getSelectionModel();
971 var records = sm.getSelection();
972 var record = records[0];
973 Ext.create("OMV.module.admin.storage.zfs.AddObject", {
974 title: _("Add Object"),
975 path: record.get("path"),
976 parenttype: record.get("type"),
977 listeners: {
978 scope: me,
979 submit: function() {
980 this.doReload();
981 }
982 }
983 }).show();
984 },
985
986 onEditButton: function() {
987 var me = this;
988 var sm = me.getSelectionModel();
989 var records = sm.getSelection();
990 var record = records[0];
991 Ext.create("OMV.module.admin.storage.zfs.EditProperties", {
992 name: record.get("path"),
993 type: record.get("type")
994 }).show();
995 },
996
997 onExpandPoolButton: function() {
998 var me = this;
999 var sm = me.getSelectionModel();
1000 var records = sm.getSelection();
1001 var record = records[0];
1002 Ext.create("OMV.module.admin.storage.zfs.ExpandPool", {
1003 title: _("Expand Pool"),
1004 name: record.get("path"),
1005 listeners: {
1006 scope: me,
1007 submit: function() {
1008 this.doReload();
1009 }
1010 }
1011 }).show();
1012 },
1013
1014 doDeletion: function(record) {
1015 var me = this;
1016 OMV.Rpc.request({
1017 scope: me,
1018 callback: me.onDeletion,
1019 rpcData: {
1020 service: "ZFS",
1021 method: "deleteObject",
1022 params: {
1023 name: record.get('path'),
1024 type: record.get('type')
1025 }
1026 }
1027 });
1028 }
1029
1030 });
1031
1032 OMV.WorkspaceManager.registerPanel({
1033 id: "overview",
1034 path: "/storage/zfs",
1035 text: _("Overview"),
1036 position: 10,
1037 className: "OMV.module.admin.storage.zfs.Overview"
1038 });
1039
1040
1041
This page took 0.176964 seconds and 4 git commands to generate.