From 258f12c79d0a1ad151d8717dfb06ea77783e84ca Mon Sep 17 00:00:00 2001 From: maximesson Date: Mon, 19 Apr 2021 10:49:31 +0200 Subject: [PATCH] Closing the instance tables when refreshing the types Change-Id: Iadcd87a2dd683e666461769658648c344b22426a Issue-ID: NONRTRIC-488 Signed-off-by: maximesson --- webapp-frontend/src/app/policy/policy-control.component.html | 2 +- webapp-frontend/src/app/policy/policy-control.component.ts | 6 ++---- .../src/app/policy/policy-type/policy-type.component.ts | 10 ++++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/webapp-frontend/src/app/policy/policy-control.component.html b/webapp-frontend/src/app/policy/policy-control.component.html index e8b6ae9..03aa936 100644 --- a/webapp-frontend/src/app/policy/policy-control.component.html +++ b/webapp-frontend/src/app/policy/policy-control.component.html @@ -28,6 +28,6 @@
- +
There are no policy types to display.
\ No newline at end of file diff --git a/webapp-frontend/src/app/policy/policy-control.component.ts b/webapp-frontend/src/app/policy/policy-control.component.ts index feb4cfb..f8b75c3 100644 --- a/webapp-frontend/src/app/policy/policy-control.component.ts +++ b/webapp-frontend/src/app/policy/policy-control.component.ts @@ -21,7 +21,6 @@ import { Component, OnInit } from "@angular/core"; import { PolicyTypes } from "@interfaces/policy.types"; import { PolicyService } from "@services/policy/policy.service"; -import { PolicyTypeComponent } from "./policy-type/policy-type.component" @Component({ selector: "nrcp-policy-control", @@ -31,10 +30,9 @@ import { PolicyTypeComponent } from "./policy-type/policy-type.component" export class PolicyControlComponent implements OnInit { policyTypeIds = []; - ptComponent: PolicyTypeComponent; + minimiseTrigger: boolean = false; constructor(private policyService: PolicyService) { - this.ptComponent = new PolicyTypeComponent(policyService); } ngOnInit() { @@ -44,7 +42,7 @@ export class PolicyControlComponent implements OnInit { refreshTables() { this.policyService.getPolicyTypes().subscribe((policyType: PolicyTypes) => { this.policyTypeIds = policyType.policytype_ids.sort(); + this.minimiseTrigger = !this.minimiseTrigger; }); - this.ptComponent.toggleVisible(); } } diff --git a/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts b/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts index cfc0eb5..7271419 100644 --- a/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts +++ b/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts @@ -18,10 +18,11 @@ * ========================LICENSE_END=================================== */ -import { Component, Input, OnInit } from "@angular/core"; +import { Component, Input, OnInit, OnChanges} from "@angular/core"; import { BehaviorSubject } from "rxjs"; import { PolicyType, PolicyTypeSchema } from "@interfaces/policy.types"; import { PolicyService } from "@app/services/policy/policy.service"; +import "@policy/policy-control.component"; class PolicyTypeInfo { constructor(public type: PolicyTypeSchema) {} @@ -34,8 +35,9 @@ class PolicyTypeInfo { templateUrl: "./policy-type.component.html", styleUrls: ["./policy-type.component.scss"], }) -export class PolicyTypeComponent implements OnInit { +export class PolicyTypeComponent implements OnInit, OnChanges { @Input() policyTypeId: string; + @Input() minimiseTrigger: boolean; isVisible: BehaviorSubject = new BehaviorSubject(false); @@ -50,6 +52,10 @@ export class PolicyTypeComponent implements OnInit { this.isVisible.next(false); } + ngOnChanges(): void { + this.isVisible.next(false); + } + public loadTypeInfo() { if (this.policyTypeId && this.policyTypeId !== "") { this.policyService -- 2.16.6