diff options
author | ys9693 <ys9693@att.com> | 2020-01-19 13:50:02 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-01-22 12:33:31 +0000 |
commit | 16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch) | |
tree | 03a2aff3060ddb5bc26a90115805a04becbaffc9 /catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-service-path-utils.ts | |
parent | aa83a2da4f911c3ac89318b8e9e8403b072942e1 (diff) |
Catalog alignment
Issue-ID: SDC-2724
Signed-off-by: ys9693 <ys9693@att.com>
Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe
Diffstat (limited to 'catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-service-path-utils.ts')
-rw-r--r-- | catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-service-path-utils.ts | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-service-path-utils.ts b/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-service-path-utils.ts deleted file mode 100644 index 48befef22d..0000000000 --- a/catalog-ui/src/app/directives/graphs-v2/composition-graph/utils/composition-graph-service-path-utils.ts +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -import * as _ from "lodash"; -import { LoaderService } from "app/services"; -import { CompositionGraphGeneralUtils } from "./composition-graph-general-utils"; -import { ICompositionGraphScope } from "../composition-graph.directive"; -import { ServiceServiceNg2 } from 'app/ng2/services/component-services/service.service'; -import { Service } from "../../../../models/components/service"; -import { ForwardingPath } from "app/models/forwarding-path"; -import { ForwardingPathLink } from "app/models/forwarding-path-link"; -import { CompositionCiServicePathLink } from "../../../../models/graph/graph-links/composition-graph-links/composition-ci-service-path-link"; -import { CommonGraphUtils } from "app/directives/graphs-v2/common/common-graph-utils"; - -export class ServicePathGraphUtils { - - constructor( - private loaderService: LoaderService, - private generalGraphUtils: CompositionGraphGeneralUtils, - private serviceService: ServiceServiceNg2, - private commonGraphUtils: CommonGraphUtils - ) { } - - public deletePathsFromGraph(cy: Cy.Instance, service: Service) { - cy.remove(`[type="${CompositionCiServicePathLink.LINK_TYPE}"]`); - } - - public drawPath(cy: Cy.Instance, forwardingPath: ForwardingPath, service: Service) { - let pathElements = forwardingPath.pathElements.listToscaDataDefinition; - - _.forEach(pathElements, (link: ForwardingPathLink) => { - let data: CompositionCiServicePathLink = new CompositionCiServicePathLink(link); - data.source = _.find( - service.componentInstances, - instance => instance.name === data.forwardingPathLink.fromNode - ).uniqueId; - data.target = _.find( - service.componentInstances, - instance => instance.name === data.forwardingPathLink.toNode - ).uniqueId; - data.pathId = forwardingPath.uniqueId; - data.pathName = forwardingPath.name; - this.commonGraphUtils.insertServicePathLinkToGraph(cy, data); - }); - } - - public createOrUpdateServicePath = (scope: ICompositionGraphScope, path: any): void => { - let service = <Service>scope.component; - this.loaderService.showLoader('composition-graph'); - - let onSuccess: (response: ForwardingPath) => void = (response: ForwardingPath) => { - - service.forwardingPaths[response.uniqueId] = response; - scope.selectedPathId = response.uniqueId; - }; - - this.generalGraphUtils.getGraphUtilsServerUpdateQueue().addBlockingUIActionWithReleaseCallback( - () => this.serviceService.createOrUpdateServicePath(service, path).subscribe(onSuccess), - () => this.loaderService.hideLoader('composition-graph') - ); - }; -} - -ServicePathGraphUtils.$inject = [ - 'LoaderService', - 'CompositionGraphGeneralUtils', - 'ServiceServiceNg2', - 'CommonGraphUtils' -]; |