First part of migrating Topo2 to GUI2
Change-Id: I316dd34cba161688e01dfb7b340bff5f2c3c57d4
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.css b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.css
new file mode 100644
index 0000000..9dca44c
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.css
@@ -0,0 +1,34 @@
+/*
+ * 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 -- Topology Toolbar Panel -- CSS file
+ */
+#toolbar-topo2-toolbar {
+ padding: 6px;
+}
+
+#toolbar-topo2-toolbar .tbar-row.right {
+ width: 100%;
+}
+
+#toolbar-topo2-toolbar .tbar-row-text {
+ height: 21px;
+ text-align: right;
+ padding: 8px 60px 0 0;
+ font-style: italic;
+}
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.html b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.html
new file mode 100644
index 0000000..a5e4b96
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.html
@@ -0,0 +1,132 @@
+<!--
+~ 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="toolbar-topo2-toolbar" class="floatpanel toolbar"
+ style="opacity: 1; left: 0px; width: 261px; top: auto; bottom: 10px;">
+ <div class="tbar-arrow">
+ <svg class="embeddedIcon" width="10" height="10" viewBox="0 0 50 50">
+ <g class="icon" transform="translate(0 50) rotate(-90)">
+ <rect width="50" height="50" rx="5"></rect>
+ <use width="50" height="50" class="glyph" xlink:href="#triangleUp"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="tbar-row">
+ <div class="toggleButton selected" id="toolbar-topo2-toolbar-topo2-instance-tog">
+ <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="#m_uiAttached"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="toggleButton selected" id="toolbar-topo2-toolbar-topo2-summary-tog">
+ <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="#m_summary"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="toggleButton selected" id="toolbar-topo2-toolbar-details-tog">
+ <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="#m_details"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="separator"></div>
+ <div class="toggleButton" id="toolbar-topo2-toolbar-hosts-tog">
+ <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="#m_endstation"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="toggleButton selected" id="toolbar-topo2-toolbar-offline-tog">
+ <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="#m_switch"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="toggleButton selected" id="toolbar-topo2-toolbar-topo2-ports-tog">
+ <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="#m_ports"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="toggleButton selected" id="toolbar-topo2-toolbar-topo2-bkgrnd-tog">
+ <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="#m_map"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ <br>
+ <div class="tbar-row">
+ <div class="button" id="toolbar-topo2-toolbar-topo2-cycleLabels-btn">
+ <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="#m_cycleLabels"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="button" id="toolbar-topo2-toolbar-topo2-resetZoom-btn">
+ <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="#m_resetZoom"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="separator"></div>
+ <div class="button" id="toolbar-topo2-toolbar-topo2-eqMaster-btn">
+ <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="#m_eqMaster"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="separator"></div>
+ <div class="radioSet" id="toolbar-topo2-toolbar-topo-overlays">
+ <div class="radioButton selected" id="toolbar-topo2-toolbar-topo-overlays-0">
+ <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="#m_unknown"></use>
+ </g>
+ </svg>
+ </div>
+ <div class="radioButton" id="toolbar-topo2-toolbar-topo-overlays-1">
+ <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="#m_allTraffic"></use>
+ </g>
+ </svg>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.spec.ts b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.spec.ts
new file mode 100644
index 0000000..730809c
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.spec.ts
@@ -0,0 +1,81 @@
+/*
+ * 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 { of } from 'rxjs';
+import { ToolbarComponent } from './toolbar.component';
+
+import {
+ FnService,
+ LogService
+} from 'gui2-fw-lib';
+
+class MockActivatedRoute extends ActivatedRoute {
+ constructor(params: Params) {
+ super();
+ this.queryParams = of(params);
+ }
+}
+
+/**
+ * ONOS GUI -- Topology View Topology Panel-- Unit Tests
+ */
+describe('ToolbarComponent', () => {
+ let fs: FnService;
+ let ar: MockActivatedRoute;
+ let windowMock: Window;
+ let logServiceSpy: jasmine.SpyObj<LogService>;
+ let component: ToolbarComponent;
+ let fixture: ComponentFixture<ToolbarComponent>;
+
+ 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: [ ToolbarComponent ],
+ providers: [
+ { provide: FnService, useValue: fs },
+ { provide: LogService, useValue: logSpy },
+ { provide: 'Window', useValue: windowMock },
+ ]
+ })
+ .compileComponents();
+ logServiceSpy = TestBed.get(LogService);
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ToolbarComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.ts b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.ts
new file mode 100644
index 0000000..208cafe
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.component.ts
@@ -0,0 +1,51 @@
+/*
+ * 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 {
+ LogService,
+ LoadingService,
+ FnService,
+ PanelBaseImpl
+} from 'gui2-fw-lib';
+
+/*
+ ONOS GUI -- Topology Toolbar Module.
+ Defines modeling of ONOS toolbar.
+ */
+@Component({
+ selector: 'onos-toolbar',
+ templateUrl: './toolbar.component.html',
+ styleUrls: [
+ './toolbar.component.css', './toolbar.theme.css',
+ '../../topology.common.css',
+ '../../../../fw/widget/panel.css', '../../../../fw/widget/panel-theme.css'
+ ]
+})
+export class ToolbarComponent extends PanelBaseImpl implements OnInit {
+
+ constructor(
+ protected fs: FnService,
+ protected log: LogService,
+ protected ls: LoadingService,
+ ) {
+ super(fs, ls, log);
+ this.log.debug('ToolbarComponent constructed');
+ }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.theme.css b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.theme.css
new file mode 100644
index 0000000..fcd9157
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/topology/panel/toolbar/toolbar.theme.css
@@ -0,0 +1,23 @@
+/*
+ * 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 -- Topology Toolbar Panel -- Theme CSS file
+ */
+.dark #toolbar-topo2-toolbar .tbar-row.right {
+ color: #666;
+}
\ No newline at end of file