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 * as _ from "lodash";
22 import { Component, Inject, Input, Output, EventEmitter, AfterViewInit, OnChanges } from "@angular/core";
23 import { TranslateService } from './../../../../../shared/translator/translate.service';
24 import { PoliciesService } from "../../../../../services/policies.service";
25 import { Component as TopologyTemplate, ComponentInstance, IAppMenu } from "app/models";
26 import { PolicyInstance } from 'app/models/graph/zones/policy-instance';
27 import { GRAPH_EVENTS } from './../../../../../../utils/constants';
28 import { EventListenerService } from 'app/services/event-listener-service';
29 import { ZoneInstance } from 'app/models/graph/zones/zone-instance';
30 import { SimpleChanges } from "@angular/core/src/metadata/lifecycle_hooks";
33 selector: 'policy-tabs',
34 templateUrl: './policy-tabs.component.html'
36 export class PolicyTabsComponent implements OnChanges {
38 @Input() topologyTemplate:TopologyTemplate;
39 @Input() selectedZoneInstanceType:string;
40 @Input() selectedZoneInstanceId:string;
41 @Input() isViewOnly: boolean;
42 @Output() isLoading: EventEmitter<boolean> = new EventEmitter<boolean>();
44 private policy:PolicyInstance;
46 constructor(private translateService:TranslateService,
47 private policiesService:PoliciesService
52 ngOnChanges(changes: SimpleChanges): void {
56 private initPolicy = ():void => {
57 this.isLoading.emit(true);
58 this.policiesService.getSpecificPolicy(this.topologyTemplate.componentType, this.topologyTemplate.uniqueId, this.selectedZoneInstanceId).subscribe(
61 console.log(JSON.stringify(policy));
63 error => console.log("Error getting policy!"),
64 () => this.isLoading.emit(false)
68 private setIsLoading = (value) :void => {
69 this.isLoading.emit(value);