--------------------------
* Add ANR xApp neighbor cell relation table
* Drop the pendulum xApp control screen
-* Add column sorting on xApp catalog and xApp control
+* Add column sorting on xApp catalog, xApp control, ANR
* Add disconnect-all button to RAN connection screen
Version 1.0.3, 28 May 2019
<mat-spinner></mat-spinner>
</div>
- <table mat-table class="ncr-table mat-elevation-z8" [dataSource]="dataSource">
+ <table mat-table class="ncr-table mat-elevation-z8" [dataSource]="dataSource" matSort>
<ng-container matColumnDef="cellIdentifierNrcgi">
- <mat-header-cell *matHeaderCellDef>Serving Cell NRCGI</mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header>Serving Cell NRCGI</mat-header-cell>
<mat-cell *matCellDef="let ncr">{{ncr.servingCellNrcgi}}</mat-cell>
</ng-container>
<ng-container matColumnDef="neighborCellNrpci">
- <mat-header-cell *matHeaderCellDef>Neighbor Cell NRPCI</mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header>Neighbor Cell NRPCI</mat-header-cell>
<mat-cell *matCellDef="let ncr">{{ncr.neighborCellNrpci}}</mat-cell>
</ng-container>
<ng-container matColumnDef="neighborCellNrcgi">
- <mat-header-cell *matHeaderCellDef>Neighbor Cell NRCGI</mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header>Neighbor Cell NRCGI</mat-header-cell>
<mat-cell *matCellDef="let ncr">{{ncr.neighborCellNrcgi}}</mat-cell>
</ng-container>
<ng-container matColumnDef="flagNoHo">
- <mat-header-cell *matHeaderCellDef>Flag No Handover</mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header>Flag No Handover</mat-header-cell>
<mat-cell *matCellDef="let ncr">{{ncr.flagNoHo}}</mat-cell>
</ng-container>
<ng-container matColumnDef="flagNoXn">
- <mat-header-cell *matHeaderCellDef>Flag No Xn</mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header>Flag No Xn</mat-header-cell>
<mat-cell *matCellDef="let ncr">{{ncr.flagNoXn}}</mat-cell>
</ng-container>
<ng-container matColumnDef="flagNoRemove">
- <mat-header-cell *matHeaderCellDef>Flag No Remove</mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header>Flag No Remove</mat-header-cell>
<mat-cell *matCellDef="let ncr">{{ncr.flagNoRemove}}</mat-cell>
</ng-container>
*/
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
+import { MatSort } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { debounceTime, distinctUntilChanged, tap } from 'rxjs/operators';
import { ANRNeighborCellRelation } from '../interfaces/anr-xapp.types';
-import { ANRXappDataSource } from './anr-xapp.datasource';
import { ANRXappService } from '../services/anr-xapp/anr-xapp.service';
-import { ANREditNCRDialogComponent } from './anr-edit-ncr-dialog.component';
-import { ConfirmDialogService } from './../services/ui/confirm-dialog.service';
import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { ConfirmDialogService } from './../services/ui/confirm-dialog.service';
import { NotificationService } from './../services/ui/notification.service';
+import { ANREditNCRDialogComponent } from './anr-edit-ncr-dialog.component';
+import { ANRXappDataSource } from './anr-xapp.datasource';
@Component({
selector: 'app-anr',
@ViewChild('ggNodeB') ggNodeB: ElementRef;
@ViewChild('servingCellNrcgi') servingCellNrcgi: ElementRef;
@ViewChild('neighborCellNrpci') neighborCellNrpci: ElementRef;
+ @ViewChild(MatSort) sort: MatSort;
displayedColumns = ['cellIdentifierNrcgi', 'neighborCellNrpci', 'neighborCellNrcgi',
'flagNoHo', 'flagNoXn', 'flagNoRemove', 'action'];
private notificationService: NotificationService) { }
ngOnInit() {
- this.dataSource = new ANRXappDataSource(this.anrXappService);
+ this.dataSource = new ANRXappDataSource(this.anrXappService, this.sort);
this.dataSource.loadTable();
// Empty string occurs first in the array of gNodeBIds
this.anrXappService.getgNodeBs().subscribe((res: string[]) => this.gNodeBIds = res);
* ========================LICENSE_END===================================
*/
-import { CollectionViewer, DataSource} from '@angular/cdk/collections';
+import { CollectionViewer, DataSource } from '@angular/cdk/collections';
+import { MatSort } from '@angular/material';
+import { merge } from 'rxjs';
+import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
-import { catchError, finalize } from 'rxjs/operators';
import { of } from 'rxjs/observable/of';
-import { BehaviorSubject } from 'rxjs/BehaviorSubject';
+import { catchError, finalize, map } from 'rxjs/operators';
import { ANRNeighborCellRelation } from '../interfaces/anr-xapp.types';
import { ANRXappService } from '../services/anr-xapp/anr-xapp.service';
public loading$ = this.loadingSubject.asObservable();
- constructor(private anrXappService: ANRXappService) {
+ constructor(private anrXappService: ANRXappService, private sort: MatSort) {
super();
}
}
connect(collectionViewer: CollectionViewer): Observable<ANRNeighborCellRelation[]> {
- return this.relationsSubject.asObservable();
+ const dataMutations = [
+ this.relationsSubject.asObservable(),
+ this.sort.sortChange
+ ];
+ return merge(...dataMutations).pipe(map(() => {
+ return this.getSortedData([...this.relationsSubject.getValue()]);
+ }));
}
disconnect(collectionViewer: CollectionViewer): void {
this.loadingSubject.complete();
}
+ private getSortedData(data: ANRNeighborCellRelation[]) {
+ if (!this.sort.active || this.sort.direction === '') {
+ return data;
+ }
+
+ return data.sort((a, b) => {
+ const isAsc = this.sort.direction === 'asc';
+ switch (this.sort.active) {
+ case 'cellIdentifierNrcgi': return compare(a.servingCellNrcgi, b.servingCellNrcgi, isAsc);
+ case 'neighborCellNrpci': return compare(a.neighborCellNrpci, b.neighborCellNrpci, isAsc);
+ case 'neighborCellNrcgi': return compare(a.neighborCellNrcgi, b.neighborCellNrcgi, isAsc);
+ case 'flagNoHo': return compare(a.flagNoHo, b.flagNoHo, isAsc);
+ case 'flagNoXn': return compare(a.flagNoXn, b.flagNoXn, isAsc);
+ case 'flagNoRemove': return compare(a.flagNoRemove, b.flagNoRemove, isAsc);
+ default: return 0;
+ }
+ });
+ }
+
+}
+
+function compare(a, b, isAsc) {
+ return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
}