]>
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.AddPool", {
7 extend
: "OMV.workspace.window.Form",
12 "OMV.form.field.CheckboxGrid"
16 rpcSetMethod
: "addPool",
17 title
: _("Create ZFS pool"),
19 hideResetButton
: true,
23 getFormItems: function() {
32 fieldLabel
: _("Pool type"),
34 store
: Ext
.create("Ext.data.ArrayStore", {
35 fields
: [ "value", "text" ],
37 [ "basic", _("Basic") ],
38 [ "mirror", _("Mirror") ],
39 [ "raidz1", _("RAID-Z1") ],
40 [ "raidz2", _("RAID-Z2") ],
41 [ "raidz3", _("RAID-Z3") ]
52 change: function(combo
, value
) {
53 var devicesField
= this.findField("devices");
56 devicesField
.minSelections
= 1;
59 devicesField
.minSelections
= 2;
62 devicesField
.minSelections
= 3;
65 devicesField
.minSelections
= 4;
67 devicesField
.minSelections
= 5;
70 devicesField
.minSelections
= 2;
73 devicesField
.validate();
77 xtype
: "checkboxgridfield",
79 fieldLabel
: _("Devices"),
80 valueField
: "devicefile",
81 minSelections
: 3, // Min. number of devices for RAIDZ-1
84 store
: Ext
.create("OMV.data.Store", {
86 model
: OMV
.data
.Model
.createImplicit({
87 idProperty
: "devicefile",
89 { name
: "devicefile", type
: "string" },
90 { name
: "size", type
: "string" },
91 { name
: "vendor", type
: "string" },
92 { name
: "serialnumber", type
: "string" }
97 appendSortParams
: false,
100 method
: "getCandidates"
105 property
: "devicefile"
110 stateId
: "1866b5d0-327e-11e4-8c21-0800200c9a66",
114 dataIndex
: "devicefile",
115 stateId
: "devicefile",
118 xtype
: "binaryunitcolumn",
132 text
: _("Serial Number"),
134 dataIndex
: "serialnumber",
135 stateId
: "serialnumber",
142 fieldLabel
: _("Mountpoint"),
145 text
: _("Optional mountpoint for the pool. Default is to use pool name.")
150 fieldLabel
: _("Force creation"),
152 boxLabel
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
156 doSubmit: function() {
158 OMV
.MessageBox
.show({
159 title
: _("Confirmation"),
160 msg
: _("Do you really want to create the ZFS pool?"),
161 buttons
: Ext
.Msg
.YESNO
,
162 fn: function(answer
) {
165 me
.superclass
.doSubmit
.call(me
);
168 icon
: Ext
.Msg
.QUESTION
173 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
174 extend
: "OMV.workspace.window.Form",
178 "OMV.data.proxy.Rpc",
179 "OMV.data.reader.RpcArray"
183 rpcSetMethod
: "addObject",
186 getFormItems: function() {
191 fieldLabel
: _("Object Type"),
194 [ "filesystem", "Filesystem" ],
195 [ "snapshot", "Snapshot" ],
196 [ "volume", "Volume" ]
200 triggerAction
: "all",
204 change: function(combo
, value
) {
205 var sizeField
= this.findField("size");
209 sizeField
.allowBlank
= false;
213 sizeField
.allowBlank
= true;
216 sizeField
.validate();
222 fieldLabel
: _("Prefix"),
228 fieldLabel
: _("Name"),
232 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
238 fieldLabel
: _("Size"),
242 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
250 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
251 extend
: "OMV.workspace.window.Grid",
259 rpcSetMethod
: "setProperties",
261 title
: _("Edit properties"),
265 getGridConfig: function() {
268 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
270 pluginId
: 'rowEditing',
272 validateedit: function(editor
, e
, eOpts
) {
273 e
.record
.set("modified", "true");
275 beforeedit: function(editor
, e
, eOpts
) {
276 if (e
.record
.get("property") === "mountpoint") {
277 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").disable();
278 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
279 } else if (e
.record
.get("newproperty") === "false") {
280 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
281 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
283 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
284 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
291 var store
= Ext
.create("OMV.data.Store", {
293 model
: OMV
.data
.Model
.createImplicit({
295 { name
: "property", type
: "string" },
296 { name
: "value", type
: "string" },
297 { name
: "source", type
: "string" },
298 { name
: "modified", type
: "string" },
299 { name
: "newproperty", type
: "string", defaultValue
: "false" }
306 method
: "getProperties",
318 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
320 plugins
: [rowEditing
],
323 text
: "Add property",
324 icon
: "images/add.png",
325 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
326 handler: function(view
) {
327 Ext
.define('Property', {
328 extend
: 'Ext.data.Model',
337 var newProperty
= Ext
.create("Property", {
344 rowEditing
.cancelEdit();
345 store
.insert(0, newProperty
);
346 rowEditing
.startEdit();
352 dataIndex
: "property",
375 xtype
: 'actioncolumn',
377 icon
: "images/checkmark.png",
379 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
380 OMV
.RpcObserver
.request({
381 msg
: _("Updating property..."),
388 property
: record
.get("property")
391 finish : function() {
392 view
.getStore().reload();
396 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
397 var src
= record
.get("source");
398 if(src
=== "local") {
406 dataIndex
: "newproperty",
407 stateId
: "newproperty",
413 dataIndex
: "modified",
420 getRpcSetParams: function() {
423 var values
= me
.getValues();
424 Ext
.Array
.each(values
, function(value
) {
425 if(value
.modified
=== "false")
428 "property": value
.property
,
429 "value": value
.value
,
435 properties
: properties
442 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
443 extend
: "OMV.workspace.window.Form",
447 "OMV.data.proxy.Rpc",
448 "OMV.data.reader.RpcArray"
452 rpcSetMethod
: "createShare",
455 getFormItems: function() {
460 fieldLabel
: _("Name"),
465 fieldLabel
: _("Path"),
471 fieldLabel
: _("Permissions"),
473 store
: Ext
.create("Ext.data.ArrayStore", {
474 fields
: [ "value", "text" ],
476 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
477 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
478 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
479 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
480 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
481 [ "777", _("Everyone: read/write") ]
484 displayField
: "text",
488 showItemTooltip
: true,
489 triggerAction
: "all",
493 text
: _("The file mode of the shared folder path.")
498 fieldLabel
: _("Comment"),
514 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
515 extend
: "OMV.module.admin.storage.zfs.TreePanel",
518 rpcGetMethod
: "getObjectTree",
527 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
544 xtype
: 'actioncolumn',
545 tooltip
: 'Create shared folder',
547 icon
: 'images/checkmark.png',
548 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
550 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
551 title
: _("Create shared folder"),
552 rpcGetMethod
: "getSharedParams",
554 name
: record
.get('path'),
555 type
: record
.get('type')
559 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
560 var src
= record
.get("type");
561 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
571 xtype
: 'actioncolumn',
574 icon
: 'images/search.png'
583 initComponent: function() {
587 store
: Ext
.create("Ext.data.TreeStore", {
589 model
: OMV
.data
.Model
.createImplicit({
591 { name
: "name", type
: "string" },
592 { name
: "type", type
: "string" },
593 { name
: "id", type
: "string" },
594 { name
: "path", type
: "string" },
595 { name
: "origin", type
: "string", defaultValue
: "none" },
596 { name
: "shared", type
: "string", defaultValue
: "false" }
603 method
: "getObjectTree",
609 me
.callParent(arguments
);
612 onAddButton: function() {
614 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
624 onAddObjButton: function() {
626 var sm
= me
.getSelectionModel();
627 var records
= sm
.getSelection();
628 var record
= records
[0];
629 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
630 title
: _("Add Object"),
631 rpcGetMethod
: "passParam",
634 value
: record
.get('path')
645 onEditButton: function() {
647 var sm
= me
.getSelectionModel();
648 var records
= sm
.getSelection();
649 var record
= records
[0];
650 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
651 name
: record
.get("path"),
652 type
: record
.get("type")
656 doDeletion: function(record
) {
660 callback
: me
.onDeletion
,
663 method
: "deleteObject",
665 name
: record
.get('path'),
666 type
: record
.get('type')
674 OMV
.WorkspaceManager
.registerPanel({
676 path
: "/storage/zfs",
679 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.237501 seconds and 6 git commands to generate.