Refactor
diff --git a/views/ngXosViews/diagnostic/mocks/data/users.json b/views/ngXosViews/diagnostic/mocks/data/users.json
index c4fb9bf..4cf36f7 100644
--- a/views/ngXosViews/diagnostic/mocks/data/users.json
+++ b/views/ngXosViews/diagnostic/mocks/data/users.json
@@ -8,7 +8,6 @@
{
"mac": "34:36:3B:C9:B6:A6",
"id": 1,
- "name": "Jill's Laptop",
"level": "PG_13"
},
{
diff --git a/views/ngXosViews/diagnostic/spec/serviceChain.test.js b/views/ngXosViews/diagnostic/spec/serviceChain.test.js
index 0c06ea8..8dfa02d 100644
--- a/views/ngXosViews/diagnostic/spec/serviceChain.test.js
+++ b/views/ngXosViews/diagnostic/spec/serviceChain.test.js
@@ -96,18 +96,25 @@
const tenants = [
{
+ id: 1,
provider_service: 2,
+ subscriber_tenant: 4,
subscriber_service: 1,
},
{
+ id: 2,
provider_service: 3,
+ subscriber_tenant: 1,
subscriber_service: 2
},
{
+ id: 3,
provider_service: 4,
+ subscriber_tenant: 4,
subscriber_service: 1
},
{
+ id: 4,
subscriber_root: 1,
provider_service: 1
}
@@ -122,11 +129,11 @@
expect(tree.children[0].name).toBe('service-1');
expect(tree.children[0].parent).toBeNull();
- expect(tree.children[0].tenant).toEqual({subscriber_root: 1, provider_service: 1});
+ expect(tree.children[0].tenant).toEqual({id: 4, subscriber_root: 1, provider_service: 1});
expect(tree.children[0].children.length).toBe(2);
expect(tree.children[0].children[0].name).toBe('service-2');
- expect(tree.children[0].children[0].tenant).toEqual({subscriber_service: 1, provider_service: 2});;
+ expect(tree.children[0].children[0].tenant).toEqual({ id: 1, provider_service: 2, subscriber_tenant: 4, subscriber_service: 1 });;
expect(tree.children[0].children[0].children[0].name).toBe('service-3');
expect(tree.children[0].children[0].children[0].children[0].name).toBe('Router');
diff --git a/views/ngXosViews/diagnostic/src/js/config.js b/views/ngXosViews/diagnostic/src/js/config.js
index 6b029d7..13f2172 100644
--- a/views/ngXosViews/diagnostic/src/js/config.js
+++ b/views/ngXosViews/diagnostic/src/js/config.js
@@ -38,6 +38,13 @@
margin: 5,
x: -40,
y: -18
+ },
+ container: {
+ width: 60,
+ height: 30,
+ margin: 5,
+ x: -30,
+ y: -15
}
})
diff --git a/views/ngXosViews/diagnostic/src/js/nodeDrawer.js b/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
index 7c76e61..3007fd2 100644
--- a/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
+++ b/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
@@ -258,7 +258,7 @@
x: - serviceTopologyConfig.circle.r - 10,
y: serviceTopologyConfig.circle.r / 2
})
- .text(d => d.name);
+ .text(d => d.name || d.mac);
}
});
})();
diff --git a/views/ngXosViews/diagnostic/src/js/rackHelper.js b/views/ngXosViews/diagnostic/src/js/rackHelper.js
index 15dcc0c..40ca88d 100644
--- a/views/ngXosViews/diagnostic/src/js/rackHelper.js
+++ b/views/ngXosViews/diagnostic/src/js/rackHelper.js
@@ -33,10 +33,10 @@
let height = serviceTopologyConfig.computeNode.margin;
lodash.forEach(nodes, (node) => {
- let [instanceWidth, instanceHeight] = this.getComputeNodeSize(node.instances);
+ let [nodeWidth, nodeHeight] = this.getComputeNodeSize(node.instances);
- width = instanceWidth + (serviceTopologyConfig.computeNode.margin * 2);
- height += (instanceHeight + serviceTopologyConfig.computeNode.margin);
+ width = nodeWidth + (serviceTopologyConfig.computeNode.margin * 2);
+ height += (nodeHeight + serviceTopologyConfig.computeNode.margin);
});
return [width, height];
diff --git a/views/ngXosViews/diagnostic/src/js/rest_services.js b/views/ngXosViews/diagnostic/src/js/rest_services.js
index 522a126..d5e924f 100644
--- a/views/ngXosViews/diagnostic/src/js/rest_services.js
+++ b/views/ngXosViews/diagnostic/src/js/rest_services.js
@@ -264,7 +264,6 @@
// find all relations relative to this rootElement
const levelRelation = findLevelRelation(tenants, rootService.id);
-
// find all items related to rootElement
const levelServices = findLevelServices(levelRelation, services);
diff --git a/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js b/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
index 7ca925b..518c41a 100644
--- a/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
+++ b/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
@@ -233,7 +233,6 @@
.each(d => d.selected = false);
// toggling selected status
- console.log(d.selected);
d.selected = !d.selected;
updateTree(_svg, _layout, _source);