-
- Downloads
Add dev fn to render dashboards with static-viz renderers (#36451)
* Add dev fn to render dashboards with static-viz renderers Run `(dev.render-png/render-dashboard-to-html 1)` to render the dashboard with id 1 to a handy html file. This file will render each dashcard in the dashboard 3 ways: - as a png, like you would see in Slack or in an email body (if it's a chart) - as html/svg, like you'd see in the email body (for tables).. might also be helpful to inspect the svg output from the graaljs interpreter - 10 row table representing what the .csv attachment for the dashcard would look like Note: to get this branch working properly, there are a couple lines commented out to pass the linter... it's a work in progress and will be cleaned up for better use. Todo: - [ ] avoid with-redefs to pass the linter - [ ] add a preview endpoint that can be used so that you don't need to run a Clojure repl to get the same result. * Eliminate with-redefs to allow csv 'render' * Make a 'preview' ns to power `api/pulse/preview_dashboard/:id` * Make dev.render-png dashboard preview fns the same as the preview ns * Dashboard Subscription preview ns now also uses csv attachment code This change now uses the csv attachment code to include an html table representing what we expect to see from csv exports. * Add dev fn to render dashboards with static-viz renderers Run `(dev.render-png/render-dashboard-to-html 1)` to render the dashboard with id 1 to a handy html file. This file will render each dashcard in the dashboard 3 ways: - as a png, like you would see in Slack or in an email body (if it's a chart) - as html/svg, like you'd see in the email body (for tables).. might also be helpful to inspect the svg output from the graaljs interpreter - 10 row table representing what the .csv attachment for the dashcard would look like Note: to get this branch working properly, there are a couple lines commented out to pass the linter... it's a work in progress and will be cleaned up for better use. Todo: - [ ] avoid with-redefs to pass the linter - [ ] add a preview endpoint that can be used so that you don't need to run a Clojure repl to get the same result. * Eliminate with-redefs to allow csv 'render' * Make a 'preview' ns to power `api/pulse/preview_dashboard/:id` * Make dev.render-png dashboard preview fns the same as the preview ns * Dashboard Subscription preview ns now also uses csv attachment code This change now uses the csv attachment code to include an html table representing what we expect to see from csv exports. * Collect all element styles into a single style tag to use with the server's nonce This allows the dashboard_preview endpoint to render properly by gathering all of the element styles into a single style tag, which can then be given the server's nonce value so that CSP doesn't strip the style out. This is useful for the preview endpoint so that we get an accurate picture of what our tables will look like in emails, plus it makes the presentation look just a bit more readable. * dev render_png fns match output used on the endpoint now too. * Hickory dependency out of dev into regular deps
src/metabase/pulse/preview.clj
0 → 100644
Please register or sign in to comment