Backport of UI: Show error if tool action is not recognized into release/1.14.x (#22830)

* backport of commit 2ca784ad11cac0e4b131f00770a774389d16a36c

---------

Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
This commit is contained in:
hc-github-team-secure-vault-core 2023-09-08 12:28:23 -04:00 committed by GitHub
parent fdb362cbc9
commit 4f75d5f9ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View File

@ -7,17 +7,12 @@ import Route from '@ember/routing/route';
import { toolsActions } from 'vault/helpers/tools-actions';
export default Route.extend({
beforeModel(transition) {
const supportedActions = toolsActions();
const { selected_action: selectedAction } = this.paramsFor(this.routeName);
if (!selectedAction || !supportedActions.includes(selectedAction)) {
transition.abort();
return this.transitionTo(this.routeName, supportedActions[0]);
}
},
model(params) {
return params.selected_action;
const supportedActions = toolsActions();
if (supportedActions.includes(params.selected_action)) {
return params.selected_action;
}
throw new Error('Given param is not a supported tool action');
},
setupController(controller, model) {

View File

@ -0,0 +1 @@
<NotFound @model={{this.model}} />