Fixed horizontal positioning of elements
diff --git a/views/ngXosViews/diagnostic/spec/logicTopologyHelper.test.js b/views/ngXosViews/diagnostic/spec/logicTopologyHelper.test.js
index 0353398..d9a987d 100644
--- a/views/ngXosViews/diagnostic/spec/logicTopologyHelper.test.js
+++ b/views/ngXosViews/diagnostic/spec/logicTopologyHelper.test.js
@@ -36,12 +36,12 @@
it('should calculate horizontal position for each element', () => {
let [el0x, el1x, el2x, el3x, el4x, el5x] = Service.computeElementPosition(900);
- expect(el0x).toBeSimilar(900 - 30);
- expect(el1x).toBeSimilar(900 - 183.4);
- expect(el2x).toBeSimilar(900 - 337.3);
- expect(el3x).toBeSimilar(900 - 490.7);
- expect(el4x).toBeSimilar(900 - 602.1);
- expect(el5x).toBeSimilar(900 - 713.5);
+ expect(el0x).toBeSimilar(870);
+ expect(el1x).toBeSimilar(736.6);
+ expect(el2x).toBeSimilar(560.7);
+ expect(el3x).toBeSimilar(384.8);
+ expect(el4x).toBeSimilar(251.4);
+ expect(el5x).toBeSimilar(95);
});
});
diff --git a/views/ngXosViews/diagnostic/src/js/config.js b/views/ngXosViews/diagnostic/src/js/config.js
index db1d832..f4ce775 100644
--- a/views/ngXosViews/diagnostic/src/js/config.js
+++ b/views/ngXosViews/diagnostic/src/js/config.js
@@ -13,7 +13,7 @@
// network: 104,
// rack: 105
// },
- elWidths: [20, 104, 105, 104, 20, 20],
+ elWidths: [20, 104, 105, 104, 20, 150],
circle: {
radius: 10,
r: 10,
diff --git a/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js b/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js
index 411da49..a05fcff 100644
--- a/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js
+++ b/views/ngXosViews/diagnostic/src/js/logicTopologyHelper.js
@@ -45,7 +45,7 @@
let totalElWidth = lodash.reduce(serviceTopologyConfig.elWidths, (el, val) => val + el, 0);
- let remainingSpace = svgWidth - totalElWidth - serviceTopologyConfig.widthMargin;
+ let remainingSpace = svgWidth - totalElWidth - (serviceTopologyConfig.widthMargin * 2);
let step = remainingSpace / (serviceTopologyConfig.elWidths.length - 1);
@@ -54,7 +54,7 @@
// get half of the previous elements width
let previousElWidth = 0;
if(i !== 0){
- previousElWidth = lodash.reduce(serviceTopologyConfig.elWidths.slice(0, i), (el, val) => val + el, 0) / 2;
+ previousElWidth = lodash.reduce(serviceTopologyConfig.elWidths.slice(0, i), (el, val) => val + el, 0);
}
let elPos =