Merge branch 'release/v1.6.3' of hardi/opt-cc into master

feature/player-war-detail v1.6.3
hardi 2017-11-10 15:18:28 +01:00 committed by HardiReady
commit 3dc348e5a5
50 changed files with 14727 additions and 171 deletions

10
.gitignore vendored
View File

@ -7,10 +7,10 @@ etc/
# dependencies
node_modules
package-lock.json
# IDEs and editors
/.idea
.idea/
*/nbproject*
.project
.classpath
.c9/
@ -43,14 +43,12 @@ testem.log
Thumbs.db
.directory
# Internal Data
/public
resource/
mongodb-data/
backup/
.idea/
*/nbproject*
# System
.npm/
.bash_history
.bash_logout

4942
api/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,9 @@ const AppUserModel = require('../models/app-user');
const account = express.Router();
account.route('/')
.get((req, res, next) => {
AppUserModel.find({}).populate('squad').exec((err, items) => {
AppUserModel.find({}, {}, {sort: {username: 1}}).populate('squad').exec((err, items) => {
if (err) {
err.status = codes.servererror;
return next(err);
@ -81,10 +80,8 @@ account.route('/:id')
routerHandling.httpMethodNotAllowed
);
// this middleware function can be used, if you like or remove it
// it looks for object(s) in res.locals.items and if they exist, they are send to the client as json
account.use(routerHandling.emptyResponse);
module.exports = account;

View File

@ -22,10 +22,10 @@ overview.route('/')
let countOpfor = 0;
let countBlufor = 0;
const armyOverview = {
NATO: {
BLUFOR: {
squads: []
},
CSAT: {
OPFOR: {
squads: []
}
};
@ -72,12 +72,12 @@ overview.route('/')
s.memberCount = squadMembers.length;
if (s.fraction === 'BLUFOR') {
delete s.fraction;
armyOverview.NATO.squads.push(s);
armyOverview.BLUFOR.squads.push(s);
countBlufor += s.members.length;
}
if (s.fraction === 'OPFOR') {
delete s.fraction;
armyOverview.CSAT.squads.push(s);
armyOverview.OPFOR.squads.push(s);
countOpfor += s.members.length;
}
callback();
@ -88,8 +88,8 @@ overview.route('/')
if (err) {
return next(err);
}
armyOverview.NATO.memberCount = countBlufor;
armyOverview.CSAT.memberCount = countOpfor;
armyOverview.BLUFOR.memberCount = countBlufor;
armyOverview.OPFOR.memberCount = countOpfor;
res.locals.items = armyOverview;
res.locals.processed = true;
next();

View File

@ -17,13 +17,12 @@ const parseWarLog = (lineArray, war) => {
players: []
};
const addPlayersIfNotExists = (inputPlayers) => {
inputPlayers.forEach(player => {
const addPlayerIfNotExists = (inputPlayer) => {
const player = getPlayerAndFractionFromString(inputPlayer);
if (player && player.name && player.fraction && !playerArrayContains(stats.players, player)) {
player['warId'] = war._id;
stats.players.push(player);
}
})
};
lineArray.some(line => {
@ -52,14 +51,12 @@ const parseWarLog = (lineArray, war) => {
friendlyFire: shooter ? target.fraction === shooter.fraction : false,
fraction: shooter ? shooter.fraction : 'NONE'
});
addPlayersIfNotExists([shooter, target]);
}
/**
* BUDGET
*/
if (line.includes('Budget')) {
else if (line.includes('Budget')) {
stats.clean.push(line);
const budg = line.split(' ');
if (line.includes('Endbudget')) {
@ -79,7 +76,7 @@ const parseWarLog = (lineArray, war) => {
/**
* FLAG
*/
if (line.includes('Fahne')) {
else if (line.includes('Fahne')) {
stats.clean.push(line);
const playerName = line.substring(line.lastIndexOf('t von ') + 6, line.lastIndexOf(' :OPT LOG END'));
const flagFraction = line.includes('NATO Flagge') ? 'BLUFOR' : 'OPFOR';
@ -97,7 +94,7 @@ const parseWarLog = (lineArray, war) => {
/**
* POINTS
*/
if (line.includes('Punkte')) {
else if (line.includes('Punkte')) {
stats.clean.push(line);
const pt = line.split(' ');
@ -114,7 +111,7 @@ const parseWarLog = (lineArray, war) => {
/**
* RESPAWN
*/
if (line.includes('Respawn')) {
else if (line.includes('Respawn')) {
stats.clean.push(line);
const resp = line.split(' ');
const playerName = line.substring(line.lastIndexOf('Spieler:') + 9, line.lastIndexOf('-') - 1);
@ -124,7 +121,7 @@ const parseWarLog = (lineArray, war) => {
/**
* REVIVE
*/
if (line.includes('Revive')) {
else if (line.includes('Revive')) {
stats.clean.push(line);
const stabilized = !!line.includes('stabilisiert');
const medicName = line.substring(line.lastIndexOf('wurde von ') + 10,
@ -141,14 +138,12 @@ const parseWarLog = (lineArray, war) => {
patient: patient.name,
fraction: medic.fraction
});
addPlayersIfNotExists([medic, patient]);
}
/**
* TRANSPORT
*/
if (line.includes('Transport ||')) {
else if (line.includes('Transport ||')) {
stats.clean.push(line);
const driverString = line.substring(line.lastIndexOf('wurde von ') + 10, line.lastIndexOf(' eingeflogen'));
const driver = getPlayerAndFractionFromString(driverString);
@ -164,8 +159,14 @@ const parseWarLog = (lineArray, war) => {
fraction: driver.fraction,
distance: distance
});
}
addPlayersIfNotExists([driver, passenger]);
/**
* PLAYERS
*/
else if (line.includes('Fraktionsübersicht ||')) {
const playerString = line.substring(line.lastIndexOf('Fraktionsübersicht || ') + 22, line.lastIndexOf(', PUID'));
addPlayerIfNotExists(playerString)
}
});
@ -184,7 +185,6 @@ const parseWarLog = (lineArray, war) => {
stats.war.playersBlufor = stats.players.filter(player => player.fraction === 'BLUFOR').length;
stats.war.playersOpfor = stats.players.filter(player => player.fraction === 'OPFOR').length;
console.log(stats.war);
return stats;
};

630
package-lock.json generated Normal file
View File

@ -0,0 +1,630 @@
{
"name": "opt-cc",
"version": "1.6.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ajv": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz",
"integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=",
"dev": true,
"requires": {
"co": "4.6.0",
"fast-deep-equal": "1.0.0",
"fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.3.1"
}
},
"ansi-regex": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
"integrity": "sha1-DY6UaWej2BQ/k+JOKYUl/BsiNfk=",
"dev": true
},
"ansi-styles": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz",
"integrity": "sha1-6uy/Zs1waIJ2Cy9GkVgrj1XXp94=",
"dev": true
},
"asn1": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=",
"dev": true
},
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
"dev": true
},
"aws4": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz",
"integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=",
"dev": true
},
"bcrypt-pbkdf": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
"dev": true,
"optional": true,
"requires": {
"tweetnacl": "0.14.5"
}
},
"boom": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
"integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
"dev": true,
"requires": {
"hoek": "4.2.0"
}
},
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
},
"chalk": {
"version": "0.5.1",
"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",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz",
"integrity": "sha1-2S3iaU6z9nMjlz1649i1W0wiGQo=",
"dev": true
}
}
},
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
"dev": true
},
"combined-stream": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
"integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=",
"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
},
"concurrently": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-3.5.0.tgz",
"integrity": "sha1-jPG3cHppFqeKT/W3e7BN7FSzebI=",
"dev": true,
"requires": {
"chalk": "0.5.1",
"commander": "2.6.0",
"date-fns": "1.29.0",
"lodash": "4.17.4",
"rx": "2.3.24",
"spawn-command": "0.0.2-1",
"supports-color": "3.2.3",
"tree-kill": "1.2.0"
}
},
"core-js": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=",
"dev": true
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"cryptiles": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",
"integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
"dev": true,
"requires": {
"boom": "5.2.0"
},
"dependencies": {
"boom": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",
"integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==",
"dev": true,
"requires": {
"hoek": "4.2.0"
}
}
}
},
"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"
}
},
"date-fns": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.29.0.tgz",
"integrity": "sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw==",
"dev": true
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"dev": true
},
"ecc-jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
"dev": true,
"optional": true,
"requires": {
"jsbn": "0.1.1"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"extend": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=",
"dev": true
},
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true
},
"fast-deep-equal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=",
"dev": true
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
"dev": true
},
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
"dev": true
},
"form-data": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz",
"integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=",
"dev": true,
"requires": {
"asynckit": "0.4.0",
"combined-stream": "1.0.5",
"mime-types": "2.1.17"
}
},
"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"
}
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
"dev": true
},
"har-validator": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"dev": true,
"requires": {
"ajv": "5.3.0",
"har-schema": "2.0.0"
}
},
"has-ansi": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
"integrity": "sha1-hPJlqujA5qiKEtcCKJS3VoiUxi4=",
"dev": true,
"requires": {
"ansi-regex": "0.2.1"
}
},
"has-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
"integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=",
"dev": true
},
"hawk": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",
"integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==",
"dev": true,
"requires": {
"boom": "4.3.1",
"cryptiles": "3.1.2",
"hoek": "4.2.0",
"sntp": "2.1.0"
}
},
"hoek": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz",
"integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==",
"dev": true
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"jsprim": "1.4.1",
"sshpk": "1.13.1"
}
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
"isemail": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz",
"integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY=",
"dev": true
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"dev": true
},
"items": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/items/-/items-2.1.1.tgz",
"integrity": "sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg=",
"dev": true
},
"joi": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz",
"integrity": "sha1-M4WseQGSEwy+Iw6ALsAskhW7/to=",
"dev": true,
"requires": {
"hoek": "4.2.0",
"isemail": "2.2.1",
"items": "2.1.1",
"moment": "2.19.1",
"topo": "2.0.2"
}
},
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
"dev": true,
"optional": true
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
"dev": true
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
"dev": true
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
"dev": true
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"verror": "1.10.0"
}
},
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
"dev": true
},
"mime-db": {
"version": "1.30.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz",
"integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=",
"dev": true
},
"mime-types": {
"version": "2.1.17",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz",
"integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=",
"dev": true,
"requires": {
"mime-db": "1.30.0"
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"moment": {
"version": "2.19.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz",
"integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc=",
"dev": true
},
"oauth-sign": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
"integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=",
"dev": true
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
},
"punycode": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
"dev": true
},
"qs": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==",
"dev": true
},
"request": {
"version": "2.83.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz",
"integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==",
"dev": true,
"requires": {
"aws-sign2": "0.7.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.3.1",
"har-validator": "5.0.3",
"hawk": "6.0.2",
"http-signature": "1.2.0",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.17",
"oauth-sign": "0.8.2",
"performance-now": "2.1.0",
"qs": "6.5.1",
"safe-buffer": "5.1.1",
"stringstream": "0.0.5",
"tough-cookie": "2.3.3",
"tunnel-agent": "0.6.0",
"uuid": "3.1.0"
}
},
"rx": {
"version": "2.3.24",
"resolved": "https://registry.npmjs.org/rx/-/rx-2.3.24.tgz",
"integrity": "sha1-FPlQpCF9fjXapxu8vljv9o6ksrc=",
"dev": true
},
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
"dev": true
},
"sntp": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
"integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
"dev": true,
"requires": {
"hoek": "4.2.0"
}
},
"spawn-command": {
"version": "0.0.2-1",
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
"integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=",
"dev": true
},
"sshpk": {
"version": "1.13.1",
"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"
}
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=",
"dev": true
},
"strip-ansi": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
"integrity": "sha1-JfSOoiynkYfzF0pNuHWTR7sSYiA=",
"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,
"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,
"requires": {
"hoek": "4.2.0"
}
},
"tough-cookie": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz",
"integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=",
"dev": true,
"requires": {
"punycode": "1.4.1"
}
},
"tree-kill": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz",
"integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg==",
"dev": true
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"dev": true,
"optional": true
},
"uuid": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
"integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==",
"dev": true
},
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "1.3.0"
}
},
"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.5.1",
"joi": "9.2.0",
"minimist": "1.2.0",
"request": "2.83.0",
"rx": "4.1.0"
},
"dependencies": {
"rx": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz",
"integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=",
"dev": true
}
}
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "opt-cc",
"version": "1.6.2",
"version": "1.6.3",
"license": "MIT",
"author": "Florian Hartwich <hardi@noarch.de>",
"private": true,

8974
static/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@swimlane/ngx-charts": "^6.1.0",
"@swimlane/ngx-datatable": "^10.2.3",
"@swimlane/ngx-datatable": "^10.4.0",
"bootstrap": "^3.3.7",
"d3": "^4.11.0",
"jquery": "^3.1.0",

View File

@ -44,7 +44,7 @@
(change)="updateAppUser(user)">
<option [value]="0">Ohne Fraktion/ Squad</option>
<option *ngFor="let squad of squads" [ngValue]="squad">
{{squad.fraction == 'BLUFOR'? 'NATO' : 'CSAT'}}: {{squad.name}}
{{squad.fraction == 'BLUFOR'? fraction.BLUFOR : fraction.OPFOR}}: {{squad.name}}
</option>
</select>
</td>

View File

@ -3,6 +3,7 @@ import {AppUser, Squad} from "../models/model-interfaces";
import {Observable} from "rxjs/Observable";
import {AppUserService} from "../services/app-user-service/app-user.service";
import {SquadService} from "../services/army-management/squad.service";
import {Fraction} from "../utils/fraction.enum";
@Component({
@ -18,6 +19,8 @@ export class AdminComponent {
showSuccessLabel = false;
readonly fraction = Fraction;
constructor(private appUserService: AppUserService,
private squadService: SquadService) {
}

View File

@ -27,16 +27,6 @@
overflow-x: auto;
}
.opfor {
color: firebrick;
font-weight: 600;
}
.blufor {
color: blue;
font-weight: 600;
}
.table-head {
background: #222222;
color: white;

View File

@ -2,7 +2,7 @@
<div class="army-member-view-container">
<div class="return-button">
<span class="btn btn-default" style="position:absolute;" (click)="backToOverview()">< zurück zur Übersicht</span>
<h3 class="text-center" [ngClass]="user.squadId?.fraction === 'BLUFOR' ? 'blufor' : 'opfor'">
<h3 class="text-center" style="font-weight: 600" [style.color]="user.squadId?.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
Auszeichnungen von {{user.username}}
</h3>
</div>

View File

@ -5,6 +5,7 @@ import {UserService} from "../services/army-management/user.service";
import {Subscription} from "rxjs/Subscription";
import {RouteConfig} from "../app.config";
import {AwardingService} from "../services/army-management/awarding.service";
import {Fraction} from "../utils/fraction.enum";
@Component({
@ -24,6 +25,8 @@ export class ArmyMemberComponent {
isCopied = false;
readonly fraction = Fraction;
constructor(private router: Router,
private route: ActivatedRoute,
private userService: UserService,

View File

@ -58,14 +58,6 @@ img {
text-decoration: underline;
}
.text-opfor {
color: firebrick;
}
.text-blufor {
color: blue;
}
.army-head {
font-weight: bolder;
text-align: center

View File

@ -2,8 +2,8 @@
<h1>Übersicht über alle Spieler, Squads und Armeen</h1>
<div class="pull-left" style="width: 45%;">
<h3 class="text-blufor army-head">NATO</h3>
<div class="squad-layout" *ngFor="let squad of army.NATO.squads">
<h3 class="army-head" [style.color]="fraction.COLOR_BLUFOR">{{fraction.BLUFOR}}</h3>
<div class="squad-layout" *ngFor="let squad of army.BLUFOR.squads">
<div class="row colored-row title-row">
<div class="squad-cell pull-left"><img
src="resource/squad/{{squad._id}}.png"></div>
@ -11,8 +11,8 @@
</div>
<div class="row middle-row">
<div class="squad-cell name-cell">
<span class="text-blufor"
style="display: block"
<span style="display: block"
[style.color]="fraction.COLOR_BLUFOR"
*ngFor="let member of squad.members">
<span class="member-link"
(click)="select(member._id)">
@ -27,12 +27,12 @@
</div>
</div>
</div>
<div style="padding: 20px; text-align: center;">Armeemitglieder: {{army.NATO.memberCount}}</div>
<div style="padding: 20px; text-align: center;">Armeemitglieder: {{army.BLUFOR.memberCount}}</div>
</div>
<div class="pull-right" style="width: 45%;">
<h3 class="text-opfor army-head">CSAT</h3>
<div class="squad-layout" *ngFor="let squad of army.CSAT.squads">
<h3 class="army-head" [style.color]="fraction.COLOR_OPFOR">{{fraction.OPFOR}}</h3>
<div class="squad-layout" *ngFor="let squad of army.OPFOR.squads">
<div class="row colored-row title-row">
<div class="squad-cell pull-left"><img
src="resource/squad/{{squad._id}}.png"></div>
@ -40,8 +40,8 @@
</div>
<div class="row middle-row">
<div class="squad-cell name-cell">
<span class="text-opfor"
style="display: block"
<span style="display: block"
[style.color]="fraction.COLOR_OPFOR"
*ngFor="let member of squad.members">
<span class="member-link"
(click)="select(member._id)">
@ -56,7 +56,7 @@
</div>
</div>
</div>
<div style="padding: 20px; text-align: center;">Armeemitglieder: {{army.CSAT.memberCount}}</div>
<div style="padding: 20px; text-align: center;">Armeemitglieder: {{army.OPFOR.memberCount}}</div>
</div>
</div>

View File

@ -2,6 +2,7 @@ import {Component} from "@angular/core";
import {Army} from "../models/model-interfaces";
import {ArmyService} from "../services/army-service/army.service";
import {ActivatedRoute, Router} from "@angular/router";
import {Fraction} from "../utils/fraction.enum";
@Component({
@ -11,7 +12,9 @@ import {ActivatedRoute, Router} from "@angular/router";
})
export class ArmyComponent {
army: Army = {NATO: {squads: [], memberCount: 0}, CSAT: {squads: [], memberCount: 0}};
army: Army = {BLUFOR: {squads: [], memberCount: 0}, OPFOR: {squads: [], memberCount: 0}};
readonly fraction = Fraction;
constructor(private router: Router,
private route: ActivatedRoute,

View File

@ -6,8 +6,8 @@
<a>{{decoration.name}}</a>
</span>
<br>
<small *ngIf="decoration.fraction == 'OPFOR'">CSAT</small>
<small *ngIf="decoration.fraction == 'BLUFOR'">NATO</small>
<small *ngIf="decoration.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
<small *ngIf="decoration.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
<small *ngIf="decoration.fraction == 'GLOBAL'">Global</small>
<small> - Sortierung: {{decoration.sortingNumber}}</small>
</div>

View File

@ -1,9 +1,9 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
import {Router} from "@angular/router";
import {Decoration} from "../../models/model-interfaces";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'pjm-decoration-item',
selector: 'decoration-item',
templateUrl: './decoration-item.component.html',
styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -20,7 +20,9 @@ export class DecorationItemComponent {
decorationSelected = new EventEmitter();
decorationDelete = new EventEmitter();
constructor(private router: Router) {
readonly fraction = Fraction;
constructor() {
}
ngOnInit() {

View File

@ -1,9 +1,9 @@
<div class="select-list">
<div class="input-group list-header pull-left">
<div class="btn-group" (click)="filterDecorations()">
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="blufor" uncheckable>NATO</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="opfor" uncheckable>CSAT</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="global" uncheckable>Global</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>{{fraction.BLUFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>{{fraction.OPFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="GLOBAL" uncheckable>Global</label>
</div>
<a class="pull-right btn btn-success" (click)="openNewDecorationForm()">+</a>
</div>
@ -22,12 +22,12 @@
</div>
<div>
<pjm-decoration-item *ngFor="let decoration of decorations$ | async"
<decoration-item *ngFor="let decoration of decorations$ | async"
[decoration]="decoration"
(decorationDelete)="deleteDecoration(decoration)"
(decorationSelected)="selectDecoration($event)"
[selected]="decoration._id == selectedDecorationId">
</pjm-decoration-item>
</decoration-item>
</div>
</div>

View File

@ -6,6 +6,7 @@ import {ActivatedRoute, Router} from "@angular/router";
import {Observable} from "rxjs/Observable";
import {Decoration} from "../../models/model-interfaces";
import {DecorationService} from "../../services/army-management/decoration.service";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'decoration-list',
@ -22,6 +23,8 @@ export class DecorationListComponent implements OnInit {
public radioModel: string;
readonly fraction = Fraction;
constructor(private decorationService: DecorationService,
private router: Router,
private route: ActivatedRoute,
@ -29,7 +32,6 @@ export class DecorationListComponent implements OnInit {
}
ngOnInit() {
this.decorations$ = this.decorationService.decorations$;
const paramsStream = this.route.queryParams
@ -44,7 +46,6 @@ export class DecorationListComponent implements OnInit {
.distinctUntilChanged()
.switchMap(query => this.decorationService.findDecorations(query, this.radioModel))
.subscribe();
}
openNewDecorationForm() {
@ -59,8 +60,8 @@ export class DecorationListComponent implements OnInit {
deleteDecoration(decoration) {
let fraction = 'Global';
if (decoration.fraction === 'BLUFOR') fraction = 'NATO';
else if (decoration.fraction === 'OPFOR') fraction = 'CSAT';
if (decoration.fraction === 'BLUFOR') fraction = Fraction.BLUFOR;
else if (decoration.fraction === 'OPFOR') fraction = Fraction.OPFOR;
if (confirm('Soll die Auszeichnung "' + decoration.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.decorationService.deleteDecoration(decoration)

View File

@ -17,8 +17,8 @@
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
required
[(ngModel)]="decoration.fraction">
<option value="OPFOR">CSAT</option>
<option value="BLUFOR">NATO</option>
<option value="OPFOR">{{fraction.OPFOR}}</option>
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
<option value="GLOBAL">Global</option>
</select>
<show-error text="Fraktion" path="fraction"></show-error>

View File

@ -4,6 +4,7 @@ import {NgForm} from "@angular/forms";
import {Decoration} from "../../models/model-interfaces";
import {DecorationService} from "../../services/army-management/decoration.service";
import {Subscription} from "rxjs/Subscription";
import {Fraction} from "../../utils/fraction.enum";
@Component({
templateUrl: './edit-decoration.component.html',
@ -25,6 +26,8 @@ export class EditDecorationComponent {
@ViewChild(NgForm) form: NgForm;
readonly fraction = Fraction;
constructor(private route: ActivatedRoute,
private router: Router,
private decorationService: DecorationService) {

View File

@ -100,7 +100,7 @@ export interface Decoration {
}
export interface Army {
NATO: {
BLUFOR: {
squads: {
_id,
name,
@ -113,7 +113,7 @@ export interface Army {
}[],
memberCount
},
CSAT: {
OPFOR: {
squads: {
_id,
name,

View File

@ -18,8 +18,8 @@
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
required
[(ngModel)]="rank.fraction">
<option value="OPFOR">CSAT</option>
<option value="BLUFOR">NATO</option>
<option value="OPFOR">{{fraction.OPFOR}}</option>
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
</select>
<show-error text="Fraktion" path="fraction"></show-error>
</div>

View File

@ -4,6 +4,7 @@ import {NgForm} from "@angular/forms";
import {Rank} from "../../models/model-interfaces";
import {RankService} from "../../services/army-management/rank.service";
import {Subscription} from "rxjs/Subscription";
import {Fraction} from "../../utils/fraction.enum";
@Component({
@ -28,6 +29,8 @@ export class EditRankComponent {
@ViewChild(NgForm) form: NgForm;
readonly fraction = Fraction;
constructor(private route: ActivatedRoute,
private router: Router,
private rankService: RankService) {

View File

@ -6,8 +6,8 @@
<a>{{rank.name}}</a>
</span>
<br>
<small *ngIf="rank.fraction == 'OPFOR'">CSAT</small>
<small *ngIf="rank.fraction == 'BLUFOR'">NATO</small>
<small *ngIf="rank.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
<small *ngIf="rank.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
<small> - Stufe {{rank.level}}</small>
</div>

View File

@ -1,6 +1,6 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
import {Router} from "@angular/router";
import {Rank} from "../../models/model-interfaces";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'pjm-rank-item',
@ -19,8 +19,9 @@ export class RankItemComponent {
rankSelected = new EventEmitter();
rankDelete = new EventEmitter();
constructor(private router: Router) {
readonly fraction = Fraction;
constructor() {
}
ngOnInit() {

View File

@ -1,8 +1,8 @@
<div class="select-list">
<div class="input-group list-header">
<div class="btn-group" (click)="filterRanks()">
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="blufor" uncheckable>NATO</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="opfor" uncheckable>CSAT</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>{{fraction.BLUFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>{{fraction.OPFOR}}</label>
</div>
<a class="pull-right btn btn-success" (click)="openNewRankForm()">+</a>
</div>

View File

@ -6,6 +6,7 @@ import {ActivatedRoute, Router} from "@angular/router";
import {Observable} from "rxjs/Observable";
import {Rank} from "../../models/model-interfaces";
import {RankService} from "../../services/army-management/rank.service";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'rank-list',
@ -22,6 +23,8 @@ export class RankListComponent implements OnInit {
public radioModel: string;
readonly fraction = Fraction;
constructor(private rankService: RankService,
private router: Router,
private route: ActivatedRoute,
@ -62,7 +65,7 @@ export class RankListComponent implements OnInit {
}
deleteRank(rank) {
const fraction = rank.fraction === 'OPFOR' ? 'CSAT' : 'NATO';
const fraction = rank.fraction === 'OPFOR' ? Fraction.OPFOR : Fraction.BLUFOR;
if (confirm('Soll der Rang ' + rank.name + ' (' + fraction + ') wirklich gelöscht werden?')) {
this.rankService.deleteRank(rank)
.subscribe((res) => {

View File

@ -18,8 +18,8 @@
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
required
[(ngModel)]="squad.fraction">
<option value="OPFOR">CSAT</option>
<option value="BLUFOR">NATO</option>
<option value="OPFOR">{{fraction.OPFOR}}</option>
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
</select>
<show-error text="Fraktion" path="fraction"></show-error>
</div>

View File

@ -4,6 +4,7 @@ import {NgForm} from "@angular/forms";
import {Squad} from "../../models/model-interfaces";
import {SquadService} from "../../services/army-management/squad.service";
import {Subscription} from "rxjs/Subscription";
import {Fraction} from "../../utils/fraction.enum";
@Component({
@ -28,6 +29,8 @@ export class EditSquadComponent {
@ViewChild(NgForm) form: NgForm;
readonly fraction = Fraction;
constructor(private route: ActivatedRoute,
private router: Router,
private squadService: SquadService) {

View File

@ -6,8 +6,8 @@
<a>{{squad.name}}</a>
</span>
<br>
<small *ngIf="squad.fraction == 'OPFOR'">CSAT</small>
<small *ngIf="squad.fraction == 'BLUFOR'">NATO</small>
<small *ngIf="squad.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
<small *ngIf="squad.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
</div>
<div class="col-xs-4">

View File

@ -1,6 +1,6 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
import {Router} from "@angular/router";
import {Squad} from "../../models/model-interfaces";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'pjm-squad-item',
@ -20,7 +20,9 @@ export class SquadItemComponent {
imageSrc;
constructor(private router: Router) {
readonly fraction = Fraction;
constructor() {
}
ngOnInit() {

View File

@ -1,8 +1,8 @@
<div class="select-list">
<div class="input-group list-header pull-left">
<div class="btn-group" (click)="filterSquads()">
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="blufor" uncheckable>NATO</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="opfor" uncheckable>CSAT</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="blufor" uncheckable>{{fraction.BLUFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="opfor" uncheckable>{{fraction.OPFOR}}</label>
</div>
<a class="pull-right btn btn-success" (click)="openNewSquadForm()">+</a>
</div>

View File

@ -6,6 +6,7 @@ import {ActivatedRoute, Router} from "@angular/router";
import {Observable} from "rxjs/Observable";
import {Squad} from "../../models/model-interfaces";
import {SquadService} from "../../services/army-management/squad.service";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'squad-list',
@ -22,6 +23,8 @@ export class SquadListComponent implements OnInit {
public radioModel: string;
readonly fraction = Fraction;
constructor(private squadService: SquadService,
private router: Router,
private route: ActivatedRoute,
@ -58,7 +61,7 @@ export class SquadListComponent implements OnInit {
}
deleteSquad(squad) {
const fraction = squad.fraction === 'OPFOR' ? 'CSAT' : 'NATO';
const fraction = squad.fraction === 'OPFOR' ? Fraction.OPFOR : Fraction.BLUFOR;
if (confirm('Soll das Squad "' + squad.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.squadService.deleteSquad(squad)
.subscribe((res) => {

View File

@ -3,6 +3,7 @@ import {ActivatedRoute} from "@angular/router";
import {CarouselConfig} from "ngx-bootstrap";
import {CampaignService} from "../../services/logs/campaign.service";
import {ChartUtils} from "../../utils/chart-utils";
import {Fraction} from "../../utils/fraction.enum";
@Component({
@ -24,7 +25,7 @@ export class StatisticOverviewComponent {
activeSlideIndex;
colorScheme = {
domain: ['#0000FF', '#B22222']
domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR]
};
gradient = false;
xAxis = true;
@ -100,20 +101,12 @@ export class StatisticOverviewComponent {
}
initChart(wars: any[]) {
let pointsObj = [
{
"name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}];
let pointsSumObj = JSON.parse(JSON.stringify(pointsObj));
let playersObj = JSON.parse(JSON.stringify(pointsObj));
const pointsObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
const pointsSumObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
const playersObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
for (let i = wars.length - 1; i >= 0; i--) {
let j = wars.length - i - 1;
const j = wars.length - i - 1;
const warDateString = ChartUtils.getShortDateString(wars[i].date);
pointsObj[0].series.push({

View File

@ -34,14 +34,6 @@
font-weight: bold;
}
.text-opfor {
color: firebrick;
}
.text-blufor {
color: blue;
}
/* ########### TABS ########### */
:host /deep/ .nav-tabs {

View File

@ -5,16 +5,16 @@
<h2>{{war.title}} - vom {{war.date | date: 'dd.MM.yyyy'}}</h2>
<div class="pull-left head-field" style="width: 250px">
<h4>Endpunktestand:</h4>
<span class="text-blufor" style="font-weight: bold; margin-right: 10px">NATO {{war.ptBlufor}}</span>
<span [style.color]="fraction.COLOR_BLUFOR" style="font-weight: bold; margin-right: 10px">{{fraction.BLUFOR}} {{war.ptBlufor}}</span>
<span style="font-size: x-large">|</span>
<span class="text-opfor" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} CSAT</span>
<span [style.color]="fraction.COLOR_OPFOR" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} {{fraction.OPFOR}}</span>
</div>
<div class="pull-left head-field " style="padding-left: 140px;">
<h4 style="margin-bottom: 0;">Teilnehmer:</h4>
<ngx-charts-pie-chart
[view]="[120, 120]"
[scheme]="{domain: ['#B22222', '#0000FF']}"
[scheme]="{domain: [fraction.COLOR_OPFOR, fraction.COLOR_BLUFOR]}"
[results]="playerChart"
[legend]="false"
[explodeSlices]="false"
@ -37,13 +37,13 @@
<input type="radio" name="fractSelect" value="BLUFOR"
[(ngModel)]="fractionRadioSelect"
#fractRadioBufor
(change)="filterPlayersByFraction(fractRadioBufor.value)">NATO
(change)="filterPlayersByFraction(fractRadioBufor.value)">{{fraction.BLUFOR}}
</label>
<label class="radio-inline">
<input type="radio" name="fractSelect" value="OPFOR"
[(ngModel)]="fractionRadioSelect"
#fractRadioOpfor
(change)="filterPlayersByFraction(fractRadioOpfor.value)">CSAT
(change)="filterPlayersByFraction(fractRadioOpfor.value)">{{fraction.OPFOR}}
</label>
<br>
</form>
@ -70,14 +70,14 @@
<ngx-datatable-column name="Spieler" prop="name" [width]="210" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[ngClass]="row['fraction'] === 'BLUFOR' ? 'text-blufor' : 'text-opfor'">
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Fraktion" prop="fraction" [width]="100">
<ng-template ngx-datatable-cell-template let-value="value">
{{value === 'BLUFOR' ? 'NATO' : 'CSAT'}}
{{value === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}}
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="90" name="Kills" prop="kill"></ngx-datatable-column>
@ -164,6 +164,12 @@
</ngx-charts-area-chart>
</div>
</tab>
<!--<tab>-->
<!--<ng-template tabHeading>-->
<!--<img src="../../../assets/player-stats-btn.png"> Player-->
<!--</ng-template>-->
<!--</tab>-->
</tabset>
</div>

View File

@ -7,6 +7,7 @@ import {LogsService} from "../../services/logs/logs.service";
import {TabsetComponent} from "ngx-bootstrap";
import * as d3 from "d3";
import {ChartUtils} from "../../utils/chart-utils";
import {Fraction} from "../../utils/fraction.enum";
@Component({
@ -16,12 +17,20 @@ import {ChartUtils} from "../../utils/chart-utils";
})
export class WarDetailComponent {
readonly fraction = Fraction;
@ViewChild('overview') private overviewContainer: ElementRef;
@ViewChild('staticTabs') staticTabs: TabsetComponent;
war: War = {players: []};
logData: any;
initialized: any;
startDateObj: Date;
public chartSelectModel: string;
fractionRadioSelect: string;
@ -51,10 +60,8 @@ export class WarDetailComponent {
tmpStabilizeData;
tmpFlagCaptureData;
initialized;
colorScheme = {
domain: ['#0000FF', '#B22222']
domain: [Fraction.COLOR_BLUFOR, Fraction.COLOR_OPFOR]
};
labelPoints = 'Punkte';
@ -80,12 +87,6 @@ export class WarDetailComponent {
timeline = false;
roundDomains = true;
startDateObj;
dataMode: string = 'Summe';
dataInterval: number = 0;
logData;
constructor(private route: ActivatedRoute,
private router: Router,
private warService: WarService,
@ -100,7 +101,7 @@ export class WarDetailComponent {
.subscribe(war => {
this.war = war;
this.rows = war.players;
this.playerChart = ChartUtils.getSingleDataArray('CSAT', war.playersOpfor, 'NATO', war.playersBlufor);
this.playerChart = ChartUtils.getSingleDataArray(Fraction.OPFOR, war.playersOpfor, Fraction.BLUFOR, war.playersBlufor);
this.initialized = {
basic: false,
@ -187,13 +188,6 @@ export class WarDetailComponent {
}
}
toggleDataMode(interval, entryString) {
this.dataInterval = interval;
this.dataMode = entryString;
this.initTransportData();
this.lineChartData = this.tmpTransportData;
}
loadFractionData() {
if (this.initialized.basic) {
return;
@ -376,14 +370,14 @@ export class WarDetailComponent {
}
initializeTempCollections() {
this.tmpPointData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpBudgetData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpKillData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpFrienlyFireData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpTransportData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpReviveData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpStabilizeData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
this.tmpPointData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpBudgetData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpKillData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpFrienlyFireData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpTransportData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpReviveData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
[0, 1].forEach(index => {

View File

@ -13,7 +13,8 @@
style="min-width: 200px;">
<option [value]="0">Auswählen...</option>
<option *ngFor="let deco of decorations" [value]="deco._id">
{{deco.fraction == 'BLUFOR'? 'NATO' : deco.fraction == 'OPFOR'? 'CSAT' : 'Global'}}: {{deco.name}}
{{deco.fraction == 'BLUFOR'? fraction.BLUFOR : deco.fraction == 'OPFOR'? fraction.OPFOR : 'Global'}}:
{{deco.name}}
</option>
</select>

View File

@ -4,6 +4,7 @@ import {Award, Decoration} from "../../models/model-interfaces";
import {NgForm} from "@angular/forms";
import {AwardingService} from "../../services/army-management/awarding.service";
import {DecorationService} from "../../services/army-management/decoration.service";
import {Fraction} from "../../utils/fraction.enum";
@Component({
@ -24,6 +25,8 @@ export class AwardUserComponent {
decoPreviewDisplay = 'none';
readonly fraction = Fraction;
constructor(private router: Router,
private route: ActivatedRoute,
private awardingService: AwardingService,

View File

@ -24,7 +24,7 @@
(change)="toggleRanks()">
<option [value]="0">Ohne Fraktion/ Squad</option>
<option *ngFor="let squad of squads" [ngValue]="squad">
{{squad.fraction == 'BLUFOR'? 'NATO' : 'CSAT'}}: {{squad.name}}
{{squad.fraction == 'BLUFOR'? fraction.BLUFOR : fraction.OPFOR}}: {{squad.name}}
</option>
</select>

View File

@ -6,6 +6,7 @@ import {SquadService} from "../../services/army-management/squad.service";
import {RankService} from "../../services/army-management/rank.service";
import {Subscription} from "rxjs";
import {NgForm} from "@angular/forms";
import {Fraction} from "../../utils/fraction.enum";
@Component({
@ -32,6 +33,8 @@ export class EditUserComponent {
error: string;
readonly fraction = Fraction;
constructor(private router: Router,
private route: ActivatedRoute,
private userService: UserService,

View File

@ -6,8 +6,9 @@
<a>{{user.username}}</a>
</span>
<br>
<small *ngIf="user.squadId && user.squadId.fraction == 'OPFOR'">CSAT - {{user.squadId.name}}</small>
<small *ngIf="user.squadId && user.squadId.fraction == 'BLUFOR'">NATO - {{user.squadId.name}}</small>
<small *ngIf="user.squadId && user.squadId.fraction == 'OPFOR'">{{fraction.OPFOR}} - {{user.squadId.name}}</small>
<small *ngIf="user.squadId && user.squadId.fraction == 'BLUFOR'">{{fraction.BLUFOR}} - {{user.squadId.name}}
</small>
<small *ngIf="!user.squadId">ohne Squad/Fraktion</small>
</div>

View File

@ -1,6 +1,6 @@
import {ChangeDetectionStrategy, Component, EventEmitter} from "@angular/core";
import {Router} from "@angular/router";
import {User} from "../../models/model-interfaces";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'pjm-user-item',
@ -19,8 +19,9 @@ export class UserItemComponent {
userAward = new EventEmitter();
userDelete = new EventEmitter();
constructor(private router: Router) {
readonly fraction = Fraction;
constructor() {
}
select() {

View File

@ -1,8 +1,8 @@
<div class="select-list">
<div class="input-group list-header pull-left">
<div class="btn-group" (click)="filterUsers()">
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>NATO</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>CSAT</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>{{fraction.BLUFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>{{fraction.OPFOR}}</label>
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="UNASSIGNED" uncheckable>Ohne Squad</label>
</div>
<a class="pull-right btn btn-success" (click)="openNewUserForm()">+</a>

View File

@ -7,6 +7,7 @@ import {Observable} from "rxjs/Observable";
import {UserService} from "../../services/army-management/user.service";
import {User} from "../../models/model-interfaces";
import {ADD, LOAD} from "../../services/stores/user.store";
import {Fraction} from "../../utils/fraction.enum";
@Component({
selector: 'squad-list',
@ -31,6 +32,8 @@ export class UserListComponent implements OnInit {
limit = 20;
readonly fraction = Fraction;
constructor(private userService: UserService,
private router: Router,
private route: ActivatedRoute,

View File

@ -0,0 +1,6 @@
export enum Fraction {
BLUFOR = 'NATO',
OPFOR = 'CSAT',
COLOR_BLUFOR = '#0000FF',
COLOR_OPFOR = '#B22222'
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B