* ========================LICENSE_END===================================
*/
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { finalize } from 'rxjs/operators';
import { XappControlRow } from '../interfaces/app-mgr.types';
+import { RicInstance } from '../interfaces/dashboard.types';
import { AppMgrService } from '../services/app-mgr/app-mgr.service';
import { InstanceSelectorService } from '../services/instance-selector/instance-selector.service';
import { ConfirmDialogService } from '../services/ui/confirm-dialog.service';
styleUrls: ['./app-control.component.scss'],
animations: [AppControlAnimations.messageTrigger]
})
-export class AppControlComponent implements OnInit {
+export class AppControlComponent implements OnInit, OnDestroy {
displayedColumns: string[] = ['xapp', 'name', 'status', 'ip', 'port', 'action'];
dataSource: AppControlDataSource;
ngOnInit() {
this.dataSource = new AppControlDataSource(this.appMgrSvc, this.sort, this.notificationService);
- this.instanceChange = this.instanceSelectorService.getSelectedInstancekey().subscribe((instanceKey: string) => {
- if (instanceKey) {
- this.instanceKey = instanceKey;
- this.dataSource.loadTable(instanceKey);
+ this.instanceChange = this.instanceSelectorService.getSelectedInstance().subscribe((instance: RicInstance) => {
+ if (instance.key) {
+ this.instanceKey = instance.key;
+ this.dataSource.loadTable(instance.key);
}
- })
+ });
}
ngOnDestroy() {
this.confirmDialogService.openConfirmDialog('Are you sure you want to undeploy App ' + app.xapp + '?')
.afterClosed().subscribe((res: boolean) => {
if (res) {
- this.loadingDialogService.startLoading("Undeploying " + app.xapp);
+ this.loadingDialogService.startLoading('Undeploying ' + app.xapp);
this.appMgrSvc.undeployXapp(this.instanceKey, app.xapp)
.pipe(
finalize(() => this.loadingDialogService.stopLoading())