Compare commits

...

8 Commits

24 changed files with 173 additions and 157 deletions

View File

@ -8,6 +8,13 @@ li {
display: inline; display: inline;
} }
.sidebar-toggle-btn {
background: linear-gradient(-90deg, #e8e5e5, #ffffff);
filter: drop-shadow(2px 1px 1px #666);
margin-left: -12px;
z-index: 500;
}
.content { .content {
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;

View File

@ -96,16 +96,19 @@
<div> <div>
<button mat-icon-button <button mat-icon-button
class="sidebar-toggle-btn"
(click)="toggleSidebar()" (click)="toggleSidebar()"
*ngIf="router.url.includes('/stats')" *ngIf="showSidebarToggleBtn">
style="background: linear-gradient(-90deg, #e8e5e5,#ffffff);margin-left: -12px;">
<mat-icon svgIcon="chevron-left" *ngIf="sidebarOpen"> <mat-icon svgIcon="chevron-left" *ngIf="sidebarOpen">
</mat-icon> </mat-icon>
<mat-icon svgIcon="chevron-right" *ngIf="!sidebarOpen"> <mat-icon svgIcon="chevron-right" *ngIf="!sidebarOpen">
</mat-icon> </mat-icon>
</button> </button>
<div id="left" *ngIf="sidebarOpen"> <div id="left"
[style.background]="leftBackground"
[style.box-shadow]="leftBoxShadow"
*ngIf="sidebarOpen">
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
@ -118,6 +121,6 @@
</div> </div>
</div> </div>
<mat-spinner class="load-indicator" *ngIf="loading"></mat-spinner> <span *ngIf="loading" class="load-indicator load-arrow glyphicon-refresh-animate"></span>
<button (click)="scrollToTop()" *ngIf="scrollTopVisible" id="scrollTopBtn" title="Zum Seitenanfang"></button> <button (click)="scrollToTop()" *ngIf="scrollTopVisible" id="scrollTopBtn" title="Zum Seitenanfang"></button>

View File

@ -7,6 +7,7 @@ import {RouteConfig} from './app.config';
import {DOCUMENT} from '@angular/common'; import {DOCUMENT} from '@angular/common';
import {DomSanitizer} from '@angular/platform-browser'; import {DomSanitizer} from '@angular/platform-browser';
import {MatIconRegistry} from '@angular/material'; import {MatIconRegistry} from '@angular/material';
import {SpinnerService} from './services/user-interface/spinner/spinner.service';
declare function require(url: string); declare function require(url: string);
@ -23,10 +24,28 @@ export class AppComponent implements OnInit {
sidebarOpen = true; sidebarOpen = true;
showSidebarToggleBtn = false;
scrollTopVisible = false; scrollTopVisible = false;
scrollBtnVisibleVal = 100; scrollBtnVisibleVal = 100;
leftBackground;
leftBoxShadow;
// a map of svgIcon names and associated svg file names
// to load from assets/icon folder
svgIcons = {
'add': 'outline-add_box-24px',
'add-user': 'twotone-person_add-24px',
'edit': 'twotone-edit-24px',
'delete': 'twotone-delete-24px',
'stats-detail': 'round-assessment-24px',
'chevron-left': 'baseline-chevron_left-24px',
'chevron-right': 'baseline-chevron_right-24px'
};
version = 'v'.concat(require('./../../../package.json').version); version = 'v'.concat(require('./../../../package.json').version);
constructor(public loginService: LoginService, constructor(public loginService: LoginService,
@ -35,33 +54,53 @@ export class AppComponent implements OnInit {
private router: Router, private router: Router,
private iconRegistry: MatIconRegistry, private iconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private spinnerService: SpinnerService,
@Inject(DOCUMENT) private document) { @Inject(DOCUMENT) private document) {
this.iconRegistry.addSvgIcon('add', this.initMaterialSvgIcons();
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/outline-add_box-24px.svg'));
this.iconRegistry.addSvgIcon('add-user', this.spinnerService.spinnerActive.subscribe(active => this.toggleSpinner(active));
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/twotone-person_add-24px.svg'));
this.iconRegistry.addSvgIcon('edit',
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/twotone-edit-24px.svg'));
this.iconRegistry.addSvgIcon('delete',
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/twotone-delete-24px.svg'));
this.iconRegistry.addSvgIcon('stats-detail',
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/round-assessment-24px.svg'));
this.iconRegistry.addSvgIcon('chevron-left',
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/baseline-chevron_left-24px.svg'));
this.iconRegistry.addSvgIcon('chevron-right',
sanitizer.bypassSecurityTrustResourceUrl('../assets/icon/baseline-chevron_right-24px.svg'));
router.events.subscribe(event => { router.events.subscribe(event => {
if (event instanceof NavigationStart) { if (event instanceof NavigationStart) {
this.loading = true; this.spinnerService.activate();
} }
if (event instanceof NavigationEnd) { if (event instanceof NavigationEnd) {
this.loading = false; this.spinnerService.deactivate();
const currentUrl = this.router.url;
// scroll to top on route from army overview to user detail and back // scroll to top on route from army overview to user detail and back
if (router.url.includes('overview')) { if (currentUrl.includes('/overview')) {
this.scrollToTop(); this.scrollToTop();
} }
// show sidebar menu on initial page access
this.sidebarOpen = true;
this.showSidebarToggleBtn = currentUrl.includes('/stats');
// remove sidebar styling for components that are rendered inside,
// but not really shown as sidebar (legacy)
if (currentUrl.includes('/login') ||
currentUrl.includes('/signup') ||
currentUrl.endsWith('/404')) {
this.leftBackground = 'none';
this.leftBoxShadow = 'none';
} else {
this.leftBackground = '#f9f9f9';
this.leftBoxShadow = '2px 1px 5px grey';
} }
}
});
}
toggleSpinner(active) {
this.loading = active;
}
initMaterialSvgIcons() {
Object.keys(this.svgIcons).forEach(key => {
const fileUri = '../assets/icon/'.concat(this.svgIcons[key])
.concat('.svg');
this.iconRegistry.addSvgIcon(key, this.sanitizer.bypassSecurityTrustResourceUrl(fileUri));
}); });
} }
@ -88,14 +127,14 @@ export class AppComponent implements OnInit {
logout() { logout() {
this.loginService.logout(); this.loginService.logout();
setTimeout(() => {
this.router.navigate([RouteConfig.overviewPath]); this.router.navigate([RouteConfig.overviewPath]);
return false; }, 500);
} }
scrollToTop() { scrollToTop() {
this.document.body.scrollTop = 0; // For Safari this.document.body.scrollTop = 0; // For Safari
this.document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera this.document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
} }
} }

View File

@ -23,12 +23,13 @@ import {UserService} from './services/army-management/user.service';
import {UserStore} from './services/stores/user.store'; import {UserStore} from './services/stores/user.store';
import {CookieService} from 'ngx-cookie-service'; import {CookieService} from 'ngx-cookie-service';
import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.service'; import {SnackBarService} from './services/user-interface/snack-bar/snack-bar.service';
import {MaterialComponentsModule} from './material-components.module';
import {HttpClientModule} from '@angular/common/http'; import {HttpClientModule} from '@angular/common/http';
import {SpinnerService} from './services/user-interface/spinner/spinner.service';
import {MatSnackBarModule} from '@angular/material';
@NgModule({ @NgModule({
imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, HttpClientModule, imports: [SharedModule, BrowserModule, BrowserAnimationsModule, appRouting, HttpModule, HttpClientModule,
ClipboardModule, MaterialComponentsModule], ClipboardModule, MatSnackBarModule],
providers: [ providers: [
HttpClient, HttpClient,
LoginService, LoginService,
@ -49,7 +50,8 @@ import {HttpClientModule} from '@angular/common/http';
AppConfig, AppConfig,
routingProviders, routingProviders,
CookieService, CookieService,
SnackBarService SnackBarService,
SpinnerService
], ],
declarations: [ declarations: [
AppComponent, AppComponent,

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3 *ngIf="decoration._id">Auszeichnung editieren</h3> <h3 *ngIf="decoration._id">Auszeichnung editieren</h3>
<h3 *ngIf="!decoration._id">Neue Auszeichnung hinzufügen</h3> <h3 *ngIf="!decoration._id">Neue Auszeichnung hinzufügen</h3>
@ -70,6 +70,7 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
(click)="saveDecoration(fileInput)" (click)="saveDecoration(fileInput)"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">

View File

@ -15,10 +15,6 @@
<span *ngIf="!loading">Anmelden</span> <span *ngIf="!loading">Anmelden</span>
<span *ngIf="loading" class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> <span *ngIf="loading" class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span>
</button> </button>
<span *ngIf="showErrorLabel"
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
{{error}}
</span>
</div> </div>

View File

@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {LoginService} from '../services/app-user-service/login-service'; import {LoginService} from '../services/app-user-service/login-service';
import {RouteConfig} from '../app.config'; import {RouteConfig} from '../app.config';
import {SnackBarService} from '../services/user-interface/snack-bar/snack-bar.service';
@Component({ @Component({
@ -12,16 +13,13 @@ import {RouteConfig} from '../app.config';
export class LoginComponent implements OnInit { export class LoginComponent implements OnInit {
showErrorLabel = false;
error: string;
loading = false; loading = false;
returnUrl: string; returnUrl: string;
constructor(private router: Router, constructor(private router: Router,
private loginService: LoginService) { private loginService: LoginService,
private snackBarService: SnackBarService) {
} }
ngOnInit() { ngOnInit() {
@ -40,11 +38,7 @@ export class LoginComponent implements OnInit {
this.router.navigate([this.returnUrl]); this.router.navigate([this.returnUrl]);
}, },
error => { error => {
this.error = error._body; this.snackBarService.showError(error._body, 15000);
this.showErrorLabel = true;
setTimeout(() => {
this.showErrorLabel = false;
}, 4000);
this.loading = false; this.loading = false;
}); });
} }

View File

@ -1,11 +1,11 @@
<form class="form-signin" (ngSubmit)="login(userName.value, password.value, secret.value)"> <form class="form-signin" (ngSubmit)="login(userName.value, password.value, secret.value)">
<div class="row"> <div class="row" style="position: absolute;width: 500px;left: 40%;">
<h2 style="text-align: center;" class="form-signin-heading">Registrieren</h2> <h2 style="text-align: center;" class="form-signin-heading">Registrieren</h2>
<p>Dieses Formular nur ausfüllen wenn du einer <b>HL</b> angehörst oder <b>SQL</b> bist. Dabei den Nutzernamen aus <p>Dieses Formular nur ausfüllen wenn du einer <b>HL</b> angehörst oder <b>SQL</b> bist. Dabei den Nutzernamen aus
dem OPT Forum verwenden! dem OPT Forum verwenden!
Im Forum eine Nachricht an <a href="https://operation-pandora.com/dashboard/index.php?conversation-add/&userID=9" Im Forum eine Nachricht an <a href="https://www.opt4.net/dashboard/index.php?conversation-add/&userID=9"
target="_blank">HardiReady</a> target="_blank">HardiReady</a>
senden, in welcher der 'geheime Text' steht, den du bei der Registrierung nutzt.<br> senden, in welcher der 'geheime Text' steht, den du bei der Registrierung nutzt.<br>
Dabei kann es sich um irgend eine willkürliche Zeichenfolge oder einen Satz handeln - dient nur dem Abgleich. Dabei kann es sich um irgend eine willkürliche Zeichenfolge oder einen Satz handeln - dient nur dem Abgleich.

View File

@ -1,20 +0,0 @@
/**
* Angular material imports
*/
import {NgModule} from '@angular/core';
import {MatProgressSpinnerModule, MatSnackBarModule} from '@angular/material';
@NgModule({
imports: [
MatSnackBarModule,
MatProgressSpinnerModule,
],
exports: [
MatSnackBarModule,
MatProgressSpinnerModule,
]
})
export class MaterialComponentsModule {
}

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3 *ngIf="rank._id">Rang editieren</h3> <h3 *ngIf="rank._id">Rang editieren</h3>
<h3 *ngIf="!rank._id">Neuen Rang hinzufügen</h3> <h3 *ngIf="!rank._id">Neuen Rang hinzufügen</h3>
@ -51,6 +51,7 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
(click)="saveRank(fileInput)" (click)="saveRank(fileInput)"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">

View File

@ -0,0 +1,19 @@
import {EventEmitter, Injectable} from '@angular/core';
@Injectable()
export class SpinnerService {
public spinnerActive: EventEmitter<Boolean>;
constructor() {
this.spinnerActive = new EventEmitter();
}
activate() {
this.spinnerActive.emit(true)
}
deactivate() {
this.spinnerActive.emit(false)
}
}

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3 *ngIf="squad._id">Squad editieren</h3> <h3 *ngIf="squad._id">Squad editieren</h3>
<h3 *ngIf="!squad._id">Neues Squad hinzufügen</h3> <h3 *ngIf="!squad._id">Neues Squad hinzufügen</h3>
@ -51,6 +51,7 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
(click)="saveSquad(fileInput)" (click)="saveSquad(fileInput)"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3 *ngIf="campaign._id">Kampagne editieren</h3> <h3 *ngIf="campaign._id">Kampagne editieren</h3>
<h3 *ngIf="!campaign._id">Neue Kampagne hinzufügen</h3> <h3 *ngIf="!campaign._id">Neue Kampagne hinzufügen</h3>
@ -20,15 +20,10 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
(click)="saveCampaign()" (click)="saveCampaign()"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">
Bestätigen Bestätigen
</button> </button>
<span *ngIf="showErrorLabel"
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
{{error}}
</span>
</form> </form>

View File

@ -4,6 +4,8 @@ import {NgForm} from '@angular/forms';
import {Subscription} from 'rxjs/Subscription'; import {Subscription} from 'rxjs/Subscription';
import {Campaign} from '../../../models/model-interfaces'; import {Campaign} from '../../../models/model-interfaces';
import {CampaignService} from '../../../services/logs/campaign.service'; import {CampaignService} from '../../../services/logs/campaign.service';
import {Message} from '../../../i18n/de.messages';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
@Component({ @Component({
@ -15,17 +17,14 @@ export class CampaignSubmitComponent {
campaign: Campaign = {}; campaign: Campaign = {};
showErrorLabel = false;
error;
subscription: Subscription; subscription: Subscription;
@ViewChild(NgForm) form: NgForm; @ViewChild(NgForm) form: NgForm;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private campaignService: CampaignService) { private campaignService: CampaignService,
private snackBarService: SnackBarService) {
this.subscription = this.route.params this.subscription = this.route.params
.map(params => params['id']) .map(params => params['id'])
.filter(id => id !== undefined) .filter(id => id !== undefined)
@ -42,12 +41,10 @@ export class CampaignSubmitComponent {
if (this.campaign._id) { if (this.campaign._id) {
redirectSuccessUrl = '../' + redirectSuccessUrl; redirectSuccessUrl = '../' + redirectSuccessUrl;
} }
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
this.router.navigate([redirectSuccessUrl + campaign._id], {relativeTo: this.route}); this.router.navigate([redirectSuccessUrl + campaign._id], {relativeTo: this.route});
}, },
error => { error => this.snackBarService.showError(error._body.error.message, 15000));
this.error = error._body.error.message;
this.showErrorLabel = true;
});
} }
cancel() { cancel() {

View File

@ -4,6 +4,20 @@
border: 1px solid #dadada; border: 1px solid #dadada;
overflow-x: auto; overflow-x: auto;
margin: auto; margin: auto;
margin-top: 56px;
}
:host /deep/ table.mat-table > thead {
position: absolute;
width: 977px;
display: inherit;
margin-left: -1px;
margin-top: -57px;
border: 1px solid #dadada;
}
:host /deep/ table.mat-table > tbody {
margin-top: 0 !important;
} }
.in-table-btn { .in-table-btn {
@ -11,20 +25,10 @@
margin-top: -5px; margin-top: -5px;
} }
/* MATERIAL TABLE */
table.mat-table {
margin: auto;
}
table.mat-table img { table.mat-table img {
filter: invert(60%); filter: invert(60%);
} }
:host /deep/ table.mat-table > thead {
position: absolute;
display: inherit;
}
:host /deep/ table.mat-table > tbody { :host /deep/ table.mat-table > tbody {
margin-top: 60px; margin-top: 60px;
display: block; display: block;
@ -37,22 +41,14 @@ table.mat-table img {
width: 90px; width: 90px;
} }
.mat-column-kill, .mat-column-friendlyFire, .mat-column-revive, .mat-column-flagTouch, .mat-column-kill, .mat-column-friendlyFire, .mat-column-revive, .mat-column-flagTouch, .mat-column-vehicleLight,
.mat-column-vehicleLight, .mat-column-vehicleHeavy, .mat-column-vehicleAir, .mat-column-death, .mat-column-respawn { .mat-column-vehicleHeavy, .mat-column-vehicleAir, .mat-column-death, .mat-column-respawn, .mat-column-interact {
width: 67px; width: 67px;
text-indent: 9px; text-indent: 9px;
} }
th.mat-column-interact { td.mat-cell:last-child, td.mat-footer-cell:last-child, th.mat-header-cell:last-child {
padding-left: 36px; padding-right: 0;
background: white;
position: relative;
z-index: 100;
}
/* TABLE SCROLLBAR */
div::-webkit-scrollbar-thumb {
border-top: solid white 56px;
} }
/* MAT ICON BUTTON */ /* MAT ICON BUTTON */

View File

@ -29,7 +29,7 @@
</ng-container> </ng-container>
<ng-container matColumnDef="interact"> <ng-container matColumnDef="interact">
<th mat-header-cell *matHeaderCellDef>&nbsp;</th> <th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<button mat-icon-button <button mat-icon-button
matTooltip="Kampagnenstatistik für {{element.name}}" matTooltip="Kampagnenstatistik für {{element.name}}"

View File

@ -113,11 +113,11 @@ export class ScoreboardComponent implements OnChanges {
csvOut += player.fraction + ','; csvOut += player.fraction + ',';
csvOut += player.kill + ','; csvOut += player.kill + ',';
csvOut += player.friendlyFire + ','; csvOut += player.friendlyFire + ',';
csvOut += player.revive + ',';
csvOut += player.flagTouch + ',';
csvOut += player.vehicleLight + ','; csvOut += player.vehicleLight + ',';
csvOut += player.vehicleHeavy + ','; csvOut += player.vehicleHeavy + ',';
csvOut += player.vehicleAir + ','; csvOut += player.vehicleAir + ',';
csvOut += player.revive + ',';
csvOut += player.flagTouch + ',';
csvOut += player.death + ','; csvOut += player.death + ',';
csvOut += player.respawn; csvOut += player.respawn;
} }

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3>Schlacht bearbeiten</h3> <h3>Schlacht bearbeiten</h3>
<div class="form-group"> <div class="form-group">
@ -71,15 +71,10 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
(click)="updateWar()" (click)="updateWar()"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">
Bestätigen Bestätigen
</button> </button>
<span *ngIf="showErrorLabel"
class="center-block label label-danger" style="font-size: medium; padding: 2px; margin-top: 2px">
{{error}}
</span>
</form> </form>

View File

@ -5,13 +5,14 @@ import {WarService} from '../../../services/logs/war.service';
import {War} from '../../../models/model-interfaces'; import {War} from '../../../models/model-interfaces';
import {CampaignService} from '../../../services/logs/campaign.service'; import {CampaignService} from '../../../services/logs/campaign.service';
import {Subscription} from 'rxjs/Subscription'; import {Subscription} from 'rxjs/Subscription';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../../i18n/de.messages';
@Component({ @Component({
selector: 'war-edit', selector: 'war-edit',
templateUrl: './war-edit.component.html', templateUrl: './war-edit.component.html',
styleUrls: ['./war-edit.component.css', '../../../style/load-indicator.css', styleUrls: ['./war-edit.component.css', '../../../style/entry-form.css', '../../../style/overview.css']
'../../../style/entry-form.css', '../../../style/overview.css']
}) })
export class WarEditComponent { export class WarEditComponent {
@ -19,15 +20,12 @@ export class WarEditComponent {
subscription: Subscription; subscription: Subscription;
showErrorLabel = false;
error;
@ViewChild(NgForm) form: NgForm; @ViewChild(NgForm) form: NgForm;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private warService: WarService, private warService: WarService,
private snackBarService: SnackBarService,
public campaignService: CampaignService) { public campaignService: CampaignService) {
this.subscription = this.route.params this.subscription = this.route.params
.map(params => params['id']) .map(params => params['id'])
@ -41,12 +39,10 @@ export class WarEditComponent {
updateWar() { updateWar() {
this.warService.updateWar(this.war) this.warService.updateWar(this.war)
.subscribe(war => { .subscribe(war => {
this.snackBarService.showSuccess(Message.SUCCESS_SAVE);
this.router.navigate(['../../war/' + war._id], {relativeTo: this.route}); this.router.navigate(['../../war/' + war._id], {relativeTo: this.route});
}, },
error => { error => this.snackBarService.showError(error._body.error.message, 15000));
this.error = error._body.error.message;
this.showErrorLabel = true;
});
} }
cancel() { cancel() {

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3>Neue Schlacht hinzufügen</h3> <h3>Neue Schlacht hinzufügen</h3>
<div class="form-group"> <div class="form-group">
@ -42,12 +42,11 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
*ngIf="!loading" *ngIf="!loading"
(click)="saveWar()" (click)="saveWar()"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">
Bestätigen Bestätigen
</button> </button>
<span *ngIf="loading" class="load-indicator load-arrow glyphicon-refresh-animate"></span>
</form> </form>

View File

@ -5,13 +5,13 @@ import {WarService} from '../../../services/logs/war.service';
import {War} from '../../../models/model-interfaces'; import {War} from '../../../models/model-interfaces';
import {CampaignService} from '../../../services/logs/campaign.service'; import {CampaignService} from '../../../services/logs/campaign.service';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service'; import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {SpinnerService} from '../../../services/user-interface/spinner/spinner.service';
@Component({ @Component({
selector: 'war-submit', selector: 'war-submit',
templateUrl: './war-submit.component.html', templateUrl: './war-submit.component.html',
styleUrls: ['./war-submit.component.css', '../../../style/load-indicator.css', styleUrls: ['./war-submit.component.css', '../../../style/entry-form.css', '../../../style/overview.css']
'../../../style/entry-form.css', '../../../style/overview.css']
}) })
export class WarSubmitComponent { export class WarSubmitComponent {
@ -25,14 +25,13 @@ export class WarSubmitComponent {
loading = false; loading = false;
error;
@ViewChild(NgForm) form: NgForm; @ViewChild(NgForm) form: NgForm;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private warService: WarService, private warService: WarService,
private snackBarService: SnackBarService, private snackBarService: SnackBarService,
private spinnerService: SpinnerService,
public campaignService: CampaignService) { public campaignService: CampaignService) {
} }
@ -53,15 +52,17 @@ export class WarSubmitComponent {
} }
const file: File = this.fileList[0]; const file: File = this.fileList[0];
this.loading = true; this.loading = true;
this.spinnerService.activate();
this.warService.submitWar(this.war, file) this.warService.submitWar(this.war, file)
.subscribe(war => { .subscribe(war => {
this.router.navigate(['../war/' + war._id], {relativeTo: this.route}); this.router.navigate(['../war/' + war._id], {relativeTo: this.route});
}, },
error => { error => {
this.spinnerService.deactivate();
this.loading = false; this.loading = false;
const errorMsg = JSON.parse(error._body).error.message; const errorMsg = JSON.parse(error._body).error.message;
this.snackBarService.showError('Error: '.concat(errorMsg), 10000); this.snackBarService.showError('Error: '.concat(errorMsg), 15000);
}); });
} }

View File

@ -2,43 +2,36 @@
position: absolute; position: absolute;
top: 50%; top: 50%;
z-index: 10000; z-index: 10000;
}
@media only screen and (max-width: 1199px) {
.load-indicator {
left: 46%; left: 46%;
filter: drop-shadow(3px 1px 2px #dadada);
} }
}
@media only screen and (min-width: 1200px) { @media only screen and (min-width: 1200px) {
.load-indicator { .load-indicator {
left: 46%; left: 47.4%;
} }
} }
@media only screen and (min-width: 1376px) { @media only screen and (min-width: 1376px) {
.load-indicator { .load-indicator {
left: 46.5%; left: 48%;
} }
} }
@media only screen and (min-width: 1600px) { @media only screen and (min-width: 1600px) {
.load-indicator { .load-indicator {
left: 47.5%; left: 48.2%;
} }
} }
@media only screen and (min-width: 1925px) { @media only screen and (min-width: 1925px) {
.load-indicator { .load-indicator {
left: 48%; left: 48.7%;
} }
} }
:host /deep/ .mat-progress-spinner circle, .mat-spinner circle {
stroke: #303030 !important;
stroke-linecap: round;
}
.load-arrow { .load-arrow {
background: url(../../assets/loading.png) no-repeat; background: url(../../assets/loading.png) no-repeat;
display: block; display: block;
width: 80px; width: 70px;
height: 80px; height: 70px;
} }
/* Loading Animation */ /* Loading Animation */

View File

@ -1,4 +1,4 @@
<form #form="ngForm" class="overview"> <form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3 *ngIf="user._id">Teilnehmer editieren</h3> <h3 *ngIf="user._id">Teilnehmer editieren</h3>
<h3 *ngIf="!user._id">Neuen Teilnehmer hinzufügen</h3> <h3 *ngIf="!user._id">Neuen Teilnehmer hinzufügen</h3>
@ -41,7 +41,7 @@
<option *ngFor="let rank of ranks" [value]="rank.level">{{rank.name}}</option> <option *ngFor="let rank of ranks" [value]="rank.level">{{rank.name}}</option>
</select> </select>
<show-error displayName="Squad" controlPath="squad"></show-error> <show-error displayName="Rang" controlPath="rank"></show-error>
</div> </div>
<button id="cancel" <button id="cancel"
@ -51,6 +51,7 @@
</button> </button>
<button id="save" <button id="save"
type="submit"
(click)="saveUser(rankLevel.value)" (click)="saveUser(rankLevel.value)"
class="btn btn-default" class="btn btn-default"
[disabled]="!form.valid"> [disabled]="!form.valid">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB