2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property and Nokia
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===================================
20 import { Component, OnInit } from '@angular/core';
21 import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
22 import { Router } from '@angular/router';
23 import { ConfirmDialogService } from './../services/ui/confirm-dialog.service'
24 import { NotificationService } from './../services/ui/notification.service'
25 import { XMXapp } from '../interfaces/xapp-mgr.types';
26 import { ControlAnimations } from './control.animations';
27 import { ControlDataSource } from './control.datasource';
31 selector: 'app-control',
32 templateUrl: './control.component.html',
33 styleUrls: ['./control.component.css'],
34 animations: [ControlAnimations.messageTrigger],
36 export class ControlComponent implements OnInit {
38 displayedColumns: string[] = ['xapp', 'name', 'status', 'ip', 'port', 'action'];
39 dataSource: ControlDataSource;
42 private xappMgrSvc: XappMgrService,
43 private router: Router,
44 private confirmDialogService: ConfirmDialogService,
45 private notification: NotificationService) { }
48 this.dataSource = new ControlDataSource(this.xappMgrSvc);
49 this.dataSource.loadTable();
54 this.router.navigate([url]);
57 undeploy(name: string): void {
58 this.confirmDialogService.openConfirmDialog('Are you sure you want to undeploy this xApp ?')
59 .afterClosed().subscribe(res => {
61 this.xappMgrSvc.undeployXapp(name).subscribe(
63 this.dataSource.loadTable();
64 switch (response.status) {
66 this.notification.success('xApp undeployed successfully!');
69 this.notification.warn('xApp undeploy failed.');