Upgrade to Angular 7 for GUI2
Change-Id: I5085bacb347ffc9af78cf7d3408853f76a5812a0
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/package.json b/web/gui2-fw-lib/projects/gui2-fw-lib/package.json
index a130774..288b753 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/package.json
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/package.json
@@ -2,7 +2,7 @@
"name": "gui2-fw-lib",
"version": "0.14.0",
"peerDependencies": {
- "@angular/common": "^6.0.0-rc.0 || ^6.0.0",
- "@angular/core": "^6.0.0-rc.0 || ^6.0.0"
+ "@angular/common": "^7.0.0 || ^6.0.0-rc.0 || ^6.0.0",
+ "@angular/core": "^7.0.0 || ^6.0.0-rc.0 || ^6.0.0"
}
}
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.spec.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.spec.ts
index 404439f..fc990eb 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.spec.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.spec.ts
@@ -29,23 +29,30 @@
class MockThemeService {}
-class MockWebSocketService {}
-
/**
* ONOS GUI -- Layer -- Loading Service - Unit Tests
*/
describe('LoadingService', () => {
let log: LogService;
+ let mockWindow: Window;
beforeEach(() => {
log = new ConsoleLoggerService();
+ mockWindow = <any>{
+ innerWidth: 400,
+ innerHeight: 200,
+ navigator: {
+ userAgent: 'defaultUA'
+ }
+ };
+
TestBed.configureTestingModule({
providers: [LoadingService,
{ provide: LogService, useValue: log },
{ provide: FnService, useClass: MockFnService },
{ provide: ThemeService, useClass: MockThemeService },
- { provide: WebSocketService, useClass: MockWebSocketService },
+ { provide: 'Window', useFactory: (() => mockWindow ) }
]
});
});
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.ts
index f7f54fa..01391f1 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/layer/loading.service.ts
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Injectable } from '@angular/core';
+import {Inject, Injectable} from '@angular/core';
import { FnService } from '../util/fn.service';
import { LogService } from '../log.service';
import { ThemeService } from '../util/theme.service';
-import { WebSocketService } from '../remote/websocket.service';
import * as d3 from 'd3';
const id = 'loading-anim';
@@ -48,7 +47,7 @@
private fs: FnService,
private log: LogService,
private ts: ThemeService,
- private wss: WebSocketService
+ @Inject('Window') private w: any
) {
this.preloadImages();
this.log.debug('LoadingService constructed');
@@ -115,7 +114,7 @@
// schedule function to start animation in the future
start() {
this.dbg('start (schedule)');
- this.wait = setTimeout(this.startAnim(), waitDelay);
+ this.wait = this.w.setTimeout(this.startAnim(), waitDelay);
}
// cancel future start, if any; stop the animation
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon/icon.component.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon/icon.component.ts
index 5267aef..d05c7ed 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon/icon.component.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon/icon.component.ts
@@ -23,7 +23,7 @@
* Note: This is an alternative to the Icon Directive from ONOS 1.0.0
* It has been implemented as a Component because it was inadvertently adding
* in a template through d3 DOM manipulations - it's better to make it a Comp
- * and build a template the Angular 6 way
+ * and build a template the Angular 7 way
*
* Remember: The CSS files applied here only apply to this component
*/
@@ -55,7 +55,6 @@
/**
* Icons are loaded in to the DOM under iconDefs
- * TODO: Change this to use more standard Angular 6 mechanism
*/
ngOnInit() {
this.is.loadIconDef(this.iconId);
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/util/keys.service.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/util/keys.service.ts
index ac68c1a..decb87b 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/util/keys.service.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/util/keys.service.ts
@@ -320,7 +320,8 @@
// returns true if we 'consumed' the ESC keypress, false otherwise
protected escapeKey(view, key, code, ev) {
- return this.ns.hideNav() || this.qhs.hideQuickHelp();
+ return this.ns.hideNav();
+ // TODO - also hide this.qhs.hideQuickHelp();
}
protected toggleTheme(view, key, code, ev) {