]>
git.datanom.net - omvzfs.git/blob - gui/js/omv/module/admin/storage/zfs/Overview.js
4acc897bbcc6f3c402d0a6d243c7408dd0961475
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",
38 Ext
.define("OMV.module.admin.storage.zfs.AddPool", {
39 extend
: "OMV.workspace.window.Form",
44 "OMV.form.field.CheckboxGrid"
48 rpcSetMethod
: "addPool",
49 title
: _("Create ZFS pool"),
51 hideResetButton
: true,
55 getFormItems: function() {
64 fieldLabel
: _("Pool type"),
66 store
: Ext
.create("Ext.data.ArrayStore", {
67 fields
: [ "value", "text" ],
69 [ "basic", _("Basic") ],
70 [ "mirror", _("Mirror") ],
71 [ "raidz1", _("RAID-Z1") ],
72 [ "raidz2", _("RAID-Z2") ],
73 [ "raidz3", _("RAID-Z3") ]
84 change: function(combo
, value
) {
85 var devicesField
= this.findField("devices");
88 devicesField
.minSelections
= 1;
91 devicesField
.minSelections
= 2;
94 devicesField
.minSelections
= 3;
97 devicesField
.minSelections
= 4;
100 devicesField
.minSelections
= 5;
103 devicesField
.minSelections
= 2;
106 devicesField
.validate();
110 xtype
: "checkboxgridfield",
112 fieldLabel
: _("Devices"),
113 valueField
: "devicefile",
114 minSelections
: 3, // Min. number of devices for RAIDZ-1
115 useStringValue
: true,
117 store
: Ext
.create("OMV.data.Store", {
119 model
: OMV
.data
.Model
.createImplicit({
120 idProperty
: "devicefile",
122 { name
: "devicefile", type
: "string" },
123 { name
: "size", type
: "string" },
124 { name
: "vendor", type
: "string" },
125 { name
: "serialnumber", type
: "string" }
130 appendSortParams
: false,
133 method
: "getCandidates"
138 property
: "devicefile"
143 stateId
: "1866b5d0-327e-11e4-8c21-0800200c9a66",
147 dataIndex
: "devicefile",
148 stateId
: "devicefile",
151 xtype
: "binaryunitcolumn",
165 text
: _("Serial Number"),
167 dataIndex
: "serialnumber",
168 stateId
: "serialnumber",
175 fieldLabel
: _("Mountpoint"),
178 text
: _("Optional mountpoint for the pool. Default is to use pool name.")
183 fieldLabel
: _("Force creation"),
187 text
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
192 doSubmit: function() {
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
) {
201 me
.superclass
.doSubmit
.call(me
);
204 icon
: Ext
.Msg
.QUESTION
209 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
210 extend
: "OMV.workspace.window.Form",
214 "OMV.data.proxy.Rpc",
215 "OMV.data.reader.RpcArray"
219 rpcSetMethod
: "addObject",
222 getFormItems: function() {
225 var store
= new Ext
.data
.ArrayStore({
229 {name
: 'value', type
: 'string'},
230 {name
: 'display', type
: 'string'}
235 if (me
.parenttype
=== "Snapshot") {
236 combodata
= [["clone","Clone"]];
237 } else if (me
.parenttype
=== "Volume") {
238 combodata
= [["snapshot", "Snapshot"]];
240 combodata
= [["filesystem","Filesystem"],
242 ["snapshot","Snapshot"]];
244 store
.loadData(combodata
,false);
249 fieldLabel
: _("Object Type"),
254 triggerAction
: "all",
256 displayField
: "display",
257 value
: combodata
[0][0],
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");
268 sizeField
.allowBlank
= true;
274 sizeField
.allowBlank
= false;
281 sizeField
.allowBlank
= true;
287 sizeField
.allowBlank
= true;
293 sizeField
.validate();
299 fieldLabel
: _("Prefix"),
305 beforerender: function(e
, eOpts
) {
306 var pathField
= this.findField("path");
307 if (me
.parenttype
=== "Snapshot") {
308 pathField
.fieldLabel
= _("Snapshot to clone");
310 pathField
.fieldLabel
= _("Prefix");
318 fieldLabel
: _("Name"),
322 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
326 beforerender: function(e
, eOpts
) {
327 var nameField
= this.findField("name");
328 if (me
.parenttype
=== "Snapshot") {
330 nameField
.allowBlank
= true;
333 nameField
.allowBlank
= false;
340 fieldLabel
: _("Mountpoint"),
344 text
: _("Optional mountpoint of the filesystem. If left blank parent mountpoint will be prepended to name of the filesystem.")
348 beforerender: function(e
, eOpts
) {
349 var mountField
= this.findField("mountpoint");
350 if (combodata
[0][0] === "filesystem") {
361 fieldLabel
: _("Clone name"),
365 text
: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.")
369 beforerender: function(e
, eOpts
) {
370 var cloneField
= this.findField("clonename");
371 if (me
.parenttype
=== "Snapshot") {
373 cloneField
.allowBlank
= false;
376 cloneField
.allowBlank
= true;
385 fieldLabel
: _("Size"),
389 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
395 Ext
.define("OMV.module.admin.storage.zfs.ExpandPool", {
396 extend
: "OMV.workspace.window.Form",
400 "OMV.data.proxy.Rpc",
401 "OMV.data.reader.RpcArray"
405 rpcSetMethod
: "expandPool",
410 getFormItems: function() {
415 fieldLabel
: _("Name"),
422 fieldLabel
: _("Vdev type"),
424 store
: Ext
.create("Ext.data.ArrayStore", {
425 fields
: [ "value", "text" ],
427 [ "basic", _("Basic") ],
428 [ "mirror", _("Mirror") ],
429 [ "raidz1", _("RAID-Z1") ],
430 [ "raidz2", _("RAID-Z2") ],
431 [ "raidz3", _("RAID-Z3") ]
434 displayField
: "text",
438 triggerAction
: "all",
442 change: function(combo
, value
) {
443 var devicesField
= this.findField("devices");
446 devicesField
.minSelections
= 1;
449 devicesField
.minSelections
= 2;
452 devicesField
.minSelections
= 3;
455 devicesField
.minSelections
= 4;
458 devicesField
.minSelections
= 5;
461 devicesField
.minSelections
= 2;
464 devicesField
.validate();
468 xtype
: "checkboxgridfield",
470 fieldLabel
: _("Devices"),
471 valueField
: "devicefile",
472 minSelections
: 3, // Min. number of devices for RAIDZ-1
473 useStringValue
: true,
475 store
: Ext
.create("OMV.data.Store", {
477 model
: OMV
.data
.Model
.createImplicit({
478 idProperty
: "devicefile",
480 { name
: "devicefile", type
: "string" },
481 { name
: "size", type
: "string" },
482 { name
: "vendor", type
: "string" },
483 { name
: "serialnumber", type
: "string" }
488 appendSortParams
: false,
491 method
: "getCandidates"
496 property
: "devicefile"
501 stateId
: "05c60750-5074-11e4-916c-0800200c9a66",
505 dataIndex
: "devicefile",
506 stateId
: "devicefile",
509 xtype
: "binaryunitcolumn",
523 text
: _("Serial Number"),
525 dataIndex
: "serialnumber",
526 stateId
: "serialnumber",
533 fieldLabel
: _("Force creation"),
537 text
: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
544 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
545 extend
: "OMV.workspace.window.Grid",
553 rpcSetMethod
: "setProperties",
555 title
: _("Edit properties"),
559 getGridConfig: function() {
562 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
564 pluginId
: 'rowEditing',
566 validateedit: function(editor
, e
, eOpts
) {
567 e
.record
.set("modified", "true");
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();
574 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
575 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
582 var store
= Ext
.create("OMV.data.Store", {
584 model
: OMV
.data
.Model
.createImplicit({
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" }
597 method
: "getProperties",
609 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
611 plugins
: [rowEditing
],
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',
628 var newProperty
= Ext
.create("Property", {
635 rowEditing
.cancelEdit();
636 store
.insert(0, newProperty
);
637 rowEditing
.startEdit();
643 dataIndex
: "property",
666 xtype
: 'actioncolumn',
668 icon
: "images/checkmark.png",
670 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
671 OMV
.RpcObserver
.request({
672 msg
: _("Updating property..."),
679 property
: record
.get("property")
682 finish : function() {
683 view
.getStore().reload();
687 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
688 var src
= record
.get("source");
689 if(src
=== "local") {
697 dataIndex
: "newproperty",
698 stateId
: "newproperty",
704 dataIndex
: "modified",
711 getRpcSetParams: function() {
714 var values
= me
.getValues();
715 Ext
.Array
.each(values
, function(value
) {
716 if(value
.modified
=== "false")
719 "property": value
.property
,
720 "value": value
.value
,
726 properties
: properties
733 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
734 extend
: "OMV.workspace.window.Form",
738 "OMV.data.proxy.Rpc",
739 "OMV.data.reader.RpcArray"
743 rpcSetMethod
: "createShare",
746 getFormItems: function() {
751 fieldLabel
: _("Name"),
756 fieldLabel
: _("Path"),
762 fieldLabel
: _("Permissions"),
764 store
: Ext
.create("Ext.data.ArrayStore", {
765 fields
: [ "value", "text" ],
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") ]
775 displayField
: "text",
779 showItemTooltip
: true,
780 triggerAction
: "all",
784 text
: _("The file mode of the shared folder path.")
789 fieldLabel
: _("Comment"),
805 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
806 extend
: "OMV.module.admin.storage.zfs.TreePanel",
809 rpcGetMethod
: "getObjectTree",
818 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
827 renderer: function(value
, p
, r
){
828 if (r
.data
['origin'] === "n/a") {
829 return r
.data
['name'];
831 return r
.data
['name'] + ' (' + r
.data
['origin'] + ')';
840 renderer: function(value
, p
, r
){
841 if (r
.data
['origin'] === "n/a") {
842 return r
.data
['type'];
860 text
: _("Available"),
861 dataIndex
: 'available',
866 text
: _("Mountpoint"),
867 dataIndex
: 'mountpoint',
870 stateId
: 'mountpoint'
873 xtype
: 'actioncolumn',
874 tooltip
: 'Create shared folder',
876 icon
: 'images/checkmark.png',
877 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
879 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
880 title
: _("Create shared folder"),
881 rpcGetMethod
: "getSharedParams",
883 name
: record
.get('path'),
884 type
: record
.get('type')
888 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
889 var src
= record
.get("type");
890 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
898 xtype
: 'actioncolumn',
901 icon
: 'images/search.png',
902 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
904 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
905 title
: _("Object details"),
906 rpcGetMethod
: "getObjectDetails",
908 name
: record
.get('path'),
909 type
: record
.get('type')
921 initComponent: function() {
925 store
: Ext
.create("Ext.data.TreeStore", {
927 model
: OMV
.data
.Model
.createImplicit({
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"}
947 method
: "getObjectTree",
953 me
.callParent(arguments
);
956 onAddButton: function() {
958 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
968 onAddObjButton: function() {
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"),
986 onEditButton: function() {
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")
997 onExpandPoolButton: function() {
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"),
1007 submit: function() {
1014 doDeletion: function(record
) {
1018 callback
: me
.onDeletion
,
1021 method
: "deleteObject",
1023 name
: record
.get('path'),
1024 type
: record
.get('type')
1032 OMV
.WorkspaceManager
.registerPanel({
1034 path
: "/storage/zfs",
1035 text
: _("Overview"),
1037 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.176964 seconds and 4 git commands to generate.