Added in panel support - details panels

Change-Id: I2803edd6fe12cb0d97a2d3c45a692ea701786dd2
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
index 2fed90d..1d4f483 100644
--- 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
@@ -15,7 +15,7 @@
  */
 import { NgModule } from '@angular/core';
 import { Routes, RouterModule } from '@angular/router';
-import { AppsComponent } from './apps.component';
+import { AppsComponent } from './apps/apps.component';
 
 
 const appsRoutes: Routes = [
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
deleted file mode 100644
index c34694c..0000000
--- a/web/gui2/src/main/webapp/app/view/apps/apps.component.html
+++ /dev/null
@@ -1,115 +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.
--->
-<div id="ov-app" filedrop on-file-drop="appDropped()">
-    <div class="tabular-header">
-        <h2>
-            {{lionFn('title_apps')}}
-            ({{ tableData.length }}
-            {{ lionFn('total') }})
-        </h2>
-        <div class="ctrl-btns">
-            <div class="refresh" (click)="toggleRefresh()">
-                <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}"
-                           iconId="refresh" iconSize="42" toolTip="{{ autoRefreshTip }}"></onos-icon>
-            </div>
-            <div class="separator"></div>
-
-            <!--<form id="inputFileForm">-->
-                <!--<input id="uploadFile"-->
-                       <!--type="file" size="50" accept=".oar,.jar"-->
-                       <!--file-model="appFile">-->
-            <!--</form>-->
-
-            <div class="active" trigger-form>
-                <onos-icon classes="{{ 'active upload' }}"
-                        iconId="upload" iconSize="42" toolTip="{{ uploadTip }}"></onos-icon>
-            </div>
-            <div (click)="appAction('activate')">
-                <onos-icon classes="{{ ctrlBtnState.installed?'active play':'play' }}"
-                           iconId="play" iconSize="42" toolTip="{{ activateTip }}"></onos-icon>
-            </div>
-            <div (click)="appAction('deactivate')">
-                <onos-icon classes="{{ ctrlBtnState.active?'active stop':'stop' }}"
-                        iconId="stop" iconSize="42" toolTip="{{ deactivateTip }}"></onos-icon>
-            </div>
-            <div (click)="appAction('uninstall')">
-                 <!--[ngClass]="{active: ctrlBtnState.selection}">-->
-                <!--tooltip tt-msg="uninstallTip"-->
-                <onos-icon classes="{{ ctrlBtnState.selection?'active garbage':'garbage' }}"
-                        iconId="garbage" iconSize="42" toolTip="{{ uninstallTip }}"></onos-icon>
-            </div>
-            <div (click)="downloadApp()">
-                <onos-icon classes="{{ ctrlBtnState.selection?'active download':'download' }}"
-                        iconId="download" iconSize="42" toolTip="{{ downloadTip }}"></onos-icon>
-            </div>
-        </div>
-
-        <!--<div class="search">-->
-            <!--<input type="text" ng-model="queryTxt" placeholder="Search"/>-->
-            <!--<select ng-model="queryBy">-->
-                <!--<option value="" disabled>Search By</option>-->
-                <!--<option value="$">All Fields</option>-->
-                <!--<option value="title">{{lionFn('title')}}</option>-->
-                <!--<option value="id">{{lionFn('app_id')}}</option>-->
-                <!--<option value="version">{{lionFn('version')}}</option>-->
-                <!--<option value="category">{{lionFn('category')}}</option>-->
-                <!--<option value="apporiginName">{{lionFn('origin')}}</option>-->
-
-            <!--</select>-->
-        <!--</div>-->
-
-
-    </div>
-
-    <div class="summary-list" onos-table-resize>
-        <table onos-flash-changes id-prop="id" width="100%">
-            <tr class="table-header">
-                <th colId="state" class="table-icon" sortable></th>
-                <th colId="icon" class="table-icon"></th>
-                <th colId="title" [ngClass]="{width: '340'}" sortable> {{lionFn('title')}} </th>
-                <th colId="id" [ngClass]="{width: '320px'}"sortable> {{lionFn('app_id')}} </th>
-                <th colId="version" [ngClass]="{width: '140px'}"sortable> {{lionFn('version')}} </th>
-                <th colId="category" [ngClass]="{width: '136px'}"sortable> {{lionFn('category')}} </th>
-                <th colId="origin" sortable> {{lionFn('origin')}} </th>
-            </tr>
-
-            <tr *ngIf="tableData.length === 0" class="no-data">
-                <td colspan="5">
-                    {{annots.no_rows_msg}}
-                </td>
-            </tr>
-            <!--&lt;!&ndash;TODO: Add back in  | filter:queryFilter&ndash;&gt;-->
-            <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">
-                    <onos-icon iconId="{{app._iconid_state}}"></onos-icon>
-                </td>
-                <td class="table-icon">
-                    <!--<img data-ng-src="./rs/applications/{{app.icon}}/icon"-->
-                                            <!--height="24px" width="24px" />-->
-                </td>
-                <td>{{ app.title }}</td>
-                <td>{{ app.id }}</td>
-                <td>{{ app.version }}</td>
-                <td>{{ app.category }}</td>
-                <td>{{ app.origin }}</td>
-            </tr>
-        </table>
-
-    </div>
-
-</div>
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 48092a9..0f38dbc 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,10 +15,13 @@
  */
 import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
 import { AppsRoutingModule } from './apps-routing.module';
-import { AppsComponent } from './apps.component';
+import { AppsComponent } from './apps/apps.component';
+import { AppsDetailsComponent } from './appsdetails/appsdetails.component';
 import { TriggerFormDirective } from './triggerform.directive';
 import { SvgModule } from '../../fw/svg/svg.module';
+import { WidgetModule } from '../../fw/widget/widget.module';
 
 /**
  * ONOS GUI -- Apps View Module
@@ -31,10 +34,13 @@
     imports: [
         CommonModule,
         AppsRoutingModule,
-        SvgModule
+        SvgModule,
+        WidgetModule,
+        FormsModule
     ],
     declarations: [
         AppsComponent,
+        AppsDetailsComponent,
         TriggerFormDirective
     ]
 })
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.css b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.css
new file mode 100644
index 0000000..5813f30
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.css
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/*
+ ONOS GUI -- Applications View (layout) -- CSS file
+ */
+
+#ov-app h2 {
+    display: inline-block;
+}
+
+#ov-app div.ctrl-btns {
+    width: 290px;
+}
+
+/* -- Drag-n-Drop oar file upload -- */
+#ov-app form#inputFileForm,
+#ov-app input#uploadFile {
+    display: none;
+}
+
+.dropping {
+
+}
+
+/* -- Confirmation Dialog -- */
+#app-dialog {
+    top: 140px;
+    padding: 12px;
+}
+
+#app-dialog p {
+    font-size: 12pt;
+}
+
+#app-dialog p.strong {
+    font-weight: bold;
+    padding: 8px;
+    text-align: center;
+}
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html
new file mode 100644
index 0000000..1c4a22f
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html
@@ -0,0 +1,137 @@
+<!--
+~ 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>
+            {{lionFn('title_apps')}}
+            ({{ tableData.length }}
+            {{ lionFn('total') }})
+        </h2>
+        <div class="ctrl-btns">
+            <div class="refresh" (click)="toggleRefresh()">
+                <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}"
+                           iconId="refresh" iconSize="42" toolTip="{{ autoRefreshTip }}"></onos-icon>
+            </div>
+            <div class="separator"></div>
+
+            <!--<form id="inputFileForm">-->
+                <!--<input id="uploadFile"-->
+                       <!--type="file" size="50" accept=".oar,.jar"-->
+                       <!--file-model="appFile">-->
+            <!--</form>-->
+
+            <div class="active" trigger-form>
+                <onos-icon classes="{{ 'active upload' }}"
+                        iconId="upload" iconSize="42" toolTip="{{ uploadTip }}"></onos-icon>
+            </div>
+            <div (click)="appAction('activate')">
+                <onos-icon classes="{{ ctrlBtnState.installed?'active play':'play' }}"
+                           iconId="play" iconSize="42" toolTip="{{ activateTip }}"></onos-icon>
+            </div>
+            <div (click)="appAction('deactivate')">
+                <onos-icon classes="{{ ctrlBtnState.active?'active stop':'stop' }}"
+                        iconId="stop" iconSize="42" toolTip="{{ deactivateTip }}"></onos-icon>
+            </div>
+            <div (click)="appAction('uninstall')">
+                 <!--[ngClass]="{active: ctrlBtnState.selection}">-->
+                <!--tooltip tt-msg="uninstallTip"-->
+                <onos-icon classes="{{ ctrlBtnState.selection?'active garbage':'garbage' }}"
+                        iconId="garbage" iconSize="42" toolTip="{{ uninstallTip }}"></onos-icon>
+            </div>
+            <div (click)="downloadApp()">
+                <onos-icon classes="{{ ctrlBtnState.selection?'active download':'download' }}"
+                        iconId="download" iconSize="42" toolTip="{{ downloadTip }}"></onos-icon>
+            </div>
+        </div>
+        <div class="search">
+            <input id="searchinput" [(ngModel)]="tableDataFilter.queryStr" type="search" #search placeholder="Search"/>
+                   <!--(keyup)="onSearch(search.value)" (search)="onSearch(search.value)"/>-->
+            <select [(ngModel)]="tableDataFilter.queryBy">
+                <!--(change)="onSearchBy($event)" (change)="search.value = ''">-->
+                <option value="" disabled>Search By</option>
+                <option value="$">All Fields</option>
+                <option value="title">{{lionFn('title')}}</option>
+                <option value="id">{{lionFn('app_id')}}</option>
+                <option value="version">{{lionFn('version')}}</option>
+                <option value="category">{{lionFn('category')}}</option>
+                <option value="origin">{{lionFn('origin')}}</option>
+            </select>
+        </div>
+
+    </div>
+
+    <div class="summary-list" onos-table-resize>
+        <table onos-flash-changes id-prop="id" width="100%">
+            <tr class="table-header">
+                <th colId="state" [ngStyle]="{width: '32px'}" class="table-icon" (click)="onSort('state')">
+                    <onos-icon classes="active" [iconId]="sortIcon('state')"></onos-icon>
+                </th>
+                <th colId="icon" [ngStyle]="{width: '32px'}" class="table-icon"></th>
+                <th colId="title"  (click)="onSort('title')">{{lionFn('title')}}
+                    <onos-icon classes="active" [iconId]="sortIcon('title')"></onos-icon>
+                </th>
+                <th colId="id" (click)="onSort('id')">{{lionFn('app_id')}}
+                    <onos-icon classes="active" [iconId]="sortIcon('id')"></onos-icon>
+                </th>
+                <th colId="version" (click)="onSort('version')"> {{lionFn('version')}}
+                    <onos-icon classes="active" [iconId]="sortIcon('version')"></onos-icon>
+                </th>
+                <th colId="category" (click)="onSort('category')"> {{lionFn('category')}}
+                    <onos-icon classes="active" [iconId]="sortIcon('category')"></onos-icon>
+                </th>
+                <th colId="origin" (click)="onSort('origin')"> {{lionFn('origin')}}
+                    <onos-icon classes="active" [iconId]="sortIcon('origin')"></onos-icon>
+                </th>
+            </tr>
+
+            <tr *ngIf="tableData.length === 0" class="no-data">
+                <td colspan="5">
+                    {{annots.no_rows_msg}}
+                </td>
+            </tr>
+            <!-- See https://angular.io/guide/pipes#appendix-no-filterpipe-or-orderbypipe
+                Angular has dropped the filter and order by pipe that were present in
+                AngularJS - filter and sort the data at source instead -->
+            <tr class="table-body" *ngFor="let app of tableData | filter: tableDataFilter"
+                (click)="selectCallback($event, app)"
+                [ngClass]="{selected: app.id === selId, 'data-change': isChanged(app.id)}">
+                <td class="table-icon">
+                    <onos-icon iconId="{{app._iconid_state}}"></onos-icon>
+                </td>
+                <td class="table-icon">
+                    <!-- The path below gets the app icon from the old GUI path -->
+                    <img src="../../ui/rs/applications/{{app.icon}}/icon"
+                                            height="24px" width="24px" />
+                </td>
+                <td>{{ app.title }}</td>
+                <td>{{ app.id }}</td>
+                <td>{{ app.version }}</td>
+                <td>{{ app.category }}</td>
+                <td>{{ app.origin }}</td>
+            </tr>
+        </table>
+
+    </div>
+    <!-- There are 2 ways this component can be included
+     1) Insert it in to the ngFor above and have it created as the row is rendered
+        for the row that has a selId != '' OR
+     2) Include it here and let selId dictate its state
+     The advantage in 2) is that panel can be animated in and out, as it is not
+     killed every time the selection changes.
+     -->
+    <onos-appsdetails  class="floatpanels" id="{{ selId }}"></onos-appsdetails>
+
+</div>
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.spec.ts b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.spec.ts
new file mode 100644
index 0000000..1889a44
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.spec.ts
@@ -0,0 +1,177 @@
+/*
+ * 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 { FormsModule } from '@angular/forms';
+import { DebugElement } from '@angular/core';
+import { By } from '@angular/platform-browser';
+
+import { LogService } from '../../../log.service';
+import { AppsComponent } from './apps.component';
+import { AppsDetailsComponent } from '../appsdetails/appsdetails.component';
+import { DialogService } from '../../../fw/layer/dialog.service';
+import { FnService } from '../../../fw/util/fn.service';
+import { IconComponent } from '../../../fw/svg/icon/icon.component';
+import { IconService } from '../../../fw/svg/icon.service';
+import { KeyService } from '../../../fw/util/key.service';
+import { LionService } from '../../../fw/util/lion.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { ThemeService } from '../../../fw/util/theme.service';
+import { TableFilterPipe } from '../../../fw/widget/tablefilter.pipe';
+import { UrlFnService } from '../../../fw/remote/urlfn.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { of } from 'rxjs';
+
+class MockActivatedRoute extends ActivatedRoute {
+    constructor(params: Params) {
+        super();
+        this.queryParams = of(params);
+    }
+}
+
+class MockDialogService {}
+
+class MockFnService {}
+
+class MockIconService {
+    loadIconDef() {}
+}
+
+class MockKeyService {}
+
+class MockLoadingService {
+    startAnim() {}
+    stop() {}
+    waiting() {}
+}
+
+class MockThemeService {}
+
+class MockUrlFnService {}
+
+class MockWebSocketService {
+    createWebSocket() {}
+    isConnected() { return false; }
+    unbindHandlers() {}
+    bindHandlers() {}
+}
+
+/**
+ * ONOS GUI -- Apps View -- Unit Tests
+ */
+describe('AppsComponent', () => {
+    let fs: FnService;
+    let ar: MockActivatedRoute;
+    let windowMock: Window;
+    let logServiceSpy: jasmine.SpyObj<LogService>;
+    let component: AppsComponent;
+    let fixture: ComponentFixture<AppsComponent>;
+    const bundleObj = {
+        'core.view.App': {
+            test: 'test1'
+        }
+    };
+    const mockLion = (key) =>  {
+        return bundleObj[key] || '%' + key + '%';
+    };
+
+    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, FormsModule ],
+            declarations: [ AppsComponent, IconComponent, AppsDetailsComponent, TableFilterPipe ],
+            providers: [
+                { provide: DialogService, useClass: MockDialogService },
+                { provide: FnService, useValue: fs },
+                { provide: IconService, useClass: MockIconService },
+                { provide: KeyService, useClass: MockKeyService },
+                { provide: LionService, useFactory: (() => {
+                        return {
+                            bundle: ((bundleId) => mockLion),
+                            ubercache: new Array(),
+                            loadCbs: new Map<string, () => void>([])
+                        };
+                    })
+                },
+                { provide: LoadingService, useClass: MockLoadingService },
+                { provide: LogService, useValue: logSpy },
+                { provide: ThemeService, useClass: MockThemeService },
+                { provide: UrlFnService, useClass: MockUrlFnService },
+                { provide: WebSocketService, useClass: MockWebSocketService },
+                { provide: 'Window', useValue: windowMock },
+            ]
+        })
+        .compileComponents();
+        logServiceSpy = TestBed.get(LogService);
+    }));
+
+    beforeEach(() => {
+        fixture = TestBed.createComponent(AppsComponent);
+        component = fixture.debugElement.componentInstance;
+        fixture.detectChanges();
+    });
+
+    it('should create', () => {
+        expect(component).toBeTruthy();
+    });
+
+    it('should have a div.tabular-header inside a div#ov-app', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div#ov-app div.tabular-header'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a h2 inside the div.tabular-header', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div#ov-app div.tabular-header h2'));
+        const div: HTMLElement = divDe.nativeElement;
+        expect(div.textContent).toEqual(' %title_apps% (0 %total%) ');
+    });
+
+    it('should have a refresh button inside the div.tabular-header', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div#ov-app div.tabular-header div.ctrl-btns div.refresh'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have an active button inside the div.tabular-header', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div#ov-app div.tabular-header div.ctrl-btns div.active'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a div.summary-list inside a div#ov-app', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div#ov-app div.summary-list'));
+        expect(divDe).toBeTruthy();
+    });
+});
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps.component.ts b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts
similarity index 73%
rename from web/gui2/src/main/webapp/app/view/apps/apps.component.ts
rename to web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts
index ed6d30a..79fa310 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps.component.ts
+++ b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts
@@ -14,17 +14,17 @@
  * limitations under the License.
  */
 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';
-import { KeyService } from '../../fw/util/key.service';
-import { LionService } from '../../fw/util/lion.service';
-import { LoadingService } from '../../fw/layer/loading.service';
-import { LogService } from '../../log.service';
-import { PanelService } from '../../fw/layer/panel.service';
-import { TableBaseImpl, TableResponse } from '../../fw/widget/tablebase';
-import { UrlFnService } from '../../fw/remote/urlfn.service';
-import { WebSocketService } from '../../fw/remote/websocket.service';
+import { DialogService } from '../../../fw/layer/dialog.service';
+import { FnService } from '../../../fw/util/fn.service';
+import { IconService } from '../../../fw/svg/icon.service';
+import { KeyService } from '../../../fw/util/key.service';
+import { LionService } from '../../../fw/util/lion.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { LogService } from '../../../log.service';
+import { TableBaseImpl, TableResponse, TableFilter, SortParams, SortDir } from '../../../fw/widget/table.base';
+import { UrlFnService } from '../../../fw/remote/urlfn.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { TableFilterPipe } from '../../../fw/widget/tablefilter.pipe';
 
 const INSTALLED = 'INSTALLED';
 const ACTIVE = 'ACTIVE';
@@ -36,8 +36,12 @@
 const detailsResp = 'appDetailsResponse';
 const fileUploadUrl = 'applications/upload';
 const activateOption = '?activate=true';
-const appUrlPrefix = 'rs/applications/';
-const iconUrlSuffix = '/icon';
+
+/** Prefix to access the REST service for applications */
+export const APPURLPREFIX = '../../ui/rs/applications/'; // TODO: This is a hack to work off GUIv1 URL
+/** Suffix to access the icon of the application - gives back an image */
+export const ICONURLSUFFIX = '/icon';
+
 const downloadSuffix = '/download';
 const dialogId = 'app-dialog';
 const dialogOpts = {
@@ -49,20 +53,26 @@
 };
 const propOrder = ['id', 'state', 'category', 'version', 'origin', 'role'];
 
+/**
+ * Model of the data returned through the Web Socket about apps.
+ */
 interface AppTableResponse extends TableResponse {
-    apps: Apps[];
+    apps: App[];
 }
 
-interface Apps {
+/**
+ * Model of the data returned through Web Socket for a single App
+ */
+export interface App {
     category: string;
     desc: string;
-    features: string;
+    features: string[];
     icon: string;
     id: string;
     origin: string;
-    permissions: string;
+    permissions: string[];
     readme: string;
-    required_apps: string;
+    required_apps: string[];
     role: string;
     state: string;
     title: string;
@@ -71,6 +81,9 @@
     _iconid_state: string;
 }
 
+/**
+ * Model of the Control Button
+ */
 interface CtrlBtnState {
     installed: boolean;
     selection: string;
@@ -85,7 +98,7 @@
   templateUrl: './apps.component.html',
   styleUrls: [
     './apps.component.css', './apps.theme.css',
-    '../../fw/widget/table.css', '../../fw/widget/table-theme.css'
+    '../../../fw/widget/table.css', '../../../fw/widget/table.theme.css'
     ]
 })
 export class AppsComponent extends TableBaseImpl implements OnInit, OnDestroy {
@@ -94,7 +107,6 @@
     lionFn; // Function
     warnDeactivate: string;
     warnOwnRisk: string;
-    friendlyProps: string[];
     ctrlBtnState: CtrlBtnState;
     detailsPanel: any;
     appFile: any;
@@ -114,43 +126,49 @@
         private lion: LionService,
         protected ls: LoadingService,
         protected log: LogService,
-        private ps: PanelService,
         private ufs: UrlFnService,
         protected wss: WebSocketService,
         @Inject('Window') private window: Window,
     ) {
         super(fs, null, log, wss, 'app');
         this.responseCallback = this.appResponseCb;
+        // pre-populate sort so active apps are at the top of the list
         this.sortParams = {
             firstCol: 'state',
-            firstDir: 'desc',
+            firstDir: SortDir.desc,
             secondCol: 'title',
-            secondDir: 'asc',
+            secondDir: SortDir.asc,
         };
-        // We want doLion() to be called only after the Lion service is populated (from the WebSocket)
-        this.lion.loadCb = (() => this.doLion());
+        // We want doLion() to be called only after the Lion
+        // service is populated (from the WebSocket)
+        // If lion is not ready we make do with a dummy function
+        // As soon a lion gets loaded this function will be replaced with
+        // the real thing
+        if (this.lion.ubercache.length === 0) {
+            this.lionFn = this.dummyLion;
+            this.lion.loadCbs.set('apps', () => this.doLion());
+        } else {
+            this.doLion();
+        }
+
         this.ctrlBtnState = <CtrlBtnState>{
             installed: false,
             active: false
         };
-        if (this.lion.ubercache.length === 0) {
-            this.lionFn = this.dummyLion;
-        } 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');
     }
 
+    /**
+     * Initialize querying the WebSocket for App table details
+     */
     ngOnInit() {
         this.init();
-        this.log.debug('AppComponent initialized');
     }
 
+    /**
+     * Stop sending queries to WebSocket
+     */
     ngOnDestroy() {
+        this.lion.loadCbs.delete('apps');
         this.destroy();
         this.log.debug('AppComponent destroyed');
     }
@@ -199,8 +217,8 @@
             this.wss.sendEvent(appMgmtReq, {
                 action: action,
                 name: itemId,
-                sortCol: spar.sortCol,
-                sortDir: spar.sortDir,
+                sortCol: spar.firstCol,
+                sortDir: spar.firstDir,
             });
             if (action === 'uninstall') {
                 this.detailsPanel.hide();
@@ -229,13 +247,12 @@
 
     downloadApp() {
         if (this.ctrlBtnState.selection) {
-            (<any>this.window).location = appUrlPrefix + this.selId + downloadSuffix;
+            (<any>this.window).location = APPURLPREFIX + this.selId + ICONURLSUFFIX;
         }
     }
 
     /**
-     * Read the LION bundle for App - this should replace the dummyLion implementation
-     * of lionFn with a function from the LION Service
+     * Read the LION bundle for App and set up the lionFn
      */
     doLion() {
         this.lionFn = this.lion.bundle('core.view.App');
@@ -243,19 +260,11 @@
         this.warnDeactivate = this.lionFn('dlg_warn_deactivate');
         this.warnOwnRisk = this.lionFn('dlg_warn_own_risk');
 
-        this.friendlyProps = [
-            this.lionFn('app_id'), this.lionFn('state'),
-            this.lionFn('category'), this.lionFn('version'),
-            this.lionFn('origin'), this.lionFn('role'),
-        ];
-    }
-
-    /**
-     * A dummy implementation of the lionFn until the response is received and the LION
-     * bundle is received from the WebSocket
-     */
-    dummyLion(key: string): string {
-        return '%' + key + '%';
+        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');
     }
 
     appDropped() {
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps.theme.css b/web/gui2/src/main/webapp/app/view/apps/apps/apps.theme.css
similarity index 100%
rename from web/gui2/src/main/webapp/app/view/apps/apps.theme.css
rename to web/gui2/src/main/webapp/app/view/apps/apps/apps.theme.css
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps.component.css b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.css
similarity index 82%
rename from web/gui2/src/main/webapp/app/view/apps/apps.component.css
rename to web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.css
index a1963c0..bfa8d08 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps.component.css
+++ b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.css
@@ -15,44 +15,8 @@
  */
 
 /*
- ONOS GUI -- Applications View (layout) -- CSS file
+ ONOS GUI -- Applications Details Panel (layout) -- CSS file
  */
-
-#ov-app h2 {
-    display: inline-block;
-}
-
-#ov-app div.ctrl-btns {
-    width: 290px;
-}
-
-/* -- Drag-n-Drop oar file upload -- */
-#ov-app form#inputFileForm,
-#ov-app input#uploadFile {
-    display: none;
-}
-
-.dropping {
-
-}
-
-/* -- Confirmation Dialog -- */
-#app-dialog {
-    top: 140px;
-    padding: 12px;
-}
-
-#app-dialog p {
-    font-size: 12pt;
-}
-
-#app-dialog p.strong {
-    font-weight: bold;
-    padding: 8px;
-    text-align: center;
-}
-
-/* -- Details Panel -- */
 #application-details-panel.floatpanel {
     z-index: 0;
 }
@@ -151,4 +115,3 @@
     padding: 6px 6px;
     text-align: left;
 }
-
diff --git a/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html
new file mode 100644
index 0000000..a78bdd9
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.html
@@ -0,0 +1,99 @@
+<!--
+~ 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="application-details-panel" class="floatpanel" [@appDetailsState]="id!=='' && !closed">
+    <!--<div *ngIf="visible" class="container">-->
+    <div class="container">
+        <div class="top">
+            <onos-icon class="close-btn" iconId="close" iconSize="20" (click)="close()"></onos-icon>
+            <div class="top-content">
+                <div class="app-title">{{ detailsData.title }}</div>
+                <div class="left app-icon">
+                    <img src="{{ iconUrl(id) }}">
+                </div>
+                <div class="right">
+                    <table class="app-props">
+                        <tbody>
+                            <tr>
+                                <td class="label">{{ lionFn('app_id') }}:</td>
+                                <td class="value">{{ id }}</td>
+                            </tr>
+                            <tr>
+                                <td class="label">{{ lionFn('state') }}:</td>
+                                <td class="value">{{ detailsData.state }}</td>
+                            </tr>
+                            <tr>
+                                <td class="label">{{ lionFn('category') }}:</td>
+                                <td class="value">{{ detailsData.category }}</td>
+                            </tr>
+                            <tr>
+                                <td class="label">{{ lionFn('version') }}:</td>
+                                <td class="value">{{ detailsData.version }}</td>
+                            </tr>
+                            <tr>
+                                <td class="label">{{ lionFn('origin') }}:</td>
+                                <td class="value">{{ detailsData.origin }}</td>
+                            </tr>
+                            <tr>
+                                <td class="label">{{ lionFn('role') }}:</td>
+                                <td class="value">{{ detailsData.role }}</td>
+                            </tr>
+                        </tbody>
+                    </table>
+                </div>
+                <div class="app-url">
+                    <a href="{{ detailsData.url }}" target="_blank">{{ detailsData.url }}</a>
+                </div>
+            </div>
+        </div>
+        <hr>
+        <div class="middle">
+            <div class="app-readme">{{ detailsData.readme }}</div>
+        </div>
+        <hr>
+        <div class="bottom">
+            <h2>{{ lionFn('dp_features') }}</h2>
+            <div class="features">
+                <table>
+                    <tbody>
+                        <tr *ngFor="let feat of detailsData.features">
+                            <td>{{ feat }}</td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+            <h2>{{ lionFn('dp_required_apps') }}</h2>
+            <div class="required-apps">
+                <table>
+                    <tbody>
+                        <tr *ngFor="let reqd of detailsData.required_apps">
+                            <td>{{ reqd }}</td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+            <h2>{{ lionFn('dp_permissions') }}</h2>
+            <div class="permissions">
+                <table>
+                    <tbody>
+                        <tr *ngFor="let perm of detailsData.permissions">
+                            <td>{{ perm }}</td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.spec.ts b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.spec.ts
new file mode 100644
index 0000000..f890cde
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.spec.ts
@@ -0,0 +1,172 @@
+/*
+ * 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 { DebugElement } from '@angular/core';
+import { By } from '@angular/platform-browser';
+
+import { LogService } from '../../../log.service';
+import { AppsDetailsComponent } from './appsdetails.component';
+import { FnService } from '../../../../app/fw/util/fn.service';
+import { IconComponent } from '../../../../app/fw/svg/icon/icon.component';
+import { IconService } from '../../../../app/fw/svg/icon.service';
+import { LionService } from '../../../../app/fw/util/lion.service';
+import { UrlFnService } from '../../../fw/remote/urlfn.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+import { of } from 'rxjs';
+
+class MockActivatedRoute extends ActivatedRoute {
+    constructor(params: Params) {
+        super();
+        this.queryParams = of(params);
+    }
+}
+
+class MockFnService {}
+
+class MockIconService {
+    loadIconDef() {}
+}
+
+class MockUrlFnService {}
+
+class MockWebSocketService {
+    createWebSocket() {}
+    isConnected() { return false; }
+    unbindHandlers() {}
+    bindHandlers() {}
+}
+
+/**
+ * ONOS GUI -- Apps Detail Panel View -- Unit Tests
+ */
+describe('AppsDetailsComponent', () => {
+    let fs: FnService;
+    let ar: MockActivatedRoute;
+    let windowMock: Window;
+    let logServiceSpy: jasmine.SpyObj<LogService>;
+    let component: AppsDetailsComponent;
+    let fixture: ComponentFixture<AppsDetailsComponent>;
+    const bundleObj = {
+        'core.view.App': {
+        }
+    };
+    const mockLion = (key) =>  {
+        return bundleObj[key] || '%' + key + '%';
+    };
+
+    beforeEach(async(() => {
+        const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+        ar = new MockActivatedRoute({'debug': 'panel'});
+
+        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: [ AppsDetailsComponent, IconComponent ],
+            providers: [
+                { provide: FnService, useValue: fs },
+                { provide: IconService, useClass: MockIconService },
+                { provide: LionService, useFactory: (() => {
+                        return {
+                            bundle: ((bundleId) => mockLion),
+                            ubercache: new Array(),
+                            loadCbs:  new Map<string, () => void>([])
+                        };
+                    })
+                },
+                { provide: LogService, useValue: logSpy },
+                { provide: UrlFnService, useClass: MockUrlFnService },
+                { provide: WebSocketService, useClass: MockWebSocketService },
+                { provide: 'Window', useValue: windowMock },
+            ]
+        })
+        .compileComponents();
+        logServiceSpy = TestBed.get(LogService);
+    }));
+
+    beforeEach(() => {
+        fixture = TestBed.createComponent(AppsDetailsComponent);
+        component = fixture.debugElement.componentInstance;
+        fixture.detectChanges();
+    });
+
+    it('should create', () => {
+        expect(component).toBeTruthy();
+    });
+
+    it('should have an onos-icon.close-btn inside a div.top inside a div.container', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.container div.top onos-icon.close-btn'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a div.top-content inside a div.top inside a div.container', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.container div.top div.top-content'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a div.app-title inside a div.top-content', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.top-content div.app-title'));
+        const div: HTMLElement = divDe.nativeElement;
+        expect(div.textContent).toEqual('');
+    });
+
+    it('should have an img inside a div.left div.top-content', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.top-content div.left.app-icon img'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a table.app-props inside a div.right inside a div.top-content', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.top-content div.right table.app-props'));
+        const div: HTMLElement = divDe.nativeElement;
+        expect(div.textContent).toEqual('%app_id%:%state%:%category%:%version%:%origin%:%role%:');
+    });
+
+    it('should have an a inside an div.app-url inside a div.top-content', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.top-content div.app-url a'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a div.app-readme inside a div.middle inside a div.container', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.container div.middle div.app-readme'));
+        expect(divDe).toBeTruthy();
+    });
+
+    it('should have a div.features inside a div.bottom inside a div.container', () => {
+        const appDe: DebugElement = fixture.debugElement;
+        const divDe = appDe.query(By.css('div.container div.bottom div.features'));
+        expect(divDe).toBeTruthy();
+    });
+});
diff --git a/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.ts b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.ts
new file mode 100644
index 0000000..1e6ed29
--- /dev/null
+++ b/web/gui2/src/main/webapp/app/view/apps/appsdetails/appsdetails.component.ts
@@ -0,0 +1,119 @@
+/*
+ * 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, Input, OnInit, OnDestroy, OnChanges } from '@angular/core';
+import { trigger, state, style, animate, transition } from '@angular/animations';
+
+import { FnService } from '../../../fw/util/fn.service';
+import { LionService } from '../../../fw/util/lion.service';
+import { LoadingService } from '../../../fw/layer/loading.service';
+import { LogService } from '../../../log.service';
+import { WebSocketService } from '../../../fw/remote/websocket.service';
+
+import { DetailsPanelBaseImpl } from '../../../fw/widget/detailspanel.base';
+import { App, APPURLPREFIX, ICONURLSUFFIX } from '../apps/apps.component';
+
+/**
+ * The details view when an app is clicked from the apps view
+ *
+ * This is expected to be passed an 'id' and it makes a call
+ * to the WebSocket with an appDetailsRequest, and gets back an
+ * appDetailsResponse.
+ *
+ * The animated fly-in is controlled by the animation below
+ * The appDetailsState is attached to application-details-panel
+ * and is false (flies out) when id='' and true (flies in) when
+ * id has a value
+ */
+@Component({
+  selector: 'onos-appsdetails',
+  templateUrl: './appsdetails.component.html',
+  styleUrls: [
+    './appsdetails.component.css',
+    '../../../fw/widget/panel.css', '../../../fw/widget/panel-theme.css'
+  ],
+  animations: [
+    trigger('appDetailsState', [
+      state('true', style({
+        transform: 'translateX(-100%)',
+        opacity: '100'
+      })),
+      state('false', style({
+        transform: 'translateX(0%)',
+        opacity: '0'
+      })),
+      transition('0 => 1', animate('100ms ease-in')),
+      transition('1 => 0', animate('100ms ease-out'))
+    ])
+  ]
+})
+export class AppsDetailsComponent extends DetailsPanelBaseImpl implements OnInit, OnDestroy, OnChanges {
+    @Input() id: string;
+
+    lionFn; // Function
+    constructor(
+        protected fs: FnService,
+        protected ls: LoadingService,
+        protected log: LogService,
+        protected wss: WebSocketService,
+        protected lion: LionService,
+    ) {
+        super(fs, ls, log, wss, 'app');
+        if (this.lion.ubercache.length === 0) {
+            this.lionFn = this.dummyLion;
+            this.lion.loadCbs.set('appsdetails', () => this.doLion());
+        } else {
+            this.doLion();
+        }
+    }
+
+    /**
+     * There is a possibility that a previous selection
+     * is already registered for call - if so wait 100ms
+     * for it to deregister - this is because in the list of
+     * apps we might have selected one higher up the list and
+     * it is now being processed here before an older selection
+     * farther down the list has been removed
+     */
+    ngOnInit() {
+        this.init();
+        this.log.debug('App Details Component initialized:', this.id);
+    }
+
+    /**
+     * Stop listening to appDetailsResponse on WebSocket
+     */
+    ngOnDestroy() {
+        this.lion.loadCbs.delete('appsdetails');
+        this.destroy();
+        this.log.debug('App Details Component destroyed');
+    }
+
+    ngOnChanges() {
+        this.requestDetailsPanelData(this.id);
+    }
+
+    iconUrl(appId: string): string {
+        return APPURLPREFIX + appId + ICONURLSUFFIX;
+    }
+
+    /**
+     * Read the LION bundle for App and set up the lionFn
+     */
+    doLion() {
+        this.lionFn = this.lion.bundle('core.view.App');
+    }
+
+}