Commit 2a0bc39f authored by Dietmar Maurer's avatar Dietmar Maurer

update tree node if node attribute changes (vm migration)

and cleanup code
parent 31cd039b
...@@ -188,10 +188,10 @@ Ext.define('PVE.StdWorkspace', { ...@@ -188,10 +188,10 @@ Ext.define('PVE.StdWorkspace', {
tree.selectById(nodeid); tree.selectById(nodeid);
}, },
check_vm_migration: function(record) { checkVmMigration: function(record) {
var me = this; var me = this;
var tree = me.down('pveResourceTree'); var tree = me.down('pveResourceTree');
tree.check_vm_migration(record); tree.checkVmMigration(record);
}, },
onLogin: function(loginData) { onLogin: function(loginData) {
......
...@@ -69,7 +69,6 @@ Ext.define('PVE.qemu.Migrate', { ...@@ -69,7 +69,6 @@ Ext.define('PVE.qemu.Migrate', {
text: 'Migrate', text: 'Migrate',
handler: function() { handler: function() {
var values = form.getValues(); var values = form.getValues();
console.log("STARTMIGRATE " + vmid + " " + values.target + " " + values.online);
me.migrate(vmid, nodename, values.target, values.online); me.migrate(vmid, nodename, values.target, values.online);
} }
}); });
......
...@@ -143,7 +143,7 @@ Ext.define('PVE.qemu.Summary', { ...@@ -143,7 +143,7 @@ Ext.define('PVE.qemu.Summary', {
me.mon(rstore, 'load', function(s, records, success) { me.mon(rstore, 'load', function(s, records, success) {
var status; var status;
if (!success) { if (!success) {
me.workspace.check_vm_migration(me.pveSelNode); me.workspace.checkVmMigration(me.pveSelNode);
status = 'unknown'; status = 'unknown';
} else { } else {
var rec = s.data.get('status'); var rec = s.data.get('status');
......
...@@ -231,8 +231,9 @@ Ext.define('PVE.tree.ResourceTree', { ...@@ -231,8 +231,9 @@ Ext.define('PVE.tree.ResourceTree', {
} }
} }
if ((item.data.text !== olditem.data.text) || if ((item.data.text !== olditem.data.text) ||
(item.data.node !== olditem.data.node) ||
(item.data.running !== olditem.data.running)) { (item.data.running !== olditem.data.running)) {
//console.log("changed text/running"); //console.log("changed node/text/running " + olditem.data.id);
changed = true; changed = true;
} }
...@@ -355,7 +356,7 @@ Ext.define('PVE.tree.ResourceTree', { ...@@ -355,7 +356,7 @@ Ext.define('PVE.tree.ResourceTree', {
me.selectExpand(node); me.selectExpand(node);
} }
}, },
check_vm_migration: function(record) { checkVmMigration: function(record) {
if (!(record.data.type === 'qemu' || record.data.type === 'openvz')) { if (!(record.data.type === 'qemu' || record.data.type === 'openvz')) {
throw "not a vm type"; throw "not a vm type";
} }
...@@ -366,7 +367,7 @@ Ext.define('PVE.tree.ResourceTree', { ...@@ -366,7 +367,7 @@ Ext.define('PVE.tree.ResourceTree', {
if (node && node.data.type === record.data.type && if (node && node.data.type === record.data.type &&
node.data.node !== record.data.node) { node.data.node !== record.data.node) {
// defer select (else we get strange errors) // defer select (else we get strange errors)
Ext.defer(function() { me.selectExpand(node)}, 100, me); Ext.defer(function() { me.selectExpand(node) }, 100, me);
} }
}, },
applyState : function(state) { applyState : function(state) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment