Add squad module; reformat

pull/7/head
Florian Hartwich 2017-09-03 12:49:59 +02:00
parent 711e82e6cc
commit 91c9986be7
48 changed files with 164 additions and 132 deletions

View File

@ -4,12 +4,12 @@
cd $(dirname $0) cd $(dirname $0)
# array of files to minify # 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" OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}" for i in "${FILES[@]}"
do do
echo "minify ${i} ..." echo "minify ${i} ..."
$(npm bin)/uglifyjs public/${i}.bundle.js ${OPTIONS} -o public/${i}.bundle.js $(npm bin)/uglifyjs public/${i}.js ${OPTIONS} -o public/${i}.js
rm -f public/${i}.bundle.js.map rm -f public/${i}.js.map
done done

View File

@ -1,4 +1,4 @@
import {browser, element, by} from 'protractor'; import {browser, by, element} from 'protractor';
describe('Main Page Access', function () { describe('Main Page Access', function () {
@ -7,7 +7,7 @@ describe('Main Page Access', function () {
browser.get('/') browser.get('/')
}); });
it('should open army overview initially', async() => { it('should open army overview initially', async () => {
let elem = element(by.css('h1')); let elem = element(by.css('h1'));
let text = elem.getText(); let text = elem.getText();
expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen"); expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen");

View File

@ -13,13 +13,13 @@ module.exports = function (config) {
require('@angular/cli/plugins/karma') require('@angular/cli/plugins/karma')
], ],
files: [ files: [
{ pattern: './src/test.ts', watched: false } {pattern: './src/test.ts', watched: false}
], ],
preprocessors: { preprocessors: {
'./src/test.ts': ['@angular/cli'] './src/test.ts': ['@angular/cli']
}, },
mime: { mime: {
'text/x-typescript': ['ts','tsx'] 'text/x-typescript': ['ts', 'tsx']
}, },
remapIstanbulReporter: { remapIstanbulReporter: {
reports: { reports: {
@ -32,8 +32,8 @@ module.exports = function (config) {
environment: 'dev' environment: 'dev'
}, },
reporters: config.angularCli && config.angularCli.codeCoverage reporters: config.angularCli && config.angularCli.codeCoverage
? ['spec', 'karma-remap-istanbul'] ? ['spec', 'karma-remap-istanbul']
: ['spec'], : ['spec'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,

View File

@ -29,24 +29,25 @@ exports.config = {
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000, defaultTimeoutInterval: 30000,
print: function() {} print: function () {
}
}, },
useAllAngular2AppRoots: true, useAllAngular2AppRoots: true,
beforeLaunch: function() { beforeLaunch: function () {
require('ts-node').register({ require('ts-node').register({
project: 'e2e' project: 'e2e'
}); });
return new Promise(function(resolve){ return new Promise(function (resolve) {
reporter.beforeLaunch(resolve); reporter.beforeLaunch(resolve);
}); });
}, },
afterLaunch: function(exitCode) { afterLaunch: function (exitCode) {
return new Promise(function(resolve){ return new Promise(function (resolve) {
reporter.afterLaunch(resolve.bind(this, exitCode)); reporter.afterLaunch(resolve.bind(this, exitCode));
}); });
}, },
onPrepare: function() { onPrepare: function () {
jasmine.getEnv().addReporter(reporter); jasmine.getEnv().addReporter(reporter);
jasmine.getEnv().addReporter(new SpecReporter()); jasmine.getEnv().addReporter(new SpecReporter());
}, },
}; };

View File

@ -1,9 +1,9 @@
// Protractor configuration file, see link for more information // Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts // 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, allScriptsTimeout: 11000,
specs: [ specs: [
'./e2e/**/*.e2e-spec.ts' './e2e/**/*.e2e-spec.ts'
@ -17,14 +17,15 @@ exports.config= {
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000, defaultTimeoutInterval: 30000,
print: function() {} print: function () {
}
}, },
beforeLaunch: function() { beforeLaunch: function () {
require('ts-node').register({ require('ts-node').register({
project: 'e2e/tsconfig.e2e.json' project: 'e2e/tsconfig.e2e.json'
}); });
}, },
onPrepare() { onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
} }
}; };

View File

@ -61,7 +61,7 @@ export class AdminComponent {
/** /**
* compare ngValue with ngModel to assign selected element * compare ngValue with ngModel to assign selected element
*/ */
equals(o1: Squad , o2: Squad) { equals(o1: Squad, o2: Squad) {
if (o1 && o2) { if (o1 && o2) {
return o1._id === o2._id; return o1._id === o2._id;
} }

View File

@ -47,11 +47,19 @@ unprocessed-child:hover {
/* Safari 4.0 - 8.0 */ /* Safari 4.0 - 8.0 */
@-webkit-keyframes color-blink { @-webkit-keyframes color-blink {
from {background-color: #222222;} from {
to {background-color: orange;} background-color: #222222;
}
to {
background-color: orange;
}
} }
@keyframes color-blink { @keyframes color-blink {
from {background-color: #222222;} from {
to {background-color: orange;} background-color: #222222;
}
to {
background-color: orange;
}
} }

View File

@ -53,17 +53,21 @@
</ul> </ul>
</li> </li>
<li *ngIf="loginService.hasPermission(2) && loginService.hasSquad()" class="dropdown"> <li *ngIf="loginService.hasPermission(2) && loginService.hasSquad()" class="dropdown">
<a href="#" [ngClass]="{'unprocessed': promotionService.hasUnprocessedPromotion || awardingService.hasUnprocessedAwards}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" <a href="#"
[ngClass]="{'unprocessed': promotionService.hasUnprocessedPromotion || awardingService.hasUnprocessedAwards}"
class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false"> aria-expanded="false">
Anträge Anträge
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a [ngClass]="{'unprocessed-child': promotionService.hasUnprocessedPromotion}" routerLink="{{config.request}}/{{config.confirmPromotionPath}}">Beförderung</a> <a [ngClass]="{'unprocessed-child': promotionService.hasUnprocessedPromotion}"
routerLink="{{config.request}}/{{config.confirmPromotionPath}}">Beförderung</a>
</li> </li>
<li> <li>
<a [ngClass]="{'unprocessed-child': awardingService.hasUnprocessedAwards}" routerLink="{{config.request}}/{{config.confirmAwardPath}}">Orden/ Auszeichnung</a> <a [ngClass]="{'unprocessed-child': awardingService.hasUnprocessedAwards}"
routerLink="{{config.request}}/{{config.confirmAwardPath}}">Orden/ Auszeichnung</a>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -1,4 +1,4 @@
import {Component, Inject, Optional} from '@angular/core'; import {Component} from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {LoginService} from './services/login-service/login-service'; import {LoginService} from './services/login-service/login-service';
import {PromotionService} from "./services/promotion-service/promotion.service"; import {PromotionService} from "./services/promotion-service/promotion.service";

View File

@ -1,20 +1,19 @@
export class AppConfig { export class AppConfig {
public readonly apiUrl = '/api'; public readonly apiUrl = '/api';
public readonly apiAppUserPath = this.apiUrl + '/account/'; public readonly apiAppUserPath = this.apiUrl + '/account/';
public readonly apiAwardPath = this.apiUrl + '/awardings'; public readonly apiAwardPath = this.apiUrl + '/awardings';
public readonly apiDecorationPath = this.apiUrl + '/decorations/'; public readonly apiDecorationPath = this.apiUrl + '/decorations/';
public readonly apiAuthenticationPath = this.apiUrl + '/authenticate'; public readonly apiAuthenticationPath = this.apiUrl + '/authenticate';
public readonly apiSignupPath = this.apiUrl + '/authenticate/signup'; public readonly apiSignupPath = this.apiUrl + '/authenticate/signup';
public readonly apiRankPath = this.apiUrl + '/ranks/'; public readonly apiRankPath = this.apiUrl + '/ranks/';
public readonly apiSquadPath = this.apiUrl + '/squads/'; public readonly apiSquadPath = this.apiUrl + '/squads/';
public readonly apiUserPath = this.apiUrl + '/users/'; public readonly apiUserPath = this.apiUrl + '/users/';
public readonly apiOverviewPath = this.apiUrl + '/overview'; public readonly apiOverviewPath = this.apiUrl + '/overview';
public readonly apiRequestAwardPath = this.apiUrl + '/request/award'; public readonly apiRequestAwardPath = this.apiUrl + '/request/award';
public readonly apiPromotionPath = this.apiUrl + '/request/promotion'; public readonly apiPromotionPath = this.apiUrl + '/request/promotion';
public readonly apiWarPath = this.apiUrl + '/wars'; public readonly apiWarPath = this.apiUrl + '/wars';
} }

View File

@ -8,7 +8,6 @@ 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";
import {DecorationService} from "./services/decoration-service/decoration.service"; 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 {RankStore} from "./services/stores/rank.store";
import {RankService} from "./services/rank-service/rank.service"; import {RankService} from "./services/rank-service/rank.service";
import {AppConfig} from "./app.config"; import {AppConfig} from "./app.config";
@ -43,8 +42,7 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
], ],
declarations: [ declarations: [
AppComponent, AppComponent,
routingComponents, routingComponents],
SquadItemComponent],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {

View File

@ -2,7 +2,6 @@ import {RouterModule, Routes} from "@angular/router";
import {LoginComponent} from "./login/index"; import {LoginComponent} from "./login/index";
import {NotFoundComponent} from "./common/not-found/not-found.component"; import {NotFoundComponent} from "./common/not-found/not-found.component";
import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard";
import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing";
import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; import {armyRoutes, armyRoutingComponents} from "./army/army.routing";
import {SignupComponent} from "./login/signup.component"; import {SignupComponent} from "./login/signup.component";
import {RouteConfig} from "./app.config"; import {RouteConfig} from "./app.config";
@ -20,8 +19,12 @@ export const appRoutes: Routes = [
{path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'}, {path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'},
{path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]},
{path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, loadChildren: './squads/squads.module#SquadsModule', canActivate: [LoginGuardHL]},
{path: RouteConfig.decorationPath, loadChildren: './decorations/decoration.module#DecorationsModule', 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]},
@ -33,6 +36,6 @@ export const appRoutes: Routes = [
export const appRouting = RouterModule.forRoot(appRoutes); 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]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin];

View File

@ -3,7 +3,7 @@ import {User} from "../models/model-interfaces";
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {UserService} from "../services/user-service/user.service"; import {UserService} from "../services/user-service/user.service";
import {Subscription} from "rxjs/Subscription"; import {Subscription} from "rxjs/Subscription";
import {AppConfig, RouteConfig} from "../app.config"; import {RouteConfig} from "../app.config";
@Component({ @Component({

View File

@ -16,7 +16,8 @@
</div> </div>
<div class=" div-table-row" style="padding-left: 8px"> <div class=" div-table-row" style="padding-left: 8px">
<div *ngFor="let member of squad.members"> <div *ngFor="let member of squad.members">
<div class="member-link text-blufor" (click)="select(member._id)">{{member.rank}} {{member.username}}</div> <div class="member-link text-blufor" (click)="select(member._id)">{{member.rank}} {{member.username}}
</div>
</div> </div>
<br> <br>
<br> <br>

View File

@ -1,5 +1,5 @@
import {Component, Input, Optional} from '@angular/core'; import {Component, Input} from '@angular/core';
import {NgForm, FormGroup} from '@angular/forms'; import {FormGroup, NgForm} from '@angular/forms';
@Component({ @Component({
selector: 'show-error', selector: 'show-error',

View File

@ -8,7 +8,7 @@ import {Decoration} from "../../models/model-interfaces";
styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'], styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['decoration', 'selected'], inputs: ['decoration', 'selected'],
outputs: ['decorationDelete','decorationSelected'], outputs: ['decorationDelete', 'decorationSelected'],
}) })
export class DecorationItemComponent { export class DecorationItemComponent {

View File

@ -49,10 +49,10 @@
<div> <div>
<pjm-decoration-item *ngFor="let decoration of decorations$ | async" <pjm-decoration-item *ngFor="let decoration of decorations$ | async"
[decoration]="decoration" [decoration]="decoration"
(decorationDelete)="deleteDecoration(decoration)" (decorationDelete)="deleteDecoration(decoration)"
(decorationSelected)="selectDecoration($event)" (decorationSelected)="selectDecoration($event)"
[selected]="decoration._id == selectedDecorationId"> [selected]="decoration._id == selectedDecorationId">
</pjm-decoration-item> </pjm-decoration-item>
</div> </div>

View File

@ -38,7 +38,7 @@
<div class="form-group"> <div class="form-group">
<label for="sort">Sortierung</label> <label for="sort">Sortierung</label>
<input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle" <input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle"
[(ngModel)]="decoration.sortingNumber"> [(ngModel)]="decoration.sortingNumber">
<show-error text="Sortierung" path="sort"></show-error> <show-error text="Sortierung" path="sort"></show-error>
</div> </div>
@ -51,7 +51,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="graphic">Bild</label> <label for="graphic">Bild</label>
<input id="graphic" name="graphic" class="ui-button form-control" type="file" <input id="graphic" name="graphic" class="ui-button form-control" type="file"
#fileInput #fileInput
accept="image/png" accept="image/png"

View File

@ -79,6 +79,10 @@
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }

View File

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router'; import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
@Injectable() @Injectable()
export class LoginGuardSQL implements CanActivate { export class LoginGuardSQL implements CanActivate {

View File

@ -1,11 +1,6 @@
import {Directive, forwardRef} from '@angular/core'; import {Directive, forwardRef} from '@angular/core';
import { import {AbstractControl, FormControl, NG_ASYNC_VALIDATORS, NG_VALIDATORS} from '@angular/forms';
FormControl,
AbstractControl,
NG_VALIDATORS, NG_ASYNC_VALIDATORS
} from '@angular/forms';
import {UserService} from "../services/user-service/user.service"; import {UserService} from "../services/user-service/user.service";
import {Observable} from "rxjs";
export function asyncIfNotBacklogThenAssignee(control): Promise<any> { export function asyncIfNotBacklogThenAssignee(control): Promise<any> {
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {

View File

@ -28,11 +28,13 @@ export interface Player {
respawn?: number; respawn?: number;
flagTouch?: number; flagTouch?: number;
} }
export interface Campaign { export interface Campaign {
_id?: string; _id?: string;
title?: string; title?: string;
wars?: War[]; wars?: War[];
} }
export interface War { export interface War {
_id?: string; _id?: string;
title?: string; title?: string;

View File

@ -30,7 +30,7 @@ export class EditRankComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private rankService : RankService) { private rankService: RankService) {
} }
ngOnInit() { ngOnInit() {

View File

@ -47,7 +47,7 @@
<div class="form-group"> <div class="form-group">
<label for="reason">Begründung</label> <label for="reason">Begründung</label>
<textarea class="form-control center-block" name="reason" [(ngModel)]="reason" required <textarea class="form-control center-block" name="reason" [(ngModel)]="reason" required
id="reason" placeholder="Begründung eingeben..." rows="3" ></textarea> id="reason" placeholder="Begründung eingeben..." rows="3"></textarea>
</div> </div>
<button id="cancel" <button id="cancel"

View File

@ -1,5 +1,4 @@
import {Component} from "@angular/core"; import {Component} from "@angular/core";
import {ActivatedRoute, Router} from "@angular/router";
import {Promotion, Rank} from "../../models/model-interfaces"; import {Promotion, Rank} from "../../models/model-interfaces";
import {RankService} from "../../services/rank-service/rank.service"; import {RankService} from "../../services/rank-service/rank.service";
import {PromotionService} from "../../services/promotion-service/promotion.service"; import {PromotionService} from "../../services/promotion-service/promotion.service";

View File

@ -1,8 +1,7 @@
import {Injectable} from "@angular/core"; import {Injectable} from "@angular/core";
import {AppUser, User} from "../../models/model-interfaces"; import {AppUser} from "../../models/model-interfaces";
import {URLSearchParams} from "@angular/http";
import {Observable} from "rxjs/Observable"; import {Observable} from "rxjs/Observable";
import {ADD, EDIT, LOAD, REMOVE} from "../stores/user.store"; import {EDIT, LOAD, REMOVE} from "../stores/user.store";
import {AppConfig} from "../../app.config"; import {AppConfig} from "../../app.config";
import {HttpClient} from "../http-client"; import {HttpClient} from "../http-client";
import {AppUserStore} from "../stores/app-user.store"; import {AppUserStore} from "../stores/app-user.store";
@ -30,12 +29,12 @@ export class AppUserService {
} }
updateUser(user: AppUser) { updateUser(user: AppUser) {
return this.http.patch(this.config.apiAppUserPath + user._id, user) return this.http.patch(this.config.apiAppUserPath + user._id, user)
.map(res => res.json()) .map(res => res.json())
.do(savedUser => { .do(savedUser => {
const action = {type: EDIT, data: savedUser}; const action = {type: EDIT, data: savedUser};
this.appUserStore.dispatch(action); this.appUserStore.dispatch(action);
}); });
} }
deleteUser(user) { deleteUser(user) {

View File

@ -1,7 +1,6 @@
import {Injectable} from "@angular/core"; import {Injectable} from "@angular/core";
import {Headers, Http, RequestMethod} from "@angular/http"; import {Headers, Http, RequestMethod} from "@angular/http";
import {Router} from "@angular/router"; import {Router} from "@angular/router";
import {LoginService} from "./login-service/login-service";
@Injectable() @Injectable()
export class HttpClient { export class HttpClient {

View File

@ -48,12 +48,12 @@ export class LoginService {
return localStorage.getItem('currentUser') != null; return localStorage.getItem('currentUser') != null;
} }
hasPermission(level : number) { hasPermission(level: number) {
let currentUser = JSON.parse(localStorage.getItem('currentUser')); let currentUser = JSON.parse(localStorage.getItem('currentUser'));
return this.isLoggedIn() && currentUser.permission >= level; return this.isLoggedIn() && currentUser.permission >= level;
} }
getCurrentUser() :AppUser { getCurrentUser(): AppUser {
return JSON.parse(localStorage.getItem('currentUser')); return JSON.parse(localStorage.getItem('currentUser'));
} }

View File

@ -3,7 +3,7 @@ import {Squad} from "../../models/model-interfaces";
import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http"; import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http";
import {Observable} from "rxjs/Observable"; import {Observable} from "rxjs/Observable";
import {SquadStore, ADD, EDIT, LOAD, REMOVE} from "../stores/squad.store"; import {ADD, EDIT, LOAD, REMOVE, SquadStore} from "../stores/squad.store";
import {AppConfig} from "../../app.config"; import {AppConfig} from "../../app.config";
import {HttpClient} from "../http-client"; import {HttpClient} from "../http-client";
@ -18,7 +18,7 @@ export class SquadService {
this.squads$ = squadStore.items$; this.squads$ = squadStore.items$;
} }
findSquads(query = '', fractionFilter='') { findSquads(query = '', fractionFilter = '') {
const searchParams = new URLSearchParams(); const searchParams = new URLSearchParams();
searchParams.append('q', query); searchParams.append('q', query);
searchParams.append('fractFilter', fractionFilter); searchParams.append('fractFilter', fractionFilter);

View File

@ -1,5 +1,5 @@
import {BehaviorSubject} from "rxjs/BehaviorSubject"; import {BehaviorSubject} from "rxjs/BehaviorSubject";
import {AppUser, User} from "../../models/model-interfaces"; import {AppUser} from "../../models/model-interfaces";
export const LOAD = 'LOAD'; export const LOAD = 'LOAD';
export const ADD = 'ADD'; export const ADD = 'ADD';

View File

@ -7,6 +7,7 @@ export const REMOVE = 'REMOVE';
type Id = string | number; type Id = string | number;
interface Identifiable { interface Identifiable {
id?: Id; id?: Id;
} }

View File

@ -6,7 +6,7 @@ import {HttpClient} from "../http-client";
@Injectable() @Injectable()
export class WarService { export class WarService {
campaigns :Campaign[]; campaigns: Campaign[];
constructor(private http: HttpClient, constructor(private http: HttpClient,
private config: AppConfig) { private config: AppConfig) {

View File

@ -30,7 +30,7 @@ export class EditSquadComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private squadService : SquadService) { private squadService: SquadService) {
} }
ngOnInit() { ngOnInit() {

View File

@ -11,7 +11,7 @@
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<img src="{{imageSrc}}" height="50px" class="squad-list-preview"> <img src="{{imageSrc}}" height="50px" class="squad-list-preview">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"></span> <span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"></span>
</div> </div>
</div> </div>

View File

@ -41,10 +41,10 @@
<div> <div>
<pjm-squad-item *ngFor="let squad of squads$ | async" <pjm-squad-item *ngFor="let squad of squads$ | async"
[squad]="squad" [squad]="squad"
(squadDelete)="deleteSquad(squad)" (squadDelete)="deleteSquad(squad)"
(squadSelected)="selectSquad($event)" (squadSelected)="selectSquad($event)"
[selected]="squad._id == selectedSquadId"> [selected]="squad._id == selectedSquadId">
</pjm-squad-item> </pjm-squad-item>
</div> </div>

View File

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

View File

@ -1,7 +1,9 @@
import {Routes} from "@angular/router"; import {RouterModule, Routes} from "@angular/router";
import {SquadComponent} from "./squads.component"; import {SquadComponent} from "./squads.component";
import {SquadListComponent} from "./squad-list/squad-list.component"; import {SquadListComponent} from "./squad-list/squad-list.component";
import {EditSquadComponent} from "./edit-squad/edit-squad.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 = [{ export const squadsRoutes: Routes = [{
path: '', component: SquadComponent, path: '', component: SquadComponent,
@ -23,5 +25,7 @@ export const squadsRoutes: Routes = [{
outlet: 'right' outlet: 'right'
}]; }];
export const squadsRoutingComponents = [SquadComponent, SquadListComponent, EditSquadComponent]; export const squadRouterModule: ModuleWithProviders = RouterModule.forChild(squadsRoutes);
export const squadsRoutingComponents = [SquadComponent, SquadItemComponent, SquadListComponent, EditSquadComponent];

View File

@ -1,7 +1,6 @@
import {Component} from "@angular/core"; 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 {WarService} from "../../services/war-service/war.service";
import {LoginService} from "../../services/login-service/login-service";
import {Player, War} from "../../models/model-interfaces"; import {Player, War} from "../../models/model-interfaces";

View File

@ -6,11 +6,12 @@
<a>{{war.title}}</a> <a>{{war.title}}</a>
</span> </span>
<br> <br>
<small >vom {{war.date | date: 'dd.MM.yyyy'}}</small> <small>vom {{war.date | date: 'dd.MM.yyyy'}}</small>
</div> </div>
<div class="col-xs-3"> <div class="col-xs-3">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash" *ngIf="loginService.hasPermission(3)"></span> <span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"
*ngIf="loginService.hasPermission(3)"></span>
</div> </div>
</div> </div>

View File

@ -40,7 +40,7 @@ span {
} }
.trash { .trash {
float:right; float: right;
padding-top: 18px; padding-top: 18px;
font-size: 17px; font-size: 17px;
} }

View File

@ -12,7 +12,8 @@
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash pull-right"></span> <span (click)="delete(); $event.stopPropagation()" title="Löschen"
class="glyphicon glyphicon-trash trash pull-right"></span>
<span (click)="award(); $event.stopPropagation()" title="Auszeichnungen" class="icon-award pull-right"></span> <span (click)="award(); $event.stopPropagation()" title="Auszeichnungen" class="icon-award pull-right"></span>
</div> </div>
</div> </div>

View File

@ -1,4 +1,3 @@
export const environment = { export const environment = {
production: false, production: false,
e2eMode: true e2eMode: true

View File

@ -9,6 +9,6 @@
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body> <body>
<app-root>Loading...</app-root> <app-root>Loading...</app-root>
</body> </body>
</html> </html>

View File

@ -1,8 +1,8 @@
import { enableProdMode } from '@angular/core'; import {enableProdMode} from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module'; import {AppModule} from './app/app.module';
import { environment } from './environments/environment'; import {environment} from './environments/environment';
import 'rxjs/add/observable/of'; import 'rxjs/add/observable/of';

View File

@ -13,11 +13,9 @@
* *
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/ */
/*************************************************************************************************** /***************************************************************************************************
* BROWSER POLYFILLS * BROWSER POLYFILLS
*/ */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol'; // import 'core-js/es6/symbol';
// import 'core-js/es6/object'; // import 'core-js/es6/object';
@ -32,29 +30,19 @@
// import 'core-js/es6/regexp'; // import 'core-js/es6/regexp';
// import 'core-js/es6/map'; // import 'core-js/es6/map';
// import 'core-js/es6/set'; // import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */ /** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; import 'core-js/es6/reflect';
import 'core-js/es7/reflect'; import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/ /** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * 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.
/*************************************************************************************************** /***************************************************************************************************

View File

@ -1,5 +1,5 @@
body { body {
padding-left: 20px; padding-left: 20px;
padding-top: 50px; padding-top: 50px;
} }
@ -47,6 +47,7 @@ form {
padding-right: 10px; padding-right: 10px;
} }
#right { #right {
overflow: hidden; overflow: hidden;
padding-left: 4%; padding-left: 4%;

View File

@ -9,18 +9,16 @@ import 'zone.js/dist/fake-async-test';
import 'rxjs/Rx'; import 'rxjs/Rx';
import { getTestBed } from '@angular/core/testing'; import {getTestBed} from '@angular/core/testing';
import { import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any; declare var __karma__: any;
declare var require: any; declare var require: any;
// Prevent Karma from running prematurely. // Prevent Karma from running prematurely.
__karma__.loaded = function () {}; __karma__.loaded = function () {
};
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(

View File

@ -12,7 +12,10 @@
"curly": true, "curly": true,
"eofline": true, "eofline": true,
"forin": true, "forin": true,
"import-blacklist": [true, "rxjs"], "import-blacklist": [
true,
"rxjs"
],
"import-spacing": true, "import-spacing": true,
"indent": [ "indent": [
true, true,
@ -97,9 +100,18 @@
"check-separator", "check-separator",
"check-type" "check-type"
], ],
"directive-selector": [
"directive-selector": [true, "attribute", "app", "camelCase"], true,
"component-selector": [true, "element", "app", "kebab-case"], "attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true, "use-input-property-decorator": true,
"use-output-property-decorator": true, "use-output-property-decorator": true,
"use-host-property-decorator": true, "use-host-property-decorator": true,