* Revert to legacy load indicator and improve it

* Fix enter submit of forgotten forms
pull/43/head
HardiReady 2018-07-17 11:34:32 +02:00
parent f2e2133496
commit d72db1ed4f
13 changed files with 42 additions and 69 deletions

View File

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

View File

@ -96,9 +96,9 @@
<div> <div>
<button mat-icon-button <button mat-icon-button
class="sidebar-toggle-btn"
(click)="toggleSidebar()" (click)="toggleSidebar()"
*ngIf="showSidebarToggleBtn" *ngIf="showSidebarToggleBtn">
style="background: linear-gradient(-90deg, #e8e5e5,#ffffff);margin-left: -12px;z-index:500;">
<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">
@ -121,6 +121,6 @@
</div> </div>
</div> </div>
<mat-spinner class="load-indicator" *ngIf="loading"></mat-spinner> <span 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

@ -34,6 +34,8 @@ export class AppComponent implements OnInit {
leftBoxShadow; leftBoxShadow;
// a map of svgIcon names and associated svg file names
// to load from assets/icon folder
svgIcons = { svgIcons = {
'add': 'outline-add_box-24px', 'add': 'outline-add_box-24px',
'add-user': 'twotone-person_add-24px', 'add-user': 'twotone-person_add-24px',
@ -63,17 +65,20 @@ export class AppComponent implements OnInit {
this.spinnerService.activate(); this.spinnerService.activate();
} }
if (event instanceof NavigationEnd) { if (event instanceof NavigationEnd) {
this.spinnerService.deactivate();
const currentUrl = this.router.url; const currentUrl = this.router.url;
this.spinnerService.deactivate();
// 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 (currentUrl.includes('/overview')) { if (currentUrl.includes('/overview')) {
this.scrollToTop(); this.scrollToTop();
} }
// show sidebar menu on initial page access // show sidebar menu on initial page access
this.sidebarOpen = true; this.sidebarOpen = true;
this.showSidebarToggleBtn = currentUrl.includes('/stats'); 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') || if (currentUrl.includes('/login') ||
currentUrl.includes('/signup') || currentUrl.includes('/signup') ||
currentUrl.endsWith('/404')) { currentUrl.endsWith('/404')) {
@ -87,13 +92,14 @@ export class AppComponent implements OnInit {
}); });
} }
toggleSpinner(active){ toggleSpinner(active) {
this.loading = active; this.loading = active;
} }
initMaterialSvgIcons() { initMaterialSvgIcons() {
Object.keys(this.svgIcons).forEach(key => { Object.keys(this.svgIcons).forEach(key => {
const fileUri = '../assets/icon/' + this.svgIcons[key] + '.svg'; const fileUri = '../assets/icon/'.concat(this.svgIcons[key])
.concat('.svg');
this.iconRegistry.addSvgIcon(key, this.sanitizer.bypassSecurityTrustResourceUrl(fileUri)); this.iconRegistry.addSvgIcon(key, this.sanitizer.bypassSecurityTrustResourceUrl(fileUri));
}); });
} }

View File

@ -23,13 +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 {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,

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,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

@ -44,7 +44,7 @@ export class CampaignSubmitComponent {
this.snackBarService.showSuccess(Message.SUCCESS_SAVE); 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 => this.snackBarService.showError(error._body.error.message, 30000)); error => this.snackBarService.showError(error._body.error.message, 15000));
} }
cancel() { cancel() {

View File

@ -12,8 +12,7 @@ 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 {
@ -43,7 +42,7 @@ export class WarEditComponent {
this.snackBarService.showSuccess(Message.SUCCESS_SAVE); 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 => this.snackBarService.showError(error._body.error.message, 30000)); error => this.snackBarService.showError(error._body.error.message, 15000));
} }
cancel() { cancel() {

View File

@ -49,6 +49,4 @@
[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;
left: 46%;
filter: drop-shadow(3px 1px 2px #dadada);
} }
@media only screen and (max-width: 1199px) {
.load-indicator {
left: 46%;
}
}
@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 */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB