open-vault/ui/lib/kmip/addon/routes/configuration.js
Angel Garbarino efd3677c58
UI: fix KMIP bug and test (#11011)
* fix KMIP test that was failing and clean modal on configuration page.

* add changelog

* remove uncessary unload

* remove async
2021-02-25 15:13:00 -07:00

31 lines
805 B
JavaScript

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import UnloadModel from 'vault/mixins/unload-model-route';
export default Route.extend(UnloadModel, {
store: service(),
secretMountPath: service(),
pathHelp: service(),
beforeModel() {
return this.pathHelp.getNewModel('kmip/config', this.secretMountPath.currentPath);
},
model() {
return this.store.findRecord('kmip/config', this.secretMountPath.currentPath).catch(err => {
if (err.httpStatus === 404) {
return;
} else {
throw err;
}
});
},
afterModel(model) {
if (model) {
return this.store.findRecord('kmip/ca', this.secretMountPath.currentPath).then(ca => {
model.set('ca', ca);
return model;
});
}
},
});