-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Conversation
Might want to take a look at #44511 ... I added a number of helpful flags to our script. |
There was a problem hiding this 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
There was a problem hiding this 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
?
x-pack/legacy/plugins/canvas/public/components/color_manager/color_manager.tsx
Outdated
Show resolved
Hide resolved
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Merging without the rest of the |
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.
* 📕 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 protected]> Co-authored-by: Elastic Machine <[email protected]> * chore: 🤖 update yarn.lock Co-authored-by: Spencer <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
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.
* 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 protected]> Co-authored-by: Elastic Machine <[email protected]>
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.
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.
embeddable
,siem
, andinfra
plugins.node x-pack/legacy/plugins/canvas/scripts/storybook
).See instructions:
Run
embeddable
stories:Run
siem
stories:Run
infra
stories:Run
canvas
stories: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 withyarn 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./public/components/file_upload/file_upload.stories.tsx
/public/components/font_picker/font_picker.stories.tsx
/public/components/color_dot/__examples__/color_dot.stories.tsx
/public/components/color_manager/__examples__/color_manager.stories.tsx
/public/components/color_palette/__examples__/color_palette.stories.tsx
/public/components/color_picker/__examples__/color_picker.stories.tsx
/public/components/color_picker_popover/__examples__/color_picker_popover.stories.tsx
/public/components/element_card/__examples__/element_card.stories.tsx
/public/components/element_types/__examples__/element_controls.stories.tsx
/public/components/element_types/__examples__/element_grid.stories.tsx
/public/components/item_grid/__examples__/item_grid.stories.tsx
/public/components/keyboard_shortcuts_doc/__examples__/keyboard_shortcuts_doc.stories.tsx
/public/components/shape_picker/__examples__/shape_picker.stories.tsx
/public/components/shape_preview/__examples__/shape_preview.stories.tsx
/public/components/shape_picker_popover/__examples__/shape_picker_popover.stories.tsx
/public/components/sidebar/__examples__/group_settings.stories.tsx
/public/components/sidebar/__examples__/multi_element_settings.stories.tsx
/public/components/sidebar_header/__examples__/sidebar_header.stories.tsx
/public/components/tag/__examples__/tag.stories.tsx
/public/components/tag_list/__examples__/tag_list.stories.tsx
/public/components/tool_tip_shortcut/__examples__/tool_tip_shortcut.stories.tsx
/public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories.tsx
/public/components/workpad_header/workpad_export/__examples__/pdf_panel.stories.tsx
/public/components/workpad_header/workpad_export/flyout/__examples__/share_website_flyout.stories.tsx
/canvas_plugin_src/renderers/time_filter/components/datetime_range_absolute/__examples__/datetime_range_absolute.stories.tsx
/canvas_plugin_src/renderers/time_filter/components/datetime_calendar/__examples__/datetime_calendar.stories.tsx
/canvas_plugin_src/renderers/time_filter/components/datetime_quick_list/__examples__/datetime_quick_list.stories.tsx
/canvas_plugin_src/renderers/time_filter/components/datetime_input/__examples__/datetime_input.stories.tsx
/canvas_plugin_src/renderers/time_filter/components/time_picker/__examples__/time_picker.stories.tsx
/canvas_plugin_src/renderers/time_filter/components/pretty_duration/__examples__/pretty_duration.stories.tsx
/canvas_plugin_src/renderers/metric/component/__examples__/metric.stories.tsx
/canvas_plugin_src/uis/arguments/axis_config/__examples__/extended_template.stories.tsx
/canvas_plugin_src/uis/arguments/axis_config/__examples__/simple_template.stories.tsx
/canvas_plugin_src/uis/arguments/date_format/__examples__/date_format.stories.tsx
/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:/public/components/asset_manager/__examples__/asset.examples.tsx
/public/components/asset_manager/__examples__/asset_manager.examples.tsx
/public/components/custom_element_modal/__examples__/custom_element_modal.examples.tsx
/public/components/expression_input/__examples__/expression_input.examples.tsx
/public/components/workpad_header/workpad_export/__examples__/workpad_export.examples.tsx
/public/canvas_plugin_src/renderers/time_filter/components/time_filter/__examples__/time_filter.examples.tsx
/shareable_runtime/components/__examples__/canvas.examples.tsx
/shareable_runtime/components/__examples__/page.examples.tsx
/shareable_runtime/components/__examples__/rendered_element.examples.tsx
/shareable_runtime/components/footer/__examples__/page_controls.examples.tsx
/shareable_runtime/components/footer/__examples__/footer.examples.tsx
/shareable_runtime/components/footer/__examples__/scrubber.examples.tsx
/shareable_runtime/components/footer/__examples__/title.examples.tsx
/shareable_runtime/components/footer/settings/__examples__/autoplay_settings.examples.tsx
/shareable_runtime/components/footer/settings/__examples__/settings.examples.tsx
/shareable_runtime/components/footer/settings/__examples__/toolbar_settings.examples.tsx
/canvas_plugin_src/renderers/advanced_filter/component/__examples__/advanced_filter.examples.tsx
/canvas_plugin_src/renderers/dropdown_filter/component/__examples__/dropdown_filter.examples.tsx
/canvas_plugin_src/renderers/time_filter/components/time_picker_popover/__examples__/time_picker_popover.examples.tsx
/public/expression_types/arg_types/container_style/__examples__/simple_template.examples.tsx
/public/expression_types/arg_types/container_style/__examples__/extended_template.examples.tsx
/public/expression_types/arg_types/series_style/__examples__/extended_template.examples.tsx
/public/expression_types/arg_types/series_style/__examples__/simple_template.examples.tsx
Closes #37102