Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Connector Builder] Display server errors and handle empty streams list #19461

Merged
merged 15 commits into from
Nov 17, 2022

Conversation

lmossman
Copy link
Contributor

@lmossman lmossman commented Nov 16, 2022

What

This PR makes changes to the connector builder to properly handle and display errors from the connector builder server when testing.

It also does some refactoring so that the case where no streams are detected in the manifest is correctly handled, e.g. by displaying a warning like this:
Screen Shot 2022-11-15 at 7 22 38 PM

This required moving some code into different components and conditionally rendering them only if a stream is currently selected (which can now only be true if there are streams to select).

Here is a screenshot of what an error looks like when testing the stream:
Screen Shot 2022-11-15 at 7 24 29 PM

How

I left some comments in the code indicating why the main changes were made

@octavia-squidington-iv octavia-squidington-iv added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Nov 16, 2022
@lmossman lmossman temporarily deployed to more-secrets November 16, 2022 03:11 Inactive
selectedStream: StreamsListReadStreamsItem;
}

export const StreamTester: React.FC<StreamTesterProps> = ({ selectedStream }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the code here is moved over from StreamTestingPanel and TestControls, so this isn't totally net-new. But it does contain some changes, mainly around handling errors from the useReadStream hook.

This component was created because I needed a single component containing the URL display, test button, and result display, so that the entire thing could be conditionally rendered only if there are streams available. If there are no streams detected, this entire component is not rendered, as desired.

I'm open to naming suggestions on this component, since it feels too close to StreamTestingPanel at the moment.

setConfigString: (configString: string) => void;
}

export const ConnectorBuilderStateContext = React.createContext<Context | null>(null);

const useJsonManifest = () => {
export const ConnectorBuilderStateProvider: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes here are just rearranging some code. I realized that the way I had this class set up before (with each of the various states being managed by separate hooks) had the fundamental issue that different users of this context would end up with different jsonManifest states.

Since the intention here was to have all of this context's state shared across all users of it, I moved that state code into this function directly, which seems to have fixed the problem.

@@ -103,3 +86,35 @@ export const useConnectorBuilderState = (): Context => {

return connectorBuilderState;
};

export const useSelectedPageAndSlice = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new hook separated from the rest, because it is only used in one component (ResultDisplay) to manage the selected page and slice per stream, and that component is only rendered if there is a selected stream.

@lmossman lmossman temporarily deployed to more-secrets November 16, 2022 03:22 Inactive
@lmossman lmossman requested a review from timroes November 16, 2022 03:25
@lmossman lmossman marked this pull request as ready for review November 16, 2022 03:25
@lmossman lmossman requested a review from a team as a code owner November 16, 2022 03:25
@lmossman lmossman temporarily deployed to more-secrets November 16, 2022 18:07 Inactive
@lmossman lmossman temporarily deployed to more-secrets November 16, 2022 18:09 Inactive
@lmossman lmossman temporarily deployed to more-secrets November 16, 2022 18:13 Inactive
Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glanced over code. Nothing breaking stood out. Minor code nitpicks, approving already.

Comment on lines 28 to 30
.errorNum.errorNum {
color: colors.$white;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline: Contrast ratio is too low that way.

<div className={styles.noStreamsContainer}>
<FontAwesomeIcon icon={faWarning} className={styles.noStreamsIcon} size="lg" />
<Text className={styles.noStreamsText} size="lg">
No streams detected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing i18n

@lmossman lmossman force-pushed the lmossman/connector-builder-error-handling branch from 0086571 to a7b0b60 Compare November 17, 2022 01:30
@lmossman lmossman requested review from a team as code owners November 17, 2022 01:30
@lmossman lmossman requested review from a team November 17, 2022 01:30
@CLAassistant
Copy link

CLAassistant commented Nov 17, 2022

CLA assistant check
All committers have signed the CLA.

@lmossman
Copy link
Contributor Author

lmossman commented Nov 17, 2022

Sorry for the noise on this PR. I forgot to change the base branch to master on Github before I rebased it on master locally and force-pushed the changes, so it considered the entire repo as "new changes" for a little bit, causing all of our code owners to be requested 😓

@lmossman
Copy link
Contributor Author

Everyone should feel free to just ignore this PR if you got pinged

@lmossman lmossman force-pushed the lmossman/connector-builder-error-handling branch from a7b0b60 to 55c6051 Compare November 17, 2022 16:10
@octavia-squidington-iv octavia-squidington-iv added the area/platform issues related to the platform label Nov 17, 2022
@lmossman lmossman merged commit 903fcf1 into master Nov 17, 2022
@lmossman lmossman deleted the lmossman/connector-builder-error-handling branch November 17, 2022 16:20
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
…st (#19461)

* save error handling progress

* display error from stream read

* rearrange components in stream testing panel

* fix state/requests/error handling and properly handle empty streams list

* remove commented code, unused components, and console logs

* use unknown error in the case of empty error message

* don't override numberbadge style

* move 'No streams detected' into en.json

* handle list streams error better

* add loading states for yaml editor and side panel

* add state service changes to support loading states

* fix manifest template

* fix promise

* fix api override

* undo change to apiOverride
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants