From cd2f53ed7b1c4e10ac64a3374d751303c17c2618 Mon Sep 17 00:00:00 2001 From: Lily Kuang Date: Mon, 15 Mar 2021 12:00:53 -0700 Subject: [PATCH] switch message content between chart and dashboard AlertReportModal (#13537) --- .../src/views/CRUD/alert/AlertReportModal.tsx | 8 ++++---- superset/reports/schemas.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 4e2d288021..26a2df4aba 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -611,11 +611,9 @@ const AlertReportModal: FunctionComponent = ({ validator_config_json: conditionNotNull ? {} : currentAlert?.validator_config_json, - chart: contentType === 'chart' ? currentAlert?.chart?.value : undefined, + chart: contentType === 'chart' ? currentAlert?.chart?.value : null, dashboard: - contentType === 'dashboard' - ? currentAlert?.dashboard?.value - : undefined, + contentType === 'dashboard' ? currentAlert?.dashboard?.value : null, database: currentAlert?.database?.value, owners: (currentAlert?.owners || []).map( owner => (owner as MetaObject).value, @@ -869,10 +867,12 @@ const AlertReportModal: FunctionComponent = ({ const onDashboardChange = (dashboard: SelectValue) => { updateAlertState('dashboard', dashboard || undefined); + updateAlertState('chart', null); }; const onChartChange = (chart: SelectValue) => { updateAlertState('chart', chart || undefined); + updateAlertState('dashboard', null); }; const onActiveSwitch = (checked: boolean) => { diff --git a/superset/reports/schemas.py b/superset/reports/schemas.py index fe9a2fbe7c..94c99b6180 100644 --- a/superset/reports/schemas.py +++ b/superset/reports/schemas.py @@ -220,8 +220,8 @@ class ReportSchedulePutSchema(Schema): required=False, allow_none=True, ) - chart = fields.Integer(required=False) - dashboard = fields.Integer(required=False) + chart = fields.Integer(required=False, allow_none=True) + dashboard = fields.Integer(required=False, allow_none=True) database = fields.Integer(required=False) owners = fields.List(fields.Integer(description=owners_description), required=False) validator_type = fields.String(