open-vault/ui/app/models/metrics/config.js
Chelsea Shaw fa1cdf66a7
Ui/pricing metric sparkle (#10119)
* Update pricing-metrics-dates component to show error if outside configured retainment period. With tests

* Add capability checks for metrics config
2020-10-09 10:14:55 -05:00

37 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import DS from 'ember-data';
import { computed } from '@ember/object';
import attachCapabilities from 'vault/lib/attach-capabilities';
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
import { apiPath } from 'vault/macros/lazy-capabilities';
const { attr } = DS;
const M = DS.Model.extend({
queriesAvailable: attr('boolean'),
defaultReportMonths: attr('number', {
label: 'Default display',
subText: 'The number of months well display in the Vault usage dashboard by default.',
}),
retentionMonths: attr('number', {
label: 'Retention period',
subText: 'The number of months of activity logs to maintain for client tracking.',
}),
enabled: attr('string', {
editType: 'boolean',
trueValue: 'On',
falseValue: 'Off',
label: 'Enable usage data collection',
helpText:
'Enable or disable client tracking. Keep in mind that disabling tracking will delete the data for the current month.',
}),
configAttrs: computed(function() {
let keys = ['enabled', 'defaultReportMonths', 'retentionMonths'];
return expandAttributeMeta(this, keys);
}),
});
export default attachCapabilities(M, {
configPath: apiPath`sys/internal/counters/config`,
});