- can read on EmbeddedDashboard
- can export on Chart
- can export on Dashboard
- can csv on Superset
- can this form get on CsvToDatabaseView
- can this form post on CsvToDatabaseView (probably not required but I have it set)
- can view chart as table on Dashboard (optional but useful)
Some of these may not be explicitly required, as I added many at the same time and haven't experimented which can be removed yet. But it does work with this combination.
While you can use admin for this, you should really create a new user and role solely for requesting/issuing tokens. Start with admin then strip away the roles that you don't need, or apply the above + roles relating to token requesting/creation. I'm still using broad scope so won't try to tell you the specific ones required.
Ensure you disable hiding chart controls by setting hideChartControls: false
in the dashboardUiConfig
See SupersetDashboard.tsx
See dashboardPage.tsx
Ensure your .env file is loaded in the base of the project (next to package.json)
Now the page loads on the server and the dashboard windows load in the client.
These settings don't play a role in whether CSV exporting appears or not, but if you're having trouble getting the dashboard to load, make sure that both the user requesting the token and the guest user is set to GAMMA role, and that user has the above permissions. I also set the flag PUBLIC_ROLE_LIKE="Gamma"
and issued the same perms to that role too, but am not sure if that's required.
Note that for production environments you should not allow all origins and headers, and should make these settings more restrictive
These settings along with ensuring you are using the latest version of Superset (4) should allow CSV exports to work from an embedded dashboard
You can also configure what a user can filter when exporting from the dashboard in the filter settings for the dashboard. Create a filter for each dimension, and ensure the UI component has showing the filter panel enabled. In the embedded dashboard, when you apply a filter to a chart, the filters are applied whenever you make an export.
@jackgray thank you for this, super nicely factored code and saved me a ton of time while going down this rabbit hole. Converted to vuejs and rails nicely. Thanks again!