-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display a maintenance page if a http error 503 occurs (#1111)
* display maintenance page only if the error still exists otherwise route to the home page * requires ICM 7.10.38.16-LTS (WebAdapter version 1.1.4)
- Loading branch information
Showing
12 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { CanActivate, Router } from '@angular/router'; | ||
import { map } from 'rxjs'; | ||
|
||
import { AppFacade } from 'ish-core/facades/app.facade'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class ErrorStatusGuard implements CanActivate { | ||
constructor(private appFacade: AppFacade, private router: Router) {} | ||
canActivate() { | ||
return this.appFacade.generalError$.pipe(map(error => (!error ? this.router.parseUrl('/home') : true))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="errorpage-content col-lg-6 offset-lg-3"> | ||
<h1>{{ 'server.maintenance.page.title' | translate }}</h1> | ||
<div class="error-text mb-3"> | ||
<div [ishServerHtml]="'server.maintenance.page.text' | translate"></div> | ||
</div> | ||
<div class="text-muted d-flex flex-column flex-sm-row justify-content-sm-between"> | ||
<div>{{ 'server.maintenance.page.contact.label' | translate }}</div> | ||
<div> | ||
<fa-icon [icon]="['fas', 'phone']" class="pr-1"></fa-icon> | ||
<a href="tel:{{ 'server.maintenance.page.contact.phone' | translate }}">{{ | ||
'server.maintenance.page.contact.phone' | translate | ||
}}</a> | ||
</div> | ||
<div> | ||
<fa-icon [icon]="['fas', 'envelope']" class="pr-1"></fa-icon> | ||
<a href="mailto:{{ 'server.maintenance.page.contact.email' | translate }}">{{ | ||
'server.maintenance.page.contact.email' | translate | ||
}}</a> | ||
</div> | ||
</div> | ||
</div> |
33 changes: 33 additions & 0 deletions
33
src/app/pages/maintenance/maintenance-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { FaIconComponent } from '@fortawesome/angular-fontawesome'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { MockComponent, MockDirective } from 'ng-mocks'; | ||
|
||
import { ServerHtmlDirective } from 'ish-core/directives/server-html.directive'; | ||
|
||
import { MaintenancePageComponent } from './maintenance-page.component'; | ||
|
||
describe('Maintenance Page Component', () => { | ||
let component: MaintenancePageComponent; | ||
let fixture: ComponentFixture<MaintenancePageComponent>; | ||
let element: HTMLElement; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [TranslateModule.forRoot()], | ||
declarations: [MaintenancePageComponent, MockComponent(FaIconComponent), MockDirective(ServerHtmlDirective)], | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(MaintenancePageComponent); | ||
component = fixture.componentInstance; | ||
element = fixture.nativeElement; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
expect(element).toBeTruthy(); | ||
expect(() => fixture.detectChanges()).not.toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'ish-maintenance-page', | ||
templateUrl: './maintenance-page.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class MaintenancePageComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
|
||
import { SharedModule } from 'ish-shared/shared.module'; | ||
|
||
import { MaintenancePageComponent } from './maintenance-page.component'; | ||
|
||
const maintenancePageRoutes: Routes = [ | ||
{ path: '', component: MaintenancePageComponent, data: { wrapperClass: 'errorpage', headerType: 'error' } }, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(maintenancePageRoutes), SharedModule], | ||
declarations: [MaintenancePageComponent], | ||
}) | ||
export class MaintenancePageModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters