From fa9065384adda531aa66bcf39ffc5ac6513ff4dd Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Mon, 18 May 2020 15:41:56 -0400 Subject: [PATCH] Update webapp front-end data models for XApp Mgr Synchronize the TypeScript interfaces to Xapp Manager API ver 0.3.3 Issue-ID: OAM-103 Change-Id: I849bc86b4671f72efddb94aff5420353c8514aa3 Signed-off-by: Lott, Christopher (cl778h) --- dashboard/app-mgr-client/pom.xml | 2 +- dashboard/e2-mgr-client/pom.xml | 2 +- dashboard/pom.xml | 2 +- dashboard/webapp-backend/pom.xml | 2 +- dashboard/webapp-frontend/pom.xml | 2 +- .../src/app/app-control/app-control.datasource.ts | 7 ++- .../src/app/catalog/catalog.component.ts | 6 +- .../src/app/catalog/catalog.datasource.ts | 14 ++--- .../src/app/interfaces/app-mgr.types.ts | 68 +++++++++++++++------- .../src/app/interfaces/e2-mgr.types.ts | 2 +- .../src/app/services/app-mgr/app-mgr.service.ts | 23 ++++---- docs/release-notes.rst | 4 ++ 12 files changed, 82 insertions(+), 52 deletions(-) diff --git a/dashboard/app-mgr-client/pom.xml b/dashboard/app-mgr-client/pom.xml index 3c1ae83a..90b1109d 100644 --- a/dashboard/app-mgr-client/pom.xml +++ b/dashboard/app-mgr-client/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 2.0.1-SNAPSHOT + 2.0.2-SNAPSHOT org.o-ran-sc.ric-plt.appmgr.client diff --git a/dashboard/e2-mgr-client/pom.xml b/dashboard/e2-mgr-client/pom.xml index 564ff700..eeac2ef3 100644 --- a/dashboard/e2-mgr-client/pom.xml +++ b/dashboard/e2-mgr-client/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 2.0.1-SNAPSHOT + 2.0.2-SNAPSHOT org.o-ran-sc.ric-plt.e2mgr.client diff --git a/dashboard/pom.xml b/dashboard/pom.xml index 75b587b0..0a67d4d3 100644 --- a/dashboard/pom.xml +++ b/dashboard/pom.xml @@ -32,7 +32,7 @@ limitations under the License. ric-dash-parent RIC Dashboard Project pom - 2.0.1-SNAPSHOT + 2.0.2-SNAPSHOT 11 diff --git a/dashboard/webapp-backend/pom.xml b/dashboard/webapp-backend/pom.xml index 247ba83a..96c58172 100644 --- a/dashboard/webapp-backend/pom.xml +++ b/dashboard/webapp-backend/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 2.0.1-SNAPSHOT + 2.0.2-SNAPSHOT ric-dash-be diff --git a/dashboard/webapp-frontend/pom.xml b/dashboard/webapp-frontend/pom.xml index d7261094..2ba2a1c4 100644 --- a/dashboard/webapp-frontend/pom.xml +++ b/dashboard/webapp-frontend/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 2.0.1-SNAPSHOT + 2.0.2-SNAPSHOT ric-dash-fe diff --git a/dashboard/webapp-frontend/src/app/app-control/app-control.datasource.ts b/dashboard/webapp-frontend/src/app/app-control/app-control.datasource.ts index 76c42168..3f94cf6a 100644 --- a/dashboard/webapp-frontend/src/app/app-control/app-control.datasource.ts +++ b/dashboard/webapp-frontend/src/app/app-control/app-control.datasource.ts @@ -26,7 +26,7 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { merge } from 'rxjs'; import { of } from 'rxjs/observable/of'; import { catchError, finalize, map } from 'rxjs/operators'; -import { XappControlRow, XMDeployedApp, XMXappInstance } from '../interfaces/app-mgr.types'; +import { XappControlRow, XMXapp, XMXappInstance } from '../interfaces/app-mgr.types'; import { AppMgrService } from '../services/app-mgr/app-mgr.service'; import { NotificationService } from '../services/ui/notification.service'; @@ -48,6 +48,7 @@ export class AppControlDataSource extends DataSource { status: null, rxMessages: [], txMessages: [], + policies: [], }; constructor(private appMgrSvc: AppMgrService, @@ -67,7 +68,7 @@ export class AppControlDataSource extends DataSource { }), finalize(() => this.loadingSubject.next(false)) ) - .subscribe((xApps: XMDeployedApp[]) => { + .subscribe((xApps: XMXapp[]) => { this.rowCount = xApps.length; const flattenedApps = this.flatten(xApps); this.appControlSubject.next(flattenedApps); @@ -89,7 +90,7 @@ export class AppControlDataSource extends DataSource { this.loadingSubject.complete(); } - private flatten(allxappdata: XMDeployedApp[]): XappControlRow[] { + private flatten(allxappdata: XMXapp[]): XappControlRow[] { const xAppInstances: XappControlRow[] = []; for (const xapp of allxappdata) { if (!xapp.instances) { diff --git a/dashboard/webapp-frontend/src/app/catalog/catalog.component.ts b/dashboard/webapp-frontend/src/app/catalog/catalog.component.ts index ad90b361..4ae7b89c 100644 --- a/dashboard/webapp-frontend/src/app/catalog/catalog.component.ts +++ b/dashboard/webapp-frontend/src/app/catalog/catalog.component.ts @@ -24,7 +24,7 @@ import { MatSort } from '@angular/material/sort'; import { Subscription } from 'rxjs'; import { finalize } from 'rxjs/operators'; import { RicInstance } from '../interfaces/dashboard.types'; -import { XMDeployableApp } from '../interfaces/app-mgr.types'; +import { XMXapp } from '../interfaces/app-mgr.types'; import { AppMgrService } from '../services/app-mgr/app-mgr.service'; import { InstanceSelectorService } from '../services/instance-selector/instance-selector.service'; import { LoadingDialogService } from '../services/ui/loading-dialog.service'; @@ -77,7 +77,7 @@ export class CatalogComponent implements OnInit, OnDestroy { this.instanceChange.unsubscribe(); } - onConfigureApp(xapp: XMDeployableApp): void { + onConfigureApp(xapp: XMXapp): void { if (this.darkMode) { this.panelClass = 'dark-theme'; } else { @@ -98,7 +98,7 @@ export class CatalogComponent implements OnInit, OnDestroy { }); } - onDeployApp(app: XMDeployableApp): void { + onDeployApp(app: XMXapp): void { this.confirmDialogService.openConfirmDialog('Deploy application ' + app.name + '?') .afterClosed().subscribe((res: boolean) => { if (res) { diff --git a/dashboard/webapp-frontend/src/app/catalog/catalog.datasource.ts b/dashboard/webapp-frontend/src/app/catalog/catalog.datasource.ts index 68362a7c..bbdf4396 100644 --- a/dashboard/webapp-frontend/src/app/catalog/catalog.datasource.ts +++ b/dashboard/webapp-frontend/src/app/catalog/catalog.datasource.ts @@ -27,12 +27,12 @@ import { merge } from 'rxjs'; import { of } from 'rxjs/observable/of'; import { catchError, finalize, map } from 'rxjs/operators'; import { AppMgrService } from '../services/app-mgr/app-mgr.service'; -import { XMDeployableApp } from '../interfaces/app-mgr.types'; +import { XMXapp } from '../interfaces/app-mgr.types'; import { NotificationService } from '../services/ui/notification.service'; -export class CatalogDataSource extends DataSource { +export class CatalogDataSource extends DataSource { - private catalogSubject = new BehaviorSubject([]); + private catalogSubject = new BehaviorSubject([]); private loadingSubject = new BehaviorSubject(false); public loading$ = this.loadingSubject.asObservable(); public rowCount = 1; // hide footer during intial load @@ -55,13 +55,13 @@ export class CatalogDataSource extends DataSource { }), finalize(() => this.loadingSubject.next(false)) ) - .subscribe((xApps: XMDeployableApp[]) => { + .subscribe((xApps: XMXapp[]) => { this.rowCount = xApps.length; this.catalogSubject.next(xApps); }); } - connect(collectionViewer: CollectionViewer): Observable { + connect(collectionViewer: CollectionViewer): Observable { const dataMutations = [ this.catalogSubject.asObservable(), this.sort.sortChange @@ -76,11 +76,11 @@ export class CatalogDataSource extends DataSource { this.loadingSubject.complete(); } - private getSortedData(data: XMDeployableApp[]) { + private getSortedData(data: XMXapp[]) { if (!this.sort.active || this.sort.direction === '') { return data; } - return data.sort((a: XMDeployableApp, b: XMDeployableApp) => { + return data.sort((a: XMXapp, b: XMXapp) => { const isAsc = this.sort.direction === 'asc'; switch (this.sort.active) { case 'name': return this.compare(a.name, b.name, isAsc); diff --git a/dashboard/webapp-frontend/src/app/interfaces/app-mgr.types.ts b/dashboard/webapp-frontend/src/app/interfaces/app-mgr.types.ts index 064967cb..d3022abb 100644 --- a/dashboard/webapp-frontend/src/app/interfaces/app-mgr.types.ts +++ b/dashboard/webapp-frontend/src/app/interfaces/app-mgr.types.ts @@ -18,26 +18,39 @@ * ========================LICENSE_END=================================== */ -// Models of data used by the App Manager +// Models of data used by the App Manager. +// TS interface names are Java class names plus XM prefix. -export interface XMSubscription { - eventType: string; - id: string; - maxRetries: number; - retryTimer: number; - targetUrl: string; +export interface XMConfigMetadata { + xappName: string; + namespace: string; } -/** - * Name is the only required field - */ -export interface XMXappInfo { +export interface XMXappConfig { + metadata: XMConfigMetadata; + config: Object; +} + +export interface XMAllXappConfig { + [position: number]: XMXappConfig; +} + +export interface XMConfigValidationError { + field: string; + error: string; +} + +export interface XMConfigValidationErrors { + [position: number]: XMConfigValidationError; +} + +export interface XMAppTransport { name: string; - configName?: string; - namespace?: string; - serviceName?: string; - imageRepo?: string; - hostname?: string; + version: string; +} + +export interface XMDashboardDeployableXapps { + [position: number]: XMAppTransport; } export interface XMXappInstance { @@ -47,18 +60,29 @@ export interface XMXappInstance { status: string; rxMessages: Array; txMessages: Array; + policies: Array; } -export interface XMDeployableApp { +export interface XMXapp { name: string; + status: string; // actually an enum version: string; + instances: Array; } -export interface XMDeployedApp { - name: string; - status: string; - version: string; - instances: Array; +export interface XMAllDeployedXapps { + [postion: number]: XMXapp; +} + +/** + * xappName is the only required field + */ +export interface XMXappDescriptor { + xappName: string; + helmVersion?: string; + releaseName?: string; + namespace?: string; + overrideFile?: object; } export interface XappControlRow { diff --git a/dashboard/webapp-frontend/src/app/interfaces/e2-mgr.types.ts b/dashboard/webapp-frontend/src/app/interfaces/e2-mgr.types.ts index 7633eac7..29ccad1c 100644 --- a/dashboard/webapp-frontend/src/app/interfaces/e2-mgr.types.ts +++ b/dashboard/webapp-frontend/src/app/interfaces/e2-mgr.types.ts @@ -71,7 +71,7 @@ export interface StatsDetails { } export interface AppStats { - instanceKey: string + instanceKey: string; statsDetails: StatsDetails; } diff --git a/dashboard/webapp-frontend/src/app/services/app-mgr/app-mgr.service.ts b/dashboard/webapp-frontend/src/app/services/app-mgr/app-mgr.service.ts index 7643da55..5d89ce46 100644 --- a/dashboard/webapp-frontend/src/app/services/app-mgr/app-mgr.service.ts +++ b/dashboard/webapp-frontend/src/app/services/app-mgr/app-mgr.service.ts @@ -20,7 +20,8 @@ import { HttpClient, HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { XMDeployableApp, XMDeployedApp, XMXappInfo } from '../../interfaces/app-mgr.types'; +import { XMAllDeployedXapps, XMAllXappConfig, XMDashboardDeployableXapps, + XMXappConfig, XMXappDescriptor } from '../../interfaces/app-mgr.types'; import { DashboardService } from '../dashboard/dashboard.service'; @Injectable() @@ -34,20 +35,20 @@ export class AppMgrService { private httpClient: HttpClient) { } - getDeployable(instanceKey: string): Observable { + getDeployable(instanceKey: string): Observable { const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.xappsPath, 'list'); - return this.httpClient.get(path); + return this.httpClient.get(path); } - getDeployed(instanceKey: string): Observable { + getDeployed(instanceKey: string): Observable { const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.xappsPath); - return this.httpClient.get(path); + return this.httpClient.get(path); } - deployXapp(instanceKey: string, name: string): Observable> { - const xappInfo: XMXappInfo = { name: name }; + deployXapp(instanceKey: string, xappName: string): Observable> { + const xappDescriptor: XMXappDescriptor = { xappName: xappName }; const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.xappsPath); - return this.httpClient.post(path, xappInfo, { observe: 'response' }); + return this.httpClient.post(path, xappDescriptor, { observe: 'response' }); } undeployXapp(instanceKey: string, name: string): Observable> { @@ -55,15 +56,15 @@ export class AppMgrService { return this.httpClient.delete(path, { observe: 'response' }); } - getConfig(instanceKey: string): Observable { + getConfig(instanceKey: string): Observable { // For demo purpose, pull example config from local - return this.httpClient.get('/assets/mockdata/config.json'); + return this.httpClient.get('/assets/mockdata/config.json'); // Once Xapp manager contains layout, should call backend to get xapp config // const path = this.dashboardSvc.buildPath(this.component, instanceKey, 'config'); // return this.httpClient.get(path); } - putConfig(instanceKey: string, config: any): Observable> { + putConfig(instanceKey: string, config: XMXappConfig): Observable> { const path = this.dashboardSvc.buildPath(this.component, instanceKey, 'config'); return this.httpClient.put(path, config, { observe: 'response' }); } diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 800e7950..147795a3 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -5,6 +5,10 @@ RIC Dashboard Release Notes =========================== +Version 2.0.2, 18 May 2020 +-------------------------- +* Repair App Manager data models in webapp frontend + Version 2.0.1, 30 Apr 2020 -------------------------- * Update and relocate the theme selector button -- 2.16.6