blob: 1692690317267516a39e0a7e0518924dd87f0dd9 [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,
Sean Condon5ca00262018-09-06 17:55:25 +010019 LogService,
20 WebSocketService,
21 SortDir, TableBaseImpl, TableResponse
Sean Condon3dd062f2020-04-14 09:25:00 +010022} from 'org_onosproject_onos/web/gui2-fw-lib/public_api';
Bhavesh72ead492018-07-19 16:29:18 +053023
24interface HostTableResponse extends TableResponse {
25 hosts: Host[];
26}
27
28interface Host {
29 name: boolean;
30 id: string;
31 hw: string;
32 vlanId: string;
33 configured: string;
34 address: string;
35 location: string;
36 _iconid_type: string;
37}
38
39/**
40 * ONOS GUI -- Host View Component
41 */
42@Component({
43 selector: 'onos-host',
44 templateUrl: './host.component.html',
45 styleUrls: ['./host.component.css',
Sean Condon98b6ddb2019-12-24 08:07:40 +000046 '../../../../../../../../gui2-fw-lib/lib/widget/table.css', '../../../../../../../../gui2-fw-lib/lib/widget/table.theme.css']
Bhavesh72ead492018-07-19 16:29:18 +053047})
48export class HostComponent extends TableBaseImpl implements OnInit, OnDestroy {
49
50 constructor(
51 protected fs: FnService,
Bhavesh72ead492018-07-19 16:29:18 +053052 protected log: LogService,
53 protected wss: WebSocketService,
54 ) {
Sean Condon95fb5742019-04-02 12:16:55 +010055 super(fs, log, wss, 'host');
Bhavesh72ead492018-07-19 16:29:18 +053056 this.responseCallback = this.hostResponseCb;
57 this.sortParams = {
58 firstCol: 'name',
59 firstDir: SortDir.desc,
60 secondCol: 'id',
61 secondDir: SortDir.asc,
62 };
63 }
64
65 ngOnInit() {
66 this.init();
67 this.log.debug('HostComponent initialized');
68 }
69
70 ngOnDestroy() {
71 this.destroy();
72 this.log.debug('HostComponent destroyed');
73 }
74
75 hostResponseCb(data: HostTableResponse) {
76 this.log.debug('Host response received for ', data.hosts.length, 'host');
77 }
78
79}