mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: surface connection error messages on the client (#11077)
* fix: surface connection error messages on the client * typo * lint
This commit is contained in:
parent
1493450a6f
commit
7f1e4e441d
@ -21,6 +21,7 @@ import { styled, t, SupersetClient } from '@superset-ui/core';
|
|||||||
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
||||||
import { useSingleViewResource } from 'src/views/CRUD/hooks';
|
import { useSingleViewResource } from 'src/views/CRUD/hooks';
|
||||||
import withToasts from 'src/messageToasts/enhancers/withToasts';
|
import withToasts from 'src/messageToasts/enhancers/withToasts';
|
||||||
|
import getClientErrorObject from 'src/utils/getClientErrorObject';
|
||||||
import Icon from 'src/components/Icon';
|
import Icon from 'src/components/Icon';
|
||||||
import Modal from 'src/common/components/Modal';
|
import Modal from 'src/common/components/Modal';
|
||||||
import Tabs from 'src/common/components/Tabs';
|
import Tabs from 'src/common/components/Tabs';
|
||||||
@ -163,11 +164,13 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
addSuccessToast(t('Connection looks good!'));
|
addSuccessToast(t('Connection looks good!'));
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(response =>
|
||||||
addDangerToast(
|
getClientErrorObject(response).then(error => {
|
||||||
t('ERROR: Connection failed, please check your connection settings'),
|
addDangerToast(
|
||||||
);
|
t('ERROR: Connection failed. ') + error?.message || '',
|
||||||
});
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
@ -551,7 +554,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
|||||||
checked={db ? !!db.impersonate_user : false}
|
checked={db ? !!db.impersonate_user : false}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
/>
|
/>
|
||||||
<div>{t('Impersonate Logged In User (Presto & Hive')}</div>
|
<div>{t('Impersonate Logged In User (Presto & Hive)')}</div>
|
||||||
<InfoTooltipWithTrigger
|
<InfoTooltipWithTrigger
|
||||||
label="impersonate"
|
label="impersonate"
|
||||||
tooltip={t(
|
tooltip={t(
|
||||||
|
Loading…
Reference in New Issue
Block a user