patternfly-org icon indicating copy to clipboard operation
patternfly-org copied to clipboard

LogViewer: fix codesandbox examples

Open nicolethoen opened this issue 4 years ago • 6 comments

The code sandbox examples/demo is not loading in the data file.

nicolethoen avatar Jul 29 '21 14:07 nicolethoen

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 27 '21 15:09 stale[bot]

@DaoDaoNoCode this may be something we still need to address

nicolethoen avatar Sep 27 '21 18:09 nicolethoen

@nicolethoen Sure, checking now.

DaoDaoNoCode avatar Sep 27 '21 18:09 DaoDaoNoCode

@redallen Could you take a look at this problem? I did some research and find this problem is because we use the codesandbox define API for patternfly.org and only create the files we want to create. https://github.com/patternfly/patternfly-org/blob/0ef1e926b807068a2f65bf899bd953acd7a36615/packages/theme-patternfly-org/helpers/codesandbox.js#L149-L193 Do you have any idea how to also create the ./realTestData.js in this situation? Is it possible to create a flag to indicate whether a file should be also created in codesandbox or not when making the API call?

DaoDaoNoCode avatar Sep 27 '21 18:09 DaoDaoNoCode

This is a problem with all example assets. @evwilkin came up with a clever solution for Core assets with some URL fiddling, but it won't work for React assets or assets not yet hosted on patternfly.org.

The better solution is to find a way to pass codesandbox imported example files by having webpack output assets in predictable paths. It looks like codesandbox has expanded their API since the last time I've checked so we may not have to send these (usually large) example files every POST: https://codesandbox.io/docs/api#binary-files

redallen avatar Sep 27 '21 19:09 redallen

Related issues #2737 & https://github.com/patternfly/patternfly-react/issues/6596

evwilkin avatar Nov 17 '21 16:11 evwilkin