Add stats module

pull/7/head
Florian Hartwich 2017-09-02 23:27:15 +02:00
parent 386a53af96
commit 92b3df335a
4 changed files with 29 additions and 23 deletions

View File

@ -1,16 +1,10 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {Title, BrowserModule} from "@angular/platform-browser"; import {BrowserModule} from "@angular/platform-browser";
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http'; import {HttpModule} from '@angular/http';
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
import {LoginService} from "./services/login-service/login-service"; 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 {appRouting, routingComponents, routingProviders} from './app.routing';
import {AUTH_ENABLED} from './app.tokens'; 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 {SquadService} from "./services/squad-service/squad.service";
import {SquadStore} from "./services/stores/squad.store"; import {SquadStore} from "./services/stores/squad.store";
import {DecorationStore} from "./services/stores/decoration.store"; import {DecorationStore} from "./services/stores/decoration.store";
@ -32,15 +26,11 @@ import {AppUserStore} from "./services/stores/app-user.store";
import {PromotionService} from "./services/promotion-service/promotion.service"; import {PromotionService} from "./services/promotion-service/promotion.service";
import {FilterRankPipe} from "./filter/filter.pipe"; import {FilterRankPipe} from "./filter/filter.pipe";
import {WarService} from "./services/war-service/war.service"; 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 {SharedModule} from "./shared.module";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
@NgModule({ @NgModule({
imports: [SharedModule, BrowserModule, appRouting, HttpModule, ClipboardModule, DataTableModule, imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()],
providers: [ providers: [
HttpClient, HttpClient,
LoginService, LoginService,
@ -50,7 +40,6 @@ import {SharedModule} from "./shared.module";
ArmyService, ArmyService,
AppUserService, AppUserService,
AppUserStore, AppUserStore,
UserService,
SquadService, SquadService,
SquadStore, SquadStore,
DecorationService, DecorationService,
@ -59,9 +48,7 @@ import {SharedModule} from "./shared.module";
RankStore, RankStore,
AwardingService, AwardingService,
PromotionService, PromotionService,
WarService,
AppConfig, AppConfig,
Title,
routingProviders, routingProviders,
{provide: AUTH_ENABLED, useValue: true} {provide: AUTH_ENABLED, useValue: true}
], ],
@ -72,8 +59,7 @@ import {SharedModule} from "./shared.module";
DecorationItemComponent, DecorationItemComponent,
RankItemComponent, RankItemComponent,
FilterRankPipe, FilterRankPipe,
SquadItemComponent, SquadItemComponent],
APPLICATION_VALIDATORS],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {

View File

@ -13,14 +13,14 @@ import {RequestPromotionComponent} from "./request/promotion/req-promotion.compo
import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component"; import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component";
import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component"; import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component";
import {RouteConfig} from "./app.config"; import {RouteConfig} from "./app.config";
import {statsRoutes, statsRoutingComponents} from "./statistic/stats.routing"; import {statsRoutingComponents} from "./statistic/stats.routing";
export const appRoutes: Routes = [ export const appRoutes: Routes = [
{path: RouteConfig.overviewPath, children: armyRoutes}, {path: RouteConfig.overviewPath, children: armyRoutes},
{path: '', redirectTo: RouteConfig.overviewPath, pathMatch: 'full'}, {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.loginPath, component: LoginComponent},
{path: RouteConfig.signUpPath, component: SignupComponent}, {path: RouteConfig.signUpPath, component: SignupComponent},
@ -46,6 +46,6 @@ export const appRouting = RouterModule.forRoot(appRoutes);
export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent, export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent,
ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent,
...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents, ...statsRoutingComponents]; ...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents];
export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin];

View File

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

View File

@ -1,10 +1,11 @@
import {Routes} from "@angular/router"; import {RouterModule, Routes} from "@angular/router";
import {StatisticComponent} from "./stats.component"; import {StatisticComponent} from "./stats.component";
import {WarDetailComponent} from "./war-detail/war-detail.component"; import {WarDetailComponent} from "./war-detail/war-detail.component";
import {WarSubmitComponent} from "./war-submit/war-submit.component"; import {WarSubmitComponent} from "./war-submit/war-submit.component";
import {WarListComponent} from "./war-list/war-list.component"; import {WarListComponent} from "./war-list/war-list.component";
import {StatisticOverviewComponent} from "./overview/stats-overview.component"; import {StatisticOverviewComponent} from "./overview/stats-overview.component";
import {WarItemComponent} from "./war-list/war-item.component"; import {WarItemComponent} from "./war-list/war-item.component";
import {ModuleWithProviders} from "@angular/core";
export const statsRoutes: Routes = [{ export const statsRoutes: Routes = [{
@ -32,6 +33,8 @@ export const statsRoutes: Routes = [{
outlet: 'right' outlet: 'right'
}]; }];
export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes);
export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, WarListComponent, export const statsRoutingComponents = [StatisticComponent, StatisticOverviewComponent, WarListComponent,
WarSubmitComponent, WarDetailComponent, WarItemComponent]; WarSubmitComponent, WarDetailComponent, WarItemComponent];