]>
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 doSubmit: function() {
144 OMV
.MessageBox
.show({
145 title
: _("Confirmation"),
146 msg
: _("Do you really want to create the ZFS pool?"),
147 buttons
: Ext
.Msg
.YESNO
,
148 fn: function(answer
) {
151 me
.superclass
.doSubmit
.call(me
);
154 icon
: Ext
.Msg
.QUESTION
159 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
160 extend
: "OMV.workspace.window.Form",
164 "OMV.data.proxy.Rpc",
165 "OMV.data.reader.RpcArray"
169 rpcSetMethod
: "addObject",
172 getFormItems: function() {
177 fieldLabel
: _("Object Type"),
180 [ "filesystem", "Filesystem" ],
181 [ "snapshot", "Snapshot" ],
182 [ "volume", "Volume" ]
186 triggerAction
: "all",
190 change: function(combo
, value
) {
191 var sizeField
= this.findField("size");
195 sizeField
.allowBlank
= false;
199 sizeField
.allowBlank
= true;
202 sizeField
.validate();
208 fieldLabel
: _("Prefix"),
214 fieldLabel
: _("Name"),
218 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
224 fieldLabel
: _("Size"),
228 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
236 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
237 extend
: "OMV.workspace.window.Grid",
245 rpcSetMethod
: "setProperties",
247 title
: _("Edit properties"),
251 getGridConfig: function() {
254 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
256 pluginId
: 'rowEditing',
258 validateedit: function(editor
, e
, eOpts
) {
259 e
.record
.set("modified", "true");
261 beforeedit: function(editor
, e
, eOpts
) {
262 if (e
.record
.get("property") === "mountpoint") {
263 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").disable();
264 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
265 } else if (e
.record
.get("newproperty") === "false") {
266 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
267 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
269 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
270 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
277 var store
= Ext
.create("OMV.data.Store", {
279 model
: OMV
.data
.Model
.createImplicit({
281 { name
: "property", type
: "string" },
282 { name
: "value", type
: "string" },
283 { name
: "source", type
: "string" },
284 { name
: "modified", type
: "string" },
285 { name
: "newproperty", type
: "string", defaultValue
: "false" }
292 method
: "getProperties",
304 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
306 plugins
: [rowEditing
],
309 text
: "Add property",
310 icon
: "images/add.png",
311 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
312 handler: function(view
) {
313 Ext
.define('Property', {
314 extend
: 'Ext.data.Model',
323 var newProperty
= Ext
.create("Property", {
330 rowEditing
.cancelEdit();
331 store
.insert(0, newProperty
);
332 rowEditing
.startEdit();
338 dataIndex
: "property",
361 xtype
: 'actioncolumn',
363 icon
: "images/checkmark.png",
365 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
366 OMV
.RpcObserver
.request({
367 msg
: _("Updating property..."),
374 property
: record
.get("property")
377 finish : function() {
378 view
.getStore().reload();
382 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
383 var src
= record
.get("source");
384 if(src
=== "local") {
392 dataIndex
: "newproperty",
393 stateId
: "newproperty",
399 dataIndex
: "modified",
406 getRpcSetParams: function() {
409 var values
= me
.getValues();
410 Ext
.Array
.each(values
, function(value
) {
411 if(value
.modified
=== "false")
414 "property": value
.property
,
415 "value": value
.value
,
421 properties
: properties
428 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
429 extend
: "OMV.workspace.window.Form",
433 "OMV.data.proxy.Rpc",
434 "OMV.data.reader.RpcArray"
438 rpcSetMethod
: "createShare",
441 getFormItems: function() {
446 fieldLabel
: _("Name"),
451 fieldLabel
: _("Path"),
457 fieldLabel
: _("Permissions"),
459 store
: Ext
.create("Ext.data.ArrayStore", {
460 fields
: [ "value", "text" ],
462 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
463 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
464 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
465 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
466 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
467 [ "777", _("Everyone: read/write") ]
470 displayField
: "text",
474 showItemTooltip
: true,
475 triggerAction
: "all",
479 text
: _("The file mode of the shared folder path.")
484 fieldLabel
: _("Comment"),
500 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
501 extend
: "OMV.module.admin.storage.zfs.TreePanel",
504 rpcGetMethod
: "getObjectTree",
513 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
530 xtype
: 'actioncolumn',
531 tooltip
: 'Create shared folder',
533 icon
: 'images/checkmark.png',
534 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
536 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
537 title
: _("Create shared folder"),
538 rpcGetMethod
: "getSharedParams",
540 name
: record
.get('path'),
541 type
: record
.get('type')
545 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
546 var src
= record
.get("type");
547 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
557 xtype
: 'actioncolumn',
560 icon
: 'images/zfs_mag.png'
569 initComponent: function() {
573 store
: Ext
.create("Ext.data.TreeStore", {
575 model
: OMV
.data
.Model
.createImplicit({
577 { name
: "name", type
: "string" },
578 { name
: "type", type
: "string" },
579 { name
: "id", type
: "string" },
580 { name
: "path", type
: "string" },
581 { name
: "origin", type
: "string", defaultValue
: "none" },
582 { name
: "shared", type
: "string", defaultValue
: "false" }
589 method
: "getObjectTree",
595 me
.callParent(arguments
);
598 onAddButton: function() {
600 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
610 onAddObjButton: function() {
612 var sm
= me
.getSelectionModel();
613 var records
= sm
.getSelection();
614 var record
= records
[0];
615 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
616 title
: _("Add Object"),
617 rpcGetMethod
: "passParam",
620 value
: record
.get('path')
631 onEditButton: function() {
633 var sm
= me
.getSelectionModel();
634 var records
= sm
.getSelection();
635 var record
= records
[0];
636 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
637 name
: record
.get("path"),
638 type
: record
.get("type")
642 doDeletion: function(record
) {
646 callback
: me
.onDeletion
,
649 method
: "deleteObject",
651 name
: record
.get('path'),
652 type
: record
.get('type')
660 OMV
.WorkspaceManager
.registerPanel({
662 path
: "/storage/zfs",
665 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.216835 seconds and 6 git commands to generate.