Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Escape hatch links on error pages #4850

Merged
merged 5 commits into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
},
},
});
12 changes: 11 additions & 1 deletion ui/app/styles/components/error-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
height: 100%;
padding-top: 25vh;
display: flex;
justify-content: center;
flex-direction: column;
justify-content: start;
align-items: center;
background: $grey-lighter;

.error-message {
Expand All @@ -19,4 +21,12 @@
border: 1px solid $grey-light;
border-radius: $radius;
}

.error-links {
padding-top: 15px;
margin-top: 15px;
border-top: 1px solid $grey-light;
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