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

Clean up of dbt cloud prototype UI code #18894

Merged
merged 5 commits into from
Nov 10, 2022

Conversation

ambirdsall
Copy link
Contributor

@ambirdsall ambirdsall commented Nov 3, 2022

What

Closes https://github.com/airbytehq/airbyte-cloud/issues/3186.

js code style changes

  • remove unused var in executionUrl match destructuring
  • extract isDbtWebhookConfig predicate
  • remove final slash from dbt Cloud executionUrl regex
  • change yup import syntax in transformation tab

scss code style changes

  • use spacing variables in settings page scss
  • use spacing variables in dbt transformation tab scss
  • target octavia image via class, not parent
  • target dbt logo image via class, not parent

tsx improvements

  • don’t render <Formik /> unless hasDbtIntegration
  • use top-level, element-specific class for img in dbt transformation tab scss
  • merge emptyListContent styles into jobListContainer
  • s/<p>/<Text>/g
  • add aria-label to “remove dbt job” X button
  • remove unused DbtCloudSignupBanner component

text content

  • conditionalize “the following jobs” text content based on whether dbt jobs exist
  • render all text content in transformation tab via <FormattedMessage />
  • rephrase “integration not setup” text

images

  • use the svg version of the dbt logo
  • move {🐙,dbt logo} img file to dbt transform tab component directory
  • remove alt text from {🐙,dbt logo} images

🚨 User Impact 🚨

None; the only differences in app behavior are slight changes to text content and a few cases where a formerly-invisible component is now not rendered at all.

@ambirdsall ambirdsall requested a review from a team as a code owner November 3, 2022 07:17
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Nov 3, 2022
<Text className={styles.contextExplanation}>
<FormattedMessage id="connection.dbtCloudJobs.explanation" />
</Text>
{jobs.map((_j, i) => (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the unused _j binding was mentioned in review, but since this is a function argument list, it's a syntax error to have no binding in that position.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry oversaw that. Could we instead rename it just job in this case? Since we don't use the _ notation for those, and that way it would be a better descriptive (not used) variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @typescript-eslint/no-unused-vars will complain then . If we need a convention for unused vars, isn't _ the best choice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, the underscore is needed as a cue for the linter. While my default preference was to use a name which communicates the value, that's superfluous here (by jobs.map, a reader ought to have a good sense of what's going on 😄) and a quick grep (I ran rg '\b_\b' in airbyte-webapp/) shows that using _ for unused arguments is already a somewhat-established convention. It helps that we only import lodash functions individually, so there's no risk of shadowing needed utility functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry did not notice that we have that checked via TS and not eslint. We could (not as part of this PR!) maybe disable the TS check and replace it by the eslint rule, which actually allows to configure an after-used so it's not failing on parameters that need to be there because we use the ones after it still.

@ambirdsall ambirdsall force-pushed the alex/dbt-cloud-demo-code-cleanup branch from 4d8f042 to 7b8d233 Compare November 4, 2022 18:55
</label>
<Input {...field} type="text" />
</>
)}
</Field>
</div>
<button type="button" className={styles.jobListItemDelete} onClick={removeJob}>
<button type="button" className={styles.jobListItemDelete} onClick={removeJob} aria-label="Delete job">
Copy link
Contributor

Choose a reason for hiding this comment

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

The aria-label should be i18ned as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I could be wrong - but I think we can use <Button type="clear"> for this sort of transparent/unstyled button?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can indeed. It isn't quite as good a match for the designs (the main issue is that it's slightly smaller even at size="lg") and adds a pointless div around the button contents, but it's more consistent with the rest of the app and adds small improvements like higher contrast against the background and a subtle darkening of the icon on hover.

Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

Just a few minor comments!

also a nitpick: could we export DbtCloudTransformationsCard from an index.ts barrel file so we don't have a long import like this:

// ConnectionTransformationTab.tsx
import { DbtCloudTransformationsCard } from "./ConnectionTransformationTab/DbtCloudTransformationsCard";

<Text className={styles.contextExplanation}>
<FormattedMessage id="connection.dbtCloudJobs.explanation" />
</Text>
{jobs.map((_j, i) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @typescript-eslint/no-unused-vars will complain then . If we need a convention for unused vars, isn't _ the best choice?

</label>
<Input {...field} type="text" />
</>
)}
</Field>
</div>
<button type="button" className={styles.jobListItemDelete} onClick={removeJob}>
<button type="button" className={styles.jobListItemDelete} onClick={removeJob} aria-label="Delete job">
Copy link
Contributor

Choose a reason for hiding this comment

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

I could be wrong - but I think we can use <Button type="clear"> for this sort of transparent/unstyled button?

@ambirdsall ambirdsall force-pushed the alex/dbt-cloud-demo-code-cleanup branch from 7b8d233 to 6e8c2d0 Compare November 9, 2022 00:47
@ambirdsall ambirdsall requested a review from josephkmh November 9, 2022 01:03
@ambirdsall ambirdsall force-pushed the alex/dbt-cloud-demo-code-cleanup branch from 8119dc2 to c349a1a Compare November 9, 2022 01:04
Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ambirdsall ambirdsall merged commit 4a577e9 into master Nov 10, 2022
@ambirdsall ambirdsall deleted the alex/dbt-cloud-demo-code-cleanup branch November 10, 2022 00:27
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
* Clean up of dbt cloud prototype UI code

* Remove variables->vars alias from scss files

* Remove obsolete comments

* Improvements to delete job button

- i18nize the aria-label
- replace most custom scss by using `<Button variant="clear" size="lg">`

* Use `_` for unused function arg
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.

3 participants