2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import {Component} from "@angular/core";
22 import {HierarchyTabComponent} from "./panel/panel-tabs/hierarchy-tab/hierarchy-tab.component";
23 import {ComponentGenericResponse} from "../../../services/responses/component-generic-response";
24 import {TopologyTemplateService} from "../../../services/component-services/topology-template.service";
25 import {WorkspaceService} from "../workspace.service";
26 import {Module} from "app/models";
27 import {SdcUiServices} from "onap-ui-angular";
28 import {Select} from "@ngxs/store";
29 import {WorkspaceState} from "../../../store/states/workspace.state";
30 import {DeploymentGraphService} from "../../composition/deployment/deployment-graph.service";
35 titleIcon: 'composition-o',
36 component: HierarchyTabComponent,
39 tooltipText: 'Hierarchy'
44 selector: 'deployment-page',
45 templateUrl: './deployment-page.component.html',
46 styleUrls: ['deployment-page.component.less']
49 export class DeploymentPageComponent {
50 public tabs: Array<any>;
51 public resourceType: string;
52 public modules: Array<Module>;
53 public isDataAvailable: boolean;
55 @Select(WorkspaceState.isViewOnly) isViewOnly$: boolean;
57 constructor(private topologyTemplateService: TopologyTemplateService,
58 private workspaceService: WorkspaceService,
59 private deploymentService: DeploymentGraphService,
60 private loaderService: SdcUiServices.LoaderService) {
62 this.isDataAvailable = false;
66 this.topologyTemplateService.getDeploymentGraphData(this.workspaceService.metadata.componentType, this.workspaceService.metadata.uniqueId).subscribe((response: ComponentGenericResponse) => {
67 this.deploymentService.componentInstances = response.componentInstances;
68 this.deploymentService.componentInstancesRelations = response.componentInstancesRelations;
69 this.deploymentService.modules = response.modules;
70 this.isDataAvailable = true;
71 this.loaderService.deactivate();
74 this.loaderService.activate();
75 this.resourceType = this.workspaceService.getMetadataType();
76 this.tabs.push(tabs.hierarchyTab);