GUI2 implementation of device/flow/port/group/meter/host/link/tunnel view
Review comments incorporated.
Change-Id: I45dd6570961cc3e0f4ffddb7acbf02cd7d860de5
diff --git a/web/gui2/src/main/webapp/app/view/device/device-routing.module.ts b/web/gui2/src/main/webapp/app/view/device/device-routing.module.ts
index 3110eca..64bcb92 100644
--- a/web/gui2/src/main/webapp/app/view/device/device-routing.module.ts
+++ b/web/gui2/src/main/webapp/app/view/device/device-routing.module.ts
@@ -15,8 +15,7 @@
*/
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
-import { DeviceComponent } from './device.component';
-
+import { DeviceComponent } from './device/device.component';
const deviceRoutes: Routes = [
{
diff --git a/web/gui2/src/main/webapp/app/view/device/device.component.html b/web/gui2/src/main/webapp/app/view/device/device.component.html
deleted file mode 100644
index 0e09d69..0000000
--- a/web/gui2/src/main/webapp/app/view/device/device.component.html
+++ /dev/null
@@ -1,114 +0,0 @@
-<!--
-~ Copyright 2014-present Open Networking Foundation
-~
-~ Licensed under the Apache License, Version 2.0 (the "License");
-~ you may not use this file except in compliance with the License.
-~ You may obtain a copy of the License at
-~
-~ http://www.apache.org/licenses/LICENSE-2.0
-~
-~ Unless required by applicable law or agreed to in writing, software
-~ distributed under the License is distributed on an "AS IS" BASIS,
-~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-~ See the License for the specific language governing permissions and
-~ limitations under the License.
--->
-<div id="ov-device">
- <div class="tabular-header">
- <h2>Devices ({{ tableData.length }} total)</h2>
- <div class="ctrl-btns">
- <div class="refresh" (click)="toggleRefresh()">
- <!-- See icon.theme.css for the defintions of the classes active and refresh-->
- <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}"
- iconId="refresh" iconSize="42" toolTip="{{ autoRefreshTip }}"></onos-icon>
- </div>
- <div class="separator"></div>
-
- <div>
- <onos-icon classes="{{ selId ? 'current-view':undefined }}"
- iconId="deviceTable" iconSize="42"></onos-icon>
- </div>
-
- <div routerLink="/flow" routerLinkActive="active">
- <onos-icon classes="{{ selId ? 'active':undefined }}"
- iconId="flowTable" iconSize="42" toolTip="{{ flowTip }}"></onos-icon>
- </div>
-
- <div routerLink="/port" routerLinkActive="active">
- <onos-icon classes="{{ selId ? 'active':undefined }}"
- iconId="portTable" iconSize="42" toolTip="{{ portTip }}"></onos-icon>
- </div>
-
- <div routerLink="/group" routerLinkActive="active">
- <onos-icon classes="{{ selId ? 'active':undefined }}"
- iconId="groupTable" iconSize="42" toolTip="{{ groupTip }}"></onos-icon>
- </div>
-
- <div routerLink="/meter" routerLinkActive="active">
- <onos-icon classes="{{ selId ? 'active':undefined }}"
- iconId="meterTable" iconSize="42" toolTip="{{ meterTip }}"></onos-icon>
- </div>
-
- <div routerLink="/pipeconf" routerLinkActive="active">
- <onos-icon classes="{{ selId ? 'active':undefined }}"
- iconId="pipeconfTable" iconSize="42" toolTip="{{ pipeconfTip }}"></onos-icon>
- </div>
- </div>
- </div>
-
- <div class="summary-list" onos-table-resize>
- <table onos-flash-changes id-prop="id" width="100%">
- <tr class="table-header">
- <th colId="available" class="table-icon" sortable></th>
- <th colId="type" class="table-icon"></th>
- <th colId="name" sortable>Friendly Name </th>
- <th colId="id" sortable>Device ID </th>
- <th colId="masterid" [ngClass]="{width: '130px'}" sortable>Master </th>
- <th colId="num_ports" [ngClass]="{width: '70px'}" sortable>Ports </th>
- <th colId="mfr" sortable>Vendor </th>
- <th colId="hw" sortable>H/W Version </th>
- <th colId="sw" sortable>S/W Version </th>
- <th colId="protocol" [ngClass]="{width: '100px'}" sortable>Protocol </th>
- </tr>
-
- <tr class="table-body" *ngIf="tableData.length === 0" class="no-data">
- <td colspan="9">{{ annots.noRowsMsg }}</td>
- </tr>
-
-
- <tr class="table-body" *ngFor="let dev of tableData"
- (click)="selectCallback($event, dev)"
- [ngClass]="{selected: dev.id === selId, 'data-change': isChanged(dev.id)}">
- <td class="table-icon">
- <!--[ngClass]="{width: devAvail.getBBox().width}"-->
- <onos-icon iconId="{{dev._iconid_available}}"></onos-icon>
- </td>
- <td class="table-icon">
- <onos-icon iconId="{{dev._iconid_type}}"></onos-icon>
- </td>
- <td>{{ dev.name }}</td>
- <td>{{ dev.id }}</td>
- <td>{{ dev.masterid }}</td>
- <td>{{ dev.num_ports }}</td>
- <td>{{ dev.mfr }}</td>
- <td>{{ dev.hw }}</td>
- <td>{{ dev.sw }}</td>
- <td>{{ dev.protocol }}</td>
- </tr>
- </table>
- </div>
- <small>
- <p>TODO (21 Jun 18): Add in:</p>
- <ul>
- <li>Scrolling for long lists of devices</li>
- <li>Sorting by column</li>
- <li>Left align header columns</li>
- <li>Move tooltip to underneath icon</li>
- <li>Correct width and icon colour of active and device icon columns</li>
- <li>Add device details panel</li>
- <li>Add more unit tests</li>
- <li>Make icon for #undefined work (e.g. for device type olt or unknown)</li>
- <li>Change loading service to fade in and out and have a threshold of </li>
- </ul>
- </small>
-</div>
diff --git a/web/gui2/src/main/webapp/app/view/device/device.component.spec.ts b/web/gui2/src/main/webapp/app/view/device/device.component.spec.ts
deleted file mode 100644
index 066a636..0000000
--- a/web/gui2/src/main/webapp/app/view/device/device.component.spec.ts
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { ActivatedRoute, Params } from '@angular/router';
-import { DebugElement } from '@angular/core';
-import { By } from '@angular/platform-browser';
-import { LogService } from '../../log.service';
-import { DeviceComponent } from './device.component';
-
-import { FnService, WindowSize } from '../../fw/util/fn.service';
-import { IconService } from '../../fw/svg/icon.service';
-import { GlyphService } from '../../fw/svg/glyph.service';
-import { IconComponent } from '../../fw/svg/icon/icon.component';
-import { KeyService } from '../../fw/util/key.service';
-import { LoadingService } from '../../fw/layer/loading.service';
-import { NavService } from '../../fw/nav/nav.service';
-import { MastService } from '../../fw/mast/mast.service';
-import { SvgUtilService } from '../../fw/svg/svgutil.service';
-import { ThemeService } from '../../fw/util/theme.service';
-import { WebSocketService } from '../../fw/remote/websocket.service';
-import { of } from 'rxjs';
-
-class MockActivatedRoute extends ActivatedRoute {
- constructor(params: Params) {
- super();
- this.queryParams = of(params);
- }
-}
-
-class MockDetailsPanelService {}
-
-class MockFnService {}
-
-class MockIconService {
- loadIconDef() {}
-}
-
-class MockGlyphService {}
-
-class MockKeyService {}
-
-class MockLoadingService {
- startAnim() {}
- stop() {}
-}
-
-class MockNavService {}
-
-class MockMastService {}
-
-class MockTableBuilderService {}
-
-class MockTableDetailService {}
-
-class MockThemeService {}
-
-class MockWebSocketService {
- createWebSocket() {}
- isConnected() { return false; }
- unbindHandlers() {}
- bindHandlers() {}
-}
-
-/**
- * ONOS GUI -- Device View Module - Unit Tests
- */
-describe('DeviceComponent', () => {
- let fs: FnService;
- let ar: MockActivatedRoute;
- let windowMock: Window;
- let logServiceSpy: jasmine.SpyObj<LogService>;
- let component: DeviceComponent;
- let fixture: ComponentFixture<DeviceComponent>;
-
- beforeEach(async(() => {
- const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
- ar = new MockActivatedRoute({'debug': 'txrx'});
-
- windowMock = <any>{
- location: <any> {
- hostname: 'foo',
- host: 'foo',
- port: '80',
- protocol: 'http',
- search: { debug: 'true'},
- href: 'ws://foo:123/onos/ui/websock/path',
- absUrl: 'ws://foo:123/onos/ui/websock/path'
- }
- };
- fs = new FnService(ar, logSpy, windowMock);
-
- TestBed.configureTestingModule({
- declarations: [ DeviceComponent, IconComponent ],
- providers: [
- { provide: FnService, useValue: fs },
- { provide: IconService, useClass: MockIconService },
- { provide: GlyphService, useClass: MockGlyphService },
- { provide: KeyService, useClass: MockKeyService },
- { provide: LoadingService, useClass: MockLoadingService },
- { provide: MastService, useClass: MockMastService },
- { provide: NavService, useClass: MockNavService },
- { provide: LogService, useValue: logSpy },
- { provide: ThemeService, useClass: MockThemeService },
- { provide: WebSocketService, useClass: MockWebSocketService },
- { provide: 'Window', useValue: windowMock },
- ]
- })
- .compileComponents();
- logServiceSpy = TestBed.get(LogService);
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(DeviceComponent);
- component = fixture.debugElement.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should have .table-header with "Friendly Name..."', () => {
- const appDe: DebugElement = fixture.debugElement;
- const divDe = appDe.query(By.css('.table-header'));
- const div: HTMLElement = divDe.nativeElement;
- expect(div.textContent).toEqual('Friendly Name Device ID Master Ports Vendor H/W Version S/W Version Protocol ');
- });
-});
diff --git a/web/gui2/src/main/webapp/app/view/device/device.module.ts b/web/gui2/src/main/webapp/app/view/device/device.module.ts
index 7840292..9ad5456 100644
--- a/web/gui2/src/main/webapp/app/view/device/device.module.ts
+++ b/web/gui2/src/main/webapp/app/view/device/device.module.ts
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,22 +16,26 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DeviceRoutingModule } from './device-routing.module';
-import { DeviceComponent } from './device.component';
-import { DeviceDetailsPanelDirective } from './devicedetailspanel.directive';
+import { DeviceComponent } from './device/device.component';
import { SvgModule } from '../../fw/svg/svg.module';
+import { WidgetModule } from '../../fw/widget/widget.module';
+import { FormsModule } from '@angular/forms';
+import { DeviceDetailsComponent } from './devicedetails/devicedetails.component';
/**
* ONOS GUI -- Device View Module
*/
@NgModule({
- imports: [
- CommonModule,
- DeviceRoutingModule,
- SvgModule
- ],
- declarations: [
- DeviceComponent,
- DeviceDetailsPanelDirective
- ]
+ imports: [
+ CommonModule,
+ DeviceRoutingModule,
+ SvgModule,
+ WidgetModule,
+ FormsModule
+ ],
+ declarations: [
+ DeviceComponent,
+ DeviceDetailsComponent
+ ]
})
export class DeviceModule { }
diff --git a/web/gui2/src/main/webapp/app/view/device/device.theme.css b/web/gui2/src/main/webapp/app/view/device/device.theme.css
deleted file mode 100644
index df0f139..0000000
--- a/web/gui2/src/main/webapp/app/view/device/device.theme.css
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- ONOS GUI -- Device View (theme) -- CSS file
- */
-
-.light #device-details-panel .bottom th {
- background-color: #e5e5e6;
-}
-
-.light #device-details-panel .bottom tr:nth-child(odd) {
- background-color: #fbfbfb;
-}
-.light #device-details-panel .bottom tr:nth-child(even) {
- background-color: #f4f4f4;
-}
-
diff --git a/web/gui2/src/main/webapp/app/view/device/device.component.css b/web/gui2/src/main/webapp/app/view/device/device/device.component.css
similarity index 97%
rename from web/gui2/src/main/webapp/app/view/device/device.component.css
rename to web/gui2/src/main/webapp/app/view/device/device/device.component.css
index 4d8454d..5ed16e8 100644
--- a/web/gui2/src/main/webapp/app/view/device/device.component.css
+++ b/web/gui2/src/main/webapp/app/view/device/device/device.component.css
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/web/gui2/src/main/webapp/app/view/device/device/device.component.html b/web/gui2/src/main/webapp/app/view/device/device/device.component.html
new file mode 100644
index 0000000..7a22076
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/device/device.component.html
@@ -0,0 +1,121 @@
+<!--
+~ Copyright 2018-present Open Networking Foundation
+~
+~ Licensed under the Apache License, Version 2.0 (the "License");
+~ you may not use this file except in compliance with the License.
+~ You may obtain a copy of the License at
+~
+~ http://www.apache.org/licenses/LICENSE-2.0
+~
+~ Unless required by applicable law or agreed to in writing, software
+~ distributed under the License is distributed on an "AS IS" BASIS,
+~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~ See the License for the specific language governing permissions and
+~ limitations under the License.
+-->
+<div id="ov-device">
+ <div class="tabular-header">
+ <h2>Devices ({{ tableData.length }} total)</h2>
+ <div class="ctrl-btns">
+ <div class="refresh" (click)="toggleRefresh()">
+ <!-- See icon.theme.css for the defintions of the classes active and refresh-->
+ <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}" iconId="refresh" iconSize="42" toolTip="{{ autoRefreshTip }}"></onos-icon>
+ </div>
+ <div class="separator"></div>
+
+ <div>
+ <onos-icon classes="{{ selId ? 'current-view':undefined }}" iconId="deviceTable" iconSize="42"></onos-icon>
+ </div>
+
+ <div (click)="navto('/flow')">
+ <onos-icon classes="{{ selId ? 'active-rect' :undefined}}" iconId="flowTable" iconSize="42" toolTip="{{ flowTip }}"></onos-icon>
+ </div>
+
+ <div (click)="navto('/port')">
+ <onos-icon classes="{{ selId ? 'active-rect' :undefined}}" iconId="portTable" iconSize="42" toolTip="{{ portTip }}"></onos-icon>
+ </div>
+
+ <div (click)="navto('/group')">
+ <onos-icon classes="{{ selId ? 'active-rect' :undefined}}" iconId="groupTable" iconSize="42" toolTip="{{ groupTip }}"></onos-icon>
+ </div>
+
+ <div (click)="navto('/meter')">
+ <onos-icon classes="{{ selId ? 'active-rect' :undefined}}" iconId="meterTable" iconSize="42" toolTip="{{ meterTip }}"></onos-icon>
+ </div>
+
+ <div (click)="navto('/pipeconf')">
+ <onos-icon classes="{{ selId ? 'active-rect' :undefined}}" iconId="pipeconfTable" iconSize="42" toolTip="{{ pipeconfTip }}"></onos-icon>
+ </div>
+ </div>
+ <div class="search">
+ <input id="searchinput" [(ngModel)]="tableDataFilter.queryStr" type="search" #search placeholder="Search" />
+ <select [(ngModel)]="tableDataFilter.queryBy">
+ <option value="" disabled>Search By</option>
+ <option value="$">All Fields</option>
+ <option value="id">Device-Id</option>
+ <option value="name">Name</option>
+ <option value="protocol">Protocol</option>
+ </select>
+ </div>
+ </div>
+
+ <div id="summary-list" class="summary-list" onosTableResize>
+ <div class="table-header">
+ <table>
+ <tr>
+ <td colId="available" class="table-icon"></td>
+ <td colId="type" class="table-icon"></td>
+ <td colId="name" (click)="onSort('name')">Friendly Name
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('name')"></onos-icon>
+ </td>
+ <td colId="id" (click)="onSort('id')">Device ID
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('id')"></onos-icon>
+ </td>
+ <td colId="masterid" [ngClass]="{width: '130px'}" (click)="onSort('masterid')">Master
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('masterid')"></onos-icon>
+ </td>
+ <td colId="num_ports" [ngClass]="{width: '70px'}" (click)="onSort('num_ports')">Ports
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('num_ports')"></onos-icon>
+ </td>
+ <td colId="mfr" (click)="onSort('mfr')">Vendor
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('mfr')"></onos-icon>
+ </td>
+ <td colId="hw" (click)="onSort('hw')">H/W Version
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('hw')"></onos-icon>
+ </td>
+ <td colId="sw" (click)="onSort('sw')">S/W Version
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('sw')"></onos-icon>
+ </td>
+ <td colId="protocol" [ngClass]="{width: '100px'}" (click)="onSort('protocol')">Protocol
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('protocol')"></onos-icon>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="table-body">
+ <table>
+ <tr class="table-body" *ngIf="tableData.length === 0" class="no-data">
+ <td colspan="9">{{ annots.noRowsMsg }}</td>
+ </tr>
+ <tr *ngFor="let dev of tableData | filter : tableDataFilter" (click)="selectCallback($event, dev)" [ngClass]="{selected: dev.id === selId, 'data-change': isChanged(dev.id)}">
+ <td class="table-icon">
+ <onos-icon classes="{{ dev._iconid_available}}" iconId={{dev._iconid_available}}></onos-icon>
+ </td>
+ <td class="table-icon">
+ <onos-icon classes="{{dev._iconid_type? 'active-type':undefined}}" iconId="{{dev._iconid_type}}"></onos-icon>
+ </td>
+ <td>{{ dev.name }}</td>
+ <td>{{ dev.id }}</td>
+ <td>{{ dev.masterid }}</td>
+ <td>{{ dev.num_ports }}</td>
+ <td>{{ dev.mfr }}</td>
+ <td>{{ dev.hw }}</td>
+ <td>{{ dev.sw }}</td>
+ <td>{{ dev.protocol }}</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+ <onos-devicedetails class="floatpanels" id="{{ selId }}" (closeEvent)="deselectRow($event)"></onos-devicedetails>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/device/device/device.component.spec.ts b/web/gui2/src/main/webapp/app/view/device/device/device.component.spec.ts
new file mode 100644
index 0000000..207dde9
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/device/device.component.spec.ts
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { ActivatedRoute, Params } from '@angular/router';
+import { DebugElement } from '@angular/core';
+import { By } from '@angular/platform-browser';
+import { LogService } from '../../../log.service';
+import { DeviceComponent } from './device.component';
+import { } from 'jasmine';
+
+import { FnService } from '../../../fw/util/fn.service';
+import { IconService } from '../../../fw/svg/icon.service';
+import { GlyphService } from '../../../fw/svg/glyph.service';
+import { IconComponent } from '../../../fw/svg/icon/icon.component';
+import { KeyService } from '../../../fw/util/key.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { NavService } from '../../../fw/nav/nav.service';
+import { MastService } from '../../../fw/mast/mast.service';
+import { TableFilterPipe } from '../../../fw/widget/tablefilter.pipe';
+import { ThemeService } from '../../../fw/util/theme.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { of } from 'rxjs';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { FormsModule } from '@angular/forms';
+import { DeviceDetailsComponent } from './../devicedetails/devicedetails.component';
+import { RouterTestingModule } from '@angular/router/testing';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+class MockIconService {
+ loadIconDef() { }
+}
+
+class MockGlyphService { }
+
+class MockKeyService { }
+
+class MockLoadingService {
+ startAnim() { }
+ stop() { }
+}
+
+class MockNavService { }
+
+class MockMastService { }
+
+class MockThemeService { }
+
+class MockWebSocketService {
+ createWebSocket() { }
+ isConnected() { return false; }
+ unbindHandlers() { }
+ bindHandlers() { }
+}
+
+/**
+ * ONOS GUI -- Device View Module - Unit Tests
+ */
+describe('DeviceComponent', () => {
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+ let component: DeviceComponent;
+ let fixture: ComponentFixture<DeviceComponent>;
+
+ beforeEach(async(() => {
+ const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+ ar = new MockActivatedRoute({ 'debug': 'txrx' });
+
+ windowMock = <any>{
+ location: <any>{
+ hostname: 'foo',
+ host: 'foo',
+ port: '80',
+ protocol: 'http',
+ search: { debug: 'true' },
+ href: 'ws://foo:123/onos/ui/websock/path',
+ absUrl: 'ws://foo:123/onos/ui/websock/path'
+ }
+ };
+ fs = new FnService(ar, logSpy, windowMock);
+
+ TestBed.configureTestingModule({
+ imports: [BrowserAnimationsModule, FormsModule, RouterTestingModule],
+ declarations: [DeviceComponent, IconComponent, TableFilterPipe, DeviceDetailsComponent],
+ providers: [
+ { provide: FnService, useValue: fs },
+ { provide: IconService, useClass: MockIconService },
+ { provide: GlyphService, useClass: MockGlyphService },
+ { provide: KeyService, useClass: MockKeyService },
+ { provide: LoadingService, useClass: MockLoadingService },
+ { provide: MastService, useClass: MockMastService },
+ { provide: NavService, useClass: MockNavService },
+ { provide: LogService, useValue: logSpy },
+ { provide: ThemeService, useClass: MockThemeService },
+ { provide: WebSocketService, useClass: MockWebSocketService },
+ { provide: 'Window', useValue: windowMock },
+ ]
+ }).compileComponents();
+ logServiceSpy = TestBed.get(LogService);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DeviceComponent);
+ component = fixture.debugElement.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should have a div.tabular-header inside a div#ov-device', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div#ov-device div.tabular-header'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have .table-header with "Friendly Name..."', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div#ov-device div.table-header'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('Friendly Name Device ID Master Ports Vendor H/W Version S/W Version Protocol ');
+ });
+
+ it('should have a refresh button inside the div.tabular-header', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div#ov-device div.tabular-header div.ctrl-btns div.refresh'));
+ expect(divDe).toBeTruthy();
+ });
+
+
+ it('should have a div.table-body ', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div#ov-device div.table-body'));
+ expect(divDe).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/device/device.component.ts b/web/gui2/src/main/webapp/app/view/device/device/device.component.ts
similarity index 61%
rename from web/gui2/src/main/webapp/app/view/device/device.component.ts
rename to web/gui2/src/main/webapp/app/view/device/device/device.component.ts
index ecccc34..b6f1d95 100644
--- a/web/gui2/src/main/webapp/app/view/device/device.component.ts
+++ b/web/gui2/src/main/webapp/app/view/device/device/device.component.ts
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,16 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
-import { FnService } from '../../fw/util/fn.service';
-import { IconService } from '../../fw/svg/icon.service';
-import { KeyService } from '../../fw/util/key.service';
-import { LoadingService } from '../../fw/layer/loading.service';
-import { LogService } from '../../log.service';
-import { MastService } from '../../fw/mast/mast.service';
-import { NavService } from '../../fw/nav/nav.service';
-import { TableBaseImpl, TableResponse } from '../../fw/widget/table.base';
-import { WebSocketService } from '../../fw/remote/websocket.service';
+import { Component, OnInit, OnDestroy} from '@angular/core';
+import { FnService } from '../../../fw/util/fn.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { LogService } from '../../../log.service';
+import { TableBaseImpl, TableResponse, SortDir } from '../../../fw/widget/table.base';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { ActivatedRoute, Router } from '@angular/router';
/**
* Model of the response from WebSocket
@@ -55,9 +52,9 @@
* ONOS GUI -- Device View Component
*/
@Component({
- selector: 'onos-device',
- templateUrl: './device.component.html',
- styleUrls: ['./device.component.css', './device.theme.css', '../../fw/widget/table.css', '../../fw/widget/table.theme.css']
+ selector: 'onos-device',
+ templateUrl: './device.component.html',
+ styleUrls: ['./device.component.css', './device.theme.css', '../../../fw/widget/table.css', '../../../fw/widget/table.theme.css']
})
export class DeviceComponent extends TableBaseImpl implements OnInit, OnDestroy {
@@ -71,16 +68,29 @@
constructor(
protected fs: FnService,
protected ls: LoadingService,
- private is: IconService,
- private ks: KeyService,
protected log: LogService,
- private mast: MastService,
- private nav: NavService,
+ protected as: ActivatedRoute,
+ protected router: Router,
protected wss: WebSocketService,
- @Inject('Window') private window: Window,
) {
super(fs, ls, log, wss, 'device');
this.responseCallback = this.deviceResponseCb;
+
+ this.as.queryParams.subscribe(params => {
+ this.selId = params['devId'];
+
+ });
+
+ this.payloadParams = {
+ devId: this.selId
+ };
+
+ this.sortParams = {
+ firstCol: 'name',
+ firstDir: SortDir.asc,
+ secondCol: 'id',
+ secondDir: SortDir.desc,
+ };
}
ngOnInit() {
@@ -97,4 +107,11 @@
this.log.debug('Device response received for ', data.devices.length, 'devices');
}
+ navto(path) {
+ this.log.debug('navigate');
+ if (this.selId) {
+ this.router.navigate([path], { queryParams: { devId: this.selId } });
+ }
+ }
+
}
diff --git a/web/gui2/src/main/webapp/app/view/device/device/device.theme.css b/web/gui2/src/main/webapp/app/view/device/device/device.theme.css
new file mode 100644
index 0000000..d9b2c07
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/device/device.theme.css
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ ONOS GUI -- Device View (theme) -- CSS file
+ */
+
+.light #device-details-panel .bottom th {
+ background-color: #e5e5e6;
+}
+
+.light #device-details-panel .bottom tr:nth-child(odd) {
+ background-color: #fbfbfb;
+}
+.light #device-details-panel .bottom tr:nth-child(even) {
+ background-color: #f4f4f4;
+}
+#ov-device .tabular-header {
+ text-align: left;
+}
+#ov-device div.summary-list .table-header td {
+ font-weight: bold;
+ font-variant: small-caps;
+ text-transform: uppercase;
+ font-size: 10pt;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ letter-spacing: 0.02em;
+ cursor: pointer;
+ background-color: #e5e5e6;
+ color: #3c3a3a;
+}
+
+#ov-device div.summary-list .table-body {
+ overflow:scroll;
+}
+#ov-device h2 {
+ display: inline-block;
+}
+
+#ov-device, div.ctrl-btns {
+}
+
+#ov-device th, td {
+ text-align: left;
+ padding: 8px;
+}
diff --git a/web/gui2/src/main/webapp/app/view/device/device.component.css b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.css
similarity index 75%
copy from web/gui2/src/main/webapp/app/view/device/device.component.css
copy to web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.css
index 4d8454d..a3903b0 100644
--- a/web/gui2/src/main/webapp/app/view/device/device.component.css
+++ b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.css
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,36 +14,24 @@
* limitations under the License.
*/
-/*
- ONOS GUI -- Device View (layout) -- CSS file
- */
-#ov-device .tabular-header {
- text-align: left;
-}
-
-#ov-device h2 {
- display: inline-block;
-}
-
-#ov-device, div.ctrl-btns {
-}
-
-
-/* More in generic panel.css */
-
#device-details-panel.floatpanel {
z-index: 0;
+ font-size: 10pt;
+ top: 185px;
}
+#device-details-panel.floatpanel a {
+ font-weight: bold;
+}
#device-details-panel .container {
- padding: 8px 12px;
+ padding: 0 30px;
}
#device-details-panel .close-btn {
position: absolute;
- right: 12px;
- top: 12px;
+ right:5px;
+ top: 5px;
cursor: pointer;
}
@@ -56,33 +44,15 @@
#device-details-panel h2 {
display: inline-block;
margin: 8px 0;
+ font-weight: bold;
+ font-size: 16pt;
}
-
#device-details-panel h2 input {
font-size: 0.90em;
width: 106%;
}
-#device-details-panel .top-tables {
- font-size: 10pt;
- white-space: nowrap;
-}
-
-#device-details-panel .top div.left {
- float: left;
- padding: 0 18px 0 0;
-}
-#device-details-panel .top div.right {
- display: inline-block;
-}
-
-#device-details-panel td.label {
- font-weight: bold;
- text-align: right;
- padding-right: 6px;
-}
-
#device-details-panel .actionBtns div {
padding: 12px 6px;
}
@@ -92,8 +62,23 @@
margin: 2px auto;
}
+#device-details-panel .top-tables {
+ font-size: 10pt;
+ white-space: nowrap;
+}
+
+#device-details-panel td.label {
+ font-weight: bold;
+ text-align: right;
+ padding-right: 6px;
+}
+
#device-details-panel .bottom table {
border-spacing: 0;
+ height: 358px;
+ width: 520px;
+ overflow: auto;
+ display: block;
}
#device-details-panel .bottom th {
@@ -106,3 +91,24 @@
text-align: center;
}
+#device-details-panel .top div.left {
+ float: left;
+ text-align: left;
+ padding: 0 10px 0 0;
+}
+
+#device-details-panel .top div.right {
+ display: inline-block;
+}
+
+#device-details-panel .editable {
+ border-bottom: 1px dashed #ca504b;
+}
+
+#device-details-panel .clickable {
+ cursor: pointer;
+}
+
+#device-details-panel .bottom thead tr {
+ background-color: #e5e5e6;
+}
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.html b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.html
new file mode 100644
index 0000000..034b63b
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.html
@@ -0,0 +1,111 @@
+<!--
+~ Copyright 2018-present Open Networking Foundation
+~
+~ Licensed under the Apache License, Version 2.0 (the "License");
+~ you may not use this file except in compliance with the License.
+~ You may obtain a copy of the License at
+~
+~ http://www.apache.org/licenses/LICENSE-2.0
+~
+~ Unless required by applicable law or agreed to in writing, software
+~ distributed under the License is distributed on an "AS IS" BASIS,
+~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~ See the License for the specific language governing permissions and
+~ limitations under the License.
+-->
+
+<div id="device-details-panel" class="floatpanel" [@deviceDetailsState]="id!=='' && !closed">
+ <div class="container">
+ <div class="top">
+ <div class="close-btn">
+ <onos-icon class="close-btn" classes="active-close" iconId="close" iconSize="20" (click)="close()"></onos-icon>
+ </div>
+ <div class="dev-icon">
+ <onos-icon classes="{{detailsData._iconid_type? 'details-icon':undefined}}" iconId="{{detailsData._iconid_type}}" [iconSize]="40"></onos-icon>
+ </div>
+ <h2 class="editable clickable">{{detailsData.id}}</h2>
+ <div class="top-content">
+ <div class="top-tables">
+ <div class="left">
+ <table>
+ <tbody>
+ <tr>
+ <td class="label" width="110">URI :</td>
+ <td class="value" width="80">{{detailsData.id}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Type :</td>
+ <td class="value" width="80">{{detailsData.type}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Master ID :</td>
+ <td class="value" width="80">{{detailsData.masterid}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Chassis ID :</td>
+ <td class="value" width="80">{{detailsData.chassisid}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Vendor :</td>
+ <td class="value" width="80">{{detailsData.mfr}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="right">
+ <table>
+ <tbody>
+ <tr>
+ <td class="label" width="110">H/W Version :</td>
+ <td class="value" width="80">{{detailsData.hw}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">S/W Version :</td>
+ <td class="value" width="80">{{detailsData.sw}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Protocol :</td>
+ <td class="value" width="80">{{detailsData.protocol}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Serial # :</td>
+ <td class="value" width="80">{{detailsData.serial}}</td>
+ </tr>
+ <tr>
+ <td class="label" width="110">Pipeconf :</td>
+ <td class="value" width="80">{{detailsData.pipeconf}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ <hr>
+ </div>
+ <div class="bottom">
+ <h2 class="ports-title">Ports</h2>
+ <table>
+ <thead>
+ <tr>
+ <th>Enabled</th>
+ <th>ID</th>
+ <th>Speed</th>
+ <th>Type</th>
+ <th>Egress Links</th>
+ <th>Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr *ngFor="let port of detailsData.ports">
+ <td>{{port.enabled}}</td>
+ <td>{{port.id}}</td>
+ <td>{{port.speed}}</td>
+ <td>{{port.type}}</td>
+ <td>{{port.elinks_dest}}</td>
+ <td>{{port.name}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.spec.ts b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.spec.ts
new file mode 100644
index 0000000..5daa2ef
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.spec.ts
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { DeviceDetailsComponent } from './devicedetails.component';
+import { ActivatedRoute, Params } from '@angular/router';
+import { of } from 'rxjs/index';
+import { FnService } from '../../../fw/util/fn.service';
+import { LogService } from '../../../log.service';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { IconService } from '../../../fw/svg/icon.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { DebugElement } from '@angular/core';
+import { By } from '@angular/platform-browser';
+import { } from 'jasmine';
+import { IconComponent } from '../../../fw/svg/icon/icon.component';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+class MockIconService {
+ classes = 'active-close';
+ loadIconDef() { }
+}
+
+class MockWebSocketService {
+ createWebSocket() { }
+ isConnected() { return false; }
+ unbindHandlers() { }
+ bindHandlers() { }
+}
+
+describe('DeviceDetailsComponent', () => {
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+ let component: DeviceDetailsComponent;
+ let fixture: ComponentFixture<DeviceDetailsComponent>;
+
+ beforeEach(async(() => {
+ const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+ ar = new MockActivatedRoute({ 'debug': 'panel' });
+ windowMock = <any>{
+ location: <any>{
+ hostname: 'foo',
+ host: 'foo',
+ port: '80',
+ protocol: 'http',
+ search: { debug: 'true' },
+ href: 'ws://foo:123/onos/ui/websock/path',
+ absUrl: 'ws://foo:123/onos/ui/websock/path'
+ }
+ };
+ fs = new FnService(ar, logSpy, windowMock);
+
+ TestBed.configureTestingModule({
+ imports: [BrowserAnimationsModule],
+ declarations: [DeviceDetailsComponent, IconComponent],
+ providers: [
+ { provide: FnService, useValue: fs },
+ { provide: IconService, useClass: MockIconService },
+ { provide: LogService, useValue: logSpy },
+ { provide: WebSocketService, useClass: MockWebSocketService },
+ { provide: 'Window', useValue: windowMock },
+ ]
+
+ }).compileComponents();
+ logServiceSpy = TestBed.get(LogService);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DeviceDetailsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should have an div.close-btn div.top inside a div.container', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.container div.top div.close-btn'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.dev-icon inside a div.top inside a div.container', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.container div.top div.dev-icon'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('');
+ });
+
+ it('should have a div.top-content inside a div.top inside a div.container', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.container div.top div.top-content'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a dev.left inside a div.top-tables inside a div.top-content', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.top-content div.top-tables div.left'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('URI :Type :Master ID :Chassis ID :Vendor :');
+ });
+
+ it('should have a dev.right inside a div.top-tables inside a div.top-content', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.top-content div.top-tables div.right'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('H/W Version :S/W Version :Protocol :Serial # :Pipeconf :');
+ });
+
+ it('should have a div.bottom inside a div.container', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.container div.bottom'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a h2.ports-title inside a div.bottom inside a div.container', () => {
+ const devDe: DebugElement = fixture.debugElement;
+ const divDe = devDe.query(By.css('div.container div.bottom h2.ports-title'));
+ expect(divDe).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.ts b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.ts
new file mode 100644
index 0000000..9e30eb7
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/devicedetails/devicedetails.component.ts
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { Component, Input, OnInit, OnDestroy, OnChanges } from '@angular/core';
+import { trigger, state, style, animate, transition } from '@angular/animations';
+
+import { FnService } from '../../../fw/util/fn.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { LogService } from '../../../log.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+
+import { DetailsPanelBaseImpl } from '../../../fw/widget/detailspanel.base';
+import { IconService } from '../../../fw/svg/icon.service';
+
+/**
+ * The details view when a device row is clicked from the Device view
+ *
+ * This is expected to be passed an 'id' and it makes a call
+ * to the WebSocket with an deviceDetailsRequest, and gets back an
+ * deviceDetailsResponse.
+ *
+ * The animated fly-in is controlled by the animation below
+ * The deviceDetailsState is attached to device-details-panel
+ * and is false (flies out) when id='' and true (flies in) when
+ * id has a value
+ */
+@Component({
+ selector: 'onos-devicedetails',
+ templateUrl: './devicedetails.component.html',
+ styleUrls: ['./devicedetails.component.css',
+ '../../../fw/widget/panel.css', '../../../fw/widget/panel-theme.css'
+ ],
+ animations: [
+ trigger('deviceDetailsState', [
+ state('true', style({
+ transform: 'translateX(-100%)',
+ opacity: '100'
+ })),
+ state('false', style({
+ transform: 'translateX(0%)',
+ opacity: '0'
+ })),
+ transition('0 => 1', animate('100ms ease-in')),
+ transition('1 => 0', animate('100ms ease-out'))
+ ])
+ ]
+})
+
+
+export class DeviceDetailsComponent extends DetailsPanelBaseImpl implements OnInit, OnDestroy, OnChanges {
+ @Input() id: string;
+
+ constructor(protected fs: FnService,
+ protected ls: LoadingService,
+ protected log: LogService,
+ protected is: IconService,
+ protected wss: WebSocketService
+ ) {
+ super(fs, ls, log, wss, 'device');
+ }
+
+ ngOnInit() {
+ this.init();
+ this.log.debug('App Details Component initialized:', this.id);
+ }
+
+ /**
+ * Stop listening to appDetailsResponse on WebSocket
+ */
+ ngOnDestroy() {
+ this.destroy();
+ this.log.debug('App Details Component destroyed');
+ }
+
+ /**
+ * Details Panel Data Request on row selection changes
+ * Should be called whenever id changes
+ * If id is empty, no request is made
+ */
+ ngOnChanges() {
+ if (this.id === '') {
+ return '';
+ } else {
+ const query = {
+ 'id': this.id
+ };
+ this.requestDetailsPanelData(query);
+ }
+ }
+
+}
diff --git a/web/gui2/src/main/webapp/app/view/device/devicedetailspanel.directive.ts b/web/gui2/src/main/webapp/app/view/device/devicedetailspanel.directive.ts
deleted file mode 100644
index d81a67d..0000000
--- a/web/gui2/src/main/webapp/app/view/device/devicedetailspanel.directive.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { Directive, Inject } from '@angular/core';
-import { KeyService } from '../../fw/util/key.service';
-import { LogService } from '../../log.service';
-
-/**
- * ONOS GUI -- Device Details Panel Directive
- *
- * TODO: figure out if this should be a directive or a component. In the old
- * code it was a directive, but was referred to in device.html like a component
- * would be
- */
-@Directive({
- selector: '[onosDeviceDetailsPanel]'
-})
-export class DeviceDetailsPanelDirective {
-
- constructor(
- private ks: KeyService,
- private log: LogService
- ) {
- this.log.debug('DeviceDetailsPanelDirective constructed');
- }
-
-}