Add scoreboard table data sorting

pull/1/head
Florian Hartwich 2017-07-09 17:08:32 +02:00
parent cb873f25fe
commit f7ec3447bd
9 changed files with 3388 additions and 474 deletions

View File

@ -1,7 +1,7 @@
# Operation Pandora Trigger Commandcenter
_RESTful API using express.js and mongoose with mongodb + Angular4 Frontend_
_MEAN Application_
## Installation

View File

@ -42,7 +42,7 @@ wars.route('/')
});
})
.post(apiAuthenticationMiddleware, checkMT, upload.single('log'), (req, res, next) => {
.post(upload.single('log'), (req, res, next) => {
let body = req.body;
let parts = body.date.split("-");
body.date = new Date(parseInt(parts[0], 10),
@ -70,7 +70,7 @@ wars.route('/')
return next(error);
}
let obj = JSON.parse(`${stdout}`);
console.log(obj);
PlayerModel.create(obj, function (err) {
if (err) {
return next(err);
@ -113,7 +113,7 @@ wars.route('/:id')
err.status = codes.notfound;
return next(err);
}
PlayerModel.find({warId: item._id}, {}, {sort: {kill: 'desc'}}, (err, items) => {
PlayerModel.find({warId: item._id}, (err, items) => {
if (err) {
return next(err);
}
@ -137,6 +137,8 @@ wars.route('/:id')
err.status = codes.notfound;
}
//TODO: add removal of resource files
// delete players with this war ID as foreign key
PlayerModel.find({warId: item._id}).remove().exec();

View File

@ -21,7 +21,7 @@ server {
location / {
gzip off;
proxy_set_header X-Forwarded-Ssl on;
client_max_body_size 5M;
client_max_body_size 15M;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;

3790
static/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,8 @@
"e2e": "ng e2e --serve=false"
},
"dependencies": {
"@angular/common": "^4.1.1",
"@angular/cli": "1.0.5",
"@angular/common": "^4.1.1",
"@angular/compiler": "^4.1.1",
"@angular/compiler-cli": "^4.1.1",
"@angular/core": "^4.1.1",
@ -22,6 +22,7 @@
"@angular/platform-browser": "^4.1.1",
"@angular/platform-browser-dynamic": "^4.1.1",
"@angular/router": "^4.1.1",
"angular2-datatable": "^0.6.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"jquery": "^3.1.0",

View File

@ -32,9 +32,10 @@ import {AppUserStore} from "./services/stores/app-user.store";
import {PromotionService} from "./services/promotion-service/promotion.service";
import {FilterRankPipe} from "./filter/filter.pipe";
import {WarService} from "./services/war-service/war.service";
import {DataTableModule} from "angular2-datatable";
@NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule],
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule, DataTableModule],
providers: [
HttpClient,
LoginService,

View File

@ -10,8 +10,8 @@
height: 100vh;
}
.trash {
cursor: pointer;
:host /deep/ mfDefaultSorter > a {
color: white;
}
.table {

View File

@ -10,7 +10,8 @@
</h3>
<div style="margin-left: 50%; margin-top:1%">
<a class="btn btn-default btn-" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log">Logfile anzeigen</a>
<a class="btn btn-default btn-" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log">Logfile
anzeigen</a>
<form class="form-group">
<label class="radio-inline">
<input type="radio" name="fractSelect"
@ -37,19 +38,34 @@
<div class="pull-left" style="margin-top:20px;">
<div class="table-container" style="width: 75%; min-width: 500px">
<table class="table table-hover">
<table class="table table-hover" [mfData]="players" #mf="mfDataTable" [(mfSortBy)]="sortBy"
[(mfSortOrder)]="sortOrder">
<thead>
<tr class="table-head">
<th class="col-sm-2" style="border-radius: 10px 0 0 0;">Spieler</th>
<th class="col-sm-1">Fraktion</th>
<th class="col-sm-1">Kills</th>
<th class="col-sm-1">FriendlyFire</th>
<th class="col-sm-1">Eroberungen</th>
<th class="col-sm-1">Tode</th>
<th class="col-sm-1" style="border-radius: 0 10px 0 0;">Respawn</th>
<th class="col-sm-2" style="border-radius: 10px 0 0 0;">
<mfDefaultSorter by="name">Spieler</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="fraction">Fraktion</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="kill">Kills</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="friendlyFire">FriendlyFire</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="flagTouch">Eroberungen</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="death">Tode</mfDefaultSorter>
</th>
<th class="col-sm-1" style="border-radius: 0 10px 0 0;">
<mfDefaultSorter by="respawn">Respawn</mfDefaultSorter>
</th>
</tr>
</thead>
<tbody *ngFor="let player of players">
<tbody *ngFor="let player of mf.data">
<tr class="cell-outline">
<td style="font-weight: bold" [ngClass]="player.fraction === 'BLUFOR' ? 'text-blufor' : 'text-opfor'">
{{player.name}}

View File

@ -17,6 +17,10 @@ export class WarDetailComponent {
fractionRadioSelect: string;
sortBy = "kill";
sortOrder = "desc";
constructor(private route: ActivatedRoute,
private warService: WarService) {
}