[Canvas][PoC] Add Redux Inspector to Storybook; standardize names and convert a few stories#69357
[Canvas][PoC] Add Redux Inspector to Storybook; standardize names and convert a few stories#69357clintandrewhall wants to merge 7 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-canvas (Team:Canvas) |
|
This is pretty rad overall! Are there ways for us to manipulate the redux state from the test file? The ability to modify the state directly from the storybook page is pretty cool I think I'm a little hesitant to go this direction though if it means we have to continue to maintain two separate storybook test groups (ours and the kbn-storybook stuff). Are any other teams running into these types of redux issues with their storybook tests? Is this something we could get buy-in to pull into kbn-storybook? |
|
@elasticmachine merge upstream |
|
@streamich Could you please help me get these changes/abilities integrated into |
|
@elasticmachine merge upstream |
crob611
left a comment
There was a problem hiding this comment.
Looks good. Left a few comments that might be for discussion outside this PR
| }, | ||
| }; | ||
|
|
||
| const reducers = combineReducers({ |
There was a problem hiding this comment.
Does this store used by Storybook even need all of the reducers and middleware, etc? Or should it just be used to provide state to components that need it?
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import React, { FC } from 'react'; |
There was a problem hiding this comment.
I prefer FunctionComponent vs FC but I ain't going to fight about it or anything. But, we should reach an agreement on one and stick to that. Maybe add a lint rule to force us to one or the other.
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
merge conflict between base and head |
spalger
left a comment
There was a problem hiding this comment.
Operations: tweak to precommit config LGTM
💔 Build Failed
Failed CI StepsBuild metricsasync chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
|
I'm going to split this PR up into better chunks. There's too much churn and too much to review at once. I'll be referring to this PR and branch moving forward, though. |
Summary
This PR is a proof-of-concept that would allow components to be connected to a mock workpad store.
There are a lot of parts to this PR:
Moving Storybook from
.storybooktostorybookThere are a lot of gotchas around typing and using
eslintin a directory that begins in a.. It's been a constant pain, so I renamed the directory.Custom Storybook Addon for Redux Actions
I wrote a custom addon for Storybook that not only provides a
storeto anyreduxcomponent, but also patches thedispatchfunction to output the result of the action.As a result, we can test our components as if they were in Canvas, and also see the results of any action.
Applying a new component file structure for Redux components
I'm proposing a new structure for our components that is demonstrated here with
asset,asset_managerandworkpad_config:The exporting file would be:
Gotchas
kbn-storybookprovides, and would require us to stay with our config, rather than migrate.