patternfly / patternfly-org

Home of patternfly.org
https://www.patternfly.org
MIT License
69 stars 136 forks source link

LogViewer: fix codesandbox examples #2705

Open nicolethoen opened 3 years ago

nicolethoen commented 3 years ago

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

stale[bot] commented 2 years ago

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

nicolethoen commented 2 years ago

@DaoDaoNoCode this may be something we still need to address

DaoDaoNoCode commented 2 years ago

@nicolethoen Sure, checking now.

DaoDaoNoCode commented 2 years ago

@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?

redallen commented 2 years ago

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

evwilkin commented 2 years ago

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