mirror of https://github.com/abpframework/abp
parent
a2d00356ac
commit
5e9d4d67ec
@ -0,0 +1,15 @@
|
||||
.error {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
background-color: #fff;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 999999;
|
||||
}
|
||||
|
||||
.centered {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngxs/store';
|
||||
|
||||
@Component({
|
||||
selector: 'abp-error-500',
|
||||
template: `
|
||||
<div class="error">
|
||||
<div class="row centered">
|
||||
<div class="col-md-12">
|
||||
<div class="error-template">
|
||||
<h1>
|
||||
Oops!
|
||||
</h1>
|
||||
<div class="error-details">
|
||||
Sorry, an error has occured.
|
||||
</div>
|
||||
<div class="error-actions">
|
||||
<a routerLink="/" class="btn btn-primary btn-md mt-2"
|
||||
><span class="glyphicon glyphicon-home"></span> Take Me Home
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
styleUrls: ['error-500.component.scss'],
|
||||
})
|
||||
export class Error500Component implements OnInit {
|
||||
constructor(private store: Store) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
.abp-loader-bar {
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
transition: opacity 0.4s linear 0.4s;
|
||||
z-index: 99999;
|
||||
|
||||
&.is-loading {
|
||||
opacity: 1;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.abp-progress {
|
||||
background: #77b6ff;
|
||||
box-shadow: 0 0 10px rgba(119, 182, 255, 0.7);
|
||||
height: 2px;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { Actions, ofActionSuccessful } from '@ngxs/store';
|
||||
import { LoaderStart, LoaderStop } from '@abp/ng.core';
|
||||
import { filter } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'abp-loader-bar',
|
||||
template: `
|
||||
<div id="abp-loader-bar" [ngClass]="containerClass" [class.is-loading]="isLoading">
|
||||
<div [ngClass]="progressClass" [style.width.vw]="progressLevel"></div>
|
||||
</div>
|
||||
`,
|
||||
styleUrls: ['./loader-bar.component.scss'],
|
||||
})
|
||||
export class LoaderBarComponent {
|
||||
@Input()
|
||||
containerClass: string = 'abp-loader-bar';
|
||||
|
||||
@Input()
|
||||
progressClass: string = 'abp-progress';
|
||||
|
||||
@Input()
|
||||
isLoading: boolean = false;
|
||||
|
||||
@Input()
|
||||
filter = (action: LoaderStart | LoaderStop) => action.payload.url.indexOf('openid-configuration') < 0;
|
||||
|
||||
progressLevel: number = 0;
|
||||
|
||||
interval: any;
|
||||
|
||||
constructor(private actions: Actions) {
|
||||
actions
|
||||
.pipe(
|
||||
ofActionSuccessful(LoaderStart, LoaderStop),
|
||||
filter(this.filter),
|
||||
)
|
||||
.subscribe(action => {
|
||||
if (action instanceof LoaderStart) {
|
||||
this.startLoading();
|
||||
} else {
|
||||
this.stopLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
startLoading() {
|
||||
this.isLoading = true;
|
||||
const interval = setInterval(() => {
|
||||
if (this.progressLevel < 75) {
|
||||
this.progressLevel += Math.random() * 10;
|
||||
} else if (this.progressLevel < 90) {
|
||||
this.progressLevel += 0.4;
|
||||
} else if (this.progressLevel < 100) {
|
||||
this.progressLevel += 0.1;
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 300);
|
||||
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
stopLoading() {
|
||||
clearInterval(this.interval);
|
||||
this.progressLevel = 100;
|
||||
this.isLoading = false;
|
||||
|
||||
setTimeout(() => {
|
||||
this.progressLevel = 0;
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue