Enabled --prod mode for GUI2 - refactored modules
Change-Id: I224fe9564cb225b9ebaed0a43281de54ec6eb274
diff --git a/web/gui2/src/main/webapp/app/fw/layer/layer.module.ts b/web/gui2/src/main/webapp/app/fw/layer/layer.module.ts
index 6292a8d..b4e39b2 100644
--- a/web/gui2/src/main/webapp/app/fw/layer/layer.module.ts
+++ b/web/gui2/src/main/webapp/app/fw/layer/layer.module.ts
@@ -15,7 +15,6 @@
*/
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
-import { UtilModule } from '../util/util.module';
import { FlashComponent } from './flash/flash.component';
import { DetailsPanelService } from './detailspanel.service';
@@ -35,8 +34,7 @@
VeilComponent
],
imports: [
- CommonModule,
- UtilModule
+ CommonModule
],
declarations: [
FlashComponent,
diff --git a/web/gui2/src/main/webapp/app/fw/mast/mast/mast.component.html b/web/gui2/src/main/webapp/app/fw/mast/mast/mast.component.html
index 94d8ce0..e7d0995 100644
--- a/web/gui2/src/main/webapp/app/fw/mast/mast/mast.component.html
+++ b/web/gui2/src/main/webapp/app/fw/mast/mast/mast.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="mast" align="left">
<span class="nav-menu-button clickable" (click)="ns.toggleNav()">
<img src="data/img/nav-menu-mojo.png"/>
diff --git a/web/gui2/src/main/webapp/app/fw/nav/nav.module.ts b/web/gui2/src/main/webapp/app/fw/nav/nav.module.ts
index 95a3c31..d25237f 100644
--- a/web/gui2/src/main/webapp/app/fw/nav/nav.module.ts
+++ b/web/gui2/src/main/webapp/app/fw/nav/nav.module.ts
@@ -17,6 +17,7 @@
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { SvgModule } from '../svg/svg.module';
+import { OnosRoutingModule } from '../../onos-routing.module';
import { NavComponent } from './nav/nav.component';
import { NavService } from './nav.service';
@@ -30,6 +31,7 @@
@NgModule({
imports: [
CommonModule,
+ OnosRoutingModule,
RouterModule,
SvgModule
],
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 a612214..f61a9ab 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
@@ -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.
+-->
<nav id="nav" [@navState]="ns.showNav?'active':'inactive'">
<div class="nav-hdr">Platform</div>
<a (click)="ns.hideNav()" routerLink="/apps" routerLinkActive="active">
diff --git a/web/gui2/src/main/webapp/app/fw/remote/remote.module.ts b/web/gui2/src/main/webapp/app/fw/remote/remote.module.ts
deleted file mode 100644
index 179988d..0000000
--- a/web/gui2/src/main/webapp/app/fw/remote/remote.module.ts
+++ /dev/null
@@ -1,42 +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 { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { SvgModule } from '../svg/svg.module';
-import { UtilModule } from '../util/util.module';
-
-import { UrlFnService } from './urlfn.service';
-import { WebSocketService } from './websocket.service';
-import { WSock } from './wsock.service';
-import { RestService } from './rest.service';
-
-/**
- * ONOS GUI -- Remote Communications Module
- */
-@NgModule({
- imports: [
- CommonModule,
- SvgModule,
- UtilModule
- ],
- providers: [
- RestService,
- UrlFnService,
- WebSocketService,
- WSock
- ]
-})
-export class RemoteModule { }
diff --git a/web/gui2/src/main/webapp/app/fw/remote/rest.service.ts b/web/gui2/src/main/webapp/app/fw/remote/rest.service.ts
index 2d6bfa2..6fec638 100644
--- a/web/gui2/src/main/webapp/app/fw/remote/rest.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/remote/rest.service.ts
@@ -21,7 +21,9 @@
/**
* ONOS GUI -- Remote Communications Module -- REST Service
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class RestService {
constructor(
diff --git a/web/gui2/src/main/webapp/app/fw/remote/urlfn.service.ts b/web/gui2/src/main/webapp/app/fw/remote/urlfn.service.ts
index 381a0c9..363663a 100644
--- a/web/gui2/src/main/webapp/app/fw/remote/urlfn.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/remote/urlfn.service.ts
@@ -29,7 +29,7 @@
export class UrlFnService {
constructor(
private log: LogService,
- @Inject(Window) private w: Window
+ @Inject('Window') private w: Window
) {
this.log.debug('UrlFnService constructed');
}
diff --git a/web/gui2/src/main/webapp/app/fw/remote/websocket.service.ts b/web/gui2/src/main/webapp/app/fw/remote/websocket.service.ts
index 34a8ea9..18dd734 100644
--- a/web/gui2/src/main/webapp/app/fw/remote/websocket.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/remote/websocket.service.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Injectable } from '@angular/core';
+import { Injectable, Inject } from '@angular/core';
import { FnService } from '../util/fn.service';
import { GlyphService } from '../svg/glyph.service';
import { LogService } from '../../log.service';
@@ -129,7 +129,7 @@
private log: LogService,
private ufs: UrlFnService,
private wsock: WSock,
- private window: Window
+ @Inject('Window') private window: Window
) {
this.log.debug(window.location.hostname);
diff --git a/web/gui2/src/main/webapp/app/fw/svg/svg.module.ts b/web/gui2/src/main/webapp/app/fw/svg/svg.module.ts
index 3174263..bf2d1d9 100644
--- a/web/gui2/src/main/webapp/app/fw/svg/svg.module.ts
+++ b/web/gui2/src/main/webapp/app/fw/svg/svg.module.ts
@@ -15,7 +15,6 @@
*/
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
-import { UtilModule } from '../util/util.module';
import { GeoDataService } from './geodata.service';
import { GlyphService } from './glyph.service';
@@ -35,8 +34,7 @@
IconComponent
],
imports: [
- CommonModule,
- UtilModule
+ CommonModule
],
declarations: [
IconComponent
diff --git a/web/gui2/src/main/webapp/app/fw/util/ee.service.ts b/web/gui2/src/main/webapp/app/fw/util/ee.service.ts
index c16e4d1..8e1d87c 100644
--- a/web/gui2/src/main/webapp/app/fw/util/ee.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/util/ee.service.ts
@@ -19,7 +19,9 @@
/**
* ONOS GUI -- Util -- EE functions
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class EeService {
constructor(
diff --git a/web/gui2/src/main/webapp/app/fw/util/fn.service.ts b/web/gui2/src/main/webapp/app/fw/util/fn.service.ts
index 7b9ea24..d0307e3 100644
--- a/web/gui2/src/main/webapp/app/fw/util/fn.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/util/fn.service.ts
@@ -149,7 +149,9 @@
/**
* ONOS GUI -- Util -- General Purpose Functions
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class FnService {
// internal state
private debugFlags = new Map<string, boolean>([
@@ -159,14 +161,14 @@
constructor(
private route: ActivatedRoute,
private log: LogService,
- @Inject(Window) private w: Window
+ @Inject('Window') private w: Window
) {
this.route.queryParams.subscribe(params => {
const debugparam: string = params['debug'];
log.debug('Param:', debugparam);
this.parseDebugFlags(debugparam);
});
- log.debug('FnService constructed');
+ this.log.debug('FnService constructed');
}
/**
diff --git a/web/gui2/src/main/webapp/app/fw/util/key.service.ts b/web/gui2/src/main/webapp/app/fw/util/key.service.ts
index b10b643..1eaa895 100644
--- a/web/gui2/src/main/webapp/app/fw/util/key.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/util/key.service.ts
@@ -20,7 +20,9 @@
/**
* ONOS GUI -- Util -- Key Handler Service
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class KeyService {
constructor(
diff --git a/web/gui2/src/main/webapp/app/fw/util/prefs.service.ts b/web/gui2/src/main/webapp/app/fw/util/prefs.service.ts
index 3cef9b6..f696125 100644
--- a/web/gui2/src/main/webapp/app/fw/util/prefs.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/util/prefs.service.ts
@@ -21,7 +21,9 @@
/**
* ONOS GUI -- Util -- User Preference Service
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class PrefsService {
constructor(
diff --git a/web/gui2/src/main/webapp/app/fw/util/random.service.ts b/web/gui2/src/main/webapp/app/fw/util/random.service.ts
index 5ec71b5..d808e48 100644
--- a/web/gui2/src/main/webapp/app/fw/util/random.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/util/random.service.ts
@@ -20,7 +20,9 @@
/**
* ONOS GUI -- Random -- Encapsulated randomness
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class RandomService {
constructor(
diff --git a/web/gui2/src/main/webapp/app/fw/util/theme.service.ts b/web/gui2/src/main/webapp/app/fw/util/theme.service.ts
index e5c9564..fe85766 100644
--- a/web/gui2/src/main/webapp/app/fw/util/theme.service.ts
+++ b/web/gui2/src/main/webapp/app/fw/util/theme.service.ts
@@ -20,7 +20,9 @@
/**
* ONOS GUI -- Util -- Theme Service
*/
-@Injectable()
+@Injectable({
+ providedIn: 'root',
+})
export class ThemeService {
themes: string[] = ['light', 'dark'];
thidx = 0;
diff --git a/web/gui2/src/main/webapp/app/fw/util/util.module.ts b/web/gui2/src/main/webapp/app/fw/util/util.module.ts
deleted file mode 100644
index 293d8e9..0000000
--- a/web/gui2/src/main/webapp/app/fw/util/util.module.ts
+++ /dev/null
@@ -1,45 +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.
- */
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-
-import { EeService } from './ee.service';
-import { FnService } from './fn.service';
-import { KeyService } from './key.service';
-import { LionService } from './lion.service';
-import { PrefsService } from './prefs.service';
-import { RandomService } from './random.service';
-import { ThemeService } from './theme.service';
-
-/**
- * ONOS GUI -- Utilities Module
- */
-@NgModule({
- imports: [
- CommonModule
- ],
- declarations: [],
- providers: [
- EeService,
- FnService,
- KeyService,
- LionService,
- PrefsService,
- RandomService,
- ThemeService
- ]
-})
-export class UtilModule { }
diff --git a/web/gui2/src/main/webapp/app/fw/widget/widget.module.ts b/web/gui2/src/main/webapp/app/fw/widget/widget.module.ts
index 02393a9..50d013c 100644
--- a/web/gui2/src/main/webapp/app/fw/widget/widget.module.ts
+++ b/web/gui2/src/main/webapp/app/fw/widget/widget.module.ts
@@ -16,9 +16,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LayerModule } from '../layer/layer.module';
-import { RemoteModule } from '../remote/remote.module';
import { SvgModule } from '../svg/svg.module';
-import { UtilModule } from '../util/util.module';
import { ButtonService } from './button.service';
import { ChartBuilderService } from './chartbuilder.service';