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 validator_config_json: conditionNotNull
? {} ? {}
: currentAlert?.validator_config_json, : currentAlert?.validator_config_json,
chart: contentType === 'chart' ? currentAlert?.chart?.value : undefined, chart: contentType === 'chart' ? currentAlert?.chart?.value : null,
dashboard: dashboard:
contentType === 'dashboard' contentType === 'dashboard' ? currentAlert?.dashboard?.value : null,
? currentAlert?.dashboard?.value
: undefined,
database: currentAlert?.database?.value, database: currentAlert?.database?.value,
owners: (currentAlert?.owners || []).map( owners: (currentAlert?.owners || []).map(
owner => (owner as MetaObject).value, owner => (owner as MetaObject).value,
@ -869,10 +867,12 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
const onDashboardChange = (dashboard: SelectValue) => { const onDashboardChange = (dashboard: SelectValue) => {
updateAlertState('dashboard', dashboard || undefined); updateAlertState('dashboard', dashboard || undefined);
updateAlertState('chart', null);
}; };
const onChartChange = (chart: SelectValue) => { const onChartChange = (chart: SelectValue) => {
updateAlertState('chart', chart || undefined); updateAlertState('chart', chart || undefined);
updateAlertState('dashboard', null);
}; };
const onActiveSwitch = (checked: boolean) => { const onActiveSwitch = (checked: boolean) => {

View File

@ -220,8 +220,8 @@ class ReportSchedulePutSchema(Schema):
required=False, required=False,
allow_none=True, allow_none=True,
) )
chart = fields.Integer(required=False) chart = fields.Integer(required=False, allow_none=True)
dashboard = fields.Integer(required=False) dashboard = fields.Integer(required=False, allow_none=True)
database = fields.Integer(required=False) database = fields.Integer(required=False)
owners = fields.List(fields.Integer(description=owners_description), required=False) owners = fields.List(fields.Integer(description=owners_description), required=False)
validator_type = fields.String( validator_type = fields.String(