]>
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",
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
: _("Disk-by-path"),
186 text
: _("Use /dev/disk/by-path when creating the pool. Recommended.")
191 fieldLabel
: _("Force creation"),
195 text
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
200 doSubmit: function() {
202 OMV
.MessageBox
.show({
203 title
: _("Confirmation"),
204 msg
: _("Do you really want to create the ZFS pool?"),
205 buttons
: Ext
.Msg
.YESNO
,
206 fn: function(answer
) {
209 me
.superclass
.doSubmit
.call(me
);
212 icon
: Ext
.Msg
.QUESTION
217 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
218 extend
: "OMV.workspace.window.Form",
222 "OMV.data.proxy.Rpc",
223 "OMV.data.reader.RpcArray"
227 rpcSetMethod
: "addObject",
230 getFormItems: function() {
233 var store
= new Ext
.data
.ArrayStore({
237 {name
: 'value', type
: 'string'},
238 {name
: 'display', type
: 'string'}
243 if (me
.parenttype
=== "Snapshot") {
244 combodata
= [["clone","Clone"]];
245 } else if (me
.parenttype
=== "Volume") {
246 combodata
= [["snapshot", "Snapshot"]];
248 combodata
= [["filesystem","Filesystem"],
250 ["snapshot","Snapshot"]];
252 store
.loadData(combodata
,false);
257 fieldLabel
: _("Object Type"),
262 triggerAction
: "all",
264 displayField
: "display",
265 value
: combodata
[0][0],
268 change: function(combo
, value
) {
269 var sizeField
= this.findField("size");
270 var cloneField
= this.findField("clonename");
271 var nameField
= this.findField("name");
272 var mountField
= this.findField("mountpoint");
276 sizeField
.allowBlank
= true;
282 sizeField
.allowBlank
= false;
289 sizeField
.allowBlank
= true;
295 sizeField
.allowBlank
= true;
301 sizeField
.validate();
307 fieldLabel
: _("Prefix"),
313 beforerender: function(e
, eOpts
) {
314 var pathField
= this.findField("path");
315 if (me
.parenttype
=== "Snapshot") {
316 pathField
.fieldLabel
= _("Snapshot to clone");
318 pathField
.fieldLabel
= _("Prefix");
326 fieldLabel
: _("Name"),
330 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
334 beforerender: function(e
, eOpts
) {
335 var nameField
= this.findField("name");
336 if (me
.parenttype
=== "Snapshot") {
338 nameField
.allowBlank
= true;
341 nameField
.allowBlank
= false;
348 fieldLabel
: _("Mountpoint"),
352 text
: _("Optional mountpoint of the filesystem. If left blank parent mountpoint will be prepended to name of the filesystem.")
356 beforerender: function(e
, eOpts
) {
357 var mountField
= this.findField("mountpoint");
358 if (combodata
[0][0] === "filesystem") {
369 fieldLabel
: _("Clone name"),
373 text
: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.")
377 beforerender: function(e
, eOpts
) {
378 var cloneField
= this.findField("clonename");
379 if (me
.parenttype
=== "Snapshot") {
381 cloneField
.allowBlank
= false;
384 cloneField
.allowBlank
= true;
393 fieldLabel
: _("Size"),
397 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
403 Ext
.define("OMV.module.admin.storage.zfs.ExpandPool", {
404 extend
: "OMV.workspace.window.Form",
408 "OMV.data.proxy.Rpc",
409 "OMV.data.reader.RpcArray"
413 rpcSetMethod
: "expandPool",
418 getFormItems: function() {
423 fieldLabel
: _("Name"),
430 fieldLabel
: _("Vdev type"),
432 store
: Ext
.create("Ext.data.ArrayStore", {
433 fields
: [ "value", "text" ],
435 [ "basic", _("Basic") ],
436 [ "mirror", _("Mirror") ],
437 [ "raidz1", _("RAID-Z1") ],
438 [ "raidz2", _("RAID-Z2") ],
439 [ "raidz3", _("RAID-Z3") ]
442 displayField
: "text",
446 triggerAction
: "all",
450 change: function(combo
, value
) {
451 var devicesField
= this.findField("devices");
454 devicesField
.minSelections
= 1;
457 devicesField
.minSelections
= 2;
460 devicesField
.minSelections
= 3;
463 devicesField
.minSelections
= 4;
466 devicesField
.minSelections
= 5;
469 devicesField
.minSelections
= 2;
472 devicesField
.validate();
476 xtype
: "checkboxgridfield",
478 fieldLabel
: _("Devices"),
479 valueField
: "devicefile",
480 minSelections
: 3, // Min. number of devices for RAIDZ-1
481 useStringValue
: true,
483 store
: Ext
.create("OMV.data.Store", {
485 model
: OMV
.data
.Model
.createImplicit({
486 idProperty
: "devicefile",
488 { name
: "devicefile", type
: "string" },
489 { name
: "size", type
: "string" },
490 { name
: "vendor", type
: "string" },
491 { name
: "serialnumber", type
: "string" }
496 appendSortParams
: false,
499 method
: "getCandidates"
504 property
: "devicefile"
509 stateId
: "05c60750-5074-11e4-916c-0800200c9a66",
513 dataIndex
: "devicefile",
514 stateId
: "devicefile",
517 xtype
: "binaryunitcolumn",
531 text
: _("Serial Number"),
533 dataIndex
: "serialnumber",
534 stateId
: "serialnumber",
541 fieldLabel
: _("Disk-by-path"),
544 text
: _("Use /dev/disk/by-path when creating the vdev. Recommended.")
549 fieldLabel
: _("Force creation"),
553 text
: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
560 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
561 extend
: "OMV.workspace.window.Grid",
569 rpcSetMethod
: "setProperties",
571 title
: _("Edit properties"),
575 getGridConfig: function() {
578 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
580 pluginId
: 'rowEditing',
582 validateedit: function(editor
, e
, eOpts
) {
583 e
.record
.set("modified", "true");
585 beforeedit: function(editor
, e
, eOpts
) {
586 if (e
.record
.get("newproperty") === "false") {
587 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
588 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
590 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
591 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
598 var store
= Ext
.create("OMV.data.Store", {
600 model
: OMV
.data
.Model
.createImplicit({
602 { name
: "property", type
: "string" },
603 { name
: "value", type
: "string" },
604 { name
: "source", type
: "string" },
605 { name
: "modified", type
: "string" },
606 { name
: "newproperty", type
: "string", defaultValue
: "false" }
613 method
: "getProperties",
625 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
627 plugins
: [rowEditing
],
630 text
: "Add property",
631 icon
: "images/add.png",
632 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
633 handler: function(view
) {
634 Ext
.define('Property', {
635 extend
: 'Ext.data.Model',
644 var newProperty
= Ext
.create("Property", {
651 rowEditing
.cancelEdit();
652 store
.insert(0, newProperty
);
653 rowEditing
.startEdit();
659 dataIndex
: "property",
682 xtype
: 'actioncolumn',
684 icon
: "images/checkmark.png",
686 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
687 OMV
.RpcObserver
.request({
688 msg
: _("Updating property..."),
695 property
: record
.get("property")
698 finish : function() {
699 view
.getStore().reload();
703 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
704 var src
= record
.get("source");
705 if(src
=== "local") {
713 dataIndex
: "newproperty",
714 stateId
: "newproperty",
720 dataIndex
: "modified",
727 getRpcSetParams: function() {
730 var values
= me
.getValues();
731 Ext
.Array
.each(values
, function(value
) {
732 if(value
.modified
=== "false")
735 "property": value
.property
,
736 "value": value
.value
,
742 properties
: properties
749 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
750 extend
: "OMV.workspace.window.Form",
754 "OMV.data.proxy.Rpc",
755 "OMV.data.reader.RpcArray"
759 rpcSetMethod
: "createShare",
762 getFormItems: function() {
767 fieldLabel
: _("Name"),
772 fieldLabel
: _("Path"),
778 fieldLabel
: _("Permissions"),
780 store
: Ext
.create("Ext.data.ArrayStore", {
781 fields
: [ "value", "text" ],
783 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
784 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
785 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
786 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
787 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
788 [ "777", _("Everyone: read/write") ]
791 displayField
: "text",
795 showItemTooltip
: true,
796 triggerAction
: "all",
800 text
: _("The file mode of the shared folder path.")
805 fieldLabel
: _("Comment"),
821 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
822 extend
: "OMV.module.admin.storage.zfs.TreePanel",
825 rpcGetMethod
: "getObjectTree",
834 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
843 renderer: function(value
, p
, r
){
844 if (r
.data
['origin'] === "n/a") {
845 return r
.data
['name'];
847 return r
.data
['name'] + ' (' + r
.data
['origin'] + ')';
856 renderer: function(value
, p
, r
){
857 if (r
.data
['origin'] === "n/a") {
858 return r
.data
['type'];
876 text
: _("Available"),
877 dataIndex
: 'available',
882 text
: _("Mountpoint"),
883 dataIndex
: 'mountpoint',
886 stateId
: 'mountpoint'
889 xtype
: 'actioncolumn',
890 tooltip
: 'Create shared folder',
892 icon
: 'images/checkmark.png',
893 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
895 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
896 title
: _("Create shared folder"),
897 rpcGetMethod
: "getSharedParams",
899 name
: record
.get('path'),
900 type
: record
.get('type')
904 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
905 var src
= record
.get("type");
906 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
914 xtype
: 'actioncolumn',
917 icon
: 'images/search.png',
918 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
920 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
921 title
: _("Object details"),
922 rpcGetMethod
: "getObjectDetails",
924 name
: record
.get('path'),
925 type
: record
.get('type')
937 initComponent: function() {
941 store
: Ext
.create("Ext.data.TreeStore", {
943 model
: OMV
.data
.Model
.createImplicit({
945 { name
: "name", type
: "string" },
946 { name
: "type", type
: "string" },
947 { name
: "size", type
: "string" },
948 { name
: "used", type
: "string" },
949 { name
: "available", type
: "string" },
950 { name
: "mountpoint", type
: "string" },
951 { name
: "id", type
: "string" },
952 { name
: "path", type
: "string" },
953 { name
: "origin", type
: "string", defaultValue
: "none" },
954 { name
: "shared", type
: "string", defaultValue
: "false" },
955 { name
: "pool_type", type
: "string"},
956 { name
: "nr_disks", type
: "string"}
963 method
: "getObjectTree",
969 me
.callParent(arguments
);
972 onAddButton: function() {
974 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
984 onAddObjButton: function() {
986 var sm
= me
.getSelectionModel();
987 var records
= sm
.getSelection();
988 var record
= records
[0];
989 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
990 title
: _("Add Object"),
991 path
: record
.get("path"),
992 parenttype
: record
.get("type"),
1002 onEditButton: function() {
1004 var sm
= me
.getSelectionModel();
1005 var records
= sm
.getSelection();
1006 var record
= records
[0];
1007 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
1008 name
: record
.get("path"),
1009 type
: record
.get("type")
1013 onExpandPoolButton: function() {
1015 var sm
= me
.getSelectionModel();
1016 var records
= sm
.getSelection();
1017 var record
= records
[0];
1018 Ext
.create("OMV.module.admin.storage.zfs.ExpandPool", {
1019 title
: _("Expand Pool"),
1020 name
: record
.get("path"),
1023 submit: function() {
1030 doDeletion: function(record
) {
1034 callback
: me
.onDeletion
,
1037 method
: "deleteObject",
1039 name
: record
.get('path'),
1040 type
: record
.get('type')
1048 OMV
.WorkspaceManager
.registerPanel({
1050 path
: "/storage/zfs",
1051 text
: _("Overview"),
1053 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.217778 seconds and 6 git commands to generate.