mirror of
https://github.com/apache/superset.git
synced 2026-08-04 04:52:32 +00:00
chore: refactor Alert-related components (#31858)
This commit is contained in:
committed by
GitHub
parent
5fe6ef268e
commit
6eb87e04c0
@@ -32,6 +32,7 @@ type Props = {
|
||||
stackTrace?: string;
|
||||
source?: ErrorSource;
|
||||
description?: string;
|
||||
descriptionDetails?: ReactNode;
|
||||
errorMitigationFunction?: () => void;
|
||||
fallback?: ReactNode;
|
||||
};
|
||||
@@ -45,6 +46,7 @@ export default function ErrorMessageWithStackTrace({
|
||||
stackTrace,
|
||||
source,
|
||||
description,
|
||||
descriptionDetails,
|
||||
fallback,
|
||||
}: Props) {
|
||||
// Check if a custom error message component was registered for this message
|
||||
@@ -66,28 +68,27 @@ export default function ErrorMessageWithStackTrace({
|
||||
if (fallback) {
|
||||
return <>{fallback}</>;
|
||||
}
|
||||
const computedDescriptionDetails =
|
||||
descriptionDetails ||
|
||||
(link || stackTrace ? (
|
||||
<>
|
||||
{link && (
|
||||
<a href={link} target="_blank" rel="noopener noreferrer">
|
||||
{t('Request Access')}
|
||||
</a>
|
||||
)}
|
||||
<br />
|
||||
{stackTrace && <pre>{stackTrace}</pre>}
|
||||
</>
|
||||
) : undefined);
|
||||
|
||||
return (
|
||||
<ErrorAlert
|
||||
level="warning"
|
||||
title={title}
|
||||
subtitle={subtitle}
|
||||
copyText={copyText}
|
||||
type="error"
|
||||
errorType={title}
|
||||
message={subtitle}
|
||||
description={description}
|
||||
source={source}
|
||||
body={
|
||||
link || stackTrace ? (
|
||||
<>
|
||||
{link && (
|
||||
<a href={link} target="_blank" rel="noopener noreferrer">
|
||||
(Request Access)
|
||||
</a>
|
||||
)}
|
||||
<br />
|
||||
{stackTrace && <pre>{stackTrace}</pre>}
|
||||
</>
|
||||
) : undefined
|
||||
}
|
||||
descriptionDetails={computedDescriptionDetails}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user