Skip to content

Commit

Permalink
Merge pull request #4850 from hashicorp/f-ui-links-on-error-pages
Browse files Browse the repository at this point in the history
UI: Escape hatch links on error pages
  • Loading branch information
DingoEatingFuzz authored Nov 19, 2018
2 parents c5a222b + b002823 commit 654611e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ui/app/mixins/with-watchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default Mixin.create(WithVisibilityDetection, {
actions: {
willTransition() {
this.cancelAllWatchers();

// Bubble the action up to the application route
return true;
},
},
});
22 changes: 17 additions & 5 deletions ui/app/styles/components/error-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,32 @@
height: 100%;
padding-top: 25vh;
display: flex;
justify-content: center;
background: $grey-lighter;
flex-direction: column;
justify-content: start;
align-items: center;
background: $white-ter;

.error-message {
width: 95vw;
max-width: 600px;

.title,
.subtitle {
.title {
text-align: center;
}
}

.error-stack-trace {
border: 1px solid $grey-light;
border: 1px solid $grey-lighter;
border-radius: $radius;
background: $white;
}

.error-links {
padding-top: 15px;
margin-top: 15px;
border-top: 1px solid $grey-lighter;
width: 95vw;
max-width: 600px;
text-align: center;
}
}
4 changes: 4 additions & 0 deletions ui/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@
<pre class="error-stack-trace"><code>{{errorStr}}</code></pre>
{{/if}}
</div>
<div class="error-links">
{{#link-to "jobs" data-test-error-jobs-link class="button is-white"}}Go to Jobs{{/link-to}}
{{#link-to "clients" data-test-error-clients-link class="button is-white"}}Go to Clients{{/link-to}}
</div>
</div>
{{/unless}}
25 changes: 25 additions & 0 deletions ui/tests/acceptance/application-errors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,28 @@ test('the no leader error state gets its own error message', function(assert) {
);
});
});

test('error pages include links to the jobs and clients pages', function(assert) {
visit('/a/non-existent/page');

andThen(() => {
assert.ok(JobsList.error.isPresent, 'An error is shown');
JobsList.error.gotoJobs();
});

andThen(() => {
assert.equal(currentURL(), '/jobs', 'Now on the jobs page');
assert.notOk(JobsList.error.isPresent, 'The error is gone now');
visit('/a/non-existent/page');
});

andThen(() => {
assert.ok(JobsList.error.isPresent, 'An error is shown');
JobsList.error.gotoClients();
});

andThen(() => {
assert.equal(currentURL(), '/clients', 'Now on the clients page');
assert.notOk(JobsList.error.isPresent, 'The error is gone now');
});
});
2 changes: 2 additions & 0 deletions ui/tests/pages/jobs/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default create({
title: text('[data-test-error-title]'),
message: text('[data-test-error-message]'),
seekHelp: clickable('[data-test-error-message] a'),
gotoJobs: clickable('[data-test-error-jobs-link]'),
gotoClients: clickable('[data-test-error-clients-link]'),
},

namespaceSwitcher: {
Expand Down

0 comments on commit 654611e

Please sign in to comment.