-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
404 support for non existing paths (#162)
Handle 404 when route is absolutely not found
- Loading branch information
1 parent
c6acf88
commit 6eb2406
Showing
10 changed files
with
312 additions
and
82 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
157 changes: 90 additions & 67 deletions
157
core/examples/luigi-sample-angular/src/app/project/project.component.html
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 |
---|---|---|
@@ -1,76 +1,99 @@ | ||
<section class="fd-section"> | ||
<div class="fd-section__header"> | ||
<h1 class="fd-section__title">Project {{ projectId }}</h1> | ||
</div> | ||
<div class="fd-panel"> | ||
<p><strong>LuigiClient uxManager methods:</strong></p> | ||
<button class="fd-button" (click)="toggleModal()">Add backdrop</button> | ||
<p> | ||
<app-code-snippet data="luigiClient.uxManager().addBackdrop()"></app-code-snippet> | ||
<app-code-snippet data="luigiClient.uxManager().removeBackdrop()"></app-code-snippet> | ||
</p> | ||
</div> | ||
<div class="fd-section__header"> | ||
<h1 class="fd-section__title">Project {{ projectId }}</h1> | ||
</div> | ||
<div class="fd-panel"> | ||
<p><strong>LuigiClient uxManager methods:</strong></p> | ||
<button class="fd-button" (click)="toggleModal()">Add backdrop</button> | ||
<p> | ||
<app-code-snippet data="luigiClient.uxManager().addBackdrop()"></app-code-snippet> | ||
<app-code-snippet data="luigiClient.uxManager().removeBackdrop()"></app-code-snippet> | ||
</p> | ||
</div> | ||
</section> | ||
|
||
<section class="fd-section" *ngIf="preservedViewCallbackContext"> | ||
<div class="fd-panel"> | ||
<div class="fd-alert" role="alert"> | ||
<span class="fd-status-label fd-status-label--available"></span> Context received from linkManager().goBack():<br /> | ||
<pre>{{ preservedViewCallbackContext | json }}</pre> | ||
</div> | ||
</div> | ||
<div class="fd-panel"> | ||
<div class="fd-alert" role="alert"> | ||
<span class="fd-status-label fd-status-label--available"></span> Context received from linkManager().goBack():<br /> | ||
<pre>{{ preservedViewCallbackContext | json }}</pre> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="fd-section link-manager" *ngIf="projectId && projectId !== 'overview'"> | ||
<div class="fd-panel"> | ||
<p><strong>LuigiClient linkManager methods:</strong></p> | ||
<ul class="fd-list-group"> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('/overview')">absolute: to overview</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('/overview')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('users/groups/stakeholders')">relative: to stakeholders</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('users/groups/stakeholders')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromClosestContext().navigate('/users/groups/stakeholders')">closest parent: to stakeholders</a> | ||
<app-code-snippet data="luigiClient.linkManager().fromClosestContext().navigate('/users/groups/stakeholders')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromContext('project').navigate('/settings')">parent by name: project to settings</a> | ||
<app-code-snippet data="luigiClient.linkManager().fromContext('project').navigate('/settings')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromClosestContext().withParams({foo: 'bar'}).navigate('settings')">project to settings with params (foo=bar)</a> | ||
<app-code-snippet data="luigiClient.linkManager().fromClosestContext().withParams({foo: 'bar'}).navigate('settings')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromContext('FOOMARK').navigate('/settings')">parent by name: with nonexisting context</a> (look at the console) | ||
<app-code-snippet data="luigiClient.linkManager().fromContext('FOOMARK').navigate('/settings')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('/settings', null, true)">with preserved view: project to global settings and back</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('/settings', null, true)"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item check-path"> | ||
<span>Check if path exists</span> | ||
<app-code-snippet data="luigiClient.linkManager().pathExists('{{pathExists.formValue}}')"></app-code-snippet> | ||
<span> | ||
<input type="text" [(ngModel)]="pathExists.formValue" (input)="resetPathExistsResult()"/> | ||
<button class="fd-button" (click)="checkIfPathExists()">Check</button> | ||
</span> | ||
<p class="check-path-result"> | ||
<ng-container *ngIf="pathExists.result === true"> | ||
Path {{pathExists.formValue}} exists! | ||
</ng-container> | ||
<ng-container *ngIf="pathExists.result === false"> | ||
Path {{pathExists.formValue}} does not exist! | ||
</ng-container> | ||
</p> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="fd-panel"> | ||
<p><strong>LuigiClient linkManager methods:</strong></p> | ||
<ul class="fd-list-group"> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('/overview')">absolute: to overview</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('/overview')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('users/groups/stakeholders')">relative: to stakeholders</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('users/groups/stakeholders')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromClosestContext().navigate('/users/groups/stakeholders')"> | ||
closest parent: to stakeholders</a> | ||
<app-code-snippet data="luigiClient.linkManager().fromClosestContext().navigate('/users/groups/stakeholders')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromContext('project').navigate('/settings')"> | ||
parent by name: project to settings</a> | ||
<app-code-snippet data="luigiClient.linkManager().fromContext('project').navigate('/settings')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromClosestContext().withParams({foo: 'bar'}).navigate('settings')"> | ||
project to settings with params (foo=bar)</a> | ||
<app-code-snippet data="luigiClient.linkManager().fromClosestContext().withParams({foo: 'bar'}).navigate('settings')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().fromContext('FOOMARK').navigate('/settings')"> | ||
parent by name: with nonexisting context</a> (look at the console) | ||
<app-code-snippet data="luigiClient.linkManager().fromContext('FOOMARK').navigate('/settings')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('/settings', null, true)"> | ||
with preserved view: project to global settings and back</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('/settings', null, true)"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item check-path"> | ||
<span>Check if path exists</span> | ||
<app-code-snippet data="luigiClient.linkManager().pathExists('{{pathExists.formValue}}')"></app-code-snippet> | ||
<span> | ||
<input type="text" [(ngModel)]="pathExists.formValue" (input)="resetPathExistsResult()" /> | ||
<button class="fd-button" (click)="checkIfPathExists()">Check</button> | ||
</span> | ||
<p class="check-path-result"> | ||
<ng-container *ngIf="pathExists.result === true"> | ||
Path {{pathExists.formValue}} exists! | ||
</ng-container> | ||
<ng-container *ngIf="pathExists.result === false"> | ||
Path {{pathExists.formValue}} does not exist! | ||
</ng-container> | ||
</p> | ||
</li> | ||
</ul> | ||
</div> | ||
</section> | ||
|
||
<app-modal [modalActive]="modalActive" (modalClosed)="toggleModal()"></app-modal> | ||
<section class="fd-section" *ngIf="projectId && projectId !== 'overview'"> | ||
<div class="fd-panel"> | ||
<p><strong>LuigiClient - wrong paths in linkManager.navigate():</strong></p> | ||
<ul class="fd-list-group"> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('/projects/pr2/miscellaneous2/maskopatol')">Partly | ||
wrong link | ||
</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('/projects/pr2/miscellaneous2/maskopatol')"></app-code-snippet> | ||
</li> | ||
<li class="fd-list-group__item"> | ||
<a href="javascript:void(0)" (click)="luigiClient.linkManager().navigate('/maskopatol/has/a/child')">Totally wrong link</a> | ||
<app-code-snippet data="luigiClient.linkManager().navigate('/maskopatol/has/a/child')"></app-code-snippet> | ||
</li> | ||
</ul> | ||
</div> | ||
</section> | ||
|
||
<app-modal [modalActive]="modalActive" (modalClosed)="toggleModal()"></app-modal> |
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
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
4 changes: 2 additions & 2 deletions
4
core/test/navigation.spec.js → core/test/services/navigation.spec.js
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
Oops, something went wrong.