From 164f4543c7fd45413881ff0e9624ae68d2d0e007 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sat, 26 Aug 2017 22:46:59 +0200 Subject: [PATCH 1/8] start creating usersModule --- package-lock.json | 2 +- static/package-lock.json | 6 ++++++ static/package.json | 1 + static/src/app/app.module.ts | 2 -- static/src/app/app.routing.ts | 5 +++-- static/src/app/users/users.module.ts | 28 +++++++++++++++++++++++++++ static/src/app/users/users.routing.ts | 5 ++++- 7 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 static/src/app/users/users.module.ts diff --git a/package-lock.json b/package-lock.json index 5a0dca3..f570986 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "opt-cc", - "version": "1.1.2", + "version": "1.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/static/package-lock.json b/static/package-lock.json index 5f561fb..0ad4833 100644 --- a/static/package-lock.json +++ b/static/package-lock.json @@ -523,6 +523,12 @@ "integrity": "sha1-dMt3+2BS7a/yqJhN2v2I1BnyXKw=", "dev": true }, + "@types/systemjs": { + "version": "0.20.4", + "resolved": "https://registry.npmjs.org/@types/systemjs/-/systemjs-0.20.4.tgz", + "integrity": "sha512-LpX7BmY9KuCZnxJ0XYBofrLwJ+0BL/FyAvfLxpejUUjzBwOqU03L9CLF6SILxWw8aWhcavFpu1b7M2bLbg1irQ==", + "dev": true + }, "abbrev": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", diff --git a/static/package.json b/static/package.json index 6f8dcca..1f2dbcf 100644 --- a/static/package.json +++ b/static/package.json @@ -41,6 +41,7 @@ "devDependencies": { "@types/jasmine": "2.5.38", "@types/node": "~6.0.60", + "@types/systemjs": "^0.20.4", "codelyzer": "~2.0.0-beta.1", "jasmine-core": "^2.5.2", "jasmine-spec-reporter": "^3.2.0", diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 51f4444..9a29c67 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -50,7 +50,6 @@ import {AccordionModule} from "ngx-bootstrap"; AppUserService, AppUserStore, UserService, - UserStore, SquadService, SquadStore, DecorationService, @@ -72,7 +71,6 @@ import {AccordionModule} from "ngx-bootstrap"; DecorationItemComponent, RankItemComponent, FilterRankPipe, - UserItemComponent, SquadItemComponent, ShowErrorComponent, APPLICATION_VALIDATORS], diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index ed8e247..0ae3489 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -15,6 +15,7 @@ import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-pro import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {RouteConfig} from "./app.config"; import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing"; +import UsersModule from "./users/users.module"; export const appRoutes: Routes = [ @@ -31,7 +32,7 @@ export const appRoutes: Routes = [ {path: RouteConfig.confirmAwardPath, component: ConfirmAwardComponent, canActivate: [LoginGuardHL]}, {path: RouteConfig.confirmPromotionPath, component: ConfirmPromotionComponent, canActivate: [LoginGuardHL]}, - {path: RouteConfig.userPath, children: usersRoutes, canActivate: [LoginGuardHL]}, + {path: RouteConfig.userPath, loadChildren: './users/users.module', canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.decorationPath, children: decorationsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, @@ -46,7 +47,7 @@ export const appRoutes: Routes = [ export const appRouting = RouterModule.forRoot(appRoutes); export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent, - ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, ...usersRoutingComponents, + ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents, ...statsRoutingComponents]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/users/users.module.ts b/static/src/app/users/users.module.ts new file mode 100644 index 0000000..a9a51c4 --- /dev/null +++ b/static/src/app/users/users.module.ts @@ -0,0 +1,28 @@ +import { NgModule } from '@angular/core'; +import {routes, usersRoutingComponents} from './users.routing'; +import {UserStore} from "../services/stores/user.store"; +import {UserService} from "../services/user-service/user.service"; +import {BrowserModule} from "@angular/platform-browser"; +import {FormsModule, ReactiveFormsModule} from "@angular/forms"; +import {HttpModule} from "@angular/http"; +import {AccordionModule} from "ngx-bootstrap"; +import {NgxChartsModule} from "@swimlane/ngx-charts"; +import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; +import {DataTableModule} from "angular2-datatable"; +import {ClipboardModule} from "ngx-clipboard/dist"; +import {UsersComponent} from "./users.component"; +import {UserItemComponent} from "./user-list/user-item.component"; +import {UserListComponent} from "./user-list/user-list.component"; +import {EditUserComponent} from "./edit-user/edit-user.component"; +import {AwardUserComponent} from "./award-user/award-user.component"; +import {ShowErrorComponent} from "../common/show-error/show-error.component"; + +@NgModule({ + declarations: [ UsersComponent, UserListComponent, UserItemComponent, EditUserComponent, AwardUserComponent, ShowErrorComponent ], + imports: [ BrowserModule, FormsModule, ReactiveFormsModule, HttpModule, ClipboardModule, DataTableModule, + BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot(), routes ], + providers: [ UserStore, UserService ] +}) +export default class UsersModule { + static routes = routes; +}; diff --git a/static/src/app/users/users.routing.ts b/static/src/app/users/users.routing.ts index 9e51e3a..001e08a 100644 --- a/static/src/app/users/users.routing.ts +++ b/static/src/app/users/users.routing.ts @@ -1,8 +1,9 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {UsersComponent} from "./users.component"; import {EditUserComponent} from "./edit-user/edit-user.component"; import {UserListComponent} from "./user-list/user-list.component"; import {AwardUserComponent} from "./award-user/award-user.component"; +import {ModuleWithProviders} from "@angular/core"; export const usersRoutes: Routes = [{ path: '', component: UsersComponent, @@ -30,4 +31,6 @@ export const usersRoutes: Routes = [{ } ]; +export const routes: ModuleWithProviders = RouterModule.forChild(usersRoutes); + export const usersRoutingComponents = [UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent]; From 386a53af96feaf5181466404b2724cc98eb1e3bf Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sat, 2 Sep 2017 22:59:13 +0200 Subject: [PATCH 2/8] add shared module --- static/src/app/app.module.ts | 4 ++-- static/src/app/app.routing.ts | 4 +--- static/src/app/shared.module.ts | 12 +++++++++++ static/src/app/users/users.module.ts | 29 ++++++++------------------- static/src/app/users/users.routing.ts | 3 ++- 5 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 static/src/app/shared.module.ts diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 9a29c67..71a4897 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -36,9 +36,10 @@ import {DataTableModule} from "angular2-datatable"; import {NgxChartsModule} from "@swimlane/ngx-charts"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; import {AccordionModule} from "ngx-bootstrap"; +import {SharedModule} from "./shared.module"; @NgModule({ - imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule, DataTableModule, + imports: [SharedModule, BrowserModule, appRouting, HttpModule, ClipboardModule, DataTableModule, BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()], providers: [ HttpClient, @@ -72,7 +73,6 @@ import {AccordionModule} from "ngx-bootstrap"; RankItemComponent, FilterRankPipe, SquadItemComponent, - ShowErrorComponent, APPLICATION_VALIDATORS], bootstrap: [AppComponent] }) diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 0ae3489..b8e3621 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -2,7 +2,6 @@ import {RouterModule, Routes} from "@angular/router"; import {LoginComponent} from "./login/index"; import {NotFoundComponent} from "./common/not-found/not-found.component"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; -import {usersRoutes, usersRoutingComponents} from "./users/users.routing"; import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing"; import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing"; @@ -15,7 +14,6 @@ import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-pro import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {RouteConfig} from "./app.config"; import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing"; -import UsersModule from "./users/users.module"; export const appRoutes: Routes = [ @@ -32,7 +30,7 @@ export const appRoutes: Routes = [ {path: RouteConfig.confirmAwardPath, component: ConfirmAwardComponent, canActivate: [LoginGuardHL]}, {path: RouteConfig.confirmPromotionPath, component: ConfirmPromotionComponent, canActivate: [LoginGuardHL]}, - {path: RouteConfig.userPath, loadChildren: './users/users.module', canActivate: [LoginGuardHL]}, + {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.decorationPath, children: decorationsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, diff --git a/static/src/app/shared.module.ts b/static/src/app/shared.module.ts new file mode 100644 index 0000000..8fa9bba --- /dev/null +++ b/static/src/app/shared.module.ts @@ -0,0 +1,12 @@ +import {NgModule} from '@angular/core'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {ShowErrorComponent} from "./common/show-error/show-error.component"; +import {CommonModule} from "@angular/common"; + +@NgModule({ + declarations: [ShowErrorComponent], + imports: [CommonModule, FormsModule, ReactiveFormsModule], + exports: [FormsModule, ReactiveFormsModule, ShowErrorComponent] +}) +export class SharedModule { +} diff --git a/static/src/app/users/users.module.ts b/static/src/app/users/users.module.ts index a9a51c4..d770eb8 100644 --- a/static/src/app/users/users.module.ts +++ b/static/src/app/users/users.module.ts @@ -1,28 +1,15 @@ -import { NgModule } from '@angular/core'; +import {NgModule} from '@angular/core'; import {routes, usersRoutingComponents} from './users.routing'; import {UserStore} from "../services/stores/user.store"; import {UserService} from "../services/user-service/user.service"; -import {BrowserModule} from "@angular/platform-browser"; -import {FormsModule, ReactiveFormsModule} from "@angular/forms"; -import {HttpModule} from "@angular/http"; -import {AccordionModule} from "ngx-bootstrap"; -import {NgxChartsModule} from "@swimlane/ngx-charts"; -import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; -import {DataTableModule} from "angular2-datatable"; -import {ClipboardModule} from "ngx-clipboard/dist"; -import {UsersComponent} from "./users.component"; -import {UserItemComponent} from "./user-list/user-item.component"; -import {UserListComponent} from "./user-list/user-list.component"; -import {EditUserComponent} from "./edit-user/edit-user.component"; -import {AwardUserComponent} from "./award-user/award-user.component"; -import {ShowErrorComponent} from "../common/show-error/show-error.component"; +import {CommonModule} from "@angular/common"; +import {SharedModule} from "../shared.module"; @NgModule({ - declarations: [ UsersComponent, UserListComponent, UserItemComponent, EditUserComponent, AwardUserComponent, ShowErrorComponent ], - imports: [ BrowserModule, FormsModule, ReactiveFormsModule, HttpModule, ClipboardModule, DataTableModule, - BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot(), routes ], - providers: [ UserStore, UserService ] + declarations: usersRoutingComponents, + imports: [CommonModule, SharedModule, routes], + providers: [UserStore, UserService] }) -export default class UsersModule { +export class UsersModule { static routes = routes; -}; +} diff --git a/static/src/app/users/users.routing.ts b/static/src/app/users/users.routing.ts index 001e08a..32b8b2a 100644 --- a/static/src/app/users/users.routing.ts +++ b/static/src/app/users/users.routing.ts @@ -4,6 +4,7 @@ import {EditUserComponent} from "./edit-user/edit-user.component"; import {UserListComponent} from "./user-list/user-list.component"; import {AwardUserComponent} from "./award-user/award-user.component"; import {ModuleWithProviders} from "@angular/core"; +import {UserItemComponent} from "./user-list/user-item.component"; export const usersRoutes: Routes = [{ path: '', component: UsersComponent, @@ -33,4 +34,4 @@ export const usersRoutes: Routes = [{ export const routes: ModuleWithProviders = RouterModule.forChild(usersRoutes); -export const usersRoutingComponents = [UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent]; +export const usersRoutingComponents = [UserItemComponent, UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent]; From 92b3df335a5d90a14a447f660f3fbb158292cd5c Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sat, 2 Sep 2017 23:27:15 +0200 Subject: [PATCH 3/8] Add stats module --- static/src/app/app.module.ts | 24 +++++------------------ static/src/app/app.routing.ts | 6 +++--- static/src/app/statistic/stats.module.ts | 17 ++++++++++++++++ static/src/app/statistic/stats.routing.ts | 5 ++++- 4 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 static/src/app/statistic/stats.module.ts diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 71a4897..fbd5e7c 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -1,16 +1,10 @@ import {NgModule} from '@angular/core'; -import {Title, BrowserModule} from "@angular/platform-browser"; -import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BrowserModule} from "@angular/platform-browser"; import {HttpModule} from '@angular/http'; import {AppComponent} from './app.component'; import {LoginService} from "./services/login-service/login-service"; -import {UserStore} from "./services/stores/user.store"; -import {ShowErrorComponent} from './common/show-error/show-error.component'; -import {APPLICATION_VALIDATORS} from './models/app-validators'; import {appRouting, routingComponents, routingProviders} from './app.routing'; import {AUTH_ENABLED} from './app.tokens'; -import {UserService} from "./services/user-service/user.service"; -import {UserItemComponent} from "./users/user-list/user-item.component"; import {SquadService} from "./services/squad-service/squad.service"; import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; @@ -26,21 +20,17 @@ import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard" import {AwardingService} from "./services/awarding-service/awarding.service"; import {HttpClient} from "./services/http-client"; import {ArmyService} from "./services/army-service/army.service"; -import { ClipboardModule } from 'ngx-clipboard'; +import {ClipboardModule} from 'ngx-clipboard'; import {AppUserService} from "./services/app-user-service/app-user.service"; import {AppUserStore} from "./services/stores/app-user.store"; import {PromotionService} from "./services/promotion-service/promotion.service"; import {FilterRankPipe} from "./filter/filter.pipe"; import {WarService} from "./services/war-service/war.service"; -import {DataTableModule} from "angular2-datatable"; -import {NgxChartsModule} from "@swimlane/ngx-charts"; -import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; -import {AccordionModule} from "ngx-bootstrap"; import {SharedModule} from "./shared.module"; +import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; @NgModule({ - imports: [SharedModule, BrowserModule, appRouting, HttpModule, ClipboardModule, DataTableModule, - BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()], + imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule], providers: [ HttpClient, LoginService, @@ -50,7 +40,6 @@ import {SharedModule} from "./shared.module"; ArmyService, AppUserService, AppUserStore, - UserService, SquadService, SquadStore, DecorationService, @@ -59,9 +48,7 @@ import {SharedModule} from "./shared.module"; RankStore, AwardingService, PromotionService, - WarService, AppConfig, - Title, routingProviders, {provide: AUTH_ENABLED, useValue: true} ], @@ -72,8 +59,7 @@ import {SharedModule} from "./shared.module"; DecorationItemComponent, RankItemComponent, FilterRankPipe, - SquadItemComponent, - APPLICATION_VALIDATORS], + SquadItemComponent], bootstrap: [AppComponent] }) export class AppModule { diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index b8e3621..6ae6371 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -13,14 +13,14 @@ import {RequestPromotionComponent} from "./request/promotion/req-promotion.compo import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component"; import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {RouteConfig} from "./app.config"; -import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing"; +import {statsRoutingComponents} from "./statistic/stats.routing"; export const appRoutes: Routes = [ {path: RouteConfig.overviewPath, children: armyRoutes}, {path: '', redirectTo: RouteConfig.overviewPath, pathMatch: 'full'}, - {path: RouteConfig.statsPath, children: statsRoutes}, + {path: RouteConfig.statsPath, loadChildren: './statistic/stats.module#StatsModule'}, {path: RouteConfig.loginPath, component: LoginComponent}, {path: RouteConfig.signUpPath, component: SignupComponent}, @@ -46,6 +46,6 @@ export const appRouting = RouterModule.forRoot(appRoutes); export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent, ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, - ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents, ...statsRoutingComponents]; + ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/statistic/stats.module.ts b/static/src/app/statistic/stats.module.ts new file mode 100644 index 0000000..18a8e47 --- /dev/null +++ b/static/src/app/statistic/stats.module.ts @@ -0,0 +1,17 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from "@angular/common"; +import {SharedModule} from "../shared.module"; +import {statsRouterModule, statsRoutingComponents} from "./stats.routing"; +import {WarService} from "../services/war-service/war.service"; +import {DataTableModule} from "angular2-datatable"; +import {NgxChartsModule} from "@swimlane/ngx-charts"; +import {AccordionModule} from "ngx-bootstrap"; + +@NgModule({ + declarations: statsRoutingComponents, + imports: [CommonModule, SharedModule, statsRouterModule, NgxChartsModule, AccordionModule.forRoot(), DataTableModule], + providers: [WarService] +}) +export class StatsModule { + static routes = statsRouterModule; +} diff --git a/static/src/app/statistic/stats.routing.ts b/static/src/app/statistic/stats.routing.ts index b34c8d1..ffc10cd 100644 --- a/static/src/app/statistic/stats.routing.ts +++ b/static/src/app/statistic/stats.routing.ts @@ -1,10 +1,11 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {StatisticComponent} from "./stats.component"; import {WarDetailComponent} from "./war-detail/war-detail.component"; import {WarSubmitComponent} from "./war-submit/war-submit.component"; import {WarListComponent} from "./war-list/war-list.component"; import {StatisticOverviewComponent} from "./overview/stats-overview.component"; import {WarItemComponent} from "./war-list/war-item.component"; +import {ModuleWithProviders} from "@angular/core"; export const statsRoutes: Routes = [{ @@ -32,6 +33,8 @@ export const statsRoutes: Routes = [{ outlet: 'right' }]; +export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes); + export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, WarListComponent, WarSubmitComponent, WarDetailComponent, WarItemComponent]; From 6eca7c581e37082f0977cc915112182088340581 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 3 Sep 2017 12:29:41 +0200 Subject: [PATCH 4/8] Add decoration, admin, request module; remove authEnabled flag --- static/src/app/admin/admin.module.ts | 15 ++++++++ static/src/app/app.component.html | 12 +++--- static/src/app/app.component.ts | 4 +- static/src/app/app.config.ts | 5 ++- static/src/app/app.module.ts | 12 ------ static/src/app/app.routing.ts | 21 +++------- static/src/app/app.tokens.ts | 6 --- .../src/app/decorations/decoration.module.ts | 15 ++++++++ .../src/app/decorations/decoration.routing.ts | 8 +++- static/src/app/request/request.component.ts | 11 ++++++ static/src/app/request/request.module.ts | 22 +++++++++++ static/src/app/request/request.routing.ts | 38 +++++++++++++++++++ .../services/login-service/login-service.ts | 8 ++-- 13 files changed, 125 insertions(+), 52 deletions(-) create mode 100644 static/src/app/admin/admin.module.ts delete mode 100644 static/src/app/app.tokens.ts create mode 100644 static/src/app/decorations/decoration.module.ts create mode 100644 static/src/app/request/request.component.ts create mode 100644 static/src/app/request/request.module.ts create mode 100644 static/src/app/request/request.routing.ts diff --git a/static/src/app/admin/admin.module.ts b/static/src/app/admin/admin.module.ts new file mode 100644 index 0000000..d8b597f --- /dev/null +++ b/static/src/app/admin/admin.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from "@angular/core"; +import {AdminComponent} from "./admin.component"; +import {SharedModule} from "../shared.module"; +import {AppUserStore} from "../services/stores/app-user.store"; +import {AppUserService} from "../services/app-user-service/app-user.service"; +import {CommonModule} from "@angular/common"; +import {RouterModule} from "@angular/router"; + +@NgModule({ + declarations: [AdminComponent], + imports: [CommonModule, SharedModule, RouterModule.forChild([{path: '', component: AdminComponent}])], + providers: [AppUserStore, AppUserService] +}) +export class AdminModule { +} diff --git a/static/src/app/app.component.html b/static/src/app/app.component.html index 04b8a4f..239d81b 100644 --- a/static/src/app/app.component.html +++ b/static/src/app/app.component.html @@ -45,10 +45,10 @@ @@ -60,10 +60,10 @@ @@ -73,8 +73,8 @@
  • Admin Panel
  • - diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts index c033920..e594b3d 100644 --- a/static/src/app/app.component.ts +++ b/static/src/app/app.component.ts @@ -1,7 +1,6 @@ import {Component, Inject, Optional} from '@angular/core'; import {Router} from '@angular/router'; import {LoginService} from './services/login-service/login-service'; -import {AUTH_ENABLED} from './app.tokens'; import {PromotionService} from "./services/promotion-service/promotion.service"; import {AwardingService} from "./services/awarding-service/awarding.service"; import {RouteConfig} from "./app.config"; @@ -15,8 +14,7 @@ export class AppComponent { config = RouteConfig; - constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled, - private loginService: LoginService, + constructor(private loginService: LoginService, private promotionService: PromotionService, private awardingService: AwardingService, private router: Router) { diff --git a/static/src/app/app.config.ts b/static/src/app/app.config.ts index d45a62f..b19bbeb 100644 --- a/static/src/app/app.config.ts +++ b/static/src/app/app.config.ts @@ -28,8 +28,9 @@ export const RouteConfig = { statsPath: 'stats', userPath: 'users', overviewPath: 'overview', - requestAwardPath: 'request-award', - requestPromotionPath: 'request-promotion', + request: 'request', + requestAwardPath: 'award', + requestPromotionPath: 'promotion', confirmAwardPath: 'confirm-award', confirmPromotionPath: 'confirm-promotion' } diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 3ada4d6..24ca5f7 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -4,27 +4,21 @@ import {HttpModule} from '@angular/http'; import {AppComponent} from './app.component'; import {LoginService} from "./services/login-service/login-service"; import {appRouting, routingComponents, routingProviders} from './app.routing'; -import {AUTH_ENABLED} from './app.tokens'; import {SquadService} from "./services/squad-service/squad.service"; import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; import {DecorationService} from "./services/decoration-service/decoration.service"; import {SquadItemComponent} from "./squads/squad-list/squad-item.component"; -import {DecorationComponent} from "./decorations/decoration.component"; import {RankItemComponent} from "./ranks/rank-list/rank-item.component"; import {RankStore} from "./services/stores/rank.store"; import {RankService} from "./services/rank-service/rank.service"; -import {DecorationItemComponent} from "./decorations/decoration-list/decoration-item.component"; import {AppConfig} from "./app.config"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard"; import {AwardingService} from "./services/awarding-service/awarding.service"; import {HttpClient} from "./services/http-client"; import {ArmyService} from "./services/army-service/army.service"; import {ClipboardModule} from 'ngx-clipboard'; -import {AppUserService} from "./services/app-user-service/app-user.service"; -import {AppUserStore} from "./services/stores/app-user.store"; import {PromotionService} from "./services/promotion-service/promotion.service"; -import {FilterRankPipe} from "./filter/filter.pipe"; import {SharedModule} from "./shared.module"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; @@ -37,8 +31,6 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; LoginGuardHL, LoginGuardAdmin, ArmyService, - AppUserService, - AppUserStore, SquadService, SquadStore, DecorationService, @@ -49,15 +41,11 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; PromotionService, AppConfig, routingProviders, - {provide: AUTH_ENABLED, useValue: true} ], declarations: [ AppComponent, routingComponents, - DecorationComponent, - DecorationItemComponent, RankItemComponent, - FilterRankPipe, SquadItemComponent], bootstrap: [AppComponent] }) diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 6ae6371..097c775 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -3,17 +3,10 @@ import {LoginComponent} from "./login/index"; import {NotFoundComponent} from "./common/not-found/not-found.component"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; -import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing"; import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing"; import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; import {SignupComponent} from "./login/signup.component"; -import {AdminComponent} from "./admin/admin.component"; -import {RequestAwardComponent} from "./request/award/req-award.component"; -import {RequestPromotionComponent} from "./request/promotion/req-promotion.component"; -import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component"; -import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {RouteConfig} from "./app.config"; -import {statsRoutingComponents} from "./statistic/stats.routing"; export const appRoutes: Routes = [ @@ -25,17 +18,14 @@ export const appRoutes: Routes = [ {path: RouteConfig.loginPath, component: LoginComponent}, {path: RouteConfig.signUpPath, component: SignupComponent}, - {path: RouteConfig.requestAwardPath, component: RequestAwardComponent, canActivate: [LoginGuardSQL]}, - {path: RouteConfig.requestPromotionPath, component: RequestPromotionComponent, canActivate: [LoginGuardSQL]}, - {path: RouteConfig.confirmAwardPath, component: ConfirmAwardComponent, canActivate: [LoginGuardHL]}, - {path: RouteConfig.confirmPromotionPath, component: ConfirmPromotionComponent, canActivate: [LoginGuardHL]}, + {path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'}, {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, - {path: RouteConfig.decorationPath, children: decorationsRoutes, canActivate: [LoginGuardHL]}, + {path: RouteConfig.decorationPath, loadChildren: './decorations/decoration.module#DecorationsModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, - {path: RouteConfig.adminPanelPath, component: AdminComponent, canActivate: [LoginGuardAdmin]}, + {path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]}, /** Redirect Konfigurationen **/ {path: '404', component: NotFoundComponent}, @@ -44,8 +34,7 @@ export const appRoutes: Routes = [ export const appRouting = RouterModule.forRoot(appRoutes); -export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent, - ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, - ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents]; +export const routingComponents = [LoginComponent, SignupComponent, + ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents, ...ranksRoutingComponents]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/app.tokens.ts b/static/src/app/app.tokens.ts deleted file mode 100644 index ba88f65..0000000 --- a/static/src/app/app.tokens.ts +++ /dev/null @@ -1,6 +0,0 @@ -import {OpaqueToken} from '@angular/core'; - -export const AUTH_ENABLED = new OpaqueToken('AUTH_ENABLED'); - -export const SOCKET_IO = new OpaqueToken('socket-io'); - diff --git a/static/src/app/decorations/decoration.module.ts b/static/src/app/decorations/decoration.module.ts new file mode 100644 index 0000000..249a929 --- /dev/null +++ b/static/src/app/decorations/decoration.module.ts @@ -0,0 +1,15 @@ +import {decorationRoutesModule, decorationsRoutingComponents} from "./decoration.routing"; +import {SharedModule} from "../shared.module"; +import {CommonModule} from "@angular/common"; +import {DecorationStore} from "../services/stores/decoration.store"; +import {DecorationService} from "../services/decoration-service/decoration.service"; +import {NgModule} from "@angular/core"; + +@NgModule({ + declarations: decorationsRoutingComponents, + imports: [CommonModule, SharedModule, decorationRoutesModule], + providers: [DecorationStore, DecorationService] +}) +export class DecorationsModule { + static routes = decorationRoutesModule; +} diff --git a/static/src/app/decorations/decoration.routing.ts b/static/src/app/decorations/decoration.routing.ts index 7afcf03..8f5cb04 100644 --- a/static/src/app/decorations/decoration.routing.ts +++ b/static/src/app/decorations/decoration.routing.ts @@ -1,7 +1,9 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {DecorationComponent} from "./decoration.component"; import {DecorationListComponent} from "./decoration-list/decoration-list.component"; import {EditDecorationComponent} from "./edit-decoration/edit-decoration.component"; +import {ModuleWithProviders} from "@angular/core"; +import {DecorationItemComponent} from "./decoration-list/decoration-item.component"; export const decorationsRoutes: Routes = [{ path: '', component: DecorationComponent, @@ -23,5 +25,7 @@ export const decorationsRoutes: Routes = [{ outlet: 'right' }]; -export const decorationsRoutingComponents = [DecorationComponent, DecorationListComponent, EditDecorationComponent]; +export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes); + +export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent, EditDecorationComponent]; diff --git a/static/src/app/request/request.component.ts b/static/src/app/request/request.component.ts new file mode 100644 index 0000000..eab67db --- /dev/null +++ b/static/src/app/request/request.component.ts @@ -0,0 +1,11 @@ +import {Component} from "@angular/core"; + +@Component({ + selector: 'request', + templateUrl: 'request.component.html', + styleUrls: ['request.component.css'] +}) +export class RequestComponent { + constructor() { + } +} diff --git a/static/src/app/request/request.module.ts b/static/src/app/request/request.module.ts new file mode 100644 index 0000000..f00e6d6 --- /dev/null +++ b/static/src/app/request/request.module.ts @@ -0,0 +1,22 @@ +import {CommonModule} from "@angular/common"; +import {SharedModule} from "../shared.module"; +import {requestRouterModule} from "./request.routing"; +import {NgModule} from "@angular/core"; +import {FilterRankPipe} from "../filter/filter.pipe"; +import {RequestComponent} from "./request.component"; +import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component"; +import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component"; +import {RequestAwardComponent} from "./award/req-award.component"; +import {RequestPromotionComponent} from "./promotion/req-promotion.component"; +import {UserService} from "../services/user-service/user.service"; +import {UserStore} from "../services/stores/user.store"; + +@NgModule({ + declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent, + ConfirmAwardComponent, FilterRankPipe], + imports: [CommonModule, SharedModule, requestRouterModule], + providers: [UserStore, UserService] +}) +export class RequestModule { + static routes = requestRouterModule; +} diff --git a/static/src/app/request/request.routing.ts b/static/src/app/request/request.routing.ts new file mode 100644 index 0000000..33d0137 --- /dev/null +++ b/static/src/app/request/request.routing.ts @@ -0,0 +1,38 @@ +import {RouterModule, Routes} from "@angular/router"; +import {ModuleWithProviders} from "@angular/core"; +import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component"; +import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component"; +import {RequestAwardComponent} from "./award/req-award.component"; +import {RequestPromotionComponent} from "./promotion/req-promotion.component"; + +import {RequestComponent} from "./request.component"; +import {RouteConfig} from "../app.config"; +import {LoginGuardHL, LoginGuardSQL} from "../login/login.guard"; + + +export const requestRoutes: Routes = [{ + path: '', component: RequestComponent +}, + { + path: RouteConfig.requestAwardPath, + component: RequestAwardComponent, + canActivate: [LoginGuardSQL] + }, + { + path: RouteConfig.requestPromotionPath, + component: RequestPromotionComponent, + canActivate: [LoginGuardSQL] + }, + { + path: RouteConfig.confirmAwardPath, + component: ConfirmAwardComponent, + canActivate: [LoginGuardHL] + }, + { + path: RouteConfig.confirmPromotionPath, + component: ConfirmPromotionComponent, + canActivate: [LoginGuardHL] + } +]; + +export const requestRouterModule: ModuleWithProviders = RouterModule.forChild(requestRoutes); diff --git a/static/src/app/services/login-service/login-service.ts b/static/src/app/services/login-service/login-service.ts index f337a74..c12a530 100644 --- a/static/src/app/services/login-service/login-service.ts +++ b/static/src/app/services/login-service/login-service.ts @@ -1,17 +1,15 @@ -import {Inject, Injectable, Optional} from "@angular/core"; +import {Injectable} from "@angular/core"; import {Http, Response} from "@angular/http"; import "rxjs/add/operator/map"; import {AppConfig} from "../../app.config"; -import {AUTH_ENABLED} from "../../app.tokens"; import {AppUser} from "../../models/model-interfaces"; import {AwardingService} from "../awarding-service/awarding.service"; import {PromotionService} from "../promotion-service/promotion.service"; @Injectable() export class LoginService { - constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled = false, - private http: Http, + constructor(private http: Http, private config: AppConfig, private awardingService: AwardingService, private promotionService: PromotionService) { @@ -47,7 +45,7 @@ export class LoginService { } isLoggedIn() { - return !this.authEnabled || localStorage.getItem('currentUser') != null; + return localStorage.getItem('currentUser') != null; } hasPermission(level : number) { From b2dd827f98f4fb669102695c92f19c0c0a3de9f7 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 3 Sep 2017 12:29:57 +0200 Subject: [PATCH 5/8] Add request module --- static/src/app/request/request.component.css | 0 static/src/app/request/request.component.html | 1 + 2 files changed, 1 insertion(+) create mode 100644 static/src/app/request/request.component.css create mode 100644 static/src/app/request/request.component.html diff --git a/static/src/app/request/request.component.css b/static/src/app/request/request.component.css new file mode 100644 index 0000000..e69de29 diff --git a/static/src/app/request/request.component.html b/static/src/app/request/request.component.html new file mode 100644 index 0000000..0680b43 --- /dev/null +++ b/static/src/app/request/request.component.html @@ -0,0 +1 @@ + From 711e82e6cc57fbbe19fb8f870b0b98d217261b3e Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 3 Sep 2017 12:37:42 +0200 Subject: [PATCH 6/8] Add ranks module --- static/src/app/app.module.ts | 2 -- static/src/app/app.routing.ts | 6 ++---- static/src/app/ranks/ranks.module.ts | 15 +++++++++++++++ static/src/app/ranks/ranks.routing.ts | 8 ++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 static/src/app/ranks/ranks.module.ts diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 24ca5f7..23eccc1 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -9,7 +9,6 @@ import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; import {DecorationService} from "./services/decoration-service/decoration.service"; import {SquadItemComponent} from "./squads/squad-list/squad-item.component"; -import {RankItemComponent} from "./ranks/rank-list/rank-item.component"; import {RankStore} from "./services/stores/rank.store"; import {RankService} from "./services/rank-service/rank.service"; import {AppConfig} from "./app.config"; @@ -45,7 +44,6 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; declarations: [ AppComponent, routingComponents, - RankItemComponent, SquadItemComponent], bootstrap: [AppComponent] }) diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 097c775..e2c9ec1 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -3,7 +3,6 @@ import {LoginComponent} from "./login/index"; import {NotFoundComponent} from "./common/not-found/not-found.component"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; -import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing"; import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; import {SignupComponent} from "./login/signup.component"; import {RouteConfig} from "./app.config"; @@ -23,7 +22,7 @@ export const appRoutes: Routes = [ {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.decorationPath, loadChildren: './decorations/decoration.module#DecorationsModule', canActivate: [LoginGuardHL]}, - {path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, + {path: RouteConfig.rankPath, loadChildren: './ranks/ranks.module#RanksModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]}, @@ -34,7 +33,6 @@ export const appRoutes: Routes = [ export const appRouting = RouterModule.forRoot(appRoutes); -export const routingComponents = [LoginComponent, SignupComponent, - ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents, ...ranksRoutingComponents]; +export const routingComponents = [LoginComponent, SignupComponent, ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/ranks/ranks.module.ts b/static/src/app/ranks/ranks.module.ts new file mode 100644 index 0000000..d13be6f --- /dev/null +++ b/static/src/app/ranks/ranks.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from "@angular/core"; +import {rankRouterModule, ranksRoutingComponents} from "./ranks.routing"; +import {SharedModule} from "../shared.module"; +import {CommonModule} from "@angular/common"; +import {RankService} from "../services/rank-service/rank.service"; +import {RankStore} from "../services/stores/rank.store"; + +@NgModule({ + declarations: ranksRoutingComponents, + imports: [CommonModule, SharedModule, rankRouterModule], + providers: [RankStore, RankService] +}) +export class RanksModule { + static routes = rankRouterModule; +} diff --git a/static/src/app/ranks/ranks.routing.ts b/static/src/app/ranks/ranks.routing.ts index c36f117..fc0a6c9 100644 --- a/static/src/app/ranks/ranks.routing.ts +++ b/static/src/app/ranks/ranks.routing.ts @@ -1,7 +1,9 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {RankComponent} from "./ranks.component"; import {RankListComponent} from "./rank-list/rank-list.component"; import {EditRankComponent} from "./edit-rank/edit-rank.component"; +import {RankItemComponent} from "./rank-list/rank-item.component"; +import {ModuleWithProviders} from "@angular/core"; export const ranksRoutes: Routes = [{ @@ -24,5 +26,7 @@ export const ranksRoutes: Routes = [{ outlet: 'right' }]; -export const ranksRoutingComponents = [RankComponent, RankListComponent, EditRankComponent]; +export const rankRouterModule: ModuleWithProviders = RouterModule.forChild(ranksRoutes); + +export const ranksRoutingComponents = [RankComponent, RankItemComponent, RankListComponent, EditRankComponent]; From 91c9986be7eb92e2eaf4f653ca3015eb01cda4cc Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 3 Sep 2017 12:49:59 +0200 Subject: [PATCH 7/8] Add squad module; reformat --- minify.sh | 6 ++--- static/e2e/test.e2e-spec.ts | 4 ++-- static/karma.conf.js | 8 +++---- static/protractor-html-reporter.conf.js | 15 ++++++------ static/protractor.conf.js | 11 +++++---- static/src/app/admin/admin.component.ts | 2 +- static/src/app/app.component.css | 16 +++++++++---- static/src/app/app.component.html | 10 +++++--- static/src/app/app.component.ts | 2 +- static/src/app/app.config.ts | 23 +++++++++---------- static/src/app/app.module.ts | 4 +--- static/src/app/app.routing.ts | 11 +++++---- static/src/app/army/army-member.component.ts | 2 +- static/src/app/army/army.component.html | 3 ++- .../common/show-error/show-error.component.ts | 4 ++-- .../decoration-item.component.ts | 2 +- .../decoration-list.component.html | 8 +++---- .../edit-decoration.component.html | 4 ++-- static/src/app/login/login.component.css | 8 +++++-- static/src/app/login/login.guard.ts | 2 +- static/src/app/models/app-validators.ts | 7 +----- static/src/app/models/model-interfaces.ts | 2 ++ .../ranks/edit-rank/edit-rank.component.ts | 2 +- .../request/award/req-award.component.html | 2 +- .../confirm-promotion.component.ts | 1 - .../app-user-service/app-user.service.ts | 17 +++++++------- static/src/app/services/http-client.ts | 1 - .../services/login-service/login-service.ts | 4 ++-- .../services/squad-service/squad.service.ts | 4 ++-- .../src/app/services/stores/app-user.store.ts | 2 +- .../src/app/services/stores/generic-store.ts | 1 + .../app/services/war-service/war.service.ts | 2 +- .../squads/edit-squad/edit-squad.component.ts | 2 +- .../squad-list/squad-item.component.html | 2 +- .../squad-list/squad-list.component.html | 8 +++---- static/src/app/squads/squads.module.ts | 15 ++++++++++++ static/src/app/squads/squads.routing.ts | 8 +++++-- .../war-detail/war-detail.component.ts | 3 +-- .../war-list/war-item.component.html | 5 ++-- static/src/app/style/list-entry.css | 2 +- .../users/user-list/user-item.component.html | 3 ++- static/src/environments/environment.e2e.ts | 1 - static/src/index.html | 2 +- static/src/main.ts | 8 +++---- static/src/polyfills.ts | 14 +---------- static/src/styles.css | 3 ++- static/src/test.ts | 10 ++++---- static/tslint.json | 20 ++++++++++++---- 48 files changed, 164 insertions(+), 132 deletions(-) create mode 100644 static/src/app/squads/squads.module.ts diff --git a/minify.sh b/minify.sh index 18454d0..bf76d44 100755 --- a/minify.sh +++ b/minify.sh @@ -4,12 +4,12 @@ cd $(dirname $0) # array of files to minify -FILES=(inline main polyfills scripts styles vendor) +FILES=(inline.bundle main.bundle polyfills.bundle scripts.bundle styles.bundle vendor.bundle 0.chunk 1.chunk 2.chunk 3.chunk 4.chunk 5.chunk 6.chunk 7.chunk) OPTIONS="-c toplevel,dead_code=true,unused=true" for i in "${FILES[@]}" do echo "minify ${i} ..." - $(npm bin)/uglifyjs public/${i}.bundle.js ${OPTIONS} -o public/${i}.bundle.js - rm -f public/${i}.bundle.js.map + $(npm bin)/uglifyjs public/${i}.js ${OPTIONS} -o public/${i}.js + rm -f public/${i}.js.map done diff --git a/static/e2e/test.e2e-spec.ts b/static/e2e/test.e2e-spec.ts index 5ceddf2..1ba9a7a 100644 --- a/static/e2e/test.e2e-spec.ts +++ b/static/e2e/test.e2e-spec.ts @@ -1,4 +1,4 @@ -import {browser, element, by} from 'protractor'; +import {browser, by, element} from 'protractor'; describe('Main Page Access', function () { @@ -7,7 +7,7 @@ describe('Main Page Access', function () { browser.get('/') }); - it('should open army overview initially', async() => { + it('should open army overview initially', async () => { let elem = element(by.css('h1')); let text = elem.getText(); expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen"); diff --git a/static/karma.conf.js b/static/karma.conf.js index d46e1e3..4135a17 100644 --- a/static/karma.conf.js +++ b/static/karma.conf.js @@ -13,13 +13,13 @@ module.exports = function (config) { require('@angular/cli/plugins/karma') ], files: [ - { pattern: './src/test.ts', watched: false } + {pattern: './src/test.ts', watched: false} ], preprocessors: { './src/test.ts': ['@angular/cli'] }, mime: { - 'text/x-typescript': ['ts','tsx'] + 'text/x-typescript': ['ts', 'tsx'] }, remapIstanbulReporter: { reports: { @@ -32,8 +32,8 @@ module.exports = function (config) { environment: 'dev' }, reporters: config.angularCli && config.angularCli.codeCoverage - ? ['spec', 'karma-remap-istanbul'] - : ['spec'], + ? ['spec', 'karma-remap-istanbul'] + : ['spec'], port: 9876, colors: true, logLevel: config.LOG_INFO, diff --git a/static/protractor-html-reporter.conf.js b/static/protractor-html-reporter.conf.js index b9360f8..acb2f7d 100644 --- a/static/protractor-html-reporter.conf.js +++ b/static/protractor-html-reporter.conf.js @@ -29,24 +29,25 @@ exports.config = { jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, - print: function() {} + print: function () { + } }, useAllAngular2AppRoots: true, - beforeLaunch: function() { + beforeLaunch: function () { require('ts-node').register({ project: 'e2e' }); - return new Promise(function(resolve){ + return new Promise(function (resolve) { reporter.beforeLaunch(resolve); }); }, - afterLaunch: function(exitCode) { - return new Promise(function(resolve){ + afterLaunch: function (exitCode) { + return new Promise(function (resolve) { reporter.afterLaunch(resolve.bind(this, exitCode)); }); }, - onPrepare: function() { + onPrepare: function () { jasmine.getEnv().addReporter(reporter); jasmine.getEnv().addReporter(new SpecReporter()); }, -}; \ No newline at end of file +}; diff --git a/static/protractor.conf.js b/static/protractor.conf.js index 954a56e..04ea2bc 100644 --- a/static/protractor.conf.js +++ b/static/protractor.conf.js @@ -1,9 +1,9 @@ // Protractor configuration file, see link for more information // https://github.com/angular/protractor/blob/master/lib/config.ts -const { SpecReporter } = require('jasmine-spec-reporter'); +const {SpecReporter} = require('jasmine-spec-reporter'); -exports.config= { +exports.config = { allScriptsTimeout: 11000, specs: [ './e2e/**/*.e2e-spec.ts' @@ -17,14 +17,15 @@ exports.config= { jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, - print: function() {} + print: function () { + } }, - beforeLaunch: function() { + beforeLaunch: function () { require('ts-node').register({ project: 'e2e/tsconfig.e2e.json' }); }, onPrepare() { - jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}})); } }; diff --git a/static/src/app/admin/admin.component.ts b/static/src/app/admin/admin.component.ts index 3d470a9..b8ce4b9 100644 --- a/static/src/app/admin/admin.component.ts +++ b/static/src/app/admin/admin.component.ts @@ -61,7 +61,7 @@ export class AdminComponent { /** * compare ngValue with ngModel to assign selected element */ - equals(o1: Squad , o2: Squad) { + equals(o1: Squad, o2: Squad) { if (o1 && o2) { return o1._id === o2._id; } diff --git a/static/src/app/app.component.css b/static/src/app/app.component.css index 1bf8f81..73039f4 100644 --- a/static/src/app/app.component.css +++ b/static/src/app/app.component.css @@ -47,11 +47,19 @@ unprocessed-child:hover { /* Safari 4.0 - 8.0 */ @-webkit-keyframes color-blink { - from {background-color: #222222;} - to {background-color: orange;} + from { + background-color: #222222; + } + to { + background-color: orange; + } } @keyframes color-blink { - from {background-color: #222222;} - to {background-color: orange;} + from { + background-color: #222222; + } + to { + background-color: orange; + } } diff --git a/static/src/app/app.component.html b/static/src/app/app.component.html index 239d81b..e7dff4e 100644 --- a/static/src/app/app.component.html +++ b/static/src/app/app.component.html @@ -53,17 +53,21 @@ diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts index e594b3d..f785986 100644 --- a/static/src/app/app.component.ts +++ b/static/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {Component, Inject, Optional} from '@angular/core'; +import {Component} from '@angular/core'; import {Router} from '@angular/router'; import {LoginService} from './services/login-service/login-service'; import {PromotionService} from "./services/promotion-service/promotion.service"; diff --git a/static/src/app/app.config.ts b/static/src/app/app.config.ts index b19bbeb..2559dbd 100644 --- a/static/src/app/app.config.ts +++ b/static/src/app/app.config.ts @@ -1,20 +1,19 @@ - export class AppConfig { public readonly apiUrl = '/api'; - public readonly apiAppUserPath = this.apiUrl + '/account/'; - public readonly apiAwardPath = this.apiUrl + '/awardings'; - public readonly apiDecorationPath = this.apiUrl + '/decorations/'; + public readonly apiAppUserPath = this.apiUrl + '/account/'; + public readonly apiAwardPath = this.apiUrl + '/awardings'; + public readonly apiDecorationPath = this.apiUrl + '/decorations/'; public readonly apiAuthenticationPath = this.apiUrl + '/authenticate'; - public readonly apiSignupPath = this.apiUrl + '/authenticate/signup'; - public readonly apiRankPath = this.apiUrl + '/ranks/'; - public readonly apiSquadPath = this.apiUrl + '/squads/'; - public readonly apiUserPath = this.apiUrl + '/users/'; - public readonly apiOverviewPath = this.apiUrl + '/overview'; - public readonly apiRequestAwardPath = this.apiUrl + '/request/award'; - public readonly apiPromotionPath = this.apiUrl + '/request/promotion'; - public readonly apiWarPath = this.apiUrl + '/wars'; + public readonly apiSignupPath = this.apiUrl + '/authenticate/signup'; + public readonly apiRankPath = this.apiUrl + '/ranks/'; + public readonly apiSquadPath = this.apiUrl + '/squads/'; + public readonly apiUserPath = this.apiUrl + '/users/'; + public readonly apiOverviewPath = this.apiUrl + '/overview'; + public readonly apiRequestAwardPath = this.apiUrl + '/request/award'; + public readonly apiPromotionPath = this.apiUrl + '/request/promotion'; + public readonly apiWarPath = this.apiUrl + '/wars'; } diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index 23eccc1..a06a627 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -8,7 +8,6 @@ import {SquadService} from "./services/squad-service/squad.service"; import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; import {DecorationService} from "./services/decoration-service/decoration.service"; -import {SquadItemComponent} from "./squads/squad-list/squad-item.component"; import {RankStore} from "./services/stores/rank.store"; import {RankService} from "./services/rank-service/rank.service"; import {AppConfig} from "./app.config"; @@ -43,8 +42,7 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; ], declarations: [ AppComponent, - routingComponents, - SquadItemComponent], + routingComponents], bootstrap: [AppComponent] }) export class AppModule { diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index e2c9ec1..9a61cac 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -2,7 +2,6 @@ import {RouterModule, Routes} from "@angular/router"; import {LoginComponent} from "./login/index"; import {NotFoundComponent} from "./common/not-found/not-found.component"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; -import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing"; import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; import {SignupComponent} from "./login/signup.component"; import {RouteConfig} from "./app.config"; @@ -20,8 +19,12 @@ export const appRoutes: Routes = [ {path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'}, {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, - {path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, - {path: RouteConfig.decorationPath, loadChildren: './decorations/decoration.module#DecorationsModule', canActivate: [LoginGuardHL]}, + {path: RouteConfig.squadPath, loadChildren: './squads/squads.module#SquadsModule', canActivate: [LoginGuardHL]}, + { + path: RouteConfig.decorationPath, + loadChildren: './decorations/decoration.module#DecorationsModule', + canActivate: [LoginGuardHL] + }, {path: RouteConfig.rankPath, loadChildren: './ranks/ranks.module#RanksModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]}, @@ -33,6 +36,6 @@ export const appRoutes: Routes = [ export const appRouting = RouterModule.forRoot(appRoutes); -export const routingComponents = [LoginComponent, SignupComponent, ...armyRoutingComponents, NotFoundComponent, ...squadsRoutingComponents]; +export const routingComponents = [LoginComponent, SignupComponent, ...armyRoutingComponents, NotFoundComponent]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; diff --git a/static/src/app/army/army-member.component.ts b/static/src/app/army/army-member.component.ts index 4a3a70a..0355e4a 100644 --- a/static/src/app/army/army-member.component.ts +++ b/static/src/app/army/army-member.component.ts @@ -3,7 +3,7 @@ import {User} from "../models/model-interfaces"; import {ActivatedRoute, Router} from "@angular/router"; import {UserService} from "../services/user-service/user.service"; import {Subscription} from "rxjs/Subscription"; -import {AppConfig, RouteConfig} from "../app.config"; +import {RouteConfig} from "../app.config"; @Component({ diff --git a/static/src/app/army/army.component.html b/static/src/app/army/army.component.html index 7f09601..3a02e79 100644 --- a/static/src/app/army/army.component.html +++ b/static/src/app/army/army.component.html @@ -16,7 +16,8 @@
    - +


    diff --git a/static/src/app/common/show-error/show-error.component.ts b/static/src/app/common/show-error/show-error.component.ts index 6e52f73..31f08a5 100644 --- a/static/src/app/common/show-error/show-error.component.ts +++ b/static/src/app/common/show-error/show-error.component.ts @@ -1,5 +1,5 @@ -import {Component, Input, Optional} from '@angular/core'; -import {NgForm, FormGroup} from '@angular/forms'; +import {Component, Input} from '@angular/core'; +import {FormGroup, NgForm} from '@angular/forms'; @Component({ selector: 'show-error', diff --git a/static/src/app/decorations/decoration-list/decoration-item.component.ts b/static/src/app/decorations/decoration-list/decoration-item.component.ts index c816b12..f366857 100644 --- a/static/src/app/decorations/decoration-list/decoration-item.component.ts +++ b/static/src/app/decorations/decoration-list/decoration-item.component.ts @@ -8,7 +8,7 @@ import {Decoration} from "../../models/model-interfaces"; styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'], changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['decoration', 'selected'], - outputs: ['decorationDelete','decorationSelected'], + outputs: ['decorationDelete', 'decorationSelected'], }) export class DecorationItemComponent { diff --git a/static/src/app/decorations/decoration-list/decoration-list.component.html b/static/src/app/decorations/decoration-list/decoration-list.component.html index 342eaf0..e54319c 100644 --- a/static/src/app/decorations/decoration-list/decoration-list.component.html +++ b/static/src/app/decorations/decoration-list/decoration-list.component.html @@ -49,10 +49,10 @@
    + [decoration]="decoration" + (decorationDelete)="deleteDecoration(decoration)" + (decorationSelected)="selectDecoration($event)" + [selected]="decoration._id == selectedDecorationId">
    diff --git a/static/src/app/decorations/edit-decoration/edit-decoration.component.html b/static/src/app/decorations/edit-decoration/edit-decoration.component.html index a1b5eca..d148c9a 100644 --- a/static/src/app/decorations/edit-decoration/edit-decoration.component.html +++ b/static/src/app/decorations/edit-decoration/edit-decoration.component.html @@ -38,7 +38,7 @@
    + [(ngModel)]="decoration.sortingNumber">
    @@ -51,7 +51,7 @@
    - + { const promise = new Promise((resolve, reject) => { diff --git a/static/src/app/models/model-interfaces.ts b/static/src/app/models/model-interfaces.ts index 9398922..a4ccc0a 100644 --- a/static/src/app/models/model-interfaces.ts +++ b/static/src/app/models/model-interfaces.ts @@ -28,11 +28,13 @@ export interface Player { respawn?: number; flagTouch?: number; } + export interface Campaign { _id?: string; title?: string; wars?: War[]; } + export interface War { _id?: string; title?: string; diff --git a/static/src/app/ranks/edit-rank/edit-rank.component.ts b/static/src/app/ranks/edit-rank/edit-rank.component.ts index bdad895..729488f 100644 --- a/static/src/app/ranks/edit-rank/edit-rank.component.ts +++ b/static/src/app/ranks/edit-rank/edit-rank.component.ts @@ -30,7 +30,7 @@ export class EditRankComponent { constructor(private route: ActivatedRoute, private router: Router, - private rankService : RankService) { + private rankService: RankService) { } ngOnInit() { diff --git a/static/src/app/request/award/req-award.component.html b/static/src/app/request/award/req-award.component.html index fb0f030..3b4143d 100644 --- a/static/src/app/request/award/req-award.component.html +++ b/static/src/app/request/award/req-award.component.html @@ -47,7 +47,7 @@
    + id="reason" placeholder="Begründung eingeben..." rows="3">
    - +
    diff --git a/static/src/app/squads/squad-list/squad-list.component.html b/static/src/app/squads/squad-list/squad-list.component.html index d992163..213e65e 100644 --- a/static/src/app/squads/squad-list/squad-list.component.html +++ b/static/src/app/squads/squad-list/squad-list.component.html @@ -41,10 +41,10 @@
    + [squad]="squad" + (squadDelete)="deleteSquad(squad)" + (squadSelected)="selectSquad($event)" + [selected]="squad._id == selectedSquadId">
    diff --git a/static/src/app/squads/squads.module.ts b/static/src/app/squads/squads.module.ts new file mode 100644 index 0000000..dff17fa --- /dev/null +++ b/static/src/app/squads/squads.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from "@angular/common"; +import {SharedModule} from "../shared.module"; +import {squadRouterModule, squadsRoutingComponents} from "./squads.routing"; +import {SquadStore} from "../services/stores/squad.store"; +import {SquadService} from "../services/squad-service/squad.service"; + +@NgModule({ + declarations: squadsRoutingComponents, + imports: [CommonModule, SharedModule, squadRouterModule], + providers: [SquadStore, SquadService] +}) +export class SquadsModule { + static routes = squadRouterModule; +} diff --git a/static/src/app/squads/squads.routing.ts b/static/src/app/squads/squads.routing.ts index 7a8149b..ef29775 100644 --- a/static/src/app/squads/squads.routing.ts +++ b/static/src/app/squads/squads.routing.ts @@ -1,7 +1,9 @@ -import {Routes} from "@angular/router"; +import {RouterModule, Routes} from "@angular/router"; import {SquadComponent} from "./squads.component"; import {SquadListComponent} from "./squad-list/squad-list.component"; import {EditSquadComponent} from "./edit-squad/edit-squad.component"; +import {ModuleWithProviders} from "@angular/core"; +import {SquadItemComponent} from "./squad-list/squad-item.component"; export const squadsRoutes: Routes = [{ path: '', component: SquadComponent, @@ -23,5 +25,7 @@ export const squadsRoutes: Routes = [{ outlet: 'right' }]; -export const squadsRoutingComponents = [SquadComponent, SquadListComponent, EditSquadComponent]; +export const squadRouterModule: ModuleWithProviders = RouterModule.forChild(squadsRoutes); + +export const squadsRoutingComponents = [SquadComponent, SquadItemComponent, SquadListComponent, EditSquadComponent]; diff --git a/static/src/app/statistic/war-detail/war-detail.component.ts b/static/src/app/statistic/war-detail/war-detail.component.ts index 861b7a0..a0827b4 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.ts +++ b/static/src/app/statistic/war-detail/war-detail.component.ts @@ -1,7 +1,6 @@ import {Component} from "@angular/core"; -import {ActivatedRoute, Router} from "@angular/router"; +import {ActivatedRoute} from "@angular/router"; import {WarService} from "../../services/war-service/war.service"; -import {LoginService} from "../../services/login-service/login-service"; import {Player, War} from "../../models/model-interfaces"; diff --git a/static/src/app/statistic/war-list/war-item.component.html b/static/src/app/statistic/war-list/war-item.component.html index f62c441..dd962b5 100644 --- a/static/src/app/statistic/war-list/war-item.component.html +++ b/static/src/app/statistic/war-list/war-item.component.html @@ -6,11 +6,12 @@ {{war.title}}
    - vom {{war.date | date: 'dd.MM.yyyy'}} + vom {{war.date | date: 'dd.MM.yyyy'}}
    - +
    diff --git a/static/src/app/style/list-entry.css b/static/src/app/style/list-entry.css index 0985751..a73838c 100644 --- a/static/src/app/style/list-entry.css +++ b/static/src/app/style/list-entry.css @@ -40,7 +40,7 @@ span { } .trash { - float:right; + float: right; padding-top: 18px; font-size: 17px; } diff --git a/static/src/app/users/user-list/user-item.component.html b/static/src/app/users/user-list/user-item.component.html index d5589d5..a3dbaa6 100644 --- a/static/src/app/users/user-list/user-item.component.html +++ b/static/src/app/users/user-list/user-item.component.html @@ -12,7 +12,8 @@
    - +
    diff --git a/static/src/environments/environment.e2e.ts b/static/src/environments/environment.e2e.ts index 329b2ec..50f3955 100644 --- a/static/src/environments/environment.e2e.ts +++ b/static/src/environments/environment.e2e.ts @@ -1,4 +1,3 @@ - export const environment = { production: false, e2eMode: true diff --git a/static/src/index.html b/static/src/index.html index d6dc0f8..8716323 100644 --- a/static/src/index.html +++ b/static/src/index.html @@ -9,6 +9,6 @@ - Loading... +Loading... diff --git a/static/src/main.ts b/static/src/main.ts index a745952..50ed715 100644 --- a/static/src/main.ts +++ b/static/src/main.ts @@ -1,8 +1,8 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import {enableProdMode} from '@angular/core'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/app.module'; -import { environment } from './environments/environment'; +import {AppModule} from './app/app.module'; +import {environment} from './environments/environment'; import 'rxjs/add/observable/of'; diff --git a/static/src/polyfills.ts b/static/src/polyfills.ts index 53bdaf1..7c0c000 100644 --- a/static/src/polyfills.ts +++ b/static/src/polyfills.ts @@ -13,11 +13,9 @@ * * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html */ - /*************************************************************************************************** * BROWSER POLYFILLS */ - /** IE9, IE10 and IE11 requires all of the following polyfills. **/ // import 'core-js/es6/symbol'; // import 'core-js/es6/object'; @@ -32,29 +30,19 @@ // import 'core-js/es6/regexp'; // import 'core-js/es6/map'; // import 'core-js/es6/set'; - /** IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. - /** IE10 and IE11 requires the following to support `@angular/animation`. */ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - /** Evergreen browsers require these. **/ import 'core-js/es6/reflect'; import 'core-js/es7/reflect'; - - /** ALL Firefox browsers require the following to support `@angular/animation`. **/ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - - /*************************************************************************************************** * Zone JS is required by Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - +import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** diff --git a/static/src/styles.css b/static/src/styles.css index b8fde6e..69de9ac 100644 --- a/static/src/styles.css +++ b/static/src/styles.css @@ -1,5 +1,5 @@ body { - padding-left: 20px; + padding-left: 20px; padding-top: 50px; } @@ -47,6 +47,7 @@ form { padding-right: 10px; } + #right { overflow: hidden; padding-left: 4%; diff --git a/static/src/test.ts b/static/src/test.ts index 6d46bc6..c177344 100644 --- a/static/src/test.ts +++ b/static/src/test.ts @@ -9,18 +9,16 @@ import 'zone.js/dist/fake-async-test'; import 'rxjs/Rx'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; +import {getTestBed} from '@angular/core/testing'; +import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing'; // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. declare var __karma__: any; declare var require: any; // Prevent Karma from running prematurely. -__karma__.loaded = function () {}; +__karma__.loaded = function () { +}; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( diff --git a/static/tslint.json b/static/tslint.json index 86bc184..3bbe964 100644 --- a/static/tslint.json +++ b/static/tslint.json @@ -12,7 +12,10 @@ "curly": true, "eofline": true, "forin": true, - "import-blacklist": [true, "rxjs"], + "import-blacklist": [ + true, + "rxjs" + ], "import-spacing": true, "indent": [ true, @@ -97,9 +100,18 @@ "check-separator", "check-type" ], - - "directive-selector": [true, "attribute", "app", "camelCase"], - "component-selector": [true, "element", "app", "kebab-case"], + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ], "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, From f72a9f09cca8ac09edef31d066c83e71c75e7c6a Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 3 Sep 2017 13:10:36 +0200 Subject: [PATCH 8/8] Fix army user detail --- static/src/app/app.module.ts | 4 ++ static/src/app/app.routing.ts | 72 +++++++++++++++++------- static/src/app/request/request.module.ts | 3 +- static/src/app/users/users.module.ts | 1 - 4 files changed, 58 insertions(+), 22 deletions(-) diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index a06a627..f8f1d68 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -19,6 +19,8 @@ import {ClipboardModule} from 'ngx-clipboard'; import {PromotionService} from "./services/promotion-service/promotion.service"; import {SharedModule} from "./shared.module"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; +import {UserService} from "./services/user-service/user.service"; +import {UserStore} from "./services/stores/user.store"; @NgModule({ imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule], @@ -28,6 +30,8 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; LoginGuardSQL, LoginGuardHL, LoginGuardAdmin, + UserService, + UserStore, ArmyService, SquadService, SquadStore, diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 9a61cac..8c7d093 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -7,31 +7,65 @@ import {SignupComponent} from "./login/signup.component"; import {RouteConfig} from "./app.config"; export const appRoutes: Routes = [ - - {path: RouteConfig.overviewPath, children: armyRoutes}, - {path: '', redirectTo: RouteConfig.overviewPath, pathMatch: 'full'}, - - {path: RouteConfig.statsPath, loadChildren: './statistic/stats.module#StatsModule'}, - - {path: RouteConfig.loginPath, component: LoginComponent}, - {path: RouteConfig.signUpPath, component: SignupComponent}, - - {path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'}, - - {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, - {path: RouteConfig.squadPath, loadChildren: './squads/squads.module#SquadsModule', canActivate: [LoginGuardHL]}, + { + path: RouteConfig.overviewPath, + children: armyRoutes + }, + { + path: '', redirectTo: RouteConfig.overviewPath, + pathMatch: 'full' + }, + { + path: RouteConfig.statsPath, + loadChildren: './statistic/stats.module#StatsModule' + }, + { + path: RouteConfig.loginPath, + component: LoginComponent + }, + { + path: RouteConfig.signUpPath, + component: SignupComponent + }, + { + path: RouteConfig.request, + loadChildren: './request/request.module#RequestModule' + }, + { + path: RouteConfig.userPath, + loadChildren: './users/users.module#UsersModule', + canActivate: [LoginGuardHL] + }, + { + path: RouteConfig.squadPath, + loadChildren: './squads/squads.module#SquadsModule', + canActivate: [LoginGuardHL] + }, { path: RouteConfig.decorationPath, loadChildren: './decorations/decoration.module#DecorationsModule', canActivate: [LoginGuardHL] }, - {path: RouteConfig.rankPath, loadChildren: './ranks/ranks.module#RanksModule', canActivate: [LoginGuardHL]}, + { + path: RouteConfig.rankPath, + loadChildren: './ranks/ranks.module#RanksModule', + canActivate: [LoginGuardHL] + }, + { + path: RouteConfig.adminPanelPath, + loadChildren: './admin/admin.module#AdminModule', + canActivate: [LoginGuardAdmin] + }, - {path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]}, - - /** Redirect Konfigurationen **/ - {path: '404', component: NotFoundComponent}, - {path: '**', redirectTo: '/404'}, // immer als letztes konfigurieren - erste Route die matched wird angesteuert + /** Redirect Configuration **/ + { + path: '404', + component: NotFoundComponent + }, + { + path: '**', + redirectTo: '/404' + } // always configure this last - first matching route gets processed ]; export const appRouting = RouterModule.forRoot(appRoutes); diff --git a/static/src/app/request/request.module.ts b/static/src/app/request/request.module.ts index f00e6d6..36ab3e0 100644 --- a/static/src/app/request/request.module.ts +++ b/static/src/app/request/request.module.ts @@ -14,8 +14,7 @@ import {UserStore} from "../services/stores/user.store"; @NgModule({ declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent, ConfirmAwardComponent, FilterRankPipe], - imports: [CommonModule, SharedModule, requestRouterModule], - providers: [UserStore, UserService] + imports: [CommonModule, SharedModule, requestRouterModule] }) export class RequestModule { static routes = requestRouterModule; diff --git a/static/src/app/users/users.module.ts b/static/src/app/users/users.module.ts index d770eb8..44c8cbd 100644 --- a/static/src/app/users/users.module.ts +++ b/static/src/app/users/users.module.ts @@ -8,7 +8,6 @@ import {SharedModule} from "../shared.module"; @NgModule({ declarations: usersRoutingComponents, imports: [CommonModule, SharedModule, routes], - providers: [UserStore, UserService] }) export class UsersModule { static routes = routes;