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,11 +1,11 @@
#Operation Pandora Trigger Commandcenter # Operation Pandora Trigger Commandcenter
_RESTful API using express.js and mongoose with mongodb + Angular4 Frontend_ _MEAN Application_
##Installation ## Installation
##Development ## Development
##License Information ## License Information

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

View File

@ -21,7 +21,7 @@ server {
location / { location / {
gzip off; gzip off;
proxy_set_header X-Forwarded-Ssl on; 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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host; 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" "e2e": "ng e2e --serve=false"
}, },
"dependencies": { "dependencies": {
"@angular/common": "^4.1.1",
"@angular/cli": "1.0.5", "@angular/cli": "1.0.5",
"@angular/common": "^4.1.1",
"@angular/compiler": "^4.1.1", "@angular/compiler": "^4.1.1",
"@angular/compiler-cli": "^4.1.1", "@angular/compiler-cli": "^4.1.1",
"@angular/core": "^4.1.1", "@angular/core": "^4.1.1",
@ -22,6 +22,7 @@
"@angular/platform-browser": "^4.1.1", "@angular/platform-browser": "^4.1.1",
"@angular/platform-browser-dynamic": "^4.1.1", "@angular/platform-browser-dynamic": "^4.1.1",
"@angular/router": "^4.1.1", "@angular/router": "^4.1.1",
"angular2-datatable": "^0.6.0",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"jquery": "^3.1.0", "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 {PromotionService} from "./services/promotion-service/promotion.service";
import {FilterRankPipe} from "./filter/filter.pipe"; import {FilterRankPipe} from "./filter/filter.pipe";
import {WarService} from "./services/war-service/war.service"; import {WarService} from "./services/war-service/war.service";
import {DataTableModule} from "angular2-datatable";
@NgModule({ @NgModule({
imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule], imports: [BrowserModule, FormsModule, ReactiveFormsModule, appRouting, HttpModule, ClipboardModule, DataTableModule],
providers: [ providers: [
HttpClient, HttpClient,
LoginService, LoginService,

View File

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

View File

@ -10,7 +10,8 @@
</h3> </h3>
<div style="margin-left: 50%; margin-top:1%"> <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"> <form class="form-group">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="fractSelect" <input type="radio" name="fractSelect"
@ -37,19 +38,34 @@
<div class="pull-left" style="margin-top:20px;"> <div class="pull-left" style="margin-top:20px;">
<div class="table-container" style="width: 75%; min-width: 500px"> <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> <thead>
<tr class="table-head"> <tr class="table-head">
<th class="col-sm-2" style="border-radius: 10px 0 0 0;">Spieler</th> <th class="col-sm-2" style="border-radius: 10px 0 0 0;">
<th class="col-sm-1">Fraktion</th> <mfDefaultSorter by="name">Spieler</mfDefaultSorter>
<th class="col-sm-1">Kills</th> </th>
<th class="col-sm-1">FriendlyFire</th> <th class="col-sm-1">
<th class="col-sm-1">Eroberungen</th> <mfDefaultSorter by="fraction">Fraktion</mfDefaultSorter>
<th class="col-sm-1">Tode</th> </th>
<th class="col-sm-1" style="border-radius: 0 10px 0 0;">Respawn</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> </tr>
</thead> </thead>
<tbody *ngFor="let player of players"> <tbody *ngFor="let player of mf.data">
<tr class="cell-outline"> <tr class="cell-outline">
<td style="font-weight: bold" [ngClass]="player.fraction === 'BLUFOR' ? 'text-blufor' : 'text-opfor'"> <td style="font-weight: bold" [ngClass]="player.fraction === 'BLUFOR' ? 'text-blufor' : 'text-opfor'">
{{player.name}} {{player.name}}

View File

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