]>
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
: _("Pool type"),
316 xtype
: "checkboxgridfield",
318 fieldLabel
: _("Devices"),
319 valueField
: "devicefile",
322 change: function(e
, eOpts
) {
323 var deviceField
= this.findField("devices");
324 if (me
.pool_type
== "Basic") {
325 deviceField
.minSelections
= 1;
327 deviceField
.minSelections
= me
.nr_disks
;
328 deviceField
.maxSelections
= me
.nr_disks
;
332 useStringValue
: true,
334 store
: Ext
.create("OMV.data.Store", {
336 model
: OMV
.data
.Model
.createImplicit({
337 idProperty
: "devicefile",
339 { name
: "devicefile", type
: "string" },
340 { name
: "size", type
: "string" },
341 { name
: "vendor", type
: "string" },
342 { name
: "serialnumber", type
: "string" }
347 appendSortParams
: false,
350 method
: "getCandidates"
355 property
: "devicefile"
360 stateId
: "04942d40-4ee3-11e4-916c-0800200c9a66",
364 dataIndex
: "devicefile",
365 stateId
: "devicefile",
368 xtype
: "binaryunitcolumn",
382 text
: _("Serial Number"),
384 dataIndex
: "serialnumber",
385 stateId
: "serialnumber",
394 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
395 extend
: "OMV.workspace.window.Grid",
403 rpcSetMethod
: "setProperties",
405 title
: _("Edit properties"),
409 getGridConfig: function() {
412 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
414 pluginId
: 'rowEditing',
416 validateedit: function(editor
, e
, eOpts
) {
417 e
.record
.set("modified", "true");
419 beforeedit: function(editor
, e
, eOpts
) {
420 if (e
.record
.get("newproperty") === "false") {
421 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
422 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
424 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
425 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
432 var store
= Ext
.create("OMV.data.Store", {
434 model
: OMV
.data
.Model
.createImplicit({
436 { name
: "property", type
: "string" },
437 { name
: "value", type
: "string" },
438 { name
: "source", type
: "string" },
439 { name
: "modified", type
: "string" },
440 { name
: "newproperty", type
: "string", defaultValue
: "false" }
447 method
: "getProperties",
459 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
461 plugins
: [rowEditing
],
464 text
: "Add property",
465 icon
: "images/add.png",
466 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
467 handler: function(view
) {
468 Ext
.define('Property', {
469 extend
: 'Ext.data.Model',
478 var newProperty
= Ext
.create("Property", {
485 rowEditing
.cancelEdit();
486 store
.insert(0, newProperty
);
487 rowEditing
.startEdit();
493 dataIndex
: "property",
516 xtype
: 'actioncolumn',
518 icon
: "images/checkmark.png",
520 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
521 OMV
.RpcObserver
.request({
522 msg
: _("Updating property..."),
529 property
: record
.get("property")
532 finish : function() {
533 view
.getStore().reload();
537 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
538 var src
= record
.get("source");
539 if(src
=== "local") {
547 dataIndex
: "newproperty",
548 stateId
: "newproperty",
554 dataIndex
: "modified",
561 getRpcSetParams: function() {
564 var values
= me
.getValues();
565 Ext
.Array
.each(values
, function(value
) {
566 if(value
.modified
=== "false")
569 "property": value
.property
,
570 "value": value
.value
,
576 properties
: properties
583 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
584 extend
: "OMV.workspace.window.Form",
588 "OMV.data.proxy.Rpc",
589 "OMV.data.reader.RpcArray"
593 rpcSetMethod
: "createShare",
596 getFormItems: function() {
601 fieldLabel
: _("Name"),
606 fieldLabel
: _("Path"),
612 fieldLabel
: _("Permissions"),
614 store
: Ext
.create("Ext.data.ArrayStore", {
615 fields
: [ "value", "text" ],
617 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
618 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
619 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
620 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
621 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
622 [ "777", _("Everyone: read/write") ]
625 displayField
: "text",
629 showItemTooltip
: true,
630 triggerAction
: "all",
634 text
: _("The file mode of the shared folder path.")
639 fieldLabel
: _("Comment"),
655 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
656 extend
: "OMV.module.admin.storage.zfs.TreePanel",
659 rpcGetMethod
: "getObjectTree",
668 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
683 renderer: function(value
, p
, r
){
684 if (r
.data
['type'] == "Pool") {
685 return r
.data
['type'] + ' (' + r
.data
['pool_type'] + ')';
687 return r
.data
['type'];
703 text
: _("Available"),
704 dataIndex
: 'available',
709 text
: _("Mountpoint"),
710 dataIndex
: 'mountpoint',
713 stateId
: 'mountpoint'
716 xtype
: 'actioncolumn',
717 tooltip
: 'Create shared folder',
719 icon
: 'images/checkmark.png',
720 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
722 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
723 title
: _("Create shared folder"),
724 rpcGetMethod
: "getSharedParams",
726 name
: record
.get('path'),
727 type
: record
.get('type')
731 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
732 var src
= record
.get("type");
733 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
741 xtype
: 'actioncolumn',
744 icon
: 'images/search.png',
745 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
747 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
748 title
: _("Object details"),
749 rpcGetMethod
: "getObjectDetails",
751 name
: record
.get('path'),
752 type
: record
.get('type')
764 initComponent: function() {
768 store
: Ext
.create("Ext.data.TreeStore", {
770 model
: OMV
.data
.Model
.createImplicit({
772 { name
: "name", type
: "string" },
773 { name
: "type", type
: "string" },
774 { name
: "size", type
: "string" },
775 { name
: "used", type
: "string" },
776 { name
: "available", type
: "string" },
777 { name
: "mountpoint", type
: "string" },
778 { name
: "id", type
: "string" },
779 { name
: "path", type
: "string" },
780 { name
: "origin", type
: "string", defaultValue
: "none" },
781 { name
: "shared", type
: "string", defaultValue
: "false" },
782 { name
: "pool_type", type
: "string"},
783 { name
: "nr_disks", type
: "string"}
790 method
: "getObjectTree",
796 me
.callParent(arguments
);
799 onAddButton: function() {
801 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
811 onAddObjButton: function() {
813 var sm
= me
.getSelectionModel();
814 var records
= sm
.getSelection();
815 var record
= records
[0];
816 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
817 title
: _("Add Object"),
818 path
: record
.get("path"),
828 onEditButton: function() {
830 var sm
= me
.getSelectionModel();
831 var records
= sm
.getSelection();
832 var record
= records
[0];
833 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
834 name
: record
.get("path"),
835 type
: record
.get("type")
839 onExpandPoolButton: function() {
841 var sm
= me
.getSelectionModel();
842 var records
= sm
.getSelection();
843 var record
= records
[0];
844 Ext
.create("OMV.module.admin.storage.zfs.ExpandPool", {
845 title
: _("Expand Pool"),
846 name
: record
.get("path"),
847 type
: record
.get("type"),
848 pool_type
: record
.get("pool_type"),
849 nr_disks
: record
.get("nr_disks"),
859 doDeletion: function(record
) {
863 callback
: me
.onDeletion
,
866 method
: "deleteObject",
868 name
: record
.get('path'),
869 type
: record
.get('type')
877 OMV
.WorkspaceManager
.registerPanel({
879 path
: "/storage/zfs",
882 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.176831 seconds and 6 git commands to generate.