From 5627dfd7773fc58ee6615ea7d6bb93dfbc28ab02 Mon Sep 17 00:00:00 2001 From: Niclas Berglind Date: Tue, 16 Sep 2014 21:47:29 +0200 Subject: [PATCH] Hide filesystems with same name as pool. Signed-off-by: Niclas Berglind --- .../omv/module/admin/storage/zfs/TreePanel.js | 5 ++-- src/Utils.php | 24 +++++++------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/gui/js/omv/module/admin/storage/zfs/TreePanel.js b/gui/js/omv/module/admin/storage/zfs/TreePanel.js index 320a6cd..919b513 100644 --- a/gui/js/omv/module/admin/storage/zfs/TreePanel.js +++ b/gui/js/omv/module/admin/storage/zfs/TreePanel.js @@ -317,10 +317,9 @@ Ext.define("OMV.module.admin.storage.zfs.TreePanel", { tbarBtnHidden["edit"] = true; tbarBtnHidden["delete"] = false; } - //Disable 'AddObj' button if selected row is a Poool or a Snapshot + //Disable 'AddObj' button if selected row is a Snapshot Ext.Array.each(records, function(record) { - if(("Pool" == record.get("type")) || - ("Snapshot" == record.get("type"))) { + if("Snapshot" == record.get("type")) { tbarBtnDisabled["addobj"] = true; tbarBtnHidden["addobj"] = true; return false; diff --git a/src/Utils.php b/src/Utils.php index 4d577f8..f997041 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -111,7 +111,7 @@ class OMVModuleZFSUtil { switch ($type) { case "filesystem": if (strpos($path,'/') === false) { - //This is a Pool, thus create both the Pool entry and a Filesystem entry corresponding to the Pool. + //This is a Pool $tmp = array('id'=>$prefix . $path, 'parentid'=>'root', 'name'=>$path, @@ -120,19 +120,11 @@ class OMVModuleZFSUtil { 'expanded'=>$expanded, 'path'=>$path); array_push($objects,$tmp); - $tmp = array('id'=>$prefix . $path . '/' . $path, - 'parentid'=>$prefix . $path, - 'name'=>$path, - 'type'=>'Filesystem', - 'icon'=>'images/filesystem.png', - 'path'=>$path, - 'expanded'=>$expanded); - array_push($objects,$tmp); } else { - //This is a Filesystem other than the Pool + //This is a Filesystem preg_match('/(.*)\/(.*)$/', $path, $result); - $tmp = array('id'=>$prefix . $root . "/" . $path, - 'parentid'=>$prefix . $root . "/" . $result[1], + $tmp = array('id'=>$prefix . $path, + 'parentid'=>$prefix . $result[1], 'name'=>$result[2], 'icon'=>"images/filesystem.png", 'path'=>$path, @@ -152,8 +144,8 @@ class OMVModuleZFSUtil { case "volume": preg_match('/(.*)\/(.*)$/', $path, $result); - $tmp = array('id'=>$prefix . $root . "/" . $path, - 'parentid'=>$prefix . $root . "/" . $result[1], + $tmp = array('id'=>$prefix . $path, + 'parentid'=>$prefix . $result[1], 'name'=>$result[2], 'type'=>ucfirst($type), 'icon'=>"images/save.png", @@ -166,8 +158,8 @@ class OMVModuleZFSUtil { preg_match('/(.*)\@(.*)$/', $path, $result); $subdirs = preg_split('/\//',$result[1]); $root = $subdirs[0]; - $tmp = array('id'=>$prefix . $root . "/" . $path, - 'parentid'=>$prefix . $root . "/" . $result[1], + $tmp = array('id'=>$prefix . $path, + 'parentid'=>$prefix . $result[1], 'name'=>$result[2], 'type'=>ucfirst($type), 'icon'=>'images/zfs_snap.png', -- 2.39.2