mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
fix: better error message for chart properties modal (#11381)
This commit is contained in:
parent
af337b9e5a
commit
910791b00b
@ -63,13 +63,17 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) {
|
|||||||
);
|
);
|
||||||
const [owners, setOwners] = useState<OptionsType<OwnerOption> | null>(null);
|
const [owners, setOwners] = useState<OptionsType<OwnerOption> | null>(null);
|
||||||
|
|
||||||
function showError({ error, statusText }: any) {
|
function showError({ error, statusText, message }: any) {
|
||||||
|
let errorText = error || statusText || t('An error has occurred');
|
||||||
|
if (message === 'Forbidden') {
|
||||||
|
errorText = t('You do not have permission to edit this chart');
|
||||||
|
}
|
||||||
errorDialog.current.show({
|
errorDialog.current.show({
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
bsSize: 'medium',
|
bsSize: 'medium',
|
||||||
bsStyle: 'danger',
|
bsStyle: 'danger',
|
||||||
actions: [Dialog.DefaultAction('Ok', () => {}, 'btn-danger')],
|
actions: [Dialog.DefaultAction('Ok', () => {}, 'btn-danger')],
|
||||||
body: error || statusText || t('An error has occurred'),
|
body: errorText,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user