Enabled --prod mode for GUI2 - refactored modules
Change-Id: I224fe9564cb225b9ebaed0a43281de54ec6eb274
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
new file mode 100644
index 0000000..3110eca
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/device/device-routing.module.ts
@@ -0,0 +1,37 @@
+/*
+ * 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 { DeviceComponent } from './device.component';
+
+
+const deviceRoutes: Routes = [
+ {
+ path: '',
+ component: DeviceComponent
+ }
+];
+
+/**
+ * ONOS GUI -- Devices Tabular View Feature Routing Module - allows it to be lazy loaded
+ *
+ * See https://angular.io/guide/lazy-loading-ngmodules
+ */
+@NgModule({
+ imports: [RouterModule.forChild(deviceRoutes)],
+ exports: [RouterModule]
+})
+export class DeviceRoutingModule { }
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
index e2d3fda..0e09d69 100644
--- a/web/gui2/src/main/webapp/app/view/device/device.component.html
+++ b/web/gui2/src/main/webapp/app/view/device/device.component.html
@@ -1,3 +1,18 @@
+<!--
+~ 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>
@@ -61,7 +76,7 @@
</tr>
- <tr class="table-body" *ngFor="let dev of tableData; trackBy $index"
+ <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">
diff --git a/web/gui2/src/main/webapp/app/view/device/device.component.ts b/web/gui2/src/main/webapp/app/view/device/device.component.ts
index f4a6fbe..99564d0 100644
--- a/web/gui2/src/main/webapp/app/view/device/device.component.ts
+++ b/web/gui2/src/main/webapp/app/view/device/device.component.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Component, OnInit, OnDestroy } from '@angular/core';
+import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
import { DetailsPanelService } from '../../fw/layer/detailspanel.service';
import { FnService } from '../../fw/util/fn.service';
import { IconService } from '../../fw/svg/icon.service';
@@ -77,7 +77,7 @@
private ps: PanelService,
private tds: TableDetailService,
protected wss: WebSocketService,
- private window: Window,
+ @Inject('Window') private window: Window,
) {
super(fs, ls, log, wss, 'device');
this.responseCallback = this.deviceResponseCb;
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 99b15bd..7840292 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
@@ -15,7 +15,7 @@
*/
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
-import { RouterModule, Routes } from '@angular/router';
+import { DeviceRoutingModule } from './device-routing.module';
import { DeviceComponent } from './device.component';
import { DeviceDetailsPanelDirective } from './devicedetailspanel.directive';
import { SvgModule } from '../../fw/svg/svg.module';
@@ -24,12 +24,9 @@
* ONOS GUI -- Device View Module
*/
@NgModule({
- exports: [
- DeviceComponent
- ],
imports: [
CommonModule,
- RouterModule,
+ DeviceRoutingModule,
SvgModule
],
declarations: [
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
index 13e7e69..d81a67d 100644
--- a/web/gui2/src/main/webapp/app/view/device/devicedetailspanel.directive.ts
+++ b/web/gui2/src/main/webapp/app/view/device/devicedetailspanel.directive.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Directive } from '@angular/core';
+import { Directive, Inject } from '@angular/core';
import { KeyService } from '../../fw/util/key.service';
import { LogService } from '../../log.service';
@@ -31,8 +31,7 @@
constructor(
private ks: KeyService,
- private log: LogService,
- private window: Window
+ private log: LogService
) {
this.log.debug('DeviceDetailsPanelDirective constructed');
}