2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
21 import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
22 import { MatSort } from '@angular/material/sort';
23 import { Subscription } from 'rxjs';
24 import { RicInstance } from '../interfaces/dashboard.types';
25 import { CaasIngressService } from '../services/caas-ingress/caas-ingress.service';
26 import { InstanceSelectorService } from '../services/instance-selector/instance-selector.service';
27 import { ConfirmDialogService } from '../services/ui/confirm-dialog.service';
28 import { ErrorDialogService } from '../services/ui/error-dialog.service';
29 import { LoadingDialogService } from '../services/ui/loading-dialog.service';
30 import { NotificationService } from '../services/ui/notification.service';
31 import { CaasIngressDataSource } from './caas-ingress.datasource';
34 selector: 'rd-caas-ingress',
35 templateUrl: './caas-ingress.component.html',
36 styleUrls: ['./caas-ingress.component.scss']
38 export class CaasIngressComponent implements OnInit, OnDestroy {
40 // Cluster name is displayed in page title
41 @Input() cluster: string;
42 // Namespace is used to query backend
43 @Input() namespace: string;
45 dataSource: CaasIngressDataSource;
46 displayedColumns: string[] = ['namespace', 'name', 'status', 'ip', 'containers', 'restartCount', 'creationTime'];
47 @ViewChild(MatSort, { static: true }) sort: MatSort;
48 private instanceChange: Subscription;
51 private caasIngressSvc: CaasIngressService,
52 private confirmDialogService: ConfirmDialogService,
53 private errorDialogService: ErrorDialogService,
54 private loadingDialogService: LoadingDialogService,
55 public instanceSelectorService: InstanceSelectorService,
56 private notificationService: NotificationService) { }
59 this.dataSource = new CaasIngressDataSource(this.caasIngressSvc, this.sort, this.notificationService);
60 this.instanceChange = this.instanceSelectorService.getSelectedInstance().subscribe((instance: RicInstance) => {
62 this.dataSource.loadTable(instance.key, this.cluster, this.namespace);
68 this.instanceChange.unsubscribe();