From c40f0d5d74bfa57a8ee28ba818b7fcd67633177d Mon Sep 17 00:00:00 2001 From: "Sarkar, Anand (as0481)" Date: Wed, 29 May 2019 12:49:15 -0400 Subject: [PATCH] Big red button addition Signed-off-by: Sarkar, Anand (as0481) Issue-Id: RICPLT-961 Change-Id: I22ca50d4f4f824879161b6a1e7a64af6eedb02af Signed-off-by: Lott, Christopher (cl778h) --- docs/release-notes.rst | 3 +- .../dashboard/controller/E2ManagerController.java | 8 ++++ .../ran-connection/ran-connection.component.html | 54 +++++++++++++--------- .../ran-connection/ran-connection.component.scss | 8 ++-- .../ran-connection.component.spec.ts | 16 +++---- .../app/ran-connection/ran-connection.component.ts | 41 +++++++++++++--- .../ran-connection/ran-connection.datasource.ts | 5 +- .../src/app/services/e2-mgr/e2-mgr.service.ts | 4 ++ 8 files changed, 94 insertions(+), 45 deletions(-) diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 7265c477..e2f00c64 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -20,10 +20,11 @@ RIC Dashboard Release Notes =========================== -Version 1.0.4, 29 May 2019 +Version 1.0.4, 30 May 2019 -------------------------- * Add ANR xApp neighbor cell relation table * Drop the pendulum xApp control screen +* Add disconnect-all button to RAN connection screen Version 1.0.3, 28 May 2019 -------------------------- diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java index b9213eac..97604a4e 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java @@ -108,6 +108,14 @@ public class E2ManagerController { return responses; } + // TODO replace with actual delete all RAN connections functionality + @ApiOperation(value = "Disconnect all RAN Connections.") + @RequestMapping(value = "/disconnectAllRAN", method = RequestMethod.DELETE) + public void disconnectAllRANConnections() { + logger.debug("disconnectAllRANConnections"); + responses.clear(); + } + @ApiOperation(value = "Sets up an EN-DC RAN connection via the E2 manager.", response = E2SetupResponse.class) @RequestMapping(value = "/endcSetup", method = RequestMethod.POST) public E2SetupResponse endcSetup(@RequestBody SetupRequest setupRequest, HttpServletResponse response) { diff --git a/webapp-frontend/src/app/ran-connection/ran-connection.component.html b/webapp-frontend/src/app/ran-connection/ran-connection.component.html index 2180ae52..565b326c 100644 --- a/webapp-frontend/src/app/ran-connection/ran-connection.component.html +++ b/webapp-frontend/src/app/ran-connection/ran-connection.component.html @@ -18,44 +18,52 @@ ========================LICENSE_END=================================== -->
-

RAN Connection

- - - +

RAN Connections

+ + + + +
+ +
+ +
+ - RAN Type - {{rconnect.requestType}} + RAN Type + {{rconnect.requestType}} - + - eNodeB/gNodeB Name - {{rconnect.ranName}} + eNodeB/gNodeB Name + {{rconnect.ranName}} - IP - {{rconnect.ranIp}} + IP + {{rconnect.ranIp}} - + - Port - {{rconnect.ranPort}} + Port + {{rconnect.ranPort}} - Response - {{rconnect.responseCode}} + Response + {{rconnect.responseCode}} - Time Stamp - {{rconnect.timeStamp}} + Time Stamp + {{rconnect.timeStamp}} - + - - + + +
- -
+ \ No newline at end of file diff --git a/webapp-frontend/src/app/ran-connection/ran-connection.component.scss b/webapp-frontend/src/app/ran-connection/ran-connection.component.scss index 79aca124..7589e9a6 100644 --- a/webapp-frontend/src/app/ran-connection/ran-connection.component.scss +++ b/webapp-frontend/src/app/ran-connection/ran-connection.component.scss @@ -32,10 +32,12 @@ } .ranconnect-table { - width: 99%; /* 100 looks wrong */ - min-height: 150px; + width: 100%; + min-height: 100px; margin-top: 10px; background-color:transparent; } - +.disconnect-all-button { + float: right; +} \ No newline at end of file diff --git a/webapp-frontend/src/app/ran-connection/ran-connection.component.spec.ts b/webapp-frontend/src/app/ran-connection/ran-connection.component.spec.ts index 3465e84a..c4bbcecc 100644 --- a/webapp-frontend/src/app/ran-connection/ran-connection.component.spec.ts +++ b/webapp-frontend/src/app/ran-connection/ran-connection.component.spec.ts @@ -7,9 +7,9 @@ * 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. @@ -19,21 +19,21 @@ */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RanConnectionComponent } from './ran-connection.component'; +import { RANConnectionComponent } from './ran-connection.component'; -describe('RanConnectionComponent', () => { - let component: RanConnectionComponent; - let fixture: ComponentFixture; +describe('RANConnectionComponent', () => { + let component: RANConnectionComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RanConnectionComponent ] + declarations: [ RANConnectionComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(RanConnectionComponent); + fixture = TestBed.createComponent(RANConnectionComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/webapp-frontend/src/app/ran-connection/ran-connection.component.ts b/webapp-frontend/src/app/ran-connection/ran-connection.component.ts index 87a2f167..ee1d4c6b 100644 --- a/webapp-frontend/src/app/ran-connection/ran-connection.component.ts +++ b/webapp-frontend/src/app/ran-connection/ran-connection.component.ts @@ -7,9 +7,9 @@ * 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. @@ -18,11 +18,16 @@ * ========================LICENSE_END=================================== */ import { Component, OnInit } from '@angular/core'; -import { MatDialog} from '@angular/material/dialog'; +import { MatDialog } from '@angular/material/dialog'; import { RANConnectionDialogComponent } from './ran-connection-dialog.component'; import { E2ManagerService } from '../services/e2-mgr/e2-mgr.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 { E2SetupRequest } from '../interfaces/e2-mgr.types'; import { RANConnectionDataSource } from './ran-connection.datasource'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; @Component({ @@ -31,25 +36,47 @@ import { RANConnectionDataSource } from './ran-connection.datasource'; styleUrls: ['./ran-connection.component.scss'] }) export class RANConnectionComponent implements OnInit { - displayedColumns: string[] = [ 'requestType', 'ranName', 'ranIp', 'ranPort', 'responseCode', 'timeStamp' ]; + displayedColumns: string[] = ['requestType', 'ranName', 'ranIp', 'ranPort', 'responseCode', 'timeStamp']; dataSource: RANConnectionDataSource; - constructor(private e2MgrSvc: E2ManagerService, public dialog: MatDialog) { } + constructor(private e2MgrSvc: E2ManagerService, private errorSvc: ErrorDialogService, + private confirmDialogService: ConfirmDialogService, private notification: NotificationService, + public dialog: MatDialog) { } ngOnInit() { this.dataSource = new RANConnectionDataSource(this.e2MgrSvc); this.dataSource.loadTable(); } - openRanConnectDialog() { + setupRANConnection() { const dialogRef = this.dialog.open(RANConnectionDialogComponent, { width: '450px', data: {} }); dialogRef.afterClosed().subscribe(result => { - this.dataSource = new RANConnectionDataSource(this.e2MgrSvc); this.dataSource.loadTable(); }); } + disconnectAllRANConnections() { + let httpErrRes: HttpErrorResponse; + const aboutError = 'Disconnect all RAN Connections Failed: '; + this.confirmDialogService.openConfirmDialog('Are you sure you want to disconnect all RAN connections?') + .afterClosed().subscribe(res => { + if (res) { + this.e2MgrSvc.disconnectAllRAN().subscribe( + response => { + if (response.status === 200) { + this.notification.success('Disconnect all RAN Connections Succeeded!'); + this.dataSource.loadTable(); + } + }, + (error => { + httpErrRes = error; + this.errorSvc.displayError(aboutError + httpErrRes.message); + }) + ); + } + }); + } } diff --git a/webapp-frontend/src/app/ran-connection/ran-connection.datasource.ts b/webapp-frontend/src/app/ran-connection/ran-connection.datasource.ts index 613c5e4b..44d4a4e1 100644 --- a/webapp-frontend/src/app/ran-connection/ran-connection.datasource.ts +++ b/webapp-frontend/src/app/ran-connection/ran-connection.datasource.ts @@ -26,7 +26,6 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { E2SetupRequest } from '../interfaces/e2-mgr.types'; import { E2ManagerService } from '../services/e2-mgr/e2-mgr.service'; - export class RANConnectionDataSource extends DataSource { private ranConnectSubject = new BehaviorSubject([]); @@ -46,7 +45,7 @@ export class RANConnectionDataSource extends DataSource { catchError(() => of([])), finalize(() => this.loadingSubject.next(false)) ) - .subscribe((ranConnect: E2SetupRequest[]) => this.ranConnectSubject.next(ranConnect) ) + .subscribe((ranConnect: E2SetupRequest[]) => this.ranConnectSubject.next(ranConnect)); } connect(collectionViewer: CollectionViewer): Observable { @@ -58,4 +57,4 @@ export class RANConnectionDataSource extends DataSource { this.loadingSubject.complete(); } -} \ No newline at end of file +} diff --git a/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts index 1c1a534d..f08facee 100644 --- a/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts +++ b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts @@ -62,4 +62,8 @@ export class E2ManagerService { return this.httpClient.post(this.basePath + 'x2Setup', req); } + disconnectAllRAN() { + return this.httpClient.delete((this.basePath + 'disconnectAllRAN'), { observe: 'response' }); + } + } -- 2.16.6