]>
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
: _("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");
267 sizeField
.allowBlank
= false;
273 sizeField
.allowBlank
= true;
278 sizeField
.allowBlank
= true;
283 sizeField
.validate();
289 fieldLabel
: _("Prefix"),
295 beforerender: function(e
, eOpts
) {
296 var pathField
= this.findField("path");
297 if (me
.parenttype
=== "Snapshot") {
298 pathField
.fieldLabel
= _("Snapshot to clone");
300 pathField
.fieldLabel
= _("Prefix");
308 fieldLabel
: _("Name"),
312 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
316 beforerender: function(e
, eOpts
) {
317 var nameField
= this.findField("name");
318 if (me
.parenttype
=== "Snapshot") {
320 nameField
.allowBlank
= true;
323 nameField
.allowBlank
= false;
331 fieldLabel
: _("Clone name"),
335 text
: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.")
339 beforerender: function(e
, eOpts
) {
340 var cloneField
= this.findField("clonename");
341 if (me
.parenttype
=== "Snapshot") {
343 cloneField
.allowBlank
= false;
346 cloneField
.allowBlank
= true;
355 fieldLabel
: _("Size"),
359 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
365 Ext
.define("OMV.module.admin.storage.zfs.ExpandPool", {
366 extend
: "OMV.workspace.window.Form",
370 "OMV.data.proxy.Rpc",
371 "OMV.data.reader.RpcArray"
375 rpcSetMethod
: "expandPool",
380 getFormItems: function() {
385 fieldLabel
: _("Name"),
392 fieldLabel
: _("Vdev type"),
394 store
: Ext
.create("Ext.data.ArrayStore", {
395 fields
: [ "value", "text" ],
397 [ "basic", _("Basic") ],
398 [ "mirror", _("Mirror") ],
399 [ "raidz1", _("RAID-Z1") ],
400 [ "raidz2", _("RAID-Z2") ],
401 [ "raidz3", _("RAID-Z3") ]
404 displayField
: "text",
408 triggerAction
: "all",
412 change: function(combo
, value
) {
413 var devicesField
= this.findField("devices");
416 devicesField
.minSelections
= 1;
419 devicesField
.minSelections
= 2;
422 devicesField
.minSelections
= 3;
425 devicesField
.minSelections
= 4;
428 devicesField
.minSelections
= 5;
431 devicesField
.minSelections
= 2;
434 devicesField
.validate();
438 xtype
: "checkboxgridfield",
440 fieldLabel
: _("Devices"),
441 valueField
: "devicefile",
442 minSelections
: 3, // Min. number of devices for RAIDZ-1
443 useStringValue
: true,
445 store
: Ext
.create("OMV.data.Store", {
447 model
: OMV
.data
.Model
.createImplicit({
448 idProperty
: "devicefile",
450 { name
: "devicefile", type
: "string" },
451 { name
: "size", type
: "string" },
452 { name
: "vendor", type
: "string" },
453 { name
: "serialnumber", type
: "string" }
458 appendSortParams
: false,
461 method
: "getCandidates"
466 property
: "devicefile"
471 stateId
: "05c60750-5074-11e4-916c-0800200c9a66",
475 dataIndex
: "devicefile",
476 stateId
: "devicefile",
479 xtype
: "binaryunitcolumn",
493 text
: _("Serial Number"),
495 dataIndex
: "serialnumber",
496 stateId
: "serialnumber",
503 fieldLabel
: _("Force creation"),
507 text
: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
514 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
515 extend
: "OMV.workspace.window.Grid",
523 rpcSetMethod
: "setProperties",
525 title
: _("Edit properties"),
529 getGridConfig: function() {
532 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
534 pluginId
: 'rowEditing',
536 validateedit: function(editor
, e
, eOpts
) {
537 e
.record
.set("modified", "true");
539 beforeedit: function(editor
, e
, eOpts
) {
540 if (e
.record
.get("newproperty") === "false") {
541 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
542 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
544 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
545 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
552 var store
= Ext
.create("OMV.data.Store", {
554 model
: OMV
.data
.Model
.createImplicit({
556 { name
: "property", type
: "string" },
557 { name
: "value", type
: "string" },
558 { name
: "source", type
: "string" },
559 { name
: "modified", type
: "string" },
560 { name
: "newproperty", type
: "string", defaultValue
: "false" }
567 method
: "getProperties",
579 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
581 plugins
: [rowEditing
],
584 text
: "Add property",
585 icon
: "images/add.png",
586 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
587 handler: function(view
) {
588 Ext
.define('Property', {
589 extend
: 'Ext.data.Model',
598 var newProperty
= Ext
.create("Property", {
605 rowEditing
.cancelEdit();
606 store
.insert(0, newProperty
);
607 rowEditing
.startEdit();
613 dataIndex
: "property",
636 xtype
: 'actioncolumn',
638 icon
: "images/checkmark.png",
640 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
641 OMV
.RpcObserver
.request({
642 msg
: _("Updating property..."),
649 property
: record
.get("property")
652 finish : function() {
653 view
.getStore().reload();
657 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
658 var src
= record
.get("source");
659 if(src
=== "local") {
667 dataIndex
: "newproperty",
668 stateId
: "newproperty",
674 dataIndex
: "modified",
681 getRpcSetParams: function() {
684 var values
= me
.getValues();
685 Ext
.Array
.each(values
, function(value
) {
686 if(value
.modified
=== "false")
689 "property": value
.property
,
690 "value": value
.value
,
696 properties
: properties
703 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
704 extend
: "OMV.workspace.window.Form",
708 "OMV.data.proxy.Rpc",
709 "OMV.data.reader.RpcArray"
713 rpcSetMethod
: "createShare",
716 getFormItems: function() {
721 fieldLabel
: _("Name"),
726 fieldLabel
: _("Path"),
732 fieldLabel
: _("Permissions"),
734 store
: Ext
.create("Ext.data.ArrayStore", {
735 fields
: [ "value", "text" ],
737 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
738 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
739 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
740 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
741 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
742 [ "777", _("Everyone: read/write") ]
745 displayField
: "text",
749 showItemTooltip
: true,
750 triggerAction
: "all",
754 text
: _("The file mode of the shared folder path.")
759 fieldLabel
: _("Comment"),
775 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
776 extend
: "OMV.module.admin.storage.zfs.TreePanel",
779 rpcGetMethod
: "getObjectTree",
788 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
797 renderer: function(value
, p
, r
){
798 if (r
.data
['origin'] === "n/a") {
799 return r
.data
['name'];
801 return r
.data
['name'] + ' (' + r
.data
['origin'] + ')';
810 renderer: function(value
, p
, r
){
811 if (r
.data
['origin'] === "n/a") {
812 return r
.data
['type'];
830 text
: _("Available"),
831 dataIndex
: 'available',
836 text
: _("Mountpoint"),
837 dataIndex
: 'mountpoint',
840 stateId
: 'mountpoint'
843 xtype
: 'actioncolumn',
844 tooltip
: 'Create shared folder',
846 icon
: 'images/checkmark.png',
847 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
849 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
850 title
: _("Create shared folder"),
851 rpcGetMethod
: "getSharedParams",
853 name
: record
.get('path'),
854 type
: record
.get('type')
858 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
859 var src
= record
.get("type");
860 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
868 xtype
: 'actioncolumn',
871 icon
: 'images/search.png',
872 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
874 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
875 title
: _("Object details"),
876 rpcGetMethod
: "getObjectDetails",
878 name
: record
.get('path'),
879 type
: record
.get('type')
891 initComponent: function() {
895 store
: Ext
.create("Ext.data.TreeStore", {
897 model
: OMV
.data
.Model
.createImplicit({
899 { name
: "name", type
: "string" },
900 { name
: "type", type
: "string" },
901 { name
: "size", type
: "string" },
902 { name
: "used", type
: "string" },
903 { name
: "available", type
: "string" },
904 { name
: "mountpoint", type
: "string" },
905 { name
: "id", type
: "string" },
906 { name
: "path", type
: "string" },
907 { name
: "origin", type
: "string", defaultValue
: "none" },
908 { name
: "shared", type
: "string", defaultValue
: "false" },
909 { name
: "pool_type", type
: "string"},
910 { name
: "nr_disks", type
: "string"}
917 method
: "getObjectTree",
923 me
.callParent(arguments
);
926 onAddButton: function() {
928 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
938 onAddObjButton: function() {
940 var sm
= me
.getSelectionModel();
941 var records
= sm
.getSelection();
942 var record
= records
[0];
943 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
944 title
: _("Add Object"),
945 path
: record
.get("path"),
946 parenttype
: record
.get("type"),
956 onEditButton: function() {
958 var sm
= me
.getSelectionModel();
959 var records
= sm
.getSelection();
960 var record
= records
[0];
961 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
962 name
: record
.get("path"),
963 type
: record
.get("type")
967 onExpandPoolButton: function() {
969 var sm
= me
.getSelectionModel();
970 var records
= sm
.getSelection();
971 var record
= records
[0];
972 Ext
.create("OMV.module.admin.storage.zfs.ExpandPool", {
973 title
: _("Expand Pool"),
974 name
: record
.get("path"),
984 doDeletion: function(record
) {
988 callback
: me
.onDeletion
,
991 method
: "deleteObject",
993 name
: record
.get('path'),
994 type
: record
.get('type')
1002 OMV
.WorkspaceManager
.registerPanel({
1004 path
: "/storage/zfs",
1005 text
: _("Overview"),
1007 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.172404 seconds and 6 git commands to generate.