From a8504802db23ead5a7fe5d7fed21f555354ea518 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Thu, 30 Jan 2020 19:08:45 +0000 Subject: [PATCH] ui: Split splitter names in the discovery-chain (#7180) Previous to 1.7 splitter names didn't include the namespace name i.e. 'service-name' as of 1.7 they now include the namespace i.e. 'service-name.namespace' This commit take account of that --- ui-v2/app/components/discovery-chain.js | 2 +- ui-v2/app/utils/components/discovery-chain/index.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ui-v2/app/components/discovery-chain.js b/ui-v2/app/components/discovery-chain.js index 594cb68160..fabd6e85e4 100644 --- a/ui-v2/app/components/discovery-chain.js +++ b/ui-v2/app/components/discovery-chain.js @@ -99,7 +99,7 @@ export default Component.extend({ switch (item.Type) { case 'splitter': item.Splits.forEach(splitter => { - graph.addLink(`splitter:${item.Name}`, splitter.NextNode); + graph.addLink(item.ID, splitter.NextNode); }); break; case 'router': diff --git a/ui-v2/app/utils/components/discovery-chain/index.js b/ui-v2/app/utils/components/discovery-chain/index.js index 9903078263..ab3240bf5b 100644 --- a/ui-v2/app/utils/components/discovery-chain/index.js +++ b/ui-v2/app/utils/components/discovery-chain/index.js @@ -38,6 +38,14 @@ export const getSplitters = function(nodes) { return getNodesByType(nodes, 'splitter').map(function(item) { // Splitters need IDs adding so we can find them in the DOM later item.ID = `splitter:${item.Name}`; + // splitters have a service.nspace as a name + // do the reverse dance to ensure we don't mess up any + // serivice names with dots in them + const temp = item.Name.split('.'); + temp.reverse(); + temp.shift(); + temp.reverse(); + item.Name = temp.join('.'); return item; }); };