fix(AlertsReports): making log retention "None" option valid (#27554)
This commit is contained in:
parent
de82d90b9c
commit
b7f3e0bb50
|
|
@ -1622,11 +1622,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
|
||||||
ariaLabel={t('Log retention')}
|
ariaLabel={t('Log retention')}
|
||||||
placeholder={t('Log retention')}
|
placeholder={t('Log retention')}
|
||||||
onChange={onLogRetentionChange}
|
onChange={onLogRetentionChange}
|
||||||
value={
|
value={currentAlert?.log_retention}
|
||||||
typeof currentAlert?.log_retention === 'number'
|
|
||||||
? currentAlert?.log_retention
|
|
||||||
: ALERT_REPORTS_DEFAULT_RETENTION
|
|
||||||
}
|
|
||||||
options={RETENTION_OPTIONS}
|
options={RETENTION_OPTIONS}
|
||||||
sortComparator={propertyComparator('value')}
|
sortComparator={propertyComparator('value')}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class AsyncPruneReportScheduleLogCommand(BaseCommand):
|
||||||
row_count = ReportScheduleDAO.bulk_delete_logs(
|
row_count = ReportScheduleDAO.bulk_delete_logs(
|
||||||
report_schedule, from_date, commit=False
|
report_schedule, from_date, commit=False
|
||||||
)
|
)
|
||||||
|
db.session.commit()
|
||||||
logger.info(
|
logger.info(
|
||||||
"Deleted %s logs for report schedule id: %s",
|
"Deleted %s logs for report schedule id: %s",
|
||||||
str(row_count),
|
str(row_count),
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ class ReportSchedulePutSchema(Schema):
|
||||||
log_retention = fields.Integer(
|
log_retention = fields.Integer(
|
||||||
metadata={"description": log_retention_description, "example": 90},
|
metadata={"description": log_retention_description, "example": 90},
|
||||||
required=False,
|
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(
|
grace_period = fields.Integer(
|
||||||
metadata={"description": grace_period_description, "example": 60 * 60 * 4},
|
metadata={"description": grace_period_description, "example": 60 * 60 * 4},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue