Upgrade to Angular 7 for GUI2

Change-Id: I5085bacb347ffc9af78cf7d3408853f76a5812a0
This commit is contained in:
Sean Condon 2018-11-02 16:29:06 +00:00
parent a70fdb603d
commit 7d275166c4
15 changed files with 4573 additions and 2828 deletions

View File

@ -178,8 +178,8 @@ genrule(
" echo -e $$MSG > ../../../$(location fm-gui2-lib-test.log);" +
" exit 0;" +
" fi;" +
" ng test --preserve-symlinks --code-coverage --browsers=ChromeHeadless" +
" --watch=false fm-gui2-lib > ../../../$(location fm-gui2-lib-test.log) 2>&1 ||" +
" ng test fm-gui2-lib --preserve-symlinks --code-coverage --browsers=ChromeHeadless" +
" --watch=false > ../../../$(location fm-gui2-lib-test.log) 2>&1 ||" +
" if [ $$? -eq 0 ]; then echo 'Successfully ran tests';" +
" else " +
" echo 'Error running \'ng test fm-gui2-lib\' on \'//apps/faultmanagement/fm-gui2-lib:_fm-gui2-lib-test-genrule\'. \\\n" +

File diff suppressed because it is too large Load Diff

View File

@ -3,31 +3,31 @@
"version": "2.0.0",
"private": true,
"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"@angular/animations": "^7.0.2",
"@angular/common": "^7.0.2",
"@angular/compiler": "^7.0.2",
"@angular/core": "^7.0.2",
"@angular/forms": "^7.0.2",
"@angular/http": "^7.0.2",
"@angular/platform-browser": "^7.0.2",
"@angular/platform-browser-dynamic": "^7.0.2",
"@angular/router": "^7.0.2",
"core-js": "^2.5.4",
"d3": "^5.2.0",
"gui2-fw-lib": "file:../../../web/gui2-fw-lib/dist/gui2-fw-lib/gui2-fw-lib-0.14.0.tgz",
"rxjs": "^6.0.0",
"rxjs": "^6.3.3",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "^6.0.0",
"@angular/compiler-cli": "^7.0.2",
"@angular-devkit/build-ng-packagr": "~0.6.8",
"@angular-devkit/build-angular": "~0.6.0",
"ng-packagr": "^3.0.0-rc.2",
"tsickle": ">=0.25.5",
"tsickle": "^0.33.1",
"tslib": "^1.7.1",
"typescript": "~2.7.2",
"@angular/cli": "~6.0.0",
"@angular/language-service": "^6.0.0",
"typescript": "~3.1.6",
"@angular/cli": "~7.0.4",
"@angular/language-service": "^7.0.2",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",

View File

@ -2,7 +2,7 @@
"name": "fm-gui2-lib",
"version": "1.15.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"
}
}

View File

@ -17,9 +17,9 @@
"""
Rules to build the ONOS GUI 2 FW Lib
The GUI2 Angular 6 elements are built here with Angular CLI 'ng'
The GUI2 Angular 7 elements are built here with Angular CLI 'ng'
Some work is being done in the Bazel community to integrate Bazel and
Angular 6, (Angular Buildtools Convergence -
Angular 7, (Angular Buildtools Convergence -
https://docs.google.com/document/d/1OlyiUnoTirUj4gecGxJeZBcjHcFr36RvLsvpBl2mxA8/preview)
but it is in the very early stages (Aug'18) and not yet fit
for production and at present it works as a replacement for Angular CLI
@ -227,7 +227,7 @@ genrule(
" export PATH=$$ROOT/$$(dirname $${NODE}):$$ROOT/web/gui2-fw-lib/node_modules/@angular/cli/bin:$$PATH &&" +
" node -v > ../../$(location gui2-fw-ng-build-prod.log) &&" +
" npm -v >> ../../$(location gui2-fw-ng-build-prod.log) &&" +
" ng -v >> ../../$(location gui2-fw-ng-build-prod.log);" +
" ng version >> ../../$(location gui2-fw-ng-build-prod.log);" +
" ng build --prod gui2-fw-lib >> $$ROOT/$(location gui2-fw-ng-build-prod.log) 2>&1 ||" +
" if [ $$? -eq 0 ]; then echo 'Successfully built GUI FW library';" +
" else " +
@ -281,7 +281,7 @@ genrule(
" export PATH=$$ROOT/$$(dirname $${NODE}):$$ROOT/web/gui2-fw-lib/node_modules/@angular/cli/bin:$$PATH &&" +
" node -v > ../../$(location onos-gui2-fw-ng-ver.log) &&" +
" npm -v >> ../../$(location onos-gui2-fw-ng-ver.log) &&" +
" ng -v >> ../../$(location onos-gui2-fw-ng-ver.log) &&" +
" ng version >> ../../$(location onos-gui2-fw-ng-ver.log) &&" +
" ng lint gui2-fw-lib > ../../$(location onos-gui2-fw-ng-lint.log);" +
" if [ -f /usr/bin/chromium-browser ]; then " + # Add to this for Mac and Chrome
" export CHROME_BIN=/usr/bin/chromium-browser; " +
@ -295,8 +295,8 @@ genrule(
" echo -e $$MSG > ../../$(location onos-gui2-fw-ng-test.log);" +
" exit 0;" +
" fi;" +
" ng test --preserve-symlinks --code-coverage --browsers=ChromeHeadless" +
" --watch=false gui2-fw-lib > ../../$(location onos-gui2-fw-ng-test.log) 2>&1 ||" +
" ng test gui2-fw-lib --preserve-symlinks --code-coverage --browsers=ChromeHeadless" +
" --watch=false > ../../$(location onos-gui2-fw-ng-test.log) 2>&1 ||" +
" if [ $$? -eq 0 ]; then echo 'Successfully ran tests';" +
" else " +
" echo 'Error running \'ng test\' on \'//web/gui2-fw-lib:onos-gui2-fw-ng-test\'. \\\n" +

View File

@ -8,9 +8,9 @@ The reason this has been separated out in to a separate library is to allow
external applications e.g. YangGUI to use it, without bringing along the
whole of GUI 2
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.4.
A couple of good articles on the creation and use of __libraries__ in Angular 6 is given in
A couple of good articles on the creation and use of __libraries__ in Angular 7 is given in
[The Angular Library Series - Creating a Library with the Angular CLI](https://blog.angularindepth.com/creating-a-library-in-angular-6-87799552e7e5)

File diff suppressed because it is too large Load Diff

View File

@ -12,27 +12,27 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"@angular/animations": "^7.0.2",
"@angular/common": "^7.0.2",
"@angular/compiler": "^7.0.2",
"@angular/core": "^7.0.2",
"@angular/forms": "^7.0.2",
"@angular/http": "^7.0.2",
"@angular/platform-browser": "^7.0.2",
"@angular/platform-browser-dynamic": "^7.0.2",
"@angular/router": "^7.0.2",
"core-js": "^2.5.4",
"d3": "^5.2.0",
"rxjs": "^6.0.0",
"rxjs": "^6.3.3",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular-devkit/build-ng-packagr": "~0.6.0",
"ng-packagr": "^3.0.0-rc.2",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@angular/cli": "~7.0.4",
"@angular/compiler-cli": "^7.0.2",
"@angular/language-service": "^7.0.2",
"@compodoc/compodoc": "^1.1.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
@ -49,6 +49,7 @@
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
"typescript": "~3.1.6",
"tsickle": "^0.33.1"
}
}

View File

@ -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"
}
}

View File

@ -29,23 +29,30 @@ class MockFnService {
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 ) }
]
});
});

View File

@ -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 @@ export class LoadingService {
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 @@ export class LoadingService {
// 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

View File

@ -23,7 +23,7 @@ import { LogService } from '../../log.service';
* 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 @@ export class IconComponent implements OnInit, OnChanges {
/**
* 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);

View File

@ -320,7 +320,8 @@ export class KeysService {
// 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) {

File diff suppressed because it is too large Load Diff

View File

@ -13,15 +13,15 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"@angular/animations": "^7.0.2",
"@angular/common": "^7.0.2",
"@angular/compiler": "^7.0.2",
"@angular/core": "^7.0.2",
"@angular/forms": "^7.0.2",
"@angular/http": "^7.0.2",
"@angular/platform-browser": "^7.0.2",
"@angular/platform-browser-dynamic": "^7.0.2",
"@angular/router": "^7.0.2",
"core-js": "^2.5.4",
"d3": "^5.2.0",
"fm-gui2-lib": "file:../../apps/faultmanagement/fm-gui2-lib/dist/fm-gui2-lib/fm-gui2-lib-1.15.0.tgz",
@ -31,9 +31,9 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@angular/cli": "~7.0.4",
"@angular/compiler-cli": "^7.0.2",
"@angular/language-service": "^7.0.2",
"@compodoc/compodoc": "^1.1.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
@ -50,6 +50,7 @@
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
"typescript": "~3.1.6",
"tsickle": "^0.33.1"
}
}