fix(AlertsReports): making log retention "None" option valid (#27554)

This commit is contained in:
Jack 2024-04-23 08:05:00 -05:00 committed by GitHub
parent de82d90b9c
commit b7f3e0bb50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 6 deletions

View File

@ -1622,11 +1622,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
ariaLabel={t('Log retention')}
placeholder={t('Log retention')}
onChange={onLogRetentionChange}
value={
typeof currentAlert?.log_retention === 'number'
? currentAlert?.log_retention
: ALERT_REPORTS_DEFAULT_RETENTION
}
value={currentAlert?.log_retention}
options={RETENTION_OPTIONS}
sortComparator={propertyComparator('value')}
/>

View File

@ -48,6 +48,7 @@ class AsyncPruneReportScheduleLogCommand(BaseCommand):
row_count = ReportScheduleDAO.bulk_delete_logs(
report_schedule, from_date, commit=False
)
db.session.commit()
logger.info(
"Deleted %s logs for report schedule id: %s",
str(row_count),

View File

@ -320,7 +320,7 @@ class ReportSchedulePutSchema(Schema):
log_retention = fields.Integer(
metadata={"description": log_retention_description, "example": 90},
required=False,
validate=[Range(min=1, error=_("Value must be greater than 0"))],
validate=[Range(min=0, error=_("Value must be 0 or greater"))],
)
grace_period = fields.Integer(
metadata={"description": grace_period_description, "example": 60 * 60 * 4},