blob: 3ea91c74cbb0b07af3f5f6986f8405ec9b46a658 [file] [log] [blame]
Bhavesh72ead492018-07-19 16:29:18 +05301/*
2* Copyright 2018-present Open Networking Foundation
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16import { Component, OnInit, OnDestroy } from '@angular/core';
Sean Condon5ca00262018-09-06 17:55:25 +010017import {
18 FnService,
19 LoadingService,
20 LogService,
21 WebSocketService,
22 SortDir, TableBaseImpl, TableResponse
23} from 'gui2-fw-lib';
Bhavesh72ead492018-07-19 16:29:18 +053024
25interface HostTableResponse extends TableResponse {
26 hosts: Host[];
27}
28
29interface Host {
30 name: boolean;
31 id: string;
32 hw: string;
33 vlanId: string;
34 configured: string;
35 address: string;
36 location: string;
37 _iconid_type: string;
38}
39
40/**
41 * ONOS GUI -- Host View Component
42 */
43@Component({
44 selector: 'onos-host',
45 templateUrl: './host.component.html',
46 styleUrls: ['./host.component.css',
47 '../../../fw/widget/table.css', '../../../fw/widget/table.theme.css']
48})
49export class HostComponent extends TableBaseImpl implements OnInit, OnDestroy {
50
51 constructor(
52 protected fs: FnService,
53 protected ls: LoadingService,
54 protected log: LogService,
55 protected wss: WebSocketService,
56 ) {
57 super(fs, ls, log, wss, 'host');
58 this.responseCallback = this.hostResponseCb;
59 this.sortParams = {
60 firstCol: 'name',
61 firstDir: SortDir.desc,
62 secondCol: 'id',
63 secondDir: SortDir.asc,
64 };
65 }
66
67 ngOnInit() {
68 this.init();
69 this.log.debug('HostComponent initialized');
70 }
71
72 ngOnDestroy() {
73 this.destroy();
74 this.log.debug('HostComponent destroyed');
75 }
76
77 hostResponseCb(data: HostTableResponse) {
78 this.log.debug('Host response received for ', data.hosts.length, 'host');
79 }
80
81}