Skip to content

Commit

Permalink
fix: font regression in SQL Lab (apache#14960)
Browse files Browse the repository at this point in the history
* fix: font regression in SQL Lab

* Fix tests
  • Loading branch information
betodealmeida authored Jun 8, 2021
1 parent a59bbbc commit 3f527c7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const mockedProps = {
message: 'Error message',
},
source: 'dashboard' as ErrorSource,
subtitle: 'Error message',
};

test('should render', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface DatabaseErrorExtra {
function DatabaseErrorMessage({
error,
source = 'dashboard',
subtitle,
}: ErrorMessageComponentProps<DatabaseErrorExtra>) {
const { extra, level, message } = error;

Expand Down Expand Up @@ -81,7 +82,7 @@ ${extra.issue_codes.map(issueCode => issueCode.message).join('\n')}`;
return (
<ErrorAlert
title={t('%s Error', extra.engine_name || t('DB engine'))}
subtitle={message}
subtitle={subtitle}
level={level}
source={source}
copyText={copyText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ export default function ErrorMessageWithStackTrace({
error.error_type,
);
if (ErrorMessageComponent) {
return <ErrorMessageComponent error={error} source={source} />;
return (
<ErrorMessageComponent
error={error}
source={source}
subtitle={subtitle}
/>
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const mockedProps = {
message: 'Error message',
},
source: 'dashboard' as ErrorSource,
subtitle: 'Error message',
};

test('should render', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const findMatches = (undefinedParameters: string[], templateKeys: string[]) => {
function ParameterErrorMessage({
error,
source = 'sqllab',
subtitle,
}: ErrorMessageComponentProps<ParameterErrorExtra>) {
const { extra, level, message } = error;

Expand Down Expand Up @@ -112,7 +113,7 @@ ${extra.issue_codes.map(issueCode => issueCode.message).join('\n')}`;
return (
<ErrorAlert
title={t('Parameter error')}
subtitle={message}
subtitle={subtitle}
level={level}
source={source}
copyText={copyText}
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/components/ErrorMessage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export type ErrorMessageComponentProps<
> = {
error: SupersetError<ExtraType>;
source?: ErrorSource;
subtitle?: React.ReactNode;
};

export type ErrorMessageComponent = React.ComponentType<ErrorMessageComponentProps>;

0 comments on commit 3f527c7

Please sign in to comment.