mirror of https://github.com/status-im/consul.git
ui: Surface 'detail' of API errors in the error page (#9237)
* ui: Surface 'detail' of API errors in the error page * Make UI generated 404s look less bare
This commit is contained in:
parent
023618e018
commit
1ea9592707
|
@ -1,5 +1,8 @@
|
||||||
{{yield}}
|
{{yield}}
|
||||||
<div class="empty-state" ...attributes>
|
<div
|
||||||
|
class="empty-state"
|
||||||
|
...attributes
|
||||||
|
>
|
||||||
{{#if hasHeader}}
|
{{#if hasHeader}}
|
||||||
<header>
|
<header>
|
||||||
{{#yield-slot name="header"}}
|
{{#yield-slot name="header"}}
|
||||||
|
|
|
@ -12,13 +12,19 @@
|
||||||
</BlockSlot>
|
</BlockSlot>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<BlockSlot @name="body">
|
<BlockSlot @name="body">
|
||||||
<p>
|
{{#if error.detail}}
|
||||||
You may have visited a URL that is loading an unknown resource, so you can try going back to the root or try re-submitting your ACL Token/SecretID by going back to ACLs.
|
<p>
|
||||||
</p>
|
{{error.detail}}
|
||||||
|
</p>
|
||||||
|
{{else}}
|
||||||
|
<p>
|
||||||
|
You may have visited a URL that is loading an unknown resource, so you can try going back to the root or try re-submitting your ACL Token/SecretID by going back to ACLs.
|
||||||
|
</p>
|
||||||
|
{{/if}}
|
||||||
</BlockSlot>
|
</BlockSlot>
|
||||||
<BlockSlot @name="actions">
|
<BlockSlot @name="actions">
|
||||||
<li class="back-link">
|
<li class="back-link">
|
||||||
<a data-test-home rel="home" href={{href-to 'index'}}>Go back to root</a>
|
<a data-test-home rel="home" href={{href-to 'index'}}>Go back</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="docs-link">
|
<li class="docs-link">
|
||||||
<a href="{{env 'CONSUL_DOCS_URL'}}" rel="noopener noreferrer" target="_blank">Read the documentation</a>
|
<a href="{{env 'CONSUL_DOCS_URL'}}" rel="noopener noreferrer" target="_blank">Read the documentation</a>
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default Route.extend(WithBlockingActions, {
|
||||||
};
|
};
|
||||||
if (e.errors && e.errors[0]) {
|
if (e.errors && e.errors[0]) {
|
||||||
error = e.errors[0];
|
error = e.errors[0];
|
||||||
error.message = error.title || error.detail || 'Error';
|
error.message = error.message || error.title || error.detail || 'Error';
|
||||||
}
|
}
|
||||||
if (error.status === '') {
|
if (error.status === '') {
|
||||||
error.message = 'Error';
|
error.message = 'Error';
|
||||||
|
|
|
@ -26,9 +26,8 @@ export default class DcService extends RepositoryService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const e = new Error();
|
const e = new Error('Page not found');
|
||||||
e.status = '404';
|
e.status = '404';
|
||||||
e.detail = 'Page not found';
|
|
||||||
return Promise.reject({ errors: [e] });
|
return Promise.reject({ errors: [e] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue