From: Niclas Berglind Date: Mon, 13 Oct 2014 20:05:21 +0000 (+0200) Subject: Support optional mountpoint value when creating filesystem. X-Git-Url: http://git.datanom.net/omvzfs.git/commitdiff_plain/c247043c2fcb7cab7ec212787244b40f604a3c19?ds=inline Support optional mountpoint value when creating filesystem. Signed-off-by: Niclas Berglind --- diff --git a/gui/js/omv/module/admin/storage/zfs/Overview.js b/gui/js/omv/module/admin/storage/zfs/Overview.js index 9db8915..4acc897 100644 --- a/gui/js/omv/module/admin/storage/zfs/Overview.js +++ b/gui/js/omv/module/admin/storage/zfs/Overview.js @@ -261,23 +261,33 @@ Ext.define("OMV.module.admin.storage.zfs.AddObject", { 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; 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; cloneField.hide(); nameField.show(); + mountField.hide(); break; } sizeField.validate(); @@ -324,6 +334,26 @@ Ext.define("OMV.module.admin.storage.zfs.AddObject", { } } } + },{ + 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", diff --git a/gui/rpc/zfs.inc b/gui/rpc/zfs.inc index ead4ee5..2b12b18 100644 --- a/gui/rpc/zfs.inc +++ b/gui/rpc/zfs.inc @@ -130,7 +130,8 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { "path":{"type":"string"}, "name":{"type":"string"}, "size":{"type":"string"}, - "clonename":{"type":"string"} + "clonename":{"type":"string"}, + "mountpoint":{"type":"string"} } }'); switch ($params['type']) { @@ -141,6 +142,10 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract { case "filesystem": $name = $params['path'] . "/" . $params['name']; $tmp = new OMVModuleZFSDataset($name); + if (strlen($params['mountpoint']) > 0) { + $properties = array("mountpoint"=>$params['mountpoint']); + $tmp->setProperties($properties); + } break; case "snapshot": $name = $params['path'] . "@" . $params['name'];