]> git.datanom.net - omvzfs.git/blobdiff - gui/js/omv/module/admin/storage/zfs/Overview.js
Made it possible to force create Vdevs.
[omvzfs.git] / gui / js / omv / module / admin / storage / zfs / Overview.js
index 2a3fe1509a4bbf565d4ecefa98cdd9192ec87bc9..4731124a7016385e636441a1f111fefa79fae95f 100644 (file)
@@ -95,6 +95,7 @@ Ext.define("OMV.module.admin.storage.zfs.AddPool", {
                                                break;
                                                case "raidz2":
                                                        devicesField.minSelections = 4;
+                                                       break;
                                                case "raidz3":
                                                        devicesField.minSelections = 5;
                                                break;
@@ -256,7 +257,8 @@ Ext.define("OMV.module.admin.storage.zfs.AddObject", {
                        name: "path",
                        fieldLabel: _("Prefix"),
                        allowBlank: false,
-                       readOnly: true
+                       readOnly: true,
+                       value: me.path
                },{
                        xtype: "textfield",
                        name: "name",
@@ -280,6 +282,153 @@ Ext.define("OMV.module.admin.storage.zfs.AddObject", {
        }
 });
 
+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.storage.zfs.EditProperties", {
@@ -570,7 +719,14 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                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',
@@ -662,7 +818,9 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                                                { 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: {
@@ -697,11 +855,7 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                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() {
@@ -721,6 +875,23 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                        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;
This page took 0.040766 seconds and 5 git commands to generate.