open-vault/ui/app/routes/vault/cluster/access/control-groups-configure.js
Matthew Irish 966c7dbf02
UI - New navbar and mount icons everywhere (#778)
New look for the navbar and new functionality on mobile. Also includes new look for the mounts list and headers in secret engines.
2018-10-21 14:19:34 -05:00

37 lines
900 B
JavaScript

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import UnloadModel from 'vault/mixins/unload-model-route';
export default Route.extend(UnloadModel, {
version: service(),
beforeModel() {
return this.get('version')
.fetchFeatures()
.then(() => {
return this._super(...arguments);
});
},
model() {
let type = 'control-group-config';
return this.get('version').hasFeature('Control Groups')
? this.store.findRecord(type, 'config').catch(e => {
// if you haven't saved a config, the API 404s, so create one here to edit and return it
if (e.httpStatus === 404) {
return this.store.createRecord(type, {
id: 'config',
});
}
throw e;
})
: null;
},
actions: {
reload() {
this.refresh();
},
},
});