Merge "add test coverage of PolicyInstanceComponent"
authorPatrik Buhr <patrik.buhr@est.tech>
Tue, 20 Apr 2021 13:49:59 +0000 (13:49 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 20 Apr 2021 13:49:59 +0000 (13:49 +0000)
webapp-frontend/src/app/policy/policy-control.component.html
webapp-frontend/src/app/policy/policy-control.component.ts
webapp-frontend/src/app/policy/policy-type/policy-type.component.ts

index e8b6ae9..03aa936 100644 (file)
@@ -28,6 +28,6 @@
 </div>
 <br>
 
-<nrcp-policy-type *ngFor="let policyTypeId of this.policyTypeIds" [policyTypeId]="policyTypeId"></nrcp-policy-type>
+<nrcp-policy-type *ngFor="let policyTypeId of this.policyTypeIds" [policyTypeId]="policyTypeId" [minimiseTrigger]="minimiseTrigger"></nrcp-policy-type>
 
 <div *ngIf="this.policyTypeIds.length==0">There are no policy types to display.</div>
\ No newline at end of file
index feb4cfb..f8b75c3 100644 (file)
@@ -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();
   }
 }
index cfc0eb5..7271419 100644 (file)
  * ========================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<boolean> = new BehaviorSubject<boolean>(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