X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fanr-xapp%2Fanr-edit-ncr-dialog.component.ts;h=9987ac335fcbc6b5020ea387cd74729f8f331ff7;hb=a4b2e71472b32a8244da846af20128504f4cbc65;hp=57a4b64ad04d1322fbcabc65221eca91fa63c50e;hpb=3af4964975f0ea5e1ca35222eac8e6848c5edf2d;p=portal%2Fric-dashboard.git diff --git a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts b/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts index 57a4b64a..9987ac33 100644 --- a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts +++ b/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts @@ -2,14 +2,14 @@ * ========================LICENSE_START================================= * O-RAN-SC * %% - * Copyright (C) 2019 AT&T Intellectual Property and Nokia + * Copyright (C) 2019 AT&T Intellectual Property * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,24 +23,22 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { ANRXappService } from '../services/anr-xapp/anr-xapp.service'; import { ErrorDialogService } from '../services/ui/error-dialog.service'; import { ANRNeighborCellRelation, ANRNeighborCellRelationMod } from '../interfaces/anr-xapp.types'; -import { modelGroupProvider } from '@angular/forms/src/directives/ng_model_group'; @Component({ - selector: 'app-ncr-edit-dialog', + selector: 'rd-ncr-edit-dialog', templateUrl: './anr-edit-ncr-dialog.component.html', styleUrls: ['./anr-edit-ncr-dialog.component.scss'] }) -export class ANREditNCRDialogComponent implements OnInit { +export class AnrEditNcrDialogComponent implements OnInit { private ncrDialogForm: FormGroup; constructor( - private dialogRef: MatDialogRef, - private dataService: ANRXappService, private errorService: ErrorDialogService, - @Inject(MAT_DIALOG_DATA) private data: ANRNeighborCellRelation) { - console.log('constructed with data ' + data); - } + private dialogRef: MatDialogRef, + private dataService: ANRXappService, + private errorService: ErrorDialogService, + @Inject(MAT_DIALOG_DATA) private data: ANRNeighborCellRelation) { } ngOnInit() { this.ncrDialogForm = new FormGroup({ @@ -58,31 +56,34 @@ export class ANREditNCRDialogComponent implements OnInit { } modifyNcr = (ncrFormValue: ANRNeighborCellRelation) => { - if (this.ncrDialogForm.valid) { - const ncrm = {} as ANRNeighborCellRelationMod; - // there must be a btter way - ncrm.neighborCellNrcgi = ncrFormValue.neighborCellNrcgi; - ncrm.neighborCellNrpci = ncrFormValue.neighborCellNrpci; - ncrm.flagNoHo = ncrFormValue.flagNoHo; - ncrm.flagNoXn = ncrFormValue.flagNoXn; - ncrm.flagNoRemove = ncrFormValue.flagNoRemove; - this.dataService.modifyNcr(ncrFormValue.servingCellNrcgi, ncrFormValue.neighborCellNrpci, ncrm).subscribe((val: any[]) => {}, - (error => { - this.errorService.displayError('NCR update failed: ' + error.message); - }) - ); - this.dialogRef.close(); - } + if (this.ncrDialogForm.valid) { + const ncrm = {} as ANRNeighborCellRelationMod; + // there must be a better way to build the struct + ncrm.neighborCellNrcgi = ncrFormValue.neighborCellNrcgi; + ncrm.neighborCellNrpci = ncrFormValue.neighborCellNrpci; + ncrm.flagNoHo = ncrFormValue.flagNoHo; + ncrm.flagNoXn = ncrFormValue.flagNoXn; + ncrm.flagNoRemove = ncrFormValue.flagNoRemove; + this.dataService.modifyNcr(ncrFormValue.servingCellNrcgi, ncrFormValue.neighborCellNrpci, ncrm).subscribe( + (val: any[]) => { + // Success + }, + (error => { + this.errorService.displayError('NCR update failed: ' + error.message); + }) + ); + this.dialogRef.close(); + } } - public hasError(controlName: string, errorName: string) { + hasError(controlName: string, errorName: string) { if (this.ncrDialogForm.controls[controlName].hasError(errorName)) { - return true; + return true; } return false; } - public validateControl(controlName: string) { + validateControl(controlName: string) { if (this.ncrDialogForm.controls[controlName].invalid && this.ncrDialogForm.controls[controlName].touched) { return true; }