* @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",
hideTopToolbar: false,
hidePagingToolbar: true,
hideAddButton: false,
- hideAddObjButton: false,
- hideEditButton: false,
- hideDeleteButton: false,
+ hideAddObjButton: true,
+ hideEditButton: true,
+ hideDeleteButton: true,
hideUpButton: true,
hideDownButton: true,
hideApplyButton: true,
hidden: me.hideAddButton,
handler: Ext.Function.bind(me.onAddButton, me, [ me ]),
scope: me
- },{
- id: me.getId() + "-addobj",
- xtype: "button",
- text: me.addObjButtonText,
- icon: "images/add.png",
- 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",
xtype: "button",
handler: Ext.Function.bind(me.onEditButton, me, [ me ]),
scope: me,
disabled: true
+ },{
+ id: me.getId() + "-addobj",
+ xtype: "button",
+ text: me.addObjButtonText,
+ icon: "images/add.png",
+ iconCls: Ext.baseCSSPrefix + "btn-icon-16x16",
+ hidden: me.hideAddObjButton,
+ handler: Ext.Function.bind(me.onAddObjButton, me, [ me ]),
+ scope: me,
+ disabled: true
},{
id: me.getId() + "-delete",
xtype: "button",
"up": true,
"down": true
};
+ var tbarBtnHidden = {
+ "addobj": true,
+ "edit": true,
+ "delete": true,
+ "up": true,
+ "down": true
+ };
// Enable/disable buttons depending on the number of selected rows.
if(records.length <= 0) {
tbarBtnDisabled["addobj"] = true;
tbarBtnDisabled["delete"] = true;
tbarBtnDisabled["up"] = true;
tbarBtnDisabled["down"] = true;
+ tbarBtnHidden["addobj"] = true;
+ tbarBtnHidden["edit"] = true;
+ tbarBtnHidden["delete"] = true;
} else if(records.length == 1) {
tbarBtnDisabled["addobj"] = false;
tbarBtnDisabled["edit"] = false;
tbarBtnDisabled["delete"] = false;
tbarBtnDisabled["up"] = false;
tbarBtnDisabled["down"] = false;
+ tbarBtnHidden["addobj"] = false;
+ tbarBtnHidden["edit"] = false;
+ tbarBtnHidden["delete"] = false;
} else {
tbarBtnDisabled["addobj"] = true;
tbarBtnDisabled["edit"] = true;
tbarBtnDisabled["delete"] = false;
tbarBtnDisabled["up"] = false;
tbarBtnDisabled["down"] = false;
+ tbarBtnHidden["addobj"] = true;
+ tbarBtnHidden["edit"] = true;
+ tbarBtnHidden["delete"] = false;
}
//Disable 'AddObj' button if selected row is a Poool or a Snapshot
Ext.Array.each(records, function(record) {
if(("Pool" == record.get("type")) ||
("Snapshot" == record.get("type"))) {
tbarBtnDisabled["addobj"] = true;
+ tbarBtnHidden["addobj"] = true;
return false;
}
});
Ext.Array.each(records, function(record) {
if((false == record.get("leaf"))) {
tbarBtnDisabled["delete"] = true;
+ tbarBtnHidden["delete"] = true;
return false;
}
});
} else {
tbarBtnCtrl.enable();
}
+ if(true == tbarBtnHidden[name]) {
+ tbarBtnCtrl.hide();
+ } else {
+ tbarBtnCtrl.show();
+ }
}
});
},