mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
UI: Show error if tool action is not recognized (#22821)
This commit is contained in:
@@ -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) {
|
||||
|
||||
6
ui/app/templates/vault/cluster/tools/error.hbs
Normal file
6
ui/app/templates/vault/cluster/tools/error.hbs
Normal file
@@ -0,0 +1,6 @@
|
||||
{{!
|
||||
Copyright (c) HashiCorp, Inc.
|
||||
SPDX-License-Identifier: BUSL-1.1
|
||||
~}}
|
||||
|
||||
<NotFound @model={{this.model}} />
|
||||
Reference in New Issue
Block a user