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

chore: Dataset specific MetadataBar #23429

Merged
merged 8 commits into from
Mar 24, 2023

Conversation

kgabryje
Copy link
Member

SUMMARY

Metadata bar component for dataset will be used in Drill to detail modal and in Drill by modal. In order to DRY the code, this PR moves the boilerplate for constructing a dataset specific metadata bar to a separate hook.
In addition, this PR adds a storybook for the new not-generic metadata bar.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Verify that the metadata bar in drill to detail modal works like before

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @kgabryje. I left some comments.

};

export const DatasetSpecific = () => {
SupersetClient.reset();
Copy link
Member

Choose a reason for hiding this comment

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

Can we mock useApiV1Resource instead of introducing a new dependency (storybook-addon-mock) and configuring SupersetClient?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have a reference on how to mock a return value of a function in storybook?

Copy link
Member

Choose a reason for hiding this comment

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

There's an addon to mock imports but that would also introduce a new dependency. It seems it's not very straightforward though. While thinking about the problem, I'm not sure if a storybook for this hook is highly valuable given that the MetadataBar component already has one that displays the dataset information. I see a test file much for valuable as the objective of the hook is to assemble the correct information from the server and transform data to be displayed. If you asked me, I would delete the storybook and the new dependency and add a test file with the different combinations of server responses (no description, no creator, no owners, etc). I'll leave the decision to you as it's not a blocker for me.

Copy link
Member Author

@kgabryje kgabryje Mar 23, 2023

Choose a reason for hiding this comment

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

Added UT. Like you said, to mock a dependency we'd still need an addon.
I'd rather keep the addon for mocking API responses as I think it opens a possibility to write stories for more complex components and features.

@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Merging #23429 (63ab375) into master (b077314) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 63ab375 differs from pull request most recent head d5e927a. Consider uploading reports for the commit d5e927a to get more accurate results

@@           Coverage Diff           @@
##           master   #23429   +/-   ##
=======================================
  Coverage   67.64%   67.65%           
=======================================
  Files        1908     1909    +1     
  Lines       73739    73743    +4     
  Branches     7988     7988           
=======================================
+ Hits        49879    49888    +9     
  Misses      21814    21814           
+ Partials     2046     2041    -5     
Flag Coverage Δ
javascript 53.84% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/components/Chart/DrillDetail/DrillDetailPane.tsx 75.32% <100.00%> (+0.32%) ⬆️
...res/datasets/metadataBar/useDatasetMetadataBar.tsx 100.00% <100.00%> (ø)
superset/db_engine_specs/base.py 90.86% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for the added test!

kgabryje and others added 2 commits March 23, 2023 19:04
…MetadataBar.test.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
…MetadataBar.test.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
@kgabryje kgabryje merged commit 8c374f3 into apache:master Mar 24, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants