]> git.datanom.net - omvzfs.git/blobdiff - gui/js/omv/module/admin/storage/zfs/TreePanel.js
Changed some icons.
[omvzfs.git] / gui / js / omv / module / admin / storage / zfs / TreePanel.js
index 26a25ce0394ffeda841d964cf1b5999d532dcc0b..373f5b6149be50e8db046d20dc15fd46279a12d6 100644 (file)
@@ -74,7 +74,7 @@
  * @param rememberSelected TRUE to reselect the previous selected rows
  *   after the grid content has been reloaded/refreshed. Defaults to FALSE.
  */
  * @param rememberSelected TRUE to reselect the previous selected rows
  *   after the grid content has been reloaded/refreshed. Defaults to FALSE.
  */
-Ext.define("OMV.module.admin.services.zfs.TreePanel", {
+Ext.define("OMV.module.admin.storage.zfs.TreePanel", {
        extend: "OMV.tree.Panel",
        requires: [
                "OMV.window.MessageBox",
        extend: "OMV.tree.Panel",
        requires: [
                "OMV.window.MessageBox",
@@ -98,15 +98,17 @@ Ext.define("OMV.module.admin.services.zfs.TreePanel", {
        hideTopToolbar: false,
        hidePagingToolbar: true,
        hideAddButton: false,
        hideTopToolbar: false,
        hidePagingToolbar: true,
        hideAddButton: false,
-       hideAddObjButton: false,
-       hideEditButton: false,
-       hideDeleteButton: false,
+       hideAddObjButton: true,
+       hideEditButton: true,
+       hideDeleteButton: true,
        hideUpButton: true,
        hideDownButton: true,
        hideApplyButton: true,
        hideRefreshButton: true,
        hideUpButton: true,
        hideDownButton: true,
        hideApplyButton: true,
        hideRefreshButton: true,
+       hideExpandPoolButton: true,
        addButtonText: _("Add Pool"),
        addObjButtonText: _("Add Object"),
        addButtonText: _("Add Pool"),
        addObjButtonText: _("Add Object"),
+       expandPoolButtonText: _("Expand"),
        editButtonText: _("Edit"),
        deleteButtonText: _("Delete"),
        upButtonText: _("Up"),
        editButtonText: _("Edit"),
        deleteButtonText: _("Delete"),
        upButtonText: _("Up"),
@@ -188,29 +190,39 @@ Ext.define("OMV.module.admin.services.zfs.TreePanel", {
                        id: me.getId() + "-add",
                        xtype: "button",
                        text: me.addButtonText,
                        id: me.getId() + "-add",
                        xtype: "button",
                        text: me.addButtonText,
-                       icon: "images/add.png",
+                       icon: "images/zfs_addpool.png",
                        iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
                        hidden: me.hideAddButton,
                        handler: Ext.Function.bind(me.onAddButton, me, [ me ]),
                        scope: me
                        iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
                        hidden: me.hideAddButton,
                        handler: Ext.Function.bind(me.onAddButton, me, [ me ]),
                        scope: me
+               },{
+                       id: me.getId() + "-edit",
+                       xtype: "button",
+                       text: me.editButtonText,
+                       icon: "images/edit.png",
+                       iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
+                       hidden: me.hideEditButton,
+                       handler: Ext.Function.bind(me.onEditButton, me, [ me ]),
+                       scope: me,
+                       disabled: true
                },{
                        id: me.getId() + "-addobj",
                        xtype: "button",
                        text: me.addObjButtonText,
                },{
                        id: me.getId() + "-addobj",
                        xtype: "button",
                        text: me.addObjButtonText,
-                       icon: "images/add.png",
+                       icon: "images/zfs_addobject.png",
                        iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
                        hidden: me.hideAddObjButton,
                        handler: Ext.Function.bind(me.onAddObjButton, me, [ me ]),
                        scope: me,
                        disabled: true
                },{
                        iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
                        hidden: me.hideAddObjButton,
                        handler: Ext.Function.bind(me.onAddObjButton, me, [ me ]),
                        scope: me,
                        disabled: true
                },{
-                       id: me.getId() + "-edit",
+                       id: me.getId() + "-expand",
                        xtype: "button",
                        xtype: "button",
-                       text: me.editButtonText,
-                       icon: "images/edit.png",
+                       text: me.expandPoolButtonText,
+                       icon: "images/zfs_expand.png",
                        iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
                        iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
-                       hidden: me.hideEditButton,
-                       handler: Ext.Function.bind(me.onEditButton, me, [ me ]),
+                       hidden: me.hideExpandPoolButton,
+                       handler: Ext.Function.bind(me.onExpandPoolButton, me, [ me ]),
                        scope: me,
                        disabled: true
                },{
                        scope: me,
                        disabled: true
                },{
@@ -273,11 +285,20 @@ Ext.define("OMV.module.admin.services.zfs.TreePanel", {
                var me = this;
                if(me.hideTopToolbar)
                        return;
                var me = this;
                if(me.hideTopToolbar)
                        return;
-               var tbarBtnName = [ "addobj", "edit", "delete", "up", "down" ];
+               var tbarBtnName = [ "addobj", "edit", "delete", "up", "down", "expand" ];
                var tbarBtnDisabled = {
                        "addobj": false,
                        "edit": false,
                        "delete": false,
                var tbarBtnDisabled = {
                        "addobj": false,
                        "edit": false,
                        "delete": false,
+                       "expand": false,
+                       "up": true,
+                       "down": true,
+               };
+               var tbarBtnHidden = {
+                       "addobj": true,
+                       "edit": true,
+                       "delete": true,
+                       "expand": true,
                        "up": true,
                        "down": true
                };
                        "up": true,
                        "down": true
                };
@@ -288,24 +309,39 @@ Ext.define("OMV.module.admin.services.zfs.TreePanel", {
                        tbarBtnDisabled["delete"] = true;
                        tbarBtnDisabled["up"] = true;
                        tbarBtnDisabled["down"] = true;
                        tbarBtnDisabled["delete"] = true;
                        tbarBtnDisabled["up"] = true;
                        tbarBtnDisabled["down"] = true;
+                       tbarBtnDisabled["expand"] = true;
+               tbarBtnHidden["addobj"] = true;
+                       tbarBtnHidden["edit"] = true;
+                       tbarBtnHidden["delete"] = true;
+                       tbarBtnHidden["expand"] = true;
                } else if(records.length == 1) {
                        tbarBtnDisabled["addobj"] = false;
                        tbarBtnDisabled["edit"] = false;
                        tbarBtnDisabled["delete"] = false;
                        tbarBtnDisabled["up"] = false;
                        tbarBtnDisabled["down"] = false;
                } else if(records.length == 1) {
                        tbarBtnDisabled["addobj"] = false;
                        tbarBtnDisabled["edit"] = false;
                        tbarBtnDisabled["delete"] = false;
                        tbarBtnDisabled["up"] = false;
                        tbarBtnDisabled["down"] = false;
+                       tbarBtnDisabled["expand"] = false;
+                       tbarBtnHidden["addobj"] = false;
+                       tbarBtnHidden["edit"] = false;
+                       tbarBtnHidden["delete"] = false;
+                       tbarBtnHidden["expand"] = false;
                } else {
                        tbarBtnDisabled["addobj"] = true;
                        tbarBtnDisabled["edit"] = true;
                        tbarBtnDisabled["delete"] = false;
                        tbarBtnDisabled["up"] = false;
                        tbarBtnDisabled["down"] = false;
                } else {
                        tbarBtnDisabled["addobj"] = true;
                        tbarBtnDisabled["edit"] = true;
                        tbarBtnDisabled["delete"] = false;
                        tbarBtnDisabled["up"] = false;
                        tbarBtnDisabled["down"] = false;
+                       tbarBtnDisabled["expand"] = true;
+                       tbarBtnHidden["addobj"] = true;
+                       tbarBtnHidden["edit"] = true;
+                       tbarBtnHidden["delete"] = false;
+                       tbarBtnHidden["expand"] = true;
                }
                }
-               //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) {
                Ext.Array.each(records, function(record) {
-                       if(("Pool" == record.get("type")) ||
-                          ("Snapshot" == record.get("type"))) {
+                       if("Snapshot" == record.get("type")) {
                                tbarBtnDisabled["addobj"] = true;
                                tbarBtnDisabled["addobj"] = true;
+                               tbarBtnHidden["addobj"] = true;
                        return false;
                        }
                });
                        return false;
                        }
                });
@@ -314,9 +350,19 @@ Ext.define("OMV.module.admin.services.zfs.TreePanel", {
                Ext.Array.each(records, function(record) {
                        if((false == record.get("leaf"))) {
                                tbarBtnDisabled["delete"] = true;
                Ext.Array.each(records, function(record) {
                        if((false == record.get("leaf"))) {
                                tbarBtnDisabled["delete"] = true;
+                               tbarBtnHidden["delete"] = true;
                        return false;
                        }
                });
                        return false;
                        }
                });
+               
+               //Disable 'ExpandPool' button if selected row is not a Pool
+               Ext.Array.each(records, function(record) {
+                       if(!("Pool" == record.get("type"))) {
+                               tbarBtnDisabled["expand"] = true;
+                               tbarBtnHidden["expand"] = true;
+                               return false;
+                       }
+               });
 
                // Update the button controls.
                Ext.Array.each(tbarBtnName, function(name) {
 
                // Update the button controls.
                Ext.Array.each(tbarBtnName, function(name) {
@@ -327,6 +373,11 @@ Ext.define("OMV.module.admin.services.zfs.TreePanel", {
                                } else {
                                        tbarBtnCtrl.enable();
                                }
                                } else {
                                        tbarBtnCtrl.enable();
                                }
+                               if(true == tbarBtnHidden[name]) {
+                                       tbarBtnCtrl.hide();
+                               } else {
+                                       tbarBtnCtrl.show();
+                               }
                        }
                });
        },
                        }
                });
        },
This page took 0.05529 seconds and 5 git commands to generate.