This is an automated email from the ASF dual-hosted git repository. michaelsmolina pushed a commit to branch 4.0 in repository https://gitbox.apache.org/repos/asf/superset.git
commit a8f7ea0720a1a5b016af752d64d10fb5bb7efbd7 Author: Jack <[email protected]> AuthorDate: Tue Apr 23 08:05:00 2024 -0500 fix(AlertsReports): making log retention "None" option valid (#27554) (cherry picked from commit b7f3e0bb50cbc93f46aa0ebd18fb87d9bcdf6e97) --- 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 89a4b3d73e..6eb157ab94 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -1625,11 +1625,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 84c075ffbd..8e3b120740 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},
