Big red button addition 09/209/5
authorSarkar, Anand (as0481) <as0481@att.com>
Wed, 29 May 2019 16:49:15 +0000 (12:49 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Thu, 30 May 2019 13:46:41 +0000 (09:46 -0400)
Signed-off-by: Sarkar, Anand (as0481) <as0481@att.com>
Issue-Id: RICPLT-961
Change-Id: I22ca50d4f4f824879161b6a1e7a64af6eedb02af
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
docs/release-notes.rst
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java
webapp-frontend/src/app/ran-connection/ran-connection.component.html
webapp-frontend/src/app/ran-connection/ran-connection.component.scss
webapp-frontend/src/app/ran-connection/ran-connection.component.spec.ts
webapp-frontend/src/app/ran-connection/ran-connection.component.ts
webapp-frontend/src/app/ran-connection/ran-connection.datasource.ts
webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts

index 7265c47..e2f00c6 100644 (file)
 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
 --------------------------
index b9213ea..97604a4 100644 (file)
@@ -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) {
index 2180ae5..565b326 100644 (file)
   ========================LICENSE_END===================================
 -->
 <div class="ranconnect__section">
-  <h3 class="ranconnect__header">RAN Connection</h3>
-  <button mat-raised-button (click)="openRanConnectDialog()">Connect</button>
-  <table mat-table [dataSource]="dataSource" class="ranconnect-table mat-elevation-z8">
-    
+  <h3 class="ranconnect__header">RAN Connections</h3>
+
+  <button mat-raised-button (click)="setupRANConnection()">Setup Connection..</button>
+  <button mat-raised-button color="warn" class="disconnect-all-button"
+    (click)="disconnectAllRANConnections()">Disconnect All</button>
+
+  <div class="spinner-container" *ngIf="dataSource.loading$ | async">
+    <mat-spinner></mat-spinner>
+  </div>
+
+  <table mat-table class="ranconnect-table mat-elevation-z8" [dataSource]="dataSource">
+
     <ng-container matColumnDef="requestType">
-        <mat-header-cell *matHeaderCellDef>RAN Type</mat-header-cell>
-        <mat-cell *matCellDef="let rconnect">{{rconnect.requestType}}</mat-cell>
+      <mat-header-cell *matHeaderCellDef>RAN Type</mat-header-cell>
+      <mat-cell *matCellDef="let rconnect">{{rconnect.requestType}}</mat-cell>
     </ng-container>
-    
+
     <ng-container matColumnDef="ranName">
-        <mat-header-cell *matHeaderCellDef>eNodeB/gNodeB Name</mat-header-cell>
-        <mat-cell *matCellDef="let rconnect">{{rconnect.ranName}}</mat-cell>
+      <mat-header-cell *matHeaderCellDef>eNodeB/gNodeB Name</mat-header-cell>
+      <mat-cell *matCellDef="let rconnect">{{rconnect.ranName}}</mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="ranIp">
-        <mat-header-cell *matHeaderCellDef>IP</mat-header-cell>
-        <mat-cell *matCellDef="let rconnect">{{rconnect.ranIp}}</mat-cell>
+      <mat-header-cell *matHeaderCellDef>IP</mat-header-cell>
+      <mat-cell *matCellDef="let rconnect">{{rconnect.ranIp}}</mat-cell>
     </ng-container>
-    
+
     <ng-container matColumnDef="ranPort">
-        <mat-header-cell *matHeaderCellDef>Port</mat-header-cell>
-        <mat-cell *matCellDef="let rconnect">{{rconnect.ranPort}}</mat-cell>
+      <mat-header-cell *matHeaderCellDef>Port</mat-header-cell>
+      <mat-cell *matCellDef="let rconnect">{{rconnect.ranPort}}</mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="responseCode">
-        <mat-header-cell *matHeaderCellDef>Response</mat-header-cell>
-        <mat-cell *matCellDef="let rconnect">{{rconnect.responseCode}}</mat-cell>
+      <mat-header-cell *matHeaderCellDef>Response</mat-header-cell>
+      <mat-cell *matCellDef="let rconnect">{{rconnect.responseCode}}</mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="timeStamp">
-        <mat-header-cell *matHeaderCellDef>Time Stamp</mat-header-cell>
-        <mat-cell *matCellDef="let rconnect">{{rconnect.timeStamp}}</mat-cell>
+      <mat-header-cell *matHeaderCellDef>Time Stamp</mat-header-cell>
+      <mat-cell *matCellDef="let rconnect">{{rconnect.timeStamp}}</mat-cell>
     </ng-container>
-    
+
     <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
-    <mat-row *matRowDef="let row; columns: displayedColumns">
-    </mat-row>
+
+    <mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
+
   </table>
-  <app-modal-event hidden></app-modal-event>
-</div>
 
+</div>
\ No newline at end of file
index 79aca12..7589e9a 100644 (file)
 }
 
 .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
index 3465e84..c4bbcec 100644 (file)
@@ -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.
  */
 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<RanConnectionComponent>;
+describe('RANConnectionComponent', () => {
+  let component: RANConnectionComponent;
+  let fixture: ComponentFixture<RANConnectionComponent>;
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ RanConnectionComponent ]
+      declarations: [ RANConnectionComponent ]
     })
     .compileComponents();
   }));
 
   beforeEach(() => {
-    fixture = TestBed.createComponent(RanConnectionComponent);
+    fixture = TestBed.createComponent(RANConnectionComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
   });
index 87a2f16..ee1d4c6 100644 (file)
@@ -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.
  * ========================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);
+            })
+          );
+        }
+      });
+  }
 }
index 613c5e4..44d4a4e 100644 (file)
@@ -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<E2SetupRequest> {
 
   private ranConnectSubject = new BehaviorSubject<E2SetupRequest[]>([]);
@@ -46,7 +45,7 @@ export class RANConnectionDataSource extends DataSource<E2SetupRequest> {
         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<E2SetupRequest[]> {
@@ -58,4 +57,4 @@ export class RANConnectionDataSource extends DataSource<E2SetupRequest> {
     this.loadingSubject.complete();
   }
 
-}
\ No newline at end of file
+}
index 1c1a534..f08face 100644 (file)
@@ -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' });
+  }
+
 }