vault/ui/app/models/clients/config.js
claire bontempo 6f00ce45d2
UI: remove current_billing_period from dashboard activity log request (#27559)
* remove current_billing_period from dashboard request

* add changelog

* remove timestamp from assertion

* update mirage
2024-06-21 11:06:53 -07:00

55 lines
1.8 KiB
JavaScript
Raw Permalink 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.

/**
* 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 hasnt 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;
}
}