// require("js/omv/tree/Panel.js")
-// require("js/omv/module/admin/service/zfs/TreePanel.js")
+// require("js/omv/module/admin/storage/zfs/TreePanel.js")
// require("js/omv/workspace/window/Grid.js")
+// require("js/omv/form/field/CheckboxGrid.js")
-Ext.define("OMV.module.admin.services.zfs.AddObject", {
+Ext.define("OMV.module.admin.storage.zfs.ShowDetails", {
+ extend: "OMV.workspace.window.Form",
+ requires: [
+ "OMV.data.Store",
+ "OMV.data.Model",
+ "OMV.data.proxy.Rpc",
+ ],
+
+ rpcService: "ZFS",
+ title: _("Object details"),
+ autoLoadData: true,
+ hideResetButton: true,
+ hideCancelButton: true,
+ width: 550,
+ height: 350,
+ layout: 'fit',
+ okButtonText: _("Ok"),
+
+ getFormItems: function() {
+ var me = this;
+
+ return [{
+ xtype: "textareafield",
+ name: "details",
+ grow: true,
+ anchor: '100%',
+ readOnly: true
+ }];
+
+ }
+});
+
+Ext.define("OMV.module.admin.storage.zfs.AddPool", {
+ extend: "OMV.workspace.window.Form",
+ requires: [
+ "OMV.data.Store",
+ "OMV.data.Model",
+ "OMV.data.proxy.Rpc",
+ "OMV.form.field.CheckboxGrid"
+ ],
+
+ rpcService: "ZFS",
+ rpcSetMethod: "addPool",
+ title: _("Create ZFS pool"),
+ autoLoadData: false,
+ hideResetButton: true,
+ width: 550,
+ height: 350,
+
+ getFormItems: function() {
+ var me = this;
+ return [{
+ xtype: "textfield",
+ name: "name",
+ fieldLabel: _("Name")
+ },{
+ xtype: "combo",
+ name: "pooltype",
+ fieldLabel: _("Pool type"),
+ queryMode: "local",
+ store: Ext.create("Ext.data.ArrayStore", {
+ fields: [ "value", "text" ],
+ data: [
+ [ "basic", _("Basic") ],
+ [ "mirror", _("Mirror") ],
+ [ "raidz1", _("RAID-Z1") ],
+ [ "raidz2", _("RAID-Z2") ],
+ [ "raidz3", _("RAID-Z3") ]
+ ]
+ }),
+ displayField: "text",
+ valueField: "value",
+ allowBlank: false,
+ editable: false,
+ triggerAction: "all",
+ value: "raidz1",
+ listeners: {
+ scope: me,
+ change: function(combo, value) {
+ var devicesField = this.findField("devices");
+ switch(value) {
+ case "basic":
+ devicesField.minSelections = 1;
+ break;
+ case "mirror":
+ devicesField.minSelections = 2;
+ break;
+ case "raidz1":
+ devicesField.minSelections = 3;
+ break;
+ case "raidz2":
+ devicesField.minSelections = 4;
+ break;
+ case "raidz3":
+ devicesField.minSelections = 5;
+ break;
+ default:
+ devicesField.minSelections = 2;
+ break;
+ }
+ devicesField.validate();
+ }
+ }
+ },{
+ xtype: "checkboxgridfield",
+ name: "devices",
+ fieldLabel: _("Devices"),
+ valueField: "devicefile",
+ minSelections: 3, // Min. number of devices for RAIDZ-1
+ useStringValue: true,
+ height: 130,
+ store: Ext.create("OMV.data.Store", {
+ autoLoad: true,
+ model: OMV.data.Model.createImplicit({
+ idProperty: "devicefile",
+ fields: [
+ { name: "devicefile", type: "string" },
+ { name: "size", type: "string" },
+ { name: "vendor", type: "string" },
+ { name: "serialnumber", type: "string" }
+ ]
+ }),
+ proxy: {
+ type: "rpc",
+ appendSortParams: false,
+ rpcData: {
+ service: "RaidMgmt",
+ method: "getCandidates"
+ }
+ },
+ sorters: [{
+ direction: "ASC",
+ property: "devicefile"
+ }]
+ }),
+ gridConfig: {
+ stateful: true,
+ stateId: "1866b5d0-327e-11e4-8c21-0800200c9a66",
+ columns: [{
+ text: _("Device"),
+ sortable: true,
+ dataIndex: "devicefile",
+ stateId: "devicefile",
+ flex: 1
+ },{
+ xtype: "binaryunitcolumn",
+ text: _("Capacity"),
+ sortable: true,
+ dataIndex: "size",
+ stateId: "size",
+ width: 50,
+ flex: 1
+ },{
+ text: _("Vendor"),
+ sortable: true,
+ dataIndex: "vendor",
+ stateId: "vendor",
+ flex: 1
+ },{
+ text: _("Serial Number"),
+ sortable: true,
+ dataIndex: "serialnumber",
+ stateId: "serialnumber",
+ flex: 1
+ }]
+ }
+ },{
+ xtype: "textfield",
+ name: "mountpoint",
+ fieldLabel: _("Mountpoint"),
+ plugins: [{
+ ptype: "fieldinfo",
+ text: _("Optional mountpoint for the pool. Default is to use pool name.")
+ }]
+ },{
+ xtype: "checkbox",
+ name: "force",
+ fieldLabel: _("Force creation"),
+ checked: false,
+ plugins: [{
+ ptype: "fieldinfo",
+ text: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!")
+ }]
+ }];
+ },
+
+ doSubmit: function() {
+ var me = this;
+ OMV.MessageBox.show({
+ title: _("Confirmation"),
+ msg: _("Do you really want to create the ZFS pool?"),
+ buttons: Ext.Msg.YESNO,
+ fn: function(answer) {
+ if(answer === "no")
+ return;
+ me.superclass.doSubmit.call(me);
+ },
+ scope: me,
+ icon: Ext.Msg.QUESTION
+ });
+ }
+});
+
+Ext.define("OMV.module.admin.storage.zfs.AddObject", {
extend: "OMV.workspace.window.Form",
uses: [
"OMV.data.Store",
name: "path",
fieldLabel: _("Prefix"),
allowBlank: false,
- readOnly: true
+ readOnly: true,
+ value: me.path
},{
xtype: "textfield",
name: "name",
}
});
+Ext.define("OMV.module.admin.storage.zfs.ExpandPool", {
+ extend: "OMV.workspace.window.Form",
+ uses: [
+ "OMV.data.Store",
+ "OMV.data.Model",
+ "OMV.data.proxy.Rpc",
+ "OMV.data.reader.RpcArray"
+ ],
+
+ rpcService: "ZFS",
+ rpcSetMethod: "expandPool",
+ width: 550,
+ height: 350,
+ autoLoadData: true,
+
+ getFormItems: function() {
+ var me = this;
+ return [{
+ xtype: "textfield",
+ name: "name",
+ fieldLabel: _("Name"),
+ allowBlank: false,
+ readOnly: true,
+ value: me.name
+ },{
+ xtype: "combo",
+ name: "vdevtype",
+ fieldLabel: _("Vdev type"),
+ queryMode: "local",
+ store: Ext.create("Ext.data.ArrayStore", {
+ fields: [ "value", "text" ],
+ data: [
+ [ "basic", _("Basic") ],
+ [ "mirror", _("Mirror") ],
+ [ "raidz1", _("RAID-Z1") ],
+ [ "raidz2", _("RAID-Z2") ],
+ [ "raidz3", _("RAID-Z3") ]
+ ]
+ }),
+ displayField: "text",
+ valueField: "value",
+ allowBlank: false,
+ editable: false,
+ triggerAction: "all",
+ value: "raidz1",
+ listeners: {
+ scope: me,
+ change: function(combo, value) {
+ var devicesField = this.findField("devices");
+ switch(value) {
+ case "basic":
+ devicesField.minSelections = 1;
+ break;
+ case "mirror":
+ devicesField.minSelections = 2;
+ break;
+ case "raidz1":
+ devicesField.minSelections = 3;
+ break;
+ case "raidz2":
+ devicesField.minSelections = 4;
+ break;
+ case "raidz3":
+ devicesField.minSelections = 5;
+ break;
+ default:
+ devicesField.minSelections = 2;
+ break;
+ }
+ devicesField.validate();
+ }
+ }
+ },{
+ xtype: "checkboxgridfield",
+ name: "devices",
+ fieldLabel: _("Devices"),
+ valueField: "devicefile",
+ minSelections: 3, // Min. number of devices for RAIDZ-1
+ useStringValue: true,
+ height: 130,
+ store: Ext.create("OMV.data.Store", {
+ autoLoad: true,
+ model: OMV.data.Model.createImplicit({
+ idProperty: "devicefile",
+ fields: [
+ { name: "devicefile", type: "string" },
+ { name: "size", type: "string" },
+ { name: "vendor", type: "string" },
+ { name: "serialnumber", type: "string" }
+ ]
+ }),
+ proxy: {
+ type: "rpc",
+ appendSortParams: false,
+ rpcData: {
+ service: "RaidMgmt",
+ method: "getCandidates"
+ }
+ },
+ sorters: [{
+ direction: "ASC",
+ property: "devicefile"
+ }]
+ }),
+ gridConfig: {
+ stateful: true,
+ stateId: "05c60750-5074-11e4-916c-0800200c9a66",
+ columns: [{
+ text: _("Device"),
+ sortable: true,
+ dataIndex: "devicefile",
+ stateId: "devicefile",
+ flex: 1
+ },{
+ xtype: "binaryunitcolumn",
+ text: _("Capacity"),
+ sortable: true,
+ dataIndex: "size",
+ stateId: "size",
+ width: 50,
+ flex: 1
+ },{
+ text: _("Vendor"),
+ sortable: true,
+ dataIndex: "vendor",
+ stateId: "vendor",
+ flex: 1
+ },{
+ text: _("Serial Number"),
+ sortable: true,
+ dataIndex: "serialnumber",
+ stateId: "serialnumber",
+ flex: 1
+ }]
+ }
+ },{
+ xtype: "checkbox",
+ name: "force",
+ fieldLabel: _("Force creation"),
+ checked: false,
+ plugins: [{
+ ptype: "fieldinfo",
+ text: _("Forces the creation of the Vdev even if errors are reported. Use with extreme caution!")
+ }]
+ }];
+ }
+});
-Ext.define("OMV.module.admin.service.zfs.EditProperties", {
+Ext.define("OMV.module.admin.storage.zfs.EditProperties", {
extend: "OMV.workspace.window.Grid",
requires: [
"OMV.data.Store",
e.record.set("modified", "true");
},
beforeedit: function(editor, e, eOpts) {
- if (e.record.get("property") === "mountpoint") {
- e.grid.getPlugin('rowEditing').editor.form.findField("value").disable();
- e.grid.getPlugin('rowEditing').editor.form.findField("property").disable();
- } else if (e.record.get("newproperty") === "false") {
+ if (e.record.get("newproperty") === "false") {
e.grid.getPlugin('rowEditing').editor.form.findField("value").enable();
e.grid.getPlugin('rowEditing').editor.form.findField("property").disable();
} else {
value: "",
source: "local",
modified: "true",
- newproperty: "true"
+ newproperty: "true"
});
rowEditing.cancelEdit();
store.insert(0, newProperty);
stateId: "newproperty",
sortable: false,
hidden: true
- },{
+ },{
text: _("Modified"),
sortable: false,
dataIndex: "modified",
var values = me.getValues();
Ext.Array.each(values, function(value) {
if(value.modified === "false")
- return;
+ return;
properties.push({
"property": value.property,
"value": value.value,
});
-Ext.define("OMV.module.admin.services.zfs.CreateShare", {
+Ext.define("OMV.module.admin.storage.zfs.CreateShare", {
extend: "OMV.workspace.window.Form",
uses: [
"OMV.data.Store",
xtype: "textfield",
name: "mountpoint",
fieldLabel: _("Path"),
- allowBlank: false,
- readOnly: true
+ allowBlank: true,
+ readOnly: false
},{
xtype: "combo",
name: "mode",
-Ext.define("OMV.module.admin.service.zfs.Overview", {
- extend: "OMV.module.admin.services.zfs.TreePanel",
+Ext.define("OMV.module.admin.storage.zfs.Overview", {
+ extend: "OMV.module.admin.storage.zfs.TreePanel",
rpcService: "ZFS",
rpcGetMethod: "getObjectTree",
dataIndex: 'type',
sortable: true,
flex: 1,
- stateId: 'type'
+ stateId: 'type',
+ renderer: function(value, p, r){
+ if (r.data['type'] == "Pool") {
+ return r.data['type'] + ' (' + r.data['pool_type'] + ')';
+ } else {
+ return r.data['type'];
+ }
+ }
+ },{
+ text: _("Size"),
+ dataIndex: 'size',
+ sortable: true,
+ flex: 1,
+ stateId: 'size'
+ },{
+ text: _("Used"),
+ dataIndex: 'used',
+ sortable: true,
+ flex: 1,
+ stateId: 'used'
+ },{
+ text: _("Available"),
+ dataIndex: 'available',
+ sortable: true,
+ flex: 1,
+ stateId: 'available'
+ },{
+ text: _("Mountpoint"),
+ dataIndex: 'mountpoint',
+ sortable: true,
+ flex: 1,
+ stateId: 'mountpoint'
},{
text: _("Share"),
xtype: 'actioncolumn',
icon: 'images/checkmark.png',
handler: function(view, rowIndex, colIndex, item, e, record, row) {
var me = this;
- Ext.create("OMV.module.admin.services.zfs.CreateShare", {
+ Ext.create("OMV.module.admin.storage.zfs.CreateShare", {
title: _("Create shared folder"),
rpcGetMethod: "getSharedParams",
rpcGetParams: {
return true;
}
}
-
-
},{
text: _("Details"),
xtype: 'actioncolumn',
tooltip: 'Details',
align: 'center',
- icon: 'images/zfs_mag.png'
+ icon: 'images/search.png',
+ handler: function(view, rowIndex, colIndex, item, e, record, row) {
+ var me = this;
+ Ext.create("OMV.module.admin.storage.zfs.ShowDetails", {
+ title: _("Object details"),
+ rpcGetMethod: "getObjectDetails",
+ rpcGetParams: {
+ name: record.get('path'),
+ type: record.get('type')
+ }
+ }).show();
+ }
},{
text: _("Shared"),
dataIndex: 'shared',
fields: [
{ name: "name", type: "string" },
{ name: "type", type: "string" },
+ { name: "size", type: "string" },
+ { name: "used", type: "string" },
+ { name: "available", type: "string" },
+ { name: "mountpoint", type: "string" },
{ name: "id", type: "string" },
{ name: "path", type: "string" },
{ name: "origin", type: "string", defaultValue: "none" },
- { name: "shared", type: "string", defaultValue: "false" }
+ { name: "shared", type: "string", defaultValue: "false" },
+ { name: "pool_type", type: "string"},
+ { name: "nr_disks", type: "string"}
]
}),
proxy: {
me.callParent(arguments);
},
+ onAddButton: function() {
+ var me = this;
+ Ext.create("OMV.module.admin.storage.zfs.AddPool", {
+ listeners: {
+ scope: me,
+ submit: function() {
+ this.doReload();
+ }
+ }
+ }).show();
+ },
+
onAddObjButton: function() {
var me = this;
var sm = me.getSelectionModel();
var records = sm.getSelection();
- var record = records[0];
- Ext.create("OMV.module.admin.services.zfs.AddObject", {
+ var record = records[0];
+ Ext.create("OMV.module.admin.storage.zfs.AddObject", {
title: _("Add Object"),
- rpcGetMethod: "passParam",
- rpcGetParams: {
- key: "path",
- value: record.get('path')
- },
+ path: record.get("path"),
listeners: {
scope: me,
submit: function() {
var sm = me.getSelectionModel();
var records = sm.getSelection();
var record = records[0];
- Ext.create("OMV.module.admin.service.zfs.EditProperties", {
+ Ext.create("OMV.module.admin.storage.zfs.EditProperties", {
name: record.get("path"),
type: record.get("type")
}).show();
},
+
+ onExpandPoolButton: function() {
+ var me = this;
+ var sm = me.getSelectionModel();
+ var records = sm.getSelection();
+ var record = records[0];
+ Ext.create("OMV.module.admin.storage.zfs.ExpandPool", {
+ title: _("Expand Pool"),
+ name: record.get("path"),
+ listeners: {
+ scope: me,
+ submit: function() {
+ this.doReload();
+ }
+ }
+ }).show();
+ },
doDeletion: function(record) {
var me = this;
OMV.WorkspaceManager.registerPanel({
id: "overview",
- path: "/service/zfs",
+ path: "/storage/zfs",
text: _("Overview"),
position: 10,
- className: "OMV.module.admin.service.zfs.Overview"
+ className: "OMV.module.admin.storage.zfs.Overview"
});