Compare commits

..

16 Commits

70 changed files with 463 additions and 14192 deletions

4
.gitignore vendored
View File

@ -6,7 +6,8 @@ tmp/
etc/ etc/
# dependencies # dependencies
/node_modules node_modules
package-lock.json
# IDEs and editors # IDEs and editors
/.idea /.idea
@ -49,7 +50,6 @@ mongodb-data/
backup/ backup/
.idea/ .idea/
node_modules
*/nbproject* */nbproject*
.npm/ .npm/
.bash_history .bash_history

4531
api/package-lock.json generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

View File

@ -14,26 +14,39 @@ deleteOldest() {
} }
# array of available collection names # array of available collection names
col=(app_user awarding decoration rank squad user promotion player war) col=(app_user awarding decoration rank squad user promotion player war campaign)
if [ -z "$1" ]
then
DATE=$(date '+%Y-%m-%d')
mkdir -p ${DATE}/resource
cp -R ../api/resource/ ${DATE}/
else
DATE=${1}
tar -xzf ${DATE}.tar.gz
rm -rf ../api/resource
cp -Rv ${DATE}/resource ../api/
fi
for i in "${col[@]}" for i in "${col[@]}"
do do
# provide date for restore process, if data import is needed # provide date for restore process, if data import is needed
if [ -z "$1" ] if [ -z "$1" ]
then then
DATE=$(date '+%Y-%m-%d')
mongoexport --db cc --collection $i --out ${DATE}/collections/${i}.json; mongoexport --db cc --collection $i --out ${DATE}/collections/${i}.json;
cp -R ../api/resource ${DATE}/
tar -zcf ${DATE}.tar.gz ${DATE}
rm -R ${DATE}
if [ $(ls -l | grep -c ^d) -gt 5 ]; then if [ $(ls -l | grep -c ^d) -gt 5 ]; then
deleteOldest deleteOldest
fi fi
else else
tar -xzf ${1}.tar.gz
mongoimport --db cc --collection $i --drop --file ${1}/collections/${i}.json mongoimport --db cc --collection $i --drop --file ${1}/collections/${i}.json
rm -rf ../api/resource
cp -Rv ${1}/resource ../api/
rm -R ${1}
fi fi
done done
if [ -z "$1" ]
then
tar -zcf ${DATE}.tar.gz ${DATE}
fi
rm -rf ${DATE}

View File

@ -4,12 +4,12 @@
cd $(dirname $0) cd $(dirname $0)
# array of files to minify # array of files to minify
FILES=(inline main polyfills scripts styles vendor) FILES=(inline.bundle main.bundle polyfills.bundle scripts.bundle styles.bundle vendor.bundle 0.chunk 1.chunk 2.chunk 3.chunk 4.chunk 5.chunk 6.chunk 7.chunk)
OPTIONS="-c toplevel,dead_code=true,unused=true" OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}" for i in "${FILES[@]}"
do do
echo "minify ${i} ..." echo "minify ${i} ..."
$(npm bin)/uglifyjs public/${i}.bundle.js ${OPTIONS} -o public/${i}.bundle.js $(npm bin)/uglifyjs public/${i}.js ${OPTIONS} -o public/${i}.js
rm -f public/${i}.bundle.js.map rm -f public/${i}.js.map
done done

683
package-lock.json generated
View File

@ -1,683 +0,0 @@
{
"name": "opt-cc",
"version": "1.3.1",
"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,
"requires": {
"co": "4.6.0",
"json-stable-stringify": "1.0.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": "0.2.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=",
"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.6.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",
"integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=",
"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": "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",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"dev": true
}
}
},
"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.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",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
"integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=",
"dev": true
},
"cryptiles": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
"integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=",
"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",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
}
}
},
"date-fns": {
"version": "1.28.5",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.28.5.tgz",
"integrity": "sha1-JXz8RdMi30XvVlhmWWfuhBzXP68=",
"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.0.2",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz",
"integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=",
"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.1.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
"integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=",
"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",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
}
}
},
"har-schema": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz",
"integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=",
"dev": true
},
"har-validator": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz",
"integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=",
"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,
"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": "3.1.3",
"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",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"dev": true
}
}
},
"hoek": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.1.1.tgz",
"integrity": "sha1-nMVz/7ore0CPtenCoTeWvpTN3Ok=",
"dev": true
},
"http-signature": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz",
"integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=",
"dev": true,
"requires": {
"assert-plus": "0.2.0",
"jsprim": "1.4.0",
"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.1.1",
"isemail": "2.2.1",
"items": "2.1.1",
"moment": "2.18.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-stable-stringify": {
"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,
"requires": {
"jsonify": "0.0.0"
}
},
"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
},
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=",
"dev": true
},
"jsprim": {
"version": "1.4.0",
"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",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
}
}
},
"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.27.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz",
"integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=",
"dev": true
},
"mime-types": {
"version": "2.1.15",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz",
"integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=",
"dev": true,
"requires": {
"mime-db": "1.27.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.18.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz",
"integrity": "sha1-w2GT3Tzhwu7SrbfIAtu8d6gbHA8=",
"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": "0.2.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz",
"integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=",
"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.4.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz",
"integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=",
"dev": true
},
"request": {
"version": "2.81.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz",
"integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=",
"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",
"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": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=",
"dev": true
},
"sntp": {
"version": "1.0.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",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"dev": true
}
}
},
"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",
"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"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
}
}
},
"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.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,
"requires": {
"punycode": "1.4.1"
}
},
"tree-kill": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.1.0.tgz",
"integrity": "sha1-yWPc8DciiS7FnLpWnpQLcZVNFyk=",
"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
},
"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.11.0",
"source-map": "0.5.6"
},
"dependencies": {
"commander": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ=="
}
}
},
"uuid": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
"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,
"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",
"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", "name": "opt-cc",
"version": "1.3.1", "version": "1.4.0",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@ -1,4 +1,4 @@
import {browser, element, by} from 'protractor'; import {browser, by, element} from 'protractor';
describe('Main Page Access', function () { describe('Main Page Access', function () {
@ -7,7 +7,7 @@ describe('Main Page Access', function () {
browser.get('/') browser.get('/')
}); });
it('should open army overview initially', async() => { it('should open army overview initially', async () => {
let elem = element(by.css('h1')); let elem = element(by.css('h1'));
let text = elem.getText(); let text = elem.getText();
expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen"); expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen");

View File

@ -13,13 +13,13 @@ module.exports = function (config) {
require('@angular/cli/plugins/karma') require('@angular/cli/plugins/karma')
], ],
files: [ files: [
{ pattern: './src/test.ts', watched: false } {pattern: './src/test.ts', watched: false}
], ],
preprocessors: { preprocessors: {
'./src/test.ts': ['@angular/cli'] './src/test.ts': ['@angular/cli']
}, },
mime: { mime: {
'text/x-typescript': ['ts','tsx'] 'text/x-typescript': ['ts', 'tsx']
}, },
remapIstanbulReporter: { remapIstanbulReporter: {
reports: { reports: {
@ -32,8 +32,8 @@ module.exports = function (config) {
environment: 'dev' environment: 'dev'
}, },
reporters: config.angularCli && config.angularCli.codeCoverage reporters: config.angularCli && config.angularCli.codeCoverage
? ['spec', 'karma-remap-istanbul'] ? ['spec', 'karma-remap-istanbul']
: ['spec'], : ['spec'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,

8709
static/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,23 +29,24 @@ exports.config = {
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000, defaultTimeoutInterval: 30000,
print: function() {} print: function () {
}
}, },
useAllAngular2AppRoots: true, useAllAngular2AppRoots: true,
beforeLaunch: function() { beforeLaunch: function () {
require('ts-node').register({ require('ts-node').register({
project: 'e2e' project: 'e2e'
}); });
return new Promise(function(resolve){ return new Promise(function (resolve) {
reporter.beforeLaunch(resolve); reporter.beforeLaunch(resolve);
}); });
}, },
afterLaunch: function(exitCode) { afterLaunch: function (exitCode) {
return new Promise(function(resolve){ return new Promise(function (resolve) {
reporter.afterLaunch(resolve.bind(this, exitCode)); reporter.afterLaunch(resolve.bind(this, exitCode));
}); });
}, },
onPrepare: function() { onPrepare: function () {
jasmine.getEnv().addReporter(reporter); jasmine.getEnv().addReporter(reporter);
jasmine.getEnv().addReporter(new SpecReporter()); jasmine.getEnv().addReporter(new SpecReporter());
}, },

View File

@ -1,9 +1,9 @@
// Protractor configuration file, see link for more information // Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts // https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter'); const {SpecReporter} = require('jasmine-spec-reporter');
exports.config= { exports.config = {
allScriptsTimeout: 11000, allScriptsTimeout: 11000,
specs: [ specs: [
'./e2e/**/*.e2e-spec.ts' './e2e/**/*.e2e-spec.ts'
@ -17,14 +17,15 @@ exports.config= {
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000, defaultTimeoutInterval: 30000,
print: function() {} print: function () {
}
}, },
beforeLaunch: function() { beforeLaunch: function () {
require('ts-node').register({ require('ts-node').register({
project: 'e2e/tsconfig.e2e.json' project: 'e2e/tsconfig.e2e.json'
}); });
}, },
onPrepare() { onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
} }
}; };

View File

@ -61,7 +61,7 @@ export class AdminComponent {
/** /**
* compare ngValue with ngModel to assign selected element * compare ngValue with ngModel to assign selected element
*/ */
equals(o1: Squad , o2: Squad) { equals(o1: Squad, o2: Squad) {
if (o1 && o2) { if (o1 && o2) {
return o1._id === o2._id; return o1._id === o2._id;
} }

View File

@ -0,0 +1,15 @@
import {NgModule} from "@angular/core";
import {AdminComponent} from "./admin.component";
import {SharedModule} from "../shared.module";
import {AppUserStore} from "../services/stores/app-user.store";
import {AppUserService} from "../services/app-user-service/app-user.service";
import {CommonModule} from "@angular/common";
import {RouterModule} from "@angular/router";
@NgModule({
declarations: [AdminComponent],
imports: [CommonModule, SharedModule, RouterModule.forChild([{path: '', component: AdminComponent}])],
providers: [AppUserStore, AppUserService]
})
export class AdminModule {
}

View File

@ -47,11 +47,19 @@ unprocessed-child:hover {
/* Safari 4.0 - 8.0 */ /* Safari 4.0 - 8.0 */
@-webkit-keyframes color-blink { @-webkit-keyframes color-blink {
from {background-color: #222222;} from {
to {background-color: orange;} background-color: #222222;
}
to {
background-color: orange;
}
} }
@keyframes color-blink { @keyframes color-blink {
from {background-color: #222222;} from {
to {background-color: orange;} background-color: #222222;
}
to {
background-color: orange;
}
} }

View File

@ -45,25 +45,29 @@
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a routerLink="{{config.requestPromotionPath}}">Beförderung</a> <a routerLink="{{config.request}}/{{config.requestPromotionPath}}">Beförderung</a>
</li> </li>
<li> <li>
<a routerLink="{{config.requestAwardPath}}">Orden/ Auszeichnung</a> <a routerLink="{{config.request}}/{{config.requestAwardPath}}">Orden/ Auszeichnung</a>
</li> </li>
</ul> </ul>
</li> </li>
<li *ngIf="loginService.hasPermission(2) && loginService.hasSquad()" class="dropdown"> <li *ngIf="loginService.hasPermission(2) && loginService.hasSquad()" class="dropdown">
<a href="#" [ngClass]="{'unprocessed': promotionService.hasUnprocessedPromotion || awardingService.hasUnprocessedAwards}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" <a href="#"
[ngClass]="{'unprocessed': promotionService.hasUnprocessedPromotion || awardingService.hasUnprocessedAwards}"
class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false"> aria-expanded="false">
Anträge Anträge
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a [ngClass]="{'unprocessed-child': promotionService.hasUnprocessedPromotion}" routerLink="{{config.confirmPromotionPath}}">Beförderung</a> <a [ngClass]="{'unprocessed-child': promotionService.hasUnprocessedPromotion}"
routerLink="{{config.request}}/{{config.confirmPromotionPath}}">Beförderung</a>
</li> </li>
<li> <li>
<a [ngClass]="{'unprocessed-child': awardingService.hasUnprocessedAwards}" routerLink="{{config.confirmAwardPath}}">Orden/ Auszeichnung</a> <a [ngClass]="{'unprocessed-child': awardingService.hasUnprocessedAwards}"
routerLink="{{config.request}}/{{config.confirmAwardPath}}">Orden/ Auszeichnung</a>
</li> </li>
</ul> </ul>
</li> </li>
@ -73,8 +77,8 @@
<li *ngIf="loginService.hasPermission(4)" routerLinkActive="active"> <li *ngIf="loginService.hasPermission(4)" routerLinkActive="active">
<a routerLink='{{config.adminPanelPath}}' class="link">Admin Panel</a> <a routerLink='{{config.adminPanelPath}}' class="link">Admin Panel</a>
</li> </li>
<li *ngIf="authEnabled" class="link" style="cursor: pointer"> <li *ngIf="loginService.isLoggedIn()" class="link" style="cursor: pointer">
<a *ngIf="loginService.isLoggedIn()" (click)="logout()">Abmelden</a> <a (click)="logout()">Abmelden</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -1,7 +1,6 @@
import {Component, Inject, Optional} from '@angular/core'; import {Component} from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {LoginService} from './services/login-service/login-service'; import {LoginService} from './services/login-service/login-service';
import {AUTH_ENABLED} from './app.tokens';
import {PromotionService} from "./services/promotion-service/promotion.service"; import {PromotionService} from "./services/promotion-service/promotion.service";
import {AwardingService} from "./services/awarding-service/awarding.service"; import {AwardingService} from "./services/awarding-service/awarding.service";
import {RouteConfig} from "./app.config"; import {RouteConfig} from "./app.config";
@ -15,8 +14,7 @@ export class AppComponent {
config = RouteConfig; config = RouteConfig;
constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled, constructor(private loginService: LoginService,
private loginService: LoginService,
private promotionService: PromotionService, private promotionService: PromotionService,
private awardingService: AwardingService, private awardingService: AwardingService,
private router: Router) { private router: Router) {

View File

@ -1,20 +1,19 @@
export class AppConfig { export class AppConfig {
public readonly apiUrl = '/api'; public readonly apiUrl = '/api';
public readonly apiAppUserPath = this.apiUrl + '/account/'; public readonly apiAppUserPath = this.apiUrl + '/account/';
public readonly apiAwardPath = this.apiUrl + '/awardings'; public readonly apiAwardPath = this.apiUrl + '/awardings';
public readonly apiDecorationPath = this.apiUrl + '/decorations/'; public readonly apiDecorationPath = this.apiUrl + '/decorations/';
public readonly apiAuthenticationPath = this.apiUrl + '/authenticate'; public readonly apiAuthenticationPath = this.apiUrl + '/authenticate';
public readonly apiSignupPath = this.apiUrl + '/authenticate/signup'; public readonly apiSignupPath = this.apiUrl + '/authenticate/signup';
public readonly apiRankPath = this.apiUrl + '/ranks/'; public readonly apiRankPath = this.apiUrl + '/ranks/';
public readonly apiSquadPath = this.apiUrl + '/squads/'; public readonly apiSquadPath = this.apiUrl + '/squads/';
public readonly apiUserPath = this.apiUrl + '/users/'; public readonly apiUserPath = this.apiUrl + '/users/';
public readonly apiOverviewPath = this.apiUrl + '/overview'; public readonly apiOverviewPath = this.apiUrl + '/overview';
public readonly apiRequestAwardPath = this.apiUrl + '/request/award'; public readonly apiRequestAwardPath = this.apiUrl + '/request/award';
public readonly apiPromotionPath = this.apiUrl + '/request/promotion'; public readonly apiPromotionPath = this.apiUrl + '/request/promotion';
public readonly apiWarPath = this.apiUrl + '/wars'; public readonly apiWarPath = this.apiUrl + '/wars';
} }
@ -28,8 +27,9 @@ export const RouteConfig = {
statsPath: 'stats', statsPath: 'stats',
userPath: 'users', userPath: 'users',
overviewPath: 'overview', overviewPath: 'overview',
requestAwardPath: 'request-award', request: 'request',
requestPromotionPath: 'request-promotion', requestAwardPath: 'award',
requestPromotionPath: 'promotion',
confirmAwardPath: 'confirm-award', confirmAwardPath: 'confirm-award',
confirmPromotionPath: 'confirm-promotion' confirmPromotionPath: 'confirm-promotion'
} }

View File

@ -4,28 +4,19 @@ import {HttpModule} from '@angular/http';
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
import {LoginService} from "./services/login-service/login-service"; import {LoginService} from "./services/login-service/login-service";
import {appRouting, routingComponents, routingProviders} from './app.routing'; import {appRouting, routingComponents, routingProviders} from './app.routing';
import {AUTH_ENABLED} from './app.tokens';
import {SquadService} from "./services/squad-service/squad.service"; import {SquadService} from "./services/squad-service/squad.service";
import {SquadStore} from "./services/stores/squad.store"; import {SquadStore} from "./services/stores/squad.store";
import {DecorationStore} from "./services/stores/decoration.store"; import {DecorationStore} from "./services/stores/decoration.store";
import {DecorationService} from "./services/decoration-service/decoration.service"; import {DecorationService} from "./services/decoration-service/decoration.service";
import {SquadItemComponent} from "./squads/squad-list/squad-item.component";
import {DecorationComponent} from "./decorations/decoration.component";
import {RankItemComponent} from "./ranks/rank-list/rank-item.component";
import {RankStore} from "./services/stores/rank.store"; import {RankStore} from "./services/stores/rank.store";
import {RankService} from "./services/rank-service/rank.service"; import {RankService} from "./services/rank-service/rank.service";
import {DecorationItemComponent} from "./decorations/decoration-list/decoration-item.component";
import {AppConfig} from "./app.config"; import {AppConfig} from "./app.config";
import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardSQL} from "./login/login.guard";
import {AwardingService} from "./services/awarding-service/awarding.service"; import {AwardingService} from "./services/awarding-service/awarding.service";
import {HttpClient} from "./services/http-client"; import {HttpClient} from "./services/http-client";
import {ArmyService} from "./services/army-service/army.service"; import {ArmyService} from "./services/army-service/army.service";
import {ClipboardModule} from 'ngx-clipboard'; import {ClipboardModule} from 'ngx-clipboard';
import {AppUserService} from "./services/app-user-service/app-user.service";
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 {WarService} from "./services/war-service/war.service";
import {SharedModule} from "./shared.module"; import {SharedModule} from "./shared.module";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
@ -38,8 +29,6 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
LoginGuardHL, LoginGuardHL,
LoginGuardAdmin, LoginGuardAdmin,
ArmyService, ArmyService,
AppUserService,
AppUserStore,
SquadService, SquadService,
SquadStore, SquadStore,
DecorationService, DecorationService,
@ -50,16 +39,10 @@ import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
PromotionService, PromotionService,
AppConfig, AppConfig,
routingProviders, routingProviders,
{provide: AUTH_ENABLED, useValue: true}
], ],
declarations: [ declarations: [
AppComponent, AppComponent,
routingComponents, routingComponents],
DecorationComponent,
DecorationItemComponent,
RankItemComponent,
FilterRankPipe,
SquadItemComponent],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {

View File

@ -2,18 +2,9 @@ import {RouterModule, Routes} from "@angular/router";
import {LoginComponent} from "./login/index"; import {LoginComponent} from "./login/index";
import {NotFoundComponent} from "./common/not-found/not-found.component"; import {NotFoundComponent} from "./common/not-found/not-found.component";
import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard"; import {LoginGuardAdmin, LoginGuardHL, LoginGuardMT, LoginGuardSQL} from "./login/login.guard";
import {squadsRoutes, squadsRoutingComponents} from "./squads/squads.routing";
import {decorationsRoutes, decorationsRoutingComponents} from "./decorations/decoration.routing";
import {ranksRoutes, ranksRoutingComponents} from "./ranks/ranks.routing";
import {armyRoutes, armyRoutingComponents} from "./army/army.routing"; import {armyRoutes, armyRoutingComponents} from "./army/army.routing";
import {SignupComponent} from "./login/signup.component"; import {SignupComponent} from "./login/signup.component";
import {AdminComponent} from "./admin/admin.component";
import {RequestAwardComponent} from "./request/award/req-award.component";
import {RequestPromotionComponent} from "./request/promotion/req-promotion.component";
import {ConfirmPromotionComponent} from "./request/confirm-promotion/confirm-promotion.component";
import {ConfirmAwardComponent} from "./request/confirm-award/confirm-award.component";
import {RouteConfig} from "./app.config"; import {RouteConfig} from "./app.config";
import {statsRoutingComponents} from "./statistic/stats.routing";
export const appRoutes: Routes = [ export const appRoutes: Routes = [
@ -25,17 +16,18 @@ export const appRoutes: Routes = [
{path: RouteConfig.loginPath, component: LoginComponent}, {path: RouteConfig.loginPath, component: LoginComponent},
{path: RouteConfig.signUpPath, component: SignupComponent}, {path: RouteConfig.signUpPath, component: SignupComponent},
{path: RouteConfig.requestAwardPath, component: RequestAwardComponent, canActivate: [LoginGuardSQL]}, {path: RouteConfig.request, loadChildren: './request/request.module#RequestModule'},
{path: RouteConfig.requestPromotionPath, component: RequestPromotionComponent, canActivate: [LoginGuardSQL]},
{path: RouteConfig.confirmAwardPath, component: ConfirmAwardComponent, canActivate: [LoginGuardHL]},
{path: RouteConfig.confirmPromotionPath, component: ConfirmPromotionComponent, canActivate: [LoginGuardHL]},
{path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]}, {path: RouteConfig.userPath, loadChildren: './users/users.module#UsersModule', canActivate: [LoginGuardHL]},
{path: RouteConfig.squadPath, children: squadsRoutes, canActivate: [LoginGuardHL]}, {path: RouteConfig.squadPath, loadChildren: './squads/squads.module#SquadsModule', canActivate: [LoginGuardHL]},
{path: RouteConfig.decorationPath, children: decorationsRoutes, canActivate: [LoginGuardHL]}, {
{path: RouteConfig.rankPath, children: ranksRoutes, canActivate: [LoginGuardHL]}, path: RouteConfig.decorationPath,
loadChildren: './decorations/decoration.module#DecorationsModule',
canActivate: [LoginGuardHL]
},
{path: RouteConfig.rankPath, loadChildren: './ranks/ranks.module#RanksModule', canActivate: [LoginGuardHL]},
{path: RouteConfig.adminPanelPath, component: AdminComponent, canActivate: [LoginGuardAdmin]}, {path: RouteConfig.adminPanelPath, loadChildren: './admin/admin.module#AdminModule', canActivate: [LoginGuardAdmin]},
/** Redirect Konfigurationen **/ /** Redirect Konfigurationen **/
{path: '404', component: NotFoundComponent}, {path: '404', component: NotFoundComponent},
@ -44,8 +36,6 @@ export const appRoutes: Routes = [
export const appRouting = RouterModule.forRoot(appRoutes); export const appRouting = RouterModule.forRoot(appRoutes);
export const routingComponents = [LoginComponent, SignupComponent, RequestAwardComponent, RequestPromotionComponent, ConfirmAwardComponent, export const routingComponents = [LoginComponent, SignupComponent, ...armyRoutingComponents, NotFoundComponent];
ConfirmPromotionComponent, AdminComponent, ...armyRoutingComponents, NotFoundComponent,
...squadsRoutingComponents, ...decorationsRoutingComponents, ...ranksRoutingComponents];
export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin]; export const routingProviders = [LoginGuardSQL, LoginGuardHL, LoginGuardMT, LoginGuardAdmin];

View File

@ -1,6 +0,0 @@
import {OpaqueToken} from '@angular/core';
export const AUTH_ENABLED = new OpaqueToken('AUTH_ENABLED');
export const SOCKET_IO = new OpaqueToken('socket-io');

View File

@ -3,7 +3,7 @@ import {User} from "../models/model-interfaces";
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {UserService} from "../services/user-service/user.service"; import {UserService} from "../services/user-service/user.service";
import {Subscription} from "rxjs/Subscription"; import {Subscription} from "rxjs/Subscription";
import {AppConfig, RouteConfig} from "../app.config"; import {RouteConfig} from "../app.config";
@Component({ @Component({

View File

@ -16,7 +16,8 @@
</div> </div>
<div class=" div-table-row" style="padding-left: 8px"> <div class=" div-table-row" style="padding-left: 8px">
<div *ngFor="let member of squad.members"> <div *ngFor="let member of squad.members">
<div class="member-link text-blufor" (click)="select(member._id)">{{member.rank}} {{member.username}}</div> <div class="member-link text-blufor" (click)="select(member._id)">{{member.rank}} {{member.username}}
</div>
</div> </div>
<br> <br>
<br> <br>

View File

@ -1,5 +1,5 @@
import {Component, Input, Optional} from '@angular/core'; import {Component, Input} from '@angular/core';
import {NgForm, FormGroup} from '@angular/forms'; import {FormGroup, NgForm} from '@angular/forms';
@Component({ @Component({
selector: 'show-error', selector: 'show-error',

View File

@ -8,7 +8,7 @@ import {Decoration} from "../../models/model-interfaces";
styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'], styleUrls: ['./decoration-item.component.css', '../../style/list-entry.css'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
inputs: ['decoration', 'selected'], inputs: ['decoration', 'selected'],
outputs: ['decorationDelete','decorationSelected'], outputs: ['decorationDelete', 'decorationSelected'],
}) })
export class DecorationItemComponent { export class DecorationItemComponent {

View File

@ -49,10 +49,10 @@
<div> <div>
<pjm-decoration-item *ngFor="let decoration of decorations$ | async" <pjm-decoration-item *ngFor="let decoration of decorations$ | async"
[decoration]="decoration" [decoration]="decoration"
(decorationDelete)="deleteDecoration(decoration)" (decorationDelete)="deleteDecoration(decoration)"
(decorationSelected)="selectDecoration($event)" (decorationSelected)="selectDecoration($event)"
[selected]="decoration._id == selectedDecorationId"> [selected]="decoration._id == selectedDecorationId">
</pjm-decoration-item> </pjm-decoration-item>
</div> </div>

View File

@ -0,0 +1,15 @@
import {decorationRoutesModule, decorationsRoutingComponents} from "./decoration.routing";
import {SharedModule} from "../shared.module";
import {CommonModule} from "@angular/common";
import {DecorationStore} from "../services/stores/decoration.store";
import {DecorationService} from "../services/decoration-service/decoration.service";
import {NgModule} from "@angular/core";
@NgModule({
declarations: decorationsRoutingComponents,
imports: [CommonModule, SharedModule, decorationRoutesModule],
providers: [DecorationStore, DecorationService]
})
export class DecorationsModule {
static routes = decorationRoutesModule;
}

View File

@ -1,7 +1,9 @@
import {Routes} from "@angular/router"; import {RouterModule, Routes} from "@angular/router";
import {DecorationComponent} from "./decoration.component"; import {DecorationComponent} from "./decoration.component";
import {DecorationListComponent} from "./decoration-list/decoration-list.component"; import {DecorationListComponent} from "./decoration-list/decoration-list.component";
import {EditDecorationComponent} from "./edit-decoration/edit-decoration.component"; import {EditDecorationComponent} from "./edit-decoration/edit-decoration.component";
import {ModuleWithProviders} from "@angular/core";
import {DecorationItemComponent} from "./decoration-list/decoration-item.component";
export const decorationsRoutes: Routes = [{ export const decorationsRoutes: Routes = [{
path: '', component: DecorationComponent, path: '', component: DecorationComponent,
@ -23,5 +25,7 @@ export const decorationsRoutes: Routes = [{
outlet: 'right' outlet: 'right'
}]; }];
export const decorationsRoutingComponents = [DecorationComponent, DecorationListComponent, EditDecorationComponent]; export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes);
export const decorationsRoutingComponents = [DecorationItemComponent, DecorationComponent, DecorationListComponent, EditDecorationComponent];

View File

@ -38,7 +38,7 @@
<div class="form-group"> <div class="form-group">
<label for="sort">Sortierung</label> <label for="sort">Sortierung</label>
<input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle" <input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle"
[(ngModel)]="decoration.sortingNumber"> [(ngModel)]="decoration.sortingNumber">
<show-error text="Sortierung" path="sort"></show-error> <show-error text="Sortierung" path="sort"></show-error>
</div> </div>
@ -51,7 +51,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="graphic">Bild</label> <label for="graphic">Bild</label>
<input id="graphic" name="graphic" class="ui-button form-control" type="file" <input id="graphic" name="graphic" class="ui-button form-control" type="file"
#fileInput #fileInput
accept="image/png" accept="image/png"

View File

@ -79,6 +79,10 @@
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }

View File

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router'; import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
@Injectable() @Injectable()
export class LoginGuardSQL implements CanActivate { export class LoginGuardSQL implements CanActivate {

View File

@ -1,11 +1,6 @@
import {Directive, forwardRef} from '@angular/core'; import {Directive, forwardRef} from '@angular/core';
import { import {AbstractControl, FormControl, NG_ASYNC_VALIDATORS, NG_VALIDATORS} from '@angular/forms';
FormControl,
AbstractControl,
NG_VALIDATORS, NG_ASYNC_VALIDATORS
} from '@angular/forms';
import {UserService} from "../services/user-service/user.service"; import {UserService} from "../services/user-service/user.service";
import {Observable} from "rxjs";
export function asyncIfNotBacklogThenAssignee(control): Promise<any> { export function asyncIfNotBacklogThenAssignee(control): Promise<any> {
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {

View File

@ -28,11 +28,13 @@ export interface Player {
respawn?: number; respawn?: number;
flagTouch?: number; flagTouch?: number;
} }
export interface Campaign { export interface Campaign {
_id?: string; _id?: string;
title?: string; title?: string;
wars?: War[]; wars?: War[];
} }
export interface War { export interface War {
_id?: string; _id?: string;
title?: string; title?: string;

View File

@ -30,7 +30,7 @@ export class EditRankComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private rankService : RankService) { private rankService: RankService) {
} }
ngOnInit() { ngOnInit() {

View File

@ -0,0 +1,15 @@
import {NgModule} from "@angular/core";
import {rankRouterModule, ranksRoutingComponents} from "./ranks.routing";
import {SharedModule} from "../shared.module";
import {CommonModule} from "@angular/common";
import {RankService} from "../services/rank-service/rank.service";
import {RankStore} from "../services/stores/rank.store";
@NgModule({
declarations: ranksRoutingComponents,
imports: [CommonModule, SharedModule, rankRouterModule],
providers: [RankStore, RankService]
})
export class RanksModule {
static routes = rankRouterModule;
}

View File

@ -1,7 +1,9 @@
import {Routes} from "@angular/router"; import {RouterModule, Routes} from "@angular/router";
import {RankComponent} from "./ranks.component"; import {RankComponent} from "./ranks.component";
import {RankListComponent} from "./rank-list/rank-list.component"; import {RankListComponent} from "./rank-list/rank-list.component";
import {EditRankComponent} from "./edit-rank/edit-rank.component"; import {EditRankComponent} from "./edit-rank/edit-rank.component";
import {RankItemComponent} from "./rank-list/rank-item.component";
import {ModuleWithProviders} from "@angular/core";
export const ranksRoutes: Routes = [{ export const ranksRoutes: Routes = [{
@ -24,5 +26,7 @@ export const ranksRoutes: Routes = [{
outlet: 'right' outlet: 'right'
}]; }];
export const ranksRoutingComponents = [RankComponent, RankListComponent, EditRankComponent]; export const rankRouterModule: ModuleWithProviders = RouterModule.forChild(ranksRoutes);
export const ranksRoutingComponents = [RankComponent, RankItemComponent, RankListComponent, EditRankComponent];

View File

@ -47,7 +47,7 @@
<div class="form-group"> <div class="form-group">
<label for="reason">Begründung</label> <label for="reason">Begründung</label>
<textarea class="form-control center-block" name="reason" [(ngModel)]="reason" required <textarea class="form-control center-block" name="reason" [(ngModel)]="reason" required
id="reason" placeholder="Begründung eingeben..." rows="3" ></textarea> id="reason" placeholder="Begründung eingeben..." rows="3"></textarea>
</div> </div>
<button id="cancel" <button id="cancel"

View File

@ -1,5 +1,4 @@
import {Component} from "@angular/core"; import {Component} from "@angular/core";
import {ActivatedRoute, Router} from "@angular/router";
import {Promotion, Rank} from "../../models/model-interfaces"; import {Promotion, Rank} from "../../models/model-interfaces";
import {RankService} from "../../services/rank-service/rank.service"; import {RankService} from "../../services/rank-service/rank.service";
import {PromotionService} from "../../services/promotion-service/promotion.service"; import {PromotionService} from "../../services/promotion-service/promotion.service";

View File

@ -0,0 +1 @@
<router-outlet></router-outlet>

View File

@ -0,0 +1,11 @@
import {Component} from "@angular/core";
@Component({
selector: 'request',
templateUrl: 'request.component.html',
styleUrls: ['request.component.css']
})
export class RequestComponent {
constructor() {
}
}

View File

@ -0,0 +1,22 @@
import {CommonModule} from "@angular/common";
import {SharedModule} from "../shared.module";
import {requestRouterModule} from "./request.routing";
import {NgModule} from "@angular/core";
import {FilterRankPipe} from "../filter/filter.pipe";
import {RequestComponent} from "./request.component";
import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component";
import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component";
import {RequestAwardComponent} from "./award/req-award.component";
import {RequestPromotionComponent} from "./promotion/req-promotion.component";
import {UserService} from "../services/user-service/user.service";
import {UserStore} from "../services/stores/user.store";
@NgModule({
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
ConfirmAwardComponent, FilterRankPipe],
imports: [CommonModule, SharedModule, requestRouterModule],
providers: [UserStore, UserService]
})
export class RequestModule {
static routes = requestRouterModule;
}

View File

@ -0,0 +1,38 @@
import {RouterModule, Routes} from "@angular/router";
import {ModuleWithProviders} from "@angular/core";
import {ConfirmAwardComponent} from "./confirm-award/confirm-award.component";
import {ConfirmPromotionComponent} from "./confirm-promotion/confirm-promotion.component";
import {RequestAwardComponent} from "./award/req-award.component";
import {RequestPromotionComponent} from "./promotion/req-promotion.component";
import {RequestComponent} from "./request.component";
import {RouteConfig} from "../app.config";
import {LoginGuardHL, LoginGuardSQL} from "../login/login.guard";
export const requestRoutes: Routes = [{
path: '', component: RequestComponent
},
{
path: RouteConfig.requestAwardPath,
component: RequestAwardComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.requestPromotionPath,
component: RequestPromotionComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.confirmAwardPath,
component: ConfirmAwardComponent,
canActivate: [LoginGuardHL]
},
{
path: RouteConfig.confirmPromotionPath,
component: ConfirmPromotionComponent,
canActivate: [LoginGuardHL]
}
];
export const requestRouterModule: ModuleWithProviders = RouterModule.forChild(requestRoutes);

View File

@ -1,8 +1,7 @@
import {Injectable} from "@angular/core"; import {Injectable} from "@angular/core";
import {AppUser, User} from "../../models/model-interfaces"; import {AppUser} from "../../models/model-interfaces";
import {URLSearchParams} from "@angular/http";
import {Observable} from "rxjs/Observable"; import {Observable} from "rxjs/Observable";
import {ADD, EDIT, LOAD, REMOVE} from "../stores/user.store"; import {EDIT, LOAD, REMOVE} from "../stores/user.store";
import {AppConfig} from "../../app.config"; import {AppConfig} from "../../app.config";
import {HttpClient} from "../http-client"; import {HttpClient} from "../http-client";
import {AppUserStore} from "../stores/app-user.store"; import {AppUserStore} from "../stores/app-user.store";
@ -30,12 +29,12 @@ export class AppUserService {
} }
updateUser(user: AppUser) { updateUser(user: AppUser) {
return this.http.patch(this.config.apiAppUserPath + user._id, user) return this.http.patch(this.config.apiAppUserPath + user._id, user)
.map(res => res.json()) .map(res => res.json())
.do(savedUser => { .do(savedUser => {
const action = {type: EDIT, data: savedUser}; const action = {type: EDIT, data: savedUser};
this.appUserStore.dispatch(action); this.appUserStore.dispatch(action);
}); });
} }
deleteUser(user) { deleteUser(user) {

View File

@ -1,7 +1,6 @@
import {Injectable} from "@angular/core"; import {Injectable} from "@angular/core";
import {Headers, Http, RequestMethod} from "@angular/http"; import {Headers, Http, RequestMethod} from "@angular/http";
import {Router} from "@angular/router"; import {Router} from "@angular/router";
import {LoginService} from "./login-service/login-service";
@Injectable() @Injectable()
export class HttpClient { export class HttpClient {

View File

@ -1,17 +1,15 @@
import {Inject, Injectable, Optional} from "@angular/core"; import {Injectable} from "@angular/core";
import {Http, Response} from "@angular/http"; import {Http, Response} from "@angular/http";
import "rxjs/add/operator/map"; import "rxjs/add/operator/map";
import {AppConfig} from "../../app.config"; import {AppConfig} from "../../app.config";
import {AUTH_ENABLED} from "../../app.tokens";
import {AppUser} from "../../models/model-interfaces"; import {AppUser} from "../../models/model-interfaces";
import {AwardingService} from "../awarding-service/awarding.service"; import {AwardingService} from "../awarding-service/awarding.service";
import {PromotionService} from "../promotion-service/promotion.service"; import {PromotionService} from "../promotion-service/promotion.service";
@Injectable() @Injectable()
export class LoginService { export class LoginService {
constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled = false, constructor(private http: Http,
private http: Http,
private config: AppConfig, private config: AppConfig,
private awardingService: AwardingService, private awardingService: AwardingService,
private promotionService: PromotionService) { private promotionService: PromotionService) {
@ -47,15 +45,15 @@ export class LoginService {
} }
isLoggedIn() { isLoggedIn() {
return !this.authEnabled || localStorage.getItem('currentUser') != null; return localStorage.getItem('currentUser') != null;
} }
hasPermission(level : number) { hasPermission(level: number) {
let currentUser = JSON.parse(localStorage.getItem('currentUser')); let currentUser = JSON.parse(localStorage.getItem('currentUser'));
return this.isLoggedIn() && currentUser.permission >= level; return this.isLoggedIn() && currentUser.permission >= level;
} }
getCurrentUser() :AppUser { getCurrentUser(): AppUser {
return JSON.parse(localStorage.getItem('currentUser')); return JSON.parse(localStorage.getItem('currentUser'));
} }

View File

@ -3,7 +3,7 @@ import {Squad} from "../../models/model-interfaces";
import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http"; import {RequestMethod, RequestOptions, URLSearchParams} from "@angular/http";
import {Observable} from "rxjs/Observable"; import {Observable} from "rxjs/Observable";
import {SquadStore, ADD, EDIT, LOAD, REMOVE} from "../stores/squad.store"; import {ADD, EDIT, LOAD, REMOVE, SquadStore} from "../stores/squad.store";
import {AppConfig} from "../../app.config"; import {AppConfig} from "../../app.config";
import {HttpClient} from "../http-client"; import {HttpClient} from "../http-client";
@ -18,7 +18,7 @@ export class SquadService {
this.squads$ = squadStore.items$; this.squads$ = squadStore.items$;
} }
findSquads(query = '', fractionFilter='') { findSquads(query = '', fractionFilter = '') {
const searchParams = new URLSearchParams(); const searchParams = new URLSearchParams();
searchParams.append('q', query); searchParams.append('q', query);
searchParams.append('fractFilter', fractionFilter); searchParams.append('fractFilter', fractionFilter);

View File

@ -1,5 +1,5 @@
import {BehaviorSubject} from "rxjs/BehaviorSubject"; import {BehaviorSubject} from "rxjs/BehaviorSubject";
import {AppUser, User} from "../../models/model-interfaces"; import {AppUser} from "../../models/model-interfaces";
export const LOAD = 'LOAD'; export const LOAD = 'LOAD';
export const ADD = 'ADD'; export const ADD = 'ADD';

View File

@ -7,6 +7,7 @@ export const REMOVE = 'REMOVE';
type Id = string | number; type Id = string | number;
interface Identifiable { interface Identifiable {
id?: Id; id?: Id;
} }

View File

@ -6,7 +6,7 @@ import {HttpClient} from "../http-client";
@Injectable() @Injectable()
export class WarService { export class WarService {
campaigns :Campaign[]; campaigns: Campaign[];
constructor(private http: HttpClient, constructor(private http: HttpClient,
private config: AppConfig) { private config: AppConfig) {

View File

@ -30,7 +30,7 @@ export class EditSquadComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private squadService : SquadService) { private squadService: SquadService) {
} }
ngOnInit() { ngOnInit() {

View File

@ -11,7 +11,7 @@
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<img src="{{imageSrc}}" height="50px" class="squad-list-preview"> <img src="{{imageSrc}}" height="50px" class="squad-list-preview">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"></span> <span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"></span>
</div> </div>
</div> </div>

View File

@ -41,10 +41,10 @@
<div> <div>
<pjm-squad-item *ngFor="let squad of squads$ | async" <pjm-squad-item *ngFor="let squad of squads$ | async"
[squad]="squad" [squad]="squad"
(squadDelete)="deleteSquad(squad)" (squadDelete)="deleteSquad(squad)"
(squadSelected)="selectSquad($event)" (squadSelected)="selectSquad($event)"
[selected]="squad._id == selectedSquadId"> [selected]="squad._id == selectedSquadId">
</pjm-squad-item> </pjm-squad-item>
</div> </div>

View File

@ -0,0 +1,15 @@
import {NgModule} from '@angular/core';
import {CommonModule} from "@angular/common";
import {SharedModule} from "../shared.module";
import {squadRouterModule, squadsRoutingComponents} from "./squads.routing";
import {SquadStore} from "../services/stores/squad.store";
import {SquadService} from "../services/squad-service/squad.service";
@NgModule({
declarations: squadsRoutingComponents,
imports: [CommonModule, SharedModule, squadRouterModule],
providers: [SquadStore, SquadService]
})
export class SquadsModule {
static routes = squadRouterModule;
}

View File

@ -1,7 +1,9 @@
import {Routes} from "@angular/router"; import {RouterModule, Routes} from "@angular/router";
import {SquadComponent} from "./squads.component"; import {SquadComponent} from "./squads.component";
import {SquadListComponent} from "./squad-list/squad-list.component"; import {SquadListComponent} from "./squad-list/squad-list.component";
import {EditSquadComponent} from "./edit-squad/edit-squad.component"; import {EditSquadComponent} from "./edit-squad/edit-squad.component";
import {ModuleWithProviders} from "@angular/core";
import {SquadItemComponent} from "./squad-list/squad-item.component";
export const squadsRoutes: Routes = [{ export const squadsRoutes: Routes = [{
path: '', component: SquadComponent, path: '', component: SquadComponent,
@ -23,5 +25,7 @@ export const squadsRoutes: Routes = [{
outlet: 'right' outlet: 'right'
}]; }];
export const squadsRoutingComponents = [SquadComponent, SquadListComponent, EditSquadComponent]; export const squadRouterModule: ModuleWithProviders = RouterModule.forChild(squadsRoutes);
export const squadsRoutingComponents = [SquadComponent, SquadItemComponent, SquadListComponent, EditSquadComponent];

View File

@ -1,3 +1,9 @@
.chart-container { .slide-chart-container {
width: 1200px; width: 1200px;
margin: auto;
}
:host /deep/ .carousel-control {
width: 5%;
cursor: pointer;
} }

View File

@ -1,46 +1,71 @@
<h2>{{title}}</h2> <h2 style="margin-bottom: 20px">{{title}}</h2>
<h3>Punkte</h3>
<div class="chart-container">
<ngx-charts-line-chart
[view]="[1050, 400]"
[scheme]="colorScheme"
[results]="playerData"
[gradient]="false"
[xAxis]="true"
[yAxis]="true"
[legend]="true"
[legendTitle]="''"
[showXAxisLabel]="true"
[showYAxisLabel]="true"
[xAxisLabel]="'Schlachtdatum'"
[yAxisLabel]="'Punkte'"
[autoScale]="false">
</ngx-charts-line-chart>
<div class="btn btn-default" [style.background]="activeSlideIndex === 2 ? '#d9edf7':'white'"
(click)="goToSlide(2)" *ngIf="id != 'all'">Gesamtpunktzahl
</div>
<div class="btn btn-default" [style.background]="activeSlideIndex === 0 ? '#d9edf7':'white'"
(click)="goToSlide(0)">Punkte je Schlacht
</div>
<div class="btn btn-default" [style.background]="activeSlideIndex === 1 ? '#d9edf7':'white'"
(click)="goToSlide(1)">Spielerzahlen
</div> </div>
<h3 style="margin-top: 370px;">Spielerzahlen</h3> <carousel [(activeSlide)]="activeSlideIndex">
<slide *ngIf="id != 'all'">
<div class="chart-container"> <div class="slide-chart-container">
<h3>Gesamtpunktzahl</h3>
<ngx-charts-line-chart <ngx-charts-line-chart
[view]="[1050, 350]" [view]="[1200, 500]"
[scheme]="colorScheme" [scheme]="colorScheme"
[results]="pointData" [results]="pointSumData"
[gradient]="false" [gradient]="false"
[xAxis]="true" [xAxis]="true"
[yAxis]="true" [yAxis]="true"
[legend]="true" [legend]="true"
[legendTitle]="''" [legendTitle]="''"
[showXAxisLabel]="true" [showXAxisLabel]="true"
[showYAxisLabel]="true" [showYAxisLabel]="true"
[xAxisLabel]="'Schlachtdatum'" [yAxisLabel]="'Gesamtpunkte'"
[yAxisLabel]="'Anzahl Spieler'" [autoScale]="true">
[autoScale]="true" </ngx-charts-line-chart>
(select)="onSelect($event)"> </div>
</ngx-charts-line-chart> </slide>
<slide>
</div> <div class="slide-chart-container">
<h3>Punkte je Schlacht</h3>
<ngx-charts-line-chart
[view]="[1200, 500]"
[scheme]="colorScheme"
[results]="pointData"
[gradient]="false"
[xAxis]="true"
[yAxis]="true"
[legend]="true"
[legendTitle]="''"
[showXAxisLabel]="true"
[showYAxisLabel]="true"
[yAxisLabel]="'Punkte'"
[autoScale]="false">
</ngx-charts-line-chart>
</div>
</slide>
<slide>
<div class="slide-chart-container">
<h3>Spielerzahlen</h3>
<ngx-charts-line-chart
[view]="[1200, 500]"
[scheme]="colorScheme"
[results]="playerData"
[gradient]="false"
[xAxis]="true"
[yAxis]="true"
[legend]="true"
[legendTitle]="''"
[showXAxisLabel]="true"
[showYAxisLabel]="true"
[yAxisLabel]="'Anzahl Spieler'"
[autoScale]="true">
</ngx-charts-line-chart>
</div>
</slide>
</carousel>

View File

@ -1,21 +1,24 @@
import {Component} from "@angular/core"; import {Component} from "@angular/core";
import {WarService} from "../../services/war-service/war.service"; import {WarService} from "../../services/war-service/war.service";
import {Campaign, War} from "../../models/model-interfaces";
import {WarListComponent} from "../war-list/war-list.component";
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {CarouselConfig} from "ngx-bootstrap";
@Component({ @Component({
selector: 'stats-overview', selector: 'stats-overview',
templateUrl: './stats-overview.component.html', templateUrl: './stats-overview.component.html',
styleUrls: ['./stats-overview.component.css'], styleUrls: ['./stats-overview.component.css'],
inputs: ['campaigns'] inputs: ['campaigns'],
providers: [{provide: CarouselConfig, useValue: {interval: false}}]
}) })
export class StatisticOverviewComponent { export class StatisticOverviewComponent {
id = "";
title = ""; title = "";
activeSlideIndex: number = 0;
pointData: any[] = []; pointData: any[] = [];
pointSumData: any[] = [];
playerData: any[] = []; playerData: any[] = [];
colorScheme = { colorScheme = {
@ -30,26 +33,30 @@ export class StatisticOverviewComponent {
this.route.params this.route.params
.map(params => params['id']) .map(params => params['id'])
.subscribe((id) => { .subscribe((id) => {
this.id = id;
if (this.warService.campaigns) { if (this.warService.campaigns) {
this.initWars(this.warService.campaigns, id); this.initWars(this.warService.campaigns);
} else { } else {
this.warService.getAllCampaigns().subscribe(campaigns => { this.warService.getAllCampaigns().subscribe(campaigns => {
this.initWars(campaigns, id); this.initWars(campaigns);
}) })
} }
}); });
} }
initWars(campaigns, id) { initWars(campaigns) {
let wars = []; let wars = [];
let itemsProcessed = 0; let itemsProcessed = 0;
campaigns = campaigns.filter(campaign => id === 'all' || campaign._id === id); campaigns = campaigns.filter(campaign => this.id === 'all' || campaign._id === this.id);
campaigns.forEach(campaign => { campaigns.forEach(campaign => {
if (id === 'all') { if (this.id === 'all') {
this.title = "Gesamtübersicht" this.title = "Gesamtübersicht";
} else { } else {
this.title = campaign.title this.title = campaign.title
setTimeout(() => {
this.activeSlideIndex = 2;
}, 10)
} }
wars = wars.concat(campaign.wars); wars = wars.concat(campaign.wars);
itemsProcessed++; itemsProcessed++;
@ -59,6 +66,10 @@ export class StatisticOverviewComponent {
}) })
} }
goToSlide(index: number) {
this.activeSlideIndex = index;
}
initChart(wars: any[]) { initChart(wars: any[]) {
let pointsObj = [ let pointsObj = [
{ {
@ -69,6 +80,15 @@ export class StatisticOverviewComponent {
"name": "CSAT", "name": "CSAT",
"series": [] "series": []
}]; }];
let pointsSumObj = [
{
"name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}];
let playersObj = [ let playersObj = [
{ {
"name": "NATO", "name": "NATO",
@ -80,37 +100,46 @@ export class StatisticOverviewComponent {
} }
]; ];
for (let i = wars.length - 1; i >= 0; i--) { for (let i = wars.length - 1; i >= 0; i--) {
let j = wars.length - i - 1;
const isoDate = wars[i].date.slice(0, 10); const isoDate = wars[i].date.slice(0, 10);
const dayDate = parseInt(isoDate.slice(8, 10)) + 1; const dayDate = parseInt(isoDate.slice(8, 10)) + 1;
const warDateString = (dayDate < 10 ? "0" + dayDate : dayDate) + '.' const warDateString = (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
+ isoDate.slice(5, 7) + '.' + isoDate.slice(0, 4); + isoDate.slice(5, 7) + '.' + isoDate.slice(0, 4);
const bluforData = { pointsObj[0].series.push({
name: warDateString, name: warDateString,
value: wars[i].ptBlufor value: wars[i].ptBlufor
}; });
const opforData = { pointsObj[1].series.push({
name: warDateString, name: warDateString,
value: wars[i].ptOpfor value: wars[i].ptOpfor
}; });
const bluforPlayers = { pointsSumObj[0].series.push({
name: warDateString,
value: pointsSumObj[0].series[j - 1] ?
pointsSumObj[0].series[j - 1].value + wars[i].ptBlufor :
wars[i].ptBlufor
});
pointsSumObj[1].series.push({
name: warDateString,
value: pointsSumObj[1].series[j - 1]
? pointsSumObj[1].series[j - 1].value + wars[i].ptOpfor :
wars[i].ptOpfor
});
playersObj[0].series.push({
name: warDateString, name: warDateString,
value: wars[i].playersBlufor value: wars[i].playersBlufor
}; });
const opforPlayers = { playersObj[1].series.push({
name: warDateString, name: warDateString,
value: wars[i].playersOpfor value: wars[i].playersOpfor
}; });
playersObj[0].series.push(bluforData);
playersObj[1].series.push(opforData);
pointsObj[0].series.push(bluforPlayers);
pointsObj[1].series.push(opforPlayers);
} }
this.pointData = pointsObj; this.pointData = pointsObj;
this.pointSumData = pointsSumObj;
this.playerData = playersObj; this.playerData = playersObj;
Object.assign(this, [this.playerData, this.pointData]) Object.assign(this, [this.pointData, this.pointSumData, this.playerData])
} }
} }

View File

@ -4,12 +4,13 @@ import {SharedModule} from "../shared.module";
import {statsRouterModule, statsRoutingComponents} from "./stats.routing"; import {statsRouterModule, statsRoutingComponents} from "./stats.routing";
import {WarService} from "../services/war-service/war.service"; import {WarService} from "../services/war-service/war.service";
import {DataTableModule} from "angular2-datatable"; import {DataTableModule} from "angular2-datatable";
import {NgxChartsModule} from "@swimlane/ngx-charts"; import {LineChartModule, PieChartModule} from "@swimlane/ngx-charts";
import {AccordionModule} from "ngx-bootstrap"; import {AccordionModule, CarouselModule} from "ngx-bootstrap";
@NgModule({ @NgModule({
declarations: statsRoutingComponents, declarations: statsRoutingComponents,
imports: [CommonModule, SharedModule, statsRouterModule, NgxChartsModule, AccordionModule.forRoot(), DataTableModule], imports: [CommonModule, SharedModule, statsRouterModule, LineChartModule, PieChartModule,
AccordionModule.forRoot(), CarouselModule.forRoot(), DataTableModule],
providers: [WarService] providers: [WarService]
}) })
export class StatsModule { export class StatsModule {

View File

@ -1,7 +1,6 @@
import {Component} from "@angular/core"; import {Component} from "@angular/core";
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {WarService} from "../../services/war-service/war.service"; import {WarService} from "../../services/war-service/war.service";
import {LoginService} from "../../services/login-service/login-service";
import {Player, War} from "../../models/model-interfaces"; import {Player, War} from "../../models/model-interfaces";

View File

@ -6,11 +6,12 @@
<a>{{war.title}}</a> <a>{{war.title}}</a>
</span> </span>
<br> <br>
<small >vom {{war.date | date: 'dd.MM.yyyy'}}</small> <small>vom {{war.date | date: 'dd.MM.yyyy'}}</small>
</div> </div>
<div class="col-xs-3"> <div class="col-xs-3">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash" *ngIf="loginService.hasPermission(3)"></span> <span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"
*ngIf="loginService.hasPermission(3)"></span>
</div> </div>
</div> </div>

View File

@ -40,7 +40,7 @@ span {
} }
.trash { .trash {
float:right; float: right;
padding-top: 18px; padding-top: 18px;
font-size: 17px; font-size: 17px;
} }

View File

@ -12,7 +12,8 @@
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash pull-right"></span> <span (click)="delete(); $event.stopPropagation()" title="Löschen"
class="glyphicon glyphicon-trash trash pull-right"></span>
<span (click)="award(); $event.stopPropagation()" title="Auszeichnungen" class="icon-award pull-right"></span> <span (click)="award(); $event.stopPropagation()" title="Auszeichnungen" class="icon-award pull-right"></span>
</div> </div>
</div> </div>

View File

@ -1,4 +1,3 @@
export const environment = { export const environment = {
production: false, production: false,
e2eMode: true e2eMode: true

View File

@ -9,6 +9,6 @@
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body> <body>
<app-root>Loading...</app-root> <app-root>Loading...</app-root>
</body> </body>
</html> </html>

View File

@ -1,8 +1,8 @@
import { enableProdMode } from '@angular/core'; import {enableProdMode} from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module'; import {AppModule} from './app/app.module';
import { environment } from './environments/environment'; import {environment} from './environments/environment';
import 'rxjs/add/observable/of'; import 'rxjs/add/observable/of';

View File

@ -13,11 +13,9 @@
* *
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/ */
/*************************************************************************************************** /***************************************************************************************************
* BROWSER POLYFILLS * BROWSER POLYFILLS
*/ */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol'; // import 'core-js/es6/symbol';
// import 'core-js/es6/object'; // import 'core-js/es6/object';
@ -32,29 +30,19 @@
// import 'core-js/es6/regexp'; // import 'core-js/es6/regexp';
// import 'core-js/es6/map'; // import 'core-js/es6/map';
// import 'core-js/es6/set'; // import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`. // import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */ /** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/ /** Evergreen browsers require these. **/
import 'core-js/es6/reflect'; import 'core-js/es6/reflect';
import 'core-js/es7/reflect'; import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/ /** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************

View File

@ -1,5 +1,5 @@
body { body {
padding-left: 20px; padding-left: 20px;
padding-top: 50px; padding-top: 50px;
} }
@ -47,6 +47,7 @@ form {
padding-right: 10px; padding-right: 10px;
} }
#right { #right {
overflow: hidden; overflow: hidden;
padding-left: 4%; padding-left: 4%;

View File

@ -9,18 +9,16 @@ import 'zone.js/dist/fake-async-test';
import 'rxjs/Rx'; import 'rxjs/Rx';
import { getTestBed } from '@angular/core/testing'; import {getTestBed} from '@angular/core/testing';
import { import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any; declare var __karma__: any;
declare var require: any; declare var require: any;
// Prevent Karma from running prematurely. // Prevent Karma from running prematurely.
__karma__.loaded = function () {}; __karma__.loaded = function () {
};
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(

View File

@ -12,7 +12,10 @@
"curly": true, "curly": true,
"eofline": true, "eofline": true,
"forin": true, "forin": true,
"import-blacklist": [true, "rxjs"], "import-blacklist": [
true,
"rxjs"
],
"import-spacing": true, "import-spacing": true,
"indent": [ "indent": [
true, true,
@ -97,9 +100,18 @@
"check-separator", "check-separator",
"check-type" "check-type"
], ],
"directive-selector": [
"directive-selector": [true, "attribute", "app", "camelCase"], true,
"component-selector": [true, "element", "app", "kebab-case"], "attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true, "use-input-property-decorator": true,
"use-output-property-decorator": true, "use-output-property-decorator": true,
"use-host-property-decorator": true, "use-host-property-decorator": true,