]>
git.datanom.net - omvzfs.git/blob - gui/js/omv/module/admin/storage/zfs/Overview.js
22f74dbf3f97235e374268accdf870bec91870bb
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
: _("Force creation"),
144 boxLabel
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
148 doSubmit: function() {
150 OMV
.MessageBox
.show({
151 title
: _("Confirmation"),
152 msg
: _("Do you really want to create the ZFS pool?"),
153 buttons
: Ext
.Msg
.YESNO
,
154 fn: function(answer
) {
157 me
.superclass
.doSubmit
.call(me
);
160 icon
: Ext
.Msg
.QUESTION
165 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
166 extend
: "OMV.workspace.window.Form",
170 "OMV.data.proxy.Rpc",
171 "OMV.data.reader.RpcArray"
175 rpcSetMethod
: "addObject",
178 getFormItems: function() {
183 fieldLabel
: _("Object Type"),
186 [ "filesystem", "Filesystem" ],
187 [ "snapshot", "Snapshot" ],
188 [ "volume", "Volume" ]
192 triggerAction
: "all",
196 change: function(combo
, value
) {
197 var sizeField
= this.findField("size");
201 sizeField
.allowBlank
= false;
205 sizeField
.allowBlank
= true;
208 sizeField
.validate();
214 fieldLabel
: _("Prefix"),
220 fieldLabel
: _("Name"),
224 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
230 fieldLabel
: _("Size"),
234 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
242 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
243 extend
: "OMV.workspace.window.Grid",
251 rpcSetMethod
: "setProperties",
253 title
: _("Edit properties"),
257 getGridConfig: function() {
260 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
262 pluginId
: 'rowEditing',
264 validateedit: function(editor
, e
, eOpts
) {
265 e
.record
.set("modified", "true");
267 beforeedit: function(editor
, e
, eOpts
) {
268 if (e
.record
.get("property") === "mountpoint") {
269 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").disable();
270 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
271 } else if (e
.record
.get("newproperty") === "false") {
272 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
273 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
275 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
276 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
283 var store
= Ext
.create("OMV.data.Store", {
285 model
: OMV
.data
.Model
.createImplicit({
287 { name
: "property", type
: "string" },
288 { name
: "value", type
: "string" },
289 { name
: "source", type
: "string" },
290 { name
: "modified", type
: "string" },
291 { name
: "newproperty", type
: "string", defaultValue
: "false" }
298 method
: "getProperties",
310 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
312 plugins
: [rowEditing
],
315 text
: "Add property",
316 icon
: "images/add.png",
317 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
318 handler: function(view
) {
319 Ext
.define('Property', {
320 extend
: 'Ext.data.Model',
329 var newProperty
= Ext
.create("Property", {
336 rowEditing
.cancelEdit();
337 store
.insert(0, newProperty
);
338 rowEditing
.startEdit();
344 dataIndex
: "property",
367 xtype
: 'actioncolumn',
369 icon
: "images/checkmark.png",
371 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
372 OMV
.RpcObserver
.request({
373 msg
: _("Updating property..."),
380 property
: record
.get("property")
383 finish : function() {
384 view
.getStore().reload();
388 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
389 var src
= record
.get("source");
390 if(src
=== "local") {
398 dataIndex
: "newproperty",
399 stateId
: "newproperty",
405 dataIndex
: "modified",
412 getRpcSetParams: function() {
415 var values
= me
.getValues();
416 Ext
.Array
.each(values
, function(value
) {
417 if(value
.modified
=== "false")
420 "property": value
.property
,
421 "value": value
.value
,
427 properties
: properties
434 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
435 extend
: "OMV.workspace.window.Form",
439 "OMV.data.proxy.Rpc",
440 "OMV.data.reader.RpcArray"
444 rpcSetMethod
: "createShare",
447 getFormItems: function() {
452 fieldLabel
: _("Name"),
457 fieldLabel
: _("Path"),
463 fieldLabel
: _("Permissions"),
465 store
: Ext
.create("Ext.data.ArrayStore", {
466 fields
: [ "value", "text" ],
468 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
469 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
470 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
471 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
472 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
473 [ "777", _("Everyone: read/write") ]
476 displayField
: "text",
480 showItemTooltip
: true,
481 triggerAction
: "all",
485 text
: _("The file mode of the shared folder path.")
490 fieldLabel
: _("Comment"),
506 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
507 extend
: "OMV.module.admin.storage.zfs.TreePanel",
510 rpcGetMethod
: "getObjectTree",
519 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
536 xtype
: 'actioncolumn',
537 tooltip
: 'Create shared folder',
539 icon
: 'images/checkmark.png',
540 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
542 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
543 title
: _("Create shared folder"),
544 rpcGetMethod
: "getSharedParams",
546 name
: record
.get('path'),
547 type
: record
.get('type')
551 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
552 var src
= record
.get("type");
553 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
563 xtype
: 'actioncolumn',
566 icon
: 'images/search.png'
575 initComponent: function() {
579 store
: Ext
.create("Ext.data.TreeStore", {
581 model
: OMV
.data
.Model
.createImplicit({
583 { name
: "name", type
: "string" },
584 { name
: "type", type
: "string" },
585 { name
: "id", type
: "string" },
586 { name
: "path", type
: "string" },
587 { name
: "origin", type
: "string", defaultValue
: "none" },
588 { name
: "shared", type
: "string", defaultValue
: "false" }
595 method
: "getObjectTree",
601 me
.callParent(arguments
);
604 onAddButton: function() {
606 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
616 onAddObjButton: function() {
618 var sm
= me
.getSelectionModel();
619 var records
= sm
.getSelection();
620 var record
= records
[0];
621 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
622 title
: _("Add Object"),
623 rpcGetMethod
: "passParam",
626 value
: record
.get('path')
637 onEditButton: function() {
639 var sm
= me
.getSelectionModel();
640 var records
= sm
.getSelection();
641 var record
= records
[0];
642 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
643 name
: record
.get("path"),
644 type
: record
.get("type")
648 doDeletion: function(record
) {
652 callback
: me
.onDeletion
,
655 method
: "deleteObject",
657 name
: record
.get('path'),
658 type
: record
.get('type')
666 OMV
.WorkspaceManager
.registerPanel({
668 path
: "/storage/zfs",
671 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.211392 seconds and 4 git commands to generate.