From e0fac8a01a4317a6a51cbc08e25d8c8ed65ccbfa Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Wed, 8 Jun 2016 22:28:16 +0200 Subject: [PATCH 01/46] preparing for version 1.8.0 --- CHANGELOG.md | 2 ++ README.md | 16 ++++++---------- pom.xml | 2 +- shardis-api/pom.xml | 4 ++-- shardis-auth/pom.xml | 4 ++-- shardis-common/pom.xml | 4 ++-- shardis-discovery/pom.xml | 4 ++-- shardis-parent/pom.xml | 2 +- shardis-ui/pom.xml | 4 ++-- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70a5056..2345670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Changelog +### 1.8.0 (unreleased) + ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency * Removed kitchensink page diff --git a/README.md b/README.md index 1ba2d26..1728ff3 100644 --- a/README.md +++ b/README.md @@ -29,28 +29,28 @@ Then build and run discovery server: ``` cd shardis-discovery/ mvn clean package -java -jar ./target/shardis-discovery-1.7.0.jar +java -jar ./target/shardis-discovery-1.8.0.jar ``` Then build and run api server: ``` cd shardis-api/ mvn clean package -java -jar ./target/shardis-api-1.7.0.jar +java -jar ./target/shardis-api-1.8.0.jar ``` Then build and run auth server: ``` cd shardis-auth/ mvn clean package -java -jar ./target/shardis-auth-1.7.0.jar +java -jar ./target/shardis-auth-1.8.0.jar ``` Then build and run ui server: ``` cd shardis-api/ mvn clean package -java -jar ./target/shardis-ui-1.7.0.jar +java -jar ./target/shardis-ui-1.8.0.jar ``` @@ -114,6 +114,8 @@ npm run e2e ## Changelog +### 1.8.0 (unreleased) + ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency * Removed kitchensink page @@ -141,10 +143,4 @@ npm run e2e * Fixed webpack validator custom schema config * Some fixes from AngularClass starter -### 1.5.0 (13.05.2016) -* Updated Spring Boot to 1.3.4 -* Updated Spring Boot to 1.3.5 -* Added Spring IO Platform dependency -* Various bugfixes - [show full changelog](CHANGELOG.md) diff --git a/pom.xml b/pom.xml index 59ec938..cad0709 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.shardis shardis - 1.7.0 + 1.8.0 pom shardis diff --git a/shardis-api/pom.xml b/shardis-api/pom.xml index 717fb8f..50f031c 100644 --- a/shardis-api/pom.xml +++ b/shardis-api/pom.xml @@ -4,7 +4,7 @@ 4.0.0 shardis-api - 1.7.0 + 1.8.0 jar shardis-api @@ -13,7 +13,7 @@ com.shardis shardis-parent - 1.7.0 + 1.8.0 diff --git a/shardis-auth/pom.xml b/shardis-auth/pom.xml index 8bdaced..7d9c1b5 100644 --- a/shardis-auth/pom.xml +++ b/shardis-auth/pom.xml @@ -4,7 +4,7 @@ 4.0.0 shardis-auth - 1.7.0 + 1.8.0 jar shardis-auth @@ -13,7 +13,7 @@ com.shardis shardis-parent - 1.7.0 + 1.8.0 diff --git a/shardis-common/pom.xml b/shardis-common/pom.xml index dd41db4..50da44d 100644 --- a/shardis-common/pom.xml +++ b/shardis-common/pom.xml @@ -4,7 +4,7 @@ 4.0.0 shardis-common - 1.7.0 + 1.8.0 jar shardis-common @@ -13,7 +13,7 @@ com.shardis shardis-parent - 1.7.0 + 1.8.0 diff --git a/shardis-discovery/pom.xml b/shardis-discovery/pom.xml index 669286e..0fb08c8 100644 --- a/shardis-discovery/pom.xml +++ b/shardis-discovery/pom.xml @@ -4,7 +4,7 @@ 4.0.0 shardis-discovery - 1.7.0 + 1.8.0 jar shardis-discovery @@ -13,7 +13,7 @@ com.shardis shardis-parent - 1.7.0 + 1.8.0 diff --git a/shardis-parent/pom.xml b/shardis-parent/pom.xml index 82be3c3..9c49d04 100644 --- a/shardis-parent/pom.xml +++ b/shardis-parent/pom.xml @@ -5,7 +5,7 @@ com.shardis shardis-parent - 1.7.0 + 1.8.0 pom shardis-parent diff --git a/shardis-ui/pom.xml b/shardis-ui/pom.xml index be8c559..17ba9fe 100644 --- a/shardis-ui/pom.xml +++ b/shardis-ui/pom.xml @@ -4,7 +4,7 @@ 4.0.0 shardis-ui - 1.7.0 + 1.8.0 jar shardis-ui @@ -13,7 +13,7 @@ com.shardis shardis-parent - 1.7.0 + 1.8.0 From f1665719e6f33a118cfa311a69ea4f4da3e58d5b Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Thu, 9 Jun 2016 18:15:15 +0200 Subject: [PATCH 02/46] dependency update --- shardis-ui/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 6732c93..3489fad 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -70,7 +70,7 @@ "karma-sourcemap-loader": "0.3.7", "karma-webpack": "1.7.0", "node-sass": "3.7.0", - "npm-check-updates": "^2.6.5", + "npm-check-updates": "^2.6.7", "parse5": "2.1.5", "phantomjs-polyfill": "0.0.2", "phantomjs-prebuilt": "2.1.7", @@ -84,9 +84,9 @@ "style-loader": "0.13.1", "ts-helpers": "1.1.1", "ts-node": "0.8.0", - "tslint": "3.10.2", + "tslint": "3.11.0", "tslint-loader": "2.1.4", - "typedoc": "0.4.1", + "typedoc": "0.4.2", "typescript": "1.8.10", "typings": "1.0.4", "url-loader": "0.5.7", From 79ff2dd084504a03480906996a38009bc8eb7002 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Thu, 9 Jun 2016 20:41:37 +0200 Subject: [PATCH 03/46] better directory structure for angular components --- CHANGELOG.md | 1 + README.md | 1 + .../{views => }/about/about.component.html | 0 .../{views => }/about/about.component.scss | 2 +- .../{views => }/about/about.component.spec.ts | 13 ++--------- .../app/{views => }/about/about.component.ts | 0 .../src/main/frontend/app/about/index.ts | 1 + .../src/main/frontend/app/app.component.html | 6 +++-- .../src/main/frontend/app/app.component.ts | 16 ++++++------- shardis-ui/src/main/frontend/app/app.spec.ts | 15 ++++-------- .../{views => }/home/home.component.e2e.ts | 5 +--- .../app/{views => }/home/home.component.html | 3 ++- .../app/{views => }/home/home.component.scss | 0 .../app/{views => }/home/home.component.ts | 5 ++-- .../app/{views => }/home/home.spec.ts | 23 +++++-------------- .../src/main/frontend/app/home/index.ts | 1 + .../main/frontend/app/home/shared/index.ts | 1 + .../shared}/title.service.spec.ts | 20 ++++------------ .../services => home/shared}/title.service.ts | 2 +- shardis-ui/src/main/frontend/app/index.ts | 1 + .../src/main/frontend/app/login/index.ts | 1 + .../{views => }/login/login.component.html | 0 .../{views => }/login/login.component.scss | 0 .../app/{views => }/login/login.component.ts | 2 +- .../playground/heroes/app.component.scss | 6 +++++ .../playground/heroes/app.component.ts | 0 .../heroes/hero-detail.component.ts | 2 +- .../playground/heroes/hero.service.ts | 0 .../frontend/app/playground/heroes/hero.ts | 4 ++++ .../playground/heroes/mock-heroes.ts | 2 +- .../src/main/frontend/app/playground/index.ts | 1 + .../playground/playground.component.ts | 0 .../{services => shared/auth}/auth.service.ts | 2 +- .../main/frontend/app/shared/auth/index.ts | 1 + .../src/main/frontend/app/shared/index.ts | 4 ++++ .../frontend/app/shared/lazy-loader/index.ts | 1 + .../lazy-loader/lazy-loader.ts} | 10 +++----- .../app/shared/router-active/index.ts | 1 + .../router-active}/router-active.directive.ts | 0 .../main/frontend/app/shared/x-large/index.ts | 1 + .../x-large}/x-large.directive.spec.ts | 17 ++++---------- .../x-large}/x-large.directive.ts | 4 ++-- .../app/views/playground/heroes/hero.ts | 4 ---- shardis-ui/src/main/frontend/main.ts | 5 ++-- .../frontend/platform/browser/directives.ts | 4 ++-- .../platform/browser/material2/index.ts | 1 + .../main/frontend/platform/browser/pipes.ts | 2 +- .../frontend/platform/browser/providers.ts | 2 +- .../src/main/frontend/platform/index.ts | 2 ++ shardis-ui/src/main/frontend/polyfills.ts | 2 +- shardis-ui/src/main/frontend/vendor.ts | 4 ++-- 51 files changed, 88 insertions(+), 113 deletions(-) rename shardis-ui/src/main/frontend/app/{views => }/about/about.component.html (100%) rename shardis-ui/src/main/frontend/app/{views => }/about/about.component.scss (68%) rename shardis-ui/src/main/frontend/app/{views => }/about/about.component.spec.ts (60%) rename shardis-ui/src/main/frontend/app/{views => }/about/about.component.ts (100%) create mode 100644 shardis-ui/src/main/frontend/app/about/index.ts rename shardis-ui/src/main/frontend/app/{views => }/home/home.component.e2e.ts (79%) rename shardis-ui/src/main/frontend/app/{views => }/home/home.component.html (98%) rename shardis-ui/src/main/frontend/app/{views => }/home/home.component.scss (100%) rename shardis-ui/src/main/frontend/app/{views => }/home/home.component.ts (75%) rename shardis-ui/src/main/frontend/app/{views => }/home/home.spec.ts (67%) create mode 100644 shardis-ui/src/main/frontend/app/home/index.ts create mode 100644 shardis-ui/src/main/frontend/app/home/shared/index.ts rename shardis-ui/src/main/frontend/app/{views/home/services => home/shared}/title.service.spec.ts (75%) rename shardis-ui/src/main/frontend/app/{views/home/services => home/shared}/title.service.ts (87%) create mode 100644 shardis-ui/src/main/frontend/app/index.ts create mode 100644 shardis-ui/src/main/frontend/app/login/index.ts rename shardis-ui/src/main/frontend/app/{views => }/login/login.component.html (100%) rename shardis-ui/src/main/frontend/app/{views => }/login/login.component.scss (100%) rename shardis-ui/src/main/frontend/app/{views => }/login/login.component.ts (93%) rename shardis-ui/src/main/frontend/app/{views => }/playground/heroes/app.component.scss (99%) rename shardis-ui/src/main/frontend/app/{views => }/playground/heroes/app.component.ts (100%) rename shardis-ui/src/main/frontend/app/{views => }/playground/heroes/hero-detail.component.ts (97%) rename shardis-ui/src/main/frontend/app/{views => }/playground/heroes/hero.service.ts (100%) create mode 100644 shardis-ui/src/main/frontend/app/playground/heroes/hero.ts rename shardis-ui/src/main/frontend/app/{views => }/playground/heroes/mock-heroes.ts (92%) create mode 100644 shardis-ui/src/main/frontend/app/playground/index.ts rename shardis-ui/src/main/frontend/app/{views => }/playground/playground.component.ts (100%) rename shardis-ui/src/main/frontend/app/{services => shared/auth}/auth.service.ts (97%) create mode 100644 shardis-ui/src/main/frontend/app/shared/auth/index.ts create mode 100644 shardis-ui/src/main/frontend/app/shared/index.ts create mode 100644 shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts rename shardis-ui/src/main/frontend/app/{utils/lazy.loader.ts => shared/lazy-loader/lazy-loader.ts} (57%) create mode 100644 shardis-ui/src/main/frontend/app/shared/router-active/index.ts rename shardis-ui/src/main/frontend/app/{directives => shared/router-active}/router-active.directive.ts (100%) create mode 100644 shardis-ui/src/main/frontend/app/shared/x-large/index.ts rename shardis-ui/src/main/frontend/app/{directives => shared/x-large}/x-large.directive.spec.ts (68%) rename shardis-ui/src/main/frontend/app/{directives => shared/x-large}/x-large.directive.ts (83%) delete mode 100644 shardis-ui/src/main/frontend/app/views/playground/heroes/hero.ts create mode 100644 shardis-ui/src/main/frontend/platform/browser/material2/index.ts create mode 100644 shardis-ui/src/main/frontend/platform/index.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 2345670..e01a573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ### 1.8.0 (unreleased) +* Better directory structure for angular components ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index 1728ff3..1c81fee 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ npm run e2e ## Changelog ### 1.8.0 (unreleased) +* Better directory structure for angular components ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/src/main/frontend/app/views/about/about.component.html b/shardis-ui/src/main/frontend/app/about/about.component.html similarity index 100% rename from shardis-ui/src/main/frontend/app/views/about/about.component.html rename to shardis-ui/src/main/frontend/app/about/about.component.html diff --git a/shardis-ui/src/main/frontend/app/views/about/about.component.scss b/shardis-ui/src/main/frontend/app/about/about.component.scss similarity index 68% rename from shardis-ui/src/main/frontend/app/views/about/about.component.scss rename to shardis-ui/src/main/frontend/app/about/about.component.scss index d6e4c6c..f965b29 100644 --- a/shardis-ui/src/main/frontend/app/views/about/about.component.scss +++ b/shardis-ui/src/main/frontend/app/about/about.component.scss @@ -1,4 +1,4 @@ -$font-stack: Helvetica, sans-serif; +$font-stack: Helvetica, sans-serif; $primary-color: #D40000; span { diff --git a/shardis-ui/src/main/frontend/app/views/about/about.component.spec.ts b/shardis-ui/src/main/frontend/app/about/about.component.spec.ts similarity index 60% rename from shardis-ui/src/main/frontend/app/views/about/about.component.spec.ts rename to shardis-ui/src/main/frontend/app/about/about.component.spec.ts index bfeb741..f083e03 100644 --- a/shardis-ui/src/main/frontend/app/views/about/about.component.spec.ts +++ b/shardis-ui/src/main/frontend/app/about/about.component.spec.ts @@ -1,16 +1,7 @@ -import { - it, - inject, - async, - describe, - beforeEachProviders -} from '@angular/core/testing'; -import {TestComponentBuilder} from '@angular/compiler/testing'; - -import {Component, provide} from '@angular/core'; +import {it, inject, describe, beforeEachProviders} from '@angular/core/testing'; +import {About} from './about.component'; // Load the implementations that should be tested -import {About} from './about.component.ts'; describe('About', () => { // provide our implementations or mocks to the dependency injector diff --git a/shardis-ui/src/main/frontend/app/views/about/about.component.ts b/shardis-ui/src/main/frontend/app/about/about.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/views/about/about.component.ts rename to shardis-ui/src/main/frontend/app/about/about.component.ts diff --git a/shardis-ui/src/main/frontend/app/about/index.ts b/shardis-ui/src/main/frontend/app/about/index.ts new file mode 100644 index 0000000..6234f86 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/about/index.ts @@ -0,0 +1 @@ +export * from './about.component' diff --git a/shardis-ui/src/main/frontend/app/app.component.html b/shardis-ui/src/main/frontend/app/app.component.html index 240ede8..c45153e 100644 --- a/shardis-ui/src/main/frontend/app/app.component.html +++ b/shardis-ui/src/main/frontend/app/app.component.html @@ -19,8 +19,10 @@ {{ name }} - Login - + Login + diff --git a/shardis-ui/src/main/frontend/app/app.component.ts b/shardis-ui/src/main/frontend/app/app.component.ts index 4b7e609..ae22e94 100644 --- a/shardis-ui/src/main/frontend/app/app.component.ts +++ b/shardis-ui/src/main/frontend/app/app.component.ts @@ -1,10 +1,10 @@ import {Component, OnInit} from '@angular/core'; import {Routes, Router} from '@angular/router'; -import {Home} from './views/home/home.component'; -import {AuthService} from './services/auth.service'; -import {About} from './views/about/about.component'; -import {Playground} from './views/playground/playground.component'; -import {Login} from './views/login/login.component'; +import {Home} from './home'; +import {AuthService} from './shared'; +import {About} from './about'; +import {Playground} from './playground'; +import {Login} from './login'; @Component({ selector: 'app', @@ -63,15 +63,15 @@ export class App implements OnInit { } ]; - constructor(public authService: AuthService, public router: Router) { + constructor(public authService:AuthService, public router:Router) { } - logMeOut(): void { + logMeOut():void { this.authService.logout(); this.router.navigate(['/']); } - ngOnInit(): void { + ngOnInit():void { console.log('app on init'); } diff --git a/shardis-ui/src/main/frontend/app/app.spec.ts b/shardis-ui/src/main/frontend/app/app.spec.ts index bf878b0..e7d1848 100644 --- a/shardis-ui/src/main/frontend/app/app.spec.ts +++ b/shardis-ui/src/main/frontend/app/app.spec.ts @@ -1,17 +1,12 @@ -import { - it, - inject, - async, - beforeEachProviders -} from '@angular/core/testing'; - -// Load the implementations that should be tested +import {it, inject, beforeEachProviders} from '@angular/core/testing'; import {App} from './app.component'; -import {AuthService} from './services/auth.service'; +import {AuthService} from './shared'; import {BaseRequestOptions, Http} from '@angular/http'; import {MockBackend} from '@angular/http/testing/mock_backend'; import {provide} from '@angular/core'; -import { ROUTER_FAKE_PROVIDERS } from '@angular/router/testing'; +import {ROUTER_FAKE_PROVIDERS} from '@angular/router/testing'; + +// Load the implementations that should be tested describe('App', () => { // provide our implementations or mocks to the dependency injector diff --git a/shardis-ui/src/main/frontend/app/views/home/home.component.e2e.ts b/shardis-ui/src/main/frontend/app/home/home.component.e2e.ts similarity index 79% rename from shardis-ui/src/main/frontend/app/views/home/home.component.e2e.ts rename to shardis-ui/src/main/frontend/app/home/home.component.e2e.ts index fa6c310..38106e7 100644 --- a/shardis-ui/src/main/frontend/app/views/home/home.component.e2e.ts +++ b/shardis-ui/src/main/frontend/app/home/home.component.e2e.ts @@ -1,6 +1,3 @@ -/* - * TODO: ES5 for now until I make a webpack plugin for protractor - */ describe('App', () => { beforeEach(() => { @@ -15,5 +12,5 @@ describe('App', () => { expect(subject).toEqual(result); }); - + }); diff --git a/shardis-ui/src/main/frontend/app/views/home/home.component.html b/shardis-ui/src/main/frontend/app/home/home.component.html similarity index 98% rename from shardis-ui/src/main/frontend/app/views/home/home.component.html rename to shardis-ui/src/main/frontend/app/home/home.component.html index c4a7f6b..03be5f3 100644 --- a/shardis-ui/src/main/frontend/app/views/home/home.component.html +++ b/shardis-ui/src/main/frontend/app/home/home.component.html @@ -61,7 +61,8 @@ Content from server:
- +
this.data = {{ data | json }}
diff --git a/shardis-ui/src/main/frontend/app/views/home/home.component.scss b/shardis-ui/src/main/frontend/app/home/home.component.scss similarity index 100% rename from shardis-ui/src/main/frontend/app/views/home/home.component.scss rename to shardis-ui/src/main/frontend/app/home/home.component.scss diff --git a/shardis-ui/src/main/frontend/app/views/home/home.component.ts b/shardis-ui/src/main/frontend/app/home/home.component.ts similarity index 75% rename from shardis-ui/src/main/frontend/app/views/home/home.component.ts rename to shardis-ui/src/main/frontend/app/home/home.component.ts index e7cfb61..1aebc1d 100644 --- a/shardis-ui/src/main/frontend/app/views/home/home.component.ts +++ b/shardis-ui/src/main/frontend/app/home/home.component.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; -import {Title} from './services/title.service.ts'; -import {XLarge} from './../../directives/x-large.directive.ts'; -import {AuthService} from '../../services/auth.service'; +import {Title} from './shared'; +import {XLarge, AuthService} from '../shared'; @Component({ selector: 'home', diff --git a/shardis-ui/src/main/frontend/app/views/home/home.spec.ts b/shardis-ui/src/main/frontend/app/home/home.spec.ts similarity index 67% rename from shardis-ui/src/main/frontend/app/views/home/home.spec.ts rename to shardis-ui/src/main/frontend/app/home/home.spec.ts index 62af81e..85602ad 100644 --- a/shardis-ui/src/main/frontend/app/views/home/home.spec.ts +++ b/shardis-ui/src/main/frontend/app/home/home.spec.ts @@ -1,24 +1,13 @@ -import { - it, - inject, - async, - describe, - beforeEachProviders -} from '@angular/core/testing'; - -import {Component, provide} from '@angular/core'; -import {BaseRequestOptions, Http} from '@angular/http'; +import {it, inject, describe, beforeEachProviders} from '@angular/core/testing'; +import {provide} from '@angular/core'; +import {BaseRequestOptions, Http, Response, ResponseOptions} from '@angular/http'; import {MockBackend} from '@angular/http/testing'; +import {Home} from './home.component'; +import {Title} from './shared'; +import {AuthService} from '../shared'; // Load the implementations that should be tested -import {Home} from './home.component.ts'; -import {Title} from './services/title.service.ts'; -import {Response} from '@angular/http'; -import {ResponseOptions} from '@angular/http'; -import {MockConnection} from '@angular/http/testing/mock_backend'; -import {ResponseOptionsArgs} from '@angular/http'; -import {AuthService} from '../../services/auth.service'; describe('Home', () => { // provide our implementations or mocks to the dependency injector diff --git a/shardis-ui/src/main/frontend/app/home/index.ts b/shardis-ui/src/main/frontend/app/home/index.ts new file mode 100644 index 0000000..3c1cba0 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/home/index.ts @@ -0,0 +1 @@ +export * from './home.component' diff --git a/shardis-ui/src/main/frontend/app/home/shared/index.ts b/shardis-ui/src/main/frontend/app/home/shared/index.ts new file mode 100644 index 0000000..50c5d6d --- /dev/null +++ b/shardis-ui/src/main/frontend/app/home/shared/index.ts @@ -0,0 +1 @@ +export * from './title.service' diff --git a/shardis-ui/src/main/frontend/app/views/home/services/title.service.spec.ts b/shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts similarity index 75% rename from shardis-ui/src/main/frontend/app/views/home/services/title.service.spec.ts rename to shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts index 3ba37c0..bc3675b 100644 --- a/shardis-ui/src/main/frontend/app/views/home/services/title.service.spec.ts +++ b/shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts @@ -1,19 +1,9 @@ -import { - it, - inject, - async, - beforeEachProviders -} from '@angular/core/testing'; - -import {Component, provide} from '@angular/core'; -import {BaseRequestOptions, Http} from '@angular/http'; +import {it, inject, async, beforeEachProviders} from '@angular/core/testing'; +import {provide} from '@angular/core'; +import {BaseRequestOptions, Http, ResponseOptions, Response} from '@angular/http'; import {MockBackend} from '@angular/http/testing'; - - -import {Title} from './title.service.ts'; -import {ResponseOptions} from '@angular/http'; -import {Response} from '@angular/http'; -import {AuthService} from '../../../services/auth.service'; +import {Title} from './title.service'; +import {AuthService} from '../../shared'; describe('Title', () => { beforeEachProviders(() => [ diff --git a/shardis-ui/src/main/frontend/app/views/home/services/title.service.ts b/shardis-ui/src/main/frontend/app/home/shared/title.service.ts similarity index 87% rename from shardis-ui/src/main/frontend/app/views/home/services/title.service.ts rename to shardis-ui/src/main/frontend/app/home/shared/title.service.ts index 88a16f3..20f6bc4 100644 --- a/shardis-ui/src/main/frontend/app/views/home/services/title.service.ts +++ b/shardis-ui/src/main/frontend/app/home/shared/title.service.ts @@ -1,6 +1,6 @@ import {Injectable} from '@angular/core'; import {Http} from '@angular/http'; -import {AuthService} from '../../../services/auth.service'; +import {AuthService} from '../../shared'; import 'rxjs/Rx'; @Injectable() diff --git a/shardis-ui/src/main/frontend/app/index.ts b/shardis-ui/src/main/frontend/app/index.ts new file mode 100644 index 0000000..e1b5e78 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/index.ts @@ -0,0 +1 @@ +export * from './app.component' diff --git a/shardis-ui/src/main/frontend/app/login/index.ts b/shardis-ui/src/main/frontend/app/login/index.ts new file mode 100644 index 0000000..60c8483 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/login/index.ts @@ -0,0 +1 @@ +export * from './login.component' diff --git a/shardis-ui/src/main/frontend/app/views/login/login.component.html b/shardis-ui/src/main/frontend/app/login/login.component.html similarity index 100% rename from shardis-ui/src/main/frontend/app/views/login/login.component.html rename to shardis-ui/src/main/frontend/app/login/login.component.html diff --git a/shardis-ui/src/main/frontend/app/views/login/login.component.scss b/shardis-ui/src/main/frontend/app/login/login.component.scss similarity index 100% rename from shardis-ui/src/main/frontend/app/views/login/login.component.scss rename to shardis-ui/src/main/frontend/app/login/login.component.scss diff --git a/shardis-ui/src/main/frontend/app/views/login/login.component.ts b/shardis-ui/src/main/frontend/app/login/login.component.ts similarity index 93% rename from shardis-ui/src/main/frontend/app/views/login/login.component.ts rename to shardis-ui/src/main/frontend/app/login/login.component.ts index c673be6..0f80a5b 100644 --- a/shardis-ui/src/main/frontend/app/views/login/login.component.ts +++ b/shardis-ui/src/main/frontend/app/login/login.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from '@angular/core'; import {Router} from '@angular/router'; -import {AuthService} from '../../services/auth.service'; +import {AuthService} from '../shared'; console.log('`Login` component loaded asynchronously'); diff --git a/shardis-ui/src/main/frontend/app/views/playground/heroes/app.component.scss b/shardis-ui/src/main/frontend/app/playground/heroes/app.component.scss similarity index 99% rename from shardis-ui/src/main/frontend/app/views/playground/heroes/app.component.scss rename to shardis-ui/src/main/frontend/app/playground/heroes/app.component.scss index cd111b9..e76b5a6 100644 --- a/shardis-ui/src/main/frontend/app/views/playground/heroes/app.component.scss +++ b/shardis-ui/src/main/frontend/app/playground/heroes/app.component.scss @@ -2,12 +2,14 @@ background-color: #CFD8DC !important; color: white; } + .heroes { margin: 0 0 2em 0; list-style-type: none; padding: 0; width: 10em; } + .heroes li { cursor: pointer; position: relative; @@ -18,19 +20,23 @@ height: 1.6em; border-radius: 4px; } + .heroes li.selected:hover { background-color: #BBD8DC !important; color: white; } + .heroes li:hover { color: #607D8B; background-color: #DDD; left: .1em; } + .heroes .text { position: relative; top: -3px; } + .heroes .badge { display: inline-block; font-size: small; diff --git a/shardis-ui/src/main/frontend/app/views/playground/heroes/app.component.ts b/shardis-ui/src/main/frontend/app/playground/heroes/app.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/views/playground/heroes/app.component.ts rename to shardis-ui/src/main/frontend/app/playground/heroes/app.component.ts diff --git a/shardis-ui/src/main/frontend/app/views/playground/heroes/hero-detail.component.ts b/shardis-ui/src/main/frontend/app/playground/heroes/hero-detail.component.ts similarity index 97% rename from shardis-ui/src/main/frontend/app/views/playground/heroes/hero-detail.component.ts rename to shardis-ui/src/main/frontend/app/playground/heroes/hero-detail.component.ts index c2ced4e..9077cb8 100644 --- a/shardis-ui/src/main/frontend/app/views/playground/heroes/hero-detail.component.ts +++ b/shardis-ui/src/main/frontend/app/playground/heroes/hero-detail.component.ts @@ -18,5 +18,5 @@ import {Hero} from './hero'; inputs: ['hero'] }) export class HeroDetailComponent { - hero: Hero; + hero:Hero; } diff --git a/shardis-ui/src/main/frontend/app/views/playground/heroes/hero.service.ts b/shardis-ui/src/main/frontend/app/playground/heroes/hero.service.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/views/playground/heroes/hero.service.ts rename to shardis-ui/src/main/frontend/app/playground/heroes/hero.service.ts diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/hero.ts b/shardis-ui/src/main/frontend/app/playground/heroes/hero.ts new file mode 100644 index 0000000..b1f8c94 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/playground/heroes/hero.ts @@ -0,0 +1,4 @@ +export interface Hero { + id:number; + name:string; +} diff --git a/shardis-ui/src/main/frontend/app/views/playground/heroes/mock-heroes.ts b/shardis-ui/src/main/frontend/app/playground/heroes/mock-heroes.ts similarity index 92% rename from shardis-ui/src/main/frontend/app/views/playground/heroes/mock-heroes.ts rename to shardis-ui/src/main/frontend/app/playground/heroes/mock-heroes.ts index ed04b97..fd7f623 100644 --- a/shardis-ui/src/main/frontend/app/views/playground/heroes/mock-heroes.ts +++ b/shardis-ui/src/main/frontend/app/playground/heroes/mock-heroes.ts @@ -1,6 +1,6 @@ import {Hero} from './hero'; -export var HEROES: Hero[] = [ +export var HEROES:Hero[] = [ {'id': 11, 'name': 'Mr. Nice'}, {'id': 12, 'name': 'Narco'}, {'id': 13, 'name': 'Bombasto'}, diff --git a/shardis-ui/src/main/frontend/app/playground/index.ts b/shardis-ui/src/main/frontend/app/playground/index.ts new file mode 100644 index 0000000..551f1d0 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/playground/index.ts @@ -0,0 +1 @@ +export * from './playground.component' diff --git a/shardis-ui/src/main/frontend/app/views/playground/playground.component.ts b/shardis-ui/src/main/frontend/app/playground/playground.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/views/playground/playground.component.ts rename to shardis-ui/src/main/frontend/app/playground/playground.component.ts diff --git a/shardis-ui/src/main/frontend/app/services/auth.service.ts b/shardis-ui/src/main/frontend/app/shared/auth/auth.service.ts similarity index 97% rename from shardis-ui/src/main/frontend/app/services/auth.service.ts rename to shardis-ui/src/main/frontend/app/shared/auth/auth.service.ts index 58dbb92..f3d00f5 100644 --- a/shardis-ui/src/main/frontend/app/services/auth.service.ts +++ b/shardis-ui/src/main/frontend/app/shared/auth/auth.service.ts @@ -28,7 +28,7 @@ export class AuthService { return this.authenticated; } - public authenticate(username: string, password: string) :Promise { + public authenticate(username:string, password:string):Promise { console.log('Authentication pending...'); diff --git a/shardis-ui/src/main/frontend/app/shared/auth/index.ts b/shardis-ui/src/main/frontend/app/shared/auth/index.ts new file mode 100644 index 0000000..cf52c9c --- /dev/null +++ b/shardis-ui/src/main/frontend/app/shared/auth/index.ts @@ -0,0 +1 @@ +export * from './auth.service' diff --git a/shardis-ui/src/main/frontend/app/shared/index.ts b/shardis-ui/src/main/frontend/app/shared/index.ts new file mode 100644 index 0000000..c5dfb98 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/shared/index.ts @@ -0,0 +1,4 @@ +export * from './router-active' +export * from './x-large' +export * from './auth' +export * from './lazy-loader' diff --git a/shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts b/shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts new file mode 100644 index 0000000..9c87ca9 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts @@ -0,0 +1 @@ +export * from './lazy-loader' diff --git a/shardis-ui/src/main/frontend/app/utils/lazy.loader.ts b/shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts similarity index 57% rename from shardis-ui/src/main/frontend/app/utils/lazy.loader.ts rename to shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts index b9c682c..2d7aab1 100644 --- a/shardis-ui/src/main/frontend/app/utils/lazy.loader.ts +++ b/shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts @@ -1,7 +1,6 @@ export enum LazyModule { ABOUT, - PLAYGROUND, - KITCHENSINK + PLAYGROUND } export class LazyLoader { @@ -12,13 +11,10 @@ export class LazyLoader { require.ensure([], (require) => { switch (lazymodule) { case LazyModule.ABOUT: - resolve(require('../views/about/about.component.ts')); + resolve(require('../../about')); break; case LazyModule.PLAYGROUND: - resolve(require('../views/playground/playground.component.ts')); - break; - case LazyModule.KITCHENSINK: - resolve(require('../views/kitchensink/kitchensink.component.ts')); + resolve(require('../../playground')); break; } }); diff --git a/shardis-ui/src/main/frontend/app/shared/router-active/index.ts b/shardis-ui/src/main/frontend/app/shared/router-active/index.ts new file mode 100644 index 0000000..1141e17 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/shared/router-active/index.ts @@ -0,0 +1 @@ +export * from './router-active.directive' diff --git a/shardis-ui/src/main/frontend/app/directives/router-active.directive.ts b/shardis-ui/src/main/frontend/app/shared/router-active/router-active.directive.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/directives/router-active.directive.ts rename to shardis-ui/src/main/frontend/app/shared/router-active/router-active.directive.ts diff --git a/shardis-ui/src/main/frontend/app/shared/x-large/index.ts b/shardis-ui/src/main/frontend/app/shared/x-large/index.ts new file mode 100644 index 0000000..406b414 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/shared/x-large/index.ts @@ -0,0 +1 @@ +export * from './x-large.directive' diff --git a/shardis-ui/src/main/frontend/app/directives/x-large.directive.spec.ts b/shardis-ui/src/main/frontend/app/shared/x-large/x-large.directive.spec.ts similarity index 68% rename from shardis-ui/src/main/frontend/app/directives/x-large.directive.spec.ts rename to shardis-ui/src/main/frontend/app/shared/x-large/x-large.directive.spec.ts index 2bcb56d..e6bf507 100644 --- a/shardis-ui/src/main/frontend/app/directives/x-large.directive.spec.ts +++ b/shardis-ui/src/main/frontend/app/shared/x-large/x-large.directive.spec.ts @@ -1,18 +1,9 @@ -import { - it, - inject, - async, - describe, - beforeEachProviders, -} from '@angular/core/testing'; - -import {Component, provide} from '@angular/core'; -import {BaseRequestOptions, Http} from '@angular/http'; -import {MockBackend} from '@angular/http/testing'; +import {it, inject, async, describe} from '@angular/core/testing'; +import {Component} from '@angular/core'; import {TestComponentBuilder} from '@angular/compiler/testing'; +import {XLarge} from './x-large.directive.ts'; // Load the implementations that should be tested -import {XLarge} from './x-large.directive.ts'; describe('x-large directive', () => { // Create a test component to test directives @@ -25,7 +16,7 @@ describe('x-large directive', () => { it('should sent font-size to x-large', async(inject([TestComponentBuilder], (tcb) => { return tcb.overrideTemplate(TestComponent, '
Content
') - .createAsync(TestComponent).then((fixture: any) => { + .createAsync(TestComponent).then((fixture:any) => { fixture.detectChanges(); let compiled = fixture.debugElement.nativeElement.children[0]; expect(compiled.style.fontSize).toBe('x-large'); diff --git a/shardis-ui/src/main/frontend/app/directives/x-large.directive.ts b/shardis-ui/src/main/frontend/app/shared/x-large/x-large.directive.ts similarity index 83% rename from shardis-ui/src/main/frontend/app/directives/x-large.directive.ts rename to shardis-ui/src/main/frontend/app/shared/x-large/x-large.directive.ts index c954584..89d05a1 100644 --- a/shardis-ui/src/main/frontend/app/directives/x-large.directive.ts +++ b/shardis-ui/src/main/frontend/app/shared/x-large/x-large.directive.ts @@ -1,4 +1,4 @@ -import {Directive, Component, ElementRef, Renderer} from '@angular/core'; +import {Directive, ElementRef, Renderer} from '@angular/core'; /* * Directive * XLarge is a simple directive to show how one is made @@ -7,7 +7,7 @@ import {Directive, Component, ElementRef, Renderer} from '@angular/core'; selector: '[x-large]' // using [ ] means selecting attributes }) export class XLarge { - constructor(element: ElementRef, renderer: Renderer) { + constructor(element:ElementRef, renderer:Renderer) { // simple DOM manipulation to set font size to x-large // `nativeElement` is the direct reference to the DOM element // element.nativeElement.style.fontSize = 'x-large'; diff --git a/shardis-ui/src/main/frontend/app/views/playground/heroes/hero.ts b/shardis-ui/src/main/frontend/app/views/playground/heroes/hero.ts deleted file mode 100644 index a61b497..0000000 --- a/shardis-ui/src/main/frontend/app/views/playground/heroes/hero.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Hero { - id: number; - name: string; -} diff --git a/shardis-ui/src/main/frontend/main.ts b/shardis-ui/src/main/frontend/main.ts index 9f4c6c8..6b1b6e2 100644 --- a/shardis-ui/src/main/frontend/main.ts +++ b/shardis-ui/src/main/frontend/main.ts @@ -2,14 +2,13 @@ * Providers provided by Angular */ import {bootstrap} from '@angular/platform-browser-dynamic'; +import {DIRECTIVES, PIPES, PROVIDERS, ENV_PROVIDERS} from './platform'; +import {App} from './app'; /* * App Component * our top level component that holds all of our components */ -import {DIRECTIVES, PIPES, PROVIDERS} from './platform/browser'; -import {ENV_PROVIDERS} from './platform/environment'; -import {App} from './app/app.component'; /* * Load styles diff --git a/shardis-ui/src/main/frontend/platform/browser/directives.ts b/shardis-ui/src/main/frontend/platform/browser/directives.ts index feb7c0a..d6e298c 100644 --- a/shardis-ui/src/main/frontend/platform/browser/directives.ts +++ b/shardis-ui/src/main/frontend/platform/browser/directives.ts @@ -1,7 +1,7 @@ import {provide, PLATFORM_DIRECTIVES} from '@angular/core'; import {ROUTER_DIRECTIVES} from '@angular/router'; -import {MATERIAL_DIRECTIVES} from './material2/material2'; -import {RouterActive} from '../../app/directives/router-active.directive'; +import {MATERIAL_DIRECTIVES} from './material2'; +import {RouterActive} from '../../app/shared/router-active/router-active.directive'; // Angular 2 Router diff --git a/shardis-ui/src/main/frontend/platform/browser/material2/index.ts b/shardis-ui/src/main/frontend/platform/browser/material2/index.ts new file mode 100644 index 0000000..7c40c96 --- /dev/null +++ b/shardis-ui/src/main/frontend/platform/browser/material2/index.ts @@ -0,0 +1 @@ +export * from './material2' diff --git a/shardis-ui/src/main/frontend/platform/browser/pipes.ts b/shardis-ui/src/main/frontend/platform/browser/pipes.ts index 3458f1c..07c9471 100644 --- a/shardis-ui/src/main/frontend/platform/browser/pipes.ts +++ b/shardis-ui/src/main/frontend/platform/browser/pipes.ts @@ -1,5 +1,5 @@ import {provide, PLATFORM_PIPES} from '@angular/core'; -import {MATERIAL_PIPES} from './material2/material2'; +import {MATERIAL_PIPES} from './material2'; // application_pipes: pipes that are global through out the application export const APPLICATION_PIPES = []; diff --git a/shardis-ui/src/main/frontend/platform/browser/providers.ts b/shardis-ui/src/main/frontend/platform/browser/providers.ts index 31285f7..0d96e56 100644 --- a/shardis-ui/src/main/frontend/platform/browser/providers.ts +++ b/shardis-ui/src/main/frontend/platform/browser/providers.ts @@ -4,7 +4,7 @@ import {HTTP_PROVIDERS} from '@angular/http'; import {ROUTER_PROVIDERS} from '@angular/router'; import {LocationStrategy} from '@angular/common/src/location/location_strategy'; import {PathLocationStrategy} from '@angular/common/src/location/path_location_strategy'; -import {MATERIAL_PROVIDERS} from './material2/material2'; +import {MATERIAL_PROVIDERS} from './material2'; import {NG2_WEBSTORAGE} from 'ng2-webstorage'; // Angular 2 diff --git a/shardis-ui/src/main/frontend/platform/index.ts b/shardis-ui/src/main/frontend/platform/index.ts new file mode 100644 index 0000000..d124f0f --- /dev/null +++ b/shardis-ui/src/main/frontend/platform/index.ts @@ -0,0 +1,2 @@ +export * from './browser' +export * from './environment' diff --git a/shardis-ui/src/main/frontend/polyfills.ts b/shardis-ui/src/main/frontend/polyfills.ts index a8bf4c5..cc4ab1e 100644 --- a/shardis-ui/src/main/frontend/polyfills.ts +++ b/shardis-ui/src/main/frontend/polyfills.ts @@ -1,12 +1,12 @@ // Ccre.js import 'core-js/es6'; import 'core-js/es7/reflect'; +import 'ts-helpers'; // Zone.js require('zone.js/dist/zone'); // Typescript emit helpers polyfill -import 'ts-helpers'; if ('production' !== ENV) { Error['stackTraceLimit'] = Infinity; diff --git a/shardis-ui/src/main/frontend/vendor.ts b/shardis-ui/src/main/frontend/vendor.ts index 40eeece..93cd159 100644 --- a/shardis-ui/src/main/frontend/vendor.ts +++ b/shardis-ui/src/main/frontend/vendor.ts @@ -5,7 +5,6 @@ import '@angular/core'; import '@angular/common'; import '@angular/http'; import '@angular/router'; -// Material import import '@angular2-material/button'; import '@angular2-material/card'; import '@angular2-material/checkbox'; @@ -21,8 +20,9 @@ import '@angular2-material/sidenav'; import '@angular2-material/slide-toggle'; import '@angular2-material/tabs'; import '@angular2-material/toolbar'; -// RxJS import 'rxjs/Rx'; +// Material import +// RxJS if ('production' === ENV) { // Production From 0b5a705ab8ffd4fe59175cb66034522b25626999 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Fri, 10 Jun 2016 22:22:34 +0200 Subject: [PATCH 04/46] dependency updates --- CHANGELOG.md | 1 + README.md | 1 + shardis-ui/package.json | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e01a573..33e5397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### 1.8.0 (unreleased) * Better directory structure for angular components +* Dependency updates ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index 1c81fee..f08e9fe 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ npm run e2e ### 1.8.0 (unreleased) * Better directory structure for angular components +* Dependency updates ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 3489fad..522fbfa 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "autoprefixer": "6.3.6", - "awesome-typescript-loader": "0.19.0", + "awesome-typescript-loader": "1.0.0", "copy-webpack-plugin": "3.0.1", "css-loader": "0.23.1", "es6-promise": "3.2.1", @@ -56,7 +56,7 @@ "expose-loader": "0.7.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.8.5", - "html-webpack-plugin": "2.19.0", + "html-webpack-plugin": "2.20.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "istanbul-instrumenter-loader": "0.2.0", @@ -65,7 +65,7 @@ "karma-chrome-launcher": "1.0.1", "karma-coverage": "1.0.0", "karma-jasmine": "1.0.2", - "karma-mocha-reporter": "2.0.3", + "karma-mocha-reporter": "2.0.4", "karma-phantomjs-launcher": "1.0.0", "karma-sourcemap-loader": "0.3.7", "karma-webpack": "1.7.0", From db65a439024ffb0192383c671654eded3e96412a Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sat, 11 Jun 2016 10:57:21 +0200 Subject: [PATCH 05/46] dependency updates --- shardis-ui/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 522fbfa..cc91fef 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -83,12 +83,12 @@ "source-map-loader": "0.1.5", "style-loader": "0.13.1", "ts-helpers": "1.1.1", - "ts-node": "0.8.0", + "ts-node": "0.9.0", "tslint": "3.11.0", "tslint-loader": "2.1.4", "typedoc": "0.4.2", "typescript": "1.8.10", - "typings": "1.0.4", + "typings": "1.0.5", "url-loader": "0.5.7", "webpack": "1.13.1", "webpack-dev-server": "1.14.1", From f3fce9d8badc5a760ee9b64e4b9b11abf84df9c9 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sun, 12 Jun 2016 14:07:10 +0200 Subject: [PATCH 06/46] dependency updates --- shardis-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shardis-ui/package.json b/shardis-ui/package.json index cc91fef..25c8ab3 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -94,7 +94,7 @@ "webpack-dev-server": "1.14.1", "webpack-load-plugins": "0.1.2", "webpack-md5-hash": "0.0.5", - "webpack-validator": "2.1.2" + "webpack-validator": "2.1.3" }, "scripts": { "clean": "npm cache clean && rimraf node node_modules doc typings coverage ./src/main/resources/static/*", From da54088ffe05c7417910916c296bf636ff7e8002 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Mon, 13 Jun 2016 23:14:26 +0200 Subject: [PATCH 07/46] dependency updates --- .gitignore | 1 + shardis-ui/package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a61d2be..ef70fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ shardis-api/target/ shardis-ui/target/ ### node +npm-debug.log shardis-ui/etc/ shardis-ui/node/ shardis-ui/node_modules/ diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 25c8ab3..2f99d4c 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -56,7 +56,7 @@ "expose-loader": "0.7.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.8.5", - "html-webpack-plugin": "2.20.0", + "html-webpack-plugin": "2.21.0", "http-server": "0.9.0", "imports-loader": "0.6.5", "istanbul-instrumenter-loader": "0.2.0", @@ -83,7 +83,7 @@ "source-map-loader": "0.1.5", "style-loader": "0.13.1", "ts-helpers": "1.1.1", - "ts-node": "0.9.0", + "ts-node": "0.9.1", "tslint": "3.11.0", "tslint-loader": "2.1.4", "typedoc": "0.4.2", From e967829f20b514eaa7e78710bb38be3fbbc7e7bd Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Tue, 14 Jun 2016 19:12:12 +0200 Subject: [PATCH 08/46] dependency updates --- shardis-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 2f99d4c..6d2e14e 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -88,7 +88,7 @@ "tslint-loader": "2.1.4", "typedoc": "0.4.2", "typescript": "1.8.10", - "typings": "1.0.5", + "typings": "1.1.0", "url-loader": "0.5.7", "webpack": "1.13.1", "webpack-dev-server": "1.14.1", From 69dde31cf8a613a429162819aeb5f6e2da91a9ed Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sun, 19 Jun 2016 15:30:11 +0200 Subject: [PATCH 09/46] updated Angular to rc.2 --- CHANGELOG.md | 2 ++ README.md | 2 ++ shardis-ui/config/webpack.config.factory.js | 5 ++-- shardis-ui/package.json | 24 +++++++++---------- .../{home.spec.ts => home.component.spec.ts} | 0 shardis-ui/tsconfig.json | 4 ---- 6 files changed, 17 insertions(+), 20 deletions(-) rename shardis-ui/src/main/frontend/app/home/{home.spec.ts => home.component.spec.ts} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33e5397..5368f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ### 1.8.0 (unreleased) * Better directory structure for angular components * Dependency updates +* Updated Angular to rc.2 +* Migrate awesome-ts-loader to ts-loader due to problems with karma ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index f08e9fe..0864177 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,8 @@ npm run e2e ### 1.8.0 (unreleased) * Better directory structure for angular components * Dependency updates +* Updated Angular to rc.2 +* Migrate awesome-ts-loader to ts-loader due to problems with karma ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/config/webpack.config.factory.js b/shardis-ui/config/webpack.config.factory.js index 1801056..526cb18 100644 --- a/shardis-ui/config/webpack.config.factory.js +++ b/shardis-ui/config/webpack.config.factory.js @@ -14,7 +14,6 @@ var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); var WebpackMd5Hash = require('webpack-md5-hash'); var CopyWebpackPlugin = require('copy-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin'); -var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin; var ExtractTextPlugin = require("extract-text-webpack-plugin"); var autoprefixer = require('autoprefixer'); @@ -68,7 +67,7 @@ var baseWebpackConfig = { loaders: [ { test: /\.ts$/, - loader: 'awesome-typescript' + loader: 'ts' }, { @@ -115,7 +114,7 @@ var baseWebpackConfig = { autoprefixer({browsers: ['last 2 versions'], remove: false}) ], plugins: [ - new ForkCheckerPlugin() + ] }; diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 6d2e14e..33aea6a 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -13,15 +13,13 @@ }, "private": true, "dependencies": { - "@angular/common": "2.0.0-rc.1", - "@angular/compiler": "2.0.0-rc.1", - "@angular/core": "2.0.0-rc.1", - "@angular/http": "2.0.0-rc.1", - "@angular/platform-browser": "2.0.0-rc.1", - "@angular/platform-browser-dynamic": "2.0.0-rc.1", - "@angular/platform-server": "2.0.0-rc.1", - "@angular/router": "2.0.0-rc.1", - "@angular/upgrade": "2.0.0-rc.1", + "@angular/common": "2.0.0-rc.2", + "@angular/compiler": "2.0.0-rc.2", + "@angular/core": "2.0.0-rc.2", + "@angular/http": "2.0.0-rc.2", + "@angular/platform-browser": "2.0.0-rc.2", + "@angular/platform-browser-dynamic": "2.0.0-rc.2", + "@angular/router": "2.0.0-rc.2", "@angular2-material/button": "2.0.0-alpha.5-2", "@angular2-material/card": "2.0.0-alpha.5-2", "@angular2-material/checkbox": "2.0.0-alpha.5-2", @@ -46,7 +44,6 @@ }, "devDependencies": { "autoprefixer": "6.3.6", - "awesome-typescript-loader": "1.0.0", "copy-webpack-plugin": "3.0.1", "css-loader": "0.23.1", "es6-promise": "3.2.1", @@ -69,7 +66,7 @@ "karma-phantomjs-launcher": "1.0.0", "karma-sourcemap-loader": "0.3.7", "karma-webpack": "1.7.0", - "node-sass": "3.7.0", + "node-sass": "3.8.0", "npm-check-updates": "^2.6.7", "parse5": "2.1.5", "phantomjs-polyfill": "0.0.2", @@ -83,12 +80,13 @@ "source-map-loader": "0.1.5", "style-loader": "0.13.1", "ts-helpers": "1.1.1", + "ts-loader": "^0.8.2", "ts-node": "0.9.1", "tslint": "3.11.0", "tslint-loader": "2.1.4", - "typedoc": "0.4.2", + "typedoc": "0.4.3", "typescript": "1.8.10", - "typings": "1.1.0", + "typings": "1.3.0", "url-loader": "0.5.7", "webpack": "1.13.1", "webpack-dev-server": "1.14.1", diff --git a/shardis-ui/src/main/frontend/app/home/home.spec.ts b/shardis-ui/src/main/frontend/app/home/home.component.spec.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/home/home.spec.ts rename to shardis-ui/src/main/frontend/app/home/home.component.spec.ts diff --git a/shardis-ui/tsconfig.json b/shardis-ui/tsconfig.json index 627d7d5..823362a 100644 --- a/shardis-ui/tsconfig.json +++ b/shardis-ui/tsconfig.json @@ -12,10 +12,6 @@ "noEmitHelpers": true, "noImplicitAny": false }, - "awesomeTypescriptLoaderOptions": { - "resolveGlobs": true, - "forkChecker": true - }, "exclude": [ "node_modules" ] From 9692e7d8ff206e2e77de483d45a035bf87c82fb9 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Mon, 20 Jun 2016 19:04:10 +0200 Subject: [PATCH 10/46] updated router to 3.0 --- CHANGELOG.md | 1 + README.md | 1 + shardis-ui/package.json | 5 +- .../src/main/frontend/app/app.component.html | 4 +- .../src/main/frontend/app/app.component.ts | 36 ++----------- .../src/main/frontend/app/app.routes.ts | 32 ++++++++++++ shardis-ui/src/main/frontend/app/app.spec.ts | 10 ++-- .../frontend/app/home/home.component.spec.ts | 7 ++- .../app/home/shared/title.service.spec.ts | 6 +-- .../frontend/app/login/login.component.ts | 2 +- .../src/main/frontend/app/shared/index.ts | 1 - .../app/shared/router-active/index.ts | 1 - .../router-active/router-active.directive.ts | 51 ------------------- .../src/main/frontend/app/testing/index.ts | 1 + .../src/main/frontend/app/testing/router.ts | 16 ++++++ shardis-ui/src/main/frontend/main.ts | 4 +- .../frontend/platform/browser/directives.ts | 16 +++--- .../main/frontend/platform/browser/pipes.ts | 8 ++- .../frontend/platform/browser/providers.ts | 18 ++----- shardis-ui/src/main/frontend/vendor.ts | 3 +- 20 files changed, 97 insertions(+), 126 deletions(-) create mode 100644 shardis-ui/src/main/frontend/app/app.routes.ts delete mode 100644 shardis-ui/src/main/frontend/app/shared/router-active/index.ts delete mode 100644 shardis-ui/src/main/frontend/app/shared/router-active/router-active.directive.ts create mode 100644 shardis-ui/src/main/frontend/app/testing/index.ts create mode 100644 shardis-ui/src/main/frontend/app/testing/router.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 5368f59..1f07c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Dependency updates * Updated Angular to rc.2 * Migrate awesome-ts-loader to ts-loader due to problems with karma +* Migrate to router 3 ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index 0864177..2ffe270 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ npm run e2e * Dependency updates * Updated Angular to rc.2 * Migrate awesome-ts-loader to ts-loader due to problems with karma +* Migrate to router 3 ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 33aea6a..73b7a80 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -19,7 +19,8 @@ "@angular/http": "2.0.0-rc.2", "@angular/platform-browser": "2.0.0-rc.2", "@angular/platform-browser-dynamic": "2.0.0-rc.2", - "@angular/router": "2.0.0-rc.2", + "@angular/router": "3.0.0-alpha.7", + "@angular/forms": "^0.1.0", "@angular2-material/button": "2.0.0-alpha.5-2", "@angular2-material/card": "2.0.0-alpha.5-2", "@angular2-material/checkbox": "2.0.0-alpha.5-2", @@ -76,7 +77,7 @@ "raw-loader": "0.5.1", "remap-istanbul": "0.6.4", "rimraf": "2.5.2", - "sass-loader": "3.2.0", + "sass-loader": "3.2.1", "source-map-loader": "0.1.5", "style-loader": "0.13.1", "ts-helpers": "1.1.1", diff --git a/shardis-ui/src/main/frontend/app/app.component.html b/shardis-ui/src/main/frontend/app/app.component.html index c45153e..9fa79b6 100644 --- a/shardis-ui/src/main/frontend/app/app.component.html +++ b/shardis-ui/src/main/frontend/app/app.component.html @@ -2,7 +2,7 @@ - + {{view.icon}} {{view.name}} {{view.description}} @@ -19,7 +19,7 @@ {{ name }} - Login diff --git a/shardis-ui/src/main/frontend/app/app.component.ts b/shardis-ui/src/main/frontend/app/app.component.ts index ae22e94..dc1a6c8 100644 --- a/shardis-ui/src/main/frontend/app/app.component.ts +++ b/shardis-ui/src/main/frontend/app/app.component.ts @@ -1,10 +1,6 @@ import {Component, OnInit} from '@angular/core'; -import {Routes, Router} from '@angular/router'; -import {Home} from './home'; +import {Router} from '@angular/router'; import {AuthService} from './shared'; -import {About} from './about'; -import {Playground} from './playground'; -import {Login} from './login'; @Component({ selector: 'app', @@ -14,28 +10,6 @@ import {Login} from './login'; styles: [require('./app.component.scss')], template: require('./app.component.html') }) -@Routes([ - { - path: '/', - component: Home as any - }, - { - path: '/about', - component: About as any//() => LazyLoader.lazyLoad(LazyModule.ABOUT).then(m => m['About']), - }, - { - path: '/playground', - component: Playground as any //() => LazyLoader.lazyLoad(LazyModule.PLAYGROUND).then(m => m['Playground']), - }, - { - path: '/login', - component: Login as any - }, - { - path: '*', - component: Home as any - } -]) export class App implements OnInit { name = 'Spring Boot Angular 2 Webpack Starter'; url = 'https://github.com/kucharzyk'; @@ -47,19 +21,19 @@ export class App implements OnInit { name: 'Home', description: 'Home page', icon: 'public', - link: ['/'] + link: [''] }, { name: 'Playground', description: 'Playground page', icon: 'casino', - link: ['/playground'] + link: ['playground'] }, { name: 'About', description: 'About page', icon: 'person', - link: ['/about'] + link: ['about'] } ]; @@ -68,7 +42,7 @@ export class App implements OnInit { logMeOut():void { this.authService.logout(); - this.router.navigate(['/']); + this.router.navigate(['']); } ngOnInit():void { diff --git a/shardis-ui/src/main/frontend/app/app.routes.ts b/shardis-ui/src/main/frontend/app/app.routes.ts new file mode 100644 index 0000000..4686266 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/app.routes.ts @@ -0,0 +1,32 @@ +import {provideRouter, RouterConfig} from '@angular/router'; +import {Home} from './home'; +import {About} from './about'; +import {Playground} from './playground'; +import {Login} from './login'; + +const routes:RouterConfig = [ + { + path: '', + component: Home as any + }, + { + path: 'about', + component: About as any + }, + { + path: 'playground', + component: Playground as any + }, + { + path: 'login', + component: Login as any + }, + { + path: '*', + component: Home as any + } +]; + +export const APP_ROUTER_PROVIDERS = [ + provideRouter(routes) +]; diff --git a/shardis-ui/src/main/frontend/app/app.spec.ts b/shardis-ui/src/main/frontend/app/app.spec.ts index e7d1848..4bf216c 100644 --- a/shardis-ui/src/main/frontend/app/app.spec.ts +++ b/shardis-ui/src/main/frontend/app/app.spec.ts @@ -3,8 +3,7 @@ import {App} from './app.component'; import {AuthService} from './shared'; import {BaseRequestOptions, Http} from '@angular/http'; import {MockBackend} from '@angular/http/testing/mock_backend'; -import {provide} from '@angular/core'; -import {ROUTER_FAKE_PROVIDERS} from '@angular/router/testing'; +import {TEST_ROUTER_PROVIDERS} from './testing/router'; // Load the implementations that should be tested @@ -14,13 +13,14 @@ describe('App', () => { App, BaseRequestOptions, MockBackend, - ROUTER_FAKE_PROVIDERS, - provide(Http, { + ...TEST_ROUTER_PROVIDERS, + { + provide: Http, useFactory: function (backend, defaultOptions) { return new Http(backend, defaultOptions); }, deps: [MockBackend, BaseRequestOptions] - }), + }, AuthService, ]); diff --git a/shardis-ui/src/main/frontend/app/home/home.component.spec.ts b/shardis-ui/src/main/frontend/app/home/home.component.spec.ts index 85602ad..8d17093 100644 --- a/shardis-ui/src/main/frontend/app/home/home.component.spec.ts +++ b/shardis-ui/src/main/frontend/app/home/home.component.spec.ts @@ -1,5 +1,4 @@ import {it, inject, describe, beforeEachProviders} from '@angular/core/testing'; -import {provide} from '@angular/core'; import {BaseRequestOptions, Http, Response, ResponseOptions} from '@angular/http'; import {MockBackend} from '@angular/http/testing'; import {Home} from './home.component'; @@ -14,13 +13,13 @@ describe('Home', () => { beforeEachProviders(() => [ BaseRequestOptions, MockBackend, - provide(Http, { + { + provide: Http, useFactory: function (backend, defaultOptions) { return new Http(backend, defaultOptions); }, deps: [MockBackend, BaseRequestOptions] - }), - + }, Title, Home, AuthService diff --git a/shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts b/shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts index bc3675b..e0e5f29 100644 --- a/shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts +++ b/shardis-ui/src/main/frontend/app/home/shared/title.service.spec.ts @@ -1,5 +1,4 @@ import {it, inject, async, beforeEachProviders} from '@angular/core/testing'; -import {provide} from '@angular/core'; import {BaseRequestOptions, Http, ResponseOptions, Response} from '@angular/http'; import {MockBackend} from '@angular/http/testing'; import {Title} from './title.service'; @@ -9,12 +8,13 @@ describe('Title', () => { beforeEachProviders(() => [ BaseRequestOptions, MockBackend, - provide(Http, { + { + provide: Http, useFactory: function (backend, defaultOptions) { return new Http(backend, defaultOptions); }, deps: [MockBackend, BaseRequestOptions] - }), + }, Title, AuthService ]); diff --git a/shardis-ui/src/main/frontend/app/login/login.component.ts b/shardis-ui/src/main/frontend/app/login/login.component.ts index 0f80a5b..b184fcb 100644 --- a/shardis-ui/src/main/frontend/app/login/login.component.ts +++ b/shardis-ui/src/main/frontend/app/login/login.component.ts @@ -25,7 +25,7 @@ export class Login implements OnInit { .catch(errorMessage => this.message = errorMessage) .then(() => { if (this.authService.isAuthenticated()) { - this.router.navigate(['/']); + this.router.navigate(['']); } }); diff --git a/shardis-ui/src/main/frontend/app/shared/index.ts b/shardis-ui/src/main/frontend/app/shared/index.ts index c5dfb98..ed64032 100644 --- a/shardis-ui/src/main/frontend/app/shared/index.ts +++ b/shardis-ui/src/main/frontend/app/shared/index.ts @@ -1,4 +1,3 @@ -export * from './router-active' export * from './x-large' export * from './auth' export * from './lazy-loader' diff --git a/shardis-ui/src/main/frontend/app/shared/router-active/index.ts b/shardis-ui/src/main/frontend/app/shared/router-active/index.ts deleted file mode 100644 index 1141e17..0000000 --- a/shardis-ui/src/main/frontend/app/shared/router-active/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './router-active.directive' diff --git a/shardis-ui/src/main/frontend/app/shared/router-active/router-active.directive.ts b/shardis-ui/src/main/frontend/app/shared/router-active/router-active.directive.ts deleted file mode 100644 index a39659b..0000000 --- a/shardis-ui/src/main/frontend/app/shared/router-active/router-active.directive.ts +++ /dev/null @@ -1,51 +0,0 @@ -import {Router} from '@angular/router'; -import {isPresent} from '@angular/core/src/facade/lang'; -import {Directive, Query, QueryList, Attribute, ElementRef, Renderer, Optional, Input} from '@angular/core'; -import {RouterLink} from '@angular/router/src/directives/router_link'; - -/** - * RouterActive dynamically finds the first element with routerLink and toggles the active class - * - * ## Use - * - * ``` - *
  • Home
  • - *
  • Home
  • - * ``` - */ -@Directive({ - selector: '[router-active], [routerActive]' -}) -export class RouterActive { - @Input() routerActive:string = null; - routerActiveAttr:string = 'active'; - - constructor(public router:Router, - public element:ElementRef, - public renderer:Renderer, - @Query(RouterLink as any) public routerLink:QueryList, - @Optional() @Attribute('router-active') routerActiveAttr?:string) { - this.routerActiveAttr = this._defaultAttrValue(routerActiveAttr); - } - - ngOnInit() { - this.router.changes.subscribe(() => { - if (this.routerLink.first) { - this._updateClass(); - } - }); - } - - private _updateClass() { - let active = this.routerLink.first.isActive; - this.renderer.setElementClass(this.element.nativeElement, this._attrOrProp(), active); - } - - private _defaultAttrValue(attr?:string) { - return this.routerActiveAttr = attr || this.routerActiveAttr; - } - - private _attrOrProp() { - return isPresent(this.routerActive) ? this.routerActive : this.routerActiveAttr; - } -} diff --git a/shardis-ui/src/main/frontend/app/testing/index.ts b/shardis-ui/src/main/frontend/app/testing/index.ts new file mode 100644 index 0000000..398cae7 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/testing/index.ts @@ -0,0 +1 @@ +export * from './router' diff --git a/shardis-ui/src/main/frontend/app/testing/router.ts b/shardis-ui/src/main/frontend/app/testing/router.ts new file mode 100644 index 0000000..c7104a3 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/testing/router.ts @@ -0,0 +1,16 @@ +import {Router, ActivatedRoute} from '@angular/router'; +class MockRouter { +} +class MockActivatedRoute { +} + +export const TEST_ROUTER_PROVIDERS = [ + { + provide: Router, + useClass: MockRouter + }, + { + provide: ActivatedRoute, + useClass: MockActivatedRoute + } +]; diff --git a/shardis-ui/src/main/frontend/main.ts b/shardis-ui/src/main/frontend/main.ts index 6b1b6e2..5fab19e 100644 --- a/shardis-ui/src/main/frontend/main.ts +++ b/shardis-ui/src/main/frontend/main.ts @@ -4,6 +4,7 @@ import {bootstrap} from '@angular/platform-browser-dynamic'; import {DIRECTIVES, PIPES, PROVIDERS, ENV_PROVIDERS} from './platform'; import {App} from './app'; +import {APP_ROUTER_PROVIDERS} from './app/app.routes'; /* * App Component @@ -26,7 +27,8 @@ export function main() { ...PROVIDERS, ...ENV_PROVIDERS, ...DIRECTIVES, - ...PIPES + ...PIPES, + ...APP_ROUTER_PROVIDERS ]) .catch(err => console.error(err)); diff --git a/shardis-ui/src/main/frontend/platform/browser/directives.ts b/shardis-ui/src/main/frontend/platform/browser/directives.ts index d6e298c..1a5716d 100644 --- a/shardis-ui/src/main/frontend/platform/browser/directives.ts +++ b/shardis-ui/src/main/frontend/platform/browser/directives.ts @@ -1,17 +1,17 @@ -import {provide, PLATFORM_DIRECTIVES} from '@angular/core'; -import {ROUTER_DIRECTIVES} from '@angular/router'; +import {PLATFORM_DIRECTIVES} from '@angular/core'; import {MATERIAL_DIRECTIVES} from './material2'; -import {RouterActive} from '../../app/shared/router-active/router-active.directive'; - -// Angular 2 Router +import {ROUTER_DIRECTIVES} from '@angular/router'; // application_directives: directives that are global through out the application export const APPLICATION_DIRECTIVES = [ - ...ROUTER_DIRECTIVES, ...MATERIAL_DIRECTIVES, - RouterActive + ...ROUTER_DIRECTIVES, ]; export const DIRECTIVES = [ - provide(PLATFORM_DIRECTIVES, {useValue: APPLICATION_DIRECTIVES, multi: true}) + { + provide: PLATFORM_DIRECTIVES, + useValue: APPLICATION_DIRECTIVES, + multi: true + } ]; diff --git a/shardis-ui/src/main/frontend/platform/browser/pipes.ts b/shardis-ui/src/main/frontend/platform/browser/pipes.ts index 07c9471..a805209 100644 --- a/shardis-ui/src/main/frontend/platform/browser/pipes.ts +++ b/shardis-ui/src/main/frontend/platform/browser/pipes.ts @@ -1,4 +1,4 @@ -import {provide, PLATFORM_PIPES} from '@angular/core'; +import {PLATFORM_PIPES} from '@angular/core'; import {MATERIAL_PIPES} from './material2'; // application_pipes: pipes that are global through out the application @@ -6,5 +6,9 @@ export const APPLICATION_PIPES = []; export const PIPES = [ ...MATERIAL_PIPES, - provide(PLATFORM_PIPES, {useValue: APPLICATION_PIPES, multi: true}) + { + provide: PLATFORM_PIPES, + useValue: APPLICATION_PIPES, + multi: true + } ]; diff --git a/shardis-ui/src/main/frontend/platform/browser/providers.ts b/shardis-ui/src/main/frontend/platform/browser/providers.ts index 0d96e56..8728781 100644 --- a/shardis-ui/src/main/frontend/platform/browser/providers.ts +++ b/shardis-ui/src/main/frontend/platform/browser/providers.ts @@ -1,29 +1,21 @@ -import {provide} from '@angular/core'; -import {FORM_PROVIDERS} from '@angular/common'; +import {FORM_PROVIDERS, LocationStrategy, PathLocationStrategy} from '@angular/common'; import {HTTP_PROVIDERS} from '@angular/http'; -import {ROUTER_PROVIDERS} from '@angular/router'; -import {LocationStrategy} from '@angular/common/src/location/location_strategy'; -import {PathLocationStrategy} from '@angular/common/src/location/path_location_strategy'; import {MATERIAL_PROVIDERS} from './material2'; import {NG2_WEBSTORAGE} from 'ng2-webstorage'; -// Angular 2 - -// Angular 2 Http -// Angular 2 Router -// ng2-webstorage - /* * Application Providers/Directives/Pipes * providers/directives/pipes that only live in our browser environment */ export const APPLICATION_PROVIDERS = [ - ...ROUTER_PROVIDERS, ...FORM_PROVIDERS, ...HTTP_PROVIDERS, ...MATERIAL_PROVIDERS, ...NG2_WEBSTORAGE, - provide(LocationStrategy, {useClass: PathLocationStrategy as any}), + { + provide: LocationStrategy, + useClass: PathLocationStrategy as any + }, ]; export const PROVIDERS = [ diff --git a/shardis-ui/src/main/frontend/vendor.ts b/shardis-ui/src/main/frontend/vendor.ts index 93cd159..d3dd071 100644 --- a/shardis-ui/src/main/frontend/vendor.ts +++ b/shardis-ui/src/main/frontend/vendor.ts @@ -4,6 +4,7 @@ import '@angular/platform-browser-dynamic'; import '@angular/core'; import '@angular/common'; import '@angular/http'; +import '@angular/forms'; import '@angular/router'; import '@angular2-material/button'; import '@angular2-material/card'; @@ -21,7 +22,7 @@ import '@angular2-material/slide-toggle'; import '@angular2-material/tabs'; import '@angular2-material/toolbar'; import 'rxjs/Rx'; -// Material import +// Material import // RxJS if ('production' === ENV) { From 71f90ccc5d3a8cb56304f3ca3811aaaf604c2288 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Mon, 20 Jun 2016 21:58:25 +0200 Subject: [PATCH 11/46] fixed not found route --- shardis-ui/src/main/frontend/app/app.routes.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shardis-ui/src/main/frontend/app/app.routes.ts b/shardis-ui/src/main/frontend/app/app.routes.ts index 4686266..ea30350 100644 --- a/shardis-ui/src/main/frontend/app/app.routes.ts +++ b/shardis-ui/src/main/frontend/app/app.routes.ts @@ -7,7 +7,11 @@ import {Login} from './login'; const routes:RouterConfig = [ { path: '', - component: Home as any + redirectTo: 'home' + }, + { + path: 'home', + component: Home as any, }, { path: 'about', @@ -22,9 +26,10 @@ const routes:RouterConfig = [ component: Login as any }, { - path: '*', - component: Home as any - } + path: '**', + redirectTo: 'home', + terminal: true + }, ]; export const APP_ROUTER_PROVIDERS = [ From c9b9cc311de2684c47fa4197f80f61ce3cf82317 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Mon, 20 Jun 2016 22:10:11 +0200 Subject: [PATCH 12/46] webpack config refactoring --- shardis-ui/config/webpack.config.factory.js | 45 +++++++-------------- shardis-ui/config/webpack.helpers.js | 10 +++++ 2 files changed, 24 insertions(+), 31 deletions(-) create mode 100644 shardis-ui/config/webpack.helpers.js diff --git a/shardis-ui/config/webpack.config.factory.js b/shardis-ui/config/webpack.config.factory.js index 526cb18..c018523 100644 --- a/shardis-ui/config/webpack.config.factory.js +++ b/shardis-ui/config/webpack.config.factory.js @@ -1,4 +1,4 @@ -var path = require('path'); +var helpers = require('./webpack.helpers'); var fs = require('fs'); var webpack = require('webpack'); @@ -50,17 +50,17 @@ var baseWebpackConfig = { test: /\.ts$/, loader: 'tslint-loader', exclude: [ - fullPathTo('../node_modules') + helpers.absolutePath('../node_modules') ] }, { test: /\.js$/, loader: "source-map-loader", exclude: [ - fullPathTo('../node_modules/rxjs'), - fullPathTo('../node_modules/@angular'), - fullPathTo('../node_modules/@angular2-material'), - fullPathTo('../node_modules/ng2-webstorage') + helpers.absolutePath('../node_modules/rxjs'), + helpers.absolutePath('../node_modules/@angular'), + helpers.absolutePath('../node_modules/@angular2-material'), + helpers.absolutePath('../node_modules/ng2-webstorage') ] } ], @@ -84,7 +84,7 @@ var baseWebpackConfig = { test: /\.html$/, loader: 'raw', exclude: [ - fullPathTo('../src/main/frontend/index.html') + helpers.absolutePath('../src/main/frontend/index.html') ] }, @@ -118,11 +118,7 @@ var baseWebpackConfig = { ] }; -// Returns full path to given relative directory -function fullPathTo(args) { - args = Array.prototype.slice.call(arguments, 0); - return path.join.apply(path, [__dirname].concat(args)); -} + // Customize config for dev environment @@ -138,7 +134,7 @@ function customizeForDev(config) { }; config.output = { - path: fullPathTo('../src/main/resources/static/'), + path: helpers.absolutePath('../src/main/resources/static/'), filename: '[name].bundle.js', sourceMapFilename: '[name].map', chunkFilename: '[id].chunk.js', @@ -174,7 +170,7 @@ function customizeForDev(config) { test: /\.scss$/, loader: 'raw!postcss!sass', exclude: [ - fullPathTo('../src/main/frontend/scss/main.scss') + helpers.absolutePath('../src/main/frontend/scss/main.scss') ] }); @@ -212,7 +208,7 @@ function customizeForProd(config) { }; config.output = { - path: fullPathTo('../src/main/resources/static'), + path: helpers.absolutePath('../src/main/resources/static'), filename: '[name].[chunkhash].bundle.js', sourceMapFilename: '[name].[chunkhash].bundle.map', chunkFilename: '[id].[chunkhash].chunk.js', @@ -234,7 +230,7 @@ function customizeForProd(config) { test: /\.scss$/, loader: 'raw!postcss!sass', exclude: [ - fullPathTo('../src/main/frontend/scss/main.scss') + helpers.absolutePath('../src/main/frontend/scss/main.scss') ] }); @@ -263,19 +259,6 @@ function customizeForProd(config) { inlineCss: '' })); config.plugins.push(new UglifyJsPlugin({ - // beautify: true, //debug - // mangle: false, //debug - // dead_code: false, //debug - // unused: false, //debug - // deadCode: false, //debug - // compress: { - // screw_ie8: true, - // keep_fnames: true, - // drop_debugger: false, - // dead_code: false, - // unused: false - // }, // debug - // comments: true, //debug beautify: false, //prod @@ -328,7 +311,7 @@ function customizeForTest(config) { test: /\.scss$/, loader: 'raw!sass', exclude: [ - fullPathTo('../src/main/frontend/scss/main.scss') + helpers.absolutePath('../src/main/frontend/scss/main.scss') ] }); @@ -336,7 +319,7 @@ function customizeForTest(config) { // instrument only testing sources with Istanbul { test: /\.(js|ts)$/, - include: fullPathTo('../src/main/frontend'), + include: helpers.absolutePath('../src/main/frontend'), loader: 'istanbul-instrumenter-loader', exclude: [ /\.(e2e|spec)\.ts$/, diff --git a/shardis-ui/config/webpack.helpers.js b/shardis-ui/config/webpack.helpers.js new file mode 100644 index 0000000..5e8abdc --- /dev/null +++ b/shardis-ui/config/webpack.helpers.js @@ -0,0 +1,10 @@ +var path = require('path'); + +var absolutePath = function (args) { + args = Array.prototype.slice.call(arguments, 0); + return path.join.apply(path, [__dirname].concat(args)); +}; + +module.exports = { + absolutePath: absolutePath +}; From 3f1580b163c35186b5509785efacfc92cfbeac2b Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Tue, 21 Jun 2016 21:21:39 +0200 Subject: [PATCH 13/46] lazy routes with modified version of AngularClass webpack resolver --- CHANGELOG.md | 1 + README.md | 1 + .../{about => +about}/about.component.html | 0 .../{about => +about}/about.component.scss | 0 .../{about => +about}/about.component.spec.ts | 0 .../app/{about => +about}/about.component.ts | 0 .../frontend/app/{about => +about}/index.ts | 0 .../heroes/app.component.scss | 0 .../heroes/app.component.ts | 0 .../heroes/hero-detail.component.ts | 0 .../heroes/hero.service.ts | 0 .../heroes/hero.ts | 0 .../heroes/mock-heroes.ts | 0 .../app/{playground => +playground}/index.ts | 0 .../playground.component.ts | 0 .../src/main/frontend/app/app.routes.ts | 20 ++++--- .../src/main/frontend/app/shared/index.ts | 1 - .../frontend/app/shared/lazy-loader/index.ts | 1 - .../app/shared/lazy-loader/lazy-loader.ts | 25 --------- shardis-ui/src/main/frontend/main.ts | 4 +- .../frontend/platform/browser/providers.ts | 5 ++ .../platform/browser/webpack/index.ts | 1 + .../platform/browser/webpack/lazy-loader.ts | 23 ++++++++ .../webpack/webpack-component-resolver.ts | 56 +++++++++++++++++++ 24 files changed, 99 insertions(+), 39 deletions(-) rename shardis-ui/src/main/frontend/app/{about => +about}/about.component.html (100%) rename shardis-ui/src/main/frontend/app/{about => +about}/about.component.scss (100%) rename shardis-ui/src/main/frontend/app/{about => +about}/about.component.spec.ts (100%) rename shardis-ui/src/main/frontend/app/{about => +about}/about.component.ts (100%) rename shardis-ui/src/main/frontend/app/{about => +about}/index.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/heroes/app.component.scss (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/heroes/app.component.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/heroes/hero-detail.component.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/heroes/hero.service.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/heroes/hero.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/heroes/mock-heroes.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/index.ts (100%) rename shardis-ui/src/main/frontend/app/{playground => +playground}/playground.component.ts (100%) delete mode 100644 shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts delete mode 100644 shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts create mode 100644 shardis-ui/src/main/frontend/platform/browser/webpack/index.ts create mode 100644 shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts create mode 100644 shardis-ui/src/main/frontend/platform/browser/webpack/webpack-component-resolver.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f07c6a..bb63f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Updated Angular to rc.2 * Migrate awesome-ts-loader to ts-loader due to problems with karma * Migrate to router 3 +* Lazy routes with modified version of AngularClass webpack resolver ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index 2ffe270..ac65a0e 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ npm run e2e * Updated Angular to rc.2 * Migrate awesome-ts-loader to ts-loader due to problems with karma * Migrate to router 3 +* Lazy routes with modified version of AngularClass webpack resolver ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/src/main/frontend/app/about/about.component.html b/shardis-ui/src/main/frontend/app/+about/about.component.html similarity index 100% rename from shardis-ui/src/main/frontend/app/about/about.component.html rename to shardis-ui/src/main/frontend/app/+about/about.component.html diff --git a/shardis-ui/src/main/frontend/app/about/about.component.scss b/shardis-ui/src/main/frontend/app/+about/about.component.scss similarity index 100% rename from shardis-ui/src/main/frontend/app/about/about.component.scss rename to shardis-ui/src/main/frontend/app/+about/about.component.scss diff --git a/shardis-ui/src/main/frontend/app/about/about.component.spec.ts b/shardis-ui/src/main/frontend/app/+about/about.component.spec.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/about/about.component.spec.ts rename to shardis-ui/src/main/frontend/app/+about/about.component.spec.ts diff --git a/shardis-ui/src/main/frontend/app/about/about.component.ts b/shardis-ui/src/main/frontend/app/+about/about.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/about/about.component.ts rename to shardis-ui/src/main/frontend/app/+about/about.component.ts diff --git a/shardis-ui/src/main/frontend/app/about/index.ts b/shardis-ui/src/main/frontend/app/+about/index.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/about/index.ts rename to shardis-ui/src/main/frontend/app/+about/index.ts diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/app.component.scss b/shardis-ui/src/main/frontend/app/+playground/heroes/app.component.scss similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/heroes/app.component.scss rename to shardis-ui/src/main/frontend/app/+playground/heroes/app.component.scss diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/app.component.ts b/shardis-ui/src/main/frontend/app/+playground/heroes/app.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/heroes/app.component.ts rename to shardis-ui/src/main/frontend/app/+playground/heroes/app.component.ts diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/hero-detail.component.ts b/shardis-ui/src/main/frontend/app/+playground/heroes/hero-detail.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/heroes/hero-detail.component.ts rename to shardis-ui/src/main/frontend/app/+playground/heroes/hero-detail.component.ts diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/hero.service.ts b/shardis-ui/src/main/frontend/app/+playground/heroes/hero.service.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/heroes/hero.service.ts rename to shardis-ui/src/main/frontend/app/+playground/heroes/hero.service.ts diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/hero.ts b/shardis-ui/src/main/frontend/app/+playground/heroes/hero.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/heroes/hero.ts rename to shardis-ui/src/main/frontend/app/+playground/heroes/hero.ts diff --git a/shardis-ui/src/main/frontend/app/playground/heroes/mock-heroes.ts b/shardis-ui/src/main/frontend/app/+playground/heroes/mock-heroes.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/heroes/mock-heroes.ts rename to shardis-ui/src/main/frontend/app/+playground/heroes/mock-heroes.ts diff --git a/shardis-ui/src/main/frontend/app/playground/index.ts b/shardis-ui/src/main/frontend/app/+playground/index.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/index.ts rename to shardis-ui/src/main/frontend/app/+playground/index.ts diff --git a/shardis-ui/src/main/frontend/app/playground/playground.component.ts b/shardis-ui/src/main/frontend/app/+playground/playground.component.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/playground/playground.component.ts rename to shardis-ui/src/main/frontend/app/+playground/playground.component.ts diff --git a/shardis-ui/src/main/frontend/app/app.routes.ts b/shardis-ui/src/main/frontend/app/app.routes.ts index ea30350..c038dab 100644 --- a/shardis-ui/src/main/frontend/app/app.routes.ts +++ b/shardis-ui/src/main/frontend/app/app.routes.ts @@ -1,10 +1,8 @@ -import {provideRouter, RouterConfig} from '@angular/router'; +import {RouterConfig} from '@angular/router'; import {Home} from './home'; -import {About} from './about'; -import {Playground} from './playground'; import {Login} from './login'; -const routes:RouterConfig = [ +export const routes:RouterConfig = [ { path: '', redirectTo: 'home' @@ -15,11 +13,11 @@ const routes:RouterConfig = [ }, { path: 'about', - component: About as any + component: 'About' }, { path: 'playground', - component: Playground as any + component: 'Playground' }, { path: 'login', @@ -32,6 +30,10 @@ const routes:RouterConfig = [ }, ]; -export const APP_ROUTER_PROVIDERS = [ - provideRouter(routes) -]; + +export const asyncRoutes = { + About: 'About', + Playground: 'Playground' +}; + + diff --git a/shardis-ui/src/main/frontend/app/shared/index.ts b/shardis-ui/src/main/frontend/app/shared/index.ts index ed64032..11c4d4e 100644 --- a/shardis-ui/src/main/frontend/app/shared/index.ts +++ b/shardis-ui/src/main/frontend/app/shared/index.ts @@ -1,3 +1,2 @@ export * from './x-large' export * from './auth' -export * from './lazy-loader' diff --git a/shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts b/shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts deleted file mode 100644 index 9c87ca9..0000000 --- a/shardis-ui/src/main/frontend/app/shared/lazy-loader/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './lazy-loader' diff --git a/shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts b/shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts deleted file mode 100644 index 2d7aab1..0000000 --- a/shardis-ui/src/main/frontend/app/shared/lazy-loader/lazy-loader.ts +++ /dev/null @@ -1,25 +0,0 @@ -export enum LazyModule { - ABOUT, - PLAYGROUND -} - -export class LazyLoader { - - static lazyLoad(lazymodule:LazyModule):Promise { - - var resolver = (resolve, reject) => { - require.ensure([], (require) => { - switch (lazymodule) { - case LazyModule.ABOUT: - resolve(require('../../about')); - break; - case LazyModule.PLAYGROUND: - resolve(require('../../playground')); - break; - } - }); - }; - - return new Promise(resolver); - } -} diff --git a/shardis-ui/src/main/frontend/main.ts b/shardis-ui/src/main/frontend/main.ts index 5fab19e..6b1b6e2 100644 --- a/shardis-ui/src/main/frontend/main.ts +++ b/shardis-ui/src/main/frontend/main.ts @@ -4,7 +4,6 @@ import {bootstrap} from '@angular/platform-browser-dynamic'; import {DIRECTIVES, PIPES, PROVIDERS, ENV_PROVIDERS} from './platform'; import {App} from './app'; -import {APP_ROUTER_PROVIDERS} from './app/app.routes'; /* * App Component @@ -27,8 +26,7 @@ export function main() { ...PROVIDERS, ...ENV_PROVIDERS, ...DIRECTIVES, - ...PIPES, - ...APP_ROUTER_PROVIDERS + ...PIPES ]) .catch(err => console.error(err)); diff --git a/shardis-ui/src/main/frontend/platform/browser/providers.ts b/shardis-ui/src/main/frontend/platform/browser/providers.ts index 8728781..50ba9c7 100644 --- a/shardis-ui/src/main/frontend/platform/browser/providers.ts +++ b/shardis-ui/src/main/frontend/platform/browser/providers.ts @@ -2,6 +2,9 @@ import {FORM_PROVIDERS, LocationStrategy, PathLocationStrategy} from '@angular/c import {HTTP_PROVIDERS} from '@angular/http'; import {MATERIAL_PROVIDERS} from './material2'; import {NG2_WEBSTORAGE} from 'ng2-webstorage'; +import {asyncRoutes, routes} from '../../app/app.routes'; +import {provideWebpack} from './webpack/webpack-component-resolver'; +import {provideRouter} from '@angular/router'; /* * Application Providers/Directives/Pipes @@ -12,6 +15,8 @@ export const APPLICATION_PROVIDERS = [ ...HTTP_PROVIDERS, ...MATERIAL_PROVIDERS, ...NG2_WEBSTORAGE, + provideRouter(routes), + provideWebpack(asyncRoutes), { provide: LocationStrategy, useClass: PathLocationStrategy as any diff --git a/shardis-ui/src/main/frontend/platform/browser/webpack/index.ts b/shardis-ui/src/main/frontend/platform/browser/webpack/index.ts new file mode 100644 index 0000000..dee2c72 --- /dev/null +++ b/shardis-ui/src/main/frontend/platform/browser/webpack/index.ts @@ -0,0 +1 @@ +export * from './webpack-component-resolver'; diff --git a/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts b/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts new file mode 100644 index 0000000..e5f64e1 --- /dev/null +++ b/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts @@ -0,0 +1,23 @@ +export class LazyLoader { + + static lazyLoad(lazymodule:string):Promise { + + var resolver = (resolve, reject) => { + + switch (lazymodule) { + case 'About': + require.ensure([], (require) => { + resolve(require('../../../app/+about/index')); + }); + break; + case 'Playground': + require.ensure([], (require) => { + resolve(require('../../../app/+playground/index')); + }); + break; + } + }; + + return new Promise(resolver); + } +} diff --git a/shardis-ui/src/main/frontend/platform/browser/webpack/webpack-component-resolver.ts b/shardis-ui/src/main/frontend/platform/browser/webpack/webpack-component-resolver.ts new file mode 100644 index 0000000..8389bd6 --- /dev/null +++ b/shardis-ui/src/main/frontend/platform/browser/webpack/webpack-component-resolver.ts @@ -0,0 +1,56 @@ +import { ComponentResolver, Injectable, Inject } from '@angular/core'; +import { RuntimeCompiler } from '@angular/compiler'; +import {LazyLoader} from './lazy-loader'; + +export const AC_WEBPACK_ASYNC_MAP = {}; + + +export const ANGULARCLASS_WEBPACK_RUNTIME_PROVIDERS = [ + { provide: AC_WEBPACK_ASYNC_MAP, useValue: {} }, + { + provide: ComponentResolver, + useFactory: (resolver, asyncMap) => { + return new WebpackComponentResolver(resolver, asyncMap); + }, + deps: [RuntimeCompiler, AC_WEBPACK_ASYNC_MAP] + } +]; + +export function provideWebpack(config) { + return [ + ...ANGULARCLASS_WEBPACK_RUNTIME_PROVIDERS, + { provide: AC_WEBPACK_ASYNC_MAP, useValue: config }, + ]; +} + +@Injectable() +export class WebpackComponentResolver { + constructor( + private _resolver: ComponentResolver, + @Inject(AC_WEBPACK_ASYNC_MAP) private _asyncComponents: any) { + + } + + resolveComponent(componentType: any) { + if (typeof componentType === 'string' && this._asyncComponents[componentType]) { + return this._fetchComponent(componentType); + } + return this._resolver.resolveComponent(componentType); + } + + + prefetchComponent(componentType) { + return this._fetchComponent(componentType); + } + + + clearCache(): void {} + + private _fetchComponent(componentType) { + return LazyLoader.lazyLoad(this._asyncComponents[componentType]) + .then(m => m[componentType]) + .then(cmp => { + return this._resolver.resolveComponent(cmp); + }); + } +} From 818e037bc162ba43af8f585930ec901800e14adb Mon Sep 17 00:00:00 2001 From: "tomasz.kucharzyk" Date: Wed, 22 Jun 2016 06:39:43 +0200 Subject: [PATCH 14/46] chmod fix --- shardis-ui/npm | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 shardis-ui/npm diff --git a/shardis-ui/npm b/shardis-ui/npm old mode 100644 new mode 100755 From 778fa1e37ac6744d56fc953aa73d1043b84d3f46 Mon Sep 17 00:00:00 2001 From: "tomasz.kucharzyk" Date: Wed, 22 Jun 2016 06:48:13 +0200 Subject: [PATCH 15/46] updated Angular to rc.3 --- CHANGELOG.md | 1 + README.md | 1 + shardis-ui/package.json | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb63f81..320063e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Migrate awesome-ts-loader to ts-loader due to problems with karma * Migrate to router 3 * Lazy routes with modified version of AngularClass webpack resolver +* Updated Angular to rc.3 ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index ac65a0e..143ca3f 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ npm run e2e * Migrate awesome-ts-loader to ts-loader due to problems with karma * Migrate to router 3 * Lazy routes with modified version of AngularClass webpack resolver +* Updated Angular to rc.3 ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 73b7a80..13c9e8c 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -13,14 +13,14 @@ }, "private": true, "dependencies": { - "@angular/common": "2.0.0-rc.2", - "@angular/compiler": "2.0.0-rc.2", - "@angular/core": "2.0.0-rc.2", - "@angular/http": "2.0.0-rc.2", - "@angular/platform-browser": "2.0.0-rc.2", - "@angular/platform-browser-dynamic": "2.0.0-rc.2", + "@angular/common": "2.0.0-rc.3", + "@angular/compiler": "2.0.0-rc.3", + "@angular/core": "2.0.0-rc.3", + "@angular/http": "2.0.0-rc.3", + "@angular/platform-browser": "2.0.0-rc.3", + "@angular/platform-browser-dynamic": "2.0.0-rc.3", "@angular/router": "3.0.0-alpha.7", - "@angular/forms": "^0.1.0", + "@angular/forms": "^0.1.1", "@angular2-material/button": "2.0.0-alpha.5-2", "@angular2-material/card": "2.0.0-alpha.5-2", "@angular2-material/checkbox": "2.0.0-alpha.5-2", @@ -53,7 +53,7 @@ "exports-loader": "0.6.3", "expose-loader": "0.7.1", "extract-text-webpack-plugin": "1.0.1", - "file-loader": "0.8.5", + "file-loader": "0.9.0", "html-webpack-plugin": "2.21.0", "http-server": "0.9.0", "imports-loader": "0.6.5", @@ -82,10 +82,10 @@ "style-loader": "0.13.1", "ts-helpers": "1.1.1", "ts-loader": "^0.8.2", - "ts-node": "0.9.1", + "ts-node": "0.9.3", "tslint": "3.11.0", - "tslint-loader": "2.1.4", - "typedoc": "0.4.3", + "tslint-loader": "2.1.5", + "typedoc": "0.4.4", "typescript": "1.8.10", "typings": "1.3.0", "url-loader": "0.5.7", @@ -93,7 +93,7 @@ "webpack-dev-server": "1.14.1", "webpack-load-plugins": "0.1.2", "webpack-md5-hash": "0.0.5", - "webpack-validator": "2.1.3" + "webpack-validator": "2.2.0" }, "scripts": { "clean": "npm cache clean && rimraf node node_modules doc typings coverage ./src/main/resources/static/*", From 073897c8c606fe7f28283166cd8ff77c25f4799d Mon Sep 17 00:00:00 2001 From: "tomasz.kucharzyk" Date: Wed, 22 Jun 2016 07:07:53 +0200 Subject: [PATCH 16/46] refactoring --- shardis-ui/src/main/frontend/app/app.routes.ts | 6 +++--- .../frontend/platform/browser/webpack/lazy-loader.ts | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/shardis-ui/src/main/frontend/app/app.routes.ts b/shardis-ui/src/main/frontend/app/app.routes.ts index c038dab..636b050 100644 --- a/shardis-ui/src/main/frontend/app/app.routes.ts +++ b/shardis-ui/src/main/frontend/app/app.routes.ts @@ -1,6 +1,7 @@ import {RouterConfig} from '@angular/router'; import {Home} from './home'; import {Login} from './login'; +import {ASYNC_ROUTES} from '../platform/browser/webpack/lazy-loader'; export const routes:RouterConfig = [ { @@ -30,10 +31,9 @@ export const routes:RouterConfig = [ }, ]; - export const asyncRoutes = { - About: 'About', - Playground: 'Playground' + About: ASYNC_ROUTES.About, + Playground: ASYNC_ROUTES.Playground }; diff --git a/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts b/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts index e5f64e1..c0e7feb 100644 --- a/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts +++ b/shardis-ui/src/main/frontend/platform/browser/webpack/lazy-loader.ts @@ -1,3 +1,8 @@ +export const ASYNC_ROUTES = { + About: 'About', + Playground: 'Playground' +}; + export class LazyLoader { static lazyLoad(lazymodule:string):Promise { @@ -5,16 +10,18 @@ export class LazyLoader { var resolver = (resolve, reject) => { switch (lazymodule) { - case 'About': + case ASYNC_ROUTES.About: require.ensure([], (require) => { resolve(require('../../../app/+about/index')); }); break; - case 'Playground': + case ASYNC_ROUTES.Playground: require.ensure([], (require) => { resolve(require('../../../app/+playground/index')); }); break; + default: + reject(); } }; From d93f65a1b25034bb0745ea4af7a06da123c9de41 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Wed, 22 Jun 2016 19:19:16 +0200 Subject: [PATCH 17/46] added 404 page --- CHANGELOG.md | 1 + README.md | 1 + .../src/main/frontend/app/app.routes.ts | 11 +++++++--- shardis-ui/src/main/frontend/app/app.spec.ts | 2 +- .../src/main/frontend/app/not-found/index.ts | 1 + .../app/not-found/not-found.component.html | 4 ++++ .../app/not-found/not-found.component.scss | 0 .../app/not-found/not-found.component.ts | 20 +++++++++++++++++++ .../app/{ => shared}/testing/index.ts | 0 .../app/{ => shared}/testing/router.ts | 0 10 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 shardis-ui/src/main/frontend/app/not-found/index.ts create mode 100644 shardis-ui/src/main/frontend/app/not-found/not-found.component.html create mode 100644 shardis-ui/src/main/frontend/app/not-found/not-found.component.scss create mode 100644 shardis-ui/src/main/frontend/app/not-found/not-found.component.ts rename shardis-ui/src/main/frontend/app/{ => shared}/testing/index.ts (100%) rename shardis-ui/src/main/frontend/app/{ => shared}/testing/router.ts (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 320063e..94036f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Migrate to router 3 * Lazy routes with modified version of AngularClass webpack resolver * Updated Angular to rc.3 +* Added 404 page ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index 143ca3f..584c719 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ npm run e2e * Migrate to router 3 * Lazy routes with modified version of AngularClass webpack resolver * Updated Angular to rc.3 +* Added 404 page ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/src/main/frontend/app/app.routes.ts b/shardis-ui/src/main/frontend/app/app.routes.ts index 636b050..f7cbe19 100644 --- a/shardis-ui/src/main/frontend/app/app.routes.ts +++ b/shardis-ui/src/main/frontend/app/app.routes.ts @@ -2,6 +2,7 @@ import {RouterConfig} from '@angular/router'; import {Home} from './home'; import {Login} from './login'; import {ASYNC_ROUTES} from '../platform/browser/webpack/lazy-loader'; +import {NotFound} from './not-found'; export const routes:RouterConfig = [ { @@ -10,7 +11,7 @@ export const routes:RouterConfig = [ }, { path: 'home', - component: Home as any, + component: Home }, { path: 'about', @@ -22,11 +23,15 @@ export const routes:RouterConfig = [ }, { path: 'login', - component: Login as any + component: Login + }, + { + path: '404', + component: NotFound }, { path: '**', - redirectTo: 'home', + redirectTo: '404', terminal: true }, ]; diff --git a/shardis-ui/src/main/frontend/app/app.spec.ts b/shardis-ui/src/main/frontend/app/app.spec.ts index 4bf216c..1bc02be 100644 --- a/shardis-ui/src/main/frontend/app/app.spec.ts +++ b/shardis-ui/src/main/frontend/app/app.spec.ts @@ -3,7 +3,7 @@ import {App} from './app.component'; import {AuthService} from './shared'; import {BaseRequestOptions, Http} from '@angular/http'; import {MockBackend} from '@angular/http/testing/mock_backend'; -import {TEST_ROUTER_PROVIDERS} from './testing/router'; +import {TEST_ROUTER_PROVIDERS} from './shared/testing'; // Load the implementations that should be tested diff --git a/shardis-ui/src/main/frontend/app/not-found/index.ts b/shardis-ui/src/main/frontend/app/not-found/index.ts new file mode 100644 index 0000000..d91ce3f --- /dev/null +++ b/shardis-ui/src/main/frontend/app/not-found/index.ts @@ -0,0 +1 @@ +export * from './not-found.component'; diff --git a/shardis-ui/src/main/frontend/app/not-found/not-found.component.html b/shardis-ui/src/main/frontend/app/not-found/not-found.component.html new file mode 100644 index 0000000..ec723da --- /dev/null +++ b/shardis-ui/src/main/frontend/app/not-found/not-found.component.html @@ -0,0 +1,4 @@ + + 404 + Page not found :( + diff --git a/shardis-ui/src/main/frontend/app/not-found/not-found.component.scss b/shardis-ui/src/main/frontend/app/not-found/not-found.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/shardis-ui/src/main/frontend/app/not-found/not-found.component.ts b/shardis-ui/src/main/frontend/app/not-found/not-found.component.ts new file mode 100644 index 0000000..7f8de81 --- /dev/null +++ b/shardis-ui/src/main/frontend/app/not-found/not-found.component.ts @@ -0,0 +1,20 @@ +import {Component, OnInit} from '@angular/core'; + +console.log('`About` component loaded asynchronously'); + +@Component({ + selector: 'not-found', + styles: [require('./not-found.component.scss')], + template: require('./not-found.component.html') +}) +export class NotFound implements OnInit { + + constructor() { + } + + + ngOnInit():any { + console.log('route not found'); + } + +} diff --git a/shardis-ui/src/main/frontend/app/testing/index.ts b/shardis-ui/src/main/frontend/app/shared/testing/index.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/testing/index.ts rename to shardis-ui/src/main/frontend/app/shared/testing/index.ts diff --git a/shardis-ui/src/main/frontend/app/testing/router.ts b/shardis-ui/src/main/frontend/app/shared/testing/router.ts similarity index 100% rename from shardis-ui/src/main/frontend/app/testing/router.ts rename to shardis-ui/src/main/frontend/app/shared/testing/router.ts From aa73d7c1623f4f7660f00bed5d6213e4d0c166c0 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Wed, 22 Jun 2016 19:29:14 +0200 Subject: [PATCH 18/46] readme changes --- CHANGELOG.md | 2 +- README.md | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94036f2..d93c4d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Changelog +## CHANGELOG: ### 1.8.0 (unreleased) * Better directory structure for angular components diff --git a/README.md b/README.md index 584c719..d5ec76f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ -# Spring Boot Angular 2 starter +# SPRING BOOT ANGULAR 2 STARTER + +## PROJECT DESCRIPTION: + +This sample project demonstrates how to integrate Spring Boot application with Angular 2. +It could be used as base for your future Angular2 Java projects. +Node and npm are installed as part of maven build. Also webpack build and karma tests runs with maven. +It also uses Spring Cloud microservices and Spring Security with Oauth2 JWT tokens. -Originally based on great [AngularClass](https://github.com/AngularClass) webpack starter ## FEATURES: * Build and testing process integrated with maven * Spring cloud microservices with Zull and Eureka * Spring security Oauth2 integration * Spring Boot application in development mode use resources from webpack dev server -* scss support -* Angular material -* font-awesome - +* Scss support +* Angular material integration +* Font-awesome integration +* Lazy loaded routes ## PRODUCTION USAGE: @@ -112,7 +118,7 @@ cd shardis-ui npm run e2e ``` -## Changelog +## CHANGELOG: ### 1.8.0 (unreleased) * Better directory structure for angular components From f6fb7b10117ad30cdd0c696dc191ca82c608576a Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Wed, 22 Jun 2016 22:49:11 +0200 Subject: [PATCH 19/46] much cleaner webpack configuration --- CHANGELOG.md | 1 + README.md | 1 + shardis-ui/config/webpack.commons.js | 129 +++++++ shardis-ui/config/webpack.config.factory.js | 376 -------------------- shardis-ui/config/webpack.dev.config.js | 95 ++++- shardis-ui/config/webpack.helpers.js | 10 - shardis-ui/config/webpack.prod.config.js | 114 +++++- shardis-ui/config/webpack.test.config.js | 51 ++- shardis-ui/package.json | 3 +- 9 files changed, 387 insertions(+), 393 deletions(-) create mode 100644 shardis-ui/config/webpack.commons.js delete mode 100644 shardis-ui/config/webpack.config.factory.js delete mode 100644 shardis-ui/config/webpack.helpers.js diff --git a/CHANGELOG.md b/CHANGELOG.md index d93c4d3..fd087bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Lazy routes with modified version of AngularClass webpack resolver * Updated Angular to rc.3 * Added 404 page +* Much cleaner webpack configuration ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/README.md b/README.md index d5ec76f..f5616a5 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ npm run e2e * Lazy routes with modified version of AngularClass webpack resolver * Updated Angular to rc.3 * Added 404 page +* Much cleaner webpack configuration ### 1.7.0 (08.06.2016) * Added npm-check-updates as dev dependency diff --git a/shardis-ui/config/webpack.commons.js b/shardis-ui/config/webpack.commons.js new file mode 100644 index 0000000..73ac320 --- /dev/null +++ b/shardis-ui/config/webpack.commons.js @@ -0,0 +1,129 @@ +var path = require('path'); +var autoprefixer = require('autoprefixer'); +var validateWebpackConfig = require('webpack-validator'); +var Joi = require('joi'); + +// Environments +const ENV = { + DEV: 'development', + PROD: 'production', + TEST: 'test' +}; + +var absolutePath = function (args) { + args = Array.prototype.slice.call(arguments, 0); + return path.join.apply(path, [__dirname].concat(args)); +}; + +function validateConfig(config) { + var customSchema = Joi.object({ + // this would just allow the property and doesn't perform any additional validation + sassLoader: Joi.any(), + htmlLoader: Joi.any() + }); + + return validateWebpackConfig(config, {schemaExtension: customSchema}); +} + +// Base configuration +var baseWebpackConfig = { + + // static data for index.html + metadata: { + baseUrl: '/' + }, + + resolve: { + extensions: ['', '.ts', '.js'], + cache: true + }, + + cache: true, + debug: false, + + devtool: 'source-map', + + tslint: { + emitErrors: false, + failOnHint: false, + resourcePath: './src/main/frontend' + }, + + module: { + preLoaders: [ + { + test: /\.ts$/, + loader: 'tslint-loader', + exclude: [ + absolutePath('../node_modules') + ] + }, + { + test: /\.js$/, + loader: "source-map-loader", + exclude: [ + absolutePath('../node_modules/rxjs'), + absolutePath('../node_modules/@angular'), + absolutePath('../node_modules/@angular2-material'), + absolutePath('../node_modules/ng2-webstorage') + ] + } + ], + loaders: [ + { + test: /\.ts$/, + loader: 'ts' + }, + + { + test: /\.json$/, + loader: 'json' + }, + + { + test: /\.css$/, + loader: 'raw' + }, + + { + test: /\.html$/, + loader: 'raw', + exclude: [ + absolutePath('../src/main/frontend/index.html') + ] + }, + + { + test: /\.(png|jpg|gif|svg)/, + loader: 'url', + query: { + limit: 10000, + name: '[name].[ext]?[hash]' + } + }, + + { + test: /\.(woff|eot|ttf|woff(2)?|otf)/i, + loader: 'file-loader?[name].[ext]?[hash]' + } + + ] + }, + sassLoader: { + includePaths: [ + './node_modules/font-awesome/scss', + './node_modules/normalize.css' + ] + }, + postcss: [ + autoprefixer({browsers: ['last 2 versions'], remove: false}) + ], + plugins: [] +}; + +module.exports = { + absolutePath: absolutePath, + ENV: ENV, + baseWebpackConfig: baseWebpackConfig, + validateConfig: validateConfig +}; diff --git a/shardis-ui/config/webpack.config.factory.js b/shardis-ui/config/webpack.config.factory.js deleted file mode 100644 index c018523..0000000 --- a/shardis-ui/config/webpack.config.factory.js +++ /dev/null @@ -1,376 +0,0 @@ -var helpers = require('./webpack.helpers'); -var fs = require('fs'); -var webpack = require('webpack'); - -var validateWebpackConfig = require('webpack-validator'); -var Joi = require('joi'); - -var ProvidePlugin = require('webpack/lib/ProvidePlugin'); -var DefinePlugin = require('webpack/lib/DefinePlugin'); -var OccurenceOrderPlugin = require('webpack/lib/optimize/OccurenceOrderPlugin'); -var DedupePlugin = require('webpack/lib/optimize/DedupePlugin'); -var UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin'); -var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); -var WebpackMd5Hash = require('webpack-md5-hash'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); -var HtmlWebpackPlugin = require('html-webpack-plugin'); -var ExtractTextPlugin = require("extract-text-webpack-plugin"); - -var autoprefixer = require('autoprefixer'); - -// Environments -const ENV = { - DEV: 'development', - PROD: 'production', - TEST: 'test' -}; - -// Base configuration -var baseWebpackConfig = { - - resolve: { - extensions: ['', '.ts', '.js'], - cache: true - }, - - cache: true, - debug: false, - - devtool: 'source-map', - - tslint: { - emitErrors: false, - failOnHint: false, - resourcePath: './src/main/frontend' - }, - - module: { - preLoaders: [ - { - test: /\.ts$/, - loader: 'tslint-loader', - exclude: [ - helpers.absolutePath('../node_modules') - ] - }, - { - test: /\.js$/, - loader: "source-map-loader", - exclude: [ - helpers.absolutePath('../node_modules/rxjs'), - helpers.absolutePath('../node_modules/@angular'), - helpers.absolutePath('../node_modules/@angular2-material'), - helpers.absolutePath('../node_modules/ng2-webstorage') - ] - } - ], - loaders: [ - { - test: /\.ts$/, - loader: 'ts' - }, - - { - test: /\.json$/, - loader: 'json' - }, - - { - test: /\.css$/, - loader: 'raw' - }, - - { - test: /\.html$/, - loader: 'raw', - exclude: [ - helpers.absolutePath('../src/main/frontend/index.html') - ] - }, - - { - test: /\.(png|jpg|gif|svg)/, - loader: 'url', - query: { - limit: 10000, - name: '[name].[ext]?[hash]' - } - }, - - { - test: /\.(woff|eot|ttf|woff(2)?|otf)/i, - loader: 'file-loader?[name].[ext]?[hash]' - } - - ] - }, - sassLoader: { - includePaths: [ - './node_modules/font-awesome/scss', - './node_modules/normalize.css' - ] - }, - postcss: [ - autoprefixer({browsers: ['last 2 versions'], remove: false}) - ], - plugins: [ - - ] -}; - - - - -// Customize config for dev environment -function customizeForDev(config) { - - config.metadata.host = 'localhost'; - config.metadata.port = 3000; - - config.entry = { - 'polyfills': './src/main/frontend/polyfills.ts', - 'vendor': './src/main/frontend/vendor.ts', - 'main': './src/main/frontend/main.ts' - }; - - config.output = { - path: helpers.absolutePath('../src/main/resources/static/'), - filename: '[name].bundle.js', - sourceMapFilename: '[name].map', - chunkFilename: '[id].chunk.js', - publicPath: 'http://localhost:3000/' - }; - - // Webpack Development Server config - config.devServer = { - port: config.metadata.port, - host: config.metadata.host, - contentBase: './src/main/frontend', - outputPath: './tmp/', - historyApiFallback: true, - watchOptions: { - aggregateTimeout: 300, - poll: 1000 - }, - quiet: false, - noInfo: false, - proxy: { - '/api/*': 'http://localhost:8080', - '/auth/*': 'http://localhost:8080' - } - }; - - // Saas config - config.module.loaders.push({ - test: /main\.scss$/, - loader: 'style!css?sourceMap!postcss!sass?sourceMap' - }); - - config.module.loaders.push({ - test: /\.scss$/, - loader: 'raw!postcss!sass', - exclude: [ - helpers.absolutePath('../src/main/frontend/scss/main.scss') - ] - }); - - // Additional plugins - config.plugins.push(new webpack.optimize.OccurenceOrderPlugin(true)); - config.plugins.push(new CommonsChunkPlugin({ - name: ['main', 'vendor', 'polyfills'], - minChunks: Infinity - })); - config.plugins.push(new CopyWebpackPlugin([ - { - from: './src/main/frontend/assets', - to: 'assets' - } - ])); - var inlinedCss = fs.readFileSync('./src/main/frontend/css/inline.css', {encoding: 'utf8'}); - config.plugins.push(new HtmlWebpackPlugin({ - template: './src/main/frontend/index.html', - chunksSortMode: 'dependency', - minify: false, - inlineCss: '' - })); - -} - -// Customize config for production environment -function customizeForProd(config) { - config.resolve.cache = false; - config.cache = false; - - config.entry = { - 'polyfills': './src/main/frontend/polyfills.ts', - 'vendor': './src/main/frontend/vendor.ts', - 'main': './src/main/frontend/main.ts' - }; - - config.output = { - path: helpers.absolutePath('../src/main/resources/static'), - filename: '[name].[chunkhash].bundle.js', - sourceMapFilename: '[name].[chunkhash].bundle.map', - chunkFilename: '[id].[chunkhash].chunk.js', - publicPath: '/' - }; - - config.tslint.emitErrors = true; - - // Saas config - - var extractCSS = new ExtractTextPlugin('[name].[contenthash].css'); - - config.module.loaders.push({ - test: /main\.scss$/, - loader: extractCSS.extract(['css?sourceMap', 'postcss', 'sass?sourceMap']) - }); - - config.module.loaders.push({ - test: /\.scss$/, - loader: 'raw!postcss!sass', - exclude: [ - helpers.absolutePath('../src/main/frontend/scss/main.scss') - ] - }); - - config.plugins.push(extractCSS); - - - // additional plugins - config.plugins.push(new WebpackMd5Hash()); - config.plugins.push(new DedupePlugin()); - config.plugins.push(new OccurenceOrderPlugin(true)); - config.plugins.push(new CommonsChunkPlugin({ - name: ['main', 'vendor', 'polyfills'], - minChunks: Infinity - })); - config.plugins.push(new CopyWebpackPlugin([ - { - from: './src/main/frontend/assets', - to: 'assets' - } - ])); - var inlinedCss = fs.readFileSync('./src/main/frontend/css/inline.css', {encoding: 'utf8'}); - config.plugins.push(new HtmlWebpackPlugin({ - template: './src/main/frontend/index.html', - chunksSortMode: 'dependency', - minify: {minimize: true, removeComments: true, preserveLineBreaks: true, collapseWhitespace: true}, - inlineCss: '' - })); - config.plugins.push(new UglifyJsPlugin({ - - beautify: false, //prod - - mangle: { - screw_ie8: true, - keep_fnames: true - }, //prod - - compress: { - screw_ie8: true - }, //prod - - comments: false //prod - })); - -// Teach html-minifier about Angular 2 syntax - config.htmlLoader = { - minimize: true, - removeAttributeQuotes: false, - caseSensitive: true, - customAttrSurround: [ - [/#/, /(?:)/], - [/\*/, /(?:)/], - [/\[?\(?/, /(?:)/] - ], - customAttrAssign: [/\)?\]?=/], - removeComments: true, - preserveLineBreaks: true, - collapseWhitespace: true - }; -} - -// Customize config for test environment -function customizeForTest(config) { - - config.devtool = 'inline-source-map'; - - config.stats = { - colors: true, - reasons: true - }; - - // Saas config - config.module.loaders.push({ - test: /main\.scss$/, - loader: 'style!css!sass' - }); - - config.module.loaders.push({ - test: /\.scss$/, - loader: 'raw!sass', - exclude: [ - helpers.absolutePath('../src/main/frontend/scss/main.scss') - ] - }); - - config.module.postLoaders = [ - // instrument only testing sources with Istanbul - { - test: /\.(js|ts)$/, - include: helpers.absolutePath('../src/main/frontend'), - loader: 'istanbul-instrumenter-loader', - exclude: [ - /\.(e2e|spec)\.ts$/, - /node_modules/ - ] - } - ]; - -} - -function customWebpackConfigValidation(config) { - var customSchema = Joi.object({ - // this would just allow the property and doesn't perform any additional validation - sassLoader: Joi.any(), - htmlLoader: Joi.any() - }); - - return validateWebpackConfig(config, {schemaExtension: customSchema}); -} - -// Create webpack config of given type -function createConfig(environment) { - - process.env.NODE_ENV = process.env.ENV = environment; - - var config = baseWebpackConfig; - - // static data for index.html - config.metadata = { - baseUrl: '/', - ENV: environment - }; - - config.plugins.push(new DefinePlugin({ - 'ENV': JSON.stringify(environment), - 'HMR': (ENV.DEV === environment) - })); - - switch (environment) { - case ENV.DEV: - customizeForDev(config); - break; - case ENV.PROD: - customizeForProd(config); - break; - case ENV.TEST: - customizeForTest(config); - break; - } - - return customWebpackConfigValidation(config); -} - -exports.createConfig = createConfig; diff --git a/shardis-ui/config/webpack.dev.config.js b/shardis-ui/config/webpack.dev.config.js index 7f2201c..7c70e40 100644 --- a/shardis-ui/config/webpack.dev.config.js +++ b/shardis-ui/config/webpack.dev.config.js @@ -1,3 +1,94 @@ -var webpackConfigFactory = require('./webpack.config.factory.js'); +const fs = require('fs'); -module.exports = webpackConfigFactory.createConfig('development'); +const webpackMerge = require('webpack-merge'); +const DefinePlugin = require('webpack/lib/DefinePlugin'); +const webpack = require('webpack'); +const ProvidePlugin = require('webpack/lib/ProvidePlugin'); +const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin'); +const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); + +const {ENV, validateConfig, baseWebpackConfig, absolutePath} = require('./webpack.commons.js'); + + +var environment = process.env.NODE_ENV = process.env.ENV = ENV.DEV; + +var inlinedCss = fs.readFileSync('./src/main/frontend/css/inline.css', {encoding: 'utf8'}); + +module.exports = validateConfig(webpackMerge(baseWebpackConfig, { + metadata: { + ENV: environment, + host: 'localhost', + port: 3000 + }, + entry: { + 'polyfills': './src/main/frontend/polyfills.ts', + 'vendor': './src/main/frontend/vendor.ts', + 'main': './src/main/frontend/main.ts' + }, + output: { + path: absolutePath('../src/main/resources/static/'), + filename: '[name].bundle.js', + sourceMapFilename: '[name].map', + chunkFilename: '[id].chunk.js', + publicPath: 'http://localhost:3000/' + }, + // Webpack Development Server config + devServer: { + port: 3000, + host: 'localhost', + contentBase: './src/main/frontend', + outputPath: './tmp/', + historyApiFallback: true, + watchOptions: { + aggregateTimeout: 300, + poll: 1000 + }, + quiet: false, + noInfo: false, + proxy: { + '/api/*': 'http://localhost:8080', + '/auth/*': 'http://localhost:8080' + } + }, + module: { + loaders: [ + // Saas config + { + test: /main\.scss$/, + loader: 'style!css?sourceMap!postcss!sass?sourceMap' + }, + { + test: /\.scss$/, + loader: 'raw!postcss!sass', + exclude: [ + absolutePath('../src/main/frontend/scss/main.scss') + ] + } + ] + }, + plugins: [ + new DefinePlugin({ + 'ENV': JSON.stringify(environment), + 'HMR': (ENV.DEV === environment) + }), + new webpack.optimize.OccurenceOrderPlugin(true), + new CommonsChunkPlugin({ + name: ['main', 'vendor', 'polyfills'], + minChunks: Infinity + }), + new CopyWebpackPlugin([ + { + from: './src/main/frontend/assets', + to: 'assets' + } + ]), + new HtmlWebpackPlugin({ + template: './src/main/frontend/index.html', + chunksSortMode: 'dependency', + minify: false, + inlineCss: '' + }) + ] +})); diff --git a/shardis-ui/config/webpack.helpers.js b/shardis-ui/config/webpack.helpers.js deleted file mode 100644 index 5e8abdc..0000000 --- a/shardis-ui/config/webpack.helpers.js +++ /dev/null @@ -1,10 +0,0 @@ -var path = require('path'); - -var absolutePath = function (args) { - args = Array.prototype.slice.call(arguments, 0); - return path.join.apply(path, [__dirname].concat(args)); -}; - -module.exports = { - absolutePath: absolutePath -}; diff --git a/shardis-ui/config/webpack.prod.config.js b/shardis-ui/config/webpack.prod.config.js index 985ebf2..ede0f72 100644 --- a/shardis-ui/config/webpack.prod.config.js +++ b/shardis-ui/config/webpack.prod.config.js @@ -1,3 +1,113 @@ -var webpackConfigFactory = require('./webpack.config.factory.js'); +const fs = require('fs'); -module.exports = webpackConfigFactory.createConfig('production'); +const webpack = require('webpack'); +const ProvidePlugin = require('webpack/lib/ProvidePlugin'); +const DedupePlugin = require('webpack/lib/optimize/DedupePlugin'); +const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin'); +const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); +const WebpackMd5Hash = require('webpack-md5-hash'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const webpackMerge = require('webpack-merge'); +const DefinePlugin = require('webpack/lib/DefinePlugin'); + +const {ENV, validateConfig, baseWebpackConfig, absolutePath} = require('./webpack.commons.js'); + +var environment = process.env.NODE_ENV = process.env.ENV = ENV.PROD; + +var inlinedCss = fs.readFileSync('./src/main/frontend/css/inline.css', {encoding: 'utf8'}); + +var extractCSS = new ExtractTextPlugin('[name].[contenthash].css'); + +module.exports = validateConfig(webpackMerge(baseWebpackConfig, { + cache: false, + metadata: { + ENV: environment + }, + resolve: { + cache: false + }, + entry: { + 'polyfills': './src/main/frontend/polyfills.ts', + 'vendor': './src/main/frontend/vendor.ts', + 'main': './src/main/frontend/main.ts' + }, + output: { + path: absolutePath('../src/main/resources/static'), + filename: '[name].[chunkhash].bundle.js', + sourceMapFilename: '[name].[chunkhash].bundle.map', + chunkFilename: '[id].[chunkhash].chunk.js', + publicPath: '/' + }, + module: { + loaders: [ + { + test: /main\.scss$/, + loader: extractCSS.extract(['css?sourceMap', 'postcss', 'sass?sourceMap']) + }, + { + test: /\.scss$/, + loader: 'raw!postcss!sass', + exclude: [ + absolutePath('../src/main/frontend/scss/main.scss') + ] + } + ] + }, + tslint: { + emitErrors: true + }, + plugins: [ + new DefinePlugin({ + 'ENV': JSON.stringify(environment), + 'HMR': (ENV.DEV === environment) + }), + extractCSS, + new WebpackMd5Hash(), + new DedupePlugin(), + new webpack.optimize.OccurenceOrderPlugin(true), + new CommonsChunkPlugin({ + name: ['main', 'vendor', 'polyfills'], + minChunks: Infinity + }), + new CopyWebpackPlugin([ + { + from: './src/main/frontend/assets', + to: 'assets' + } + ]), + new HtmlWebpackPlugin({ + template: './src/main/frontend/index.html', + chunksSortMode: 'dependency', + minify: {minimize: true, removeComments: true, preserveLineBreaks: true, collapseWhitespace: true}, + inlineCss: '' + }), + new UglifyJsPlugin({ + beautify: false, + mangle: { + screw_ie8: true, + keep_fnames: true + }, + compress: { + screw_ie8: true + }, + comments: false + }) + ], + // Teach html-minifier about Angular 2 syntax + htmlLoader: { + minimize: true, + removeAttributeQuotes: false, + caseSensitive: true, + customAttrSurround: [ + [/#/, /(?:)/], + [/\*/, /(?:)/], + [/\[?\(?/, /(?:)/] + ], + customAttrAssign: [/\)?\]?=/], + removeComments: true, + preserveLineBreaks: true, + collapseWhitespace: true + } +})); diff --git a/shardis-ui/config/webpack.test.config.js b/shardis-ui/config/webpack.test.config.js index 63b92b2..2e1c1b8 100644 --- a/shardis-ui/config/webpack.test.config.js +++ b/shardis-ui/config/webpack.test.config.js @@ -1,3 +1,50 @@ -var webpackConfigFactory = require('./webpack.config.factory.js'); +const webpackMerge = require('webpack-merge'); +const DefinePlugin = require('webpack/lib/DefinePlugin'); -module.exports = webpackConfigFactory.createConfig('test'); +const {ENV, validateConfig, baseWebpackConfig, absolutePath} = require('./webpack.commons.js'); + +var environment = process.env.NODE_ENV = process.env.ENV = ENV.TEST; + +module.exports = validateConfig(webpackMerge(baseWebpackConfig, { + devtool: 'inline-source-map', + stats: { + colors: true, + reasons: true + }, + metadata: { + ENV: environment + }, + module: { + loaders: [ + { + test: /main\.scss$/, + loader: 'style!css!sass' + }, + { + test: /\.scss$/, + loader: 'raw!sass', + exclude: [ + absolutePath('../src/main/frontend/scss/main.scss') + ] + } + ], + postLoaders: [ + // instrument only testing sources with Istanbul + { + test: /\.(js|ts)$/, + include: absolutePath('../src/main/frontend'), + loader: 'istanbul-instrumenter-loader', + exclude: [ + /\.(e2e|spec)\.ts$/, + /node_modules/ + ] + } + ] + }, + plugins: [ + new DefinePlugin({ + 'ENV': JSON.stringify(environment), + 'HMR': (ENV.DEV === environment) + }) + ] +})); diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 13c9e8c..0370cb2 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -93,6 +93,7 @@ "webpack-dev-server": "1.14.1", "webpack-load-plugins": "0.1.2", "webpack-md5-hash": "0.0.5", + "webpack-merge": "0.14.0", "webpack-validator": "2.2.0" }, "scripts": { @@ -115,7 +116,7 @@ "server:dev": "webpack-dev-server --config ./config/webpack.dev.config.js --hot --inline --progress --profile --colors --watch --display-error-details --display-cached ", "webdriver:update": "webdriver-manager update", "webdriver:start": "webdriver-manager start", - "lint": "tslint -t prose \"./src/main/frontend/**/*.ts\"", + "lint": "tslint --force -t prose \"./src/main/frontend/**/*.ts\"", "pree2e": "npm run webdriver:update -- --standalone", "e2e": "protractor ./config/protractor.conf.js", "e2e:live": "protractor --elementExplorer ./config/protractor.conf.js", From 9e53e42edc408226271b2e46909519ddf4fcb643 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Wed, 22 Jun 2016 23:26:29 +0200 Subject: [PATCH 20/46] much cleaner webpack configuration --- shardis-ui/config/webpack.commons.js | 7 +++---- shardis-ui/config/webpack.dev.config.js | 9 ++++++--- shardis-ui/config/webpack.prod.config.js | 6 ++++-- .../{typings => custom_typings}/custom_typings.d.ts | 0 4 files changed, 13 insertions(+), 9 deletions(-) rename shardis-ui/src/main/frontend/{typings => custom_typings}/custom_typings.d.ts (100%) diff --git a/shardis-ui/config/webpack.commons.js b/shardis-ui/config/webpack.commons.js index 73ac320..5e7849b 100644 --- a/shardis-ui/config/webpack.commons.js +++ b/shardis-ui/config/webpack.commons.js @@ -35,14 +35,13 @@ var baseWebpackConfig = { resolve: { extensions: ['', '.ts', '.js'], - cache: true + cache: true, + root: absolutePath('../src/main/frontend') }, cache: true, debug: false, - - devtool: 'source-map', - + tslint: { emitErrors: false, failOnHint: false, diff --git a/shardis-ui/config/webpack.dev.config.js b/shardis-ui/config/webpack.dev.config.js index 7c70e40..f39b0a4 100644 --- a/shardis-ui/config/webpack.dev.config.js +++ b/shardis-ui/config/webpack.dev.config.js @@ -3,8 +3,6 @@ const fs = require('fs'); const webpackMerge = require('webpack-merge'); const DefinePlugin = require('webpack/lib/DefinePlugin'); const webpack = require('webpack'); -const ProvidePlugin = require('webpack/lib/ProvidePlugin'); -const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin'); const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); @@ -17,6 +15,7 @@ var environment = process.env.NODE_ENV = process.env.ENV = ENV.DEV; var inlinedCss = fs.readFileSync('./src/main/frontend/css/inline.css', {encoding: 'utf8'}); module.exports = validateConfig(webpackMerge(baseWebpackConfig, { + devtool: 'cheap-module-source-map', metadata: { ENV: environment, host: 'localhost', @@ -68,6 +67,10 @@ module.exports = validateConfig(webpackMerge(baseWebpackConfig, { } ] }, + tslint: { + emitErrors: false, + failOnHint: false + }, plugins: [ new DefinePlugin({ 'ENV': JSON.stringify(environment), @@ -75,7 +78,7 @@ module.exports = validateConfig(webpackMerge(baseWebpackConfig, { }), new webpack.optimize.OccurenceOrderPlugin(true), new CommonsChunkPlugin({ - name: ['main', 'vendor', 'polyfills'], + name: ['vendor', 'polyfills'], minChunks: Infinity }), new CopyWebpackPlugin([ diff --git a/shardis-ui/config/webpack.prod.config.js b/shardis-ui/config/webpack.prod.config.js index ede0f72..d90e991 100644 --- a/shardis-ui/config/webpack.prod.config.js +++ b/shardis-ui/config/webpack.prod.config.js @@ -21,6 +21,7 @@ var inlinedCss = fs.readFileSync('./src/main/frontend/css/inline.css', {encoding var extractCSS = new ExtractTextPlugin('[name].[contenthash].css'); module.exports = validateConfig(webpackMerge(baseWebpackConfig, { + devtool: 'source-map', cache: false, metadata: { ENV: environment @@ -56,7 +57,8 @@ module.exports = validateConfig(webpackMerge(baseWebpackConfig, { ] }, tslint: { - emitErrors: true + emitErrors: true, + failOnHint: true }, plugins: [ new DefinePlugin({ @@ -68,7 +70,7 @@ module.exports = validateConfig(webpackMerge(baseWebpackConfig, { new DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(true), new CommonsChunkPlugin({ - name: ['main', 'vendor', 'polyfills'], + name: ['vendor', 'polyfills'], minChunks: Infinity }), new CopyWebpackPlugin([ diff --git a/shardis-ui/src/main/frontend/typings/custom_typings.d.ts b/shardis-ui/src/main/frontend/custom_typings/custom_typings.d.ts similarity index 100% rename from shardis-ui/src/main/frontend/typings/custom_typings.d.ts rename to shardis-ui/src/main/frontend/custom_typings/custom_typings.d.ts From ffac704b08b1911ef67eec8b0a62082a445ce51d Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Fri, 24 Jun 2016 19:15:57 +0200 Subject: [PATCH 21/46] formatting --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cad0709..b7962e3 100644 --- a/pom.xml +++ b/pom.xml @@ -12,9 +12,9 @@ shardis - shardis-parent + shardis-parent shardis-common - shardis-discovery + shardis-discovery shardis-auth shardis-ui shardis-api From 14d1086beccecb0a7e63249ed6ab2f0b4b35dbf3 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Fri, 24 Jun 2016 19:28:09 +0200 Subject: [PATCH 22/46] pom refactoring --- shardis-parent/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shardis-parent/pom.xml b/shardis-parent/pom.xml index 9c49d04..f04d22a 100644 --- a/shardis-parent/pom.xml +++ b/shardis-parent/pom.xml @@ -127,6 +127,11 @@ + + org.springframework.boot + spring-boot-maven-plugin + ${spring-cloud-starter-parent.version} + From c3b5efe89265caf46c95606f52689c37c7ba531e Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Fri, 24 Jun 2016 20:51:46 +0200 Subject: [PATCH 23/46] dependency update --- shardis-ui/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shardis-ui/package.json b/shardis-ui/package.json index 0370cb2..473207d 100644 --- a/shardis-ui/package.json +++ b/shardis-ui/package.json @@ -59,12 +59,12 @@ "imports-loader": "0.6.5", "istanbul-instrumenter-loader": "0.2.0", "json-loader": "0.5.4", - "karma": "0.13.22", + "karma": "1.0.0", "karma-chrome-launcher": "1.0.1", "karma-coverage": "1.0.0", "karma-jasmine": "1.0.2", "karma-mocha-reporter": "2.0.4", - "karma-phantomjs-launcher": "1.0.0", + "karma-phantomjs-launcher": "1.0.1", "karma-sourcemap-loader": "0.3.7", "karma-webpack": "1.7.0", "node-sass": "3.8.0", From b80ba8b6851c3638beb61ec592cac6e29cfc4be2 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sat, 25 Jun 2016 12:37:01 +0200 Subject: [PATCH 24/46] pom refactoring --- shardis-api/pom.xml | 1 + shardis-auth/pom.xml | 1 + shardis-common/pom.xml | 1 + shardis-discovery/pom.xml | 1 + shardis-ui/pom.xml | 1 + 5 files changed, 5 insertions(+) diff --git a/shardis-api/pom.xml b/shardis-api/pom.xml index 50f031c..a710e25 100644 --- a/shardis-api/pom.xml +++ b/shardis-api/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.shardis shardis-api 1.8.0 jar diff --git a/shardis-auth/pom.xml b/shardis-auth/pom.xml index 7d9c1b5..1a66622 100644 --- a/shardis-auth/pom.xml +++ b/shardis-auth/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.shardis shardis-auth 1.8.0 jar diff --git a/shardis-common/pom.xml b/shardis-common/pom.xml index 50da44d..c95b37a 100644 --- a/shardis-common/pom.xml +++ b/shardis-common/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.shardis shardis-common 1.8.0 jar diff --git a/shardis-discovery/pom.xml b/shardis-discovery/pom.xml index 0fb08c8..08093dd 100644 --- a/shardis-discovery/pom.xml +++ b/shardis-discovery/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.shardis shardis-discovery 1.8.0 jar diff --git a/shardis-ui/pom.xml b/shardis-ui/pom.xml index 17ba9fe..5689092 100644 --- a/shardis-ui/pom.xml +++ b/shardis-ui/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.shardis shardis-ui 1.8.0 jar From bca740fb47bc8ef62aafa8ccde2aa2252b45b5a8 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sat, 25 Jun 2016 12:44:04 +0200 Subject: [PATCH 25/46] enable angular debug tools --- shardis-ui/src/main/frontend/main.ts | 2 ++ shardis-ui/src/main/frontend/platform/environment.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/shardis-ui/src/main/frontend/main.ts b/shardis-ui/src/main/frontend/main.ts index 6b1b6e2..4bd53ab 100644 --- a/shardis-ui/src/main/frontend/main.ts +++ b/shardis-ui/src/main/frontend/main.ts @@ -4,6 +4,7 @@ import {bootstrap} from '@angular/platform-browser-dynamic'; import {DIRECTIVES, PIPES, PROVIDERS, ENV_PROVIDERS} from './platform'; import {App} from './app'; +import {decorateComponentRef} from './platform/environment'; /* * App Component @@ -28,6 +29,7 @@ export function main() { ...DIRECTIVES, ...PIPES ]) + .then(decorateComponentRef) //angular debug tools .catch(err => console.error(err)); } diff --git a/shardis-ui/src/main/frontend/platform/environment.ts b/shardis-ui/src/main/frontend/platform/environment.ts index f156841..7a98763 100644 --- a/shardis-ui/src/main/frontend/platform/environment.ts +++ b/shardis-ui/src/main/frontend/platform/environment.ts @@ -1,11 +1,17 @@ // Angular 2 import {enableProdMode} from '@angular/core'; +import {disableDebugTools, enableDebugTools} from '@angular/platform-browser'; // Environment Providers var PROVIDERS = []; +// Angular debug tools in the dev console +// https://github.com/angular/angular/blob/86405345b781a9dc2438c0fbe3e9409245647019/TOOLS_JS.md +let _decorateComponentRef = function identity(value) { return value; }; + if ('production' === ENV) { // Production + disableDebugTools(); enableProdMode(); PROVIDERS = [ @@ -13,6 +19,9 @@ if ('production' === ENV) { ]; } else { + + _decorateComponentRef = (cmpRef) => enableDebugTools(cmpRef); + // Development PROVIDERS = [ ...PROVIDERS @@ -20,6 +29,7 @@ if ('production' === ENV) { } +export const decorateComponentRef = _decorateComponentRef; export const ENV_PROVIDERS = [ ...PROVIDERS From 5e220ae1083d52bc4766cf507659dfa4d0d66f0d Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sat, 25 Jun 2016 13:06:42 +0200 Subject: [PATCH 26/46] pom fix --- shardis-parent/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shardis-parent/pom.xml b/shardis-parent/pom.xml index f04d22a..60381cf 100644 --- a/shardis-parent/pom.xml +++ b/shardis-parent/pom.xml @@ -22,6 +22,7 @@ 1.4.1 Brixton.RELEASE 2.0.5.RELEASE + 1.3.5.RELEASE @@ -130,7 +131,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-cloud-starter-parent.version} + ${spring-boot.version} From 2980833951879a0ee94041ad5c2b81665a12ca36 Mon Sep 17 00:00:00 2001 From: "kucharzyk.tomasz" Date: Sat, 25 Jun 2016 13:26:19 +0200 Subject: [PATCH 27/46] logged user info --- shardis-ui/src/main/frontend/app/app.component.html | 1 + shardis-ui/src/main/frontend/app/app.component.scss | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/shardis-ui/src/main/frontend/app/app.component.html b/shardis-ui/src/main/frontend/app/app.component.html index 9fa79b6..17f7f58 100644 --- a/shardis-ui/src/main/frontend/app/app.component.html +++ b/shardis-ui/src/main/frontend/app/app.component.html @@ -19,6 +19,7 @@ {{ name }} + Login