Merge pull request #3370 from hashicorp/b-ui-release-error-state-on-transition
Allow users to escape error pages with the back button
This commit is contained in:
commit
303eb3279b
|
@ -11,6 +11,7 @@ export default Route.extend({
|
|||
|
||||
actions: {
|
||||
didTransition() {
|
||||
this.controllerFor('application').set('error', null);
|
||||
window.scrollTo(0, 0);
|
||||
},
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
{{else if is404}}
|
||||
<h1 class="title is-spaced">Not Found</h1>
|
||||
<p class="subtitle">What you're looking for couldn't be found. It either doesn't exist or you are not authorized to see it.</p>
|
||||
{{else}}
|
||||
<h1 class="title is-spaced">Error</h1>
|
||||
<p class="subtitle">Something went wrong.</p>
|
||||
{{/if}}
|
||||
{{#if (eq config.environment "development")}}
|
||||
<pre class="error-stack-trace"><code>{{errorStr}}</code></pre>
|
||||
|
|
27
ui/tests/acceptance/application-errors-test.js
Normal file
27
ui/tests/acceptance/application-errors-test.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { find, visit } from 'ember-native-dom-helpers';
|
||||
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
|
||||
import { test } from 'qunit';
|
||||
|
||||
moduleForAcceptance('Acceptance | application errors ', {
|
||||
beforeEach() {
|
||||
server.create('agent');
|
||||
server.create('node');
|
||||
server.create('job');
|
||||
},
|
||||
});
|
||||
|
||||
test('transitioning away from an error page resets the global error', function(assert) {
|
||||
server.pretender.get('/v1/nodes', () => [403, {}, null]);
|
||||
|
||||
visit('/nodes');
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('.error-message'), 'Application has errored');
|
||||
});
|
||||
|
||||
visit('/jobs');
|
||||
|
||||
andThen(() => {
|
||||
assert.notOk(find('.error-message'), 'Application is no longer in an error state');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue