Optimize code style
parent
08aeda0de3
commit
82cc3e1e50
|
@ -4,13 +4,13 @@ import {browser, by, element} from 'protractor';
|
||||||
describe('Main Page Access', function () {
|
describe('Main Page Access', function () {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
browser.get('/')
|
browser.get('/');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open army overview initially', async () => {
|
it('should open army overview initially', async () => {
|
||||||
let elem = element(by.css('h1'));
|
const elem = element(by.css('h1'));
|
||||||
let text = elem.getText();
|
const text = elem.getText();
|
||||||
expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen");
|
expect(text).toBe('Übersicht über alle Spieler, Squads und Armeen');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from '@angular/core';
|
||||||
import {AppUser, Squad} from "../models/model-interfaces";
|
import {AppUser, Squad} from '../models/model-interfaces';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {AppUserService} from "../services/app-user-service/app-user.service";
|
import {AppUserService} from '../services/app-user-service/app-user.service';
|
||||||
import {SquadService} from "../services/army-management/squad.service";
|
import {SquadService} from '../services/army-management/squad.service';
|
||||||
import {Fraction} from "../utils/fraction.enum";
|
import {Fraction} from '../utils/fraction.enum';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -33,14 +33,14 @@ export class AdminComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAppUser(user) {
|
updateAppUser(user) {
|
||||||
let updateObject = {
|
const updateObject = {
|
||||||
_id: user._id,
|
_id: user._id,
|
||||||
squad: user.squad,
|
squad: user.squad,
|
||||||
activated: user.activated,
|
activated: user.activated,
|
||||||
permission: user.permission
|
permission: user.permission
|
||||||
};
|
};
|
||||||
|
|
||||||
if (updateObject.squad === "0") {
|
if (updateObject.squad === '0') {
|
||||||
updateObject.squad = null;
|
updateObject.squad = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,15 +49,15 @@ export class AdminComponent {
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000)
|
}, 2000);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUser(user) {
|
deleteUser(user) {
|
||||||
if (confirm('Soll der Nutzer "' + user.username + '" wirklich gelöscht werden?')) {
|
if (confirm('Soll der Nutzer "' + user.username + '" wirklich gelöscht werden?')) {
|
||||||
this.appUserService.deleteUser(user)
|
this.appUserService.deleteUser(user)
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {NgModule} from "@angular/core";
|
import {NgModule} from '@angular/core';
|
||||||
import {AdminComponent} from "./admin.component";
|
import {AdminComponent} from './admin.component';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {AppUserStore} from "../services/stores/app-user.store";
|
import {AppUserStore} from '../services/stores/app-user.store';
|
||||||
import {AppUserService} from "../services/app-user-service/app-user.service";
|
import {AppUserService} from '../services/app-user-service/app-user.service';
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {RouterModule} from "@angular/router";
|
import {RouterModule} from '@angular/router';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AdminComponent],
|
declarations: [AdminComponent],
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {NavigationEnd, NavigationStart, Router} from '@angular/router';
|
import {NavigationEnd, NavigationStart, Router} from '@angular/router';
|
||||||
import {LoginService} from './services/app-user-service/login-service';
|
import {LoginService} from './services/app-user-service/login-service';
|
||||||
import {PromotionService} from "./services/army-management/promotion.service";
|
import {PromotionService} from './services/army-management/promotion.service';
|
||||||
import {AwardingService} from "./services/army-management/awarding.service";
|
import {AwardingService} from './services/army-management/awarding.service';
|
||||||
import {RouteConfig} from "./app.config";
|
import {RouteConfig} from './app.config';
|
||||||
|
|
||||||
declare function require(url: string);
|
declare function require(url: string);
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {BrowserModule} from "@angular/platform-browser";
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {HttpModule} from '@angular/http';
|
import {HttpModule} from '@angular/http';
|
||||||
import {AppComponent} from './app.component';
|
import {AppComponent} from './app.component';
|
||||||
import {LoginService} from "./services/app-user-service/login-service";
|
import {LoginService} from './services/app-user-service/login-service';
|
||||||
import {appRouting, routingComponents, routingProviders} from './app.routing';
|
import {appRouting, routingComponents, routingProviders} from './app.routing';
|
||||||
import {SquadService} from "./services/army-management/squad.service";
|
import {SquadService} from './services/army-management/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/army-management/decoration.service";
|
import {DecorationService} from './services/army-management/decoration.service';
|
||||||
import {RankStore} from "./services/stores/rank.store";
|
import {RankStore} from './services/stores/rank.store';
|
||||||
import {RankService} from "./services/army-management/rank.service";
|
import {RankService} from './services/army-management/rank.service';
|
||||||
import {AppConfig} from "./app.config";
|
import {AppConfig} from './app.config';
|
||||||
import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard";
|
import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from './login/login.guard';
|
||||||
import {AwardingService} from "./services/army-management/awarding.service";
|
import {AwardingService} from './services/army-management/awarding.service';
|
||||||
import {HttpClient} from "./services/http-client";
|
import {HttpClient} from './services/http-client';
|
||||||
import {ArmyService} from "./services/army-service/army.service";
|
import {ArmyService} from './services/army-service/army.service';
|
||||||
import {ClipboardModule} from 'ngx-clipboard';
|
import {ClipboardModule} from 'ngx-clipboard';
|
||||||
import {PromotionService} from "./services/army-management/promotion.service";
|
import {PromotionService} from './services/army-management/promotion.service';
|
||||||
import {SharedModule} from "./shared.module";
|
import {SharedModule} from './shared.module';
|
||||||
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
import {UserService} from "./services/army-management/user.service";
|
import {UserService} from './services/army-management/user.service';
|
||||||
import {UserStore} from "./services/stores/user.store";
|
import {UserStore} from './services/stores/user.store';
|
||||||
import {CookieService} from "ngx-cookie-service";
|
import {CookieService} from 'ngx-cookie-service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
|
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, ClipboardModule],
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {RouterModule, Routes} from "@angular/router";
|
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} from "./login/login.guard";
|
import {LoginGuardAdmin, LoginGuardHL} from './login/login.guard';
|
||||||
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';
|
||||||
|
|
||||||
export const appRoutes: Routes = [
|
export const appRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {Component, Inject} from "@angular/core";
|
import {Component, Inject} from '@angular/core';
|
||||||
import {Award, User} from "../models/model-interfaces";
|
import {Award, User} from '../models/model-interfaces';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {UserService} from "../services/army-management/user.service";
|
import {UserService} from '../services/army-management/user.service';
|
||||||
import {Subscription} from "rxjs/Subscription";
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {RouteConfig} from "../app.config";
|
import {RouteConfig} from '../app.config';
|
||||||
import {AwardingService} from "../services/army-management/awarding.service";
|
import {AwardingService} from '../services/army-management/awarding.service';
|
||||||
import {Fraction} from "../utils/fraction.enum";
|
import {Fraction} from '../utils/fraction.enum';
|
||||||
import {DOCUMENT} from "@angular/common";
|
import {DOCUMENT} from '@angular/common';
|
||||||
import {CSSHelpers} from "../global.helpers";
|
import {CSSHelpers} from '../global.helpers';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Component, Inject} from "@angular/core";
|
import {Component, Inject} from '@angular/core';
|
||||||
import {Army} from "../models/model-interfaces";
|
import {Army} from '../models/model-interfaces';
|
||||||
import {ArmyService} from "../services/army-service/army.service";
|
import {ArmyService} from '../services/army-service/army.service';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Fraction} from "../utils/fraction.enum";
|
import {Fraction} from '../utils/fraction.enum';
|
||||||
import {DOCUMENT} from "@angular/common";
|
import {DOCUMENT} from '@angular/common';
|
||||||
import {RouteConfig} from "../app.config";
|
import {RouteConfig} from '../app.config';
|
||||||
import {CSSHelpers} from "../global.helpers";
|
import {CSSHelpers} from '../global.helpers';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Routes} from "@angular/router";
|
import {Routes} from '@angular/router';
|
||||||
import {ArmyComponent} from "./army.component";
|
import {ArmyComponent} from './army.component';
|
||||||
import {ArmyMemberComponent} from "./army-member.component";
|
import {ArmyMemberComponent} from './army-member.component';
|
||||||
|
|
||||||
|
|
||||||
export const armyRoutes: Routes = [
|
export const armyRoutes: Routes = [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
|
||||||
import {Decoration} from "../../models/model-interfaces";
|
import {Decoration} from '../../models/model-interfaces';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'decoration-item',
|
selector: 'decoration-item',
|
||||||
|
@ -29,15 +29,15 @@ export class DecorationItemComponent {
|
||||||
this.imageSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
|
this.imageSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
|
||||||
if (!this.decoration.isMedal) {
|
if (!this.decoration.isMedal) {
|
||||||
this.imgStyle.width = '62px';
|
this.imgStyle.width = '62px';
|
||||||
this.imgStyle.marginTop = '17px'
|
this.imgStyle.marginTop = '17px';
|
||||||
} else {
|
} else {
|
||||||
this.imgStyle.height = '50px';
|
this.imgStyle.height = '50px';
|
||||||
this.imgStyle.marginTop = '3px'
|
this.imgStyle.marginTop = '3px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
this.decorationSelected.emit(this.decoration._id)
|
this.decorationSelected.emit(this.decoration._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Location} from "@angular/common";
|
import {Location} from '@angular/common';
|
||||||
|
|
||||||
import {FormControl} from "@angular/forms";
|
import {FormControl} from '@angular/forms';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Decoration} from "../../models/model-interfaces";
|
import {Decoration} from '../../models/model-interfaces';
|
||||||
import {DecorationService} from "../../services/army-management/decoration.service";
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'decoration-list',
|
selector: 'decoration-list',
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {decorationRoutesModule, decorationsRoutingComponents} from "./decoration.routing";
|
import {decorationRoutesModule, decorationsRoutingComponents} from './decoration.routing';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {DecorationStore} from "../services/stores/decoration.store";
|
import {DecorationStore} from '../services/stores/decoration.store';
|
||||||
import {DecorationService} from "../services/army-management/decoration.service";
|
import {DecorationService} from '../services/army-management/decoration.service';
|
||||||
import {NgModule} from "@angular/core";
|
import {NgModule} from '@angular/core';
|
||||||
import {ButtonsModule} from "ngx-bootstrap";
|
import {ButtonsModule} from 'ngx-bootstrap';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: decorationsRoutingComponents,
|
declarations: decorationsRoutingComponents,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {RouterModule, Routes} from "@angular/router";
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
import {DecorationComponent} from "./decoration.component";
|
import {DecorationComponent} from './decoration.component';
|
||||||
import {DecorationListComponent} from "./decoration-list/decoration-list.component";
|
import {DecorationListComponent} from './decoration-list/decoration-list.component';
|
||||||
import {EditDecorationComponent} from "./edit-decoration/edit-decoration.component";
|
import {EditDecorationComponent} from './edit-decoration/edit-decoration.component';
|
||||||
import {ModuleWithProviders} from "@angular/core";
|
import {ModuleWithProviders} from '@angular/core';
|
||||||
import {DecorationItemComponent} from "./decoration-list/decoration-item.component";
|
import {DecorationItemComponent} from './decoration-list/decoration-item.component';
|
||||||
|
|
||||||
export const decorationsRoutes: Routes = [{
|
export const decorationsRoutes: Routes = [{
|
||||||
path: '', component: DecorationComponent,
|
path: '', component: DecorationComponent,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {Decoration} from "../../models/model-interfaces";
|
import {Decoration} from '../../models/model-interfaces';
|
||||||
import {DecorationService} from "../../services/army-management/decoration.service";
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {Subscription} from "rxjs/Subscription";
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './edit-decoration.component.html',
|
templateUrl: './edit-decoration.component.html',
|
||||||
|
@ -66,7 +66,7 @@ export class EditDecorationComponent {
|
||||||
this.decorationService.submitDecoration(this.decoration, file)
|
this.decorationService.submitDecoration(this.decoration, file)
|
||||||
.subscribe(rank => {
|
.subscribe(rank => {
|
||||||
this.router.navigate(['..'], {relativeTo: this.route});
|
this.router.navigate(['..'], {relativeTo: this.route});
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return window.alert(`Bild ist ein Pflichtfeld`);
|
return window.alert(`Bild ist ein Pflichtfeld`);
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,8 @@ export class EditDecorationComponent {
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000)
|
}, 2000);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Pipe, PipeTransform} from "@angular/core";
|
import {Pipe, PipeTransform} from '@angular/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter Pipe to filter specific rank by level number in template
|
* Filter Pipe to filter specific rank by level number in template
|
||||||
|
@ -11,11 +11,10 @@ export class FilterRankPipe implements PipeTransform {
|
||||||
|
|
||||||
transform(items: any[], filter: any): any {
|
transform(items: any[], filter: any): any {
|
||||||
// filter items array, items which match and return true will be kept, false will be filtered out
|
// filter items array, items which match and return true will be kept, false will be filtered out
|
||||||
let res = items.filter(item => item.level === filter);
|
const res = items.filter(item => item.level === filter);
|
||||||
if (res.length === 0) {
|
if (res.length === 0) {
|
||||||
return [{name: '-'}];
|
return [{name: '-'}];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Router} from "@angular/router";
|
import {Router} from '@angular/router';
|
||||||
import {LoginService} from "../services/app-user-service/login-service";
|
import {LoginService} from '../services/app-user-service/login-service';
|
||||||
import {RouteConfig} from "../app.config";
|
import {RouteConfig} from '../app.config';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
|
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
|
||||||
import {LoginService} from "../services/app-user-service/login-service";
|
import {LoginService} from '../services/app-user-service/login-service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LoginGuardSQL implements CanActivate {
|
export class LoginGuardSQL implements CanActivate {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {LoginService} from "../services/app-user-service/login-service";
|
import {LoginService} from '../services/app-user-service/login-service';
|
||||||
import {RouteConfig} from "../app.config";
|
import {RouteConfig} from '../app.config';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -76,8 +76,8 @@ export interface Rank {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Award {
|
export interface Award {
|
||||||
_id?: string,
|
_id?: string;
|
||||||
userId: string,
|
userId: string;
|
||||||
decorationId?: any; // Decoration or string
|
decorationId?: any; // Decoration or string
|
||||||
reason?: string;
|
reason?: string;
|
||||||
proposer?: AppUser;
|
proposer?: AppUser;
|
||||||
|
@ -87,9 +87,9 @@ export interface Award {
|
||||||
|
|
||||||
export interface Promotion {
|
export interface Promotion {
|
||||||
_id?: string;
|
_id?: string;
|
||||||
userId?: string
|
userId?: string;
|
||||||
oldRankLvl: number,
|
oldRankLvl: number;
|
||||||
newRankLvl: number
|
newRankLvl: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Decoration {
|
export interface Decoration {
|
||||||
|
@ -114,7 +114,7 @@ export interface Army {
|
||||||
}[],
|
}[],
|
||||||
}[],
|
}[],
|
||||||
memberCount
|
memberCount
|
||||||
},
|
};
|
||||||
OPFOR: {
|
OPFOR: {
|
||||||
squads: {
|
squads: {
|
||||||
_id,
|
_id,
|
||||||
|
@ -127,6 +127,6 @@ export interface Army {
|
||||||
}[],
|
}[],
|
||||||
}[],
|
}[],
|
||||||
memberCount
|
memberCount
|
||||||
},
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {Rank} from "../../models/model-interfaces";
|
import {Rank} from '../../models/model-interfaces';
|
||||||
import {RankService} from "../../services/army-management/rank.service";
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {Subscription} from "rxjs/Subscription";
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -39,7 +39,7 @@ export class EditRankComponent {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscription = this.route.params
|
this.subscription = this.route.params
|
||||||
.map(params => params['id'])
|
.map(params => params['id'])
|
||||||
.filter(id => id != undefined)
|
.filter(id => id !== undefined)
|
||||||
.flatMap(id => this.rankService.getRank(id))
|
.flatMap(id => this.rankService.getRank(id))
|
||||||
.subscribe(rank => {
|
.subscribe(rank => {
|
||||||
this.rank = rank;
|
this.rank = rank;
|
||||||
|
@ -70,7 +70,7 @@ export class EditRankComponent {
|
||||||
.subscribe(rank => {
|
.subscribe(rank => {
|
||||||
this.saved = true;
|
this.saved = true;
|
||||||
this.router.navigate(['..'], {relativeTo: this.route});
|
this.router.navigate(['..'], {relativeTo: this.route});
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return window.alert(`Bild ist ein Pflichtfeld`);
|
return window.alert(`Bild ist ein Pflichtfeld`);
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,8 @@ export class EditRankComponent {
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000)
|
}, 2000);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
|
||||||
import {Rank} from "../../models/model-interfaces";
|
import {Rank} from '../../models/model-interfaces';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pjm-rank-item',
|
selector: 'pjm-rank-item',
|
||||||
|
@ -29,7 +29,7 @@ export class RankItemComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
this.rankSelected.emit(this.rank._id)
|
this.rankSelected.emit(this.rank._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Location} from "@angular/common";
|
import {Location} from '@angular/common';
|
||||||
|
|
||||||
import {FormControl} from "@angular/forms";
|
import {FormControl} from '@angular/forms';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Rank} from "../../models/model-interfaces";
|
import {Rank} from '../../models/model-interfaces';
|
||||||
import {RankService} from "../../services/army-management/rank.service";
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'rank-list',
|
selector: 'rank-list',
|
||||||
|
@ -69,7 +69,7 @@ export class RankListComponent implements OnInit {
|
||||||
if (confirm('Soll der Rang ' + rank.name + ' (' + fraction + ') wirklich gelöscht werden?')) {
|
if (confirm('Soll der Rang ' + rank.name + ' (' + fraction + ') wirklich gelöscht werden?')) {
|
||||||
this.rankService.deleteRank(rank)
|
this.rankService.deleteRank(rank)
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {NgModule} from "@angular/core";
|
import {NgModule} from '@angular/core';
|
||||||
import {rankRouterModule, ranksRoutingComponents} from "./ranks.routing";
|
import {rankRouterModule, ranksRoutingComponents} from './ranks.routing';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {RankService} from "../services/army-management/rank.service";
|
import {RankService} from '../services/army-management/rank.service';
|
||||||
import {RankStore} from "../services/stores/rank.store";
|
import {RankStore} from '../services/stores/rank.store';
|
||||||
import {ButtonsModule} from "ngx-bootstrap";
|
import {ButtonsModule} from 'ngx-bootstrap';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: ranksRoutingComponents,
|
declarations: ranksRoutingComponents,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {RouterModule, Routes} from "@angular/router";
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
import {RankComponent} from "./ranks.component";
|
import {RankComponent} from './ranks.component';
|
||||||
import {RankListComponent} from "./rank-list/rank-list.component";
|
import {RankListComponent} from './rank-list/rank-list.component';
|
||||||
import {EditRankComponent} from "./edit-rank/edit-rank.component";
|
import {EditRankComponent} from './edit-rank/edit-rank.component';
|
||||||
import {RankItemComponent} from "./rank-list/rank-item.component";
|
import {RankItemComponent} from './rank-list/rank-item.component';
|
||||||
import {ModuleWithProviders} from "@angular/core";
|
import {ModuleWithProviders} from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
export const ranksRoutes: Routes = [{
|
export const ranksRoutes: Routes = [{
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Award, Decoration, User} from "../../models/model-interfaces";
|
import {Award, Decoration, User} from '../../models/model-interfaces';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {AwardingService} from "../../services/army-management/awarding.service";
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
||||||
import {DecorationService} from "../../services/army-management/decoration.service";
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {UserService} from "../../services/army-management/user.service";
|
import {UserService} from '../../services/army-management/user.service';
|
||||||
import {LoginService} from "../../services/app-user-service/login-service";
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -81,10 +81,10 @@ export class RequestAwardComponent {
|
||||||
addAwarding(previewImage, descriptionField) {
|
addAwarding(previewImage, descriptionField) {
|
||||||
if (this.decoration._id && this.reason.length > 0) {
|
if (this.decoration._id && this.reason.length > 0) {
|
||||||
const award: Award = {
|
const award: Award = {
|
||||||
"userId": this.user._id,
|
'userId': this.user._id,
|
||||||
"decorationId": this.decoration._id,
|
'decorationId': this.decoration._id,
|
||||||
"reason": this.reason,
|
'reason': this.reason,
|
||||||
"date": Date.now()
|
'date': Date.now()
|
||||||
};
|
};
|
||||||
this.awardingService.requestAwarding(award).subscribe(() => {
|
this.awardingService.requestAwarding(award).subscribe(() => {
|
||||||
this.awardingService.getUserAwardings(this.user._id)
|
this.awardingService.getUserAwardings(this.user._id)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from '@angular/core';
|
||||||
import {Award} from "../../models/model-interfaces";
|
import {Award} from '../../models/model-interfaces';
|
||||||
import {AwardingService} from "../../services/army-management/awarding.service";
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
||||||
import {LoginService} from "../../services/app-user-service/login-service";
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from '@angular/core';
|
||||||
import {Promotion, Rank} from "../../models/model-interfaces";
|
import {Promotion, Rank} from '../../models/model-interfaces';
|
||||||
import {RankService} from "../../services/army-management/rank.service";
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {PromotionService} from "../../services/army-management/promotion.service";
|
import {PromotionService} from '../../services/army-management/promotion.service';
|
||||||
import {LoginService} from "../../services/app-user-service/login-service";
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Rank, User} from "../../models/model-interfaces";
|
import {Rank, User} from '../../models/model-interfaces';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {UserService} from "../../services/army-management/user.service";
|
import {UserService} from '../../services/army-management/user.service';
|
||||||
import {RankService} from "../../services/army-management/rank.service";
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {PromotionService} from "../../services/army-management/promotion.service";
|
import {PromotionService} from '../../services/army-management/promotion.service';
|
||||||
import {LoginService} from "../../services/app-user-service/login-service";
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -41,7 +41,7 @@ export class RequestPromotionComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let currentUser = this.loginService.getCurrentUser()
|
const currentUser = this.loginService.getCurrentUser();
|
||||||
// show only current users squad members
|
// show only current users squad members
|
||||||
this.userService.findUsers('', undefined, currentUser.squad._id).subscribe(users => {
|
this.userService.findUsers('', undefined, currentUser.squad._id).subscribe(users => {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
|
@ -51,12 +51,12 @@ export class RequestPromotionComponent {
|
||||||
});
|
});
|
||||||
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
|
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
|
||||||
this.uncheckedPromotions = promotions;
|
this.uncheckedPromotions = promotions;
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleUser() {
|
toggleUser() {
|
||||||
if (this.user._id != '0') {
|
if (this.user._id !== '0') {
|
||||||
this.showForm = true;
|
this.showForm = true;
|
||||||
this.newLevel = this.user.rankLvl;
|
this.newLevel = this.user.rankLvl;
|
||||||
this.selectedUserRank = this.ranks.filter(rank => rank.level === this.user.rankLvl).map(rank => rank.name);
|
this.selectedUserRank = this.ranks.filter(rank => rank.level === this.user.rankLvl).map(rank => rank.name);
|
||||||
|
@ -68,13 +68,13 @@ export class RequestPromotionComponent {
|
||||||
|
|
||||||
addPromotion() {
|
addPromotion() {
|
||||||
const promotion = {
|
const promotion = {
|
||||||
"userId": this.user._id,
|
'userId': this.user._id,
|
||||||
"oldRankLvl": this.user.rankLvl,
|
'oldRankLvl': this.user.rankLvl,
|
||||||
"newRankLvl": this.newLevel
|
'newRankLvl': this.newLevel
|
||||||
};
|
};
|
||||||
|
|
||||||
this.promotionService.requestPromotion(promotion).subscribe(() => {
|
this.promotionService.requestPromotion(promotion).subscribe(() => {
|
||||||
let currentUser = this.loginService.getCurrentUser();
|
const currentUser = this.loginService.getCurrentUser();
|
||||||
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
|
this.promotionService.getSquadPromotions(currentUser.squad._id).subscribe(promotions => {
|
||||||
this.uncheckedPromotions = promotions;
|
this.uncheckedPromotions = promotions;
|
||||||
this.showForm = false;
|
this.showForm = false;
|
||||||
|
@ -83,7 +83,7 @@ export class RequestPromotionComponent {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {requestRouterModule} from "./request.routing";
|
import {requestRouterModule} from './request.routing';
|
||||||
import {NgModule} from "@angular/core";
|
import {NgModule} from '@angular/core';
|
||||||
import {FilterRankPipe} from "../filter/filter.pipe";
|
import {FilterRankPipe} from '../filter/filter.pipe';
|
||||||
import {RequestComponent} from "./request.component";
|
import {RequestComponent} from './request.component';
|
||||||
import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component";
|
import {ConfirmAwardComponent} from './confirm-award/confirm-award.component';
|
||||||
import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component";
|
import {ConfirmPromotionComponent} from './confirm-promotion/confirm-promotion.component';
|
||||||
import {RequestAwardComponent} from "./award/req-award.component";
|
import {RequestAwardComponent} from './award/req-award.component';
|
||||||
import {RequestPromotionComponent} from "./promotion/req-promotion.component";
|
import {RequestPromotionComponent} from './promotion/req-promotion.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
|
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {RouterModule, Routes} from "@angular/router";
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
import {ModuleWithProviders} from "@angular/core";
|
import {ModuleWithProviders} from '@angular/core';
|
||||||
import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component";
|
import {ConfirmAwardComponent} from './confirm-award/confirm-award.component';
|
||||||
import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component";
|
import {ConfirmPromotionComponent} from './confirm-promotion/confirm-promotion.component';
|
||||||
import {RequestAwardComponent} from "./award/req-award.component";
|
import {RequestAwardComponent} from './award/req-award.component';
|
||||||
import {RequestPromotionComponent} from "./promotion/req-promotion.component";
|
import {RequestPromotionComponent} from './promotion/req-promotion.component';
|
||||||
|
|
||||||
import {RequestComponent} from "./request.component";
|
import {RequestComponent} from './request.component';
|
||||||
import {RouteConfig} from "../app.config";
|
import {RouteConfig} from '../app.config';
|
||||||
import {LoginGuardHL, LoginGuardSQL} from "../login/login.guard";
|
import {LoginGuardHL, LoginGuardSQL} from '../login';
|
||||||
|
|
||||||
|
|
||||||
export const requestRoutes: Routes = [{
|
export const requestRoutes: Routes = [{
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {AppUser} from "../../models/model-interfaces";
|
import {AppUser} from '../../models/model-interfaces';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {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';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppUserService {
|
export class AppUserService {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {Http, Response} from "@angular/http";
|
import {Http, Response} from '@angular/http';
|
||||||
import "rxjs/add/operator/map";
|
import 'rxjs/add/operator/map';
|
||||||
|
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {AwardingService} from "../army-management/awarding.service";
|
import {AwardingService} from '../army-management/awarding.service';
|
||||||
import {PromotionService} from "../army-management/promotion.service";
|
import {PromotionService} from '../army-management/promotion.service';
|
||||||
import {CookieService} from "ngx-cookie-service";
|
import {CookieService} from 'ngx-cookie-service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LoginService {
|
export class LoginService {
|
||||||
|
@ -20,7 +20,7 @@ export class LoginService {
|
||||||
return this.http.post(this.config.apiAuthenticationPath, {username: username, password: password})
|
return this.http.post(this.config.apiAuthenticationPath, {username: username, password: password})
|
||||||
.map((response: Response) => {
|
.map((response: Response) => {
|
||||||
// login successful if there's a jwt token in the response
|
// login successful if there's a jwt token in the response
|
||||||
let user = response.json();
|
const user = response.json();
|
||||||
if (user && user.token) {
|
if (user && user.token) {
|
||||||
// store user details and jwt token in cookie
|
// store user details and jwt token in cookie
|
||||||
this.cookieService.set('currentUser', JSON.stringify(user));
|
this.cookieService.set('currentUser', JSON.stringify(user));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {Award} from "../../models/model-interfaces";
|
import {Award} from '../../models/model-interfaces';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AwardingService {
|
export class AwardingService {
|
||||||
|
@ -14,15 +14,15 @@ export class AwardingService {
|
||||||
|
|
||||||
getUnconfirmedAwards(fraction?: string) {
|
getUnconfirmedAwards(fraction?: string) {
|
||||||
return this.http.get(this.config.apiAwardPath + '?inProgress=true&fractFilter=' + fraction)
|
return this.http.get(this.config.apiAwardPath + '?inProgress=true&fractFilter=' + fraction)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
checkUnprocessedAwards(fraction?: string) {
|
checkUnprocessedAwards(fraction?: string) {
|
||||||
this.getUnconfirmedAwards(fraction).subscribe((items) => {
|
this.getUnconfirmedAwards(fraction).subscribe((items) => {
|
||||||
if (items.length > 0) {
|
if (items.length > 0) {
|
||||||
this.hasUnprocessedAwards = true
|
this.hasUnprocessedAwards = true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,24 +30,24 @@ export class AwardingService {
|
||||||
*/
|
*/
|
||||||
getUserAwardings(userId: string) {
|
getUserAwardings(userId: string) {
|
||||||
return this.http.get(this.config.apiAwardPath + '?userId=' + userId)
|
return this.http.get(this.config.apiAwardPath + '?userId=' + userId)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
addAwarding(award: Award) {
|
addAwarding(award: Award) {
|
||||||
return this.http.post(this.config.apiAwardPath, award)
|
return this.http.post(this.config.apiAwardPath, award);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAward(award) {
|
updateAward(award) {
|
||||||
return this.http.patch(this.config.apiAwardPath + '/' + award._id, award)
|
return this.http.patch(this.config.apiAwardPath + '/' + award._id, award)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
requestAwarding(award: Award) {
|
requestAwarding(award: Award) {
|
||||||
return this.http.post(this.config.apiRequestAwardPath, award)
|
return this.http.post(this.config.apiRequestAwardPath, award);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAwarding(awardingId) {
|
deleteAwarding(awardingId) {
|
||||||
return this.http.delete(this.config.apiAwardPath + '/' + awardingId)
|
return this.http.delete(this.config.apiAwardPath + '/' + awardingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {Decoration} from "../../models/model-interfaces";
|
import {Decoration} 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 {ADD, DecorationStore, EDIT, LOAD, REMOVE} from "../stores/decoration.store";
|
import {ADD, DecorationStore, EDIT, LOAD, REMOVE} from '../stores/decoration.store';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
import {Promotion} from "../../models/model-interfaces";
|
import {Promotion} from '../../models/model-interfaces';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PromotionService {
|
export class PromotionService {
|
||||||
|
@ -14,33 +14,33 @@ export class PromotionService {
|
||||||
|
|
||||||
getUnconfirmedPromotions(fraction?: string) {
|
getUnconfirmedPromotions(fraction?: string) {
|
||||||
return this.http.get(this.config.apiPromotionPath + '?inProgress=true&fractFilter=' + fraction)
|
return this.http.get(this.config.apiPromotionPath + '?inProgress=true&fractFilter=' + fraction)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
checkUnconfirmedPromotions(fraction?: string) {
|
checkUnconfirmedPromotions(fraction?: string) {
|
||||||
this.getUnconfirmedPromotions(fraction).subscribe((items) => {
|
this.getUnconfirmedPromotions(fraction).subscribe((items) => {
|
||||||
if (items.length > 0) {
|
if (items.length > 0) {
|
||||||
this.hasUnprocessedPromotion = true
|
this.hasUnprocessedPromotion = true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSquadPromotions(squadId: string) {
|
getSquadPromotions(squadId: string) {
|
||||||
return this.http.get(this.config.apiPromotionPath + '?squadId=' + squadId)
|
return this.http.get(this.config.apiPromotionPath + '?squadId=' + squadId)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPromotion(promotion: Promotion) {
|
requestPromotion(promotion: Promotion) {
|
||||||
return this.http.post(this.config.apiPromotionPath, promotion)
|
return this.http.post(this.config.apiPromotionPath, promotion);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePromotion(promotion) {
|
updatePromotion(promotion) {
|
||||||
return this.http.patch(this.config.apiPromotionPath + '/' + promotion._id, promotion)
|
return this.http.patch(this.config.apiPromotionPath + '/' + promotion._id, promotion)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePromotion(promotionId) {
|
deletePromotion(promotionId) {
|
||||||
return this.http.delete(this.config.apiPromotionPath + promotionId)
|
return this.http.delete(this.config.apiPromotionPath + promotionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {Decoration, Rank} from "../../models/model-interfaces";
|
import {Decoration, Rank} 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 {LOAD} from "../stores/decoration.store";
|
import {LOAD} from '../stores/decoration.store';
|
||||||
import {ADD, EDIT, RankStore, REMOVE} from "../stores/rank.store";
|
import {ADD, EDIT, RankStore, REMOVE} from '../stores/rank.store';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -118,7 +118,7 @@ export class RankService {
|
||||||
* @param imageFile - new image file to upload
|
* @param imageFile - new image file to upload
|
||||||
*/
|
*/
|
||||||
updateRankGraphic(rankId: string, imageFile: File) {
|
updateRankGraphic(rankId: string, imageFile: File) {
|
||||||
let formData: FormData = new FormData();
|
const formData: FormData = new FormData();
|
||||||
formData.append('_id', rankId);
|
formData.append('_id', rankId);
|
||||||
formData.append('image', imageFile, imageFile.name);
|
formData.append('image', imageFile, imageFile.name);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {Squad} from "../../models/model-interfaces";
|
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 {ADD, EDIT, LOAD, REMOVE, SquadStore} 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';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SquadService {
|
export class SquadService {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {User} from "../../models/model-interfaces";
|
import {User} from '../../models/model-interfaces';
|
||||||
import {URLSearchParams} from "@angular/http";
|
import {URLSearchParams} from '@angular/http';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {ADD, EDIT, LOAD, REMOVE, UserStore} from "../stores/user.store";
|
import {ADD, EDIT, LOAD, REMOVE, UserStore} from '../stores/user.store';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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 {CookieService} from "ngx-cookie-service";
|
import {CookieService} from 'ngx-cookie-service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HttpClient {
|
export class HttpClient {
|
||||||
|
@ -16,21 +16,21 @@ export class HttpClient {
|
||||||
if (cookieField) {
|
if (cookieField) {
|
||||||
const currentUser = JSON.parse(cookieField);
|
const currentUser = JSON.parse(cookieField);
|
||||||
if (new Date().getTime() <= Date.parse(currentUser.tokenExpireDate)) {
|
if (new Date().getTime() <= Date.parse(currentUser.tokenExpireDate)) {
|
||||||
let headers = new Headers();
|
const headers = new Headers();
|
||||||
headers.append('x-access-token', currentUser.token);
|
headers.append('x-access-token', currentUser.token);
|
||||||
return headers;
|
return headers;
|
||||||
} else {
|
} else {
|
||||||
// logout
|
// logout
|
||||||
localStorage.removeItem('currentUser');
|
localStorage.removeItem('currentUser');
|
||||||
this.router.navigate(['/login'])
|
this.router.navigate(['/login']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get(url, searchParams?) {
|
get(url, searchParams?) {
|
||||||
let headers = this.createAuthorizationHeader();
|
const headers = this.createAuthorizationHeader();
|
||||||
let options: any = {headers: headers};
|
const options: any = {headers: headers};
|
||||||
if (searchParams) {
|
if (searchParams) {
|
||||||
options.search = searchParams;
|
options.search = searchParams;
|
||||||
}
|
}
|
||||||
|
@ -38,28 +38,28 @@ export class HttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
post(url, data) {
|
post(url, data) {
|
||||||
let headers = this.createAuthorizationHeader();
|
const headers = this.createAuthorizationHeader();
|
||||||
return this.http.post(url, data, {
|
return this.http.post(url, data, {
|
||||||
headers: headers
|
headers: headers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
put(url, data) {
|
put(url, data) {
|
||||||
let headers = this.createAuthorizationHeader();
|
const headers = this.createAuthorizationHeader();
|
||||||
return this.http.put(url, data, {
|
return this.http.put(url, data, {
|
||||||
headers: headers
|
headers: headers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
patch(url, data) {
|
patch(url, data) {
|
||||||
let headers = this.createAuthorizationHeader();
|
const headers = this.createAuthorizationHeader();
|
||||||
return this.http.patch(url, data, {
|
return this.http.patch(url, data, {
|
||||||
headers: headers
|
headers: headers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(url) {
|
delete(url) {
|
||||||
let headers = this.createAuthorizationHeader();
|
const headers = this.createAuthorizationHeader();
|
||||||
return this.http.delete(url, {
|
return this.http.delete(url, {
|
||||||
headers: headers
|
headers: headers
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {Campaign} from "../../models/model-interfaces";
|
import {Campaign} from '../../models/model-interfaces';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CampaignService {
|
export class CampaignService {
|
||||||
|
@ -14,17 +14,17 @@ export class CampaignService {
|
||||||
|
|
||||||
getAllCampaigns() {
|
getAllCampaigns() {
|
||||||
return this.http.get(this.config.apiWarPath)
|
return this.http.get(this.config.apiWarPath)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
submitCampaign(campaign: Campaign) {
|
submitCampaign(campaign: Campaign) {
|
||||||
return this.http.post(this.config.apiCampaignPath, campaign)
|
return this.http.post(this.config.apiCampaignPath, campaign)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCampaign(id: string) {
|
deleteCampaign(id: string) {
|
||||||
return this.http.delete(this.config.apiCampaignPath + '/' + id)
|
return this.http.delete(this.config.apiCampaignPath + '/' + id)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
import {URLSearchParams} from "@angular/http";
|
import {URLSearchParams} from '@angular/http';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LogsService {
|
export class LogsService {
|
||||||
|
@ -12,28 +12,28 @@ export class LogsService {
|
||||||
|
|
||||||
getFullLog(warId: string) {
|
getFullLog(warId: string) {
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId)
|
return this.http.get(this.config.apiLogsPath + '/' + warId)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getBudgetLogs(warId: string, fraction = '') {
|
getBudgetLogs(warId: string, fraction = '') {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.append('fraction', fraction);
|
params.append('fraction', fraction);
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/budget', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/budget', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getRespawnLogs(warId: string, playerName = '') {
|
getRespawnLogs(warId: string, playerName = '') {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.append('player', playerName);
|
params.append('player', playerName);
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/respawn', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/respawn', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getPointsLogs(warId: string, fraction = '') {
|
getPointsLogs(warId: string, fraction = '') {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.append('fraction', fraction);
|
params.append('fraction', fraction);
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/points', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/points', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getReviveLogs(warId: string, medicName = '', patientName = '', fraction = '', stabilizedOnly = false, reviveOnly = false) {
|
getReviveLogs(warId: string, medicName = '', patientName = '', fraction = '', stabilizedOnly = false, reviveOnly = false) {
|
||||||
|
@ -44,7 +44,7 @@ export class LogsService {
|
||||||
params.append('stabilized', stabilizedOnly ? 'true' : '');
|
params.append('stabilized', stabilizedOnly ? 'true' : '');
|
||||||
params.append('revive', reviveOnly ? 'true' : '');
|
params.append('revive', reviveOnly ? 'true' : '');
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/revive', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/revive', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getKillLogs(warId: string, shooterName = '', targetName = '', fraction = '', friendlyFireOnly = false, notFriendlyFireOnly = false) {
|
getKillLogs(warId: string, shooterName = '', targetName = '', fraction = '', friendlyFireOnly = false, notFriendlyFireOnly = false) {
|
||||||
|
@ -55,7 +55,7 @@ export class LogsService {
|
||||||
params.append('friendlyFire', friendlyFireOnly ? 'true' : '');
|
params.append('friendlyFire', friendlyFireOnly ? 'true' : '');
|
||||||
params.append('noFriendlyFire', notFriendlyFireOnly ? 'true' : '');
|
params.append('noFriendlyFire', notFriendlyFireOnly ? 'true' : '');
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/kills', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/kills', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getTransportLogs(warId: string, driverName = '', passengerName = '', fraction = '') {
|
getTransportLogs(warId: string, driverName = '', passengerName = '', fraction = '') {
|
||||||
|
@ -64,7 +64,7 @@ export class LogsService {
|
||||||
params.append('passenger', passengerName);
|
params.append('passenger', passengerName);
|
||||||
params.append('fraction', fraction);
|
params.append('fraction', fraction);
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/transport', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/transport', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getFlagLogs(warId: string, playerName = '', fraction = '', captureOnly = false, defendOnly = false) {
|
getFlagLogs(warId: string, playerName = '', fraction = '', captureOnly = false, defendOnly = false) {
|
||||||
|
@ -74,7 +74,7 @@ export class LogsService {
|
||||||
params.append('capture', captureOnly ? 'true' : '');
|
params.append('capture', captureOnly ? 'true' : '');
|
||||||
params.append('defend', defendOnly ? 'true' : '');
|
params.append('defend', defendOnly ? 'true' : '');
|
||||||
return this.http.get(this.config.apiLogsPath + '/' + warId + '/flag', params)
|
return this.http.get(this.config.apiLogsPath + '/' + warId + '/flag', params)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PlayerService {
|
export class PlayerService {
|
||||||
|
@ -11,12 +11,12 @@ export class PlayerService {
|
||||||
|
|
||||||
getCampaignPlayer(campaignId: string, playerName: string) {
|
getCampaignPlayer(campaignId: string, playerName: string) {
|
||||||
return this.http.get(this.config.apiPlayersPath + '/single/' + campaignId + '/' + playerName)
|
return this.http.get(this.config.apiPlayersPath + '/single/' + campaignId + '/' + playerName)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
getCampaignHighscore(campaignId: string) {
|
getCampaignHighscore(campaignId: string) {
|
||||||
return this.http.get(this.config.apiPlayersPath + '/ranking/' + campaignId)
|
return this.http.get(this.config.apiPlayersPath + '/ranking/' + campaignId)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from '@angular/core';
|
||||||
import {War} from "../../models/model-interfaces";
|
import {War} from '../../models/model-interfaces';
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from '../../app.config';
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from '../http-client';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WarService {
|
export class WarService {
|
||||||
|
@ -12,7 +12,7 @@ export class WarService {
|
||||||
|
|
||||||
getWar(warId: string) {
|
getWar(warId: string) {
|
||||||
return this.http.get(this.config.apiWarPath + '/' + warId)
|
return this.http.get(this.config.apiWarPath + '/' + warId)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ export class WarService {
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http.post(this.config.apiWarPath, body)
|
return this.http.post(this.config.apiWarPath, body)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteWar(id: string) {
|
deleteWar(id: string) {
|
||||||
return this.http.delete(this.config.apiWarPath + '/' + id)
|
return this.http.delete(this.config.apiWarPath + '/' + id)
|
||||||
.map(res => res.json())
|
.map(res => res.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BehaviorSubject} from "rxjs/BehaviorSubject";
|
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
||||||
import {AppUser} 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';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BehaviorSubject} from "rxjs/BehaviorSubject";
|
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
||||||
import {Decoration} from "../../models/model-interfaces";
|
import {Decoration} from '../../models/model-interfaces';
|
||||||
|
|
||||||
export const LOAD = 'LOAD';
|
export const LOAD = 'LOAD';
|
||||||
export const ADD = 'ADD';
|
export const ADD = 'ADD';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BehaviorSubject} from "rxjs/BehaviorSubject";
|
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
||||||
import {Rank} from "../../models/model-interfaces";
|
import {Rank} from '../../models/model-interfaces';
|
||||||
|
|
||||||
export const LOAD = 'LOAD';
|
export const LOAD = 'LOAD';
|
||||||
export const ADD = 'ADD';
|
export const ADD = 'ADD';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BehaviorSubject} from "rxjs/BehaviorSubject";
|
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
||||||
import {Squad} from "../../models/model-interfaces";
|
import {Squad} from '../../models/model-interfaces';
|
||||||
|
|
||||||
export const LOAD = 'LOAD';
|
export const LOAD = 'LOAD';
|
||||||
export const ADD = 'ADD';
|
export const ADD = 'ADD';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BehaviorSubject} from "rxjs/BehaviorSubject";
|
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
|
||||||
import {User} from "../../models/model-interfaces";
|
import {User} from '../../models/model-interfaces';
|
||||||
|
|
||||||
export const LOAD = 'LOAD';
|
export const LOAD = 'LOAD';
|
||||||
export const ADD = 'ADD';
|
export const ADD = 'ADD';
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {Squad} from "../../models/model-interfaces";
|
import {Squad} from '../../models/model-interfaces';
|
||||||
import {SquadService} from "../../services/army-management/squad.service";
|
import {SquadService} from '../../services/army-management/squad.service';
|
||||||
import {Subscription} from "rxjs/Subscription";
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -39,7 +39,7 @@ export class EditSquadComponent {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscription = this.route.params
|
this.subscription = this.route.params
|
||||||
.map(params => params['id'])
|
.map(params => params['id'])
|
||||||
.filter(id => id != undefined)
|
.filter(id => id !== undefined)
|
||||||
.flatMap(id => this.squadService.getSquad(id))
|
.flatMap(id => this.squadService.getSquad(id))
|
||||||
.subscribe(squad => {
|
.subscribe(squad => {
|
||||||
this.squad = squad;
|
this.squad = squad;
|
||||||
|
@ -70,7 +70,7 @@ export class EditSquadComponent {
|
||||||
.subscribe(rank => {
|
.subscribe(rank => {
|
||||||
this.saved = true;
|
this.saved = true;
|
||||||
this.router.navigate(['..'], {relativeTo: this.route});
|
this.router.navigate(['..'], {relativeTo: this.route});
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return window.alert(`Bild ist ein Pflichtfeld`);
|
return window.alert(`Bild ist ein Pflichtfeld`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
|
||||||
import {Squad} from "../../models/model-interfaces";
|
import {Squad} from '../../models/model-interfaces';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pjm-squad-item',
|
selector: 'pjm-squad-item',
|
||||||
|
@ -30,7 +30,7 @@ export class SquadItemComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
this.squadSelected.emit(this.squad._id)
|
this.squadSelected.emit(this.squad._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Location} from "@angular/common";
|
import {Location} from '@angular/common';
|
||||||
|
|
||||||
import {FormControl} from "@angular/forms";
|
import {FormControl} from '@angular/forms';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Squad} from "../../models/model-interfaces";
|
import {Squad} from '../../models/model-interfaces';
|
||||||
import {SquadService} from "../../services/army-management/squad.service";
|
import {SquadService} from '../../services/army-management/squad.service';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'squad-list',
|
selector: 'squad-list',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'users',
|
selector: 'users',
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {squadRouterModule, squadsRoutingComponents} from "./squads.routing";
|
import {squadRouterModule, squadsRoutingComponents} from './squads.routing';
|
||||||
import {SquadStore} from "../services/stores/squad.store";
|
import {SquadStore} from '../services/stores/squad.store';
|
||||||
import {SquadService} from "../services/army-management/squad.service";
|
import {SquadService} from '../services/army-management/squad.service';
|
||||||
import {ButtonsModule} from "ngx-bootstrap";
|
import {ButtonsModule} from 'ngx-bootstrap';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: squadsRoutingComponents,
|
declarations: squadsRoutingComponents,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {RouterModule, 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 {ModuleWithProviders} from '@angular/core';
|
||||||
import {SquadItemComponent} from "./squad-list/squad-item.component";
|
import {SquadItemComponent} from './squad-list/squad-item.component';
|
||||||
|
|
||||||
export const squadsRoutes: Routes = [{
|
export const squadsRoutes: Routes = [{
|
||||||
path: '', component: SquadComponent,
|
path: '', component: SquadComponent,
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
import {Component, EventEmitter} from "@angular/core";
|
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||||
import {CampaignPlayer} from "../../models/model-interfaces";
|
import {CampaignPlayer} from '../../models/model-interfaces';
|
||||||
import {PlayerService} from "../../services/logs/player.service";
|
import {PlayerService} from '../../services/logs/player.service';
|
||||||
import {ChartUtils} from "../../utils/chart-utils";
|
import {ChartUtils} from '../../utils/chart-utils';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'campaign-player-detail',
|
selector: 'campaign-player-detail',
|
||||||
templateUrl: './campaign-player-detail.component.html',
|
templateUrl: './campaign-player-detail.component.html',
|
||||||
inputs: ['campaignId', 'playerName'],
|
|
||||||
outputs: ['switchTab'],
|
|
||||||
styleUrls: ['./campaign-player-detail.component.css', '../../style/list-entry.css',
|
styleUrls: ['./campaign-player-detail.component.css', '../../style/list-entry.css',
|
||||||
'../../style/hide-scrollbar.css', '../../style/overview.css']
|
'../../style/hide-scrollbar.css', '../../style/overview.css']
|
||||||
})
|
})
|
||||||
export class CampaignPlayerDetailComponent {
|
export class CampaignPlayerDetailComponent {
|
||||||
|
|
||||||
campaignId: string;
|
@Input() campaignId: string;
|
||||||
|
|
||||||
playerName: string;
|
@Input() playerName: string;
|
||||||
|
|
||||||
switchTab = new EventEmitter();
|
@Output() switchTab = new EventEmitter();
|
||||||
|
|
||||||
campaignPlayer: CampaignPlayer = {campaign: {}, players: []};
|
campaignPlayer: CampaignPlayer = {campaign: {}, players: []};
|
||||||
|
|
||||||
|
@ -90,16 +88,16 @@ export class CampaignPlayerDetailComponent {
|
||||||
this.playerService.getCampaignPlayer(this.campaignId, encodeURIComponent(this.playerName))
|
this.playerService.getCampaignPlayer(this.campaignId, encodeURIComponent(this.playerName))
|
||||||
.subscribe(campaignPlayer => {
|
.subscribe(campaignPlayer => {
|
||||||
this.campaignPlayer = campaignPlayer;
|
this.campaignPlayer = campaignPlayer;
|
||||||
this.killData = this.assignData(this.yAxisKill, "kill");
|
this.killData = this.assignData(this.yAxisKill, 'kill');
|
||||||
this.vehicleKillData = this.assignData(this.yAxisVehicleKill, "vehicle");
|
this.vehicleKillData = this.assignData(this.yAxisVehicleKill, 'vehicle');
|
||||||
this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, "friendlyFire");
|
this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, 'friendlyFire');
|
||||||
this.deathData = this.assignData(this.yAxisDeath, "death");
|
this.deathData = this.assignData(this.yAxisDeath, 'death');
|
||||||
this.respawnData = this.assignData(this.yAxisRespawn, "respawn");
|
this.respawnData = this.assignData(this.yAxisRespawn, 'respawn');
|
||||||
this.reviveData = this.assignData(this.yAxisRevive, "revive");
|
this.reviveData = this.assignData(this.yAxisRevive, 'revive');
|
||||||
this.captureData = this.assignData(this.yAxisCapture, "flagTouch");
|
this.captureData = this.assignData(this.yAxisCapture, 'flagTouch');
|
||||||
|
|
||||||
this.kdRatio = parseFloat((this.totalKills / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
|
this.kdRatio = parseFloat((this.totalKills / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
|
||||||
if (this.kdRatio > 1) this.maxKd = this.kdRatio * 1.7;
|
if (this.kdRatio > 1) { this.maxKd = this.kdRatio * 1.7; }
|
||||||
|
|
||||||
this.respawnDeathRatio = parseFloat((this.totalRespawn / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
|
this.respawnDeathRatio = parseFloat((this.totalRespawn / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
|
||||||
|
|
||||||
|
@ -139,7 +137,7 @@ export class CampaignPlayerDetailComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private assignData(label, field) {
|
private assignData(label, field) {
|
||||||
let killObj = {
|
const killObj = {
|
||||||
name: label,
|
name: label,
|
||||||
series: []
|
series: []
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {Campaign} from "../../models/model-interfaces";
|
import {Campaign} from '../../models/model-interfaces';
|
||||||
import {CampaignService} from "../../services/logs/campaign.service";
|
import {CampaignService} from '../../services/logs/campaign.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from '@angular/core';
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {PlayerService} from "../../services/logs/player.service";
|
import {PlayerService} from '../../services/logs/player.service';
|
||||||
import {CampaignService} from "../../services/logs/campaign.service";
|
import {CampaignService} from '../../services/logs/campaign.service';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
import {FormControl} from "@angular/forms";
|
import {FormControl} from '@angular/forms';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {Player} from "../../models/model-interfaces";
|
import {Player} from '../../models/model-interfaces';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -57,8 +57,8 @@ export class StatisticHighScoreComponent {
|
||||||
this.initData();
|
this.initData();
|
||||||
} else {
|
} else {
|
||||||
this.campaignService.getAllCampaigns().subscribe(campaigns => {
|
this.campaignService.getAllCampaigns().subscribe(campaigns => {
|
||||||
this.initData()
|
this.initData();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ export class StatisticHighScoreComponent {
|
||||||
this.playerService.getCampaignHighscore(this.id).subscribe(players => {
|
this.playerService.getCampaignHighscore(this.id).subscribe(players => {
|
||||||
this.players = players;
|
this.players = players;
|
||||||
this.playersStored = players;
|
this.playersStored = players;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
filterPlayers() {
|
filterPlayers() {
|
||||||
|
@ -91,7 +91,7 @@ export class StatisticHighScoreComponent {
|
||||||
respawn: this.filterPlayerAttribute('respawn'),
|
respawn: this.filterPlayerAttribute('respawn'),
|
||||||
revive: this.filterPlayerAttribute('revive'),
|
revive: this.filterPlayerAttribute('revive'),
|
||||||
flagTouch: this.filterPlayerAttribute('flagTouch')
|
flagTouch: this.filterPlayerAttribute('flagTouch')
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,12 +100,12 @@ export class StatisticHighScoreComponent {
|
||||||
|
|
||||||
return this.playersStored[attribute].filter(player => {
|
return this.playersStored[attribute].filter(player => {
|
||||||
for (let i = 0; i < query.length; i++) {
|
for (let i = 0; i < query.length; i++) {
|
||||||
if (query[i].trim() != '' && player.name.toLowerCase().includes(query[i].trim())) {
|
if (query[i].trim() !== '' && player.name.toLowerCase().includes(query[i].trim())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component, Input} from '@angular/core';
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {CampaignService} from "../../services/logs/campaign.service";
|
import {CampaignService} from '../../services/logs/campaign.service';
|
||||||
import {ChartUtils} from "../../utils/chart-utils";
|
import {ChartUtils} from '../../utils/chart-utils';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'stats-overview',
|
selector: 'stats-overview',
|
||||||
templateUrl: './stats-overview.component.html',
|
templateUrl: './stats-overview.component.html',
|
||||||
styleUrls: ['./stats-overview.component.css', '../../style/list-entry.css', '../../style/overview.css'],
|
styleUrls: ['./stats-overview.component.css', '../../style/list-entry.css', '../../style/overview.css']
|
||||||
inputs: ['campaigns']
|
|
||||||
})
|
})
|
||||||
export class StatisticOverviewComponent {
|
export class StatisticOverviewComponent {
|
||||||
|
|
||||||
id = "";
|
@Input() campaigns;
|
||||||
title = "";
|
|
||||||
|
id = '';
|
||||||
|
title = '';
|
||||||
|
|
||||||
pointData: any[] = [];
|
pointData: any[] = [];
|
||||||
pointSumData: any[] = [];
|
pointSumData: any[] = [];
|
||||||
|
@ -33,7 +34,7 @@ export class StatisticOverviewComponent {
|
||||||
legendTitle = '';
|
legendTitle = '';
|
||||||
showXAxisLabel = true;
|
showXAxisLabel = true;
|
||||||
showYAxisLabel = true;
|
showYAxisLabel = true;
|
||||||
yAxisLabel = "";
|
yAxisLabel = '';
|
||||||
autoscale = true;
|
autoscale = true;
|
||||||
timeline = false;
|
timeline = false;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ export class StatisticOverviewComponent {
|
||||||
} else {
|
} else {
|
||||||
this.campaignService.getAllCampaigns().subscribe(campaigns => {
|
this.campaignService.getAllCampaigns().subscribe(campaigns => {
|
||||||
this.initWars(campaigns);
|
this.initWars(campaigns);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -65,34 +66,38 @@ export class StatisticOverviewComponent {
|
||||||
itemsProcessed++;
|
itemsProcessed++;
|
||||||
if (itemsProcessed === campaigns.length) {
|
if (itemsProcessed === campaigns.length) {
|
||||||
if (this.id === 'all') {
|
if (this.id === 'all') {
|
||||||
this.title = "Gesamtübersicht";
|
this.title = 'Gesamtübersicht';
|
||||||
wars.sort((a, b) => {
|
wars.sort((a, b) => {
|
||||||
// sort by dates, because older campaign can contain newer war
|
// sort by dates, because older campaign can contain newer war
|
||||||
if (a['date'] > (b['date'])) return -1;
|
if (a['date'] > (b['date'])) {
|
||||||
if (a['date'] < (b['date'])) return 1;
|
return -1;
|
||||||
|
}
|
||||||
|
if (a['date'] < (b['date'])) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.title = campaign.title;
|
this.title = campaign.title;
|
||||||
}
|
}
|
||||||
this.initChart(wars);
|
this.initChart(wars);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
goToSlide(index: number) {
|
goToSlide(index: number) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
this.currentData = this.pointSumData;
|
this.currentData = this.pointSumData;
|
||||||
this.yAxisLabel = "Gesamtpunkte";
|
this.yAxisLabel = 'Gesamtpunkte';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.currentData = this.pointData;
|
this.currentData = this.pointData;
|
||||||
this.yAxisLabel = "Punkte";
|
this.yAxisLabel = 'Punkte';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.currentData = this.playerData;
|
this.currentData = this.playerData;
|
||||||
this.yAxisLabel = "Anzahl Spieler";
|
this.yAxisLabel = 'Anzahl Spieler';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.activeSlideIndex = index;
|
this.activeSlideIndex = index;
|
||||||
|
@ -140,7 +145,7 @@ export class StatisticOverviewComponent {
|
||||||
this.pointData = pointsObj;
|
this.pointData = pointsObj;
|
||||||
this.pointSumData = pointsSumObj;
|
this.pointSumData = pointsSumObj;
|
||||||
this.playerData = playersObj;
|
this.playerData = playersObj;
|
||||||
if (this.id != 'all') {
|
if (this.id !== 'all') {
|
||||||
this.goToSlide(0);
|
this.goToSlide(0);
|
||||||
} else {
|
} else {
|
||||||
this.goToSlide(1);
|
this.goToSlide(1);
|
||||||
|
@ -149,7 +154,7 @@ export class StatisticOverviewComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
isActiveSlide(index) {
|
isActiveSlide(index) {
|
||||||
return this.activeSlideIndex === index ? '#d9edf7' : 'white'
|
return this.activeSlideIndex === index ? '#d9edf7' : 'white';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {statsRouterModule, statsRoutingComponents} from "./stats.routing";
|
import {statsRouterModule, statsRoutingComponents} from './stats.routing';
|
||||||
import {WarService} from "../services/logs/war.service";
|
import {WarService} from '../services/logs/war.service';
|
||||||
import {NgxChartsModule} from "@swimlane/ngx-charts";
|
import {NgxChartsModule} from '@swimlane/ngx-charts';
|
||||||
import {AccordionModule, ButtonsModule} from "ngx-bootstrap";
|
import {AccordionModule, ButtonsModule} from 'ngx-bootstrap';
|
||||||
import {CampaignService} from "../services/logs/campaign.service";
|
import {CampaignService} from '../services/logs/campaign.service';
|
||||||
import {NgxDatatableModule} from "@swimlane/ngx-datatable";
|
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
|
||||||
import {PlayerService} from "../services/logs/player.service";
|
import {PlayerService} from '../services/logs/player.service';
|
||||||
import {LogsService} from "../services/logs/logs.service";
|
import {LogsService} from '../services/logs/logs.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: statsRoutingComponents,
|
declarations: statsRoutingComponents,
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import {RouterModule, Routes} from "@angular/router";
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
import {StatisticComponent} from "./stats.component";
|
import {StatisticComponent} from './stats.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";
|
import {ModuleWithProviders} from '@angular/core';
|
||||||
import {CampaignSubmitComponent} from "./campaign-submit/campaign-submit.component";
|
import {CampaignSubmitComponent} from './campaign-submit/campaign-submit.component';
|
||||||
import {CampaignPlayerDetailComponent} from "./campaign-player-detail/campaign-player-detail.component";
|
import {CampaignPlayerDetailComponent} from './campaign-player-detail/campaign-player-detail.component';
|
||||||
import {WarDetailComponent} from "./war-detail/war-detail.component";
|
import {WarDetailComponent} from './war-detail/war-detail.component';
|
||||||
import {ScoreboardComponent} from "./war-detail/scoreboard/scoreboard.component";
|
import {ScoreboardComponent} from './war-detail/scoreboard/scoreboard.component';
|
||||||
import {WarSubmitComponent} from "./war-submit/war-submit.component";
|
import {WarSubmitComponent} from './war-submit/war-submit.component';
|
||||||
import {FractionStatsComponent} from "./war-detail/fraction-stats/fraction-stats.component";
|
import {FractionStatsComponent} from './war-detail/fraction-stats/fraction-stats.component';
|
||||||
import {StatisticHighScoreComponent} from "./highscore/highscore.component";
|
import {StatisticHighScoreComponent} from './highscore/highscore.component';
|
||||||
|
|
||||||
|
|
||||||
export const statsRoutes: Routes = [{
|
export const statsRoutes: Routes = [{
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
import {Component, ElementRef, SimpleChanges, ViewChild} from "@angular/core";
|
import {Component, ElementRef, Input, SimpleChanges, ViewChild} from '@angular/core';
|
||||||
import * as d3 from "d3";
|
import * as d3 from 'd3';
|
||||||
import {ChartUtils} from "../../../utils/chart-utils";
|
import {ChartUtils} from '../../../utils/chart-utils';
|
||||||
import {Fraction} from "../../../utils/fraction.enum";
|
import {Fraction} from '../../../utils/fraction.enum';
|
||||||
import {War} from "../../../models/model-interfaces";
|
import {War} from '../../../models/model-interfaces';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'war-detail-fraction',
|
selector: 'war-detail-fraction',
|
||||||
templateUrl: './fraction-stats.component.html',
|
templateUrl: './fraction-stats.component.html',
|
||||||
inputs: ['war', 'logData'],
|
|
||||||
styleUrls: ['./fraction-stats.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
styleUrls: ['./fraction-stats.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||||
})
|
})
|
||||||
export class FractionStatsComponent {
|
export class FractionStatsComponent {
|
||||||
|
@ -17,9 +16,9 @@ export class FractionStatsComponent {
|
||||||
|
|
||||||
@ViewChild('overview') private overviewContainer: ElementRef;
|
@ViewChild('overview') private overviewContainer: ElementRef;
|
||||||
|
|
||||||
war: War;
|
@Input() war: War;
|
||||||
|
|
||||||
logData: any;
|
@Input() logData: any;
|
||||||
|
|
||||||
startDateObj: Date;
|
startDateObj: Date;
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ export class FractionStatsComponent {
|
||||||
const fractionChange = budgetEntry.fraction === 'BLUFOR' ? 0 : 1;
|
const fractionChange = budgetEntry.fraction === 'BLUFOR' ? 0 : 1;
|
||||||
const fractionOld = budgetEntry.fraction !== 'BLUFOR' ? 0 : 1;
|
const fractionOld = budgetEntry.fraction !== 'BLUFOR' ? 0 : 1;
|
||||||
|
|
||||||
if (this.isTwoMinutesAhead(budgetEntryDate, this.tmpBudgetData)) {
|
if (FractionStatsComponent.isTwoMinutesAhead(budgetEntryDate, this.tmpBudgetData)) {
|
||||||
this.tmpBudgetData[fractionChange].series.push(ChartUtils.getSeriesEntry(new Date(budgetEntry.time), budgetEntry.newBudget));
|
this.tmpBudgetData[fractionChange].series.push(ChartUtils.getSeriesEntry(new Date(budgetEntry.time), budgetEntry.newBudget));
|
||||||
this.tmpBudgetData[fractionOld].series.push(ChartUtils.getSeriesEntry(new Date(budgetEntry.time),
|
this.tmpBudgetData[fractionOld].series.push(ChartUtils.getSeriesEntry(new Date(budgetEntry.time),
|
||||||
this.tmpBudgetData[fractionOld].series[this.tmpBudgetData[fractionOld].series.length - 1].value));
|
this.tmpBudgetData[fractionOld].series[this.tmpBudgetData[fractionOld].series.length - 1].value));
|
||||||
|
@ -187,7 +186,7 @@ export class FractionStatsComponent {
|
||||||
if (killEntry.fraction === 'OPFOR') {
|
if (killEntry.fraction === 'OPFOR') {
|
||||||
killCountOpfor++;
|
killCountOpfor++;
|
||||||
}
|
}
|
||||||
if (this.isTwoMinutesAhead(killEntryDate, this.tmpKillData)) {
|
if (FractionStatsComponent.isTwoMinutesAhead(killEntryDate, this.tmpKillData)) {
|
||||||
this.tmpKillData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountBlufor));
|
this.tmpKillData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountBlufor));
|
||||||
this.tmpKillData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountOpfor));
|
this.tmpKillData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountOpfor));
|
||||||
}
|
}
|
||||||
|
@ -198,7 +197,7 @@ export class FractionStatsComponent {
|
||||||
if (killEntry.fraction === 'OPFOR') {
|
if (killEntry.fraction === 'OPFOR') {
|
||||||
ffKillCountOpfor++;
|
ffKillCountOpfor++;
|
||||||
}
|
}
|
||||||
if (this.isTwoMinutesAhead(killEntryDate, this.tmpFrienlyFireData)) {
|
if (FractionStatsComponent.isTwoMinutesAhead(killEntryDate, this.tmpFrienlyFireData)) {
|
||||||
this.tmpFrienlyFireData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountBlufor));
|
this.tmpFrienlyFireData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountBlufor));
|
||||||
this.tmpFrienlyFireData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountOpfor));
|
this.tmpFrienlyFireData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountOpfor));
|
||||||
}
|
}
|
||||||
|
@ -212,7 +211,7 @@ export class FractionStatsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addFinalTimeData(this.tmpKillData);
|
this.addFinalTimeData(this.tmpKillData);
|
||||||
this.addFinalTimeData(this.tmpFrienlyFireData)
|
this.addFinalTimeData(this.tmpFrienlyFireData);
|
||||||
this.initialized.kill = true;
|
this.initialized.kill = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +228,7 @@ export class FractionStatsComponent {
|
||||||
} else {
|
} else {
|
||||||
reviveCountOpfor++;
|
reviveCountOpfor++;
|
||||||
}
|
}
|
||||||
if (this.isTwoMinutesAhead(reviveEntryDate, this.tmpReviveData)) {
|
if (FractionStatsComponent.isTwoMinutesAhead(reviveEntryDate, this.tmpReviveData)) {
|
||||||
this.tmpReviveData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountBlufor));
|
this.tmpReviveData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountBlufor));
|
||||||
this.tmpReviveData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountOpfor));
|
this.tmpReviveData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountOpfor));
|
||||||
}
|
}
|
||||||
|
@ -239,7 +238,7 @@ export class FractionStatsComponent {
|
||||||
} else {
|
} else {
|
||||||
stabilizeCountOpfor++;
|
stabilizeCountOpfor++;
|
||||||
}
|
}
|
||||||
if (this.isTwoMinutesAhead(reviveEntryDate, this.tmpStabilizeData)) {
|
if (FractionStatsComponent.isTwoMinutesAhead(reviveEntryDate, this.tmpStabilizeData)) {
|
||||||
this.tmpStabilizeData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountBlufor));
|
this.tmpStabilizeData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountBlufor));
|
||||||
this.tmpStabilizeData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountOpfor));
|
this.tmpStabilizeData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountOpfor));
|
||||||
}
|
}
|
||||||
|
@ -271,7 +270,7 @@ export class FractionStatsComponent {
|
||||||
} else {
|
} else {
|
||||||
vehicleKillCountOpfor++;
|
vehicleKillCountOpfor++;
|
||||||
}
|
}
|
||||||
if (this.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) {
|
if (FractionStatsComponent.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) {
|
||||||
this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor));
|
this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor));
|
||||||
this.tmpVehicleData[1].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountOpfor));
|
this.tmpVehicleData[1].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountOpfor));
|
||||||
}
|
}
|
||||||
|
@ -295,7 +294,7 @@ export class FractionStatsComponent {
|
||||||
} else {
|
} else {
|
||||||
transportCountOpfor++;
|
transportCountOpfor++;
|
||||||
}
|
}
|
||||||
if (this.isTwoMinutesAhead(transportEntryDate, this.tmpTransportData) || index === this.logData.transport.length - 1) {
|
if (FractionStatsComponent.isTwoMinutesAhead(transportEntryDate, this.tmpTransportData) || index === this.logData.transport.length - 1) {
|
||||||
this.tmpTransportData[0].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountBlufor));
|
this.tmpTransportData[0].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountBlufor));
|
||||||
this.tmpTransportData[1].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountOpfor));
|
this.tmpTransportData[1].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountOpfor));
|
||||||
}
|
}
|
||||||
|
@ -321,15 +320,15 @@ export class FractionStatsComponent {
|
||||||
}
|
}
|
||||||
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push(
|
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push(
|
||||||
ChartUtils.getSeriesEntry(new Date(flagEntry.time), flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor)
|
ChartUtils.getSeriesEntry(new Date(flagEntry.time), flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor)
|
||||||
)
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addFinalTimeData(this.tmpFlagCaptureData);
|
this.addFinalTimeData(this.tmpFlagCaptureData);
|
||||||
this.initialized.flag = true;
|
this.initialized.flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
|
protected static isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
|
||||||
return entryDate.getTime() >= tmpData[0].series[tmpData[0].series.length - 1].name.getTime() + (1.5 * 60000)
|
return entryDate.getTime() >= tmpData[0].series[tmpData[0].series.length - 1].name.getTime() + (1.5 * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeTempCollections() {
|
initializeTempCollections() {
|
||||||
|
@ -346,7 +345,7 @@ export class FractionStatsComponent {
|
||||||
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpVehicleData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
|
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpVehicleData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
|
||||||
[0, 1].forEach(index => {
|
[0, 1].forEach(index => {
|
||||||
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
|
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetBlufor));
|
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetBlufor));
|
||||||
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetOpfor));
|
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetOpfor));
|
||||||
|
@ -358,7 +357,7 @@ export class FractionStatsComponent {
|
||||||
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetBlufor));
|
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetBlufor));
|
||||||
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor));
|
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor));
|
||||||
} else {
|
} else {
|
||||||
for (let j in [0, 1]) {
|
for (const j in [0, 1]) {
|
||||||
if (tmpCollection[j].series[tmpCollection[j].series.length - 1].name < endDate) {
|
if (tmpCollection[j].series[tmpCollection[j].series.length - 1].name < endDate) {
|
||||||
tmpCollection[j].series.push(ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value));
|
tmpCollection[j].series.push(ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
import {Component, ElementRef, EventEmitter, SimpleChanges} from "@angular/core";
|
import {Component, ElementRef, EventEmitter, Input, Output, SimpleChanges} from '@angular/core';
|
||||||
import {War} from "../../../models/model-interfaces";
|
import {War} from '../../../models/model-interfaces';
|
||||||
import {Fraction} from "../../../utils/fraction.enum";
|
import {Fraction} from '../../../utils/fraction.enum';
|
||||||
import {PlayerUtils} from "../../../utils/player-utils";
|
import {PlayerUtils} from '../../../utils/player-utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'scoreboard',
|
selector: 'scoreboard',
|
||||||
templateUrl: './scoreboard.component.html',
|
templateUrl: './scoreboard.component.html',
|
||||||
inputs: ['war', 'fractionFilterSelected'],
|
|
||||||
outputs: ['playerTabSwitch'],
|
|
||||||
styleUrls: ['./scoreboard.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
styleUrls: ['./scoreboard.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
|
||||||
})
|
})
|
||||||
export class ScoreboardComponent {
|
export class ScoreboardComponent {
|
||||||
|
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
playerTabSwitch = new EventEmitter();
|
@Input() war: War;
|
||||||
|
|
||||||
war: War;
|
@Input() fractionFilterSelected: string;
|
||||||
|
|
||||||
|
@Output() playerTabSwitch = new EventEmitter();
|
||||||
|
|
||||||
isSteamUUID = PlayerUtils.isSteamUUID;
|
isSteamUUID = PlayerUtils.isSteamUUID;
|
||||||
|
|
||||||
fractionFilterSelected: string;
|
|
||||||
|
|
||||||
cellHeight = 40;
|
cellHeight = 40;
|
||||||
|
|
||||||
rows = [];
|
rows = [];
|
||||||
|
@ -40,7 +38,7 @@ export class ScoreboardComponent {
|
||||||
this.playerTabSwitch.emit({
|
this.playerTabSwitch.emit({
|
||||||
view: view,
|
view: view,
|
||||||
player: player
|
player: player
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
@ -51,7 +49,7 @@ export class ScoreboardComponent {
|
||||||
.scrollTo(0, 0);
|
.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
if (changes.fractionFilterSelected) {
|
if (changes.fractionFilterSelected) {
|
||||||
this.filterPlayersByFraction(this.fractionFilterSelected)
|
this.filterPlayersByFraction(this.fractionFilterSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ export class ScoreboardComponent {
|
||||||
if (fraction) {
|
if (fraction) {
|
||||||
this.rows = this.war.players.filter((player) => {
|
this.rows = this.war.players.filter((player) => {
|
||||||
return player.fraction === fraction;
|
return player.fraction === fraction;
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.rows = this.war.players;
|
this.rows = this.war.players;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from '@angular/core';
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {WarService} from "../../services/logs/war.service";
|
import {WarService} from '../../services/logs/war.service';
|
||||||
import {War} from "../../models/model-interfaces";
|
import {War} from '../../models/model-interfaces';
|
||||||
import {ChartUtils} from "../../utils/chart-utils";
|
import {ChartUtils} from '../../utils/chart-utils';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
import {LogsService} from "../../services/logs/logs.service";
|
import {LogsService} from '../../services/logs/logs.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -44,7 +44,7 @@ export class WarDetailComponent {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params
|
this.route.params
|
||||||
.map(params => params['id'])
|
.map(params => params['id'])
|
||||||
.filter(id => id != undefined)
|
.filter(id => id !== undefined)
|
||||||
.flatMap(id => this.warService.getWar(id))
|
.flatMap(id => this.warService.getWar(id))
|
||||||
.subscribe(war => {
|
.subscribe(war => {
|
||||||
this.war = war;
|
this.war = war;
|
||||||
|
@ -55,7 +55,7 @@ export class WarDetailComponent {
|
||||||
|
|
||||||
this.playerChart = ChartUtils.getSingleDataArray(Fraction.OPFOR, war.playersOpfor, Fraction.BLUFOR, war.playersBlufor);
|
this.playerChart = ChartUtils.getSingleDataArray(Fraction.OPFOR, war.playersOpfor, Fraction.BLUFOR, war.playersBlufor);
|
||||||
Object.assign(this, [this.playerChart]);
|
Object.assign(this, [this.playerChart]);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
switchTab(index: number) {
|
switchTab(index: number) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
|
||||||
import {War} from "../../models/model-interfaces";
|
import {War} from '../../models/model-interfaces';
|
||||||
import {LoginService} from "../../services/app-user-service/login-service";
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pjm-war-item',
|
selector: 'pjm-war-item',
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Campaign, War} from "../../models/model-interfaces";
|
import {Campaign, War} from '../../models/model-interfaces';
|
||||||
import {WarService} from "../../services/logs/war.service";
|
import {WarService} from '../../services/logs/war.service';
|
||||||
import {LoginService} from "../../services/app-user-service/login-service";
|
import {LoginService} from '../../services/app-user-service/login-service';
|
||||||
import {CampaignService} from "../../services/logs/campaign.service";
|
import {CampaignService} from '../../services/logs/campaign.service';
|
||||||
import {RouteConfig} from "../../app.config";
|
import {RouteConfig} from '../../app.config';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'war-list',
|
selector: 'war-list',
|
||||||
|
@ -37,9 +37,9 @@ export class WarListComponent implements OnInit {
|
||||||
if (url.endsWith(RouteConfig.statsPath)) {
|
if (url.endsWith(RouteConfig.statsPath)) {
|
||||||
this.selectOverview(this.campaigns[0]._id);
|
this.selectOverview(this.campaigns[0]._id);
|
||||||
} else if (url.indexOf(subPathWar) !== -1) {
|
} else if (url.indexOf(subPathWar) !== -1) {
|
||||||
this.selectedWarId = url.substring(url.lastIndexOf(subPathWar) + subPathWar.length, url.lastIndexOf(")"));
|
this.selectedWarId = url.substring(url.lastIndexOf(subPathWar) + subPathWar.length, url.lastIndexOf(')'));
|
||||||
} else if (url.indexOf(subPathOverview) !== -1) {
|
} else if (url.indexOf(subPathOverview) !== -1) {
|
||||||
this.selectedWarId = url.substring(url.lastIndexOf(subPathOverview) + subPathOverview.length, url.lastIndexOf(")"));
|
this.selectedWarId = url.substring(url.lastIndexOf(subPathOverview) + subPathOverview.length, url.lastIndexOf(')'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -55,21 +55,21 @@ export class WarListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
selectWar(warId) {
|
selectWar(warId) {
|
||||||
if (this.selectedWarId != warId) {
|
if (this.selectedWarId !== warId) {
|
||||||
this.selectedWarId = warId;
|
this.selectedWarId = warId;
|
||||||
this.router.navigate([{outlets: {'right': ['war', warId]}}], {relativeTo: this.route});
|
this.router.navigate([{outlets: {'right': ['war', warId]}}], {relativeTo: this.route});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectOverview(campaignId) {
|
selectOverview(campaignId) {
|
||||||
if (this.selectedWarId != campaignId) {
|
if (this.selectedWarId !== campaignId) {
|
||||||
this.selectedWarId = campaignId;
|
this.selectedWarId = campaignId;
|
||||||
this.router.navigate([{outlets: {'right': ['overview', campaignId]}}], {relativeTo: this.route});
|
this.router.navigate([{outlets: {'right': ['overview', campaignId]}}], {relativeTo: this.route});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectHighscore(campaignId) {
|
selectHighscore(campaignId) {
|
||||||
if (this.selectedWarId != campaignId + this.highscore) {
|
if (this.selectedWarId !== campaignId + this.highscore) {
|
||||||
this.selectedWarId = campaignId + this.highscore;
|
this.selectedWarId = campaignId + this.highscore;
|
||||||
this.router.navigate([{outlets: {'right': ['highscore', campaignId]}}], {relativeTo: this.route});
|
this.router.navigate([{outlets: {'right': ['highscore', campaignId]}}], {relativeTo: this.route});
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ export class WarListComponent implements OnInit {
|
||||||
this.selectOverview('all');
|
this.selectOverview('all');
|
||||||
}
|
}
|
||||||
this.campaigns.splice(this.campaigns.indexOf(war), 1);
|
this.campaigns.splice(this.campaigns.indexOf(war), 1);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ export class WarListComponent implements OnInit {
|
||||||
this.selectOverview('all');
|
this.selectOverview('all');
|
||||||
}
|
}
|
||||||
this.campaigns.splice(this.campaigns.indexOf(campaign), 1);
|
this.campaigns.splice(this.campaigns.indexOf(campaign), 1);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {WarService} from "../../services/logs/war.service";
|
import {WarService} from '../../services/logs/war.service';
|
||||||
import {War} from "../../models/model-interfaces";
|
import {War} from '../../models/model-interfaces';
|
||||||
import {CampaignService} from "../../services/logs/campaign.service";
|
import {CampaignService} from '../../services/logs/campaign.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Award, Decoration} from "../../models/model-interfaces";
|
import {Award, Decoration} from '../../models/model-interfaces';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {AwardingService} from "../../services/army-management/awarding.service";
|
import {AwardingService} from '../../services/army-management/awarding.service';
|
||||||
import {DecorationService} from "../../services/army-management/decoration.service";
|
import {DecorationService} from '../../services/army-management/decoration.service';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -48,7 +48,7 @@ export class AwardUserComponent {
|
||||||
|
|
||||||
this.route.params
|
this.route.params
|
||||||
.map(params => params['id'])
|
.map(params => params['id'])
|
||||||
.subscribe(id => this.userId = id)
|
.subscribe(id => this.userId = id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ export class AwardUserComponent {
|
||||||
const reason = reasonField.value;
|
const reason = reasonField.value;
|
||||||
if (decorationId && reason.length > 0) {
|
if (decorationId && reason.length > 0) {
|
||||||
const award = {
|
const award = {
|
||||||
"userId": this.userId,
|
'userId': this.userId,
|
||||||
"decorationId": decorationId,
|
'decorationId': decorationId,
|
||||||
"reason": reason,
|
'reason': reason,
|
||||||
"date": Date.now()
|
'date': Date.now()
|
||||||
};
|
};
|
||||||
this.awardingService.addAwarding(award).subscribe(() => {
|
this.awardingService.addAwarding(award).subscribe(() => {
|
||||||
this.awardingService.getUserAwardings(this.userId)
|
this.awardingService.getUserAwardings(this.userId)
|
||||||
|
@ -87,9 +87,9 @@ export class AwardUserComponent {
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000)
|
}, 2000);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ export class AwardUserComponent {
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000)
|
}, 2000);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {Component, ViewChild} from "@angular/core";
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Rank, Squad, User} from "../../models/model-interfaces";
|
import {Rank, Squad, User} from '../../models/model-interfaces';
|
||||||
import {UserService} from "../../services/army-management/user.service";
|
import {UserService} from '../../services/army-management/user.service';
|
||||||
import {SquadService} from "../../services/army-management/squad.service";
|
import {SquadService} from '../../services/army-management/squad.service';
|
||||||
import {RankService} from "../../services/army-management/rank.service";
|
import {RankService} from '../../services/army-management/rank.service';
|
||||||
import {Subscription} from "rxjs";
|
import {Subscription} from 'rxjs';
|
||||||
import {NgForm} from "@angular/forms";
|
import {NgForm} from '@angular/forms';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -46,11 +46,11 @@ export class EditUserComponent {
|
||||||
|
|
||||||
this.subscription = this.route.params
|
this.subscription = this.route.params
|
||||||
.map(params => params['id'])
|
.map(params => params['id'])
|
||||||
.filter(id => id != undefined)
|
.filter(id => id !== undefined)
|
||||||
.flatMap(id => this.userService.getUser(id))
|
.flatMap(id => this.userService.getUser(id))
|
||||||
.subscribe(user => {
|
.subscribe(user => {
|
||||||
if (!user.squadId) {
|
if (!user.squadId) {
|
||||||
user.squadId = "0";
|
user.squadId = '0';
|
||||||
this.ranksDisplay = 'none';
|
this.ranksDisplay = 'none';
|
||||||
} else {
|
} else {
|
||||||
this.rankService.findRanks('', user.squadId.fraction).subscribe(ranks => {
|
this.rankService.findRanks('', user.squadId.fraction).subscribe(ranks => {
|
||||||
|
@ -67,7 +67,7 @@ export class EditUserComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleRanks() {
|
toggleRanks() {
|
||||||
if (this.user.squadId != '0') {
|
if (this.user.squadId !== '0') {
|
||||||
this.rankService.findRanks('', this.user.squadId.fraction).subscribe(
|
this.rankService.findRanks('', this.user.squadId.fraction).subscribe(
|
||||||
ranks => {
|
ranks => {
|
||||||
this.ranks = ranks;
|
this.ranks = ranks;
|
||||||
|
@ -87,7 +87,7 @@ export class EditUserComponent {
|
||||||
squadId: null
|
squadId: null
|
||||||
};
|
};
|
||||||
if (this.user.squadId._id !== '0') {
|
if (this.user.squadId._id !== '0') {
|
||||||
updateObject.squadId = this.user.squadId._id
|
updateObject.squadId = this.user.squadId._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.user._id) {
|
if (this.user._id) {
|
||||||
|
@ -100,8 +100,8 @@ export class EditUserComponent {
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
}, 2000)
|
}, 2000);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.userService.submitUser(updateObject)
|
this.userService.submitUser(updateObject)
|
||||||
.subscribe(user => {
|
.subscribe(user => {
|
||||||
|
@ -111,13 +111,13 @@ export class EditUserComponent {
|
||||||
error => {
|
error => {
|
||||||
// duplicated user error message
|
// duplicated user error message
|
||||||
if (error._body.includes('duplicate')) {
|
if (error._body.includes('duplicate')) {
|
||||||
this.error = "Benutzername existiert bereits";
|
this.error = 'Benutzername existiert bereits';
|
||||||
this.showErrorLabel = true;
|
this.showErrorLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showErrorLabel = false;
|
this.showErrorLabel = false;
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
|
import {ChangeDetectionStrategy, Component, EventEmitter, Input, Output} from '@angular/core';
|
||||||
import {User} from "../../models/model-interfaces";
|
import {User} from '../../models/model-interfaces';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pjm-user-item',
|
selector: 'pjm-user-item',
|
||||||
templateUrl: './user-item.component.html',
|
templateUrl: './user-item.component.html',
|
||||||
styleUrls: ['./user-item.component.css', '../../style/list-entry.css'],
|
styleUrls: ['./user-item.component.css', '../../style/list-entry.css'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
inputs: ['user', 'selected'],
|
|
||||||
outputs: ['userSelected', 'userAward', 'userDelete']
|
|
||||||
})
|
})
|
||||||
export class UserItemComponent {
|
export class UserItemComponent {
|
||||||
|
|
||||||
selected: boolean;
|
@Input() user: User;
|
||||||
user: User;
|
|
||||||
|
|
||||||
userSelected = new EventEmitter();
|
@Input() selected: boolean;
|
||||||
userAward = new EventEmitter();
|
|
||||||
userDelete = new EventEmitter();
|
@Output() userSelected = new EventEmitter();
|
||||||
|
@Output() userAward = new EventEmitter();
|
||||||
|
@Output() userDelete = new EventEmitter();
|
||||||
|
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
|
@ -25,11 +24,11 @@ export class UserItemComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
this.userSelected.emit(this.user._id)
|
this.userSelected.emit(this.user._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
award() {
|
award() {
|
||||||
this.userAward.emit(this.user._id)
|
this.userAward.emit(this.user._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {Component, OnInit} from "@angular/core";
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Location} from "@angular/common";
|
import {Location} from '@angular/common';
|
||||||
|
|
||||||
import {FormControl} from "@angular/forms";
|
import {FormControl} from '@angular/forms';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {UserService} from "../../services/army-management/user.service";
|
import {UserService} from '../../services/army-management/user.service';
|
||||||
import {User} from "../../models/model-interfaces";
|
import {User} from '../../models/model-interfaces';
|
||||||
import {ADD, LOAD} from "../../services/stores/user.store";
|
import {ADD, LOAD} from '../../services/stores/user.store';
|
||||||
import {Fraction} from "../../utils/fraction.enum";
|
import {Fraction} from '../../utils/fraction.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'squad-list',
|
selector: 'squad-list',
|
||||||
|
@ -77,7 +77,7 @@ export class UserListComponent implements OnInit {
|
||||||
if (confirm('Soll der Teilnehmer "' + user.username + '" wirklich gelöscht werden?')) {
|
if (confirm('Soll der Teilnehmer "' + user.username + '" wirklich gelöscht werden?')) {
|
||||||
this.userService.deleteUser(user)
|
this.userService.deleteUser(user)
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ export class UserListComponent implements OnInit {
|
||||||
if (this.offset + this.limit > this.userService.totalCount) {
|
if (this.offset + this.limit > this.userService.totalCount) {
|
||||||
this.limit = this.userService.totalCount - this.offset;
|
this.limit = this.userService.totalCount - this.offset;
|
||||||
}
|
}
|
||||||
if (this.limit != 0) {
|
if (this.limit !== 0) {
|
||||||
this.offset += this.limit;
|
this.offset += this.limit;
|
||||||
this.filterUsers(ADD);
|
this.filterUsers(ADD);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ export class UserListComponent implements OnInit {
|
||||||
|
|
||||||
adjustBrowserUrl(queryString = '') {
|
adjustBrowserUrl(queryString = '') {
|
||||||
const absoluteUrl = this.location.path().split('?')[0];
|
const absoluteUrl = this.location.path().split('?')[0];
|
||||||
const queryPart = queryString !== '' ? `query=${queryString}` : '';
|
const queryPart = queryString !== '' ? 'query=${queryString}' : '';
|
||||||
|
|
||||||
this.location.replaceState(absoluteUrl, queryPart);
|
this.location.replaceState(absoluteUrl, queryPart);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {usersRouterModule, usersRoutingComponents} from './users.routing';
|
import {usersRouterModule, usersRoutingComponents} from './users.routing';
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from '@angular/common';
|
||||||
import {SharedModule} from "../shared.module";
|
import {SharedModule} from '../shared.module';
|
||||||
import {ButtonsModule} from "ngx-bootstrap";
|
import {ButtonsModule} from 'ngx-bootstrap';
|
||||||
import {InfiniteScrollModule} from "ngx-infinite-scroll";
|
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: usersRoutingComponents,
|
declarations: usersRoutingComponents,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {RouterModule, Routes} from "@angular/router";
|
import {RouterModule, Routes} from '@angular/router';
|
||||||
import {UsersComponent} from "./users.component";
|
import {UsersComponent} from './users.component';
|
||||||
import {EditUserComponent} from "./edit-user/edit-user.component";
|
import {EditUserComponent} from './edit-user/edit-user.component';
|
||||||
import {UserListComponent} from "./user-list/user-list.component";
|
import {UserListComponent} from './user-list/user-list.component';
|
||||||
import {AwardUserComponent} from "./award-user/award-user.component";
|
import {AwardUserComponent} from './award-user/award-user.component';
|
||||||
import {ModuleWithProviders} from "@angular/core";
|
import {ModuleWithProviders} from '@angular/core';
|
||||||
import {UserItemComponent} from "./user-list/user-item.component";
|
import {UserItemComponent} from './user-list/user-item.component';
|
||||||
|
|
||||||
export const usersRoutes: Routes = [{
|
export const usersRoutes: Routes = [{
|
||||||
path: '', component: UsersComponent,
|
path: '', component: UsersComponent,
|
||||||
|
|
|
@ -3,14 +3,14 @@ export class ChartUtils {
|
||||||
public static getShortDateString(date): string {
|
public static getShortDateString(date): string {
|
||||||
const isoDate = date.slice(0, 10);
|
const isoDate = date.slice(0, 10);
|
||||||
const dayDate = parseInt(isoDate.slice(8, 10));
|
const dayDate = parseInt(isoDate.slice(8, 10));
|
||||||
return (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
|
return (dayDate < 10 ? '0' + dayDate : dayDate) + '.'
|
||||||
+ isoDate.slice(5, 7) + '.' + isoDate.slice(2, 4);
|
+ isoDate.slice(5, 7) + '.' + isoDate.slice(2, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSeriesEntry(name, value) {
|
public static getSeriesEntry(name, value) {
|
||||||
return {
|
return {
|
||||||
"name": name,
|
'name': name,
|
||||||
"value": value
|
'value': value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ export class ChartUtils {
|
||||||
const obj = [];
|
const obj = [];
|
||||||
for (let i = 0, arg; arg = args[i]; i++) {
|
for (let i = 0, arg; arg = args[i]; i++) {
|
||||||
obj.push({
|
obj.push({
|
||||||
"name": arg,
|
'name': arg,
|
||||||
"series": []
|
'series': []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -27,11 +27,11 @@ export class ChartUtils {
|
||||||
|
|
||||||
public static getSingleDataArray(name1, value1, name2, value2): any[] {
|
public static getSingleDataArray(name1, value1, name2, value2): any[] {
|
||||||
return [{
|
return [{
|
||||||
"name": name1,
|
'name': name1,
|
||||||
"value": value1
|
'value': value1
|
||||||
}, {
|
}, {
|
||||||
"name": name2,
|
'name': name2,
|
||||||
"value": value2
|
'value': value2
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue