- onxAppControlAction(event) {
- switch (event.action) {
- case 'view':
- this.view(event);
- break;
- case 'undeploy':
- this.undeploy(event);
- break;
- }
- }
-
- view(event): void {
- const url = '/xapp';
- this.router.navigate([url, event]);
- }
-
- undeploy(event): 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(
- response => {
- this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(this.getInstance(xapps)));
- switch (response.status) {
- case 200:
- this.notification.success('xApp undeployed successfully!');
- break;
- default:
- this.notification.warn('xApp undeploy failed.');
- }
- }
- );
- }
- });
- }
-
- 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;
- }
-
-