Add statistics menu dropdown

pull/1/head
Florian Hartwich 2017-07-08 22:50:01 +02:00
parent ee61271550
commit 8c3d944561
8 changed files with 33 additions and 6 deletions

View File

@ -4,6 +4,10 @@ const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const WarSchema = new Schema({
title: {
type: String,
required: true
},
date: {
type: Date,
required: true

View File

@ -27,7 +27,7 @@ const wars = express.Router();
wars.route('/')
.get((req, res, next) => {
const filter = {};
WarModel.find(filter, {}, {sort: {date: 'asc'}}, (err, items) => {
WarModel.find(filter, {}, {sort: {date: 'desc'}}, (err, items) => {
if (err) {
err.status = codes.servererror;
return next(err);

View File

@ -31,7 +31,7 @@ const awardingRouter = require('./routes/awardings');
const requestRouter = require('./routes/request');
const signatureRouter = require('./routes/signatures');
const commandRouter = require('./routes/command');
const warRouter = require('./routes/war');
const warRouter = require('./routes/wars');
// Configuration ***********************************
// mongoose promise setup

View File

@ -17,4 +17,4 @@ while IFS= read -r line; do
echo "$line"
echo ""
fi
done < <(grep -A 200 Scoreboard ${FILE} )
done < <(grep -A 100 Scoreboard ${FILE} )

View File

@ -21,6 +21,18 @@
<li routerLinkActive="active">
<a routerLink='/cc-overview' class="link">Armeeübersicht</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">
Schlacht Statistik
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li *ngFor="let war of wars">
<a [routerLink]="['/cc-wars/' + war._id]">{{war.title}} <small>{{war.date | date: 'dd.MM.yy'}}</small></a>
</li>
</ul>
</li>
<li *ngIf="loginService.hasPermission(2)" routerLinkActive="active">
<a routerLink='/cc-users' class="link">Teilnehmer</a>
</li>

View File

@ -7,6 +7,8 @@ import {
import {LoginService} from './services/login-service/login-service';
import {Title} from '@angular/platform-browser';
import {AUTH_ENABLED} from './app.tokens';
import {WarService} from "./services/war-service/war.service";
import {War} from "./models/model-interfaces";
@Component({
selector: 'app-root',
@ -17,8 +19,11 @@ export class AppComponent {
defaultTitle: string;
wars: War[] = [];
constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled,
private loginService: LoginService,
private warService: WarService,
private activatedRoute: ActivatedRoute,
private router: Router,
private titleService: Title) {
@ -31,7 +36,11 @@ export class AppComponent {
.filter(event => event instanceof NavigationEnd)
.subscribe(event => {
this.setBrowserTitle();
});
this.warService.getAllWars().subscribe((wars) => {
this.wars = wars;
})
}
setBrowserTitle() {

View File

@ -29,6 +29,7 @@ export interface Player {
}
export interface War {
_id?: string;
title?: string;
date?: Date;
ptBlufor?: number;
ptOpfor?: number;

View File

@ -1,7 +1,7 @@
<div class="overview" xmlns="http://www.w3.org/1999/html">
<div style="margin-left: 5%">
<h2>Schlacht vom {{war.date | date: 'dd.MM.yyyy'}}</h2>
<h2>{{war.title}} - Schlacht vom {{war.date | date: 'dd.MM.yyyy'}}</h2>
<h3 class="pull-left">
<h4>Endpunktestand:</h4>
<span class="text-blufor" style="font-weight: bold; margin-right: 10px">NATO {{war.ptBlufor}}</span>
@ -9,7 +9,8 @@
<span class="text-opfor" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} CSAT</span>
</h3>
<div style="margin-left: 50%; margin-top:5%">
<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>
<form class="form-group">
<label class="radio-inline">
<input type="radio" name="fractSelect"