mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 07:01:09 +02:00
* remove current_billing_period from dashboard request * add changelog * remove timestamp from assertion * update mirage
55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
/**
|
||
* Copyright (c) HashiCorp, Inc.
|
||
* SPDX-License-Identifier: BUSL-1.1
|
||
*/
|
||
|
||
import Model, { attr } from '@ember-data/model';
|
||
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
||
import { withFormFields } from 'vault/decorators/model-form-fields';
|
||
import { withModelValidations } from 'vault/decorators/model-validations';
|
||
|
||
const validations = {
|
||
retentionMonths: [
|
||
{
|
||
validator: (model) => parseInt(model.retentionMonths) >= model.minimumRetentionMonths,
|
||
message: (model) =>
|
||
`Retention period must be greater than or equal to ${model.minimumRetentionMonths}.`,
|
||
},
|
||
{
|
||
validator: (model) => parseInt(model.retentionMonths) <= 60,
|
||
message: 'Retention period must be less than or equal to 60.',
|
||
},
|
||
],
|
||
};
|
||
|
||
@withModelValidations(validations)
|
||
@withFormFields(['enabled', 'retentionMonths'])
|
||
export default class ClientsConfigModel extends Model {
|
||
@attr('boolean') queriesAvailable; // true only if historical data exists, will be false if there is only current month data
|
||
|
||
@attr('number', {
|
||
label: 'Retention period',
|
||
subText: 'The number of months of activity logs to maintain for client tracking.',
|
||
})
|
||
retentionMonths;
|
||
|
||
@attr('number') minimumRetentionMonths;
|
||
|
||
// refers specifically to the activitylog and will always be on for enterprise
|
||
@attr('string') enabled;
|
||
|
||
// reporting_enabled is for automated reporting and only true of the customer hasn’t opted-out of automated license reporting
|
||
@attr('boolean') reportingEnabled;
|
||
|
||
@attr('date') billingStartTimestamp;
|
||
|
||
@lazyCapabilities(apiPath`sys/internal/counters/config`) configPath;
|
||
|
||
get canRead() {
|
||
return this.configPath.get('canRead') !== false;
|
||
}
|
||
get canEdit() {
|
||
return this.configPath.get('canUpdate') !== false;
|
||
}
|
||
}
|