You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2024/04/23 13:05:07 UTC
(superset) branch master updated: fix(AlertsReports): making log retention "None" option valid (#27554)
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new b7f3e0bb50 fix(AlertsReports): making log retention "None" option valid (#27554)
b7f3e0bb50 is described below
commit b7f3e0bb50cbc93f46aa0ebd18fb87d9bcdf6e97
Author: Jack <41...@users.noreply.github.com>
AuthorDate: Tue Apr 23 08:05:00 2024 -0500
fix(AlertsReports): making log retention "None" option valid (#27554)
---
superset-frontend/src/features/alerts/AlertReportModal.tsx | 6 +-----
superset/commands/report/log_prune.py | 1 +
superset/reports/schemas.py | 2 +-
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx
index 50e2380b5f..7b0e4c5af8 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -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')}
/>
diff --git a/superset/commands/report/log_prune.py b/superset/commands/report/log_prune.py
index 610519ba90..f14f7856a1 100644
--- a/superset/commands/report/log_prune.py
+++ b/superset/commands/report/log_prune.py
@@ -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),
diff --git a/superset/reports/schemas.py b/superset/reports/schemas.py
index 286322a2da..64b56ec35a 100644
--- a/superset/reports/schemas.py
+++ b/superset/reports/schemas.py
@@ -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},