Enabled --prod mode for GUI2 - refactored modules

Change-Id: I224fe9564cb225b9ebaed0a43281de54ec6eb274
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps-routing.module.ts b/web/gui2/src/main/webapp/app/view/apps/apps-routing.module.ts
new file mode 100644
index 0000000..2fed90d
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/apps-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 { AppsComponent } from './apps.component';
+
+
+const appsRoutes: Routes = [
+    {
+        path: '',
+        component: AppsComponent
+    }
+];
+
+/**
+ * ONOS GUI -- Apps Tabular View Feature Routing Module - allows it to be lazy loaded
+ *
+ * See https://angular.io/guide/lazy-loading-ngmodules
+ */
+@NgModule({
+    imports: [RouterModule.forChild(appsRoutes)],
+    exports: [RouterModule]
+})
+export class AppsRoutingModule { }
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps.component.html b/web/gui2/src/main/webapp/app/view/apps/apps.component.html
index 6397f63..c34694c 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps.component.html
+++ b/web/gui2/src/main/webapp/app/view/apps/apps.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-app" filedrop on-file-drop="appDropped()">
     <div class="tabular-header">
         <h2>
@@ -77,7 +92,7 @@
                 </td>
             </tr>
             <!--&lt;!&ndash;TODO: Add back in  | filter:queryFilter&ndash;&gt;-->
-            <tr class="table-body" *ngFor="let app of tableData; trackBy $index"
+            <tr class="table-body" *ngFor="let app of tableData"
                 (click)="selectCallback($event, app)"
                 [ngClass]="{selected: app.id === selId, 'data-change': isChanged(app.id)}">
                 <td class="table-icon">
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps.component.ts b/web/gui2/src/main/webapp/app/view/apps/apps.component.ts
index b2bb38b..ed6d30a 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps.component.ts
+++ b/web/gui2/src/main/webapp/app/view/apps/apps.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 { DialogService } from '../../fw/layer/dialog.service';
 import { FnService } from '../../fw/util/fn.service';
 import { IconService } from '../../fw/svg/icon.service';
@@ -97,6 +97,14 @@
     friendlyProps: string[];
     ctrlBtnState: CtrlBtnState;
     detailsPanel: any;
+    appFile: any;
+    activateImmediately = '';
+
+    uploadTip: string;
+    activateTip: string;
+    deactivateTip: string;
+    uninstallTip: string;
+    downloadTip: string;
 
     constructor(
         protected fs: FnService,
@@ -109,7 +117,7 @@
         private ps: PanelService,
         private ufs: UrlFnService,
         protected wss: WebSocketService,
-        private window: Window,
+        @Inject('Window') private window: Window,
     ) {
         super(fs, null, log, wss, 'app');
         this.responseCallback = this.appResponseCb;
@@ -130,6 +138,11 @@
         } else {
             this.doLion();
         }
+        this.uploadTip = this.lionFn('tt_ctl_upload');
+        this.activateTip = this.lionFn('tt_ctl_activate');
+        this.deactivateTip = this.lionFn('tt_ctl_deactivate');
+        this.uninstallTip = this.lionFn('tt_ctl_uninstall');
+        this.downloadTip = this.lionFn('tt_ctl_download');
     }
 
     ngOnInit() {
@@ -244,4 +257,10 @@
     dummyLion(key: string): string {
         return '%' + key + '%';
     }
+
+    appDropped() {
+        this.activateImmediately = activateOption;
+//        $scope.$emit('FileChanged'); // TODO: Implement this
+        this.appFile = null;
+    }
 }
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps.module.ts b/web/gui2/src/main/webapp/app/view/apps/apps.module.ts
index 3e3d5c4..48092a9 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps.module.ts
+++ b/web/gui2/src/main/webapp/app/view/apps/apps.module.ts
@@ -15,6 +15,7 @@
  */
 import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
+import { AppsRoutingModule } from './apps-routing.module';
 import { AppsComponent } from './apps.component';
 import { TriggerFormDirective } from './triggerform.directive';
 import { SvgModule } from '../../fw/svg/svg.module';
@@ -27,11 +28,9 @@
  * the 'app' folder which is the root of the complete framework
  */
 @NgModule({
-    exports: [
-        AppsComponent
-    ],
     imports: [
         CommonModule,
+        AppsRoutingModule,
         SvgModule
     ],
     declarations: [
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');
     }