mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-29 06:31:10 +01:00
Handle api explorer routing error (#12354)
* Handle api explorer routing error - For some reason when routing is done during async process, router transtionTo throws the TransitionAbortedError - As a fix treat this particular error as success since it doesn't interfere in the routing - Reference: https://github.com/emberjs/ember-test-helpers/issues/332 * Added changelog
This commit is contained in:
parent
8399fb29d5
commit
9659477213
3
changelog/12354.txt
Normal file
3
changelog/12354.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
ui: Fixed api explorer routing bug
|
||||||
|
```
|
||||||
@ -92,12 +92,11 @@ export default Component.extend({
|
|||||||
|
|
||||||
refreshRoute: task(function*() {
|
refreshRoute: task(function*() {
|
||||||
let owner = getOwner(this);
|
let owner = getOwner(this);
|
||||||
let routeName = this.router.currentRouteName;
|
let currentRoute = owner.lookup(`router:main`).get('currentRouteName');
|
||||||
let route = owner.lookup(`route:${routeName}`);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.store.clearAllDatasets();
|
this.store.clearAllDatasets();
|
||||||
yield route.refresh();
|
yield this.router.transitionTo(currentRoute);
|
||||||
this.logAndOutput(null, { type: 'success', content: 'The current screen has been refreshed!' });
|
this.logAndOutput(null, { type: 'success', content: 'The current screen has been refreshed!' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logAndOutput(null, { type: 'error', content: 'The was a problem refreshing the current screen.' });
|
this.logAndOutput(null, { type: 'error', content: 'The was a problem refreshing the current screen.' });
|
||||||
@ -106,25 +105,32 @@ export default Component.extend({
|
|||||||
|
|
||||||
routeToExplore: task(function*(command) {
|
routeToExplore: task(function*(command) {
|
||||||
let filter = command.replace('api', '').trim();
|
let filter = command.replace('api', '').trim();
|
||||||
try {
|
|
||||||
yield this.router.transitionTo('vault.cluster.open-api-explorer.index', {
|
|
||||||
queryParams: { filter },
|
|
||||||
});
|
|
||||||
let content =
|
let content =
|
||||||
'Welcome to the Vault API explorer! \nYou can search for endpoints, see what parameters they accept, and even execute requests with your current token.';
|
'Welcome to the Vault API explorer! \nYou can search for endpoints, see what parameters they accept, and even execute requests with your current token.';
|
||||||
if (filter) {
|
if (filter) {
|
||||||
content = `Welcome to the Vault API explorer! \nWe've filtered the list of endpoints for '${filter}'.`;
|
content = `Welcome to the Vault API explorer! \nWe've filtered the list of endpoints for '${filter}'.`;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
yield this.router.transitionTo('vault.cluster.open-api-explorer.index', {
|
||||||
|
queryParams: { filter },
|
||||||
|
});
|
||||||
this.logAndOutput(null, {
|
this.logAndOutput(null, {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
content,
|
content,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error.message === 'TransitionAborted') {
|
||||||
|
this.logAndOutput(null, {
|
||||||
|
type: 'success',
|
||||||
|
content,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
this.logAndOutput(null, {
|
this.logAndOutput(null, {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
content: 'There was a problem navigating to the api explorer.',
|
content: 'There was a problem navigating to the api explorer.',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shiftCommandIndex(keyCode) {
|
shiftCommandIndex(keyCode) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user