+ this.dataSource = new ANRXappDataSource(this.anrXappService, this.sort, this.notificationService);
+ this.dataSource.loadTable();
+ // Empty string occurs first in the array of gNodeBIds
+ this.anrXappService.getgNodeBs().subscribe((res: string[]) => this.gNodeBIds = res);
+ this.ui.darkModeState.subscribe((isDark) => {
+ this.darkMode = isDark;
+ });
+ }
+
+ ngAfterViewInit() {
+ // the selector event calls loadNcrtPage() directly.
+ fromEvent(this.servingCellNrcgi.nativeElement, 'keyup')
+ .pipe(
+ debounceTime(150),
+ distinctUntilChanged(),
+ tap(() => {
+ this.loadNcrtPage();
+ })
+ )
+ .subscribe();
+ fromEvent(this.neighborCellNrpci.nativeElement, 'keyup')
+ .pipe(
+ debounceTime(150),
+ distinctUntilChanged(),
+ tap(() => {
+ this.loadNcrtPage();
+ })
+ )
+ .subscribe();
+ }
+
+ loadNcrtPage() {
+ this.dataSource.loadTable(
+ this.ggNodeB.nativeElement.value,
+ this.servingCellNrcgi.nativeElement.value,
+ this.neighborCellNrpci.nativeElement.value);
+ }
+
+ modifyNcr(ncr: ANRNeighborCellRelation): void {
+ if (this.darkMode) {
+ this.panelClass = "dark-theme";
+ } else {
+ this.panelClass = "";
+ }
+ const dialogRef = this.dialog.open(AnrEditNcrDialogComponent, {
+ panelClass: this.panelClass,
+ width: '300px',
+ data: ncr
+ });
+ dialogRef.afterClosed().subscribe(
+ (result: any) => {
+ this.loadNcrtPage();
+ }
+ );
+ }
+
+ deleteNcr(ncr: ANRNeighborCellRelation): void {
+ this.confirmDialogService
+ .openConfirmDialog('Are you sure you want to delete this relation?')
+ .afterClosed().subscribe(
+ (res: any) => {
+ if (res) {
+ this.loadingDialogService.startLoading("Deleting");
+ this.anrXappService.deleteNcr(ncr.servingCellNrcgi, ncr.neighborCellNrpci)
+ .pipe(
+ finalize(() => this.loadingDialogService.stopLoading())
+ )
+ .subscribe(
+ (response: HttpResponse<Object>) => {
+ switch (response.status) {
+ case 200:
+ this.notificationService.success('Delete succeeded!');
+ this.loadNcrtPage();
+ break;
+ default:
+ this.notificationService.warn('Delete failed.');
+ }
+ },
+ (error: HttpErrorResponse) => {
+ this.errorDialogService.displayError(error.message);
+ });
+ }
+ });