X-Git-Url: http://git.datanom.net/omvzfs.git/blobdiff_plain/47e63d33372ed4f7924466ba066fc2a42e1b7c41..9f2f49761f46d21417199cf1118b3d08084ae0fb:/gui/js/omv/module/admin/storage/zfs/Overview.js diff --git a/gui/js/omv/module/admin/storage/zfs/Overview.js b/gui/js/omv/module/admin/storage/zfs/Overview.js index 4731124..3c0f25f 100644 --- a/gui/js/omv/module/admin/storage/zfs/Overview.js +++ b/gui/js/omv/module/admin/storage/zfs/Overview.js @@ -29,7 +29,9 @@ Ext.define("OMV.module.admin.storage.zfs.ShowDetails", { name: "details", grow: true, anchor: '100%', - readOnly: true + readOnly: true, + preventScrollbars: true, + growMax: "2000" }]; } @@ -177,6 +179,14 @@ Ext.define("OMV.module.admin.storage.zfs.AddPool", { ptype: "fieldinfo", text: _("Optional mountpoint for the pool. Default is to use pool name.") }] + },{ + xtype: "checkbox", + name: "diskpath", + fieldLabel: _("Disk-by-path"), + plugins: [{ + ptype: "fieldinfo", + text: _("Use /dev/disk/by-path when creating the pool. Recommended.") + }] },{ xtype: "checkbox", name: "force", @@ -221,32 +231,73 @@ Ext.define("OMV.module.admin.storage.zfs.AddObject", { getFormItems: function() { var me = this; + + var store = new Ext.data.ArrayStore({ + autoDestroy: true, + storeId: 'my_store', + fields: [ + {name: 'value', type: 'string'}, + {name: 'display', type: 'string'} + ] + }); + + var combodata; + if (me.parenttype === "Snapshot") { + combodata = [["clone","Clone"]]; + } else if (me.parenttype === "Volume") { + combodata = [["snapshot", "Snapshot"]]; + } else { + combodata = [["filesystem","Filesystem"], + ["volume","Volume"], + ["snapshot","Snapshot"]]; + } + store.loadData(combodata,false); + return [{ xtype: "combo", name: "type", fieldLabel: _("Object Type"), queryMode: "local", - store: [ - [ "filesystem", "Filesystem" ], - [ "snapshot", "Snapshot" ], - [ "volume", "Volume" ] - ], + store: store, allowBlank: true, editable: false, triggerAction: "all", - value: "filesystem", + valueField: "value", + displayField: "display", + value: combodata[0][0], listeners: { scope: me, change: function(combo, value) { var sizeField = this.findField("size"); + var cloneField = this.findField("clonename"); + var nameField = this.findField("name"); + var mountField = this.findField("mountpoint"); switch(value) { + case "filesystem": + sizeField.hide(); + sizeField.allowBlank = true; + cloneField.hide(); + nameField.show(); + mountField.show(); case "volume": sizeField.show(); - sizeField.allowBlank = false; + sizeField.allowBlank = false; + cloneField.hide(); + nameField.show(); + mountField.hide(); break; + case "clone": + sizeField.hide(); + sizeField.allowBlank = true; + cloneField.show(); + nameField.hide(); + mountField.hide(); default: sizeField.hide(); - sizeField.allowBlank = true; + sizeField.allowBlank = true; + cloneField.hide(); + nameField.show(); + mountField.hide(); break; } sizeField.validate(); @@ -258,19 +309,88 @@ Ext.define("OMV.module.admin.storage.zfs.AddObject", { fieldLabel: _("Prefix"), allowBlank: false, readOnly: true, - value: me.path + value: me.path, + listeners: { + scope: me, + beforerender: function(e, eOpts) { + var pathField = this.findField("path"); + if (me.parenttype === "Snapshot") { + pathField.fieldLabel = _("Snapshot to clone"); + } else { + pathField.fieldLabel = _("Prefix"); + } + } + } },{ xtype: "textfield", name: "name", + id: "name", fieldLabel: _("Name"), allowBlank: false, plugins: [{ ptype: "fieldinfo", text: _("Name of the new object. Prefix will prepend the name. Please omit leading /") - }] + }], + listeners: { + scope: me, + beforerender: function(e, eOpts) { + var nameField = this.findField("name"); + if (me.parenttype === "Snapshot") { + nameField.hide(); + nameField.allowBlank = true; + } else { + nameField.show(); + nameField.allowBlank = false; + } + } + } + },{ + xtype: "textfield", + name: "mountpoint", + fieldLabel: _("Mountpoint"), + allowBlank: true, + plugins: [{ + ptype: "fieldinfo", + text: _("Optional mountpoint of the filesystem. If left blank parent mountpoint will be prepended to name of the filesystem.") + }], + listeners: { + scope: me, + beforerender: function(e, eOpts) { + var mountField = this.findField("mountpoint"); + if (combodata[0][0] === "filesystem") { + mountField.show(); + } else { + mountField.hide(); + } + } + } + },{ + xtype: "textfield", + name: "clonename", + id: "clonename", + fieldLabel: _("Clone name"), + allowBlank: false, + plugins: [{ + ptype: "fieldinfo", + text: _("Name of the new Clone. It can be placed anywhere within the ZFS hierarchy.") + }], + listeners: { + scope: me, + beforerender: function(e, eOpts) { + var cloneField = this.findField("clonename"); + if (me.parenttype === "Snapshot") { + cloneField.show(); + cloneField.allowBlank = false; + } else { + cloneField.hide(); + cloneField.allowBlank = true; + } + } + } },{ xtype: "textfield", name: "size", + id: "size", hidden: true, fieldLabel: _("Size"), allowBlank: true, @@ -417,6 +537,14 @@ Ext.define("OMV.module.admin.storage.zfs.ExpandPool", { flex: 1 }] } + },{ + xtype: "checkbox", + name: "diskpath", + fieldLabel: _("Disk-by-path"), + plugins: [{ + ptype: "fieldinfo", + text: _("Use /dev/disk/by-path when creating the vdev. Recommended.") + }] },{ xtype: "checkbox", name: "force", @@ -713,7 +841,14 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", { dataIndex: 'name', sortable: true, flex: 2, - stateId: 'name' + stateId: 'name', + renderer: function(value, p, r){ + if (r.data['origin'] === "n/a") { + return r.data['name']; + } else { + return r.data['name'] + ' (' + r.data['origin'] + ')'; + } + } },{ text: _("Type"), dataIndex: 'type', @@ -721,10 +856,10 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", { flex: 1, stateId: 'type', renderer: function(value, p, r){ - if (r.data['type'] == "Pool") { - return r.data['type'] + ' (' + r.data['pool_type'] + ')'; - } else { + if (r.data['origin'] === "n/a") { return r.data['type']; + } else { + return 'Clone'; } } },{ @@ -752,11 +887,11 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", { flex: 1, stateId: 'mountpoint' },{ - text: _("Share"), + text: _("Share folder"), xtype: 'actioncolumn', tooltip: 'Create shared folder', align: 'center', - icon: 'images/checkmark.png', + icon: 'images/share.png', handler: function(view, rowIndex, colIndex, item, e, record, row) { var me = this; Ext.create("OMV.module.admin.storage.zfs.CreateShare", { @@ -856,6 +991,7 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", { Ext.create("OMV.module.admin.storage.zfs.AddObject", { title: _("Add Object"), path: record.get("path"), + parenttype: record.get("type"), listeners: { scope: me, submit: function() {