]> git.datanom.net - omvzfs.git/commitdiff
Added columns to overview and implemented object details window.
authorNiclas Berglind <nb@kjam.se>
Wed, 24 Sep 2014 13:18:00 +0000 (15:18 +0200)
committerMichael Rasmussen <mir@datanom.net>
Wed, 24 Sep 2014 18:21:17 +0000 (20:21 +0200)
Signed-off-by: Niclas Berglind <nb@kjam.se>
gui/js/omv/module/admin/storage/zfs/Overview.js
gui/rpc/zfs.inc
src/Utils.php

index f2357996f754cd0d11cacb49b891ec4bfca062a8..3230435105d13863cdd14b59e2365e706a3b0ecc 100644 (file)
@@ -3,6 +3,38 @@
 // require("js/omv/workspace/window/Grid.js")
 // require("js/omv/form/field/CheckboxGrid.js")
 
+Ext.define("OMV.module.admin.storage.zfs.ShowDetails", {
+       extend: "OMV.workspace.window.Form",
+       requires: [
+               "OMV.data.Store",
+               "OMV.data.Model",
+               "OMV.data.proxy.Rpc",
+       ],
+
+       rpcService: "ZFS",
+       title: _("Object details"),
+       autoLoadData: true,
+       hideResetButton: true,
+       hideCancelButton: true,
+       width: 550,
+       height: 350,
+       layout: 'fit',
+       okButtonText: _("Ok"),
+
+       getFormItems: function() {
+               var me = this;
+               
+               return [{
+                       xtype: "textareafield",
+                       name: "details",
+                       grow: true,
+                       anchor: '100%',
+                       readOnly: true
+               }];
+
+       }
+});
+
 Ext.define("OMV.module.admin.storage.zfs.AddPool", {
        extend: "OMV.workspace.window.Form",
        requires: [
@@ -539,6 +571,30 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                sortable: true,
                flex: 1,
                stateId: 'type'
+       },{
+               text: _("Size"),
+               dataIndex: 'size',
+               sortable: true,
+               flex: 1,
+               stateId: 'size'
+       },{
+               text: _("Used"),
+               dataIndex: 'used',
+               sortable: true,
+               flex: 1,
+               stateId: 'used'
+       },{
+               text: _("Available"),
+               dataIndex: 'available',
+               sortable: true,
+               flex: 1,
+               stateId: 'available'
+       },{
+               text: _("Mountpoint"),
+               dataIndex: 'mountpoint',
+               sortable: true,
+               flex: 1,
+               stateId: 'mountpoint'
        },{
                text: _("Share"),
                xtype: 'actioncolumn',
@@ -564,14 +620,23 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                                return true;
                        }
                }
-
-
        },{
                text: _("Details"),
                xtype: 'actioncolumn',
                tooltip: 'Details',
                align: 'center',
-               icon: 'images/search.png'
+               icon: 'images/search.png',
+               handler: function(view, rowIndex, colIndex, item, e, record, row) {
+                       var me = this;
+                       Ext.create("OMV.module.admin.storage.zfs.ShowDetails", {
+                               title: _("Object details"),
+                               rpcGetMethod: "getObjectDetails",
+                               rpcGetParams: {
+                                       name: record.get('path'),
+                                       type: record.get('type')
+                               }
+                       }).show();
+               }
        },{
                text: _("Shared"),
                dataIndex: 'shared',
@@ -590,6 +655,10 @@ Ext.define("OMV.module.admin.storage.zfs.Overview", {
                                        fields: [
                                                { name: "name", type: "string" },
                                                { name: "type", type: "string" },
+                                               { name: "size", type: "string" },
+                                               { name: "used", type: "string" },
+                                               { name: "available", type: "string" },
+                                               { name: "mountpoint", type: "string" },
                                                { name: "id", type: "string" },
                                                { name: "path", type: "string" },
                                                { name: "origin", type: "string", defaultValue: "none" },
index 3a98d58d28299e012744f1510748f749f9efd6bc..7a6b36410e58b4021a9fcc030a1f96163441f158 100644 (file)
@@ -30,6 +30,7 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
                $this->registermethod("inherit");
                $this->registermethod("getSharedParams");
                $this->registermethod("createShare");
+               $this->registermethod("getObjectDetails");
        }
 
        public function addPool($params, $context) {
@@ -460,6 +461,41 @@ class OMVRpcServiceZFS extends OMVRpcServiceAbstract {
                return $object;
        }
 
+       public function getObjectDetails($params, $context) {
+               $this->validateMethodContext($context, array("role" => OMV_ROLE_ADMINISTRATOR));
+               // Validate the parameters of the RPC service method.
+               $this->validateMethodParams($params, '{
+                       "type":"object",
+                               "properties":{
+                                       "name":{"type":"string"},
+                                               "type":{"type":"string"}
+                       }
+               }');
+               $output = "";
+               switch ($params['type']) {
+               case "Filesystem":
+                       $output .= "Filesystem details (zfs get all):\n\r\n\r";
+                       $cmd = "zfs get all {$params['name']}";
+                       break;
+               case "Volume":
+                       $output .= "Volume details (zfs get all):\n\r\n\r";
+                       $cmd = "zfs get all {$params['name']}";
+                       break;
+               case "Snapshot":
+                       $output .= "Snapshot details (zfs get all):\n\r\n\r";
+                       $cmd = "zfs get all {$params['name']}";
+                       break;
+               case "Pool":
+                       $output .= "Pool details (zpool get all):\n\r\n\r";
+                       $cmd = "zpool get all {$params['name']}";
+                       break;
+               default:
+                       throw new OMVModuleZFSException("Incorrect type provided");
+               }
+               OMVModuleZFSUtil::exec($cmd,$out,$res);
+               $output .= implode("\n\r", $out);
+               return array("details" => $output);
+       }
 }
 
 // Register the RPC service.
index 53562231600b10643e7f10a9cdcd8f9f0749e8cd..5658265a1744a0423d43d97e980eca18155e8bd9 100644 (file)
@@ -2,6 +2,7 @@
 require_once("Exception.php");
 require_once("openmediavault/util.inc");
 require_once("Dataset.php");
+require_once("Zvol.php");
 require_once("Vdev.php");
 require_once("Zpool.php");
 
@@ -197,6 +198,11 @@ class OMVModuleZFSUtil {
                                                'icon'=>'images/raid.png',
                                                'expanded'=>$expanded,
                                                'path'=>$path);
+                                       $pool = new OMVModuleZFSZpool($path);
+                                       $tmp['size'] = $pool->getSize();
+                                       $tmp['used'] = "n/a";
+                                       $tmp['available'] = "n/a";
+                                       $tmp['mountpoint'] = $pool->getMountPoint();
                                        array_push($objects,$tmp);
                                } else {
                                        //This is a Filesystem
@@ -216,6 +222,12 @@ class OMVModuleZFSUtil {
                                                //This is a standard Filesystem.
                                                $tmp['type']= ucfirst($type);
                                        }
+                                       $tmp['size'] = "n/a";
+                                       $used = $ds->getProperty("used");
+                                       $tmp['used'] = $used['value'];
+                                       $available = $ds->getProperty("available");
+                                       $tmp['available'] = $available['value'];
+                                       $tmp['mountpoint'] = $ds->getMountPoint();
                                        array_push($objects,$tmp);
                                }
                                break;
@@ -229,6 +241,11 @@ class OMVModuleZFSUtil {
                                        'icon'=>"images/save.png",
                                        'path'=>$path,
                                        'expanded'=>$expanded);
+                               $vol = new OMVModuleZFSZvol();
+                               $tmp['size'] = $vol->getSize();
+                               $tmp['used'] = "n/a";
+                               $tmp['available'] = "n/a";
+                               $tmp['mountpoint'] = "n/a";
                                array_push($objects,$tmp);
                                break;
 
@@ -243,6 +260,10 @@ class OMVModuleZFSUtil {
                                        'icon'=>'images/zfs_snap.png',
                                        'path'=>$path,
                                        'expanded'=>$expanded);
+                               $tmp['size'] = "n/a";
+                               $tmp['used'] = "n/a";
+                               $tmp['available'] = "n/a";
+                               $tmp['mountpoint'] = "n/a";
                                array_push($objects,$tmp);
                                break;
 
This page took 0.044135 seconds and 5 git commands to generate.