First part of migrating Topo2 to GUI2
Change-Id: I316dd34cba161688e01dfb7b340bff5f2c3c57d4
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.css b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.css
new file mode 100644
index 0000000..9a35cb3
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.css
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+/* --- Topo Details Panel --- */
+
+#topo2-p-detail {
+ padding: 16px;
+ top: 370px;
+}
+html[data-platform='iPad'] #topo2-p-detail {
+ top: 386px;
+}
+
+#topo2-p-detail .actionBtns .actionBtn {
+ display: inline-block;
+}
+#topo2-p-detail .actionBtns .actionBtn svg {
+ width: 28px;
+ height: 28px;
+}
+
+#topo2-p-detail div.actionBtns {
+ padding-top: 6px;
+}
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.html b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.html
new file mode 100644
index 0000000..1ff43e6
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.html
@@ -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.
+-->
+<div id="topo2-p-detail" class="floatpanel topo2-p"
+ style="opacity: 1; right: 20px; width: 260px; top: 350px;" [@detailsPanelState]="!on">
+ <div class="header">
+ <div class="icon clickable">
+ <svg>
+ <use width="26" height="26" class="glyph" xlink:href="#m_switch"></use>
+ </svg>
+ </div>
+ <h2 class="clickable">rest:10.1.2.2:443</h2>
+ </div>
+ <div class="body">
+ <table>
+ <tbody>
+ <tr>
+ <td class="label">URI :</td>
+ <td class="value">null:0000000000000002</td>
+ </tr>
+ <tr>
+ <td class="label">Vendor :</td>
+ <td class="value">ONF</td>
+ </tr>
+ <tr>
+ <td class="label">H/W Version :</td>
+ <td class="value">0.1</td>
+ </tr>
+ <tr>
+ <td class="label">S/W Version :</td>
+ <td class="value">0.1</td>
+ </tr>
+ <tr>
+ <td class="label">Serial # :</td>
+ <td class="value">1234</td>
+ </tr>
+ <tr>
+ <td class="label">Protocol :</td>
+ <td class="value"></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">Ports :</td>
+ <td class="value">4</td>
+ </tr>
+ <tr>
+ <td class="label">Flows :</td>
+ <td class="value">4</td>
+ </tr>
+ <tr>
+ <td class="label">Tunnels :</td>
+ <td class="value">0</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="footer">
+ <hr>
+ <div class="actionBtns">
+ <div class="actionBtn">
+ <div class="button" id="topo2-p-detail-core-showDeviceView">
+ <svg class="embeddedIcon" width="25" height="25" viewBox="0 0 50 50">
+ <g class="icon">
+ <rect width="50" height="50" rx="5"></rect>
+ <use width="50" height="50" class="glyph" xlink:href="#switch"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ <div class="actionBtn">
+ <div class="button" id="topo2-p-detail-core-showFlowView">
+ <svg class="embeddedIcon" width="25" height="25" viewBox="0 0 50 50">
+ <g class="icon">
+ <rect width="50" height="50" rx="5"></rect>
+ <use width="50" height="50" class="glyph" xlink:href="#flowTable"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ <div class="actionBtn">
+ <div class="button" id="topo2-p-detail-core-showPortView">
+ <svg class="embeddedIcon" width="25" height="25" viewBox="0 0 50 50">
+ <g class="icon">
+ <rect width="50" height="50" rx="5"></rect>
+ <use width="50" height="50" class="glyph" xlink:href="#portTable"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ <div class="actionBtn">
+ <div class="button" id="topo2-p-detail-core-showGroupView">
+ <svg class="embeddedIcon" width="25" height="25" viewBox="0 0 50 50">
+ <g class="icon">
+ <rect width="50" height="50" rx="5"></rect>
+ <use width="50" height="50" class="glyph" xlink:href="#groupTable"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ <div class="actionBtn">
+ <div class="button" id="topo2-p-detail-core-showMeterView">
+ <svg class="embeddedIcon" width="25" height="25" viewBox="0 0 50 50">
+ <g class="icon">
+ <rect width="50" height="50" rx="5"></rect>
+ <use width="50" height="50" class="glyph" xlink:href="#meterTable"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.spec.ts b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.spec.ts
new file mode 100644
index 0000000..0c0c269
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.spec.ts
@@ -0,0 +1,84 @@
+/*
+ * 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 { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { of } from 'rxjs';
+import { DetailsComponent } from './details.component';
+
+import {
+ FnService,
+ LogService
+} from 'gui2-fw-lib';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+/**
+ * ONOS GUI -- Topology View Details Panel-- Unit Tests
+ */
+describe('DetailsComponent', () => {
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+ let component: DetailsComponent;
+ let fixture: ComponentFixture<DetailsComponent>;
+
+ 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 ],
+ declarations: [ DetailsComponent ],
+ providers: [
+ { provide: FnService, useValue: fs },
+ { provide: LogService, useValue: logSpy },
+ { provide: 'Window', useValue: windowMock },
+ ]
+ })
+ .compileComponents();
+ logServiceSpy = TestBed.get(LogService);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DetailsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.ts b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.ts
new file mode 100644
index 0000000..c8bf95b
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.component.ts
@@ -0,0 +1,68 @@
+/*
+ * 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 } from '@angular/core';
+import { animate, state, style, transition, trigger } from '@angular/animations';
+import {
+ LogService,
+ LoadingService,
+ FnService,
+ DetailsPanelBaseImpl,
+ WebSocketService
+} from 'gui2-fw-lib';
+
+/*
+ ONOS GUI -- Topology Details Panel.
+ Displays details of selected device.
+ */
+@Component({
+ selector: 'onos-details',
+ templateUrl: './details.component.html',
+ styleUrls: [
+ './details.component.css', './details.theme.css',
+ '../../topology.common.css',
+ '../../../../fw/widget/panel.css', '../../../../fw/widget/panel-theme.css'
+ ],
+ animations: [
+ trigger('detailsPanelState', [
+ state('true', style({
+ transform: 'translateX(0%)',
+ opacity: '100'
+ })),
+ state('false', style({
+ transform: 'translateX(100%)',
+ opacity: '0'
+ })),
+ transition('0 => 1', animate('100ms ease-in')),
+ transition('1 => 0', animate('100ms ease-out'))
+ ])
+ ]
+})
+export class DetailsComponent extends DetailsPanelBaseImpl implements OnInit {
+
+ constructor(
+ protected fs: FnService,
+ protected log: LogService,
+ protected ls: LoadingService,
+ protected wss: WebSocketService,
+ ) {
+ super(fs, ls, log, wss, 'topo');
+ this.log.debug('InstanceComponent constructed');
+ }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/details/details.theme.css b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.theme.css
new file mode 100644
index 0000000..7ad72dd
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/details/details.theme.css
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+/* --- Topo Details Panel Theme --- */
+
+#topo2-p-detail svg {
+ background: none;
+}
+
+#topo2-p-detail .header svg .glyph {
+ fill: #c0242b;
+}
+
+.dark #topo2-p-detail .header svg .glyph {
+ fill: #91292f;
+}
\ No newline at end of file