diff --git a/ui/app/routes/application.js b/ui/app/routes/application.js index 1b6fe6335..f84961641 100644 --- a/ui/app/routes/application.js +++ b/ui/app/routes/application.js @@ -11,6 +11,7 @@ export default Route.extend({ actions: { didTransition() { + this.controllerFor('application').set('error', null); window.scrollTo(0, 0); }, diff --git a/ui/app/templates/application.hbs b/ui/app/templates/application.hbs index 0dfba7e6e..1299680b6 100644 --- a/ui/app/templates/application.hbs +++ b/ui/app/templates/application.hbs @@ -10,6 +10,9 @@ {{else if is404}}

Not Found

What you're looking for couldn't be found. It either doesn't exist or you are not authorized to see it.

+ {{else}} +

Error

+

Something went wrong.

{{/if}} {{#if (eq config.environment "development")}}
{{errorStr}}
diff --git a/ui/tests/acceptance/application-errors-test.js b/ui/tests/acceptance/application-errors-test.js new file mode 100644 index 000000000..385961325 --- /dev/null +++ b/ui/tests/acceptance/application-errors-test.js @@ -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'); + }); +});