]>
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"),
184 boxLabel
: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
188 doSubmit: function() {
190 OMV
.MessageBox
.show({
191 title
: _("Confirmation"),
192 msg
: _("Do you really want to create the ZFS pool?"),
193 buttons
: Ext
.Msg
.YESNO
,
194 fn: function(answer
) {
197 me
.superclass
.doSubmit
.call(me
);
200 icon
: Ext
.Msg
.QUESTION
205 Ext
.define("OMV.module.admin.storage.zfs.AddObject", {
206 extend
: "OMV.workspace.window.Form",
210 "OMV.data.proxy.Rpc",
211 "OMV.data.reader.RpcArray"
215 rpcSetMethod
: "addObject",
218 getFormItems: function() {
223 fieldLabel
: _("Object Type"),
226 [ "filesystem", "Filesystem" ],
227 [ "snapshot", "Snapshot" ],
228 [ "volume", "Volume" ]
232 triggerAction
: "all",
236 change: function(combo
, value
) {
237 var sizeField
= this.findField("size");
241 sizeField
.allowBlank
= false;
245 sizeField
.allowBlank
= true;
248 sizeField
.validate();
254 fieldLabel
: _("Prefix"),
260 fieldLabel
: _("Name"),
264 text
: _("Name of the new object. Prefix will prepend the name. Please omit leading /")
270 fieldLabel
: _("Size"),
274 text
: _("Size of the volume e.g. 5mb,100gb,1tb etc")
282 Ext
.define("OMV.module.admin.storage.zfs.EditProperties", {
283 extend
: "OMV.workspace.window.Grid",
291 rpcSetMethod
: "setProperties",
293 title
: _("Edit properties"),
297 getGridConfig: function() {
300 var rowEditing
= Ext
.create('Ext.grid.plugin.RowEditing', {
302 pluginId
: 'rowEditing',
304 validateedit: function(editor
, e
, eOpts
) {
305 e
.record
.set("modified", "true");
307 beforeedit: function(editor
, e
, eOpts
) {
308 if (e
.record
.get("property") === "mountpoint") {
309 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").disable();
310 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
311 } else if (e
.record
.get("newproperty") === "false") {
312 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
313 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").disable();
315 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("value").enable();
316 e
.grid
.getPlugin('rowEditing').editor
.form
.findField("property").enable();
323 var store
= Ext
.create("OMV.data.Store", {
325 model
: OMV
.data
.Model
.createImplicit({
327 { name
: "property", type
: "string" },
328 { name
: "value", type
: "string" },
329 { name
: "source", type
: "string" },
330 { name
: "modified", type
: "string" },
331 { name
: "newproperty", type
: "string", defaultValue
: "false" }
338 method
: "getProperties",
350 stateId
: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66",
352 plugins
: [rowEditing
],
355 text
: "Add property",
356 icon
: "images/add.png",
357 iconCls
: Ext
.baseCSSPrefix
+ "btn-icon-16x16",
358 handler: function(view
) {
359 Ext
.define('Property', {
360 extend
: 'Ext.data.Model',
369 var newProperty
= Ext
.create("Property", {
376 rowEditing
.cancelEdit();
377 store
.insert(0, newProperty
);
378 rowEditing
.startEdit();
384 dataIndex
: "property",
407 xtype
: 'actioncolumn',
409 icon
: "images/checkmark.png",
411 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
412 OMV
.RpcObserver
.request({
413 msg
: _("Updating property..."),
420 property
: record
.get("property")
423 finish : function() {
424 view
.getStore().reload();
428 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
429 var src
= record
.get("source");
430 if(src
=== "local") {
438 dataIndex
: "newproperty",
439 stateId
: "newproperty",
445 dataIndex
: "modified",
452 getRpcSetParams: function() {
455 var values
= me
.getValues();
456 Ext
.Array
.each(values
, function(value
) {
457 if(value
.modified
=== "false")
460 "property": value
.property
,
461 "value": value
.value
,
467 properties
: properties
474 Ext
.define("OMV.module.admin.storage.zfs.CreateShare", {
475 extend
: "OMV.workspace.window.Form",
479 "OMV.data.proxy.Rpc",
480 "OMV.data.reader.RpcArray"
484 rpcSetMethod
: "createShare",
487 getFormItems: function() {
492 fieldLabel
: _("Name"),
497 fieldLabel
: _("Path"),
503 fieldLabel
: _("Permissions"),
505 store
: Ext
.create("Ext.data.ArrayStore", {
506 fields
: [ "value", "text" ],
508 [ "700", _("Administrator: read/write, Users: no access, Others: no access") ],
509 [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ],
510 [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ],
511 [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ],
512 [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ],
513 [ "777", _("Everyone: read/write") ]
516 displayField
: "text",
520 showItemTooltip
: true,
521 triggerAction
: "all",
525 text
: _("The file mode of the shared folder path.")
530 fieldLabel
: _("Comment"),
546 Ext
.define("OMV.module.admin.storage.zfs.Overview", {
547 extend
: "OMV.module.admin.storage.zfs.TreePanel",
550 rpcGetMethod
: "getObjectTree",
559 stateId
: "cec54550-bc2a-11e3-a5e2-0800200c9a66",
587 text
: _("Available"),
588 dataIndex
: 'available',
593 text
: _("Mountpoint"),
594 dataIndex
: 'mountpoint',
597 stateId
: 'mountpoint'
600 xtype
: 'actioncolumn',
601 tooltip
: 'Create shared folder',
603 icon
: 'images/checkmark.png',
604 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
606 Ext
.create("OMV.module.admin.storage.zfs.CreateShare", {
607 title
: _("Create shared folder"),
608 rpcGetMethod
: "getSharedParams",
610 name
: record
.get('path'),
611 type
: record
.get('type')
615 isDisabled: function(view
, rowIdx
, colIdx
, item
, record
) {
616 var src
= record
.get("type");
617 if((src
=== "Filesystem") && (record
.get("shared") === "false")) {
625 xtype
: 'actioncolumn',
628 icon
: 'images/search.png',
629 handler: function(view
, rowIndex
, colIndex
, item
, e
, record
, row
) {
631 Ext
.create("OMV.module.admin.storage.zfs.ShowDetails", {
632 title
: _("Object details"),
633 rpcGetMethod
: "getObjectDetails",
635 name
: record
.get('path'),
636 type
: record
.get('type')
648 initComponent: function() {
652 store
: Ext
.create("Ext.data.TreeStore", {
654 model
: OMV
.data
.Model
.createImplicit({
656 { name
: "name", type
: "string" },
657 { name
: "type", type
: "string" },
658 { name
: "size", type
: "string" },
659 { name
: "used", type
: "string" },
660 { name
: "available", type
: "string" },
661 { name
: "mountpoint", type
: "string" },
662 { name
: "id", type
: "string" },
663 { name
: "path", type
: "string" },
664 { name
: "origin", type
: "string", defaultValue
: "none" },
665 { name
: "shared", type
: "string", defaultValue
: "false" }
672 method
: "getObjectTree",
678 me
.callParent(arguments
);
681 onAddButton: function() {
683 Ext
.create("OMV.module.admin.storage.zfs.AddPool", {
693 onAddObjButton: function() {
695 var sm
= me
.getSelectionModel();
696 var records
= sm
.getSelection();
697 var record
= records
[0];
698 Ext
.create("OMV.module.admin.storage.zfs.AddObject", {
699 title
: _("Add Object"),
700 rpcGetMethod
: "passParam",
703 value
: record
.get('path')
714 onEditButton: function() {
716 var sm
= me
.getSelectionModel();
717 var records
= sm
.getSelection();
718 var record
= records
[0];
719 Ext
.create("OMV.module.admin.storage.zfs.EditProperties", {
720 name
: record
.get("path"),
721 type
: record
.get("type")
725 doDeletion: function(record
) {
729 callback
: me
.onDeletion
,
732 method
: "deleteObject",
734 name
: record
.get('path'),
735 type
: record
.get('type')
743 OMV
.WorkspaceManager
.registerPanel({
745 path
: "/storage/zfs",
748 className
: "OMV.module.admin.storage.zfs.Overview"
This page took 0.157837 seconds and 6 git commands to generate.