First part of migrating Topo2 to GUI2

Change-Id: I316dd34cba161688e01dfb7b340bff5f2c3c57d4
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/detailspanel.base.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/detailspanel.base.ts
index 11dc8c9..03c681b 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/detailspanel.base.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/detailspanel.base.ts
@@ -55,7 +55,7 @@
         protected wss: WebSocketService,
         protected tag: string,
     ) {
-        super(fs, ls, log, wss, {});
+        super(fs, ls, log);
         this.root = tag + 's';
         this.req = tag + 'DetailsRequest';
         this.resp = tag + 'DetailsResponse';
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/panel.base.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/panel.base.ts
index 90cdfd5..0377c47 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/panel.base.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/panel.base.ts
@@ -16,41 +16,6 @@
 import { FnService } from '../util/fn.service';
 import { LoadingService } from '../layer/loading.service';
 import { LogService } from '../log.service';
-import { WebSocketService } from '../remote/websocket.service';
-
-
-const noop = (): any => undefined;
-
-/**
- ********* Static functions *********
- */
-function margin(p) {
-    return p.settings.margin;
-}
-
-function hideMargin(p) {
-    return p.settings.hideMargin;
-}
-
-function noPx(p, what) {
-    return Number(p.el.style(what).replace(/px$/, ''));
-}
-
-function widthVal(p) {
-    return noPx(p, 'width');
-}
-
-function heightVal(p) {
-    return noPx(p, 'height');
-}
-
-function pxShow(p) {
-    return margin(p) + 'px';
-}
-
-function pxHide(p) {
-    return (-hideMargin(p) - widthVal(p) - (noPx(p, 'padding') * 2)) + 'px';
-}
 
 
 /**
@@ -60,14 +25,7 @@
     showPanel(cb: any): void;
     hidePanel(cb: any): void;
     togglePanel(cb: any): void;
-    emptyPanel(): void;
-    appendPanel(what: any): void;
-    panelWidth(w: number): number;
-    panelHeight(h: number): number;
-    panelBBox(): string;
     panelIsVisible(): boolean;
-    classed(cls: any, bool: boolean): boolean;
-    panelEl(): any;
 }
 
 /**
@@ -77,36 +35,22 @@
  */
 export abstract class PanelBaseImpl implements PanelBase {
 
-    protected on: boolean;
-    protected el: any;
+    on: boolean;
 
     constructor(
         protected fs: FnService,
         protected ls: LoadingService,
         protected log: LogService,
-        protected wss: WebSocketService,
-        protected settings: any
     ) {
 //        this.log.debug('Panel base class constructed');
     }
 
     showPanel(cb) {
-        const endCb = this.fs.isF(cb) || noop;
         this.on = true;
-        this.el.transition().duration(this.settings.xtnTime)
-            .each('end', endCb)
-            .style(this.settings.edge, pxShow(this))
-            .style('opacity', 1);
     }
 
     hidePanel(cb) {
-        const endCb = this.fs.isF(cb) || noop;
-        const endOpacity = this.settings.fade ? 0 : 1;
         this.on = false;
-        this.el.transition().duration(this.settings.xtnTime)
-            .each('end', endCb)
-            .style(this.settings.edge, pxHide(this))
-            .style('opacity', endOpacity);
     }
 
     togglePanel(cb): boolean {
@@ -118,45 +62,10 @@
         return this.on;
     }
 
-    emptyPanel(): string {
-        return this.el.text('');
-    }
-
-    appendPanel(what) {
-        return this.el.append(what);
-    }
-
-    panelWidth(w: number): number {
-        if (w === undefined) {
-            return widthVal(this);
-        }
-        this.el.style('width', w + 'px');
-    }
-
-    panelHeight(h: number): number {
-        if (h === undefined) {
-            return heightVal(this);
-        }
-        this.el.style('height', h + 'px');
-    }
-
-    panelBBox(): string {
-        return this.el.node().getBoundingClientRect();
-    }
-
     panelIsVisible(): boolean {
         return this.on;
     }
 
-    classed(cls, bool): boolean {
-        return this.el.classed(cls, bool);
-    }
-
-    panelEl() {
-        return this.el;
-    }
-
-
     /**
      * A dummy implementation of the lionFn until the response is received and the LION
      * bundle is received from the WebSocket
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.spec.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.spec.ts
new file mode 100644
index 0000000..b1e87e6
--- /dev/null
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.spec.ts
@@ -0,0 +1,74 @@
+/*
+ * 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 { TestBed, inject } from '@angular/core/testing';
+import { ActivatedRoute, Params } from '@angular/router';
+import { of } from 'rxjs';
+import { TableResizeDirective } from './tableresize.directive';
+import { LogService } from '..//log.service';
+import { ConsoleLoggerService } from '../consolelogger.service';
+import { MastService } from '../mast/mast.service';
+import { FnService } from '../util/fn.service';
+
+class MockMastService {}
+
+class MockFnService extends FnService {
+    constructor(ar: ActivatedRoute, log: LogService, w: Window) {
+        super(ar, log, w);
+    }
+}
+
+class MockActivatedRoute extends ActivatedRoute {
+    constructor(params: Params) {
+        super();
+        this.queryParams = of(params);
+    }
+}
+
+/**
+ * ONOS GUI -- Widget -- Table Resize Directive - Unit Tests
+ */
+describe('TableResizeDirective', () => {
+    let log: LogService;
+    let mockWindow: Window;
+    let ar: ActivatedRoute;
+
+    beforeEach(() => {
+        log = new ConsoleLoggerService();
+        ar = new MockActivatedRoute(['debug', 'DetectBrowserDirective']);
+        mockWindow = <any>{
+            navigator: {
+                userAgent: 'HeadlessChrome',
+                vendor: 'Google Inc.'
+            }
+        };
+        TestBed.configureTestingModule({
+            providers: [ TableResizeDirective,
+                { provide: FnService, useValue: new MockFnService(ar, log, mockWindow) },
+                { provide: LogService, useValue: log },
+                { provide: MastService, useClass: MockMastService },
+                { provide: 'Window', useFactory: (() => mockWindow ) },
+            ]
+        });
+    });
+
+    afterEach(() => {
+        log = null;
+    });
+
+    it('should create an instance', inject([TableResizeDirective], (directive: TableResizeDirective) => {
+        expect(directive).toBeTruthy();
+    }));
+});
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.ts
index 0678583..5d3a9eb 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/widget/tableresize.directive.ts
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { AfterContentChecked, Directive, ElementRef, Inject } from '@angular/core';
+import { AfterContentChecked, Directive, Inject } from '@angular/core';
 import { FnService } from '../util/fn.service';
 import { LogService } from '../log.service';
 import { MastService } from '../mast/mast.service';
@@ -34,7 +34,6 @@
     constructor(protected fs: FnService,
         protected log: LogService,
         protected mast: MastService,
-        protected el: ElementRef,
         @Inject('Window') private w: any) {
 
         log.info('TableResizeDirective constructed');