From a5445100050e49e83f73424198d73cd72d672a4d Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 4 Mar 2018 14:53:33 +0200 Subject: Sync Integ to Master Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) --- .../utils/composition-graph-nodes-utils.ts | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-nodes-utils.ts') diff --git a/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-nodes-utils.ts b/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-nodes-utils.ts index 449d551cc0..fb1e6650bd 100644 --- a/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-nodes-utils.ts +++ b/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-nodes-utils.ts @@ -18,11 +18,15 @@ * ============LICENSE_END========================================================= */ -import {Component, NodesFactory, ComponentInstance, CompositionCiNodeVl,IAppMenu,AssetPopoverObj} from "app/models"; +import * as _ from "lodash"; +import {Component, NodesFactory, ComponentInstance, CompositionCiNodeVl,IAppMenu,AssetPopoverObj, Service} from "app/models"; import {EventListenerService, LoaderService} from "app/services"; import {GRAPH_EVENTS,ModalsHandler,GraphUIObjects} from "app/utils"; import {CompositionGraphGeneralUtils} from "./composition-graph-general-utils"; import {CommonGraphUtils} from "../../common/common-graph-utils"; +import {CompositionCiServicePathLink} from "app/models/graph/graph-links/composition-graph-links/composition-ci-service-path-link"; +import {ServiceGenericResponse} from "app/ng2/services/responses/service-generic-response"; +import {ServiceServiceNg2} from 'app/ng2/services/component-services/service.service'; /** * Created by obarda on 11/9/2016. */ @@ -31,9 +35,10 @@ export class CompositionGraphNodesUtils { private GeneralGraphUtils:CompositionGraphGeneralUtils, private commonGraphUtils:CommonGraphUtils, private eventListenerService:EventListenerService, - private loaderService:LoaderService /*, - private sdcMenu: IAppMenu, - private ModalsHandler: ModalsHandler*/) { + private loaderService:LoaderService, + private serviceService:ServiceServiceNg2, + /*private sdcMenu: IAppMenu, + private ModalsHandler: ModalsHandler*/) { } @@ -88,9 +93,20 @@ export class CompositionGraphNodesUtils { this.handleConnectedVlsToDelete(connectedVls); } + // check whether there is a service path going through this node, and if so clean it from the graph. + let nodeId = nodeToDelete.data().id; + let connectedPathLinks = cy.collection(`[type="${CompositionCiServicePathLink.LINK_TYPE}"][source="${nodeId}"], [type="${CompositionCiServicePathLink.LINK_TYPE}"][target="${nodeId}"]`); + _.forEach(connectedPathLinks, (link, key) => { + cy.remove(`[pathId="${link.data().pathId}"]`); + }); + + // update service path list + this.serviceService.getComponentCompositionData(component).subscribe((response:ServiceGenericResponse) => { + (component).forwardingPaths = response.forwardingPaths; + }); + //update UI cy.remove(nodeToDelete); - }; let onFailed:(response:any) => void = (response:any) => { @@ -297,5 +313,5 @@ export class CompositionGraphNodesUtils { } - CompositionGraphNodesUtils.$inject = ['NodesFactory', '$log', 'CompositionGraphGeneralUtils', 'CommonGraphUtils', 'EventListenerService', 'LoaderService' /*, 'sdcMenu', 'ModalsHandler'*/] + CompositionGraphNodesUtils.$inject = ['NodesFactory', '$log', 'CompositionGraphGeneralUtils', 'CommonGraphUtils', 'EventListenerService', 'LoaderService', 'ServiceServiceNg2' /*, 'sdcMenu', 'ModalsHandler'*/] -- cgit 1.2.3-korg