From b266d6f972f51c8ab2411d6e513227a1f0b8dac1 Mon Sep 17 00:00:00 2001 From: HardiReady Date: Sun, 22 Oct 2017 18:06:37 +0200 Subject: [PATCH] Add LogsService --- api/routes/logs.js | 11 +-- static/src/app/admin/admin.component.ts | 2 +- static/src/app/app.component.ts | 6 +- static/src/app/app.config.ts | 17 +++-- static/src/app/app.module.ts | 14 ++-- static/src/app/army/army-member.component.ts | 4 +- .../decoration-list.component.ts | 2 +- .../src/app/decorations/decoration.module.ts | 2 +- .../edit-decoration.component.ts | 2 +- static/src/app/login/login.component.ts | 2 +- static/src/app/login/login.guard.ts | 2 +- static/src/app/login/signup.component.ts | 2 +- .../ranks/edit-rank/edit-rank.component.ts | 2 +- .../ranks/rank-list/rank-list.component.ts | 2 +- static/src/app/ranks/ranks.module.ts | 2 +- .../app/request/award/req-award.component.ts | 8 +- .../confirm-award/confirm-award.component.ts | 4 +- .../confirm-promotion.component.ts | 6 +- .../promotion/req-promotion.component.ts | 8 +- .../login-service.ts | 4 +- .../awarding.service.ts | 0 .../decoration.service.ts | 0 .../promotion.service.ts | 0 .../rank.service.ts | 0 .../squad.service.ts | 0 .../user.service.ts | 0 .../campaign.service.ts | 0 static/src/app/services/logs/logs.service.ts | 76 +++++++++++++++++++ .../player.service.ts | 0 .../{war-service => logs}/war.service.ts | 0 .../squads/edit-squad/edit-squad.component.ts | 2 +- .../squads/squad-list/squad-list.component.ts | 2 +- static/src/app/squads/squads.module.ts | 2 +- .../campaign-player-detail.component.ts | 2 +- .../campaign-submit.component.ts | 2 +- .../overview/stats-overview.component.ts | 2 +- static/src/app/statistic/stats.module.ts | 9 ++- .../war-detail/war-detail.component.ts | 6 +- .../statistic/war-list/war-item.component.ts | 2 +- .../statistic/war-list/war-list.component.ts | 6 +- .../war-submit/war-submit.component.ts | 4 +- .../users/award-user/award-user.component.ts | 4 +- .../users/edit-user/edit-user.component.ts | 6 +- .../users/user-list/user-list.component.ts | 2 +- 44 files changed, 152 insertions(+), 77 deletions(-) rename static/src/app/services/{login-service => app-user-service}/login-service.ts (92%) rename static/src/app/services/{awarding-service => army-management}/awarding.service.ts (100%) rename static/src/app/services/{decoration-service => army-management}/decoration.service.ts (100%) rename static/src/app/services/{promotion-service => army-management}/promotion.service.ts (100%) rename static/src/app/services/{rank-service => army-management}/rank.service.ts (100%) rename static/src/app/services/{squad-service => army-management}/squad.service.ts (100%) rename static/src/app/services/{user-service => army-management}/user.service.ts (100%) rename static/src/app/services/{campaign-service => logs}/campaign.service.ts (100%) create mode 100644 static/src/app/services/logs/logs.service.ts rename static/src/app/services/{player-service => logs}/player.service.ts (100%) rename static/src/app/services/{war-service => logs}/war.service.ts (100%) diff --git a/api/routes/logs.js b/api/routes/logs.js index 2a1e4eb..18913ed 100644 --- a/api/routes/logs.js +++ b/api/routes/logs.js @@ -2,10 +2,7 @@ // modules const express = require('express'); -const logger = require('debug')('cc:wars'); - -// HTTP status codes by name -const codes = require('./http-codes'); +const logger = require('debug')('cc:logs'); const routerHandling = require('../middleware/router-handling'); @@ -18,16 +15,14 @@ const LogTransportModel = require('../models/logs/transport'); const LogFlagModel = require('../models/logs/flag'); const LogPointsModel = require('../models/logs/points'); -const notFoundError = new Error('No logs found'); - const logsRouter = express.Router(); function processLogRequest(model, filter, res, next) { model.find(filter, {}, {sort: {time: 1}}, (err, log) => { if (err) return next(err); if (!log || log.length === 0) { - const err = notFoundError; - err.status = codes.notfound; + const err = new Error('No logs found'); + err.status = require('./http-codes').notfound; return next(err) } res.locals.items = log; diff --git a/static/src/app/admin/admin.component.ts b/static/src/app/admin/admin.component.ts index 87674bf..999ffeb 100644 --- a/static/src/app/admin/admin.component.ts +++ b/static/src/app/admin/admin.component.ts @@ -2,7 +2,7 @@ import {Component} from "@angular/core"; import {AppUser, Squad} from "../models/model-interfaces"; import {Observable} from "rxjs/Observable"; import {AppUserService} from "../services/app-user-service/app-user.service"; -import {SquadService} from "../services/squad-service/squad.service"; +import {SquadService} from "../services/army-management/squad.service"; @Component({ diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts index 51736c3..21105b0 100644 --- a/static/src/app/app.component.ts +++ b/static/src/app/app.component.ts @@ -1,8 +1,8 @@ import {Component} from '@angular/core'; import {NavigationEnd, NavigationStart, Router} from '@angular/router'; -import {LoginService} from './services/login-service/login-service'; -import {PromotionService} from "./services/promotion-service/promotion.service"; -import {AwardingService} from "./services/awarding-service/awarding.service"; +import {LoginService} from './services/app-user-service/login-service'; +import {PromotionService} from "./services/army-management/promotion.service"; +import {AwardingService} from "./services/army-management/awarding.service"; import {RouteConfig} from "./app.config"; declare function require(url: string); diff --git a/static/src/app/app.config.ts b/static/src/app/app.config.ts index ad97dbe..7187683 100644 --- a/static/src/app/app.config.ts +++ b/static/src/app/app.config.ts @@ -3,19 +3,20 @@ export class AppConfig { public readonly apiUrl = '/api'; public readonly apiAppUserPath = this.apiUrl + '/account/'; - public readonly apiAwardPath = this.apiUrl + '/awardings'; - public readonly apiDecorationPath = this.apiUrl + '/decorations/'; public readonly apiAuthenticationPath = this.apiUrl + '/authenticate'; - public readonly apiSignupPath = this.apiUrl + '/authenticate/signup'; - public readonly apiRankPath = this.apiUrl + '/ranks/'; - public readonly apiSquadPath = this.apiUrl + '/squads/'; - public readonly apiUserPath = this.apiUrl + '/users/'; + public readonly apiAwardPath = this.apiUrl + '/awardings'; + public readonly apiCampaignPath = this.apiUrl + '/campaigns'; + public readonly apiDecorationPath = this.apiUrl + '/decorations/'; + public readonly apiLogsPath = this.apiUrl + '/logs'; public readonly apiOverviewPath = this.apiUrl + '/overview'; public readonly apiPlayersPath = this.apiUrl + '/players'; - public readonly apiRequestAwardPath = this.apiUrl + '/request/award'; public readonly apiPromotionPath = this.apiUrl + '/request/promotion'; + public readonly apiRankPath = this.apiUrl + '/ranks/'; + public readonly apiRequestAwardPath = this.apiUrl + '/request/award'; + public readonly apiSignupPath = this.apiUrl + '/authenticate/signup'; + public readonly apiSquadPath = this.apiUrl + '/squads/'; + public readonly apiUserPath = this.apiUrl + '/users/'; public readonly apiWarPath = this.apiUrl + '/wars'; - public readonly apiCampaignPath = this.apiUrl + '/campaigns'; } diff --git a/static/src/app/app.module.ts b/static/src/app/app.module.ts index bd133ba..936c413 100644 --- a/static/src/app/app.module.ts +++ b/static/src/app/app.module.ts @@ -2,24 +2,24 @@ import {NgModule} from '@angular/core'; import {BrowserModule} from "@angular/platform-browser"; import {HttpModule} from '@angular/http'; import {AppComponent} from './app.component'; -import {LoginService} from "./services/login-service/login-service"; +import {LoginService} from "./services/app-user-service/login-service"; import {appRouting, routingComponents, routingProviders} from './app.routing'; -import {SquadService} from "./services/squad-service/squad.service"; +import {SquadService} from "./services/army-management/squad.service"; import {SquadStore} from "./services/stores/squad.store"; import {DecorationStore} from "./services/stores/decoration.store"; -import {DecorationService} from "./services/decoration-service/decoration.service"; +import {DecorationService} from "./services/army-management/decoration.service"; import {RankStore} from "./services/stores/rank.store"; -import {RankService} from "./services/rank-service/rank.service"; +import {RankService} from "./services/army-management/rank.service"; import {AppConfig} from "./app.config"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard"; -import {AwardingService} from "./services/awarding-service/awarding.service"; +import {AwardingService} from "./services/army-management/awarding.service"; import {HttpClient} from "./services/http-client"; import {ArmyService} from "./services/army-service/army.service"; import {ClipboardModule} from 'ngx-clipboard'; -import {PromotionService} from "./services/promotion-service/promotion.service"; +import {PromotionService} from "./services/army-management/promotion.service"; import {SharedModule} from "./shared.module"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; -import {UserService} from "./services/user-service/user.service"; +import {UserService} from "./services/army-management/user.service"; import {UserStore} from "./services/stores/user.store"; import {CookieService} from "ngx-cookie-service"; diff --git a/static/src/app/army/army-member.component.ts b/static/src/app/army/army-member.component.ts index 84937ed..76c938a 100644 --- a/static/src/app/army/army-member.component.ts +++ b/static/src/app/army/army-member.component.ts @@ -1,10 +1,10 @@ import {Component} from "@angular/core"; import {Award, User} from "../models/model-interfaces"; import {ActivatedRoute, Router} from "@angular/router"; -import {UserService} from "../services/user-service/user.service"; +import {UserService} from "../services/army-management/user.service"; import {Subscription} from "rxjs/Subscription"; import {RouteConfig} from "../app.config"; -import {AwardingService} from "../services/awarding-service/awarding.service"; +import {AwardingService} from "../services/army-management/awarding.service"; @Component({ diff --git a/static/src/app/decorations/decoration-list/decoration-list.component.ts b/static/src/app/decorations/decoration-list/decoration-list.component.ts index 0578845..83448fe 100644 --- a/static/src/app/decorations/decoration-list/decoration-list.component.ts +++ b/static/src/app/decorations/decoration-list/decoration-list.component.ts @@ -5,7 +5,7 @@ import {FormControl} from "@angular/forms"; import {ActivatedRoute, Router} from "@angular/router"; import {Observable} from "rxjs/Observable"; import {Decoration} from "../../models/model-interfaces"; -import {DecorationService} from "../../services/decoration-service/decoration.service"; +import {DecorationService} from "../../services/army-management/decoration.service"; @Component({ selector: 'decoration-list', diff --git a/static/src/app/decorations/decoration.module.ts b/static/src/app/decorations/decoration.module.ts index 2e5b5f4..91f2c58 100644 --- a/static/src/app/decorations/decoration.module.ts +++ b/static/src/app/decorations/decoration.module.ts @@ -2,7 +2,7 @@ import {decorationRoutesModule, decorationsRoutingComponents} from "./decoration import {SharedModule} from "../shared.module"; import {CommonModule} from "@angular/common"; import {DecorationStore} from "../services/stores/decoration.store"; -import {DecorationService} from "../services/decoration-service/decoration.service"; +import {DecorationService} from "../services/army-management/decoration.service"; import {NgModule} from "@angular/core"; import {ButtonsModule} from "ngx-bootstrap"; diff --git a/static/src/app/decorations/edit-decoration/edit-decoration.component.ts b/static/src/app/decorations/edit-decoration/edit-decoration.component.ts index a41c590..e7ed88c 100644 --- a/static/src/app/decorations/edit-decoration/edit-decoration.component.ts +++ b/static/src/app/decorations/edit-decoration/edit-decoration.component.ts @@ -2,7 +2,7 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {NgForm} from "@angular/forms"; import {Decoration} from "../../models/model-interfaces"; -import {DecorationService} from "../../services/decoration-service/decoration.service"; +import {DecorationService} from "../../services/army-management/decoration.service"; import {Subscription} from "rxjs/Subscription"; @Component({ diff --git a/static/src/app/login/login.component.ts b/static/src/app/login/login.component.ts index 3510135..f6fb1f8 100644 --- a/static/src/app/login/login.component.ts +++ b/static/src/app/login/login.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from "@angular/core"; import {Router} from "@angular/router"; -import {LoginService} from "../services/login-service/login-service"; +import {LoginService} from "../services/app-user-service/login-service"; import {RouteConfig} from "../app.config"; diff --git a/static/src/app/login/login.guard.ts b/static/src/app/login/login.guard.ts index f4985f4..95a5b25 100644 --- a/static/src/app/login/login.guard.ts +++ b/static/src/app/login/login.guard.ts @@ -1,6 +1,6 @@ import {Injectable} from '@angular/core'; import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router'; -import {LoginService} from "../services/login-service/login-service"; +import {LoginService} from "../services/app-user-service/login-service"; @Injectable() export class LoginGuardSQL implements CanActivate { diff --git a/static/src/app/login/signup.component.ts b/static/src/app/login/signup.component.ts index 22e9531..267c98c 100644 --- a/static/src/app/login/signup.component.ts +++ b/static/src/app/login/signup.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; -import {LoginService} from "../services/login-service/login-service"; +import {LoginService} from "../services/app-user-service/login-service"; import {RouteConfig} from "../app.config"; diff --git a/static/src/app/ranks/edit-rank/edit-rank.component.ts b/static/src/app/ranks/edit-rank/edit-rank.component.ts index 2aebc98..67fd866 100644 --- a/static/src/app/ranks/edit-rank/edit-rank.component.ts +++ b/static/src/app/ranks/edit-rank/edit-rank.component.ts @@ -2,7 +2,7 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {NgForm} from "@angular/forms"; import {Rank} from "../../models/model-interfaces"; -import {RankService} from "../../services/rank-service/rank.service"; +import {RankService} from "../../services/army-management/rank.service"; import {Subscription} from "rxjs/Subscription"; diff --git a/static/src/app/ranks/rank-list/rank-list.component.ts b/static/src/app/ranks/rank-list/rank-list.component.ts index 8d2a299..807720f 100644 --- a/static/src/app/ranks/rank-list/rank-list.component.ts +++ b/static/src/app/ranks/rank-list/rank-list.component.ts @@ -5,7 +5,7 @@ import {FormControl} from "@angular/forms"; import {ActivatedRoute, Router} from "@angular/router"; import {Observable} from "rxjs/Observable"; import {Rank} from "../../models/model-interfaces"; -import {RankService} from "../../services/rank-service/rank.service"; +import {RankService} from "../../services/army-management/rank.service"; @Component({ selector: 'rank-list', diff --git a/static/src/app/ranks/ranks.module.ts b/static/src/app/ranks/ranks.module.ts index 5b34d04..ef23247 100644 --- a/static/src/app/ranks/ranks.module.ts +++ b/static/src/app/ranks/ranks.module.ts @@ -2,7 +2,7 @@ import {NgModule} from "@angular/core"; import {rankRouterModule, ranksRoutingComponents} from "./ranks.routing"; import {SharedModule} from "../shared.module"; import {CommonModule} from "@angular/common"; -import {RankService} from "../services/rank-service/rank.service"; +import {RankService} from "../services/army-management/rank.service"; import {RankStore} from "../services/stores/rank.store"; import {ButtonsModule} from "ngx-bootstrap"; diff --git a/static/src/app/request/award/req-award.component.ts b/static/src/app/request/award/req-award.component.ts index befcdb0..149e165 100644 --- a/static/src/app/request/award/req-award.component.ts +++ b/static/src/app/request/award/req-award.component.ts @@ -2,10 +2,10 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {Award, Decoration, User} from "../../models/model-interfaces"; import {NgForm} from "@angular/forms"; -import {AwardingService} from "../../services/awarding-service/awarding.service"; -import {DecorationService} from "../../services/decoration-service/decoration.service"; -import {UserService} from "../../services/user-service/user.service"; -import {LoginService} from "../../services/login-service/login-service"; +import {AwardingService} from "../../services/army-management/awarding.service"; +import {DecorationService} from "../../services/army-management/decoration.service"; +import {UserService} from "../../services/army-management/user.service"; +import {LoginService} from "../../services/app-user-service/login-service"; @Component({ diff --git a/static/src/app/request/confirm-award/confirm-award.component.ts b/static/src/app/request/confirm-award/confirm-award.component.ts index 4ce6898..751f6ab 100644 --- a/static/src/app/request/confirm-award/confirm-award.component.ts +++ b/static/src/app/request/confirm-award/confirm-award.component.ts @@ -1,7 +1,7 @@ import {Component} from "@angular/core"; import {Award} from "../../models/model-interfaces"; -import {AwardingService} from "../../services/awarding-service/awarding.service"; -import {LoginService} from "../../services/login-service/login-service"; +import {AwardingService} from "../../services/army-management/awarding.service"; +import {LoginService} from "../../services/app-user-service/login-service"; @Component({ diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.ts b/static/src/app/request/confirm-promotion/confirm-promotion.component.ts index d3c7d40..8612ced 100644 --- a/static/src/app/request/confirm-promotion/confirm-promotion.component.ts +++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.ts @@ -1,8 +1,8 @@ import {Component} from "@angular/core"; import {Promotion, Rank} from "../../models/model-interfaces"; -import {RankService} from "../../services/rank-service/rank.service"; -import {PromotionService} from "../../services/promotion-service/promotion.service"; -import {LoginService} from "../../services/login-service/login-service"; +import {RankService} from "../../services/army-management/rank.service"; +import {PromotionService} from "../../services/army-management/promotion.service"; +import {LoginService} from "../../services/app-user-service/login-service"; @Component({ diff --git a/static/src/app/request/promotion/req-promotion.component.ts b/static/src/app/request/promotion/req-promotion.component.ts index 4d6451e..bdd4a06 100644 --- a/static/src/app/request/promotion/req-promotion.component.ts +++ b/static/src/app/request/promotion/req-promotion.component.ts @@ -2,10 +2,10 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {Rank, User} from "../../models/model-interfaces"; import {NgForm} from "@angular/forms"; -import {UserService} from "../../services/user-service/user.service"; -import {RankService} from "../../services/rank-service/rank.service"; -import {PromotionService} from "../../services/promotion-service/promotion.service"; -import {LoginService} from "../../services/login-service/login-service"; +import {UserService} from "../../services/army-management/user.service"; +import {RankService} from "../../services/army-management/rank.service"; +import {PromotionService} from "../../services/army-management/promotion.service"; +import {LoginService} from "../../services/app-user-service/login-service"; @Component({ diff --git a/static/src/app/services/login-service/login-service.ts b/static/src/app/services/app-user-service/login-service.ts similarity index 92% rename from static/src/app/services/login-service/login-service.ts rename to static/src/app/services/app-user-service/login-service.ts index 1af6a68..54ad27f 100644 --- a/static/src/app/services/login-service/login-service.ts +++ b/static/src/app/services/app-user-service/login-service.ts @@ -3,8 +3,8 @@ import {Http, Response} from "@angular/http"; import "rxjs/add/operator/map"; import {AppConfig} from "../../app.config"; -import {AwardingService} from "../awarding-service/awarding.service"; -import {PromotionService} from "../promotion-service/promotion.service"; +import {AwardingService} from "../army-management/awarding.service"; +import {PromotionService} from "../army-management/promotion.service"; import {CookieService} from "ngx-cookie-service"; @Injectable() diff --git a/static/src/app/services/awarding-service/awarding.service.ts b/static/src/app/services/army-management/awarding.service.ts similarity index 100% rename from static/src/app/services/awarding-service/awarding.service.ts rename to static/src/app/services/army-management/awarding.service.ts diff --git a/static/src/app/services/decoration-service/decoration.service.ts b/static/src/app/services/army-management/decoration.service.ts similarity index 100% rename from static/src/app/services/decoration-service/decoration.service.ts rename to static/src/app/services/army-management/decoration.service.ts diff --git a/static/src/app/services/promotion-service/promotion.service.ts b/static/src/app/services/army-management/promotion.service.ts similarity index 100% rename from static/src/app/services/promotion-service/promotion.service.ts rename to static/src/app/services/army-management/promotion.service.ts diff --git a/static/src/app/services/rank-service/rank.service.ts b/static/src/app/services/army-management/rank.service.ts similarity index 100% rename from static/src/app/services/rank-service/rank.service.ts rename to static/src/app/services/army-management/rank.service.ts diff --git a/static/src/app/services/squad-service/squad.service.ts b/static/src/app/services/army-management/squad.service.ts similarity index 100% rename from static/src/app/services/squad-service/squad.service.ts rename to static/src/app/services/army-management/squad.service.ts diff --git a/static/src/app/services/user-service/user.service.ts b/static/src/app/services/army-management/user.service.ts similarity index 100% rename from static/src/app/services/user-service/user.service.ts rename to static/src/app/services/army-management/user.service.ts diff --git a/static/src/app/services/campaign-service/campaign.service.ts b/static/src/app/services/logs/campaign.service.ts similarity index 100% rename from static/src/app/services/campaign-service/campaign.service.ts rename to static/src/app/services/logs/campaign.service.ts diff --git a/static/src/app/services/logs/logs.service.ts b/static/src/app/services/logs/logs.service.ts new file mode 100644 index 0000000..48af08f --- /dev/null +++ b/static/src/app/services/logs/logs.service.ts @@ -0,0 +1,76 @@ +import {Injectable} from "@angular/core"; +import {AppConfig} from "../../app.config"; +import {HttpClient} from "../http-client"; +import {URLSearchParams} from "@angular/http"; + +@Injectable() +export class LogsService { + + constructor(private http: HttpClient, + private config: AppConfig) { + } + + getBudgetLogs(warId: string, fraction = '') { + console.log("CALL") + const params = new URLSearchParams(); + params.append('fraction', fraction); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/budget', params) + .map(res => res.json()) + } + + getRespawnLogs(warId: string, playerName = '') { + const params = new URLSearchParams(); + params.append('player', playerName); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/respawn', params) + .map(res => res.json()) + } + + getPointsLogs(warId: string, fraction = '') { + const params = new URLSearchParams(); + params.append('fraction', fraction); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/points', params) + .map(res => res.json()) + } + + getReviveLogs(warId: string, medicName = '', patientName = '', fraction = '', stabilizedOnly = false, reviveOnly = false) { + const params = new URLSearchParams(); + params.append('medic', medicName); + params.append('patient', patientName); + params.append('fraction', fraction); + params.append('stabilized', stabilizedOnly ? 'true' : ''); + params.append('revive', reviveOnly ? 'true' : ''); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/revive', params) + .map(res => res.json()) + } + + getKillLogs(warId: string, shooterName = '', targetName = '', fraction = '', friendlyFireOnly = false, notFriendlyFireOnly = false) { + const params = new URLSearchParams(); + params.append('shooter', shooterName); + params.append('target', targetName); + params.append('fraction', fraction); + params.append('friendlyFire', friendlyFireOnly ? 'true' : ''); + params.append('noFriendlyFire', notFriendlyFireOnly ? 'true' : ''); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/kills', params) + .map(res => res.json()) + } + + getTransportLogs(warId: string, driverName = '', passengerName = '', fraction = '') { + const params = new URLSearchParams(); + params.append('driver', driverName); + params.append('passenger', passengerName); + params.append('fraction', fraction); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/transport', params) + .map(res => res.json()) + } + + getFlagLogs(warId: string, playerName = '', fraction = '', captureOnly = false, defendOnly = false) { + const params = new URLSearchParams(); + params.append('player', playerName); + params.append('fraction', fraction); + params.append('capture', captureOnly ? 'true' : ''); + params.append('defend', defendOnly ? 'true' : ''); + return this.http.get(this.config.apiLogsPath + '/' + warId + '/flag', params) + .map(res => res.json()) + } + +} diff --git a/static/src/app/services/player-service/player.service.ts b/static/src/app/services/logs/player.service.ts similarity index 100% rename from static/src/app/services/player-service/player.service.ts rename to static/src/app/services/logs/player.service.ts diff --git a/static/src/app/services/war-service/war.service.ts b/static/src/app/services/logs/war.service.ts similarity index 100% rename from static/src/app/services/war-service/war.service.ts rename to static/src/app/services/logs/war.service.ts diff --git a/static/src/app/squads/edit-squad/edit-squad.component.ts b/static/src/app/squads/edit-squad/edit-squad.component.ts index d4b46b7..6ebef35 100644 --- a/static/src/app/squads/edit-squad/edit-squad.component.ts +++ b/static/src/app/squads/edit-squad/edit-squad.component.ts @@ -2,7 +2,7 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {NgForm} from "@angular/forms"; import {Squad} from "../../models/model-interfaces"; -import {SquadService} from "../../services/squad-service/squad.service"; +import {SquadService} from "../../services/army-management/squad.service"; import {Subscription} from "rxjs/Subscription"; diff --git a/static/src/app/squads/squad-list/squad-list.component.ts b/static/src/app/squads/squad-list/squad-list.component.ts index 12fd6ec..fcb5582 100644 --- a/static/src/app/squads/squad-list/squad-list.component.ts +++ b/static/src/app/squads/squad-list/squad-list.component.ts @@ -5,7 +5,7 @@ import {FormControl} from "@angular/forms"; import {ActivatedRoute, Router} from "@angular/router"; import {Observable} from "rxjs/Observable"; import {Squad} from "../../models/model-interfaces"; -import {SquadService} from "../../services/squad-service/squad.service"; +import {SquadService} from "../../services/army-management/squad.service"; @Component({ selector: 'squad-list', diff --git a/static/src/app/squads/squads.module.ts b/static/src/app/squads/squads.module.ts index 41c63b7..919b3a9 100644 --- a/static/src/app/squads/squads.module.ts +++ b/static/src/app/squads/squads.module.ts @@ -3,7 +3,7 @@ import {CommonModule} from "@angular/common"; import {SharedModule} from "../shared.module"; import {squadRouterModule, squadsRoutingComponents} from "./squads.routing"; import {SquadStore} from "../services/stores/squad.store"; -import {SquadService} from "../services/squad-service/squad.service"; +import {SquadService} from "../services/army-management/squad.service"; import {ButtonsModule} from "ngx-bootstrap"; @NgModule({ diff --git a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts index 7f7b556..2aa64eb 100644 --- a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts +++ b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.ts @@ -1,7 +1,7 @@ import {Component} from "@angular/core"; import {ActivatedRoute} from "@angular/router"; import {CampaignPlayer} from "../../models/model-interfaces"; -import {PlayerService} from "../../services/player-service/player.service"; +import {PlayerService} from "../../services/logs/player.service"; import {ChartUtils} from "../../utils/chart-utils"; import {Location} from '@angular/common'; diff --git a/static/src/app/statistic/campaign-submit/campaign-submit.component.ts b/static/src/app/statistic/campaign-submit/campaign-submit.component.ts index 8182d8e..59c67cf 100644 --- a/static/src/app/statistic/campaign-submit/campaign-submit.component.ts +++ b/static/src/app/statistic/campaign-submit/campaign-submit.component.ts @@ -2,7 +2,7 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {NgForm} from "@angular/forms"; import {Campaign} from "../../models/model-interfaces"; -import {CampaignService} from "../../services/campaign-service/campaign.service"; +import {CampaignService} from "../../services/logs/campaign.service"; @Component({ diff --git a/static/src/app/statistic/overview/stats-overview.component.ts b/static/src/app/statistic/overview/stats-overview.component.ts index 919a966..a5395a1 100644 --- a/static/src/app/statistic/overview/stats-overview.component.ts +++ b/static/src/app/statistic/overview/stats-overview.component.ts @@ -1,7 +1,7 @@ import {Component} from "@angular/core"; import {ActivatedRoute} from "@angular/router"; import {CarouselConfig} from "ngx-bootstrap"; -import {CampaignService} from "../../services/campaign-service/campaign.service"; +import {CampaignService} from "../../services/logs/campaign.service"; import {ChartUtils} from "../../utils/chart-utils"; diff --git a/static/src/app/statistic/stats.module.ts b/static/src/app/statistic/stats.module.ts index e2edbc4..b7b9bb1 100644 --- a/static/src/app/statistic/stats.module.ts +++ b/static/src/app/statistic/stats.module.ts @@ -2,18 +2,19 @@ import {NgModule} from '@angular/core'; import {CommonModule} from "@angular/common"; import {SharedModule} from "../shared.module"; import {statsRouterModule, statsRoutingComponents} from "./stats.routing"; -import {WarService} from "../services/war-service/war.service"; +import {WarService} from "../services/logs/war.service"; import {NgxChartsModule} from "@swimlane/ngx-charts"; import {AccordionModule, CarouselModule} from "ngx-bootstrap"; -import {CampaignService} from "../services/campaign-service/campaign.service"; +import {CampaignService} from "../services/logs/campaign.service"; import {NgxDatatableModule} from "@swimlane/ngx-datatable"; -import {PlayerService} from "../services/player-service/player.service"; +import {PlayerService} from "../services/logs/player.service"; +import {LogsService} from "../services/logs/logs.service"; @NgModule({ declarations: statsRoutingComponents, imports: [CommonModule, SharedModule, statsRouterModule, NgxChartsModule, AccordionModule.forRoot(), CarouselModule.forRoot(), NgxDatatableModule], - providers: [WarService, CampaignService, PlayerService] + providers: [WarService, CampaignService, PlayerService, LogsService] }) export class StatsModule { static routes = statsRouterModule; diff --git a/static/src/app/statistic/war-detail/war-detail.component.ts b/static/src/app/statistic/war-detail/war-detail.component.ts index 2952cc4..b572e56 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.ts +++ b/static/src/app/statistic/war-detail/war-detail.component.ts @@ -1,7 +1,8 @@ import {Component, ElementRef, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; -import {WarService} from "../../services/war-service/war.service"; +import {WarService} from "../../services/logs/war.service"; import {War} from "../../models/model-interfaces"; +import {LogsService} from "../../services/logs/logs.service"; @Component({ @@ -32,7 +33,8 @@ export class WarDetailComponent { constructor(private route: ActivatedRoute, private router: Router, - private warService: WarService) { + private warService: WarService, + private logsService: LogsService) { Object.assign(this, this.playerChart) } diff --git a/static/src/app/statistic/war-list/war-item.component.ts b/static/src/app/statistic/war-list/war-item.component.ts index fcbff1c..cbb63b4 100644 --- a/static/src/app/statistic/war-list/war-item.component.ts +++ b/static/src/app/statistic/war-list/war-item.component.ts @@ -1,6 +1,6 @@ import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core"; import {War} from "../../models/model-interfaces"; -import {LoginService} from "../../services/login-service/login-service"; +import {LoginService} from "../../services/app-user-service/login-service"; @Component({ selector: 'pjm-war-item', diff --git a/static/src/app/statistic/war-list/war-list.component.ts b/static/src/app/statistic/war-list/war-list.component.ts index e3f515c..f109160 100644 --- a/static/src/app/statistic/war-list/war-list.component.ts +++ b/static/src/app/statistic/war-list/war-list.component.ts @@ -1,9 +1,9 @@ import {Component, OnInit} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {Campaign, War} from "../../models/model-interfaces"; -import {WarService} from "../../services/war-service/war.service"; -import {LoginService} from "../../services/login-service/login-service"; -import {CampaignService} from "../../services/campaign-service/campaign.service"; +import {WarService} from "../../services/logs/war.service"; +import {LoginService} from "../../services/app-user-service/login-service"; +import {CampaignService} from "../../services/logs/campaign.service"; import {RouteConfig} from "../../app.config"; @Component({ diff --git a/static/src/app/statistic/war-submit/war-submit.component.ts b/static/src/app/statistic/war-submit/war-submit.component.ts index 3520855..78ff828 100644 --- a/static/src/app/statistic/war-submit/war-submit.component.ts +++ b/static/src/app/statistic/war-submit/war-submit.component.ts @@ -1,9 +1,9 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {NgForm} from "@angular/forms"; -import {WarService} from "../../services/war-service/war.service"; +import {WarService} from "../../services/logs/war.service"; import {War} from "../../models/model-interfaces"; -import {CampaignService} from "../../services/campaign-service/campaign.service"; +import {CampaignService} from "../../services/logs/campaign.service"; @Component({ diff --git a/static/src/app/users/award-user/award-user.component.ts b/static/src/app/users/award-user/award-user.component.ts index 4ee5d92..e0ee866 100644 --- a/static/src/app/users/award-user/award-user.component.ts +++ b/static/src/app/users/award-user/award-user.component.ts @@ -2,8 +2,8 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {Award, Decoration} from "../../models/model-interfaces"; import {NgForm} from "@angular/forms"; -import {AwardingService} from "../../services/awarding-service/awarding.service"; -import {DecorationService} from "../../services/decoration-service/decoration.service"; +import {AwardingService} from "../../services/army-management/awarding.service"; +import {DecorationService} from "../../services/army-management/decoration.service"; @Component({ diff --git a/static/src/app/users/edit-user/edit-user.component.ts b/static/src/app/users/edit-user/edit-user.component.ts index 8d3bc3c..aab5110 100644 --- a/static/src/app/users/edit-user/edit-user.component.ts +++ b/static/src/app/users/edit-user/edit-user.component.ts @@ -1,9 +1,9 @@ import {Component, ViewChild} from "@angular/core"; import {ActivatedRoute, Router} from "@angular/router"; import {Rank, Squad, User} from "../../models/model-interfaces"; -import {UserService} from "../../services/user-service/user.service"; -import {SquadService} from "../../services/squad-service/squad.service"; -import {RankService} from "../../services/rank-service/rank.service"; +import {UserService} from "../../services/army-management/user.service"; +import {SquadService} from "../../services/army-management/squad.service"; +import {RankService} from "../../services/army-management/rank.service"; import {Subscription} from "rxjs"; import {NgForm} from "@angular/forms"; diff --git a/static/src/app/users/user-list/user-list.component.ts b/static/src/app/users/user-list/user-list.component.ts index b334813..9e2de89 100644 --- a/static/src/app/users/user-list/user-list.component.ts +++ b/static/src/app/users/user-list/user-list.component.ts @@ -4,7 +4,7 @@ import {Location} from "@angular/common"; import {FormControl} from "@angular/forms"; import {ActivatedRoute, Router} from "@angular/router"; import {Observable} from "rxjs/Observable"; -import {UserService} from "../../services/user-service/user.service"; +import {UserService} from "../../services/army-management/user.service"; import {User} from "../../models/model-interfaces"; import {ADD, LOAD} from "../../services/stores/user.store";