]> git.datanom.net - omvzfs.git/commitdiff
Support optional mountpoint value when creating filesystem.
authorNiclas Berglind <nb@kjam.se>
Mon, 13 Oct 2014 20:05:21 +0000 (22:05 +0200)
committerMichael Rasmussen <mir@datanom.net>
Mon, 13 Oct 2014 22:41:46 +0000 (00:41 +0200)
Signed-off-by: Niclas Berglind <nb@kjam.se>
gui/js/omv/module/admin/storage/zfs/Overview.js
gui/rpc/zfs.inc

index 9db8915221f4ce396ea2fb1738f7607a7cf9b2e2..4acc897bbcc6f3c402d0a6d243c7408dd0961475 100644 (file)
@@ -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",
index ead4ee52ce98734254c550b3aff6c561a55d9985..2b12b18d5b1623706a8c2500d8ba21d536f15c5c 100644 (file)
@@ -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'];
This page took 0.037115 seconds and 5 git commands to generate.