]>
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;
99 devicesField
.minSelections
= 5;
102 devicesField
.minSelections
= 2;
105 devicesField
.validate();
109 xtype
: "checkboxgridfield",
111 fieldLabel
: _("Devices"),
112 valueField
: "devicefile",
113 minSelections
: 3, // Min. number of devices for RAIDZ-1
114 useStringValue
: true,
116 store
: Ext
.create("OMV.data.Store", {
118 model
: OMV
.data
.Model
.createImplicit({
119 idProperty
: "devicefile",
121 { name
: "devicefile", type
: "string" },
122 { name
: "size", type
: "string" },
123 { name
: "vendor", type
: "string" },
124 { name
: "serialnumber", type
: "string" }
129 appendSortParams
: false,
132 method
: "getCandidates"
137 property
: "devicefile"
142 stateId
: "1866b5d0-327e-11e4-8c21-0800200c9a66",
146 dataIndex
: "devicefile",
147 stateId
: "devicefile",
150 xtype
: "binaryunitcolumn",
164 text
: _("Serial Number"),
166 dataIndex
: "serialnumber",
167 stateId
: "serialnumber",
174 fieldLabel
: _("Mountpoint"),
177 text
: _("Optional mountpoint for the pool. Default is to use pool name.")
182 fieldLabel
: _("Force creation"),
186 text
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
191 doSubmit: function() {
193 OMV
.MessageBox
.show({
194 title
: _("Confirmation"),
195 msg
: _("Do you really want to create the ZFS pool?"),
196 buttons
: Ext
.Msg
.YESNO
,
197 fn: function(answer
) {
200 me
.superclass
.doSubmit
.call(me
);
203 icon
: Ext
.Msg
.QUESTION
208 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
209 extend
: "OMV.workspace.window.Form",
213 "OMV.data.proxy.Rpc",
214 "OMV.data.reader.RpcArray"
218 rpcSetMethod
: "addObject",
221 getFormItems: function() {
226 fieldLabel
: _("Object Type"),
229 [ "filesystem", "Filesystem" ],
230 [ "snapshot", "Snapshot" ],
231 [ "volume", "Volume" ]
235 triggerAction
: "all",
239 change: function(combo
, value
) {
240 var sizeField
= this.findField("size");
244 sizeField
.allowBlank
= false;
248 sizeField
.allowBlank
= true;
251 sizeField
.validate();
257 fieldLabel
: _("Prefix"),
264 fieldLabel
: _("Name"),
268 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
274 fieldLabel
: _("Size"),
278 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
284 Ext
.define("OMV.module.admin.storage.zfs.ExpandPool", {
285 extend
: "OMV.workspace.window.Form",
289 "OMV.data.proxy.Rpc",
290 "OMV.data.reader.RpcArray"
294 rpcSetMethod
: "expandPool",
299 getFormItems: function() {
304 fieldLabel
: _("Name"),
311 fieldLabel
: _("Vdev type"),
313 store
: Ext
.create("Ext.data.ArrayStore", {
314 fields
: [ "value", "text" ],
316 [ "basic", _("Basic") ],
317 [ "mirror", _("Mirror") ],
318 [ "raidz1", _("RAID-Z1") ],
319 [ "raidz2", _("RAID-Z2") ],
320 [ "raidz3", _("RAID-Z3") ]
323 displayField
: "text",
327 triggerAction
: "all",
331 change: function(combo
, value
) {
332 var devicesField
= this.findField("devices");
335 devicesField
.minSelections
= 1;
338 devicesField
.minSelections
= 2;
341 devicesField
.minSelections
= 3;
344 devicesField
.minSelections
= 4;
346 devicesField
.minSelections
= 5;
349 devicesField
.minSelections
= 2;
352 devicesField
.validate();
356 xtype
: "checkboxgridfield",
358 fieldLabel
: _("Devices"),
359 valueField
: "devicefile",
360 minSelections
: 3, // Min. number of devices for RAIDZ-1
361 useStringValue
: true,
363 store
: Ext
.create("OMV.data.Store", {
365 model
: OMV
.data
.Model
.createImplicit({
366 idProperty
: "devicefile",
368 { name
: "devicefile", type
: "string" },
369 { name
: "size", type
: "string" },
370 { name
: "vendor", type
: "string" },
371 { name
: "serialnumber", type
: "string" }
376 appendSortParams
: false,
379 method
: "getCandidates"
384 property
: "devicefile"
389 stateId
: "05c60750-5074-11e4-916c-0800200c9a66",
393 dataIndex
: "devicefile",
394 stateId
: "devicefile",
397 xtype
: "binaryunitcolumn",
411 text
: _("Serial Number"),
413 dataIndex
: "serialnumber",
414 stateId
: "serialnumber",
423 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
424 extend
: "OMV.workspace.window.Grid",
432 rpcSetMethod
: "setProperties",
434 title
: _("Edit properties"),
438 getGridConfig: function() {
441 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
443 pluginId
: 'rowEditing',
445 validateedit: function(editor
, e
, eOpts
) {
446 e
.record
.set("modified", "true");
448 beforeedit: function(editor
, e
, eOpts
) {
449 if (e
.record
.get("newproperty") === "false") {
450 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
451 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
453 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
454 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
461 var store
= Ext
.create("OMV.data.Store", {
463 model
: OMV
.data
.Model
.createImplicit({
465 { name
: "property", type
: "string" },
466 { name
: "value", type
: "string" },
467 { name
: "source", type
: "string" },
468 { name
: "modified", type
: "string" },
469 { name
: "newproperty", type
: "string", defaultValue
: "false" }
476 method
: "getProperties",
488 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
490 plugins
: [rowEditing
],
493 text
: "Add property",
494 icon
: "images/add.png",
495 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
496 handler: function(view
) {
497 Ext
.define('Property', {
498 extend
: 'Ext.data.Model',
507 var newProperty
= Ext
.create("Property", {
514 rowEditing
.cancelEdit();
515 store
.insert(0, newProperty
);
516 rowEditing
.startEdit();
522 dataIndex
: "property",
545 xtype
: 'actioncolumn',
547 icon
: "images/checkmark.png",
549 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
550 OMV
.RpcObserver
.request({
551 msg
: _("Updating property..."),
558 property
: record
.get("property")
561 finish : function() {
562 view
.getStore().reload();
566 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
567 var src
= record
.get("source");
568 if(src
=== "local") {
576 dataIndex
: "newproperty",
577 stateId
: "newproperty",
583 dataIndex
: "modified",
590 getRpcSetParams: function() {
593 var values
= me
.getValues();
594 Ext
.Array
.each(values
, function(value
) {
595 if(value
.modified
=== "false")
598 "property": value
.property
,
599 "value": value
.value
,
605 properties
: properties
612 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
613 extend
: "OMV.workspace.window.Form",
617 "OMV.data.proxy.Rpc",
618 "OMV.data.reader.RpcArray"
622 rpcSetMethod
: "createShare",
625 getFormItems: function() {
630 fieldLabel
: _("Name"),
635 fieldLabel
: _("Path"),
641 fieldLabel
: _("Permissions"),
643 store
: Ext
.create("Ext.data.ArrayStore", {
644 fields
: [ "value", "text" ],
646 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
647 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
648 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
649 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
650 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
651 [ "777", _("Everyone: read/write") ]
654 displayField
: "text",
658 showItemTooltip
: true,
659 triggerAction
: "all",
663 text
: _("The file mode of the shared folder path.")
668 fieldLabel
: _("Comment"),
684 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
685 extend
: "OMV.module.admin.storage.zfs.TreePanel",
688 rpcGetMethod
: "getObjectTree",
697 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
712 renderer: function(value
, p
, r
){
713 if (r
.data
['type'] == "Pool") {
714 return r
.data
['type'] + ' (' + r
.data
['pool_type'] + ')';
716 return r
.data
['type'];
732 text
: _("Available"),
733 dataIndex
: 'available',
738 text
: _("Mountpoint"),
739 dataIndex
: 'mountpoint',
742 stateId
: 'mountpoint'
745 xtype
: 'actioncolumn',
746 tooltip
: 'Create shared folder',
748 icon
: 'images/checkmark.png',
749 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
751 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
752 title
: _("Create shared folder"),
753 rpcGetMethod
: "getSharedParams",
755 name
: record
.get('path'),
756 type
: record
.get('type')
760 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
761 var src
= record
.get("type");
762 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
770 xtype
: 'actioncolumn',
773 icon
: 'images/search.png',
774 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
776 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
777 title
: _("Object details"),
778 rpcGetMethod
: "getObjectDetails",
780 name
: record
.get('path'),
781 type
: record
.get('type')
793 initComponent: function() {
797 store
: Ext
.create("Ext.data.TreeStore", {
799 model
: OMV
.data
.Model
.createImplicit({
801 { name
: "name", type
: "string" },
802 { name
: "type", type
: "string" },
803 { name
: "size", type
: "string" },
804 { name
: "used", type
: "string" },
805 { name
: "available", type
: "string" },
806 { name
: "mountpoint", type
: "string" },
807 { name
: "id", type
: "string" },
808 { name
: "path", type
: "string" },
809 { name
: "origin", type
: "string", defaultValue
: "none" },
810 { name
: "shared", type
: "string", defaultValue
: "false" },
811 { name
: "pool_type", type
: "string"},
812 { name
: "nr_disks", type
: "string"}
819 method
: "getObjectTree",
825 me
.callParent(arguments
);
828 onAddButton: function() {
830 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
840 onAddObjButton: function() {
842 var sm
= me
.getSelectionModel();
843 var records
= sm
.getSelection();
844 var record
= records
[0];
845 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
846 title
: _("Add Object"),
847 path
: record
.get("path"),
857 onEditButton: function() {
859 var sm
= me
.getSelectionModel();
860 var records
= sm
.getSelection();
861 var record
= records
[0];
862 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
863 name
: record
.get("path"),
864 type
: record
.get("type")
868 onExpandPoolButton: function() {
870 var sm
= me
.getSelectionModel();
871 var records
= sm
.getSelection();
872 var record
= records
[0];
873 Ext
.create("OMV.module.admin.storage.zfs.ExpandPool", {
874 title
: _("Expand Pool"),
875 name
: record
.get("path"),
885 doDeletion: function(record
) {
889 callback
: me
.onDeletion
,
892 method
: "deleteObject",
894 name
: record
.get('path'),
895 type
: record
.get('type')
903 OMV
.WorkspaceManager
.registerPanel({
905 path
: "/storage/zfs",
908 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.1607 seconds and 6 git commands to generate.