From 0fa03820cb9d1f8777bc5510c184ea3f3edb5376 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Mon, 2 Oct 2017 20:03:42 +0200 Subject: [PATCH] make war detail row clickable --- static/src/app/app.routing.ts | 8 ++++---- .../campaign-player-detail.component.html | 8 +------- .../campaign-player-detail.component.ts | 3 ++- .../statistic/overview/stats-overview.component.html | 2 -- static/src/app/statistic/stats.module.ts | 2 +- .../statistic/war-detail/war-detail.component.css | 2 +- .../statistic/war-detail/war-detail.component.html | 6 ++++-- .../app/statistic/war-detail/war-detail.component.ts | 12 +++++++----- 8 files changed, 20 insertions(+), 23 deletions(-) diff --git a/static/src/app/app.routing.ts b/static/src/app/app.routing.ts index 767f6cd..47e9acd 100644 --- a/static/src/app/app.routing.ts +++ b/static/src/app/app.routing.ts @@ -62,10 +62,10 @@ export const appRoutes: Routes = [ path: '404', component: NotFoundComponent }, - // { - // path: '**', - // redirectTo: '/404' - // } // always configure this last - first matching route gets processed + { + path: '**', + redirectTo: '/404' + } // always configure this last - first matching route gets processed ]; export const appRouting = RouterModule.forRoot(appRoutes); diff --git a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html index 272d3e6..9542f3f 100644 --- a/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html +++ b/static/src/app/statistic/campaign-player-detail/campaign-player-detail.component.html @@ -23,7 +23,7 @@ [scheme]="colorScheme" [value]="respawnDeathRatio" [previousValue]="0.5" - [max]="1" + [max]="maxRespawnDeathRatio" [min]="0" [units]="'Respawn/Death'"> @@ -54,7 +54,6 @@ [xAxis]="xAxis" [yAxis]="yAxis" [legend]="legend" - [legendTitle]="legendTitle" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [yAxisLabel]="yAxisKill" @@ -75,7 +74,6 @@ [xAxis]="xAxis" [yAxis]="yAxis" [legend]="legend" - [legendTitle]="legendTitle" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [yAxisLabel]="yAxisFriendlyFire" @@ -96,7 +94,6 @@ [xAxis]="xAxis" [yAxis]="yAxis" [legend]="legend" - [legendTitle]="legendTitle" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [yAxisLabel]="yAxisDeath" @@ -117,7 +114,6 @@ [xAxis]="xAxis" [yAxis]="yAxis" [legend]="legend" - [legendTitle]="legendTitle" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [yAxisLabel]="yAxisRespawn" @@ -138,7 +134,6 @@ [xAxis]="xAxis" [yAxis]="yAxis" [legend]="legend" - [legendTitle]="legendTitle" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [yAxisLabel]="yAxisRevive" @@ -159,7 +154,6 @@ [xAxis]="xAxis" [yAxis]="yAxis" [legend]="legend" - [legendTitle]="legendTitle" [showXAxisLabel]="showXAxisLabel" [showYAxisLabel]="showYAxisLabel" [yAxisLabel]="yAxisCapture" 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 5733f16..7ccd760 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 @@ -52,7 +52,6 @@ export class CampaignPlayerDetailComponent { xAxis = true; yAxis = true; legend = false; - legendTitle = ''; showXAxisLabel = true; showYAxisLabel = true; autoscale = false; @@ -68,7 +67,9 @@ export class CampaignPlayerDetailComponent { kdRatio = 0; maxKd = 1.7; + respawnDeathRatio = 0; + maxRespawnDeathRatio = 1; constructor(private route: ActivatedRoute, diff --git a/static/src/app/statistic/overview/stats-overview.component.html b/static/src/app/statistic/overview/stats-overview.component.html index 91163ea..7ab2b59 100644 --- a/static/src/app/statistic/overview/stats-overview.component.html +++ b/static/src/app/statistic/overview/stats-overview.component.html @@ -10,8 +10,6 @@ (click)="goToSlide(1)">Spielerzahlen - -
diff --git a/static/src/app/statistic/stats.module.ts b/static/src/app/statistic/stats.module.ts index 58965d7..e2edbc4 100644 --- a/static/src/app/statistic/stats.module.ts +++ b/static/src/app/statistic/stats.module.ts @@ -3,7 +3,7 @@ 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 {GaugeModule, LineChartModule, NgxChartsModule, PieChartModule} from "@swimlane/ngx-charts"; +import {NgxChartsModule} from "@swimlane/ngx-charts"; import {AccordionModule, CarouselModule} from "ngx-bootstrap"; import {CampaignService} from "../services/campaign-service/campaign.service"; import {NgxDatatableModule} from "@swimlane/ngx-datatable"; diff --git a/static/src/app/statistic/war-detail/war-detail.component.css b/static/src/app/statistic/war-detail/war-detail.component.css index 06ae73a..454c430 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.css +++ b/static/src/app/statistic/war-detail/war-detail.component.css @@ -13,7 +13,6 @@ .player-name { font-weight: bold; - cursor: pointer; } .text-opfor { @@ -52,6 +51,7 @@ :host /deep/ .datatable-body-row { color: #222222; border-bottom: 1px solid grey; + cursor: pointer; } :host /deep/ .datatable-body-row:hover { diff --git a/static/src/app/statistic/war-detail/war-detail.component.html b/static/src/app/statistic/war-detail/war-detail.component.html index dd55dba..fa69568 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.html +++ b/static/src/app/statistic/war-detail/war-detail.component.html @@ -57,10 +57,12 @@ [messages]="{emptyMessage: 'Loading...'}" [headerHeight]="cellHeight" [rowHeight]="cellHeight" - [cssClasses]='customClasses'> + [cssClasses]='customClasses' + [selectionType]="'single'" + (select)="selectPlayerDetail($event)"> - {{value}} 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 c112347..3695170 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.ts +++ b/static/src/app/statistic/war-detail/war-detail.component.ts @@ -55,11 +55,6 @@ export class WarDetailComponent { }); } - selectPlayerDetail(playerName) { - this.router.navigate(['../../campaign-player/' + this.war.campaign + '/' + playerName], - {relativeTo: this.route}); - } - filterPlayersByFraction(fraction: string) { if (fraction) { this.rows = this.war.players.filter((player) => { @@ -70,4 +65,11 @@ export class WarDetailComponent { } } + selectPlayerDetail(player) { + if (player && player.selected && player.selected.length > 0) { + this.router.navigate(['../../campaign-player/' + this.war.campaign + '/' + player.selected[0].name], + {relativeTo: this.route}); + } + } + }