2018-09-25 16:28:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { assert } from '@ember/debug';
|
|
|
|
import Helper from '@ember/component/helper';
|
|
|
|
import { observer } from '@ember/object';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
const FEATURES = [
|
|
|
|
'HSM',
|
|
|
|
'Performance Replication',
|
|
|
|
'DR Replication',
|
|
|
|
'MFA',
|
|
|
|
'Sentinel',
|
|
|
|
'Seal Wrapping',
|
|
|
|
'Control Groups',
|
2018-08-16 17:48:24 +00:00
|
|
|
'Namespaces',
|
2018-04-03 14:16:57 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
export function hasFeature(featureName, features) {
|
|
|
|
if (!FEATURES.includes(featureName)) {
|
2018-09-25 16:28:26 +00:00
|
|
|
assert(`${featureName} is not one of the available values for Vault Enterprise features.`, false);
|
2018-04-03 14:16:57 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return features ? features.includes(featureName) : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Helper.extend({
|
2018-09-25 16:28:26 +00:00
|
|
|
version: service(),
|
2018-04-03 14:16:57 +00:00
|
|
|
onFeaturesChange: observer('version.features.[]', function() {
|
|
|
|
this.recompute();
|
|
|
|
}),
|
|
|
|
compute([featureName]) {
|
|
|
|
return hasFeature(featureName, this.get('version.features'));
|
|
|
|
},
|
|
|
|
});
|