mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2025-12-27 20:53:17 +09:00
#71 added a generic error view
This commit is contained in:
@@ -6,6 +6,7 @@ import {NotFoundComponent} from './views/not-found';
|
||||
import {ForbiddenComponent} from './views/forbidden';
|
||||
|
||||
import {ManagerComponent} from './views/manager';
|
||||
import {GenericErrorComponent} from './views/error/genericError.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
@@ -33,6 +34,10 @@ export const routes: Routes = [
|
||||
path: '403',
|
||||
component: ForbiddenComponent
|
||||
},
|
||||
{
|
||||
path: 'error',
|
||||
component: GenericErrorComponent
|
||||
},
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: '/404'
|
||||
|
||||
@@ -59,9 +59,9 @@ import {
|
||||
} from './services';
|
||||
import { ForbiddenComponent } from './views/forbidden/forbidden.component';
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import { environment } from '../environments/environment';
|
||||
import {SimpleTriggerConfigComponent} from './components/simple-trigger-config';
|
||||
import JobService from './services/job.service';
|
||||
import {GenericErrorComponent} from './views/error/genericError.component';
|
||||
|
||||
export function initUserFactory(userService: UserService) {
|
||||
return () => userService.fetchLoggedUser();
|
||||
@@ -116,6 +116,7 @@ export function jwtOptionsFactory(apiService: ApiService) {
|
||||
LogsPanelComponent,
|
||||
ProgressPanelComponent,
|
||||
ForbiddenComponent,
|
||||
GenericErrorComponent,
|
||||
TriggerListComponent
|
||||
],
|
||||
imports: [
|
||||
|
||||
@@ -35,13 +35,15 @@ export class UserService {
|
||||
this.currentUser = user;
|
||||
this.router.initialNavigation();
|
||||
}, err => {
|
||||
console.log(`error retrieving current user due to ` + err);
|
||||
console.log(`error retrieving current user due to ` + JSON.stringify(err));
|
||||
const httpErrorResponse = err as HttpErrorResponse;
|
||||
if (httpErrorResponse.status === 404) {
|
||||
this.isAnAnonymousUser = true;
|
||||
this.router.initialNavigation();
|
||||
return;
|
||||
}
|
||||
// TODO generic error!
|
||||
if (httpErrorResponse.status < 200 || httpErrorResponse.status > 399)
|
||||
this.router.navigateByUrl('/error');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<div fxLayout="column" fxLayoutAlign="center" style="text-align: center">
|
||||
<div>
|
||||
<div>
|
||||
<p style="font-size: 4em; margin-bottom: 0">Unexpected Error</p>
|
||||
<p>Please try again later!</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<img src="assets/image/error.svg" alt="generic error"/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {GenericErrorComponent} from './genericError.component';
|
||||
|
||||
describe('GenericComponent', () => {
|
||||
let component: GenericErrorComponent;
|
||||
let fixture: ComponentFixture<GenericErrorComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GenericErrorComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GenericErrorComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'qrzmng-generic-error',
|
||||
templateUrl: './genericError.component.html',
|
||||
styleUrls: ['./genericError.component.css']
|
||||
})
|
||||
export class GenericErrorComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
1
quartz-manager-frontend/src/assets/image/error.svg
Normal file
1
quartz-manager-frontend/src/assets/image/error.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.7 KiB |
Reference in New Issue
Block a user