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

📕 Storybook for everyone (take 2) #43529

Merged
merged 75 commits into from
Jan 15, 2020
Merged

📕 Storybook for everyone (take 2) #43529

merged 75 commits into from
Jan 15, 2020

Conversation

streamich
Copy link
Contributor

@streamich streamich commented Aug 19, 2019

  • Sets up a sample Storybook for embeddable, siem, and infra plugins.
  • Loads stories only for specific plugin.
  • Canvas Storybook still works as before (node x-pack/legacy/plugins/canvas/scripts/storybook).

See instructions:

yarn storybook

Run embeddable stories:

yarn storybook embeddable

Run siem stories:

yarn storybook siem

Run infra stories:

yarn storybook infra

Run canvas stories:

yarn storybook canvas

Canvas

We agreed that I would split Canvas stories in two: (1) the ones that can be run in new global Storybook; (2) and the ones that currently run only in the Canvas local one.

I went through all Canvas Storybook stories and was able to run the below 35 stories in the global Storybook. I changed their extension to .stories, so they now can be loaded with yarn storybook canvas. The internal Canvas Storybook will also load them, I changed it to support both extensions: .examples and .stories. For some of these stories to work in global Storybook I had to do small changes to imports and TypeScript types.

  1. /public/components/file_upload/file_upload.stories.tsx
  2. /public/components/font_picker/font_picker.stories.tsx
  3. /public/components/color_dot/__examples__/color_dot.stories.tsx
  4. /public/components/color_manager/__examples__/color_manager.stories.tsx
  5. /public/components/color_palette/__examples__/color_palette.stories.tsx
  6. /public/components/color_picker/__examples__/color_picker.stories.tsx
  7. /public/components/color_picker_popover/__examples__/color_picker_popover.stories.tsx
  8. /public/components/element_card/__examples__/element_card.stories.tsx
  9. /public/components/element_types/__examples__/element_controls.stories.tsx
  10. /public/components/element_types/__examples__/element_grid.stories.tsx
  11. /public/components/item_grid/__examples__/item_grid.stories.tsx
  12. /public/components/keyboard_shortcuts_doc/__examples__/keyboard_shortcuts_doc.stories.tsx
  13. /public/components/shape_picker/__examples__/shape_picker.stories.tsx
  14. /public/components/shape_preview/__examples__/shape_preview.stories.tsx
  15. /public/components/shape_picker_popover/__examples__/shape_picker_popover.stories.tsx
  16. /public/components/sidebar/__examples__/group_settings.stories.tsx
  17. /public/components/sidebar/__examples__/multi_element_settings.stories.tsx
  18. /public/components/sidebar_header/__examples__/sidebar_header.stories.tsx
  19. /public/components/tag/__examples__/tag.stories.tsx
  20. /public/components/tag_list/__examples__/tag_list.stories.tsx
  21. /public/components/tool_tip_shortcut/__examples__/tool_tip_shortcut.stories.tsx
  22. /public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories.tsx
  23. /public/components/workpad_header/workpad_export/__examples__/pdf_panel.stories.tsx
  24. /public/components/workpad_header/workpad_export/flyout/__examples__/share_website_flyout.stories.tsx
  25. /canvas_plugin_src/renderers/time_filter/components/datetime_range_absolute/__examples__/datetime_range_absolute.stories.tsx
  26. /canvas_plugin_src/renderers/time_filter/components/datetime_calendar/__examples__/datetime_calendar.stories.tsx
  27. /canvas_plugin_src/renderers/time_filter/components/datetime_quick_list/__examples__/datetime_quick_list.stories.tsx
  28. /canvas_plugin_src/renderers/time_filter/components/datetime_input/__examples__/datetime_input.stories.tsx
  29. /canvas_plugin_src/renderers/time_filter/components/time_picker/__examples__/time_picker.stories.tsx
  30. /canvas_plugin_src/renderers/time_filter/components/pretty_duration/__examples__/pretty_duration.stories.tsx
  31. /canvas_plugin_src/renderers/metric/component/__examples__/metric.stories.tsx
  32. /canvas_plugin_src/uis/arguments/axis_config/__examples__/extended_template.stories.tsx
  33. /canvas_plugin_src/uis/arguments/axis_config/__examples__/simple_template.stories.tsx
  34. /canvas_plugin_src/uis/arguments/date_format/__examples__/date_format.stories.tsx
  35. /canvas_plugin_src/uis/arguments/number_format/__examples__/number_format.stories.tsx

These remaining stories below would throw an error in global Storybook as they are using some state or some import from ui/public. Likely that not just the stories, but also the components themselves need some adjustment before they can be migrated to the New Platfrom and global Storybook:

  1. /public/components/asset_manager/__examples__/asset.examples.tsx
  2. /public/components/asset_manager/__examples__/asset_manager.examples.tsx
  3. /public/components/custom_element_modal/__examples__/custom_element_modal.examples.tsx
  4. /public/components/expression_input/__examples__/expression_input.examples.tsx
  5. /public/components/workpad_header/workpad_export/__examples__/workpad_export.examples.tsx
  6. /public/canvas_plugin_src/renderers/time_filter/components/time_filter/__examples__/time_filter.examples.tsx
  7. /shareable_runtime/components/__examples__/canvas.examples.tsx
  8. /shareable_runtime/components/__examples__/page.examples.tsx
  9. /shareable_runtime/components/__examples__/rendered_element.examples.tsx
  10. /shareable_runtime/components/footer/__examples__/page_controls.examples.tsx
  11. /shareable_runtime/components/footer/__examples__/footer.examples.tsx
  12. /shareable_runtime/components/footer/__examples__/scrubber.examples.tsx
  13. /shareable_runtime/components/footer/__examples__/title.examples.tsx
  14. /shareable_runtime/components/footer/settings/__examples__/autoplay_settings.examples.tsx
  15. /shareable_runtime/components/footer/settings/__examples__/settings.examples.tsx
  16. /shareable_runtime/components/footer/settings/__examples__/toolbar_settings.examples.tsx
  17. /canvas_plugin_src/renderers/advanced_filter/component/__examples__/advanced_filter.examples.tsx
  18. /canvas_plugin_src/renderers/dropdown_filter/component/__examples__/dropdown_filter.examples.tsx
  19. /canvas_plugin_src/renderers/time_filter/components/time_picker_popover/__examples__/time_picker_popover.examples.tsx
  20. /public/expression_types/arg_types/container_style/__examples__/simple_template.examples.tsx
  21. /public/expression_types/arg_types/container_style/__examples__/extended_template.examples.tsx
  22. /public/expression_types/arg_types/series_style/__examples__/extended_template.examples.tsx
  23. /public/expression_types/arg_types/series_style/__examples__/simple_template.examples.tsx

Closes #37102

@elastic elastic deleted a comment from elasticmachine Aug 19, 2019
@elastic elastic deleted a comment from elasticmachine Aug 19, 2019
@streamich streamich changed the title Storybook 2 📕 Storybook for everyone (take 2) Aug 27, 2019
@clintandrewhall
Copy link
Contributor

Might want to take a look at #44511 ... I added a number of helpful flags to our script.

@elastic elastic deleted a comment from elasticmachine Dec 6, 2019
@elastic elastic deleted a comment from elasticmachine Dec 6, 2019
@elastic elastic deleted a comment from elasticmachine Dec 6, 2019
@elastic elastic deleted a comment from elasticmachine Dec 7, 2019
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM once green, but a couple questions and two nits

src/dev/storybook/run_storybook_cli.ts Outdated Show resolved Hide resolved
packages/kbn-storybook/index.js Show resolved Hide resolved
src/dev/storybook/run_storybook_cli.ts Outdated Show resolved Hide resolved
x-pack/package.json Show resolved Hide resolved
Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

Approving to unblock... most of the changes look good. I'll likely revisit the EuiPopoverAny, but could you please address the ticks in color_manager?

@streamich streamich mentioned this pull request Jan 14, 2020
11 tasks
@streamich streamich added v7.7.0 and removed v7.6.0 labels Jan 14, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@streamich
Copy link
Contributor Author

Merging without the rest of the CODEOWNERS reviews as their changes don't have real code changes—only setup of sample Storybooks.

@streamich streamich merged commit 22369c9 into elastic:master Jan 15, 2020
smith added a commit to smith/kibana that referenced this pull request Jan 15, 2020
    Add Storybook with help from changes in elastic#43529.

    We still need to do some work around having mocks for hooks and HTTP requests but the basics are there.
@smith smith mentioned this pull request Jan 15, 2020
streamich added a commit that referenced this pull request Jan 16, 2020
* 📕 Storybook for everyone (take 2) (#43529)

* chore: 🤖 add Infra sample Storybook story

* chore: 🤖 add @kbn/storybook package

* chore: 🤖 add sample SIEM stories

* chore: 🤖 add Canvas new Storybook config

* fix: 🐛 fix TypeScript errors

* chore: 🤖 add @kbn/babel-preset to package.json

* chore: 🤖 move dependencies to devDependencies

* chore: 🤖 make Storybook dependencies non-dev

* chore: 🤖 upgrade Storybook dependencies

* chore: 🤖 add packages to webpack

* fix: 🐛 fix TypeScript type check

* chore: 🤖 disable ESLint warnings

* chore: 🤖 remove Storybook info plugin

* chore: 🤖 upate yarn.lock

* chore: 🤖 add Storbook to Embeddables

* feat: 🎸 add --clean flag to Storybook CLI

* coalesce yarn.lock versions

* update kbn/pm dist

* This reverts commit 97d8ff9 and 49b07cd.

* chore: 🤖 use fs instead of mkdirp

* chore: 🤖 use debug for message logging

* chore: 🤖 update yarn.lock

* feat: 🎸 add link to kbn-storybook package

* docs: ✏️ add Storybook readme

* chore: 🤖 remove packages that failed DLL build

* style: 💄 add ESLint comma

* chore: 🤖 apply changes from #52209

* fix: 🐛 make Canvas Storybook build again

* chore: 🤖 move Canvas stories to global Storybook

* chore: 🤖 move more Canvas components to global Storybook

* chore: 🤖 move more Canvas stories to global Storybook

* chore: 🤖 move <ItemGrid> and <KeyboardShortcutsDoc> to NP SB

* chore: 🤖 move shape picker Canvas stories to global Storybook

* chore: 🤖 move Canvas sidebar stories to global Storybook

* fix: 🐛 split imports to not import path.resolve in Storybook

* chore: 🤖 move tag and PDF panel Canvas stories to global SB

* chore: 🤖 move Canvas share website flyout stories to global SB

* fix: 🐛 clean up <ShareWebsiteFlyout> imports

* chore: 🤖 add back Canvas withInfo decorator

* chore: 🤖 look for Canvas stories everywhere in /canvas folder

* test: 💍 mock correct files in Storyshots

* test: 💍 update Canvas Storyshot snapshots

* chore: 🤖 move more Canvas components to global Storybook

* chore: 🤖 move more Canvas components to global Storybook

* test: 💍 update Canvas Storyshots

* chore: 🤖 rebuild @kbn/pm

* chore: 🤖 refresh @kbn/pm dist/index.js artifact

* chore: 🤖 update yarn.lock

* chore: 🤖 update @kbn/pm artifact

* feat: 🎸 address review comments

* fix: 🐛 remove circular import

* chore: 🤖 update yarn.lock

* test: 💍 disable a test suite

* test: 💍 update Canvas storyshots

* chore: 🤖 remvoe build step from @kbn/storybook

* chore: 🤖 enable disabled functional test suite

Co-authored-by: Spencer <email@spalger.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* chore: 🤖 update yarn.lock

Co-authored-by: Spencer <email@spalger.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
smith added a commit that referenced this pull request Jan 16, 2020
Add Storybook with help from changes in #43529.

    We still need to do some work around having mocks for hooks and HTTP requests but the basics are there.
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
* chore: 🤖 add Infra sample Storybook story

* chore: 🤖 add @kbn/storybook package

* chore: 🤖 add sample SIEM stories

* chore: 🤖 add Canvas new Storybook config

* fix: 🐛 fix TypeScript errors

* chore: 🤖 add @kbn/babel-preset to package.json

* chore: 🤖 move dependencies to devDependencies

* chore: 🤖 make Storybook dependencies non-dev

* chore: 🤖 upgrade Storybook dependencies

* chore: 🤖 add packages to webpack

* fix: 🐛 fix TypeScript type check

* chore: 🤖 disable ESLint warnings

* chore: 🤖 remove Storybook info plugin

* chore: 🤖 upate yarn.lock

* chore: 🤖 add Storbook to Embeddables

* feat: 🎸 add --clean flag to Storybook CLI

* coalesce yarn.lock versions

* update kbn/pm dist

* This reverts commit 97d8ff9 and 49b07cd.

* chore: 🤖 use fs instead of mkdirp

* chore: 🤖 use debug for message logging

* chore: 🤖 update yarn.lock

* feat: 🎸 add link to kbn-storybook package

* docs: ✏️ add Storybook readme

* chore: 🤖 remove packages that failed DLL build

* style: 💄 add ESLint comma

* chore: 🤖 apply changes from elastic#52209

* fix: 🐛 make Canvas Storybook build again

* chore: 🤖 move Canvas stories to global Storybook

* chore: 🤖 move more Canvas components to global Storybook

* chore: 🤖 move more Canvas stories to global Storybook

* chore: 🤖 move <ItemGrid> and <KeyboardShortcutsDoc> to NP SB

* chore: 🤖 move shape picker Canvas stories to global Storybook

* chore: 🤖 move Canvas sidebar stories to global Storybook

* fix: 🐛 split imports to not import path.resolve in Storybook

* chore: 🤖 move tag and PDF panel Canvas stories to global SB

* chore: 🤖 move Canvas share website flyout stories to global SB

* fix: 🐛 clean up <ShareWebsiteFlyout> imports

* chore: 🤖 add back Canvas withInfo decorator

* chore: 🤖 look for Canvas stories everywhere in /canvas folder

* test: 💍 mock correct files in Storyshots

* test: 💍 update Canvas Storyshot snapshots

* chore: 🤖 move more Canvas components to global Storybook

* chore: 🤖 move more Canvas components to global Storybook

* test: 💍 update Canvas Storyshots

* chore: 🤖 rebuild @kbn/pm

* chore: 🤖 refresh @kbn/pm dist/index.js artifact

* chore: 🤖 update yarn.lock

* chore: 🤖 update @kbn/pm artifact

* feat: 🎸 address review comments

* fix: 🐛 remove circular import

* chore: 🤖 update yarn.lock

* test: 💍 disable a test suite

* test: 💍 update Canvas storyshots

* chore: 🤖 remvoe build step from @kbn/storybook

* chore: 🤖 enable disabled functional test suite

Co-authored-by: Spencer <email@spalger.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
Add Storybook with help from changes in elastic#43529.

    We still need to do some work around having mocks for hooks and HTTP requests but the basics are there.
smith added a commit to smith/kibana that referenced this pull request Jan 30, 2020
Add Storybook with help from changes in elastic#43529.

    We still need to do some work around having mocks for hooks and HTTP requests but the basics are there.
smith added a commit that referenced this pull request Jan 31, 2020
Add Storybook with help from changes in #43529.

    We still need to do some work around having mocks for hooks and HTTP requests but the basics are there.
@mshustov mshustov mentioned this pull request Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes review Team:Operations Team label for Operations Team v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📕 Storybook
8 participants