[pve-devel] r6202 - pve-manager/pve2/www/manager/qemu
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed Jun 29 11:12:04 CEST 2011
Author: dietmar
Date: 2011-06-29 11:12:04 +0200 (Wed, 29 Jun 2011)
New Revision: 6202
Modified:
pve-manager/pve2/www/manager/qemu/HardwareView.js
Log:
context sensitive buttons
Modified: pve-manager/pve2/www/manager/qemu/HardwareView.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/HardwareView.js 2011-06-29 08:42:08 UTC (rev 6201)
+++ pve-manager/pve2/www/manager/qemu/HardwareView.js 2011-06-29 09:12:04 UTC (rev 6202)
@@ -34,6 +34,7 @@
var rows = {
memory: {
header: 'Memory',
+ never_delete: true,
tdCls: 'pve-itype-icon-memory',
renderer: function(value) {
return PVE.Utils.format_size(value*1024*1024);
@@ -41,6 +42,7 @@
},
sockets: {
header: 'Processors',
+ never_delete: true,
tdCls: 'pve-itype-icon-processor',
defaultValue: 1,
renderer: function(value, metaData, record, rowIndex, colIndex, store) {
@@ -54,12 +56,14 @@
},
keyboard: {
header: 'Keyboard',
+ never_delete: true,
tdCls: 'pve-itype-icon-keyboard',
defaultValue: 'default',
renderer: PVE.Utils.render_kvm_language
},
vga: {
header: 'Display',
+ never_delete: true,
tdCls: 'pve-itype-icon-display',
defaultValue: 'default'
},
@@ -111,6 +115,37 @@
me.rstore.load();
};
+ var edit_btn = new Ext.Button({
+ text: 'Edit',
+ disabled: true,
+ handler: run_editor
+ });
+
+ var remove_btn = new Ext.Button({
+ text: 'Remove',
+ disabled: true,
+ handler: function(){
+ console.log("REMOVE");
+ }
+ });
+
+ var set_button_status = function() {
+ var sm = me.getSelectionModel();
+ var rec = sm.getSelection()[0];
+
+ if (!rec) {
+ remove_btn.disable();
+ edit_btn.disable();
+ return;
+ }
+
+ edit_btn.enable();
+
+ var rowdef = rows[rec.data.key];
+
+ remove_btn.setDisabled(rowdef.never_delete === true);
+ }
+
Ext.applyIf(me, {
url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/config",
cwidth1: 150,
@@ -144,20 +179,16 @@
}
]
})
- },
- {
- text: "Edit",
- handler: run_editor
- },
- {
- text: "Delete"
- }
+ },
+ remove_btn,
+ edit_btn
],
rows: rows,
listeners: {
itemdblclick: function() {
run_editor();
- }
+ },
+ selectionchange: set_button_status
}
});
More information about the pve-devel
mailing list