Compare commits
No commits in common. "2e4ec1e36036a052e89501d4f8b3d0724f8b65e0" and "bc24aaf26fca03c57b3138415eea8fc44bbc1aa8" have entirely different histories.
2e4ec1e360
...
bc24aaf26f
File diff suppressed because it is too large
Load Diff
|
@ -34,7 +34,6 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"chai-http": "^3.0.0",
|
"chai-http": "^3.0.0",
|
||||||
"mocha": "^3.3.0",
|
"mocha": "^3.3.0"
|
||||||
"nodemon": "^1.11.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "opt-cc",
|
"name": "opt-cc",
|
||||||
"version": "1.1.2",
|
"version": "1.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm run deploy-static-prod && npm start --prefix ./api",
|
"start": "npm run deploy-static-prod && npm start --prefix ./api",
|
||||||
"dev": "npm run deploy-static && npm run dev --prefix ./api",
|
"dev": "npm run deploy-static && npm run dev --prefix ./api",
|
||||||
"deploy-static": "cd ./static && $(npm bin)/ng build && ln -s ../api/resource/ ../public/resource",
|
"deploy-static": "cd ./static && ng build && ln -s ../api/resource/ ../public/resource",
|
||||||
"deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource",
|
"deploy-static-prod": "cd ./static && ng build --env=prod && ln -s ../api/resource/ ../public/resource",
|
||||||
"postinstall": "npm install --prefix ./static && npm install --prefix ./api",
|
"postinstall": "npm install --prefix ./static && npm install --prefix ./api",
|
||||||
"mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data",
|
"mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data",
|
||||||
"test": "npm test --prefix ./api",
|
"test": "npm test --prefix ./api",
|
||||||
|
|
|
@ -28,30 +28,3 @@ li {
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.unprocessed {
|
|
||||||
-webkit-animation-name: color-blink; /* Safari 4.0 - 8.0 */
|
|
||||||
-webkit-animation-duration: 4s; /* Safari 4.0 - 8.0 */
|
|
||||||
animation-name: color-blink;
|
|
||||||
animation-duration: 4s;
|
|
||||||
animation-iteration-count: infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.unprocessed-child {
|
|
||||||
background-color: orange;
|
|
||||||
}
|
|
||||||
|
|
||||||
unprocessed-child:hover {
|
|
||||||
background-color: orange;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Safari 4.0 - 8.0 */
|
|
||||||
@-webkit-keyframes color-blink {
|
|
||||||
from {background-color: #222222;}
|
|
||||||
to {background-color: orange;}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes color-blink {
|
|
||||||
from {background-color: #222222;}
|
|
||||||
to {background-color: orange;}
|
|
||||||
}
|
|
||||||
|
|
|
@ -67,17 +67,17 @@
|
||||||
</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="#" 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]="['/confirm-promotion']">Beförderung</a>
|
<a [routerLink]="['/confirm-promotion']">Beförderung</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a [ngClass]="{'unprocessed-child': awardingService.hasUnprocessedAwards}" [routerLink]="['/confirm-award']">Orden/ Auszeichnung</a>
|
<a [routerLink]="['/confirm-award']">Orden/ Auszeichnung</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import {Component, Inject, Optional} from '@angular/core';
|
import {Component, Inject, Optional} from '@angular/core';
|
||||||
import {Router} from '@angular/router';
|
import {
|
||||||
|
Router,
|
||||||
|
NavigationEnd,
|
||||||
|
ActivatedRoute,
|
||||||
|
} from '@angular/router';
|
||||||
import {LoginService} from './services/login-service/login-service';
|
import {LoginService} from './services/login-service/login-service';
|
||||||
|
import {Title} from '@angular/platform-browser';
|
||||||
import {AUTH_ENABLED} from './app.tokens';
|
import {AUTH_ENABLED} from './app.tokens';
|
||||||
import {WarService} from "./services/war-service/war.service";
|
import {WarService} from "./services/war-service/war.service";
|
||||||
import {War} from "./models/model-interfaces";
|
import {War} from "./models/model-interfaces";
|
||||||
import {PromotionService} from "./services/promotion-service/promotion.service";
|
|
||||||
import {AwardingService} from "./services/awarding-service/awarding.service";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
@ -14,34 +17,41 @@ import {AwardingService} from "./services/awarding-service/awarding.service";
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
||||||
|
defaultTitle: string;
|
||||||
|
|
||||||
wars: War[] = [];
|
wars: War[] = [];
|
||||||
|
|
||||||
constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled,
|
constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled,
|
||||||
private loginService: LoginService,
|
private loginService: LoginService,
|
||||||
private warService: WarService,
|
private warService: WarService,
|
||||||
private promotionService: PromotionService,
|
private activatedRoute: ActivatedRoute,
|
||||||
private awardingService: AwardingService,
|
private router: Router,
|
||||||
private router: Router) {
|
private titleService: Title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.defaultTitle = this.titleService.getTitle();
|
||||||
|
this.router.events
|
||||||
|
.filter(event => event instanceof NavigationEnd)
|
||||||
|
.subscribe(event => {
|
||||||
|
this.setBrowserTitle();
|
||||||
|
});
|
||||||
this.warService.getAllWars().subscribe((wars) => {
|
this.warService.getAllWars().subscribe((wars) => {
|
||||||
this.wars = wars;
|
this.wars = wars;
|
||||||
});
|
})
|
||||||
if (this.loginService.hasPermission(2)) {
|
|
||||||
const fraction = this.loginService.getCurrentUser().squad.fraction;
|
}
|
||||||
this.promotionService.getUnconfirmedPromotions(fraction).subscribe((items) => {
|
|
||||||
if (items.length > 0) {
|
setBrowserTitle() {
|
||||||
this.promotionService.hasUnprocessedPromotion = true;
|
let title = this.defaultTitle;
|
||||||
}
|
let route = this.activatedRoute;
|
||||||
});
|
// firstChild gibt die Haupt-Kindroute der übergebenen Route zurück
|
||||||
this.awardingService.getUnconfirmedAwards(fraction).subscribe((items) => {
|
while (route.firstChild) {
|
||||||
if (items.length > 0) {
|
route = route.firstChild;
|
||||||
this.awardingService.hasUnprocessedAwards = true;
|
title = route.snapshot.data['title'] || title;
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
this.titleService.setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
(change)="toggleDecoPreview(decoDescription, decoPreview)"
|
(change)="toggleDecoPreview(decoDescription, decoPreview)"
|
||||||
required>
|
required>
|
||||||
<option *ngFor="let deco of decorations" [ngValue]="deco">
|
<option *ngFor="let deco of decorations" [ngValue]="deco">
|
||||||
{{deco.name}}
|
{{deco.fraction == 'BLUFOR'? 'NATO' : deco.fraction == 'OPFOR'? 'CSAT' : 'Global'}}: {{deco.name}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from "@angular/core";
|
||||||
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {Award} from "../../models/model-interfaces";
|
import {Award} from "../../models/model-interfaces";
|
||||||
import {AwardingService} from "../../services/awarding-service/awarding.service";
|
import {AwardingService} from "../../services/awarding-service/awarding.service";
|
||||||
|
|
||||||
|
@ -13,7 +14,9 @@ export class ConfirmAwardComponent {
|
||||||
|
|
||||||
showSuccessLabel = false;
|
showSuccessLabel = false;
|
||||||
|
|
||||||
constructor(private awardingService: AwardingService) {
|
constructor(private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private awardingService: AwardingService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -34,9 +37,6 @@ export class ConfirmAwardComponent {
|
||||||
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
|
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
|
||||||
this.awards = awards;
|
this.awards = awards;
|
||||||
if (awards.length < 1) {
|
|
||||||
this.awardingService.hasUnprocessedAwards = false;
|
|
||||||
}
|
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
|
|
|
@ -17,7 +17,9 @@ export class ConfirmPromotionComponent {
|
||||||
|
|
||||||
promotions: Promotion[];
|
promotions: Promotion[];
|
||||||
|
|
||||||
constructor(private rankService: RankService,
|
constructor(private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private rankService: RankService,
|
||||||
private promotionService: PromotionService) {
|
private promotionService: PromotionService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +45,6 @@ export class ConfirmPromotionComponent {
|
||||||
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {
|
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {
|
||||||
this.promotions = promotions;
|
this.promotions = promotions;
|
||||||
if (promotions.length < 1) {
|
|
||||||
this.promotionService.hasUnprocessedPromotion = false;
|
|
||||||
}
|
|
||||||
this.showSuccessLabel = true;
|
this.showSuccessLabel = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSuccessLabel = false;
|
this.showSuccessLabel = false;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from "@angular/core";
|
||||||
import {Award} from "../../models/model-interfaces";
|
import {Award, User} from "../../models/model-interfaces";
|
||||||
|
import {Headers, Http} from "@angular/http";
|
||||||
|
import {Observable} from "rxjs/Observable";
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from "../../app.config";
|
||||||
import {HttpClient} from "../http-client";
|
import {HttpClient} from "../http-client";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AwardingService {
|
export class AwardingService {
|
||||||
|
|
||||||
hasUnprocessedAwards = false;
|
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(private http: HttpClient,
|
||||||
private config: AppConfig) {
|
private config: AppConfig) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import "rxjs/add/operator/map";
|
||||||
|
|
||||||
import {AppConfig} from "../../app.config";
|
import {AppConfig} from "../../app.config";
|
||||||
import {AUTH_ENABLED} from "../../app.tokens";
|
import {AUTH_ENABLED} from "../../app.tokens";
|
||||||
import {AppUser} from "../../models/model-interfaces";
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LoginService {
|
export class LoginService {
|
||||||
|
@ -46,10 +45,6 @@ export class LoginService {
|
||||||
return this.isLoggedIn() && currentUser.permission >= level;
|
return this.isLoggedIn() && currentUser.permission >= level;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentUser() :AppUser {
|
|
||||||
return JSON.parse(localStorage.getItem('currentUser'));
|
|
||||||
}
|
|
||||||
|
|
||||||
hasSquad() {
|
hasSquad() {
|
||||||
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||||
return currentUser.squad != null;
|
return currentUser.squad != null;
|
||||||
|
|
|
@ -6,8 +6,6 @@ import {Promotion} from "../../models/model-interfaces";
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PromotionService {
|
export class PromotionService {
|
||||||
|
|
||||||
hasUnprocessedPromotion = false;
|
|
||||||
|
|
||||||
constructor(private http: HttpClient,
|
constructor(private http: HttpClient,
|
||||||
private config: AppConfig) {
|
private config: AppConfig) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue