Compare commits

..

6 Commits

Author SHA1 Message Date
Florian Hartwich bfa1913231 Add basic statistic page 2017-07-29 12:59:51 +02:00
Florian Hartwich a7e9c5e865 Merge branch 'master' of git.noarch.de:hardi/opt-cc into feature/statistic-charts 2017-07-29 12:24:13 +02:00
Florian Hartwich 99696a8de1 Add uglify-js to package 2017-07-29 11:55:57 +02:00
hardi 2f932a70a7 Merge branch 'task/minified-ng-output' of hardi/opt-cc into master 2017-07-29 11:48:54 +02:00
Florian Hartwich 1876b31eb4 Minify webpack output 2017-07-29 11:46:01 +02:00
Florian Hartwich 965068f544 Fix type compilation errors 2017-07-29 11:23:37 +02:00
17 changed files with 5417 additions and 2021 deletions

2540
api/package-lock.json generated

File diff suppressed because it is too large Load Diff

11
minify.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# array of files to minify
FILES=(inline main polyfills scripts styles vendor)
OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}"
do
echo "minify ${i} ..."
$(npm bin)/uglifyjs public/${i}.bundle.js ${OPTIONS} -o public/${i}.bundle.js
done

208
package-lock.json generated
View File

@ -2,12 +2,17 @@
"name": "opt-cc",
"version": "1.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ajv": {
"version": "4.11.8",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz",
"integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=",
"dev": true
"dev": true,
"requires": {
"co": "4.6.0",
"json-stable-stringify": "1.0.1"
}
},
"ansi-regex": {
"version": "0.2.1",
@ -56,13 +61,19 @@
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
"dev": true,
"optional": true
"optional": true,
"requires": {
"tweetnacl": "0.14.5"
}
},
"boom": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
"dev": true,
"requires": {
"hoek": "2.16.3"
},
"dependencies": {
"hoek": {
"version": "2.16.3",
@ -83,6 +94,13 @@
"resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
"integrity": "sha1-Zjs6ZItotV0EaQ1JFnqoN4WPIXQ=",
"dev": true,
"requires": {
"ansi-styles": "1.1.0",
"escape-string-regexp": "1.0.5",
"has-ansi": "0.1.0",
"strip-ansi": "0.3.0",
"supports-color": "0.2.0"
},
"dependencies": {
"supports-color": {
"version": "0.2.0",
@ -102,19 +120,31 @@
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
"integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=",
"dev": true
"dev": true,
"requires": {
"delayed-stream": "1.0.0"
}
},
"commander": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz",
"integrity": "sha1-nfflL7Kgyw+4kFjugMMQQiXzfh0=",
"dev": true
"integrity": "sha1-nfflL7Kgyw+4kFjugMMQQiXzfh0="
},
"concurrently": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-3.5.0.tgz",
"integrity": "sha1-jPG3cHppFqeKT/W3e7BN7FSzebI=",
"dev": true
"dev": true,
"requires": {
"chalk": "0.5.1",
"commander": "2.6.0",
"date-fns": "1.28.5",
"lodash": "4.17.4",
"rx": "2.3.24",
"spawn-command": "0.0.2-1",
"supports-color": "3.2.3",
"tree-kill": "1.1.0"
}
},
"core-js": {
"version": "2.4.1",
@ -126,13 +156,19 @@
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=",
"dev": true
"dev": true,
"requires": {
"boom": "2.10.1"
}
},
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"dev": true,
"requires": {
"assert-plus": "1.0.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
@ -159,7 +195,10 @@
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
"dev": true,
"optional": true
"optional": true,
"requires": {
"jsbn": "0.1.1"
}
},
"escape-string-regexp": {
"version": "1.0.5",
@ -189,13 +228,21 @@
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
"integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=",
"dev": true
"dev": true,
"requires": {
"asynckit": "0.4.0",
"combined-stream": "1.0.5",
"mime-types": "2.1.15"
}
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"dev": true,
"requires": {
"assert-plus": "1.0.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
@ -215,13 +262,20 @@
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz",
"integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=",
"dev": true
"dev": true,
"requires": {
"ajv": "4.11.8",
"har-schema": "1.0.5"
}
},
"has-ansi": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
"integrity": "sha1-hPJlqujA5qiKEtcCKJS3VoiUxi4=",
"dev": true
"dev": true,
"requires": {
"ansi-regex": "0.2.1"
}
},
"has-flag": {
"version": "1.0.0",
@ -234,6 +288,12 @@
"resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz",
"integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=",
"dev": true,
"requires": {
"boom": "2.10.1",
"cryptiles": "2.0.5",
"hoek": "2.16.3",
"sntp": "1.0.9"
},
"dependencies": {
"hoek": {
"version": "2.16.3",
@ -253,7 +313,12 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
"dev": true
"dev": true,
"requires": {
"assert-plus": "0.2.0",
"jsprim": "1.4.0",
"sshpk": "1.13.1"
}
},
"is-typedarray": {
"version": "1.0.0",
@ -283,7 +348,14 @@
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz",
"integrity": "sha1-M4WseQGSEwy+Iw6ALsAskhW7/to=",
"dev": true
"dev": true,
"requires": {
"hoek": "4.1.1",
"isemail": "2.2.1",
"items": "2.1.1",
"moment": "2.18.1",
"topo": "2.0.2"
}
},
"jsbn": {
"version": "0.1.1",
@ -302,7 +374,10 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
"integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
"dev": true
"dev": true,
"requires": {
"jsonify": "0.0.0"
}
},
"json-stringify-safe": {
"version": "5.0.1",
@ -321,6 +396,12 @@
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz",
"integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.0.2",
"json-schema": "0.2.3",
"verror": "1.3.6"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
@ -346,7 +427,10 @@
"version": "2.1.15",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz",
"integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=",
"dev": true
"dev": true,
"requires": {
"mime-db": "1.27.0"
}
},
"minimist": {
"version": "1.2.0",
@ -388,7 +472,31 @@
"version": "2.81.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz",
"integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=",
"dev": true
"dev": true,
"requires": {
"aws-sign2": "0.6.0",
"aws4": "1.6.0",
"caseless": "0.12.0",
"combined-stream": "1.0.5",
"extend": "3.0.1",
"forever-agent": "0.6.1",
"form-data": "2.1.4",
"har-validator": "4.2.1",
"hawk": "3.1.3",
"http-signature": "1.1.1",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.15",
"oauth-sign": "0.8.2",
"performance-now": "0.2.0",
"qs": "6.4.0",
"safe-buffer": "5.1.1",
"stringstream": "0.0.5",
"tough-cookie": "2.3.2",
"tunnel-agent": "0.6.0",
"uuid": "3.1.0"
}
},
"rx": {
"version": "2.3.24",
@ -399,7 +507,7 @@
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
"integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=",
"dev": true
},
"sntp": {
@ -407,6 +515,9 @@
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz",
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=",
"dev": true,
"requires": {
"hoek": "2.16.3"
},
"dependencies": {
"hoek": {
"version": "2.16.3",
@ -416,6 +527,11 @@
}
}
},
"source-map": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz",
"integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI="
},
"spawn-command": {
"version": "0.0.2-1",
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
@ -427,6 +543,16 @@
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",
"integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=",
"dev": true,
"requires": {
"asn1": "0.2.3",
"assert-plus": "1.0.0",
"bcrypt-pbkdf": "1.0.1",
"dashdash": "1.14.1",
"ecc-jsbn": "0.1.1",
"getpass": "0.1.7",
"jsbn": "0.1.1",
"tweetnacl": "0.14.5"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
@ -446,25 +572,37 @@
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
"integrity": "sha1-JfSOoiynkYfzF0pNuHWTR7sSYiA=",
"dev": true
"dev": true,
"requires": {
"ansi-regex": "0.2.1"
}
},
"supports-color": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz",
"integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=",
"dev": true
"dev": true,
"requires": {
"has-flag": "1.0.0"
}
},
"topo": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
"integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=",
"dev": true
"dev": true,
"requires": {
"hoek": "4.1.1"
}
},
"tough-cookie": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz",
"integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=",
"dev": true
"dev": true,
"requires": {
"punycode": "1.4.1"
}
},
"tree-kill": {
"version": "1.1.0",
@ -476,7 +614,10 @@
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"tweetnacl": {
"version": "0.14.5",
@ -485,23 +626,42 @@
"dev": true,
"optional": true
},
"uglify-js": {
"version": "3.0.26",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.0.26.tgz",
"integrity": "sha512-+D/BjzuvT1oRMSkH0fuF3M/BCvDxDywmZasd1UTPPHsdsHZqJEAZSvrojgFlS7lrM3ZZWq5h7Bb5i96X1TbOJw==",
"requires": {
"commander": "2.6.0",
"source-map": "0.5.6"
}
},
"uuid": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
"integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==",
"integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=",
"dev": true
},
"verror": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz",
"integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=",
"dev": true
"dev": true,
"requires": {
"extsprintf": "1.0.2"
}
},
"wait-on": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-2.0.2.tgz",
"integrity": "sha1-CoT9BwJMb8Joyw6r5YW+IXqvK6o=",
"dev": true,
"requires": {
"core-js": "2.4.1",
"joi": "9.2.0",
"minimist": "1.2.0",
"request": "2.81.0",
"rx": "4.1.0"
},
"dependencies": {
"rx": {
"version": "4.1.0",

View File

@ -7,7 +7,8 @@
"start": "npm run deploy-static-prod && npm start --prefix ./api",
"dev": "npm run deploy-static && npm run dev --prefix ./api",
"deploy-static": "cd ./static && $(npm bin)/ng build && ln -s ../api/resource/ ../public/resource",
"deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource",
"deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource && cd .. && npm run deploy-minify",
"deploy-minify": "./minify.sh",
"postinstall": "npm install --prefix ./static && npm install --prefix ./api",
"mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data",
"test": "npm test --prefix ./api",
@ -18,5 +19,8 @@
"devDependencies": {
"concurrently": "^3.4.0",
"wait-on": "^2.0.2"
},
"dependencies": {
"uglify-js": "^3.0.26"
}
}

4446
static/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,9 @@
<li *ngIf="loginService.hasPermission(3)">
<a routerLink='/cc-wars' class="link">Hinzufügen...</a>
</li>
<li>
<a routerLink='/cc-statistic' class="link">Übersicht</a>
</li>
<li *ngFor="let war of wars">
<a [routerLink]="['/cc-wars/' + war._id]">{{war.title}}
<small>{{war.date | date: 'dd.MM.yy'}}</small>

View File

@ -14,6 +14,7 @@ import {RequestPromotionComponent} from "./request/promotion/req-promotion.compo
import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component";
import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component";
import {warRoutes, warsRoutingComponents} from "./wars/wars.routing";
import {StatisticComponent} from "./statistic/statistic.component";
export const appRoutes: Routes = [
@ -22,6 +23,7 @@ export const appRoutes: Routes = [
{path: '', redirectTo: '/cc-overview', pathMatch: 'full'},
{path: 'cc-wars', children: warRoutes},
{path: 'cc-statistic', component: StatisticComponent},
{path: 'login', component: LoginComponent},
{path: 'signup', component: SignupComponent},
@ -46,7 +48,7 @@ export const appRoutes: Routes = [
export const appRouting = RouterModule.forRoot(appRoutes);
export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent,
ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, ...usersRoutingComponents,
ConfirmPromotionComponent, StatisticComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent, ...usersRoutingComponents,
...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents, ...warsRoutingComponents];
export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin];

View File

@ -2,24 +2,6 @@
<div style="width: 1200px; margin-left: 25%">
<ngx-charts-line-chart
[view]="view"
[scheme]="colorScheme"
[results]="chartData"
[gradient]="gradient"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[legend]="showLegend"
[legendTitle]="legendTitle"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[autoScale]="autoScale"
[timeline]="timeline"
(select)="onSelect($event)">
</ngx-charts-line-chart>
<div class="div-table" style="width: 490px; float:left">
<h3 class="text-blufor army-head">NATO</h3>
<div *ngFor="let squad of army.NATO.squads" style="outline:1px solid #D4D4D4;">

View File

@ -1,8 +1,7 @@
import {Component} from "@angular/core";
import {Army, War} from "../models/model-interfaces";
import {Army} from "../models/model-interfaces";
import {ArmyService} from "../services/army-service/army.service";
import {ActivatedRoute, Router} from "@angular/router";
import {WarService} from "../services/war-service/war.service";
@Component({
@ -14,34 +13,9 @@ export class ArmyComponent {
army: Army = {NATO: {squads: [], memberCount: 0}, CSAT: {squads: [], memberCount: 0}};
chartData: any[] = [];
view: any[] = [700, 400];
// options
showXAxis = true;
showYAxis = true;
timeline=true;
gradient = false;
showLegend = true;
legendTitle = "";
showXAxisLabel = true;
xAxisLabel = 'Schlachtdatum';
showYAxisLabel = true;
yAxisLabel = 'Punkte';
colorScheme = {
domain: ['#0000FF', '#B22222', '#C7B42C', '#AAAAAA']
};
// line, area
autoScale = false;
constructor(private router: Router,
private route: ActivatedRoute,
private armyService: ArmyService,
private warService: WarService) {
Object.assign(this, this.chartData)
private armyService: ArmyService) {
}
ngOnInit() {
@ -49,39 +23,10 @@ export class ArmyComponent {
.subscribe(army => {
this.army = army;
});
this.warService.getAllWars()
.subscribe((wars) => {
let updateObj = [{
"name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}];
for (let i = 0; i < wars.length; i++) {
let warDateString = wars[i].date;
let bluforData = {
name: warDateString,
value: wars[i].ptBlufor
};
updateObj[0].series.push(bluforData);
let opforData = {
name: warDateString,
value: wars[i].ptOpfor
};
updateObj[1].series.push(opforData);
}
this.chartData = updateObj;
})
};
select(memberId) {
this.router.navigate(['member', memberId], {relativeTo: this.route});
}
onSelect(event) {
console.log(event);
}
}

View File

@ -11,7 +11,7 @@ export interface User {
_id?: string;
boardUserId?: number;
username?: string;
squad?: Squad;
squad?: any; //Squad or string
rank?: Rank;
awards?: Award[];
}
@ -54,7 +54,7 @@ export interface Rank {
export interface Award {
_id?: string,
userId: string,
decorationId?: Decoration;
decorationId?: any; //Decoration or string
reason?: string;
proposer?: AppUser;
date?: number; // since Date.now() returns a number

View File

@ -79,7 +79,7 @@ export class RequestAwardComponent {
addAwarding(previewImage, descriptionField) {
if (this.decoration._id && this.reason.length > 0) {
const award = {
const award : Award = {
"userId": this.user._id,
"decorationId": this.decoration._id,
"reason": this.reason,

View File

@ -0,0 +1,48 @@
h1 {
width: 920px;
margin-bottom: 50px;
margin-left: 25%
}
img {
margin-top: 10px;
padding-right: 30px;
}
.div-table {
display: table;
border-radius: 10px;
margin-left: 1%;
width: auto;
border-spacing: 5px; /* cellspacing:poor IE support for this */
}
.div-table-row {
display: table-row;
width: auto;
clear: both;
}
.div-table-col {
float: left; /* fix for buggy browsers */
display: table-column;
padding: 5px 15px 5px 15px;
}
.army-head {
font-weight: bolder;
text-align: center
}
.member-link {
cursor: pointer;
text-decoration: underline;
}
.text-opfor {
color: firebrick;
}
.text-blufor {
color: blue;
}

View File

@ -0,0 +1,23 @@
<h3>Statistik</h3>
<div style="width: 1200px; margin-left: 25%">
<ngx-charts-line-chart
[view]="[1050, 400]"
[scheme]="colorScheme"
[results]="chartData"
[gradient]="false"
[xAxis]="true"
[yAxis]="true"
[legend]="true"
[legendTitle]="''"
[showXAxisLabel]="true"
[showYAxisLabel]="true"
[xAxisLabel]="Schlachtdatum"
[yAxisLabel]="Punkte"
[autoScale]="false"
[timeline]="true"
(select)="onSelect($event)">
</ngx-charts-line-chart>
</div>

View File

@ -0,0 +1,54 @@
import {Component} from "@angular/core";
import {WarService} from "../services/war-service/war.service";
@Component({
selector: 'statistic',
templateUrl: './statistic.component.html',
styleUrls: ['./statistic.component.css']
})
export class StatisticComponent {
chartData: any[] = [];
colorScheme = {
domain: ['#0000FF', '#B22222', '#C7B42C', '#AAAAAA']
};
constructor(private warService: WarService) {
Object.assign(this, this.chartData)
}
ngOnInit() {
this.warService.getAllWars()
.subscribe((wars) => {
let updateObj = [{
"name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}];
for (let i = 0; i < wars.length; i++) {
let warDateString = new Date(wars[i].date);
let bluforData = {
name: warDateString,
value: wars[i].ptBlufor
};
updateObj[0].series.push(bluforData);
let opforData = {
name: warDateString,
value: wars[i].ptOpfor
};
updateObj[1].series.push(opforData);
}
this.chartData = updateObj;
})
};
onSelect(event) {
console.log(event);
}
}

View File

@ -4,7 +4,7 @@
<div class="form-group">
<label for="title">Name</label>
<input type="text" class="form-control"
<input class="form-control"
[(ngModel)]="user.username"
name="title"
id="title"

View File

@ -1,10 +1,10 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"lib": [
"es2016",
"dom"
],
"lib": [
"es2016",
"dom"
],
"outDir": "../out-tsc/app",
"target": "es5",
"module": "es2015",

View File

@ -2,7 +2,7 @@
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"sourceMap": false,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,