Make overview and war stats available via direct url

pull/11/head
Florian Hartwich 2017-10-06 21:41:59 +02:00
parent a7020b3208
commit 0c7d8c7716
3 changed files with 26 additions and 6 deletions

View File

@ -1,4 +1,4 @@
<div style="width: 1100px; margin:auto; position: relative;left: -1%;">
<div style="width: 1100px; margin:auto; position: relative;">
<h1>Übersicht über alle Spieler, Squads und Armeen</h1>
<div class="pull-left" style="width: 45%;">

View File

@ -20,7 +20,7 @@ export class StatisticOverviewComponent {
pointData: any[] = [];
pointSumData: any[] = [];
playerData: any[] = [];
currentData : any[];
currentData: any[] = [];
activeSlideIndex;
colorScheme = {
@ -78,9 +78,18 @@ export class StatisticOverviewComponent {
goToSlide(index: number) {
switch (index) {
case 0: this.currentData = this.pointSumData; this.yAxisLabel="Gesamtpunkte"; break;
case 1: this.currentData = this.pointData; this.yAxisLabel="Punkte"; break;
case 2: this.currentData = this.playerData; this.yAxisLabel="Anzahl Spieler"; break;
case 0:
this.currentData = this.pointSumData;
this.yAxisLabel = "Gesamtpunkte";
break;
case 1:
this.currentData = this.pointData;
this.yAxisLabel = "Punkte";
break;
case 2:
this.currentData = this.playerData;
this.yAxisLabel = "Anzahl Spieler";
break;
}
this.activeSlideIndex = index;

View File

@ -4,6 +4,7 @@ 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 {RouteConfig} from "../../app.config";
@Component({
selector: 'war-list',
@ -25,9 +26,19 @@ export class WarListComponent implements OnInit {
ngOnInit() {
this.campaignService.getAllCampaigns().subscribe((items) => {
const subPathWar = 'war/';
const subPathOverview = 'overview/';
this.campaignService.campaigns = items;
this.campaigns = items;
const url = this.router.url;
if (url.endsWith(RouteConfig.statsPath)) {
this.selectOverview(this.campaigns[0]._id);
} else if (url.indexOf(subPathWar) !== -1) {
this.selectedWarId = url.substring(url.lastIndexOf(subPathWar) + subPathWar.length, url.lastIndexOf(")"));
} else if (url.indexOf(subPathOverview) !== -1) {
this.selectedWarId = url.substring(url.lastIndexOf(subPathOverview) + subPathOverview.length, url.lastIndexOf(")"));
}
});
}