]>
git.datanom.net - omvzfs.git/blob - 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")
6 Ext
.define("OMV.module.admin.storage.zfs.ShowDetails", {
7 extend
: "OMV.workspace.window.Form",
15 title
: _("Object details"),
17 hideResetButton
: true,
18 hideCancelButton
: true,
22 okButtonText
: _("Ok"),
24 getFormItems: function() {
28 xtype
: "textareafield",
33 preventScrollbars
: true,
40 Ext
.define("OMV.module.admin.storage.zfs.AddPool", {
41 extend
: "OMV.workspace.window.Form",
46 "OMV.form.field.CheckboxGrid"
50 rpcSetMethod
: "addPool",
51 title
: _("Create ZFS pool"),
53 hideResetButton
: true,
57 getFormItems: function() {
66 fieldLabel
: _("Pool type"),
68 store
: Ext
.create("Ext.data.ArrayStore", {
69 fields
: [ "value", "text" ],
71 [ "basic", _("Basic") ],
72 [ "mirror", _("Mirror") ],
73 [ "raidz1", _("RAID-Z1") ],
74 [ "raidz2", _("RAID-Z2") ],
75 [ "raidz3", _("RAID-Z3") ]
86 change: function(combo
, value
) {
87 var devicesField
= this.findField("devices");
90 devicesField
.minSelections
= 1;
93 devicesField
.minSelections
= 2;
96 devicesField
.minSelections
= 3;
99 devicesField
.minSelections
= 4;
102 devicesField
.minSelections
= 5;
105 devicesField
.minSelections
= 2;
108 devicesField
.validate();
112 xtype
: "checkboxgridfield",
114 fieldLabel
: _("Devices"),
115 valueField
: "devicefile",
116 minSelections
: 3, // Min. number of devices for RAIDZ-1
117 useStringValue
: true,
119 store
: Ext
.create("OMV.data.Store", {
121 model
: OMV
.data
.Model
.createImplicit({
122 idProperty
: "devicefile",
124 { name
: "devicefile", type
: "string" },
125 { name
: "size", type
: "string" },
126 { name
: "vendor", type
: "string" },
127 { name
: "serialnumber", type
: "string" }
132 appendSortParams
: false,
135 method
: "getCandidates"
140 property
: "devicefile"
145 stateId
: "1866b5d0-327e-11e4-8c21-0800200c9a66",
149 dataIndex
: "devicefile",
150 stateId
: "devicefile",
153 xtype
: "binaryunitcolumn",
167 text
: _("Serial Number"),
169 dataIndex
: "serialnumber",
170 stateId
: "serialnumber",
177 fieldLabel
: _("Mountpoint"),
180 text
: _("Optional mountpoint for the pool. Default is to use pool name.")
185 fieldLabel
: _("Disk-by-path"),
188 text
: _("Use /dev/disk/by-path when creating the pool. Recommended.")
193 fieldLabel
: _("Force creation"),
197 text
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
202 doSubmit: function() {
204 OMV
.MessageBox
.show({
205 title
: _("Confirmation"),
206 msg
: _("Do you really want to create the ZFS pool?"),
207 buttons
: Ext
.Msg
.YESNO
,
208 fn: function(answer
) {
211 me
.superclass
.doSubmit
.call(me
);
214 icon
: Ext
.Msg
.QUESTION
219 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
220 extend
: "OMV.workspace.window.Form",
224 "OMV.data.proxy.Rpc",
225 "OMV.data.reader.RpcArray"
229 rpcSetMethod
: "addObject",
232 getFormItems: function() {
235 var store
= new Ext
.data
.ArrayStore({
239 {name
: 'value', type
: 'string'},
240 {name
: 'display', type
: 'string'}
245 if (me
.parenttype
=== "Snapshot") {
246 combodata
= [["clone","Clone"]];
247 } else if (me
.parenttype
=== "Volume") {
248 combodata
= [["snapshot", "Snapshot"]];
250 combodata
= [["filesystem","Filesystem"],
252 ["snapshot","Snapshot"]];
254 store
.loadData(combodata
,false);
259 fieldLabel
: _("Object Type"),
264 triggerAction
: "all",
266 displayField
: "display",
267 value
: combodata
[0][0],
270 change: function(combo
, value
) {
271 var sizeField
= this.findField("size");
272 var cloneField
= this.findField("clonename");
273 var nameField
= this.findField("name");
274 var mountField
= this.findField("mountpoint");
278 sizeField
.allowBlank
= true;
284 sizeField
.allowBlank
= false;
291 sizeField
.allowBlank
= true;
297 sizeField
.allowBlank
= true;
303 sizeField
.validate();
309 fieldLabel
: _("Prefix"),
315 beforerender: function(e
, eOpts
) {
316 var pathField
= this.findField("path");
317 if (me
.parenttype
=== "Snapshot") {
318 pathField
.fieldLabel
= _("Snapshot to clone");
320 pathField
.fieldLabel
= _("Prefix");
328 fieldLabel
: _("Name"),
332 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
336 beforerender: function(e
, eOpts
) {
337 var nameField
= this.findField("name");
338 if (me
.parenttype
=== "Snapshot") {
340 nameField
.allowBlank
= true;
343 nameField
.allowBlank
= false;
350 fieldLabel
: _("Mountpoint"),
354 text
: _("Optional mountpoint of the filesystem. If left blank parent mountpoint will be prepended to name of the filesystem.")
358 beforerender: function(e
, eOpts
) {
359 var mountField
= this.findField("mountpoint");
360 if (combodata
[0][0] === "filesystem") {
371 fieldLabel
: _("Clone name"),
375 text
: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.")
379 beforerender: function(e
, eOpts
) {
380 var cloneField
= this.findField("clonename");
381 if (me
.parenttype
=== "Snapshot") {
383 cloneField
.allowBlank
= false;
386 cloneField
.allowBlank
= true;
395 fieldLabel
: _("Size"),
399 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
405 Ext
.define("OMV.module.admin.storage.zfs.ExpandPool", {
406 extend
: "OMV.workspace.window.Form",
410 "OMV.data.proxy.Rpc",
411 "OMV.data.reader.RpcArray"
415 rpcSetMethod
: "expandPool",
420 getFormItems: function() {
425 fieldLabel
: _("Name"),
432 fieldLabel
: _("Vdev type"),
434 store
: Ext
.create("Ext.data.ArrayStore", {
435 fields
: [ "value", "text" ],
437 [ "basic", _("Basic") ],
438 [ "mirror", _("Mirror") ],
439 [ "raidz1", _("RAID-Z1") ],
440 [ "raidz2", _("RAID-Z2") ],
441 [ "raidz3", _("RAID-Z3") ]
444 displayField
: "text",
448 triggerAction
: "all",
452 change: function(combo
, value
) {
453 var devicesField
= this.findField("devices");
456 devicesField
.minSelections
= 1;
459 devicesField
.minSelections
= 2;
462 devicesField
.minSelections
= 3;
465 devicesField
.minSelections
= 4;
468 devicesField
.minSelections
= 5;
471 devicesField
.minSelections
= 2;
474 devicesField
.validate();
478 xtype
: "checkboxgridfield",
480 fieldLabel
: _("Devices"),
481 valueField
: "devicefile",
482 minSelections
: 3, // Min. number of devices for RAIDZ-1
483 useStringValue
: true,
485 store
: Ext
.create("OMV.data.Store", {
487 model
: OMV
.data
.Model
.createImplicit({
488 idProperty
: "devicefile",
490 { name
: "devicefile", type
: "string" },
491 { name
: "size", type
: "string" },
492 { name
: "vendor", type
: "string" },
493 { name
: "serialnumber", type
: "string" }
498 appendSortParams
: false,
501 method
: "getCandidates"
506 property
: "devicefile"
511 stateId
: "05c60750-5074-11e4-916c-0800200c9a66",
515 dataIndex
: "devicefile",
516 stateId
: "devicefile",
519 xtype
: "binaryunitcolumn",
533 text
: _("Serial Number"),
535 dataIndex
: "serialnumber",
536 stateId
: "serialnumber",
543 fieldLabel
: _("Disk-by-path"),
546 text
: _("Use /dev/disk/by-path when creating the vdev. Recommended.")
551 fieldLabel
: _("Force creation"),
555 text
: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
562 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
563 extend
: "OMV.workspace.window.Grid",
571 rpcSetMethod
: "setProperties",
573 title
: _("Edit properties"),
577 getGridConfig: function() {
580 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
582 pluginId
: 'rowEditing',
584 validateedit: function(editor
, e
, eOpts
) {
585 e
.record
.set("modified", "true");
587 beforeedit: function(editor
, e
, eOpts
) {
588 if (e
.record
.get("newproperty") === "false") {
589 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
590 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
592 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
593 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
600 var store
= Ext
.create("OMV.data.Store", {
602 model
: OMV
.data
.Model
.createImplicit({
604 { name
: "property", type
: "string" },
605 { name
: "value", type
: "string" },
606 { name
: "source", type
: "string" },
607 { name
: "modified", type
: "string" },
608 { name
: "newproperty", type
: "string", defaultValue
: "false" }
615 method
: "getProperties",
627 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
629 plugins
: [rowEditing
],
632 text
: "Add property",
633 icon
: "images/add.png",
634 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
635 handler: function(view
) {
636 Ext
.define('Property', {
637 extend
: 'Ext.data.Model',
646 var newProperty
= Ext
.create("Property", {
653 rowEditing
.cancelEdit();
654 store
.insert(0, newProperty
);
655 rowEditing
.startEdit();
661 dataIndex
: "property",
684 xtype
: 'actioncolumn',
686 icon
: "images/checkmark.png",
688 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
689 OMV
.RpcObserver
.request({
690 msg
: _("Updating property..."),
697 property
: record
.get("property")
700 finish : function() {
701 view
.getStore().reload();
705 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
706 var src
= record
.get("source");
707 if(src
=== "local") {
715 dataIndex
: "newproperty",
716 stateId
: "newproperty",
722 dataIndex
: "modified",
729 getRpcSetParams: function() {
732 var values
= me
.getValues();
733 Ext
.Array
.each(values
, function(value
) {
734 if(value
.modified
=== "false")
737 "property": value
.property
,
738 "value": value
.value
,
744 properties
: properties
751 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
752 extend
: "OMV.workspace.window.Form",
756 "OMV.data.proxy.Rpc",
757 "OMV.data.reader.RpcArray"
761 rpcSetMethod
: "createShare",
764 getFormItems: function() {
769 fieldLabel
: _("Name"),
774 fieldLabel
: _("Path"),
780 fieldLabel
: _("Permissions"),
782 store
: Ext
.create("Ext.data.ArrayStore", {
783 fields
: [ "value", "text" ],
785 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
786 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
787 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
788 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
789 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
790 [ "777", _("Everyone: read/write") ]
793 displayField
: "text",
797 showItemTooltip
: true,
798 triggerAction
: "all",
802 text
: _("The file mode of the shared folder path.")
807 fieldLabel
: _("Comment"),
823 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
824 extend
: "OMV.module.admin.storage.zfs.TreePanel",
827 rpcGetMethod
: "getObjectTree",
836 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
845 renderer: function(value
, p
, r
){
846 if (r
.data
['origin'] === "n/a") {
847 return r
.data
['name'];
849 return r
.data
['name'] + ' (' + r
.data
['origin'] + ')';
858 renderer: function(value
, p
, r
){
859 if (r
.data
['origin'] === "n/a") {
860 return r
.data
['type'];
878 text
: _("Available"),
879 dataIndex
: 'available',
884 text
: _("Mountpoint"),
885 dataIndex
: 'mountpoint',
888 stateId
: 'mountpoint'
890 text
: _("Share folder"),
891 xtype
: 'actioncolumn',
892 tooltip
: 'Create shared folder',
894 icon
: 'images/share.png',
895 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
897 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
898 title
: _("Create shared folder"),
899 rpcGetMethod
: "getSharedParams",
901 name
: record
.get('path'),
902 type
: record
.get('type')
906 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
907 var src
= record
.get("type");
908 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
916 xtype
: 'actioncolumn',
919 icon
: 'images/search.png',
920 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
922 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
923 title
: _("Object details"),
924 rpcGetMethod
: "getObjectDetails",
926 name
: record
.get('path'),
927 type
: record
.get('type')
939 initComponent: function() {
943 store
: Ext
.create("Ext.data.TreeStore", {
945 model
: OMV
.data
.Model
.createImplicit({
947 { name
: "name", type
: "string" },
948 { name
: "type", type
: "string" },
949 { name
: "size", type
: "string" },
950 { name
: "used", type
: "string" },
951 { name
: "available", type
: "string" },
952 { name
: "mountpoint", type
: "string" },
953 { name
: "id", type
: "string" },
954 { name
: "path", type
: "string" },
955 { name
: "origin", type
: "string", defaultValue
: "none" },
956 { name
: "shared", type
: "string", defaultValue
: "false" },
957 { name
: "pool_type", type
: "string"},
958 { name
: "nr_disks", type
: "string"}
965 method
: "getObjectTree",
971 me
.callParent(arguments
);
974 onAddButton: function() {
976 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
986 onAddObjButton: function() {
988 var sm
= me
.getSelectionModel();
989 var records
= sm
.getSelection();
990 var record
= records
[0];
991 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
992 title
: _("Add Object"),
993 path
: record
.get("path"),
994 parenttype
: record
.get("type"),
1004 onEditButton: function() {
1006 var sm
= me
.getSelectionModel();
1007 var records
= sm
.getSelection();
1008 var record
= records
[0];
1009 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
1010 name
: record
.get("path"),
1011 type
: record
.get("type")
1015 onExpandPoolButton: function() {
1017 var sm
= me
.getSelectionModel();
1018 var records
= sm
.getSelection();
1019 var record
= records
[0];
1020 Ext
.create("OMV.module.admin.storage.zfs.ExpandPool", {
1021 title
: _("Expand Pool"),
1022 name
: record
.get("path"),
1025 submit: function() {
1032 doDeletion: function(record
) {
1036 callback
: me
.onDeletion
,
1039 method
: "deleteObject",
1041 name
: record
.get('path'),
1042 type
: record
.get('type')
1050 OMV
.WorkspaceManager
.registerPanel({
1052 path
: "/storage/zfs",
1053 text
: _("Overview"),
1055 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.602747 seconds and 6 git commands to generate.