open-vault/ui/app/routes/vault/cluster/tools/tool.js

30 lines
876 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import Ember from 'ember';
import { toolsActions } from 'vault/helpers/tools-actions';
export default Ember.Route.extend({
2018-08-28 05:03:55 +00:00
wizard: Ember.inject.service(),
2018-04-03 14:16:57 +00:00
beforeModel(transition) {
const supportedActions = toolsActions();
const { selectedAction } = this.paramsFor(this.routeName);
if (!selectedAction || !supportedActions.includes(selectedAction)) {
transition.abort();
return this.transitionTo(this.routeName, supportedActions[0]);
}
},
model() {},
actions: {
didTransition() {
const params = this.paramsFor(this.routeName);
2018-08-28 05:03:55 +00:00
if (this.get('wizard.currentMachine') === 'tools') {
this.get('wizard').transitionFeatureMachine(
this.get('wizard.featureState'),
params.selectedAction.toUpperCase()
);
}
2018-04-03 14:16:57 +00:00
this.controller.setProperties(params);
2018-08-28 05:03:55 +00:00
return true;
2018-04-03 14:16:57 +00:00
},
},
});