GUI2 Settings and Partitions View
Change-Id: I605304c20c1e625394d789104fcd7a5b278e244d
diff --git a/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.html b/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.html
index 27d4a60..bd4d6af 100644
--- a/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.html
+++ b/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.html
@@ -14,30 +14,36 @@
~ limitations under the License.
-->
<nav id="nav" [@navState]="ns.showNav">
- <div class="nav-hdr">{{ lionFn('cat_platform') }}</div>
+ <div id="platform" class="nav-hdr">{{ lionFn('cat_platform') }}</div>
- <a (click)="ns.hideNav()" routerLink="/app" routerLinkActive="active">
- <onos-icon iconId="nav_apps"></onos-icon> Apps</a>
+ <a id="app" (click)="ns.hideNav()" routerLink="/app" routerLinkActive="active">
+ <onos-icon iconId="nav_apps"></onos-icon> Applications</a>
- <a (click)="ns.hideNav()" routerLink="/processor" routerLinkActive="active">
+ <a id="settings" (click)="ns.hideNav()" routerLink="/settings" routerLinkActive="active">
+ <onos-icon iconId="nav_settings"></onos-icon> Settings</a>
+
+ <a id="processor" (click)="ns.hideNav()" routerLink="/processor" routerLinkActive="active">
<onos-icon iconId="nav_processors"></onos-icon> Packet Processors</a>
- <div class="nav-hdr">{{ lionFn('cat_network') }}</div>
+ <a id="partition" (click)="ns.hideNav()" routerLink="/partition" routerLinkActive="active">
+ <onos-icon iconId="nav_partitions"></onos-icon> Partitions</a>
- <a (click)="ns.hideNav()" routerLink="/device" routerLinkActive="active">
+ <div id="network" class="nav-hdr">{{ lionFn('cat_network') }}</div>
+
+ <a id="device" (click)="ns.hideNav()" routerLink="/device" routerLinkActive="active">
<onos-icon iconId="nav_devs"></onos-icon> Devices</a>
- <a (click)="ns.hideNav()" routerLink="/link" routerLinkActive="active">
+ <a id="link" (click)="ns.hideNav()" routerLink="/link" routerLinkActive="active">
<onos-icon iconId="nav_links"></onos-icon> Links</a>
- <a (click)="ns.hideNav()" routerLink="/host" routerLinkActive="active">
+ <a id="host" (click)="ns.hideNav()" routerLink="/host" routerLinkActive="active">
<onos-icon iconId="nav_hosts"></onos-icon> Hosts</a>
- <a (click)="ns.hideNav()" routerLink="/intent" routerLinkActive="active">
+ <a id="intent" (click)="ns.hideNav()" routerLink="/intent" routerLinkActive="active">
<onos-icon iconId="nav_intents"></onos-icon> Intents</a>
- <a (click)="ns.hideNav()" routerLink="/tunnel" routerLinkActive="active">
+ <a id="tunnel" (click)="ns.hideNav()" routerLink="/tunnel" routerLinkActive="active">
<onos-icon iconId="nav_tunnels"></onos-icon> Tunnels</a>
- <div class="nav-hdr">{{ lionFn('cat_other') }}</div>
+ <div id="other" class="nav-hdr">{{ lionFn('cat_other') }}</div>
</nav>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.spec.ts b/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.spec.ts
index 7079b15..9435b43 100644
--- a/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.spec.ts
+++ b/web/gui2/src/main/webapp/app/fw/nav/nav/nav.component.spec.ts
@@ -118,15 +118,78 @@
it('should have a platform div.nav-hdr inside a nav#nav', () => {
const appDe: DebugElement = fixture.debugElement;
- const divDe = appDe.query(By.css('nav#nav div.nav-hdr'));
+ const divDe = appDe.query(By.css('nav#nav div#platform.nav-hdr'));
const div: HTMLElement = divDe.nativeElement;
expect(div.textContent).toEqual('%cat_platform%');
});
- it('should have an apps link inside a nav#nav', () => {
+ it('should have an app view link inside a nav#nav', () => {
const appDe: DebugElement = fixture.debugElement;
- const divDe = appDe.query(By.css('nav#nav a'));
+ const divDe = appDe.query(By.css('nav#nav a#app'));
const div: HTMLElement = divDe.nativeElement;
- expect(div.textContent).toEqual(' Apps');
+ expect(div.textContent).toEqual(' Applications');
+ });
+
+ it('should have an processor view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#processor'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Packet Processors');
+ });
+
+ it('should have a settings view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#settings'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Settings');
+ });
+
+ it('should have a partition view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#partition'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Partitions');
+ });
+
+ it('should have a network div.nav-hdr inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav div#network.nav-hdr'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('%cat_network%');
+ });
+
+ it('should have a device view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#device'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Devices');
+ });
+
+ it('should have a link view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#link'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Links');
+ });
+
+ it('should have a host view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#host'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Hosts');
+ });
+
+ it('should have a intent view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#intent'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Intents');
+ });
+
+ it('should have a tunnel view link inside a nav#nav', () => {
+ const appDe: DebugElement = fixture.debugElement;
+ const divDe = appDe.query(By.css('nav#nav a#tunnel'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual(' Tunnels');
});
});
diff --git a/web/gui2/src/main/webapp/app/fw/svg/icon.service.ts b/web/gui2/src/main/webapp/app/fw/svg/icon.service.ts
index de3672c..0f9da65 100644
--- a/web/gui2/src/main/webapp/app/fw/svg/icon.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/svg/icon.service.ts
@@ -79,6 +79,7 @@
['nav_settings', 'cog'],
['nav_cluster', 'node'],
['nav_processors', 'allTraffic'],
+ ['nav_partitions', 'unknown'],
['nav_topo', 'topo'],
['nav_topo2', 'm_cloud'],
diff --git a/web/gui2/src/main/webapp/app/onos-routing.module.ts b/web/gui2/src/main/webapp/app/onos-routing.module.ts
index 48192b5..8be8549 100644
--- a/web/gui2/src/main/webapp/app/onos-routing.module.ts
+++ b/web/gui2/src/main/webapp/app/onos-routing.module.ts
@@ -30,6 +30,14 @@
loadChildren: 'app/view/processor/processor.module#ProcessorModule'
},
{
+ path: 'settings',
+ loadChildren: 'app/view/settings/settings.module#SettingsModule'
+ },
+ {
+ path: 'partition',
+ loadChildren: 'app/view/partition/partition.module#PartitionModule'
+ },
+ {
path: 'device',
loadChildren: 'app/view/device/device.module#DeviceModule'
},
diff --git a/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html
index d43c264..6671601 100644
--- a/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html
+++ b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html
@@ -17,7 +17,7 @@
<!--<div *ngIf="visible" class="container">-->
<div class="container">
<div class="top">
- <onos-icon class="close-btn" iconId="close" iconSize="20" (click)="close()"></onos-icon>
+ <onos-icon class="close-btn" classes="active-close" iconId="close" iconSize="20" (click)="close()"></onos-icon>
<div class="top-content">
<div class="app-title">{{ detailsData.title }}</div>
<div class="left app-icon">
diff --git a/web/gui2/src/main/webapp/app/view/host/host-routing.module.ts b/web/gui2/src/main/webapp/app/view/host/host-routing.module.ts
index 62f10a1..01cdd8f 100644
--- a/web/gui2/src/main/webapp/app/view/host/host-routing.module.ts
+++ b/web/gui2/src/main/webapp/app/view/host/host-routing.module.ts
@@ -18,14 +18,14 @@
import { HostComponent } from './host/host.component';
const hostRoutes: Routes = [
- {
- path: '',
- component: HostComponent
- }
+ {
+ path: '',
+ component: HostComponent
+ }
];
@NgModule({
- imports: [RouterModule.forChild(hostRoutes)],
- exports: [RouterModule]
+ imports: [RouterModule.forChild(hostRoutes)],
+ exports: [RouterModule]
})
export class HostRoutingModule { }
diff --git a/web/gui2/src/main/webapp/app/view/host/host.module.ts b/web/gui2/src/main/webapp/app/view/host/host.module.ts
index 230b55a..93d0a59 100644
--- a/web/gui2/src/main/webapp/app/view/host/host.module.ts
+++ b/web/gui2/src/main/webapp/app/view/host/host.module.ts
@@ -23,12 +23,12 @@
import { HostDetailsComponent } from './hostdetails/hostdetails.component';
@NgModule({
- imports: [
- CommonModule,
- HostRoutingModule,
- WidgetModule,
- SvgModule
- ],
- declarations: [HostComponent, HostDetailsComponent]
+ imports: [
+ CommonModule,
+ HostRoutingModule,
+ WidgetModule,
+ SvgModule
+ ],
+ declarations: [HostComponent, HostDetailsComponent]
})
export class HostModule { }
diff --git a/web/gui2/src/main/webapp/app/view/partition/partition-routing.module.ts b/web/gui2/src/main/webapp/app/view/partition/partition-routing.module.ts
new file mode 100644
index 0000000..8b5345c
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/partition/partition-routing.module.ts
@@ -0,0 +1,31 @@
+/*
+ * 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 { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+import { PartitionComponent } from './partition/partition.component';
+
+const partitionRoutes: Routes = [
+ {
+ path: '',
+ component: PartitionComponent
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(partitionRoutes)],
+ exports: [RouterModule]
+})
+export class PartitionRoutingModule { }
diff --git a/web/gui2/src/main/webapp/app/view/partition/partition.module.ts b/web/gui2/src/main/webapp/app/view/partition/partition.module.ts
new file mode 100644
index 0000000..69e9832
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/partition/partition.module.ts
@@ -0,0 +1,33 @@
+/*
+ * 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 { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { SvgModule } from '../../fw/svg/svg.module';
+import { WidgetModule } from '../../fw/widget/widget.module';
+
+import { PartitionRoutingModule } from './partition-routing.module';
+import { PartitionComponent } from './partition/partition.component';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ SvgModule,
+ WidgetModule,
+ PartitionRoutingModule
+ ],
+ declarations: [PartitionComponent]
+})
+export class PartitionModule { }
diff --git a/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.css b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.css
new file mode 100644
index 0000000..e6a654b
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.css
@@ -0,0 +1,47 @@
+/*
+ * 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 -- Partition View (layout) -- CSS file
+ */
+ #ov-partition .tabular-header {
+ text-align: left;
+}
+
+#ov-partition h2 {
+ display: inline-block;
+}
+
+#ov-partition 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-partition td {
+ text-align: center;
+}
+
+#ov-partition tr.no-data td {
+ text-align: center;
+}
diff --git a/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.html b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.html
new file mode 100644
index 0000000..0adac19
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.html
@@ -0,0 +1,56 @@
+<!--
+~ 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-partition">
+ <div class="tabular-header">
+ <h2>Partitions ({{tableData.length}} total)</h2>
+ <div class="ctrl-btns">
+ <div class="refresh" (click)="toggleRefresh()">
+ <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}" iconId="refresh" iconSize="42" toolTip="{{ autoRefreshTip }}"></onos-icon>
+ </div>
+ </div>
+ </div>
+ <div class="summary-list">
+ <div class="table-header">
+ <table onosTableResize>
+ <tr>
+ <td colId="name" [ngStyle]="{width: '100px'}" (click)="onSort('name')">Name
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('name')"></onos-icon>
+ </td>
+ <td colId="term" [ngStyle]="{width: '100px'}" (click)="onSort('term')">Term
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('term')"></onos-icon>
+ </td>
+ <td colId="leader" [ngStyle]="{width: '200px'}" (click)="onSort('leader')">Leader
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('leader')"></onos-icon>
+ </td>
+ <td colId="members">Members </td>
+ </tr>
+ </table>
+ </div>
+ <div class="table-body">
+ <table onosTableResize id-prop="name">
+ <tr *ngIf="tableData.length === 0" class="no-data">
+ <td colspan="4">{{ annots.noRowsMsg }}</td>
+ </tr>
+ <tr *ngFor="let partition of tableData" [ngClass]="{selected: partition.name === selId}">
+ <td [ngStyle]="{width: '100px'}">{{partition.name}}</td>
+ <td [ngStyle]="{width: '100px'}">{{partition.term}}</td>
+ <td [ngStyle]="{width: '200px'}">{{partition.leader}}</td>
+ <td>{{partition.members}}</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.spec.ts b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.spec.ts
new file mode 100644
index 0000000..ed9697e
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.spec.ts
@@ -0,0 +1,145 @@
+/*
+ * 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 { FnService } from '../../../fw/util/fn.service';
+import { IconComponent } from '../../../fw/svg/icon/icon.component';
+import { IconService } from '../../../fw/svg/icon.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { of } from 'rxjs';
+import { } from 'jasmine';
+import { RouterTestingModule } from '@angular/router/testing';
+import { PartitionComponent } from './partition.component';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+class MockIconService {
+ loadIconDef() { }
+}
+
+class MockLoadingService {
+ startAnim() { }
+ stop() { }
+ waiting() { }
+}
+
+class MockWebSocketService {
+ createWebSocket() { }
+ isConnected() { return false; }
+ unbindHandlers() { }
+ bindHandlers() { }
+}
+
+/**
+ * ONOS GUI -- Partition View Module - Unit Tests
+ */
+describe('PartitionComponent', () => {
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+ let component: PartitionComponent;
+ let fixture: ComponentFixture<PartitionComponent>;
+
+ beforeEach(async(() => {
+ const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+ ar = new MockActivatedRoute({ 'debug': 'txrx' });
+
+ windowMock = <any>{
+ location: <any>{
+ partitionname: 'foo',
+ partition: '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: [RouterTestingModule],
+ declarations: [PartitionComponent, IconComponent],
+ providers: [
+ { provide: FnService, useValue: fs },
+ { provide: LoadingService, useClass: MockLoadingService },
+ { provide: IconService, useClass: MockIconService },
+ { provide: LogService, useValue: logSpy },
+ { provide: WebSocketService, useClass: MockWebSocketService },
+ ]
+ })
+ .compileComponents();
+ logServiceSpy = TestBed.get(LogService);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PartitionComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should have a div.tabular-header inside a div#ov-partition', () => {
+ const metDe: DebugElement = fixture.debugElement;
+ const divDe = metDe.query(By.css('div#ov-partition div.tabular-header'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a h2 inside the div.tabular-header', () => {
+ const metDe: DebugElement = fixture.debugElement;
+ const divDe = metDe.query(By.css('div#ov-partition div.tabular-header h2'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('Partitions (0 total)');
+ });
+
+ it('should have a refresh button inside the div.tabular-header', () => {
+ const metDe: DebugElement = fixture.debugElement;
+ const divDe = metDe.query(By.css('div#ov-partition div.tabular-header div.ctrl-btns div.refresh'));
+ expect(divDe).toBeTruthy();
+ });
+
+
+ it('should have a div.summary-list inside a div#ov-partition', () => {
+ const partDe: DebugElement = fixture.debugElement;
+ const divDe = partDe.query(By.css('div#ov-partition div.summary-list'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.table-header inside a div.summary-list inside a div#ov-partition', () => {
+ const partDe: DebugElement = fixture.debugElement;
+ const divDe = partDe.query(By.css('div#ov-partition div.summary-list div.table-header'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.table-body inside a div.summary-list inside a div#ov-partition', () => {
+ const partDe: DebugElement = fixture.debugElement;
+ const divDe = partDe.query(By.css('div#ov-partition div.summary-list div.table-body'));
+ expect(divDe).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.ts b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.ts
new file mode 100644
index 0000000..552574f
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/partition/partition/partition.component.ts
@@ -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.
+ */
+import { Component, OnDestroy, OnInit } from '@angular/core';
+import { TableBaseImpl, SortDir } from '../../../fw/widget/table.base';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { LogService } from '../../../log.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { FnService } from '../../../fw/util/fn.service';
+import { ActivatedRoute } from '@angular/router';
+
+/**
+* ONOS GUI -- Partition View Component extends TableBaseImpl
+*/
+@Component({
+ selector: 'onos-partition',
+ templateUrl: './partition.component.html',
+ styleUrls: ['./partition.component.css', '../../../fw/widget/table.css', '../../../fw/widget/table.theme.css']
+})
+export class PartitionComponent extends TableBaseImpl implements OnInit, OnDestroy {
+
+ constructor(
+ protected fs: FnService,
+ protected log: LogService,
+ protected ls: LoadingService,
+ protected as: ActivatedRoute,
+ protected wss: WebSocketService,
+ ) {
+ super(fs, ls, log, wss, 'partition');
+ this.sortParams = {
+ firstCol: 'name',
+ firstDir: SortDir.desc,
+ secondCol: 'term',
+ secondDir: SortDir.asc,
+ };
+ }
+
+ ngOnInit() {
+ this.init();
+ this.log.debug('PartitionComponent initialized');
+ }
+
+ ngOnDestroy() {
+ this.destroy();
+ this.log.debug('PartitionComponent destroyed');
+ }
+
+}
diff --git a/web/gui2/src/main/webapp/app/view/settings/settings-routing.module.ts b/web/gui2/src/main/webapp/app/view/settings/settings-routing.module.ts
new file mode 100644
index 0000000..54e808b
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settings-routing.module.ts
@@ -0,0 +1,31 @@
+/*
+* 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 { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+import { SettingsComponent } from './settings/settings.component';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: SettingsComponent
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class SettingsRoutingModule { }
diff --git a/web/gui2/src/main/webapp/app/view/settings/settings.module.ts b/web/gui2/src/main/webapp/app/view/settings/settings.module.ts
new file mode 100644
index 0000000..eeed435
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settings.module.ts
@@ -0,0 +1,34 @@
+/*
+* 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 { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+
+import { SettingsRoutingModule } from './settings-routing.module';
+import { SettingsComponent } from './settings/settings.component';
+import { SvgModule } from '../../fw/svg/svg.module';
+import { WidgetModule } from '../../fw/widget/widget.module';
+import { SettingsDetailsComponent } from './settingsdetails/settingsdetails.component';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ SettingsRoutingModule,
+ SvgModule,
+ WidgetModule
+ ],
+ declarations: [SettingsComponent, SettingsDetailsComponent]
+})
+export class SettingsModule { }
diff --git a/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.css b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.css
new file mode 100644
index 0000000..c2c5621
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.css
@@ -0,0 +1,43 @@
+/*
+ * 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 -- Settings Panel (layout) -- CSS file
+ */
+ #ov-settings .tabular-header {
+ text-align: left;
+ }
+
+ #ov-settings h2 {
+ display: inline-block;
+ }
+
+ #ov-settings 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;
+}
+
+#ov-settings th, td {
+ text-align: left;
+ padding: 8px;
+}
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.html b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.html
new file mode 100644
index 0000000..7f88b51
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.html
@@ -0,0 +1,63 @@
+<!--
+~ 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-settings">
+ <div class="tabular-header">
+ <h2>Component Settings ({{tableData.length}} total)</h2>
+ <div class="ctrl-btns">
+ <div class="refresh" (click)="toggleRefresh()">
+ <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}" iconId="refresh" iconSize="42" toolTip="{{ autoRefreshTip }}"></onos-icon>
+ </div>
+ </div>
+ </div>
+ <div class="summary-list" onosTableResize>
+ <div class="table-header">
+ <table>
+ <tr>
+ <td colId="component" [ngStyle]="{width: '260px'}" (click)="onSort('component')">Component
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('component')"></onos-icon>
+ </td>
+ <td colId="prop" [ngStyle]="{width: '260px'}" (click)="onSort('prop')">Property
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('prop')"></onos-icon>
+ </td>
+ <td colId="type" [ngStyle]="{width: '80px'}" (click)="onSort('type')">Type
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('type')"></onos-icon>
+ </td>
+ <td colId="value" [ngStyle]="{width: '260px'}" (click)="onSort('value')">Value
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('value')"></onos-icon>
+ </td>
+ <td colId="desc" (click)="onSort('desc')">Description
+ <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('desc')"></onos-icon>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="table-body">
+ <table>
+ <tr *ngIf="tableData.length === 0" class="no-data">
+ <td colspan="5">{{ annots.noRowMsg }}</td>
+ </tr>
+ <tr *ngFor="let setting of tableData" (click)="selectCallback($event, setting)" [ngClass]="{selected: setting.id === selId, 'data-change': isChanged(setting.id)}">
+ <td [ngStyle]="{width: '260px'}">{{setting.component}}</td>
+ <td [ngStyle]="{width: '260px'}">{{setting.prop}}</td>
+ <td [ngStyle]="{width: '80px'}">{{setting.type}}</td>
+ <td [ngStyle]="{width: '260px'}" [ngClass]="{notdef: setting.value !== setting.defValue}">{{setting.value}}</td>
+ <td>{{setting.desc}}</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <onos-settingsdetails class="floatpanels" id="{{ selId }}" [settingsDetails]="settingsDetails" (closeEvent)="deselectRow($event)"></onos-settingsdetails>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.spec.ts b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.spec.ts
new file mode 100644
index 0000000..6ceb4ad
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.spec.ts
@@ -0,0 +1,145 @@
+/*
+* 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 { SettingsComponent } from './settings.component';
+import { ActivatedRoute, Params } from '@angular/router';
+import { of } from 'rxjs';
+import { FnService } from '../../../fw/util/fn.service';
+import { LogService } from '../../../log.service';
+import { IconComponent } from '../../../fw/svg/icon/icon.component';
+import { IconService } from '../../../fw/svg/icon.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { DebugElement } from '@angular/core';
+import { By } from '@angular/platform-browser';
+import { SettingsDetailsComponent } from '../settingsdetails/settingsdetails.component';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+class MockIconService {
+ loadIconDef() { }
+}
+
+class MockLoadingService {
+ startAnim() { }
+ stop() { }
+ waiting() { }
+}
+
+class MockWebSocketService {
+ createWebSocket() { }
+ isConnected() { return false; }
+ unbindHandlers() { }
+ bindHandlers() { }
+}
+
+/**
+ * ONOS GUI -- Settings View Module - Unit Tests
+ */
+describe('SettingsComponent', () => {
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+ let component: SettingsComponent;
+ let fixture: ComponentFixture<SettingsComponent>;
+
+ const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+ ar = new MockActivatedRoute({ 'debug': 'txrx' });
+
+ windowMock = <any>{
+ location: <any>{
+ settingsname: 'foo',
+ settings: '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);
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [BrowserAnimationsModule],
+ declarations: [SettingsComponent, IconComponent, SettingsDetailsComponent],
+ providers: [
+ { provide: FnService, useValue: fs },
+ { provide: IconService, useClass: MockIconService },
+ { provide: LoadingService, useClass: MockLoadingService },
+ { provide: LogService, useValue: logSpy },
+ { provide: WebSocketService, useClass: MockWebSocketService },
+ ]
+ })
+ .compileComponents();
+ logServiceSpy = TestBed.get(LogService);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(SettingsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should have a div.tabular-header inside a div#ov-settings', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div#ov-settings div.tabular-header'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a h2 inside the div.tabular-header', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div#ov-settings div.tabular-header h2'));
+ const div: HTMLElement = divDe.nativeElement;
+ expect(div.textContent).toEqual('Component Settings (0 total)');
+ });
+
+ it('should have a refresh button inside the div.tabular-header', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div#ov-settings div.tabular-header div.ctrl-btns div.refresh'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.summary-list inside a div#ov-settings', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div#ov-settings div.summary-list'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.table-header inside a div.summary-list inside a div#ov-settings', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div#ov-settings div.summary-list div.table-header'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.table-body inside a div.summary-list inside a div#ov-settings', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div#ov-settings div.summary-list div.table-body'));
+ expect(divDe).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.ts b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.ts
new file mode 100644
index 0000000..bc74b6a
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settings/settings.component.ts
@@ -0,0 +1,91 @@
+/*
+* 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, OnInit, OnDestroy } from '@angular/core';
+import { TableBaseImpl, TableResponse, SortDir } from '../../../fw/widget/table.base';
+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';
+
+/**
+ * Model of the data returned through the Web Socket about settings.
+ */
+interface SettingsTableResponse extends TableResponse {
+ settings: Settings[];
+}
+
+/**
+ * Model of the data returned through Web Socket for a single settings
+ */
+export interface Settings {
+ fqComponent: string;
+ component: string;
+ prop: string;
+ type: string;
+ value: number;
+ defValue: number;
+ desc: string;
+}
+
+/**
+ * ONOS GUI -- Settings View Component
+ */
+@Component({
+ selector: 'onos-settings',
+ templateUrl: './settings.component.html',
+ styleUrls: ['./settings.component.css', '../../../fw/widget/table.css', '../../../fw/widget/table.theme.css']
+})
+
+export class SettingsComponent extends TableBaseImpl implements OnInit, OnDestroy {
+
+ settingsDetails: Settings;
+
+ constructor(
+ protected fs: FnService,
+ protected ls: LoadingService,
+ protected log: LogService,
+ protected wss: WebSocketService
+ ) {
+ super(fs, ls, log, wss, 'setting');
+ this.responseCallback = this.settingsResponseCb;
+ this.parentSelCb = this.rowSelection;
+
+ this.sortParams = {
+ firstCol: 'component',
+ firstDir: SortDir.desc,
+ secondCol: 'prop',
+ secondDir: SortDir.asc,
+ };
+ }
+
+ ngOnInit() {
+ this.init();
+ this.log.debug('SettingsComponent initialized');
+ }
+
+ ngOnDestroy() {
+ this.destroy();
+ this.log.debug('SettingsComponent destroyed');
+ }
+
+ settingsResponseCb(data: SettingsTableResponse) {
+ this.log.debug('Settings response received for ', data.settings.length, 'settings');
+ }
+
+ rowSelection(event: any, row: any) {
+ this.settingsDetails = row;
+ }
+}
diff --git a/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.css b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.css
new file mode 100644
index 0000000..a44eb6a
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.css
@@ -0,0 +1,75 @@
+/*
+ * 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 -- Settings Details Panel (layout) -- CSS file
+ */
+
+#settings-details-panel.floatpanel {
+ z-index: 100;
+ font-size: 10pt;
+ top: 143px;
+ overflow-y: scroll;
+}
+
+#settings-details-panel .container {
+ padding: 0 30px;
+ height: 300px;
+}
+
+#settings-details-panel .container .top-content {
+ padding: 15px;
+}
+
+#settings-details-panel .close-btn {
+ position: absolute;
+ right: 12px;
+ top: 12px;
+ cursor: pointer;
+}
+
+#settings-details-panel .settings-title-1 {
+ width: 90%;
+ height: 25px;
+ font-size: 14pt;
+ font-weight: lighter;
+ overflow: hidden;
+ white-space: nowrap;
+ padding: 0 12px 0 2px;
+ margin-top: 19px;
+ margin-bottom: 5px;
+}
+
+#settings-details-panel .settings-title-2 {
+ width: 90%;
+ height: 52px;
+ font-size: 18pt;
+ font-weight: lighter;
+ overflow: hidden;
+ white-space: nowrap;
+ padding: 0 6px 0 2px;
+ margin-top: 5px;
+ margin-bottom: 5px;
+}
+
+#settings-details-panel td.label {
+ font-weight: bold;
+ text-align: right;
+ padding-right: 6px;
+ font-size: 10pt;
+ vertical-align: top;
+ width: 120px;
+}
diff --git a/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.html b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.html
new file mode 100644
index 0000000..eef4ba2
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.html
@@ -0,0 +1,56 @@
+<!--
+~ 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="settings-details-panel" class="floatpanel" [@settingsDetailsState]="id!=='' && !closed">
+ <div class="container">
+ <div class="top">
+ <onos-icon class="close-btn" classes="active-close" iconId="close" iconSize="20" (click)="close()"></onos-icon>
+ </div>
+ <div class="top-content">
+ <div class="settings-title-1">{{ settingsDetails?.component }}</div>
+ <div class="settings-title-2">{{ settingsDetails?.prop }}</div>
+ <div class="settings-props">
+ <table>
+ <tbody>
+ <tr>
+ <td class="label">Component: </td>
+ <td class="value">{{ settingsDetails?.fqComponent }}</td>
+ </tr>
+ <tr>
+ <td class="label">Property: </td>
+ <td class="value">{{ settingsDetails?.prop }}</td>
+ </tr>
+ <tr>
+ <td class="label">Type: </td>
+ <td class="value">{{ settingsDetails?.type }}</td>
+ </tr>
+ <tr>
+ <td class="label">Value: </td>
+ <td class="value">{{ settingsDetails?.value }}</td>
+ </tr>
+ <tr>
+ <td class="label">Default: </td>
+ <td class="value">{{ settingsDetails?.defValue }}</td>
+ </tr>
+ <tr>
+ <td class="label">Description: </td>
+ <td class="value">{{ settingsDetails?.desc }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.spec.ts b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.spec.ts
new file mode 100644
index 0000000..41200fc
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.spec.ts
@@ -0,0 +1,128 @@
+/*
+* 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 { SettingsDetailsComponent } from './settingsdetails.component';
+import { ActivatedRoute, Params } from '@angular/router';
+import { of } from 'rxjs';
+import { FnService } from '../../../fw/util/fn.service';
+import { LogService } from '../../../log.service';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { IconComponent } from '../../../fw/svg/icon/icon.component';
+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';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+class MockIconService {
+ loadIconDef() { }
+}
+
+class MockWebSocketService {
+ createWebSocket() { }
+ isConnected() { return false; }
+ unbindHandlers() { }
+ bindHandlers() { }
+}
+
+/**
+* ONOS GUI -- Settings Detail Panel View -- Unit Tests
+*/
+describe('SettingsdetailsComponent', () => {
+ let component: SettingsDetailsComponent;
+ let fixture: ComponentFixture<SettingsDetailsComponent>;
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+
+ beforeEach(async(() => {
+ const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+ ar = new MockActivatedRoute({ 'debug': 'panel' });
+ windowMock = <any>{
+ location: <any>{
+ settingsname: 'foo',
+ settings: '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: [SettingsDetailsComponent, 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(SettingsDetailsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should have an onos-icon.close-btn inside a div.top inside a div.container', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div.container div.top onos-icon.close-btn'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.top-content inside a div.container', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div.container div.top-content'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.settings-title-1 inside a div.top-content inside a div.container', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div.container div.top-content div.settings-title-1'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.settings-title-2 inside a div.top-content inside a div.container', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div.container div.top-content div.settings-title-2'));
+ expect(divDe).toBeTruthy();
+ });
+
+ it('should have a div.settings-props inside a div.top-content inside a div.container', () => {
+ const settingsDe: DebugElement = fixture.debugElement;
+ const divDe = settingsDe.query(By.css('div.container div.top-content div.settings-props'));
+ expect(divDe).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.ts b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.ts
new file mode 100644
index 0000000..e818360
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/settings/settingsdetails/settingsdetails.component.ts
@@ -0,0 +1,96 @@
+/*
+* 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, OnInit, Input, OnDestroy, OnChanges } from '@angular/core';
+import { FnService } from '../../../fw/util/fn.service';
+import { DetailsPanelBaseImpl } from '../../../fw/widget/detailspanel.base';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { LogService } from '../../../log.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { trigger, state, style, transition, animate } from '@angular/animations';
+import { Settings } from '../settings/settings.component';
+
+/**
+ * The details view when a host row is clicked from the Settings view
+ *
+ * This is expected to be passed an 'id' and it makes a call
+ * to the WebSocket with an hostDetailsRequest, and gets back an
+ * hostDetailsResponse.
+ *
+ * The animated fly-in is controlled by the animation below
+ * The hostDetailsState is attached to host-details-panel
+ * and is false (flies out) when id='' and true (flies in) when
+ * id has a value
+ */
+@Component({
+ selector: 'onos-settingsdetails',
+ templateUrl: './settingsdetails.component.html',
+ styleUrls: ['./settingsdetails.component.css', '../../../fw/widget/panel.css', '../../../fw/widget/panel-theme.css'],
+ animations: [
+ trigger('settingsDetailsState', [
+ 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 SettingsDetailsComponent extends DetailsPanelBaseImpl implements OnInit, OnDestroy, OnChanges {
+
+ @Input() id: string;
+ @Input() settingsDetails: Settings;
+
+ constructor(
+ protected fs: FnService,
+ protected ls: LoadingService,
+ protected log: LogService,
+ protected wss: WebSocketService
+ ) {
+ super(fs, ls, log, wss, 'setting');
+ }
+
+ ngOnInit() {
+ this.init();
+ this.log.debug('Settings Details Component initialized:', this.id);
+ }
+
+ ngOnDestroy() {
+ this.destroy();
+ this.log.debug('Settings 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);
+ }
+ }
+
+}