From c11160ecfdce03091917e2728f80848f4d8feb95 Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 25 Feb 2020 15:13:31 -0800 Subject: Add new dialog for policy Add a new dialog component for tosca based policy, config/op should use that dialog now. Issue-ID: CLAMP-653 Change-Id: I57523bc2d4bfbf5ca5a3acf5c59823df06fd4cd9 Signed-off-by: sebdet --- .../src/components/loop_viewer/svg/LoopComponentConverter.js | 9 ++++++--- ui-react/src/components/loop_viewer/svg/LoopSvg.test.js | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'ui-react/src/components/loop_viewer/svg') diff --git a/ui-react/src/components/loop_viewer/svg/LoopComponentConverter.js b/ui-react/src/components/loop_viewer/svg/LoopComponentConverter.js index a409d2cd0..5b0dc1e01 100644 --- a/ui-react/src/components/loop_viewer/svg/LoopComponentConverter.js +++ b/ui-react/src/components/loop_viewer/svg/LoopComponentConverter.js @@ -4,15 +4,18 @@ export default class LoopComponentConverter { var componentsMap = new Map([]); if (typeof (loopCache.getMicroServicePolicies()) !== "undefined") { loopCache.getMicroServicePolicies().forEach(ms => { - componentsMap.set(ms.name, "/configurationPolicyModal/"+ms.name); + componentsMap.set(ms.name, "/policyModal/MICRO-SERVICE-POLICY/"+ms.name); }) } if (typeof (loopCache.getOperationalPolicies()) !== "undefined") { loopCache.getOperationalPolicies().forEach(op => { - componentsMap.set(op.name, "/operationalPolicyModal"); + if (op.name.includes("legacy")) { + componentsMap.set(op.name,"/operationalPolicyModal"); + } else { + componentsMap.set(op.name, "/policyModal/OPERATIONAL-POLICY/"+op.name); + } }) } - componentsMap.set("OperationalPolicy","/operationalPolicyModal"); return componentsMap; } } diff --git a/ui-react/src/components/loop_viewer/svg/LoopSvg.test.js b/ui-react/src/components/loop_viewer/svg/LoopSvg.test.js index 635185463..17f4b3563 100644 --- a/ui-react/src/components/loop_viewer/svg/LoopSvg.test.js +++ b/ui-react/src/components/loop_viewer/svg/LoopSvg.test.js @@ -99,7 +99,7 @@ describe('Verify LoopSvg', () => { component.simulate('click', event); component.update(); - expect(historyMock.push.mock.calls[0]).toEqual([ '/configurationPolicyModal/TCA_h2NMX_v1_0_ResourceInstanceName1_tca']); + expect(historyMock.push.mock.calls[0]).toEqual([ '/policyModal/MICRO-SERVICE-POLICY/TCA_h2NMX_v1_0_ResourceInstanceName1_tca']); //click operational policy dummyElement.setAttribute("data-element-id","OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca"); @@ -108,7 +108,7 @@ describe('Verify LoopSvg', () => { component.simulate('click', event2); component.update(); - expect(historyMock.push.mock.calls[1]).toEqual([ '/operationalPolicyModal']); + expect(historyMock.push.mock.calls[1]).toEqual([ '/policyModal/OPERATIONAL-POLICY/OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca']); }); it('Test componentWillReceiveProps method', () => { @@ -125,9 +125,9 @@ describe('Verify LoopSvg', () => { ); - expect(component.state('componentModalMapping').size).toEqual(2); + expect(component.state('componentModalMapping').size).toEqual(1); component.setProps({loopCache: loopCache}); - expect(component.state('componentModalMapping').size).toEqual(3); + expect(component.state('componentModalMapping').size).toEqual(2); }); }); -- cgit 1.2.3-korg