Skip to content

Commit

Permalink
fix(AlertsReports): making log retention "None" option valid (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fisjac authored and jzhao62 committed May 16, 2024
1 parent 046e1e2 commit 7246627
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')}
/>
Expand Down
1 change: 1 addition & 0 deletions superset/commands/report/log_prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def run(self) -> None:
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),
Expand Down
2 changes: 1 addition & 1 deletion superset/reports/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 7246627

Please sign in to comment.