Skip to content

Commit

Permalink
🪟 🎨 Show Schema Update Errors to User (#18008)
Browse files Browse the repository at this point in the history
* show schema update error

* remove test code

* use i18n for error message label and string

* update snapshot of create connection

* fix intl string parsing

* update snapshot
  • Loading branch information
teallarson authored Oct 19, 2022
1 parent b564f3e commit 19e6fad
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const SchemaError = ({ schemaError }: { schemaError: SchemaErrorType }) =
const { refreshSchema } = useConnectionFormService();
return (
<Card>
<TryAfterErrorBlock onClick={refreshSchema} />
<TryAfterErrorBlock onClick={refreshSchema} message={schemaError?.message} />
{job && <JobItem job={job} />}
</Card>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@ import { Text } from "components/ui/Text";
import styles from "./TryAfterErrorBlock.module.scss";

interface TryAfterErrorBlockProps {
message?: React.ReactNode;
message?: string;
onClick: () => void;
}

export const TryAfterErrorBlock: React.FC<TryAfterErrorBlockProps> = ({ message, onClick }) => (
<div className={styles.container}>
<StatusIcon big />
<Text as="p" size="lg" centered className={styles.message}>
{message || <FormattedMessage id="form.schemaFailed" />}
</Text>
<Button className={styles.retryButton} onClick={onClick} variant="danger">
<FormattedMessage id="form.tryAgain" />
</Button>
</div>
);
export const TryAfterErrorBlock: React.FC<TryAfterErrorBlockProps> = ({ message, onClick }) => {
return (
<div className={styles.container}>
<StatusIcon big />
<Text as="p" size="lg" centered className={styles.message}>
<FormattedMessage id="form.schemaFailed" />
</Text>
{message && (
<Text as="p" size="lg" centered className={styles.message}>
<FormattedMessage id="form.error" values={{ message }} />
</Text>
)}
<Button className={styles.retryButton} onClick={onClick} variant="danger">
<FormattedMessage id="form.tryAgain" />
</Button>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,11 @@ exports[`CreateConnectionForm should render with an error 1`] = `
>
Failed to fetch schema. Please try again
</p>
<p
class="<removed-for-snapshot-test>"
>
Error: Test Error
</p>
<button
class="<removed-for-snapshot-test>"
>
Expand Down
1 change: 1 addition & 0 deletions airbyte-webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"sidebar.recipes": "Tutorials - Use cases",

"form.continue": "Continue",
"form.error": "Error: {message}",
"form.yourEmail": "Your email",
"form.email.placeholder": "[email protected]",
"form.email.error": "Enter a valid email",
Expand Down

0 comments on commit 19e6fad

Please sign in to comment.