improve dashboard UI
[portal/ric-dashboard.git] / webapp-frontend / src / app / caas-ingress / caas-ingress.component.ts
index 3f6e0e7..13ff7af 100644 (file)
  * ========================LICENSE_END===================================
  */
 
-import { Component, Input, OnInit, ViewChild } from '@angular/core';
+import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
 import { MatSort } from '@angular/material/sort';
 import { Subscription } from 'rxjs';
+import { RicInstance } from '../interfaces/dashboard.types';
 import { CaasIngressService } from '../services/caas-ingress/caas-ingress.service';
 import { InstanceSelectorService } from '../services/instance-selector/instance-selector.service';
 import { ConfirmDialogService } from '../services/ui/confirm-dialog.service';
@@ -34,7 +35,7 @@ import { CaasIngressDataSource } from './caas-ingress.datasource';
   templateUrl: './caas-ingress.component.html',
   styleUrls: ['./caas-ingress.component.scss']
 })
-export class CaasIngressComponent implements OnInit {
+export class CaasIngressComponent implements OnInit, OnDestroy {
 
   // Cluster name is displayed in page title
   @Input() cluster: string;
@@ -56,11 +57,11 @@ export class CaasIngressComponent implements OnInit {
 
   ngOnInit() {
     this.dataSource = new CaasIngressDataSource(this.caasIngressSvc, this.sort, this.notificationService);
-    this.instanceChange = this.instanceSelectorService.getSelectedInstancekey().subscribe((instanceKey: string) => {
-      if (instanceKey) {
-        this.dataSource.loadTable(instanceKey, this.cluster, this.namespace);
+    this.instanceChange = this.instanceSelectorService.getSelectedInstance().subscribe((instance: RicInstance) => {
+      if (instance.key) {
+        this.dataSource.loadTable(instance.key, this.cluster, this.namespace);
       }
-    })
+    });
   }
 
   ngOnDestroy() {