[pve-devel] r5956 - in pve-manager/pve2/www/new: qemu tree
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue May 10 11:33:14 CEST 2011
Author: dietmar
Date: 2011-05-10 11:33:14 +0200 (Tue, 10 May 2011)
New Revision: 5956
Modified:
pve-manager/pve2/www/new/qemu/Config.js
pve-manager/pve2/www/new/qemu/CreateWizard.js
pve-manager/pve2/www/new/tree/ResourceTree.js
Log:
implement remove VM
Modified: pve-manager/pve2/www/new/qemu/Config.js
===================================================================
--- pve-manager/pve2/www/new/qemu/Config.js 2011-05-10 08:16:18 UTC (rev 5955)
+++ pve-manager/pve2/www/new/qemu/Config.js 2011-05-10 09:33:14 UTC (rev 5956)
@@ -28,7 +28,25 @@
{ text: 'Stop'},
{ text: 'Reset'},
{ text: 'Shutdown'},
- { text: 'Remove'}
+ {
+ text: 'Remove',
+ handler: function() {
+ var msg = 'Are you sure you want to remove VM ' +
+ vmid + '? This will permanently erase all VM data.';
+ Ext.Msg.confirm('Confirm', msg, function(btn) {
+ if (btn !== 'yes')
+ return;
+
+ PVE.Utils.API2Request({
+ url: '/nodes/' + nodename + '/qemu/' + vmid,
+ method: 'DELETE',
+ failure: function(response, opts) {
+ Ext.Msg.alert('Error', response.htmlStatus);
+ }
+ });
+ });
+ }
+ }
],
html: 'summary ' + vmid
},
Modified: pve-manager/pve2/www/new/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/new/qemu/CreateWizard.js 2011-05-10 08:16:18 UTC (rev 5955)
+++ pve-manager/pve2/www/new/qemu/CreateWizard.js 2011-05-10 09:33:14 UTC (rev 5956)
@@ -415,7 +415,6 @@
Ext.Msg.alert('Error', response.htmlStatus);
}
});
-
}
}
]
Modified: pve-manager/pve2/www/new/tree/ResourceTree.js
===================================================================
--- pve-manager/pve2/www/new/tree/ResourceTree.js 2011-05-10 08:16:18 UTC (rev 5955)
+++ pve-manager/pve2/www/new/tree/ResourceTree.js 2011-05-10 09:33:14 UTC (rev 5956)
@@ -176,10 +176,19 @@
var stateid = 'rid';
var updateTree = function() {
+ var tmp;
// fixme: suspend events ?
var rootnode = me.store.getRootNode();
+
+ // remember selected node (and all parents)
+ var sm = me.getSelectionModel();
+ var lastsel = sm.getLastSelected();
+ var parents = [];
+ var p = lastsel;
+ while(p && (p = p.parentNode))
+ parents.push(p);
var index = pdata.dataIndex;
@@ -203,7 +212,7 @@
for (var i = 0, len = groups.length; i < len; i++) {
var attr = groups[i];
if (item.data[attr] != olditem.data[attr]) {
- console.log("changed " + attr);
+ //console.log("changed " + attr);
changed = true;
break;
}
@@ -242,6 +251,18 @@
index[item.data.id] = child;
});
+ // select parent node is selection vanished
+ if (lastsel && !rootnode.findChild('id', lastsel.data.id, true)) {
+ lastsel = rootnode;
+ while (p = parents.shift()) {
+ if (tmp = rootnode.findChild('id', p.data.id, true)) {
+ lastsel = tmp;
+ break;
+ }
+ }
+ me.selectById(lastsel.data.id);
+ }
+
if (!pdata.updateCount) {
rootnode.collapse();
rootnode.expand();
More information about the pve-devel
mailing list