-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat: Add error pages #13144
feat: Add error pages #13144
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13144 +/- ##
==========================================
- Coverage 77.21% 72.88% -4.34%
==========================================
Files 903 555 -348
Lines 45662 20535 -25127
Branches 5506 5374 -132
==========================================
- Hits 35258 14966 -20292
+ Misses 10278 5441 -4837
- Partials 126 128 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
nit: @samtfm can you add to the description on the PR, that this is just a placeholder, since they are not actually going to get rendered |
Hi @samtfm, thanks for the contribution! I'm wondering if you could speak a bit about the architecture approach you chose here. Most of the frontend assets in Superset are rendered using React, and those that don't we're quickly trying to replace (like the HTML templates that flask renders). Why was the decision made to use raw HTML and CSS for these pages instead of making use of the shared React components and React render logic already available in the app? |
Hi @etr2460 the goal from Preset's side is to add static error pages that can be rendered directly from a web server (such as nginx) without relying on the rest of the systems. We thought they might be nice to contribute back to the community for others who have the same need. Happy to make that more obvious however it would be most useful. |
Thanks for the context @willbarrett! Adding this to the PR summary would definitely be helpful (especially since they're not used anywhere in code, and therefore might get deleted as unused code in the future without that documentation). Also, for this use case, I wonder if the CSS (and even images with base64) should be embedded within the html files to prevent further dependencies. |
Yes, I think that's a good idea @etr2460 - a little duplication would make them easier to deploy. If we find we need more than two, it might be possible to create a simple static page generator to spit them out, but I think we should wait for a request for a 3rd error page before going down that path. |
Perhaps we can add a README to the |
Thanks all. Copying the css into the two files sounds good. I'd also propose I move the referenced image files into this static-pages directory. I'm a little wary of the legibility of embedding images as base64 if these aren't going to be auto-generated, but I suppose I could still include the source files in the same folder, and include the steps for updating the html in the README. |
Maybe you can take advantage of the html-webpack-plugin to build a static error pages with all styles and images embedded? I'm also wondering whether it makes sense to let Python/Jinja render 404 and 403 first, and only fallback to a static 500 page in Nginx if the Python render fails. So you can do more advanced stuff with these error pages like having global navs and render more customized error messages, etc |
73d4015
to
620d26c
Compare
@ktmud thank you for the suggestion! I've refactored this using html-webpack-plugin to render these html files directly to the distribution folder. (package-lock.json got updated in a big way that I didn't intend, I am currently looking into how to tell npm to add a package without doing this lockfileVersion update) |
453fef2
to
8cfc4ec
Compare
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 rebased.
* add custom error pages for 404 and 500 responses * refactor error page styles into separate template * move error pages to superset-frontend * fix whitespace on error pages * refactor error pages to be generated by jinja * generate static error pages with webpack
SUMMARY
Adds custom 404 and 500 error pages as static html
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION