Apply mat-table to control and catalog 89/189/6
authorjh245g <jh245g@att.com>
Wed, 22 May 2019 21:26:40 +0000 (17:26 -0400)
committerjh245g <jh245g@att.com>
Fri, 24 May 2019 14:11:01 +0000 (10:11 -0400)
Change-Id: Ia19844502618c70a5627a0017eb79ec42b922e88
Signed-off-by: Jun (Nicolas) Hu <jh245g@att.com>
13 files changed:
docs/release-notes.rst
webapp-frontend/src/app/app.module.ts
webapp-frontend/src/app/catalog/catalog.component.css
webapp-frontend/src/app/catalog/catalog.component.html
webapp-frontend/src/app/catalog/catalog.component.ts
webapp-frontend/src/app/catalog/catalog.datasource.ts [new file with mode: 0644]
webapp-frontend/src/app/control/control.animations.ts [new file with mode: 0644]
webapp-frontend/src/app/control/control.component.css
webapp-frontend/src/app/control/control.component.html
webapp-frontend/src/app/control/control.component.ts
webapp-frontend/src/app/control/control.datasource.ts [new file with mode: 0644]
webapp-frontend/src/app/interfaces/xapp-mgr.types.ts
webapp-frontend/src/app/services/xapp-mgr/xapp-mgr.service.ts

index 082678c..ec39828 100644 (file)
@@ -20,7 +20,7 @@
 RIC Dashboard Release Notes
 ===========================
 
-Version 1.0.3, 21 May 2019
+Version 1.0.3, 22 May 2019
 --------------------------
 * Add AC xApp controller to backend
 * Add AC xApp interface to frontend
@@ -33,6 +33,7 @@ Version 1.0.3, 21 May 2019
 * Add AC and ANR xApp services
 * Rename signal service to E2 Manager service
 * Use XappMgrService to replace ControlService and CatalogService
+* Apply mat-table to control and catalog
 
 Version 1.0.2, 13 May 2019
 --------------------------
index f249df5..6255d2a 100644 (file)
  */
 import { BrowserModule } from '@angular/platform-browser';
 // tslint:disable-next-line:max-line-length
-import { MatIconModule, MatCardModule, MatListModule, MatSidenavModule,
-    MatButtonToggleModule, MatSliderModule, MatGridListModule, MatSlideToggleModule,
-    MatExpansionModule, MatTabsModule, MatDialogModule, MatFormFieldModule,
-    MatButtonModule, MatInputModule, MatSnackBarModule} from '@angular/material';
+import {MatButtonModule, MatButtonToggleModule, MatCardModule, MatDialogModule,
+    MatExpansionModule, MatFormFieldModule, MatGridListModule, MatIconModule,
+    MatInputModule, MatListModule, MatPaginatorModule, MatProgressSpinnerModule,
+    MatSidenavModule, MatSliderModule, MatSlideToggleModule, MatSnackBarModule,
+    MatSortModule,MatTableModule, MatTabsModule} from '@angular/material';
 import { BrowserAnimationsModule} from '@angular/platform-browser/animations';
 import { NgModule } from '@angular/core';
 import { Ng2SmartTableModule } from 'ng2-smart-table';
@@ -99,9 +100,12 @@ import { ErrorDialogService } from './services/ui/error-dialog.service';
     MatSidenavModule,
     MatSlideToggleModule,
     MatTabsModule,
+    MatSortModule,
+    MatTableModule,
     MatFormFieldModule,
     MatButtonModule,
     MatInputModule,
+    MatProgressSpinnerModule,
     Ng2SmartTableModule,
     MatSnackBarModule,
     MDBBootstrapModule.forRoot(),
index f345476..00617b6 100644 (file)
     transform: translate(149 56);
 }
 
-:host /deep/ ng2-smart-table tbody > tr > td {
-  text-align: left;
+.spinner-container {
+  height: 360px;
+  width: 390px;
+  position: fixed;
 }
 
-:host /deep/ ng2-smart-table thead th{
-  text-align: left;
+.spinner-container mat-spinner {
+  margin: 130px auto 0 auto;
 }
 
-:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom {
-  display: inline-block;
-  width: 50px;
-  text-align: center;
-  font-size: 1.1em;
+.catalog-table {
+  width: 99%;
+  min-height: 150px;
+  margin-top: 10px;
+  background-color: transparent;
 }
 
-:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom:hover {
-  color: #5dcfe3;
+.catalog-button-row button{
+  margin-right: 5px;
 }
+
index 86e925e..2379fd4 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===================================
   -->
 <div class="catalog__section">
-    <h3 class="catalog__header">xApp Catalog</h3>
-    <ng2-smart-table [settings]="settings" [source]="source" (custom)="onDeployxApp($event)">
-    </ng2-smart-table>
-    <!-- <app-modal-event></app-modal-event> -->
+  <h3 class="catalog__header">xApp Catalog</h3>
+  <div class="spinner-container" *ngIf="dataSource.loading$ | async">
+    <mat-spinner></mat-spinner>
+  </div>
+  <table mat-table [dataSource]="dataSource" class="catalog-table mat-elevation-z8">
+
+    <ng-container matColumnDef="name">
+      <mat-header-cell *matHeaderCellDef> xApp Name </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.name}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="version">
+      <mat-header-cell *matHeaderCellDef> xApp version </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.version}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="status">
+      <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.status}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="action">
+      <mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
+      <mat-cell *matCellDef="let element">
+        <div class="catalog-button-row">
+          <button mat-icon-button
+                  (click)="onConfigurexApp(element.name)">
+            <mat-icon>settings</mat-icon>
+          </button>
+          <button mat-button class="mat-raised-button mat-primary"
+                  (click)="onDeployxApp(element.name)">
+            Deploy
+          </button>
+        </div>
+      </mat-cell>
+    </ng-container>
+
+    <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
+    <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
+  </table>
 </div>
index fd28f0a..96e040e 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
-import { Component, OnInit } from '@angular/core';
-import { LocalDataSource } from 'ng2-smart-table';
+import { Component, OnInit} from '@angular/core';
 import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
 import { ConfirmDialogService } from './../services/ui/confirm-dialog.service'
 import { NotificationService } from './../services/ui/notification.service'
-import { XMXapp } from '../interfaces/xapp-mgr.types';
+import { ErrorDialogService } from '../services/ui/error-dialog.service';
+import { CatalogDataSource } from './catalog.datasource';
 
 @Component({
   selector: 'app-catalog',
   templateUrl: './catalog.component.html',
-  styleUrls: ['./catalog.component.css']
+  styleUrls: ['./catalog.component.css'],
 })
 export class CatalogComponent implements OnInit{
 
-  settings = {
-    hideSubHeader: true,
-    actions: {
-      columnTitle: 'Actions',
-      add: false,
-      edit: false,
-      delete: false,
-      custom: [
-        { name: 'deployxApp', title: 'Deploy' },
-      ],
-      position: 'right'
-
-    },
-    columns: {
-      name: {
-        title: 'xApp Name',
-        type: 'string',
-      },
-      version: {
-        title: 'xApp Version',
-        type: 'string',
-      },
-      status: {
-        title: 'Status',
-        type: 'string',
-      },
-    },
-  };
-
-  source: LocalDataSource = new LocalDataSource();
+  displayedColumns: string[] = ['name', 'version', 'status', 'action'];
+  dataSource: CatalogDataSource;
 
   constructor(
     private xappMgrSvc: XappMgrService,
     private confirmDialogService: ConfirmDialogService,
+    private errorService: ErrorDialogService,
     private notification: NotificationService) { }
 
   ngOnInit() {
-    this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(xapps));
+    this.dataSource = new CatalogDataSource(this.xappMgrSvc);
+    this.dataSource.loadTable();
+  }
+
+  onConfigurexApp(name: string): void {
+    const aboutError = 'Not implemented yet';
+    this.errorService.displayError(aboutError);
   }
 
-  onDeployxApp(event): void {
+  onDeployxApp(name: string): void {
     this.confirmDialogService.openConfirmDialog('Are you sure you want to deploy this xApp?')
       .afterClosed().subscribe(res => {
         if (res) {
-          this.xappMgrSvc.deployXapp(event.data.name).subscribe(
+          this.xappMgrSvc.deployXapp(name).subscribe(
             response => {
               switch (response.status) {
                 case 200:
diff --git a/webapp-frontend/src/app/catalog/catalog.datasource.ts b/webapp-frontend/src/app/catalog/catalog.datasource.ts
new file mode 100644 (file)
index 0000000..6ee6e92
--- /dev/null
@@ -0,0 +1,59 @@
+/*-
+ * ========================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 { CollectionViewer, DataSource } from '@angular/cdk/collections';
+import { Observable } from 'rxjs/Observable';
+import { catchError, finalize } from 'rxjs/operators';
+import { of } from 'rxjs/observable/of';
+import { BehaviorSubject } from 'rxjs/BehaviorSubject';
+import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
+import { XMXapp } from '../interfaces/xapp-mgr.types';
+
+export class CatalogDataSource extends DataSource<XMXapp> {
+
+  private xAppsSubject = new BehaviorSubject<XMXapp[]>([]);
+
+  private loadingSubject = new BehaviorSubject<boolean>(false);
+
+  public loading$ = this.loadingSubject.asObservable();
+
+  constructor(private xappMgrSvc: XappMgrService) {
+    super();
+  };
+
+  loadTable() {
+    this.loadingSubject.next(true);
+    this.xappMgrSvc.getAll()
+      .pipe(
+        catchError(() => of([])),
+        finalize(() => this.loadingSubject.next(false))
+      )
+      .subscribe(xApps => this.xAppsSubject.next(xApps) )
+  }
+
+  connect(collectionViewer: CollectionViewer): Observable<XMXapp[]> {
+    return this.xAppsSubject.asObservable();
+  }
+
+  disconnect(collectionViewer: CollectionViewer): void {
+    this.xAppsSubject.complete();
+    this.loadingSubject.complete();
+  }
+}
diff --git a/webapp-frontend/src/app/control/control.animations.ts b/webapp-frontend/src/app/control/control.animations.ts
new file mode 100644 (file)
index 0000000..aa92a57
--- /dev/null
@@ -0,0 +1,28 @@
+/*-
+ * ========================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 { animate, state, style, transition, trigger } from '@angular/animations';
+
+export const ControlAnimations = {
+  messageTrigger: trigger('messageExpand', [
+    state('collapsed', style({ height: '0px', minHeight: '0', display: 'none' })),
+    state('expanded', style({ height: '*' })),
+  ])
+}
\ No newline at end of file
index 798e94d..e589e3e 100644 (file)
     transform: translate(149 56);
 }
 
-:host /deep/ ng2-smart-table tbody > tr > td{
-  text-align: left;
+.spinner-container {
+    height: 360px;
+    width: 390px;
+    position: fixed;
 }
 
-:host /deep/ ng2-smart-table thead th{
-  text-align: left;
+.spinner-container mat-spinner {
+    margin: 130px auto 0 auto;
 }
 
-:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom {
-    display: inline-block;
-    width: 50px;
-    text-align: center;
-    font-size: 1.1em;
+.control-table {
+  width: 99%; 
+  min-height: 150px;
+  margin-top: 10px;
+  background-color: transparent;
 }
 
-:host /deep/ i.material-icons.red-close {
-    color: red !important;
-}
\ No newline at end of file
+tr.message-row {
+  height: 0;
+}
index 0ae71ac..d29191c 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===================================
   -->
 <div class="control__section">
-    <h3 class="control__header">xApp Control</h3>
-    <ng2-smart-table [settings]="settings" [source]="source" (custom)="onxAppControlAction($event)">
-    </ng2-smart-table>
-    <app-modal-event hidden></app-modal-event>
+  <h3 class="control__header">xApp Control</h3>
+  <div class="spinner-container" *ngIf="dataSource.loading$ | async">
+    <mat-spinner></mat-spinner>
+  </div>
+  <table mat-table [dataSource]="dataSource" multiTemplateDataRows class="control-table mat-elevation-z8">
+
+    <ng-container matColumnDef="xapp">
+      <mat-header-cell *matHeaderCellDef> xApp Name </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.xapp}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="name">
+      <mat-header-cell *matHeaderCellDef> Instance Name</mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.instance.name}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="status">
+      <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.instance.status}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="ip">
+      <mat-header-cell *matHeaderCellDef> IP </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.instance.ip}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="port">
+      <mat-header-cell *matHeaderCellDef> Port </mat-header-cell>
+      <mat-cell *matCellDef="let element"> {{element.instance.port}} </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="action">
+      <mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
+      <mat-cell *matCellDef="let element">
+        <button mat-icon-button
+                (click)="view()">
+          <mat-icon>settings</mat-icon>
+        </button>
+        <button mat-icon-button
+                color="warn"
+                (click)="undeploy(element.xapp)">
+          <mat-icon>delete</mat-icon>
+        </button>
+      </mat-cell>
+    </ng-container>
+
+    <ng-container matColumnDef="expandedDetail">
+      <td mat-cell *matCellDef="let element" [attr.colspan]="displayedColumns.length">
+        <div [@messageExpand]="element == expandedElement ? 'expanded' : 'collapsed'">
+          <div>
+            txMessages:
+          </div>
+          <li *ngFor="let rxmessage of element.instance.rxMessage">
+            <span>{{rxmessage}}</span>
+          </li>
+          <div>
+            rxMessages:
+          </div>
+          <li *ngFor="let txmessage of element.instance.txMessage">
+            <span>{{txmessage}}</span>
+          </li>
+        </div>
+      </td>
+    </ng-container>
+
+    <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
+    <mat-row *matRowDef="let element; columns: displayedColumns;"
+             [class.example-expanded-row]="expandedElement === element"
+             (click)="expandedElement = expandedElement === element ? null : element"></mat-row>
+    <tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="message-row"></tr>
+  </table>
 </div>
index 067077e..54ce96d 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
-import { Component, OnInit, ViewEncapsulation } from '@angular/core';
-import { LocalDataSource } from 'ng2-smart-table';
+import { Component, OnInit } from '@angular/core';
 import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
 import { Router } from '@angular/router';
 import { ConfirmDialogService } from './../services/ui/confirm-dialog.service'
 import { NotificationService } from './../services/ui/notification.service'
 import { XMXapp } from '../interfaces/xapp-mgr.types';
+import { ControlAnimations } from './control.animations';
+import { ControlDataSource } from './control.datasource';
 
 
 @Component({
   selector: 'app-control',
   templateUrl: './control.component.html',
   styleUrls: ['./control.component.css'],
-  encapsulation: ViewEncapsulation.Emulated,
+  animations: [ControlAnimations.messageTrigger],
 })
-export class ControlComponent implements OnInit  {
+export class ControlComponent implements OnInit {
 
-  settings = {
-    hideSubHeader: true,
-    actions: {
-      columnTitle: 'Actions',
-      add: false,
-      edit: false,
-      delete: false,
-      custom: [
-        { name: 'view', title: '<i class="material-icons">visibility</i>', },
-        { name: 'undeploy', title: '<i class="material-icons red-close">close</i>', },
-      ],
-      position: 'right'
-
-    },
-    columns: {
-      xapp: {
-        title: 'xApp Name',
-        type: 'string',
-      },
-      name: {
-        title: 'Instance Name',
-        type: 'string',
-      },
-      status: {
-        title: 'Status',
-        type: 'string',
-      },
-      ip: {
-        title: 'IP',
-        type: 'string',
-      },
-      port: {
-        title: 'Port',
-        type: 'integer',
-      },
-      txMessages: {
-        title: 'txMessages',
-        type: 'array',
-      },
-      rxMessages: {
-        title: 'rxMessages',
-        type: 'array',
-      },
-    },
-  };
-
-  source: LocalDataSource = new LocalDataSource();
+  displayedColumns: string[] = ['xapp', 'name', 'status', 'ip', 'port', 'action'];
+  dataSource: ControlDataSource;
 
   constructor(
     private xappMgrSvc: XappMgrService,
@@ -89,32 +45,22 @@ export class ControlComponent implements OnInit  {
     private notification: NotificationService) { }
 
   ngOnInit() {
-    this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(this.getInstance(xapps)));
+    this.dataSource = new ControlDataSource(this.xappMgrSvc);
+    this.dataSource.loadTable();
   }
 
-  onxAppControlAction(event) {
-    switch (event.action) {
-      case 'view':
-        this.view(event);
-        break;
-      case 'undeploy':
-        this.undeploy(event);
-        break;
-    }
-  }
-
-  view(event): void {
+  view(): void {
     const url = '/xapp';
-    this.router.navigate([url, event]);
+    this.router.navigate([url]);
   }
 
-  undeploy(event): void {
+  undeploy(name: string): void {
     this.confirmDialogService.openConfirmDialog('Are you sure you want to undeploy this xApp ?')
       .afterClosed().subscribe(res => {
         if (res) {
-          this.xappMgrSvc.undeployXapp(event.data.xapp).subscribe(
+          this.xappMgrSvc.undeployXapp(name).subscribe(
             response => {
-              this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(this.getInstance(xapps)));
+              this.dataSource.loadTable();
               switch (response.status) {
                 case 200:
                   this.notification.success('xApp undeployed successfully!');
@@ -128,19 +74,6 @@ export class ControlComponent implements OnInit  {
       });
   }
 
-  getInstance(allxappdata: XMXapp[]) {
-    const xAppInstances = [];
-    for (const xappindex in allxappdata) {
-      const instancelist = allxappdata[xappindex].instances;
-      for (const instanceindex in instancelist) {
-        var instance: any;
-        instance = instancelist[instanceindex];
-        instance.xapp = allxappdata[xappindex].name;
-        xAppInstances.push(instance);
-      }
-    }
-    return xAppInstances;
-  }
 
 
 }
diff --git a/webapp-frontend/src/app/control/control.datasource.ts b/webapp-frontend/src/app/control/control.datasource.ts
new file mode 100644 (file)
index 0000000..833a4f0
--- /dev/null
@@ -0,0 +1,74 @@
+/*-
+ * ========================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 { CollectionViewer, DataSource } from '@angular/cdk/collections';
+import { Observable } from 'rxjs/Observable';
+import { catchError, finalize } from 'rxjs/operators';
+import { of } from 'rxjs/observable/of';
+import { BehaviorSubject } from 'rxjs/BehaviorSubject';
+import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
+import { XMXapp, XappControlRow } from '../interfaces/xapp-mgr.types';
+
+export class ControlDataSource extends DataSource<XappControlRow> {
+
+  private xAppInstancesSubject = new BehaviorSubject<XappControlRow[]>([]);
+
+  private loadingSubject = new BehaviorSubject<boolean>(false);
+
+  public loading$ = this.loadingSubject.asObservable();
+
+  constructor(private xappMgrSvc: XappMgrService) {
+    super();
+  };
+
+  loadTable() {
+    this.loadingSubject.next(true);
+    this.xappMgrSvc.getAll()
+      .pipe(
+        catchError(() => of([])),
+        finalize(() => this.loadingSubject.next(false))
+      )
+      .subscribe(xApps => this.xAppInstancesSubject.next(this.getInstance(xApps)) )
+  }
+
+  connect(collectionViewer: CollectionViewer): Observable<XappControlRow[]> {
+    return this.xAppInstancesSubject.asObservable();
+  }
+
+  disconnect(collectionViewer: CollectionViewer): void {
+    this.xAppInstancesSubject.complete();
+    this.loadingSubject.complete();
+  }
+
+  getInstance(allxappdata: XMXapp[]) {
+    const xAppInstances: XappControlRow[]= [];
+    for (const xappindex in allxappdata) {
+      const instancelist = allxappdata[xappindex].instances;
+      for (const instanceindex in instancelist) {
+        var instance: XappControlRow = {
+          xapp: allxappdata[xappindex].name,
+          instance: instancelist[instanceindex]
+        }
+        xAppInstances.push(instance);
+      }
+    }
+    return xAppInstances;
+  }
+}
index 999ddb3..7654377 100644 (file)
@@ -47,3 +47,8 @@ export interface XMXapp {
   version: string;
   instances: Array<XMXappInstance>;
 }
+
+export interface XappControlRow {
+  xapp: string;
+  instance: XMXappInstance;
+}
\ No newline at end of file
index daef3e0..13ae13d 100644 (file)
@@ -32,8 +32,9 @@ export class XappMgrService {
 
   private basePath = 'api/xappmgr/xapps';
 
-  getAll(){
-    return this.httpClient.get<XMXapp[]>(this.basePath);
+  getAll(): Observable<XMXapp[]>{
+    return this.httpClient.get<XMXapp[]>(this.basePath)
+
   }
 
   deployXapp(name: string) {