Compare commits

...

2 Commits

Author SHA1 Message Date
Florian Hartwich 92b3df335a Add stats module 2017-09-02 23:27:15 +02:00
Florian Hartwich 386a53af96 add shared module 2017-09-02 22:59:13 +02:00
7 changed files with 52 additions and 48 deletions

View File

@ -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,20 +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 {SharedModule} from "./shared.module";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {AccordionModule} from "ngx-bootstrap";
@NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule, DataTableModule,
BrowserAnimationsModule, NgxChartsModule, AccordionModule.forRoot()],
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
providers: [
HttpClient,
LoginService,
@ -49,7 +40,6 @@ import {AccordionModule} from "ngx-bootstrap";
ArmyService,
AppUserService,
AppUserStore,
UserService,
SquadService,
SquadStore,
DecorationService,
@ -58,9 +48,7 @@ import {AccordionModule} from "ngx-bootstrap";
RankStore,
AwardingService,
PromotionService,
WarService,
AppConfig,
Title,
routingProviders,
{provide: AUTH_ENABLED, useValue: true}
],
@ -71,9 +59,7 @@ import {AccordionModule} from "ngx-bootstrap";
DecorationItemComponent,
RankItemComponent,
FilterRankPipe,
SquadItemComponent,
ShowErrorComponent,
APPLICATION_VALIDATORS],
SquadItemComponent],
bootstrap: [AppComponent]
})
export class AppModule {

View File

@ -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";
@ -14,15 +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 UsersModule from "./users/users.module";
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},
@ -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]},
@ -48,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];

View File

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

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 {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];

View File

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

View File

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