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:
parent
fdb362cbc9
commit
4f75d5f9ee
|
@ -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) {
|
||||
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) {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<NotFound @model={{this.model}} />
|
Loading…
Reference in New Issue