]>
git.datanom.net - omvzfs.git/blob - gui/js/omv/module/admin/storage/zfs/Overview.js
4731124a7016385e636441a1f111fefa79fae95f
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() {
227 fieldLabel
: _("Object Type"),
230 [ "filesystem", "Filesystem" ],
231 [ "snapshot", "Snapshot" ],
232 [ "volume", "Volume" ]
236 triggerAction
: "all",
240 change: function(combo
, value
) {
241 var sizeField
= this.findField("size");
245 sizeField
.allowBlank
= false;
249 sizeField
.allowBlank
= true;
252 sizeField
.validate();
258 fieldLabel
: _("Prefix"),
265 fieldLabel
: _("Name"),
269 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
275 fieldLabel
: _("Size"),
279 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
285 Ext
.define("OMV.module.admin.storage.zfs.ExpandPool", {
286 extend
: "OMV.workspace.window.Form",
290 "OMV.data.proxy.Rpc",
291 "OMV.data.reader.RpcArray"
295 rpcSetMethod
: "expandPool",
300 getFormItems: function() {
305 fieldLabel
: _("Name"),
312 fieldLabel
: _("Vdev type"),
314 store
: Ext
.create("Ext.data.ArrayStore", {
315 fields
: [ "value", "text" ],
317 [ "basic", _("Basic") ],
318 [ "mirror", _("Mirror") ],
319 [ "raidz1", _("RAID-Z1") ],
320 [ "raidz2", _("RAID-Z2") ],
321 [ "raidz3", _("RAID-Z3") ]
324 displayField
: "text",
328 triggerAction
: "all",
332 change: function(combo
, value
) {
333 var devicesField
= this.findField("devices");
336 devicesField
.minSelections
= 1;
339 devicesField
.minSelections
= 2;
342 devicesField
.minSelections
= 3;
345 devicesField
.minSelections
= 4;
348 devicesField
.minSelections
= 5;
351 devicesField
.minSelections
= 2;
354 devicesField
.validate();
358 xtype
: "checkboxgridfield",
360 fieldLabel
: _("Devices"),
361 valueField
: "devicefile",
362 minSelections
: 3, // Min. number of devices for RAIDZ-1
363 useStringValue
: true,
365 store
: Ext
.create("OMV.data.Store", {
367 model
: OMV
.data
.Model
.createImplicit({
368 idProperty
: "devicefile",
370 { name
: "devicefile", type
: "string" },
371 { name
: "size", type
: "string" },
372 { name
: "vendor", type
: "string" },
373 { name
: "serialnumber", type
: "string" }
378 appendSortParams
: false,
381 method
: "getCandidates"
386 property
: "devicefile"
391 stateId
: "05c60750-5074-11e4-916c-0800200c9a66",
395 dataIndex
: "devicefile",
396 stateId
: "devicefile",
399 xtype
: "binaryunitcolumn",
413 text
: _("Serial Number"),
415 dataIndex
: "serialnumber",
416 stateId
: "serialnumber",
423 fieldLabel
: _("Force creation"),
427 text
: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
434 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
435 extend
: "OMV.workspace.window.Grid",
443 rpcSetMethod
: "setProperties",
445 title
: _("Edit properties"),
449 getGridConfig: function() {
452 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
454 pluginId
: 'rowEditing',
456 validateedit: function(editor
, e
, eOpts
) {
457 e
.record
.set("modified", "true");
459 beforeedit: function(editor
, e
, eOpts
) {
460 if (e
.record
.get("newproperty") === "false") {
461 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
462 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
464 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
465 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
472 var store
= Ext
.create("OMV.data.Store", {
474 model
: OMV
.data
.Model
.createImplicit({
476 { name
: "property", type
: "string" },
477 { name
: "value", type
: "string" },
478 { name
: "source", type
: "string" },
479 { name
: "modified", type
: "string" },
480 { name
: "newproperty", type
: "string", defaultValue
: "false" }
487 method
: "getProperties",
499 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
501 plugins
: [rowEditing
],
504 text
: "Add property",
505 icon
: "images/add.png",
506 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
507 handler: function(view
) {
508 Ext
.define('Property', {
509 extend
: 'Ext.data.Model',
518 var newProperty
= Ext
.create("Property", {
525 rowEditing
.cancelEdit();
526 store
.insert(0, newProperty
);
527 rowEditing
.startEdit();
533 dataIndex
: "property",
556 xtype
: 'actioncolumn',
558 icon
: "images/checkmark.png",
560 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
561 OMV
.RpcObserver
.request({
562 msg
: _("Updating property..."),
569 property
: record
.get("property")
572 finish : function() {
573 view
.getStore().reload();
577 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
578 var src
= record
.get("source");
579 if(src
=== "local") {
587 dataIndex
: "newproperty",
588 stateId
: "newproperty",
594 dataIndex
: "modified",
601 getRpcSetParams: function() {
604 var values
= me
.getValues();
605 Ext
.Array
.each(values
, function(value
) {
606 if(value
.modified
=== "false")
609 "property": value
.property
,
610 "value": value
.value
,
616 properties
: properties
623 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
624 extend
: "OMV.workspace.window.Form",
628 "OMV.data.proxy.Rpc",
629 "OMV.data.reader.RpcArray"
633 rpcSetMethod
: "createShare",
636 getFormItems: function() {
641 fieldLabel
: _("Name"),
646 fieldLabel
: _("Path"),
652 fieldLabel
: _("Permissions"),
654 store
: Ext
.create("Ext.data.ArrayStore", {
655 fields
: [ "value", "text" ],
657 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
658 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
659 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
660 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
661 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
662 [ "777", _("Everyone: read/write") ]
665 displayField
: "text",
669 showItemTooltip
: true,
670 triggerAction
: "all",
674 text
: _("The file mode of the shared folder path.")
679 fieldLabel
: _("Comment"),
695 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
696 extend
: "OMV.module.admin.storage.zfs.TreePanel",
699 rpcGetMethod
: "getObjectTree",
708 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
723 renderer: function(value
, p
, r
){
724 if (r
.data
['type'] == "Pool") {
725 return r
.data
['type'] + ' (' + r
.data
['pool_type'] + ')';
727 return r
.data
['type'];
743 text
: _("Available"),
744 dataIndex
: 'available',
749 text
: _("Mountpoint"),
750 dataIndex
: 'mountpoint',
753 stateId
: 'mountpoint'
756 xtype
: 'actioncolumn',
757 tooltip
: 'Create shared folder',
759 icon
: 'images/checkmark.png',
760 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
762 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
763 title
: _("Create shared folder"),
764 rpcGetMethod
: "getSharedParams",
766 name
: record
.get('path'),
767 type
: record
.get('type')
771 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
772 var src
= record
.get("type");
773 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
781 xtype
: 'actioncolumn',
784 icon
: 'images/search.png',
785 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
787 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
788 title
: _("Object details"),
789 rpcGetMethod
: "getObjectDetails",
791 name
: record
.get('path'),
792 type
: record
.get('type')
804 initComponent: function() {
808 store
: Ext
.create("Ext.data.TreeStore", {
810 model
: OMV
.data
.Model
.createImplicit({
812 { name
: "name", type
: "string" },
813 { name
: "type", type
: "string" },
814 { name
: "size", type
: "string" },
815 { name
: "used", type
: "string" },
816 { name
: "available", type
: "string" },
817 { name
: "mountpoint", type
: "string" },
818 { name
: "id", type
: "string" },
819 { name
: "path", type
: "string" },
820 { name
: "origin", type
: "string", defaultValue
: "none" },
821 { name
: "shared", type
: "string", defaultValue
: "false" },
822 { name
: "pool_type", type
: "string"},
823 { name
: "nr_disks", type
: "string"}
830 method
: "getObjectTree",
836 me
.callParent(arguments
);
839 onAddButton: function() {
841 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
851 onAddObjButton: function() {
853 var sm
= me
.getSelectionModel();
854 var records
= sm
.getSelection();
855 var record
= records
[0];
856 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
857 title
: _("Add Object"),
858 path
: record
.get("path"),
868 onEditButton: function() {
870 var sm
= me
.getSelectionModel();
871 var records
= sm
.getSelection();
872 var record
= records
[0];
873 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
874 name
: record
.get("path"),
875 type
: record
.get("type")
879 onExpandPoolButton: function() {
881 var sm
= me
.getSelectionModel();
882 var records
= sm
.getSelection();
883 var record
= records
[0];
884 Ext
.create("OMV.module.admin.storage.zfs.ExpandPool", {
885 title
: _("Expand Pool"),
886 name
: record
.get("path"),
896 doDeletion: function(record
) {
900 callback
: me
.onDeletion
,
903 method
: "deleteObject",
905 name
: record
.get('path'),
906 type
: record
.get('type')
914 OMV
.WorkspaceManager
.registerPanel({
916 path
: "/storage/zfs",
919 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.154734 seconds and 4 git commands to generate.