* Add simple page footer with copyright and version
* Add AC and ANR xApp services
* Rename signal service to E2 Manager service
+* Use XappMgrService to replace ControlService and CatalogService
Version 1.0.2, 13 May 2019
--------------------------
import { CatalogComponent } from './catalog/catalog.component';
import { UiService } from './services/ui/ui.service';
import { AdminService } from './services/admin/admin.service';
-import { CatalogService } from './services/catalog/catalog.service';
-import { ControlService } from './services/control/control.service';
+import { XappMgrService } from './services/xapp-mgr/xapp-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,
AdminService,
- CatalogService,
- ControlService,
+ XappMgrService,
DashboardService,
E2ManagerService
],
* limitations under the License.
* ========================LICENSE_END===================================
*/
-import { Component, Inject } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
import { LocalDataSource } from 'ng2-smart-table';
-import { CatalogService } from '../services/catalog/catalog.service';
+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';
@Component({
selector: 'app-catalog',
templateUrl: './catalog.component.html',
styleUrls: ['./catalog.component.css']
})
-export class CatalogComponent {
+export class CatalogComponent implements OnInit{
settings = {
hideSubHeader: true,
source: LocalDataSource = new LocalDataSource();
constructor(
- private service: CatalogService,
+ private xappMgrSvc: XappMgrService,
private confirmDialogService: ConfirmDialogService,
- private notification: NotificationService) {
- this.service.getAll().subscribe((val: any[]) => this.source.load(val));
+ private notification: NotificationService) { }
+
+ ngOnInit() {
+ this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(xapps));
}
onDeployxApp(event): void {
this.confirmDialogService.openConfirmDialog('Are you sure you want to deploy this xApp?')
.afterClosed().subscribe(res => {
if (res) {
- this.service.deployXapp(event.data.name).subscribe(
+ this.xappMgrSvc.deployXapp(event.data.name).subscribe(
response => {
switch (response.status) {
case 200:
*/
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { LocalDataSource } from 'ng2-smart-table';
-import { ControlService } from '../services/control/control.service';
+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';
@Component({
styleUrls: ['./control.component.css'],
encapsulation: ViewEncapsulation.Emulated,
})
-export class ControlComponent {
+export class ControlComponent implements OnInit {
settings = {
hideSubHeader: true,
source: LocalDataSource = new LocalDataSource();
constructor(
- private service: ControlService,
+ private xappMgrSvc: XappMgrService,
private router: Router,
private confirmDialogService: ConfirmDialogService,
- private notification: NotificationService) {
- this.service.getxAppInstances((instances) => { this.source.load(instances); });
+ private notification: NotificationService) { }
+
+ ngOnInit() {
+ this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(this.getInstance(xapps)));
}
onxAppControlAction(event) {
this.confirmDialogService.openConfirmDialog('Are you sure you want to undeploy this xApp ?')
.afterClosed().subscribe(res => {
if (res) {
- this.service.undeployxApp(event.data.xapp).subscribe(
+ this.xappMgrSvc.undeployXapp(event.data.xapp).subscribe(
response => {
- this.service.getxAppInstances((instances) => { this.source.load(instances); });
+ this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(this.getInstance(xapps)));
switch (response.status) {
case 200:
this.notification.success('xApp undeployed successfully!');
});
}
+ 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;
+ }
+
}
+++ /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===================================
- */
-import { TestBed } from '@angular/core/testing';
-
-import { ControlService } from './control.service';
-
-describe('ControlService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
-
- it('should be created', () => {
- const service: ControlService = TestBed.get(ControlService);
- expect(service).toBeTruthy();
- });
-});
+++ /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===================================
- */
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-
-@Injectable()
-export class ControlService {
-
- constructor(private http: HttpClient) {
- }
-
- getxAppInstances(xAppInstances) {
- return this.http.get('api/xappmgr/xapps').subscribe(
- (val: any[]) => {
- xAppInstances(this.fetchInstance(val));
- }
- );
- }
-
- undeployxApp(xapp) {
- return this.http.delete(('api/xappmgr/xapps/' + xapp), { observe: 'response' });
- }
-
- fetchInstance(allxappdata) {
- const xAppInstances = [];
- for (const xappindex in allxappdata) {
- const instancelist = allxappdata[xappindex].instances;
- for (const instanceindex in instancelist) {
- const instance = instancelist[instanceindex];
- instance.xapp = allxappdata[xappindex].name;
- xAppInstances.push(instance);
- }
- }
- return xAppInstances;
- }
-
-}
* 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.
* limitations under the License.
* ========================LICENSE_END===================================
*/
-import { TestBed } from '@angular/core/testing';
-import { CatalogService } from './catalog.service';
+import { TestBed } from '@angular/core/testing';
+import { XappMgrService } from './xapp-mgr.service';
-describe('CatalogService', () => {
+describe('XappMgrService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
- const service: CatalogService = TestBed.get(CatalogService);
+ const service: XappMgrService = TestBed.get(XappMgrService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
-import { XMXappInfo } from '../../interfaces/xapp-mgr.types';
+import { XMXappInfo, XMXapp} from '../../interfaces/xapp-mgr.types';
+
@Injectable()
-export class CatalogService {
+export class XappMgrService {
constructor(private httpClient: HttpClient) {
// injects to variable httpClient
}
- getAll() {
- return this.httpClient.get('api/xappmgr/xapps');
+ private basePath = 'api/xappmgr/xapps';
+
+ getAll(){
+ return this.httpClient.get<XMXapp[]>(this.basePath);
}
deployXapp(name: string) {
const xappInfo: XMXappInfo = { xAppName: name };
- return this.httpClient.post('api/xappmgr/xapps', xappInfo, { observe: 'response' });
+ return this.httpClient.post(this.basePath, xappInfo, { observe: 'response' });
+ }
+
+ undeployXapp(name: string) {
+ return this.httpClient.delete((this.basePath + '/' + name), { observe: 'response' });
}
-}
+}
\ No newline at end of file