switch message content between chart and dashboard AlertReportModal (#13537)

This commit is contained in:
Lily Kuang 2021-03-15 12:00:53 -07:00 committed by GitHub
parent d1e93078f4
commit cd2f53ed7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -611,11 +611,9 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
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<AlertReportModalProps> = ({
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) => {

View File

@ -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(