clean up code according to lint

pull/30/head
Florian Hartwich 2018-03-08 09:44:35 +01:00
parent 996ea41224
commit f764bd52d5
42 changed files with 150 additions and 140 deletions

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnInit} 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';
@ -11,7 +11,7 @@ import {Fraction} from '../utils/fraction.enum';
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.css', '../style/overview.css']
})
export class AdminComponent {
export class AdminComponent implements OnInit {
users$: Observable<AppUser[]>;
@ -45,7 +45,7 @@ export class AdminComponent {
}
this.appUserService.updateUser(updateObject)
.subscribe(user => {
.subscribe(resUser => {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {NavigationEnd, NavigationStart, Router} from '@angular/router';
import {LoginService} from './services/app-user-service/login-service';
import {PromotionService} from './services/army-management/promotion.service';
@ -12,11 +12,11 @@ declare function require(url: string);
templateUrl: 'app.component.html',
styleUrls: ['app.component.css', 'style/load-indicator.css']
})
export class AppComponent {
export class AppComponent implements OnInit {
config = RouteConfig;
loading: boolean = false;
loading = false;
version = 'v' + require('./../../../package.json').version;

View File

@ -1,4 +1,4 @@
import {Component, Inject} from '@angular/core';
import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
import {Award, User} from '../models/model-interfaces';
import {ActivatedRoute, Router} from '@angular/router';
import {UserService} from '../services/army-management/user.service';
@ -15,7 +15,7 @@ import {CSSHelpers} from '../global.helpers';
templateUrl: './army-member.component.html',
styleUrls: ['./army-member.component.css']
})
export class ArmyMemberComponent {
export class ArmyMemberComponent implements OnInit, OnDestroy {
subscription: Subscription;
@ -42,7 +42,7 @@ export class ArmyMemberComponent {
this.subscription = this.route.params
.map(params => params['id'])
.filter(id => id != undefined)
.filter(id => id !== undefined)
.flatMap(id => this.userService.getUser(id))
.subscribe(user => {
this.user = user;

View File

@ -1,4 +1,4 @@
import {Component, Inject} from '@angular/core';
import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
import {Army} from '../models/model-interfaces';
import {ArmyService} from '../services/army-service/army.service';
import {ActivatedRoute, Router} from '@angular/router';
@ -13,7 +13,7 @@ import {CSSHelpers} from '../global.helpers';
templateUrl: './army.component.html',
styleUrls: ['./army.component.css']
})
export class ArmyComponent {
export class ArmyComponent implements OnInit, OnDestroy {
army: Army = {BLUFOR: {squads: [], memberCount: 0}, OPFOR: {squads: [], memberCount: 0}};

View File

@ -13,6 +13,7 @@ import {FormGroup, NgForm} from '@angular/forms';
export class ShowErrorComponent {
@Input('path') controlPath;
@Input('text') displayName = '';
private form: FormGroup;

View File

@ -1,4 +1,4 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Decoration} from '../../models/model-interfaces';
import {Fraction} from '../../utils/fraction.enum';
@ -6,19 +6,21 @@ import {Fraction} from '../../utils/fraction.enum';
selector: 'decoration-item',
templateUrl: './decoration-item.component.html',
styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['decoration', 'selected'],
outputs: ['decorationDelete', 'decorationSelected'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DecorationItemComponent {
export class DecorationItemComponent implements OnInit {
@Input() selected: boolean;
@Input() decoration: Decoration;
@Output() decorationSelected = new EventEmitter();
@Output() decorationDelete = new EventEmitter();
selected: boolean;
decoration: Decoration;
imageSrc;
imgStyle = {width: '', height: '', marginTop: ''};
decorationSelected = new EventEmitter();
decorationDelete = new EventEmitter();
imgStyle = {width: '', height: '', marginTop: ''};
readonly fraction = Fraction;

View File

@ -60,13 +60,16 @@ export class DecorationListComponent implements OnInit {
deleteDecoration(decoration) {
let fraction = 'Global';
if (decoration.fraction === 'BLUFOR') fraction = Fraction.BLUFOR;
else if (decoration.fraction === 'OPFOR') fraction = Fraction.OPFOR;
if (decoration.fraction === 'BLUFOR') {
fraction = Fraction.BLUFOR;
} else if (decoration.fraction === 'OPFOR') {
fraction = Fraction.OPFOR;
}
if (confirm('Soll die Auszeichnung "' + decoration.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.decorationService.deleteDecoration(decoration)
.subscribe((res) => {
})
});
}
}

View File

@ -1,4 +1,4 @@
import {Component} from "@angular/core";
import {Component} from '@angular/core';
@Component({
selector: 'decorations',

View File

@ -27,5 +27,6 @@ export const decorationsRoutes: Routes = [{
export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes);
export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent, EditDecorationComponent];
export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent,
EditDecorationComponent];

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {NgForm} from '@angular/forms';
import {Decoration} from '../../models/model-interfaces';
@ -10,7 +10,7 @@ import {Fraction} from '../../utils/fraction.enum';
templateUrl: './edit-decoration.component.html',
styleUrls: ['./edit-decoration.component.css', '../../style/entry-form.css', '../../style/overview.css']
})
export class EditDecorationComponent {
export class EditDecorationComponent implements OnInit, OnDestroy {
subscription: Subscription;
@ -36,7 +36,7 @@ export class EditDecorationComponent {
ngOnInit() {
this.subscription = this.route.params
.map(params => params['id'])
.filter(id => id != undefined)
.filter(id => id !== undefined)
.flatMap(id => this.decorationService.getDecoration(id))
.subscribe(decoration => {
this.decoration = decoration;

View File

@ -15,7 +15,7 @@ export class FilterRankPipe implements PipeTransform {
if (res.length === 0) {
return [{name: '-'}];
} else {
return res
return res;
}
}

View File

@ -1,2 +1,2 @@
export * from './login.component';
export * from './login.guard';
export * from './login.guard';

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {NgForm} from '@angular/forms';
import {Rank} from '../../models/model-interfaces';
@ -11,7 +11,7 @@ import {Fraction} from '../../utils/fraction.enum';
templateUrl: './edit-rank.component.html',
styleUrls: ['./edit-rank.component.css', '../../style/entry-form.css', '../../style/overview.css']
})
export class EditRankComponent {
export class EditRankComponent implements OnInit, OnDestroy {
subscription: Subscription;

View File

@ -1,4 +1,4 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Rank} from '../../models/model-interfaces';
import {Fraction} from '../../utils/fraction.enum';
@ -6,19 +6,20 @@ import {Fraction} from '../../utils/fraction.enum';
selector: 'pjm-rank-item',
templateUrl: './rank-item.component.html',
styleUrls: ['./rank-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['rank', 'selected'],
outputs: ['rankSelected', 'rankDelete'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RankItemComponent {
export class RankItemComponent implements OnInit {
@Input() selected: boolean;
@Input() rank: Rank;
@Output() rankSelected = new EventEmitter();
@Output() rankDelete = new EventEmitter();
selected: boolean;
rank: Rank;
imageSrc;
rankSelected = new EventEmitter();
rankDelete = new EventEmitter();
readonly fraction = Fraction;
constructor() {

View File

@ -1,4 +1,4 @@
import {Component} from "@angular/core";
import {Component} from '@angular/core';
@Component({
selector: 'ranks',

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Award, Decoration, User} from '../../models/model-interfaces';
import {NgForm} from '@angular/forms';
@ -12,7 +12,7 @@ import {LoginService} from '../../services/app-user-service/login-service';
templateUrl: './req-award.component.html',
styleUrls: ['./req-award.component.css', '../../style/overview.css'],
})
export class RequestAwardComponent {
export class RequestAwardComponent implements OnInit {
@ViewChild(NgForm) form: NgForm;
@ -24,7 +24,7 @@ export class RequestAwardComponent {
decoration: Decoration = {_id: '0'};
reason: string = '';
reason = '';
decorations: Decoration[];
@ -96,9 +96,9 @@ export class RequestAwardComponent {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
}, 2000)
})
})
}, 2000);
});
});
}
}

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {Award} from '../../models/model-interfaces';
import {AwardingService} from '../../services/army-management/awarding.service';
import {LoginService} from '../../services/app-user-service/login-service';
@ -8,7 +8,7 @@ import {LoginService} from '../../services/app-user-service/login-service';
templateUrl: './confirm-award.component.html',
styleUrls: ['./confirm-award.component.css', '../../style/overview.css'],
})
export class ConfirmAwardComponent {
export class ConfirmAwardComponent implements OnInit {
awards: Award[];
@ -19,7 +19,7 @@ export class ConfirmAwardComponent {
}
ngOnInit() {
let currentUser = this.loginService.getCurrentUser();
const currentUser = this.loginService.getCurrentUser();
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
this.awards = awards;
});
@ -32,7 +32,7 @@ export class ConfirmAwardComponent {
};
this.awardingService.updateAward(updateObject).subscribe(res => {
let currentUser = this.loginService.getCurrentUser();
const currentUser = this.loginService.getCurrentUser();
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
this.awards = awards;
if (awards.length < 1) {

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {Promotion, Rank} from '../../models/model-interfaces';
import {RankService} from '../../services/army-management/rank.service';
import {PromotionService} from '../../services/army-management/promotion.service';
@ -9,7 +9,7 @@ import {LoginService} from '../../services/app-user-service/login-service';
templateUrl: './confirm-promotion.component.html',
styleUrls: ['./confirm-promotion.component.css', '../../style/overview.css'],
})
export class ConfirmPromotionComponent {
export class ConfirmPromotionComponent implements OnInit {
showSuccessLabel = false;
@ -23,15 +23,14 @@ export class ConfirmPromotionComponent {
}
ngOnInit() {
let currentUser = this.loginService.getCurrentUser();
const currentUser = this.loginService.getCurrentUser();
// show only current users fraction promotions
this.rankService.findRanks('', currentUser.squad.fraction).subscribe(ranks => {
this.ranks = ranks;
});
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {
this.promotions = promotions;
})
});
}
confirm(promotion: Promotion, decision: boolean) {
@ -41,7 +40,7 @@ export class ConfirmPromotionComponent {
};
this.promotionService.updatePromotion(updateObject).subscribe(res => {
let currentUser = this.loginService.getCurrentUser();
const currentUser = this.loginService.getCurrentUser();
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {
this.promotions = promotions;
if (promotions.length < 1) {

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Rank, User} from '../../models/model-interfaces';
import {NgForm} from '@angular/forms';
@ -12,7 +12,7 @@ import {LoginService} from '../../services/app-user-service/login-service';
templateUrl: './req-promotion.component.html',
styleUrls: ['./req-promotion.component.css', '../../style/overview.css'],
})
export class RequestPromotionComponent {
export class RequestPromotionComponent implements OnInit {
@ViewChild(NgForm) form: NgForm;

View File

@ -1,4 +1,4 @@
import {Component} from "@angular/core";
import {Component} from '@angular/core';
@Component({
selector: 'request',

View File

@ -32,7 +32,7 @@ export class UserService {
searchParams.append('offset', offset);
this.http.get(this.config.apiUserPath, searchParams)
.do((res) => {
let headerCount = parseInt(res.headers.get('x-total-count'));
const headerCount = parseInt(res.headers.get('x-total-count'), 10);
if (headerCount) {
this.totalCount = headerCount;
}

View File

@ -1,6 +1,6 @@
import {Injectable} from "@angular/core";
import {AppConfig} from "../../app.config";
import {Http} from "@angular/http";
import {Injectable} from '@angular/core';
import {AppConfig} from '../../app.config';
import {Http} from '@angular/http';
@Injectable()

View File

@ -1,4 +1,4 @@
import {BehaviorSubject} from "rxjs/BehaviorSubject";
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
export const LOAD = 'LOAD';
export const ADD = 'ADD';
@ -29,7 +29,7 @@ export class Store<T extends Identifiable> {
return [...items, action.data];
case EDIT:
return items.map(task => {
var editedTask = action.data;
const editedTask = action.data;
if (task.id !== editedTask.id) {
return task;
}

View File

@ -1,7 +1,7 @@
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {ShowErrorComponent} from "./common/show-error/show-error.component";
import {CommonModule} from "@angular/common";
import {ShowErrorComponent} from './common/show-error/show-error.component';
import {CommonModule} from '@angular/common';
@NgModule({
declarations: [ShowErrorComponent],

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {NgForm} from '@angular/forms';
import {Squad} from '../../models/model-interfaces';
@ -11,7 +11,7 @@ import {Fraction} from '../../utils/fraction.enum';
templateUrl: './edit-squad.component.html',
styleUrls: ['./edit-squad.component.css', '../../style/entry-form.css', '../../style/overview.css']
})
export class EditSquadComponent {
export class EditSquadComponent implements OnInit, OnDestroy {
subscription: Subscription;
@ -88,8 +88,8 @@ export class EditSquadComponent {
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
}, 2000)
})
}, 2000);
});
}
}

View File

@ -1,4 +1,4 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Squad} from '../../models/model-interfaces';
import {Fraction} from '../../utils/fraction.enum';
@ -6,17 +6,17 @@ import {Fraction} from '../../utils/fraction.enum';
selector: 'pjm-squad-item',
templateUrl: './squad-item.component.html',
styleUrls: ['./squad-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['squad', 'selected'],
outputs: ['squadSelected', 'squadDelete'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SquadItemComponent {
export class SquadItemComponent implements OnInit {
selected: boolean;
squad: Squad;
@Input() selected: boolean;
squadSelected = new EventEmitter();
squadDelete = new EventEmitter();
@Input() squad: Squad;
@Output() squadSelected = new EventEmitter();
@Output() squadDelete = new EventEmitter();
imageSrc;

View File

@ -65,7 +65,7 @@ export class SquadListComponent implements OnInit {
if (confirm('Soll das Squad "' + squad.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.squadService.deleteSquad(squad)
.subscribe((res) => {
})
});
}
}

View File

@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {CampaignPlayer} from '../../models/model-interfaces';
import {PlayerService} from '../../services/logs/player.service';
import {ChartUtils} from '../../utils/chart-utils';
@ -10,7 +10,7 @@ import {ChartUtils} from '../../utils/chart-utils';
styleUrls: ['./campaign-player-detail.component.css', '../../style/list-entry.css',
'../../style/hide-scrollbar.css', '../../style/overview.css']
})
export class CampaignPlayerDetailComponent {
export class CampaignPlayerDetailComponent implements OnInit {
@Input() campaignId: string;
@ -132,7 +132,8 @@ export class CampaignPlayerDetailComponent {
}
];
Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleKillData, this.deathData, this.respawnData, this.reviveData, this.captureData]);
Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleKillData,
this.deathData, this.respawnData, this.reviveData, this.captureData]);
});
}

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, Input, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PlayerService} from '../../services/logs/player.service';
import {CampaignService} from '../../services/logs/campaign.service';
@ -11,10 +11,11 @@ import {Player} from '../../models/model-interfaces';
@Component({
selector: 'stats-highscore',
templateUrl: './highscore.component.html',
styleUrls: ['./highscore.component.css', '../../style/list-entry.css', '../../style/overview.css'],
inputs: ['campaigns']
styleUrls: ['./highscore.component.css', '../../style/list-entry.css', '../../style/overview.css']
})
export class StatisticHighScoreComponent {
export class StatisticHighScoreComponent implements OnInit {
@Input() campaigns;
id = '';

View File

@ -1,4 +1,4 @@
import {Component, Input} from '@angular/core';
import {Component, Input, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {CampaignService} from '../../services/logs/campaign.service';
import {ChartUtils} from '../../utils/chart-utils';
@ -10,7 +10,7 @@ import {Fraction} from '../../utils/fraction.enum';
templateUrl: './stats-overview.component.html',
styleUrls: ['./stats-overview.component.css', '../../style/list-entry.css', '../../style/overview.css']
})
export class StatisticOverviewComponent {
export class StatisticOverviewComponent implements OnInit {
@Input() campaigns;

View File

@ -1,4 +1,4 @@
import {Component} from "@angular/core";
import {Component} from '@angular/core';
@Component({
selector: 'stats',

View File

@ -51,7 +51,7 @@ export const statsRoutes: Routes = [{
path: 'campaign-player/:id/:playerName',
component: CampaignPlayerDetailComponent,
outlet: 'right'
},];
}];
export const statsRouterModule: ModuleWithProviders = RouterModule.forChild(statsRoutes);

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, Input, SimpleChanges, ViewChild} from '@angular/core';
import {Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, ViewChild} from '@angular/core';
import * as d3 from 'd3';
import {ChartUtils} from '../../../utils/chart-utils';
import {Fraction} from '../../../utils/fraction.enum';
@ -10,7 +10,7 @@ import {War} from '../../../models/model-interfaces';
templateUrl: './fraction-stats.component.html',
styleUrls: ['./fraction-stats.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
})
export class FractionStatsComponent {
export class FractionStatsComponent implements OnInit, OnChanges {
readonly fraction = Fraction;
@ -161,7 +161,7 @@ export class FractionStatsComponent {
const fractionChange = budgetEntry.fraction === 'BLUFOR' ? 0 : 1;
const fractionOld = budgetEntry.fraction !== 'BLUFOR' ? 0 : 1;
if (FractionStatsComponent.isTwoMinutesAhead(budgetEntryDate, this.tmpBudgetData)) {
if (this.isTwoMinutesAhead(budgetEntryDate, this.tmpBudgetData)) {
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[this.tmpBudgetData[fractionOld].series.length - 1].value));
@ -177,7 +177,7 @@ export class FractionStatsComponent {
}
let killCountBlufor = 0, killCountOpfor = 0, ffKillCountBlufor = 0, ffKillCountOpfor = 0;
for (const {killEntry, index} of this.logData.kill.map((killEntry, index) => ({killEntry, index}))) {
for (const {killEntry, index} of this.logData.kill.map((entry, pos) => ({entry, pos}))) {
const killEntryDate = new Date(killEntry.time);
if (killEntry.friendlyFire === false) {
if (killEntry.fraction === 'BLUFOR') {
@ -186,7 +186,7 @@ export class FractionStatsComponent {
if (killEntry.fraction === 'OPFOR') {
killCountOpfor++;
}
if (FractionStatsComponent.isTwoMinutesAhead(killEntryDate, this.tmpKillData)) {
if (this.isTwoMinutesAhead(killEntryDate, this.tmpKillData)) {
this.tmpKillData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountBlufor));
this.tmpKillData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountOpfor));
}
@ -197,7 +197,7 @@ export class FractionStatsComponent {
if (killEntry.fraction === 'OPFOR') {
ffKillCountOpfor++;
}
if (FractionStatsComponent.isTwoMinutesAhead(killEntryDate, this.tmpFrienlyFireData)) {
if (this.isTwoMinutesAhead(killEntryDate, this.tmpFrienlyFireData)) {
this.tmpFrienlyFireData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountBlufor));
this.tmpFrienlyFireData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountOpfor));
}
@ -220,7 +220,7 @@ export class FractionStatsComponent {
return;
}
let reviveCountBlufor = 0, reviveCountOpfor = 0, stabilizeCountBlufor = 0, stabilizeCountOpfor = 0;
for (const {reviveEntry, index} of this.logData.revive.map((reviveEntry, index) => ({reviveEntry, index}))) {
for (const {reviveEntry, index} of this.logData.revive.map((entry, pos) => ({entry, pos}))) {
const reviveEntryDate = new Date(reviveEntry.time);
if (reviveEntry.stabilized === false) {
if (reviveEntry.fraction === 'BLUFOR') {
@ -228,7 +228,7 @@ export class FractionStatsComponent {
} else {
reviveCountOpfor++;
}
if (FractionStatsComponent.isTwoMinutesAhead(reviveEntryDate, this.tmpReviveData)) {
if (this.isTwoMinutesAhead(reviveEntryDate, this.tmpReviveData)) {
this.tmpReviveData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountBlufor));
this.tmpReviveData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountOpfor));
}
@ -238,7 +238,7 @@ export class FractionStatsComponent {
} else {
stabilizeCountOpfor++;
}
if (FractionStatsComponent.isTwoMinutesAhead(reviveEntryDate, this.tmpStabilizeData)) {
if (this.isTwoMinutesAhead(reviveEntryDate, this.tmpStabilizeData)) {
this.tmpStabilizeData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountBlufor));
this.tmpStabilizeData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountOpfor));
}
@ -260,8 +260,8 @@ export class FractionStatsComponent {
return;
}
let vehicleKillCountBlufor = 0, vehicleKillCountOpfor = 0;
for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((transportEntry, index) => ({
transportEntry,
for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((entry, pos) => ({
pos,
index
}))) {
const vehicleEntryDate = new Date(vehicleEntry.time);
@ -270,7 +270,7 @@ export class FractionStatsComponent {
} else {
vehicleKillCountOpfor++;
}
if (FractionStatsComponent.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) {
if (this.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) {
this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor));
this.tmpVehicleData[1].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountOpfor));
}
@ -284,9 +284,9 @@ export class FractionStatsComponent {
return;
}
let transportCountBlufor = 0, transportCountOpfor = 0;
for (const {transportEntry, index} of this.logData.transport.map((transportEntry, index) => ({
transportEntry,
index
for (const {transportEntry, index} of this.logData.transport.map((entry, pos) => ({
entry,
pos
}))) {
const transportEntryDate = new Date(transportEntry.time);
if (transportEntry.fraction === 'BLUFOR') {
@ -294,7 +294,7 @@ export class FractionStatsComponent {
} else {
transportCountOpfor++;
}
if (FractionStatsComponent.isTwoMinutesAhead(transportEntryDate, this.tmpTransportData) || index === this.logData.transport.length - 1) {
if (this.isTwoMinutesAhead(transportEntryDate, this.tmpTransportData) || index === this.logData.transport.length - 1) {
this.tmpTransportData[0].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountBlufor));
this.tmpTransportData[1].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountOpfor));
}
@ -327,7 +327,7 @@ export class FractionStatsComponent {
this.initialized.flag = true;
}
protected static isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
protected isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
return entryDate.getTime() >= tmpData[0].series[tmpData[0].series.length - 1].name.getTime() + (1.5 * 60000);
}
@ -342,7 +342,8 @@ export class FractionStatsComponent {
this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
[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 => {
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
});
@ -359,7 +360,8 @@ export class FractionStatsComponent {
} else {
for (const j in [0, 1]) {
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));
}
}
}

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, EventEmitter, Input, Output, SimpleChanges} from '@angular/core';
import {Component, ElementRef, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {War} from '../../../models/model-interfaces';
import {Fraction} from '../../../utils/fraction.enum';
import {PlayerUtils} from '../../../utils/player-utils';
@ -8,7 +8,7 @@ import {PlayerUtils} from '../../../utils/player-utils';
templateUrl: './scoreboard.component.html',
styleUrls: ['./scoreboard.component.css', '../../../style/list-entry.css', '../../../style/hide-scrollbar.css']
})
export class ScoreboardComponent {
export class ScoreboardComponent implements OnChanges {
readonly fraction = Fraction;
@ -24,7 +24,7 @@ export class ScoreboardComponent {
rows = [];
reorderable: boolean = false;
reorderable = false;
customClasses = {
sortAscending: 'glyphicon glyphicon-triangle-top',

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {WarService} from '../../services/logs/war.service';
import {War} from '../../models/model-interfaces';
@ -12,7 +12,7 @@ import {LogsService} from '../../services/logs/logs.service';
templateUrl: './war-detail.component.html',
styleUrls: ['./war-detail.component.css', '../../style/list-entry.css', '../../style/hide-scrollbar.css']
})
export class WarDetailComponent {
export class WarDetailComponent implements OnInit {
readonly fraction = Fraction;

View File

@ -1,4 +1,4 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from '@angular/core';
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {War} from '../../models/model-interfaces';
import {LoginService} from '../../services/app-user-service/login-service';
@ -6,19 +6,17 @@ import {LoginService} from '../../services/app-user-service/login-service';
selector: 'pjm-war-item',
templateUrl: './war-item.component.html',
styleUrls: ['./war-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['war', 'selected'],
outputs: ['warSelected', 'warDelete']
changeDetection: ChangeDetectionStrategy.OnPush
})
export class WarItemComponent {
export class WarItemComponent implements OnInit {
selected: boolean;
@Input() selected: boolean;
war: War;
@Input() war: War;
warSelected = new EventEmitter();
@Output() warSelected = new EventEmitter();
warDelete = new EventEmitter();
@Output() warDelete = new EventEmitter();
constructor(public loginService: LoginService) {
}
@ -27,7 +25,7 @@ export class WarItemComponent {
}
select() {
this.warSelected.emit(this.war._id)
this.warSelected.emit(this.war._id);
}
delete() {

View File

@ -1,4 +1,4 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Award, Decoration} from '../../models/model-interfaces';
import {NgForm} from '@angular/forms';
@ -11,7 +11,7 @@ import {Fraction} from '../../utils/fraction.enum';
templateUrl: './award-user.component.html',
styleUrls: ['./award-user.component.css', '../../style/overview.css', '../../style/hide-scrollbar.css'],
})
export class AwardUserComponent {
export class AwardUserComponent implements OnInit {
@ViewChild(NgForm) form: NgForm;

View File

@ -1,10 +1,10 @@
import {Component, ViewChild} from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Rank, Squad, User} from '../../models/model-interfaces';
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 {Subscription} from 'rxjs/Subscription';
import {NgForm} from '@angular/forms';
import {Fraction} from '../../utils/fraction.enum';
@ -13,7 +13,7 @@ import {Fraction} from '../../utils/fraction.enum';
templateUrl: './edit-user.component.html',
styleUrls: ['./edit-user.component.css', '../../style/entry-form.css', '../../style/overview.css'],
})
export class EditUserComponent {
export class EditUserComponent implements OnInit {
@ViewChild(NgForm) form: NgForm;

View File

@ -1,4 +1,4 @@
import {Component} from "@angular/core";
import {Component} from '@angular/core';
@Component({
selector: 'users',

View File

@ -2,7 +2,7 @@ export class ChartUtils {
public static getShortDateString(date): string {
const isoDate = date.slice(0, 10);
const dayDate = parseInt(isoDate.slice(8, 10));
const dayDate = parseInt(isoDate.slice(8, 10), 10);
return (dayDate < 10 ? '0' + dayDate : dayDate) + '.'
+ isoDate.slice(5, 7) + '.' + isoDate.slice(2, 4);
}
@ -20,7 +20,7 @@ export class ChartUtils {
obj.push({
'name': arg,
'series': []
})
});
}
return obj;
}

View File

@ -1,7 +1,7 @@
export class PlayerUtils {
public static isSteamUUID(input: string): boolean {
const steamUIDPattern = new RegExp("[0-9]{17}");
return steamUIDPattern.test(input)
const steamUIDPattern = new RegExp('[0-9]{17}');
return steamUIDPattern.test(input);
}
}

View File

@ -109,6 +109,7 @@
"component-selector": [
true,
"element",
"cc",
"kebab-case"
],
"use-input-property-decorator": true,