Add loading component 21/821/3
authorjh245g <jh245g@att.com>
Wed, 28 Aug 2019 13:32:20 +0000 (09:32 -0400)
committerjh245g <jh245g@att.com>
Wed, 4 Sep 2019 14:18:25 +0000 (10:18 -0400)
Create loading-dialog component and service
Showing the loading-dialog while making API call
Add notification and error handling for xapp configuration

Change-Id: I6366c07d63055057fdc45036b56a2fcbfff04487
Signed-off-by: Jun (Nicolas) Hu <jh245g@att.com>
15 files changed:
docs/release-notes.rst
webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts
webapp-frontend/src/app/app-configuration/app-configuration.component.ts
webapp-frontend/src/app/app-control/app-control.component.ts
webapp-frontend/src/app/catalog/catalog.component.ts
webapp-frontend/src/app/ran-control/ran-connection-dialog.component.ts
webapp-frontend/src/app/ran-control/ran-control.component.ts
webapp-frontend/src/app/rd.module.ts
webapp-frontend/src/app/services/app-mgr/app-mgr.service.ts
webapp-frontend/src/app/services/ui/loading-dialog.service.spec.ts [new file with mode: 0644]
webapp-frontend/src/app/services/ui/loading-dialog.service.ts [new file with mode: 0644]
webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.html [new file with mode: 0644]
webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.scss [new file with mode: 0644]
webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.spec.ts [new file with mode: 0644]
webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.ts [new file with mode: 0644]

index 1e6deb4..4d94370 100644 (file)
@@ -47,6 +47,9 @@ Version 1.2.0, 23 Aug 2019
 * Use snake_case (not camelCase) names in AC policy front end
 * Update A1 mediator client to spec version 0.10.3
 * Extend AC control screen to read policy from A1
+* Create loading-dialog component and service
+* Showing the loading-dialog while making API call
+* Add notification and error handling for xapp configuration
 
 Version 1.0.5, 5 July 2019
 --------------------------
index 652c955..9e25391 100644 (file)
  * ========================LICENSE_END===================================
  */
 
-import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
 import { HttpResponse } from '@angular/common/http';
+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 { debounceTime, distinctUntilChanged, finalize, tap } from 'rxjs/operators';
 import { ANRNeighborCellRelation } from '../interfaces/anr-xapp.types';
 import { ANRXappService } from '../services/anr-xapp/anr-xapp.service';
 import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { LoadingDialogService } from '../services/ui/loading-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';
@@ -54,6 +55,7 @@ export class AnrXappComponent implements AfterViewInit, OnInit {
     private dialog: MatDialog,
     private confirmDialogService: ConfirmDialogService,
     private errorDialogService: ErrorDialogService,
+    private loadingDialogService: LoadingDialogService,
     private notificationService: NotificationService) { }
 
   ngOnInit() {
@@ -107,7 +109,11 @@ export class AnrXappComponent implements AfterViewInit, OnInit {
       .openConfirmDialog('Are you sure you want to delete this relation?')
       .afterClosed().subscribe(res => {
         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) {
index 8b429c6..28e9bf7 100644 (file)
  * ========================LICENSE_END===================================
  */
 
-import { Component, OnInit, Inject } from '@angular/core';
+import { Component, Inject, OnInit } from '@angular/core';
 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
-import { AppMgrService } from '../services/app-mgr/app-mgr.service';
-import { ErrorDialogService } from '../services/ui/error-dialog.service';
 import { BehaviorSubject } from 'rxjs/BehaviorSubject';
 import { finalize } from 'rxjs/operators';
-
+import { AppMgrService } from '../services/app-mgr/app-mgr.service';
+import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { LoadingDialogService } from '../services/ui/loading-dialog.service';
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
+import { NotificationService } from './../services/ui/notification.service';
 
 @Component({
   selector: 'rd-app-configuration',
@@ -40,12 +42,14 @@ export class AppConfigurationComponent implements OnInit {
     private dialogRef: MatDialogRef<AppConfigurationComponent>,
     private appMgrService: AppMgrService,
     private errorDiaglogService: ErrorDialogService,
+    private loadingDialogService: LoadingDialogService,
+    private notificationService: NotificationService,
     @Inject(MAT_DIALOG_DATA) private data
   ) { }
 
   xappMetadata: any;
   xappConfigSchema: any;
-  xappConfigData: any; 
+  xappConfigData: any;
   xappLayout:any;
   ngOnInit() {
     this.loadingSubject.next(true);
@@ -67,8 +71,26 @@ export class AppConfigurationComponent implements OnInit {
       config: event,
       layout: this.xappLayout
     }
+    this.loadingDialogService.startLoading("Updating " + this.data.name + " configuration");
     this.appMgrService.putConfig(config)
-    this.dialogRef.close();
+      .pipe(
+        finalize(() => {
+          this.loadingDialogService.stopLoading();
+          this.dialogRef.close();
+        })
+    )
+      .subscribe(
+        (response: HttpResponse<Object>) => {
+          this.notificationService.success('Configuration update succeeded!');
+        },
+        ((her: HttpErrorResponse) => {
+          let msg = her.message;
+          if (her.error && her.error.message) {
+            msg = her.error.message;
+          }
+          this.notificationService.warn('Configuration update failed: ' + msg);
+        })
+      );
   }
 
   loadConfigForm(name: string, allConfig: any) {
index 057b976..18af73b 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
 import { Component, OnInit, ViewChild } from '@angular/core';
-import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
 import { MatSort } from '@angular/material/sort';
 import { Router } from '@angular/router';
 import { XappControlRow } from '../interfaces/app-mgr.types';
 import { AppMgrService } from '../services/app-mgr/app-mgr.service';
 import { ConfirmDialogService } from '../services/ui/confirm-dialog.service';
 import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { LoadingDialogService } from '../services/ui/loading-dialog.service';
 import { NotificationService } from '../services/ui/notification.service';
 import { AppControlAnimations } from './app-control.animations';
 import { AppControlDataSource } from './app-control.datasource';
+import { finalize } from 'rxjs/operators';
 
 @Component({
   selector: 'rd-app-control',
@@ -46,6 +48,7 @@ export class AppControlComponent implements OnInit {
     private router: Router,
     private confirmDialogService: ConfirmDialogService,
     private errorDialogService: ErrorDialogService,
+    private loadingDialogService: LoadingDialogService,
     private notificationService: NotificationService) { }
 
   ngOnInit() {
@@ -73,7 +76,12 @@ export class AppControlComponent implements OnInit {
     this.confirmDialogService.openConfirmDialog('Are you sure you want to undeploy App ' + app.xapp + '?')
       .afterClosed().subscribe( (res: boolean) => {
         if (res) {
-          this.appMgrSvc.undeployXapp(app.xapp).subscribe(
+          this.loadingDialogService.startLoading("Undeploying " + app.xapp);
+          this.appMgrSvc.undeployXapp(app.xapp)
+            .pipe(
+              finalize(() => this.loadingDialogService.stopLoading())
+            )
+            .subscribe(
             ( httpResponse: HttpResponse<Object>) => {
               // Answers 204/No content on success
               this.notificationService.success('App undeployed successfully!');
index 9100de4..7f8cb68 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
-import { Component, OnInit, ViewChild } from '@angular/core';
 import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
 import { MatSort } from '@angular/material/sort';
-import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { finalize } from 'rxjs/operators';
+import { XMDeployableApp } from '../interfaces/app-mgr.types';
 import { AppMgrService } from '../services/app-mgr/app-mgr.service';
+import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { LoadingDialogService } from '../services/ui/loading-dialog.service';
+import { AppConfigurationComponent } from './../app-configuration/app-configuration.component';
 import { ConfirmDialogService } from './../services/ui/confirm-dialog.service';
 import { NotificationService } from './../services/ui/notification.service';
 import { CatalogDataSource } from './catalog.datasource';
-import { XMDeployableApp } from '../interfaces/app-mgr.types';
-import { MatDialog } from '@angular/material/dialog';
-import { AppConfigurationComponent } from './../app-configuration/app-configuration.component';
 
 @Component({
   selector: 'rd-app-catalog',
@@ -45,6 +47,7 @@ export class CatalogComponent implements OnInit {
     private confirmDialogService: ConfirmDialogService,
     private dialog: MatDialog,
     private errorDiaglogService: ErrorDialogService,
+    private loadingDialogService: LoadingDialogService,
     private notificationService: NotificationService) { }
 
   ngOnInit() {
@@ -68,7 +71,12 @@ export class CatalogComponent implements OnInit {
     this.confirmDialogService.openConfirmDialog('Deploy application ' + app.name + '?')
       .afterClosed().subscribe( (res: boolean) => {
         if (res) {
-          this.appMgrService.deployXapp(app.name).subscribe(
+          this.loadingDialogService.startLoading("Deploying " + app.name);
+          this.appMgrService.deployXapp(app.name)
+            .pipe(
+              finalize(() => this.loadingDialogService.stopLoading())
+            )
+            .subscribe(
             (response: HttpResponse<Object>) => {
               this.notificationService.success('App deploy succeeded!');
             },
index 7c63f13..4065f44 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
-import { Component, OnInit, Inject } from '@angular/core';
-import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
-import { FormGroup, FormControl, Validators } from '@angular/forms';
-import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
+import { Component, OnInit } from '@angular/core';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
+import { MatDialogRef } from '@angular/material/dialog';
 import { Observable } from 'rxjs';
+import { finalize } from 'rxjs/operators';
+import { E2SetupRequest, RanDialogFormData } from '../interfaces/e2-mgr.types';
 import { E2ManagerService } from '../services/e2-mgr/e2-mgr.service';
-import { NotificationService } from '../services/ui/notification.service';
 import { ErrorDialogService } from '../services/ui/error-dialog.service';
-import { E2SetupRequest, RanDialogFormData } from '../interfaces/e2-mgr.types';
+import { LoadingDialogService } from '../services/ui/loading-dialog.service';
+import { NotificationService } from '../services/ui/notification.service';
 
 @Component({
-    selector: 'rd-ran-control-connect-dialog',
-    templateUrl: './ran-connection-dialog.component.html',
-    styleUrls: ['./ran-connection-dialog.component.scss']
+  selector: 'rd-ran-control-connect-dialog',
+  templateUrl: './ran-connection-dialog.component.html',
+  styleUrls: ['./ran-connection-dialog.component.scss']
 })
 
 export class RanControlConnectDialogComponent implements OnInit {
 
-    public ranDialogForm: FormGroup;
-    public processing = false;
+  public ranDialogForm: FormGroup;
+  public processing = false;
 
-    constructor(
-        private dialogRef: MatDialogRef<RanControlConnectDialogComponent>,
-        private service: E2ManagerService,
-        private errorService: ErrorDialogService,
-        private notifService: NotificationService) {
-        // opens with empty fields; accepts no data to display
-    }
+  constructor(
+    private dialogRef: MatDialogRef<RanControlConnectDialogComponent>,
+    private service: E2ManagerService,
+    private errorService: ErrorDialogService,
+    private loadingDialogService: LoadingDialogService,
+    private notifService: NotificationService) {
+    // opens with empty fields; accepts no data to display
+  }
 
-    ngOnInit() {
-        const namePattern = /^([A-Z]){4}([0-9]){6}$/;
-        // tslint:disable-next-line:max-line-length
-        const ipPattern = /((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/;
-        const portPattern = /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/;
-        this.ranDialogForm = new FormGroup({
-            ranType: new FormControl('endc'),
-            ranName: new FormControl('', [Validators.required, Validators.pattern(namePattern)]),
-            ranIp: new FormControl('', [Validators.required, Validators.pattern(ipPattern)]),
-            ranPort: new FormControl('', [Validators.required, Validators.pattern(portPattern)])
-        });
-    }
+  ngOnInit() {
+    const namePattern = /^([A-Z]){4}([0-9]){6}$/;
+    // tslint:disable-next-line:max-line-length
+    const ipPattern = /((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/;
+    const portPattern = /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/;
+    this.ranDialogForm = new FormGroup({
+      ranType: new FormControl('endc'),
+      ranName: new FormControl('', [Validators.required, Validators.pattern(namePattern)]),
+      ranIp: new FormControl('', [Validators.required, Validators.pattern(ipPattern)]),
+      ranPort: new FormControl('', [Validators.required, Validators.pattern(portPattern)])
+    });
+  }
 
-    onCancel() {
-        this.dialogRef.close(false);
-    }
+  onCancel() {
+    this.dialogRef.close(false);
+  }
 
-    setupConnection = (ranFormValue: RanDialogFormData) => {
-        if (!this.ranDialogForm.valid) {
-            // should never happen
-            return;
-        }
-        this.processing = true;
-        const setupRequest: E2SetupRequest = {
-            ranName: ranFormValue.ranName,
-            ranIp: ranFormValue.ranIp,
-            ranPort: ranFormValue.ranPort
-        };
-        let observable: Observable<HttpResponse<Object>>;
-        if (ranFormValue.ranType === 'endc') {
-            observable = this.service.endcSetup(setupRequest);
-        } else {
-            observable = this.service.x2Setup(setupRequest);
-        }
-        observable.subscribe(
-            (response: any) => {
-                this.processing = false;
-                this.notifService.success('Connect succeeded!');
-                this.dialogRef.close(true);
-            },
-            ( (her: HttpErrorResponse) => {
-                this.processing = false;
-                // the error field carries the server's response
-                let msg = her.message;
-                if (her.error && her.error.message) {
-                  msg = her.error.message;
-                }
-                this.errorService.displayError('Connect failed: ' + msg);
-                // keep the dialog open
-            })
-        );
+  setupConnection = (ranFormValue: RanDialogFormData) => {
+    if (!this.ranDialogForm.valid) {
+      // should never happen
+      return;
+    }
+    this.processing = true;
+    const setupRequest: E2SetupRequest = {
+      ranName: ranFormValue.ranName,
+      ranIp: ranFormValue.ranIp,
+      ranPort: ranFormValue.ranPort
+    };
+    this.loadingDialogService.startLoading("Setting up connection ");
+    let observable: Observable<HttpResponse<Object>>;
+    if (ranFormValue.ranType === 'endc') {
+      observable = this.service.endcSetup(setupRequest);
+    } else {
+      observable = this.service.x2Setup(setupRequest);
     }
+    observable
+      .pipe(
+        finalize(() => this.loadingDialogService.stopLoading())
+      )
+      .subscribe(
+        (response: any) => {
+          this.processing = false;
+          this.notifService.success('Connect succeeded!');
+          this.dialogRef.close(true);
+        },
+        ((her: HttpErrorResponse) => {
+          this.processing = false;
+          // the error field carries the server's response
+          let msg = her.message;
+          if (her.error && her.error.message) {
+            msg = her.error.message;
+          }
+          this.errorService.displayError('Connect failed: ' + msg);
+          // keep the dialog open
+        })
+      );
+  }
 
-    hasError(controlName: string, errorName: string) {
-        if (this.ranDialogForm.controls[controlName].hasError(errorName)) {
-          return true;
-        }
-        return false;
+  hasError(controlName: string, errorName: string) {
+    if (this.ranDialogForm.controls[controlName].hasError(errorName)) {
+      return true;
     }
+    return false;
+  }
 
-    validateControl(controlName: string) {
-        if (this.ranDialogForm.controls[controlName].invalid && this.ranDialogForm.controls[controlName].touched) {
-            return true;
-        }
-        return false;
+  validateControl(controlName: string) {
+    if (this.ranDialogForm.controls[controlName].invalid && this.ranDialogForm.controls[controlName].touched) {
+      return true;
     }
+    return false;
+  }
 
 }
index af7709d..172a84e 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
+import { HttpErrorResponse } from '@angular/common/http';
 import { Component, OnInit } from '@angular/core';
-import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
 import { MatDialog } from '@angular/material/dialog';
-import { RanControlConnectDialogComponent } from './ran-connection-dialog.component';
+import { finalize } from 'rxjs/operators';
 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 { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { LoadingDialogService } from '../services/ui/loading-dialog.service';
 import { NotificationService } from '../services/ui/notification.service';
+import { RanControlConnectDialogComponent } from './ran-connection-dialog.component';
 import { RANControlDataSource } from './ran-control.datasource';
 
 @Component({
@@ -40,6 +42,7 @@ export class RanControlComponent implements OnInit {
     private errorDialogService: ErrorDialogService,
     private confirmDialogService: ConfirmDialogService,
     private notificationService: NotificationService,
+    private loadingDialogService: LoadingDialogService,
     public dialog: MatDialog) { }
 
   ngOnInit() {
@@ -63,7 +66,12 @@ export class RanControlComponent implements OnInit {
     this.confirmDialogService.openConfirmDialog('Are you sure you want to disconnect all RAN connections?')
       .afterClosed().subscribe( (res: boolean) => {
         if (res) {
-          this.e2MgrSvc.nodebPut().subscribe(
+          this.loadingDialogService.startLoading("Disconnecting");
+          this.e2MgrSvc.nodebPut()
+            .pipe(
+              finalize(() => this.loadingDialogService.stopLoading())
+            )
+            .subscribe(
             ( body: any ) => {
               this.notificationService.success('Disconnect succeeded!');
               this.dataSource.loadTable();
index 8b59594..acb9536 100644 (file)
@@ -55,6 +55,7 @@ import { ErrorDialogComponent } from './ui/error-dialog/error-dialog.component';
 import { ErrorDialogService } from './services/ui/error-dialog.service';
 import { FlexLayoutModule } from '@angular/flex-layout';
 import { FooterComponent } from './footer/footer.component';
+import { LoadingDialogComponent } from './ui/loading-dialog/loading-dialog.component';
 import { MainComponent } from './main/main.component';
 import { MaterialDesignFrameworkModule } from 'angular6-json-schema-form';
 import { ModalEventComponent } from './ui/modal-event/modal-event.component';
@@ -85,6 +86,7 @@ import { UserComponent } from './user/user.component';
     EditDashboardUserDialogComponent,
     ErrorDialogComponent,
     FooterComponent,
+    LoadingDialogComponent,
     MainComponent,
     ModalEventComponent,
     RanControlComponent,
@@ -157,6 +159,7 @@ import { UserComponent } from './user/user.component';
     ConfirmDialogComponent,
     EditDashboardUserDialogComponent,
     ErrorDialogComponent,
+    LoadingDialogComponent,
     RanControlConnectDialogComponent
   ],
   providers: [
index 33dd1cb..f9df38c 100644 (file)
@@ -29,32 +29,32 @@ export class AppMgrService {
     // injects to variable httpClient
   }
 
-  private basePath = 'api/appmgr/xapps';
+  private basePath = 'api/appmgr';
 
   getDeployable(): Observable<XMDeployableApp[]> {
-    return this.httpClient.get<XMDeployableApp[]>(this.basePath + '/list');
+    return this.httpClient.get<XMDeployableApp[]>(this.basePath + '/xapps/list');
   }
 
   getDeployed(): Observable<XMDeployedApp[]> {
-    return this.httpClient.get<XMDeployedApp[]>(this.basePath);
+    return this.httpClient.get<XMDeployedApp[]>(this.basePath + '/xapps');
   }
 
   deployXapp(name: string): Observable<HttpResponse<Object>> {
     const xappInfo: XMXappInfo = { name: name };
-    return this.httpClient.post(this.basePath, xappInfo, { observe: 'response' });
+    return this.httpClient.post((this.basePath + '/xapps'), xappInfo, { observe: 'response' });
   }
 
   undeployXapp(name: string): Observable<HttpResponse<Object>> {
-    return this.httpClient.delete((this.basePath + '/' + name), { observe: 'response' });
+    return this.httpClient.delete((this.basePath + '/xapps'+ '/' + name), { observe: 'response' });
   }
 
   getConfig(): Observable<any[]>{
     return this.httpClient.get<any[]>("/assets/mockdata/config.json");
-    //return this.httpClient.get<any[]>((this.basePath + '/config'));
+    //return this.httpClient.get<any[]>((this.basePath  + '/config'));
   }
 
   putConfig(config: any): Observable<HttpResponse<Object>> {
-    return this.httpClient.post((this.basePath + '/config' ), config, { observe: 'response' });
+    return this.httpClient.put((this.basePath + '/config' ), config, { observe: 'response' });
   }
 
 
diff --git a/webapp-frontend/src/app/services/ui/loading-dialog.service.spec.ts b/webapp-frontend/src/app/services/ui/loading-dialog.service.spec.ts
new file mode 100644 (file)
index 0000000..2aec88d
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+import { TestBed } from '@angular/core/testing';
+
+import { LoadingDialogService } from './loading-dialog.service';
+
+describe('LoadingDialogService', () => {
+  beforeEach(() => TestBed.configureTestingModule({}));
+
+  it('should be created', () => {
+    const service: LoadingDialogService = TestBed.get(LoadingDialogService);
+    expect(service).toBeTruthy();
+  });
+});
diff --git a/webapp-frontend/src/app/services/ui/loading-dialog.service.ts b/webapp-frontend/src/app/services/ui/loading-dialog.service.ts
new file mode 100644 (file)
index 0000000..a172d28
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+import { Injectable } from '@angular/core';
+import { MatDialog, MatDialogRef } from '@angular/material/dialog';
+import { LoadingDialogComponent } from './../../ui/loading-dialog/loading-dialog.component';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class LoadingDialogService {
+
+  constructor(private dialog: MatDialog) { }
+
+  private loadingDialogRef: MatDialogRef<LoadingDialogComponent>;
+
+  startLoading(msg: string) {
+    this.loadingDialogRef = this.dialog.open(LoadingDialogComponent, {
+      disableClose: true,
+      width: '480px',
+      position: { top: '100px' },
+      data: {
+        message: msg
+      }
+    });
+  }
+
+  stopLoading() {
+    this.loadingDialogRef.close()
+  }
+
+}
+
+
diff --git a/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.html b/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.html
new file mode 100644 (file)
index 0000000..3066d0e
--- /dev/null
@@ -0,0 +1,27 @@
+<!--
+  ========================LICENSE_START=================================
+  O-RAN-SC
+  %%
+  Copyright (C) 2019 AT&T Intellectual Property and Nokia
+  %%
+  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.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  ========================LICENSE_END===================================
+  -->
+
+
+  <div mat-dialog-content>
+    {{data.message}}
+  </div>
+  <mat-spinner diameter=70></mat-spinner>
+
+
diff --git a/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.scss b/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.scss
new file mode 100644 (file)
index 0000000..8683a53
--- /dev/null
@@ -0,0 +1,23 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+mat-spinner {
+  margin: 10px
+}
diff --git a/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.spec.ts b/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.spec.ts
new file mode 100644 (file)
index 0000000..4462b3b
--- /dev/null
@@ -0,0 +1,45 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { LoadingDialogComponent } from './loading-dialog.component';
+
+describe('LoadingDialogComponent', () => {
+  let component: LoadingDialogComponent;
+  let fixture: ComponentFixture<LoadingDialogComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ LoadingDialogComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(LoadingDialogComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.ts b/webapp-frontend/src/app/ui/loading-dialog/loading-dialog.component.ts
new file mode 100644 (file)
index 0000000..9658efe
--- /dev/null
@@ -0,0 +1,36 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================LICENSE_END===================================
+ */
+
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA } from '@angular/material';
+
+@Component({
+  selector: 'rd-loading-dialog',
+  templateUrl: './loading-dialog.component.html',
+  styleUrls: ['./loading-dialog.component.scss']
+})
+export class LoadingDialogComponent implements OnInit {
+
+  constructor(@Inject(MAT_DIALOG_DATA) public data) { }
+
+  ngOnInit() {
+  }
+
+}