X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy%2Fric-selector%2Fric-selector.component.ts;h=15e1a61e0339e6068a6fabffe1d6e7e600bc6917;hb=66372cb88b6b3e94dada9197c5efeaa7b2c93e17;hp=996d9a092c24e8c0ba058e1790d81bce9c2efe20;hpb=042a087cf3eea5e6f941ee9add6e1c50cb106e91;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.ts b/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.ts index 996d9a0..15e1a61 100644 --- a/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.ts +++ b/webapp-frontend/src/app/policy/ric-selector/ric-selector.component.ts @@ -18,7 +18,7 @@ // ========================LICENSE_END=================================== // / -import { Component, Input, OnInit } from "@angular/core"; +import { Component, Input, OnInit, Output } from "@angular/core"; import { AbstractControl, ControlContainer, @@ -28,8 +28,10 @@ import { FormGroupDirective, Validators, } from "@angular/forms"; +import { EventEmitter } from "@angular/core"; import { Rics } from "src/app/interfaces/ric"; import { PolicyService } from "src/app/services/policy/policy.service"; +import { MatSelectChange } from "@angular/material/select"; @Component({ selector: "nrcp-ric-selector", @@ -40,9 +42,13 @@ import { PolicyService } from "src/app/services/policy/policy.service"; ], }) export class RicSelectorComponent implements OnInit { - @Input() instanceForm: FormGroup; @Input() policyTypeName: string = ""; - ric: string; + @Output() selectedRic: EventEmitter = new EventEmitter(); + + ric: string = null; + instanceForm: FormGroup = new FormGroup({ + ricSelector: new FormControl(this.ric, [Validators.required]), + }); allRics: string[] = []; constructor( @@ -51,17 +57,12 @@ export class RicSelectorComponent implements OnInit { ) {} ngOnInit(): void { - this.instanceForm.addControl( - "ricSelector", - new FormControl(this.ric, [Validators.required]) - ); - console.log("Ric:", this.ric); this.fetchRics(); } - get selectedRic(): string { - return this.ric; + onRicChanged(newvalue: MatSelectChange): void { + this.selectedRic.emit(newvalue.value); } get ricSelector(): AbstractControl {