This adds a method to list the deployable (available) apps.
Extended backend to proxy to the new App Manager method.
Revised the frontend catalog interface, service and screen
to call the new backend method.
Renamed from "xapp-manager" to "app-manager" to be consistent
with that project's naming conventions.
Change-Id: I6216ea09d8e316f00f2df5a73f3a64f89aaf8a54
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
<version>1.0.4-SNAPSHOT</version>
</parent>
<!-- This groupId will NOT allow deployment in LF -->
- <groupId>org.o-ran-sc.ric.a1med.client</groupId>
+ <groupId>org.o-ran-sc.ric.plt.a1med.client</groupId>
<artifactId>a1-med-client</artifactId>
<name>RIC A1 Mediator client</name>
<version>0.4.0-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
</parent>
<!-- This groupId will NOT allow deployment in LF -->
- <groupId>org.o-ran-sc.ric.anrxapp.client</groupId>
+ <groupId>org.o-ran-sc.ric.xapp.anr.client</groupId>
<artifactId>anr-xapp-client</artifactId>
<name>RIC ANR xApp client</name>
<version>0.0.8-SNAPSHOT</version>
-# XApp Manager Client Generator
+# App Manager Client Generator
This projects generates a REST client library from the Swagger specification
-file stored here and packages it in a jar.
+file stored in src/main/resources and packages it in a jar.
## Eclipse and STS Users
<version>1.0.4-SNAPSHOT</version>
</parent>
<!-- This groupId will NOT allow deployment in LF -->
- <groupId>org.o-ran-sc.ric.xappmgr.client</groupId>
- <artifactId>xapp-mgr-client</artifactId>
- <name>RIC xApp Manager client</name>
- <version>0.1.4-SNAPSHOT</version>
+ <groupId>org.o-ran-sc.ric.plt.appmgr.client</groupId>
+ <artifactId>app-mgr-client</artifactId>
+ <name>RIC App Manager client</name>
+ <version>0.1.5-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Jenkins invokes maven with -Dbuild.number=.. -->
<build.number>0</build.number>
<!-- same as groupId BUT without hyphens -->
- <client.base.package.name>org.oransc.ric.xappmgr.client</client.base.package.name>
+ <client.base.package.name>org.oransc.ric.plt.appmgr.client</client.base.package.name>
</properties>
<!-- Successful compilation requires generated code dependencies -->
<dependencies>
<goal>generate</goal>
</goals>
<configuration>
- <inputSpec>${project.basedir}/src/main/resources/xapp_manager_rest_api_v0_1_4.yaml</inputSpec>
+ <inputSpec>${project.basedir}/src/main/resources/xapp_manager_rest_api_v0_1_5.yaml</inputSpec>
<language>java</language>
<configOptions>
<groupId>${project.groupId}</groupId>
# ========================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
swagger: '2.0'
info:
description: This is a draft API for RIC appmgr
- version: 0.1.4
+ version: 0.1.5
title: RIC appmgr
license:
name: Apache 2.0
'200':
description: successful query of xApps
schema:
- $ref: '#/definitions/AllXapps'
+ $ref: '#/definitions/AllDeployedXapps'
+ '500':
+ description: Internal error
+ '/xapps/list':
+ get:
+ summary: Returns the list of all deployable xapps
+ tags:
+ - xapp
+ operationId: listAllXapps
+ produces:
+ - application/json
+ responses:
+ '200':
+ description: successful list of deployable xApps
+ schema:
+ $ref: '#/definitions/AllDeployableXapps'
'500':
description: Internal error
'/xapps/{xAppName}':
'400':
description: Invalid subscription supplied
definitions:
- AllXapps:
+ AllDeployableXapps:
+ type: array
+ items:
+ type: string
+ example: "xapp-dummy"
+ AllDeployedXapps:
type: array
items:
$ref: '#/definitions/Xapp'
- deleted
- updated
xApps:
- $ref: '#/definitions/AllXapps'
+ $ref: '#/definitions/AllDeployedXapps'
* limitations under the License.
* ========================LICENSE_END===================================
*/
-package org.oransc.ric.portal.dashboard.xappmgr.client.test;
+package org.oransc.ric.portal.dashboard.appmgr.client.test;
import org.junit.jupiter.api.Test;
-import org.oransc.ric.xappmgr.client.api.HealthApi;
-import org.oransc.ric.xappmgr.client.api.XappApi;
-import org.oransc.ric.xappmgr.client.invoker.ApiClient;
-import org.oransc.ric.xappmgr.client.model.AllXapps;
-import org.oransc.ric.xappmgr.client.model.Xapp;
+import org.oransc.ric.plt.appmgr.client.api.HealthApi;
+import org.oransc.ric.plt.appmgr.client.api.XappApi;
+import org.oransc.ric.plt.appmgr.client.invoker.ApiClient;
+import org.oransc.ric.plt.appmgr.client.model.AllDeployedXapps;
+import org.oransc.ric.plt.appmgr.client.model.Xapp;
import org.springframework.web.client.RestClientException;
/**
*
* The test fails because no server is available.
*/
-public class XappManagerClientTest {
+public class AppManagerClientTest {
@Test
public void demo() {
}
try {
XappApi xappApi = new XappApi(apiClient);
- AllXapps allXapps = xappApi.getAllXapps();
+ AllDeployedXapps allXapps = xappApi.getAllXapps();
System.out.println("getAllXapps answered: " + apiClient.getStatusCode().toString());
System.out.println("xApp count: " + allXapps.size());
for (Xapp x : allXapps)
* Extend Xapp Controller with config endpoints
* Add build number to dashboard version string
* Move mock admin screen user data to backend
+* Update App manager client to spec version 0.1.5
Version 1.0.3, 28 May 2019
--------------------------
<version>1.0.4-SNAPSHOT</version>
</parent>
<!-- This groupId will NOT allow deployment in LF -->
- <groupId>org.o-ran-sc.ric.e2mgr.client</groupId>
+ <groupId>org.o-ran-sc.ric.plt.e2mgr.client</groupId>
<artifactId>e2-mgr-client</artifactId>
<name>RIC E2 Manager client</name>
<version>20190620-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
+ <!-- this group Id must match LF gerrit repository -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<modules>
<module>a1-med-client</module>
<module>anr-xapp-client</module>
+ <module>app-mgr-client</module>
<module>e2-mgr-client</module>
- <module>xapp-mgr-client</module>
<module>webapp-frontend</module>
<module>webapp-backend</module>
</modules>
<build.number>0</build.number>
</properties>
<dependencies>
+ <!-- xApps -->
<dependency>
- <groupId>org.o-ran-sc.ric.a1med.client</groupId>
+ <groupId>org.o-ran-sc.ric.xapp.anr.client</groupId>
+ <artifactId>anr-xapp-client</artifactId>
+ <version>0.0.8-SNAPSHOT</version>
+ </dependency>
+ <!-- Platform components -->
+ <dependency>
+ <groupId>org.o-ran-sc.ric.plt.a1med.client</groupId>
<artifactId>a1-med-client</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.o-ran-sc.ric.anrxapp.client</groupId>
- <artifactId>anr-xapp-client</artifactId>
- <version>0.0.8-SNAPSHOT</version>
+ <groupId>org.o-ran-sc.ric.plt.appmgr.client</groupId>
+ <artifactId>app-mgr-client</artifactId>
+ <version>0.1.5-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.o-ran-sc.ric.e2mgr.client</groupId>
+ <groupId>org.o-ran-sc.ric.plt.e2mgr.client</groupId>
<artifactId>e2-mgr-client</artifactId>
<version>20190620-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.o-ran-sc.ric.xappmgr.client</groupId>
- <artifactId>xapp-mgr-client</artifactId>
- <version>0.1.4-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
import java.net.MalformedURLException;
import java.net.URL;
-import org.oransc.ric.xappmgr.client.api.HealthApi;
-import org.oransc.ric.xappmgr.client.api.XappApi;
-import org.oransc.ric.xappmgr.client.invoker.ApiClient;
+import org.oransc.ric.plt.appmgr.client.api.HealthApi;
+import org.oransc.ric.plt.appmgr.client.api.XappApi;
+import org.oransc.ric.plt.appmgr.client.invoker.ApiClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
*/
@Configuration
@Profile("!mock")
-public class XappManagerConfiguration {
+public class AppManagerConfiguration {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final String xappMgrUrl;
@Autowired
- public XappManagerConfiguration(@Value("${xappmgr.url}") final String url) throws MalformedURLException {
+ public AppManagerConfiguration(@Value("${xappmgr.url}") final String url) throws MalformedURLException {
logger.info("Configuring xApp Manager at base URL {}", url);
new URL(url);
this.xappMgrUrl = url;
import java.lang.invoke.MethodHandles;
-import org.oransc.ric.xappmgr.client.api.HealthApi;
-import org.oransc.ric.xappmgr.client.api.XappApi;
-import org.oransc.ric.xappmgr.client.invoker.ApiClient;
-import org.oransc.ric.xappmgr.client.model.AllXappConfig;
-import org.oransc.ric.xappmgr.client.model.AllXapps;
-import org.oransc.ric.xappmgr.client.model.ConfigMetadata;
-import org.oransc.ric.xappmgr.client.model.SubscriptionRequest;
-import org.oransc.ric.xappmgr.client.model.SubscriptionResponse;
-import org.oransc.ric.xappmgr.client.model.XAppConfig;
-import org.oransc.ric.xappmgr.client.model.XAppInfo;
-import org.oransc.ric.xappmgr.client.model.Xapp;
-import org.oransc.ric.xappmgr.client.model.Xapp.StatusEnum;
-import org.oransc.ric.xappmgr.client.model.XappInstance;
+import org.oransc.ric.plt.appmgr.client.api.HealthApi;
+import org.oransc.ric.plt.appmgr.client.api.XappApi;
+import org.oransc.ric.plt.appmgr.client.invoker.ApiClient;
+import org.oransc.ric.plt.appmgr.client.model.AllDeployableXapps;
+import org.oransc.ric.plt.appmgr.client.model.AllDeployedXapps;
+import org.oransc.ric.plt.appmgr.client.model.AllXappConfig;
+import org.oransc.ric.plt.appmgr.client.model.ConfigMetadata;
+import org.oransc.ric.plt.appmgr.client.model.SubscriptionRequest;
+import org.oransc.ric.plt.appmgr.client.model.SubscriptionResponse;
+import org.oransc.ric.plt.appmgr.client.model.XAppConfig;
+import org.oransc.ric.plt.appmgr.client.model.XAppInfo;
+import org.oransc.ric.plt.appmgr.client.model.Xapp;
+import org.oransc.ric.plt.appmgr.client.model.Xapp.StatusEnum;
+import org.oransc.ric.plt.appmgr.client.model.XappInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
*/
@Profile("mock")
@Configuration
-public class XappManagerMockConfiguration {
+public class AppManagerMockConfiguration {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private final AllXapps allXapps;
+ private final AllDeployableXapps availXapps;
+ private final AllDeployedXapps deployedXapps;
private final AllXappConfig allXappConfigs;
- public XappManagerMockConfiguration() {
+ public AppManagerMockConfiguration() {
logger.info("Configuring mock xApp Manager");
final String[] appNames = { "AdmissionControl", "Automatic Neighbor Relation", "Dual Connectivity" };
final String configJson = " { \"config\" : \"example\" }";
final String descriptorJson = " { \"descriptor\" : \"example\" }";
allXappConfigs = new AllXappConfig();
- allXapps = new AllXapps();
+ availXapps = new AllDeployableXapps();
+ deployedXapps = new AllDeployedXapps();
for (String n : appNames) {
ConfigMetadata metadata = new ConfigMetadata().configName("config-" + n).name(n).namespace("namespace");
XAppConfig config = new XAppConfig().config(configJson).descriptor(descriptorJson).metadata(metadata);
allXappConfigs.add(config);
+ availXapps.add(n);
Xapp xapp = new Xapp().name(n).version("version").status(StatusEnum.UNKNOWN);
xapp.addInstancesItem(new XappInstance().name("abcd-1234").ip("1.2.3.4").port(200)
.status(XappInstance.StatusEnum.RUNNING));
- allXapps.add(xapp);
+ deployedXapps.add(xapp);
}
}
when(mockApi.deployXapp(any(XAppInfo.class))).thenReturn(new Xapp());
- when(mockApi.getAllXapps()).thenReturn(allXapps);
+ when(mockApi.listAllXapps()).thenReturn(availXapps);
+
+ when(mockApi.getAllXapps()).thenReturn(deployedXapps);
Xapp xappByName = new Xapp().name("name").status(StatusEnum.UNKNOWN).version("v1");
when(mockApi.getXappByName(any(String.class))).thenReturn(xappByName);
import javax.servlet.http.HttpServletResponse;
+import org.oransc.ric.plt.appmgr.client.api.HealthApi;
+import org.oransc.ric.plt.appmgr.client.api.XappApi;
+import org.oransc.ric.plt.appmgr.client.model.AllDeployableXapps;
+import org.oransc.ric.plt.appmgr.client.model.AllDeployedXapps;
+import org.oransc.ric.plt.appmgr.client.model.AllXappConfig;
+import org.oransc.ric.plt.appmgr.client.model.ConfigMetadata;
+import org.oransc.ric.plt.appmgr.client.model.XAppConfig;
+import org.oransc.ric.plt.appmgr.client.model.XAppInfo;
+import org.oransc.ric.plt.appmgr.client.model.Xapp;
import org.oransc.ric.portal.dashboard.DashboardApplication;
import org.oransc.ric.portal.dashboard.DashboardConstants;
+import org.oransc.ric.portal.dashboard.model.AppTransport;
+import org.oransc.ric.portal.dashboard.model.DashboardDeployableXapps;
import org.oransc.ric.portal.dashboard.model.SuccessTransport;
-import org.oransc.ric.xappmgr.client.api.HealthApi;
-import org.oransc.ric.xappmgr.client.api.XappApi;
-import org.oransc.ric.xappmgr.client.model.AllXappConfig;
-import org.oransc.ric.xappmgr.client.model.AllXapps;
-import org.oransc.ric.xappmgr.client.model.ConfigMetadata;
-import org.oransc.ric.xappmgr.client.model.XAppConfig;
-import org.oransc.ric.xappmgr.client.model.XAppInfo;
-import org.oransc.ric.xappmgr.client.model.Xapp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
/**
- * Proxies calls from the front end to the xApp Manager API. All methods answer
+ * Proxies calls from the front end to the App Manager API. All methods answer
* 502 on failure: <blockquote>HTTP server received an invalid response from a
* server it consulted when acting as a proxy or gateway.</blockquote>
*/
@Configuration
@RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xappmgr", produces = MediaType.APPLICATION_JSON_VALUE)
-public class XappManagerController {
+@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/appmgr", produces = MediaType.APPLICATION_JSON_VALUE)
+public class AppManagerController {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final XappApi xappApi;
@Autowired
- public XappManagerController(final HealthApi healthApi, final XappApi xappApi) {
+ public AppManagerController(final HealthApi healthApi, final XappApi xappApi) {
Assert.notNull(healthApi, "health API must not be null");
Assert.notNull(xappApi, "xapp API must not be null");
this.healthApi = healthApi;
}
}
- @ApiOperation(value = "Returns the status of all xapps.", response = AllXapps.class)
+ @ApiOperation(value = "Returns a list of deployable xapps.", response = DashboardDeployableXapps.class)
+ @RequestMapping(value = "/xapps/list", method = RequestMethod.GET)
+ public Object getAvailableXapps() {
+ logger.debug("getAvailableXapps");
+ try {
+ AllDeployableXapps appNames = xappApi.listAllXapps();
+ // Answer a collection of structure instead of string
+ DashboardDeployableXapps apps = new DashboardDeployableXapps();
+ for (String n : appNames)
+ apps.add(new AppTransport(n));
+ return apps;
+ } catch (HttpStatusCodeException ex) {
+ logger.error("getAvailableXapps failed: {}", ex.toString());
+ return ResponseEntity.status(HttpServletResponse.SC_BAD_GATEWAY).body(ex.getResponseBodyAsString());
+ }
+ }
+
+ @ApiOperation(value = "Returns the status of all deployed xapps.", response = AllDeployedXapps.class)
@RequestMapping(value = "/xapps", method = RequestMethod.GET)
- public Object getAllXapps() {
- logger.debug("getAllXapps");
+ public Object getDeployedXapps() {
+ logger.debug("getDeployedXapps");
try {
return xappApi.getAllXapps();
} catch (HttpStatusCodeException ex) {
- logger.error("getAllXapps failed: {}", ex.toString());
+ logger.error("getDeployedXapps failed: {}", ex.toString());
return ResponseEntity.status(HttpServletResponse.SC_BAD_GATEWAY).body(ex.getResponseBodyAsString());
}
}
--- /dev/null
+/*-
+ * ========================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===================================
+ */
+
+package org.oransc.ric.portal.dashboard.model;
+
+/**
+ * Trivial model to transport available application from the App manager. I
+ * expect that system will soon add additional attributes. This allows coding to
+ * a structure rather than a scalar.
+ */
+public class AppTransport implements IDashboardResponse {
+
+ private String name;
+ private String version;
+
+ /**
+ * Builds an empty object.
+ */
+ public AppTransport() {
+ // no-arg constructor
+ }
+
+ /**
+ * Builds an object with the specified value.
+ *
+ * @param s
+ * value to transport.
+ */
+ public AppTransport(String s) {
+ this.name = s;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String s) {
+ this.name = s;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+}
--- /dev/null
+/*-
+ * ========================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===================================
+ */
+package org.oransc.ric.portal.dashboard.model;
+
+import java.util.ArrayList;
+
+/**
+ * Replaces AllDeployableXapps, which only wraps String.
+ */
+public class DashboardDeployableXapps extends ArrayList<AppTransport> {
+
+ private static final long serialVersionUID = -928428052502491021L;
+
+}
import { LoginComponent } from './login/login.component';
import { CatalogComponent } from './catalog/catalog.component';
import { UiService } from './services/ui/ui.service';
-import { XappMgrService } from './services/xapp-mgr/xapp-mgr.service';
+import { AppMgrService } from './services/app-mgr/app-mgr.service';
import { DashboardService } from './services/dashboard/dashboard.service';
import { E2ManagerService } from './services/e2-mgr/e2-mgr.service';
import { SidenavListComponent } from './navigation/sidenav-list/sidenav-list.component';
],
providers: [
UiService,
- XappMgrService,
+ AppMgrService,
DashboardService,
E2ManagerService,
ErrorDialogService
.catalog-button-row button{
margin-right: 5px;
}
-
<table mat-table [dataSource]="dataSource" matSort class="catalog-table mat-elevation-z8">
<ng-container matColumnDef="name">
- <mat-header-cell *matHeaderCellDef mat-sort-header> xApp Name </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> App Name </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.name}} </mat-cell>
</ng-container>
<ng-container matColumnDef="version">
- <mat-header-cell *matHeaderCellDef mat-sort-header> xApp version </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> Version </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.version}} </mat-cell>
</ng-container>
- <ng-container matColumnDef="status">
- <mat-header-cell *matHeaderCellDef mat-sort-header> 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">
* 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.
* 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 { Component, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { ErrorDialogService } from '../services/ui/error-dialog.service';
-import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
+import { AppMgrService } from '../services/app-mgr/app-mgr.service';
import { ConfirmDialogService } from './../services/ui/confirm-dialog.service';
import { NotificationService } from './../services/ui/notification.service';
import { CatalogDataSource } from './catalog.datasource';
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.css'],
})
-export class CatalogComponent implements OnInit{
+export class CatalogComponent implements OnInit {
- displayedColumns: string[] = ['name', 'version', 'status', 'action'];
+ displayedColumns: string[] = ['name', 'version', 'action'];
dataSource: CatalogDataSource;
@ViewChild(MatSort) sort: MatSort;
constructor(
- private xappMgrSvc: XappMgrService,
+ private appMgrSvc: AppMgrService,
private confirmDialogService: ConfirmDialogService,
private errorService: ErrorDialogService,
private notification: NotificationService) { }
ngOnInit() {
- this.dataSource = new CatalogDataSource(this.xappMgrSvc, this.sort );
+ this.dataSource = new CatalogDataSource(this.appMgrSvc, this.sort );
this.dataSource.loadTable();
}
onConfigurexApp(name: string): void {
- const aboutError = 'Not implemented yet';
+ const aboutError = 'Configure not implemented (yet)';
this.errorService.displayError(aboutError);
}
onDeployxApp(name: string): void {
- this.confirmDialogService.openConfirmDialog('Are you sure you want to deploy this xApp?')
+ this.confirmDialogService.openConfirmDialog('Deploy application ' + name + '?')
.afterClosed().subscribe(res => {
if (res) {
- this.xappMgrSvc.deployXapp(name).subscribe(
+ this.appMgrSvc.deployXapp(name).subscribe(
response => {
switch (response.status) {
case 200:
- this.notification.success('xApp deploy succeeded!');
+ this.notification.success('Deploy succeeded!');
break;
default:
- this.notification.warn('xApp deploy failed.');
+ this.notification.warn('Deploy failed.');
}
}
);
});
}
-}
\ No newline at end of file
+}
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { catchError, finalize, map } from 'rxjs/operators';
-import { XMXapp } from '../interfaces/xapp-mgr.types';
-import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
+import { AppMgrService } from '../services/app-mgr/app-mgr.service';
+import { XMDeployableApp } from '../interfaces/app-mgr.types';
-export class CatalogDataSource extends DataSource<XMXapp> {
+export class CatalogDataSource extends DataSource<XMDeployableApp> {
- private xAppsSubject = new BehaviorSubject<XMXapp[]>([]);
+ private xAppsSubject = new BehaviorSubject<XMDeployableApp[]>([]);
private loadingSubject = new BehaviorSubject<boolean>(false);
public loading$ = this.loadingSubject.asObservable();
- constructor(private xappMgrSvc: XappMgrService, private sort: MatSort ) {
+ constructor(private appMgrSvc: AppMgrService, private sort: MatSort) {
super();
- };
+ }
loadTable() {
this.loadingSubject.next(true);
- this.xappMgrSvc.getAll()
+ this.appMgrSvc.getDeployable()
.pipe(
catchError(() => of([])),
finalize(() => this.loadingSubject.next(false))
)
- .subscribe(xApps => this.xAppsSubject.next(xApps) )
+ .subscribe(xApps => this.xAppsSubject.next(xApps));
}
- connect(collectionViewer: CollectionViewer): Observable<XMXapp[]> {
+ connect(collectionViewer: CollectionViewer): Observable<XMDeployableApp[]> {
const dataMutations = [
this.xAppsSubject.asObservable(),
this.sort.sortChange
this.loadingSubject.complete();
}
- private getSortedData(data: XMXapp[]) {
+ private getSortedData(data: XMDeployableApp[]) {
if (!this.sort.active || this.sort.direction === '') {
return data;
}
-
- return data.sort((a, b) => {
+ return data.sort((a: XMDeployableApp, b: XMDeployableApp) => {
const isAsc = this.sort.direction === 'asc';
switch (this.sort.active) {
- case 'name': return compare(a.name, b.name, isAsc);
- case 'version': return compare(a.version, b.version, isAsc);
- case 'status': return compare(a.status, b.status, isAsc);
+ case 'name': return this.compare(a.name, b.name, isAsc);
+ case 'version': return this.compare(a.version, b.version, isAsc);
default: return 0;
}
});
}
-}
-function compare(a, b, isAsc) {
- return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
+ private compare(a: string, b: string, isAsc: boolean) {
+ return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
+ }
+
}
<table mat-table [dataSource]="dataSource" matSort multiTemplateDataRows class="control-table mat-elevation-z8">
<ng-container matColumnDef="xapp">
- <mat-header-cell *matHeaderCellDef mat-sort-header> xApp Name </mat-header-cell>
+ <mat-header-cell *matHeaderCellDef mat-sort-header> App Name </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.xapp}} </mat-cell>
</ng-container>
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { Router } from '@angular/router';
-import { XappControlRow } from '../interfaces/xapp-mgr.types';
-import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
+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 { NotificationService } from './../services/ui/notification.service';
@ViewChild(MatSort) sort: MatSort;
constructor(
- private xappMgrSvc: XappMgrService,
+ private appMgrSvc: AppMgrService,
private router: Router,
private confirmDialogService: ConfirmDialogService,
private errorDialogService: ErrorDialogService,
private notification: NotificationService) { }
ngOnInit() {
- this.dataSource = new ControlDataSource(this.xappMgrSvc, this.sort);
+ this.dataSource = new ControlDataSource(this.appMgrSvc, this.sort);
this.dataSource.loadTable();
}
this.confirmDialogService.openConfirmDialog('Are you sure you want to undeploy xApp ' + app.xapp + '?')
.afterClosed().subscribe(res => {
if (res) {
- this.xappMgrSvc.undeployXapp(app.xapp).subscribe(
+ this.appMgrSvc.undeployXapp(app.xapp).subscribe(
response => {
this.dataSource.loadTable();
switch (response.status) {
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { catchError, finalize, map } from 'rxjs/operators';
-import { XappControlRow, XMXapp, XMXappInstance } from '../interfaces/xapp-mgr.types';
-import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
+import { XappControlRow, XMDeployedApp, XMXappInstance } from '../interfaces/app-mgr.types';
+import { AppMgrService } from '../services/app-mgr/app-mgr.service';
export class ControlDataSource extends DataSource<XappControlRow> {
txMessages: [],
};
- constructor(private xappMgrSvc: XappMgrService, private sort: MatSort) {
+ constructor(private appMgrSvc: AppMgrService, private sort: MatSort) {
super();
- };
+ }
loadTable() {
this.loadingSubject.next(true);
- this.xappMgrSvc.getAll()
+ this.appMgrSvc.getDeployed()
.pipe(
catchError(() => of([])),
finalize(() => this.loadingSubject.next(false))
)
- .subscribe(xApps => this.xAppInstancesSubject.next(this.getInstance(xApps)))
+ .subscribe(xApps => this.xAppInstancesSubject.next(this.flatten(xApps)));
}
connect(collectionViewer: CollectionViewer): Observable<XappControlRow[]> {
this.loadingSubject.complete();
}
- getInstance(allxappdata: XMXapp[]) {
+ private flatten(allxappdata: XMDeployedApp[]) {
const xAppInstances: XappControlRow[] = [];
- for (const xappindex in allxappdata) {
- const instancelist = allxappdata[xappindex].instances;
- if (!instancelist) {
- var instance: XappControlRow = {
- xapp: allxappdata[xappindex].name,
+ for (const xapp of allxappdata) {
+ if (!xapp.instances) {
+ const row: XappControlRow = {
+ xapp: xapp.name,
instance: this.emptyInstances
- }
- xAppInstances.push(instance);
- }
- else {
- for (const instanceindex in instancelist) {
- var instance: XappControlRow = {
- xapp: allxappdata[xappindex].name,
- instance: instancelist[instanceindex]
- }
- xAppInstances.push(instance);
+ };
+ xAppInstances.push(row);
+ } else {
+ for (const ins of xapp.instances) {
+ const row: XappControlRow = {
+ xapp: xapp.name,
+ instance: ins
+ };
+ xAppInstances.push(row);
}
}
}
function compare(a, b, isAsc) {
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
-}
\ No newline at end of file
+}
* ========================LICENSE_END===================================
*/
-// Models of data used by the xApp Manager
+// Models of data used by the App Manager
export interface XMSubscription {
eventType: string;
txMessages: Array<string>;
}
-export interface XMXapp {
+export interface XMDeployableApp {
+ name: string;
+ version: string;
+}
+
+export interface XMDeployedApp {
name: string;
status: string;
version: string;
*/
import { TestBed } from '@angular/core/testing';
-import { XappMgrService } from './xapp-mgr.service';
+import { AppMgrService } from './app-mgr.service';
-describe('XappMgrService', () => {
+describe('AppMgrService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
- const service: XappMgrService = TestBed.get(XappMgrService);
+ const service: AppMgrService = TestBed.get(AppMgrService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
-import { XMXappInfo, XMXapp} from '../../interfaces/xapp-mgr.types';
-
+import { XMXappInfo, XMDeployableApp, XMDeployedApp } from '../../interfaces/app-mgr.types';
@Injectable()
-export class XappMgrService {
+export class AppMgrService {
constructor(private httpClient: HttpClient) {
// injects to variable httpClient
}
- private basePath = 'api/xappmgr/xapps';
+ private basePath = 'api/appmgr/xapps';
+
+ getDeployable(): Observable<XMDeployableApp[]> {
+ return this.httpClient.get<XMDeployableApp[]>(this.basePath + '/list');
+ }
- getAll(): Observable<XMXapp[]>{
- return this.httpClient.get<XMXapp[]>(this.basePath)
+ getDeployed(): Observable<XMDeployedApp[]> {
+ return this.httpClient.get<XMDeployedApp[]>(this.basePath);
}
deployXapp(name: string) {