Selecting and deselcting instances
diff --git a/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js b/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js
index d2b48ea..8ba9c71 100644
--- a/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js
+++ b/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js
@@ -108,12 +108,17 @@
transform: `translate(${svgWidth / 2}, ${svgHeight / 2})`
});
+ // create Nodes
NodeDrawer.addNetworks(node.filter('.network'));
NodeDrawer.addRack(node.filter('.rack'));
NodeDrawer.addPhisical(node.filter('.router'));
NodeDrawer.addPhisical(node.filter('.subscriber'));
NodeDrawer.addDevice(node.filter('.device'));
+ //update nodes
+ // TODO if data change, only update them
+ // NodeDrawer.updateRack(node.filter('.rack'));
+
// Transition nodes to their new position.
var nodeUpdate = node.transition()
.duration(serviceTopologyConfig.duration)
@@ -207,6 +212,14 @@
const computeNodes = baseData.children[0].children[0].computeNodes;
+ // unselect all
+ computeNodes.map((node) => {
+ node.instances.map((instance) => {
+ instance.selected = false
+ return instance;
+ });
+ });
+
let targetInstance = computeNodes.reduce((selected, node) => {
let found = lodash.find(node.instances, {id: instanceId});
@@ -217,7 +230,9 @@
// object are passed by reference,
// updating this update the instance in the tree
- targetInstance.selected = true;
+ if(targetInstance){
+ targetInstance.selected = true;
+ }
}
});
diff --git a/views/ngXosViews/diagnostic/src/js/rest_services.js b/views/ngXosViews/diagnostic/src/js/rest_services.js
index 02ed7d5..93a9b90 100644
--- a/views/ngXosViews/diagnostic/src/js/rest_services.js
+++ b/views/ngXosViews/diagnostic/src/js/rest_services.js
@@ -80,7 +80,7 @@
});
// faking to have 2 subscriber
- res.data.push(angular.copy(res.data[0]));
+ // res.data.push(angular.copy(res.data[0]));
deferred.resolve(res.data);
})
diff --git a/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js b/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
index 4ff5516..872c778 100644
--- a/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
+++ b/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
@@ -219,9 +219,8 @@
$log.info('TODO emit an event to highlight VMs', d);
- if(d.service.service_specific_attribute && d.service.service_specific_attribute.instance_id){
- $rootScope.$emit('instance.detail', {id: d.service.service_specific_attribute.instance_id});
- }
+ // TODO how I get the instance id???
+ $rootScope.$emit('instance.detail', {id: d.service.service_specific_attribute.instance_id || null});
if(!d.service){
return;