open-vault/ui/app/components/auth-config-form/options.js

29 lines
987 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import AuthConfigComponent from './config';
2019-02-14 18:52:34 +00:00
import { inject as service } from '@ember/service';
2018-04-03 14:16:57 +00:00
import { task } from 'ember-concurrency';
import DS from 'ember-data';
export default AuthConfigComponent.extend({
2019-02-14 18:52:34 +00:00
router: service(),
wizard: service(),
2018-04-03 14:16:57 +00:00
saveModel: task(function*() {
2019-02-14 18:52:34 +00:00
let data = this.model.config.serialize();
data.description = this.model.description;
2018-04-03 14:16:57 +00:00
try {
2019-02-14 18:52:34 +00:00
yield this.model.tune(data);
2018-04-03 14:16:57 +00:00
} catch (err) {
// AdapterErrors are handled by the error-message component
// in the form
if (err instanceof DS.AdapterError === false) {
throw err;
}
return;
}
2019-02-14 18:52:34 +00:00
if (this.wizard.currentMachine === 'authentication' && this.wizard.featureState === 'config') {
this.wizard.transitionFeatureMachine(this.wizard.featureState, 'CONTINUE');
}
this.router.transitionTo('vault.cluster.access.methods').followRedirects();
this.flashMessages.success('The configuration was saved successfully.');
2018-04-03 14:16:57 +00:00
}),
});