AxelFurlanF opened a new issue, #32966: URL: https://github.com/apache/superset/issues/32966
### Bug description I'm reopening the issue that was previously reported here: https://github.com/apache/superset/issues/15457 I'll quote that original issue here, the only difference is that I'm using 4.1.2. > When creating a dashboard with the API (POST `/dashboard/), the response indicates success but the resulting dashboard is not functional. The charts do not appear to be operative. > > Expected results > Creation of a dashboard with the API should result in a properly functioning dashboard / charts, just the same as if the dashboard were created manually with the UI. > > Actual results > Dashboard is successfully created, however the charts are nonoperational. > > Screenshots > Screen Shot 2021-06-29 at 9 22 20 AM > > How to reproduce the bug > Prerequisites: > > CSRF is disabled (add WTF_CSRF_ENABLED = False to superset/config.py) > Install curl for testing the API and jq for parsing JSON > SUPERSET_HOST=localhost:8088 > SUPERSET_USER=admin; SUPERSET_PASSWORD=admin > Obtain a TOKEN > TOKEN=$(curl -s http://$SUPERSET_HOST/api/v1/security/login -H 'accept: application/json' -H 'Content-Type: application/json' -d '{ "password": "'$SUPERSET_PASSWORD'", "provider": "db", "refresh": true, "username": "'$SUPERSET_USER'" }' | jq -r .access_token) > > Determine the UUID of the "Daily Totals" chart > Since there is no way to discover the UUID of a chart from the API (see related issue below), you need to manually create a dashboard containing a chart (for this simple test case) and then GET /dashboard/{pk} on that dashboard. The UUID value of the "Daily Totals" chart will be in the position_json attribute of the dashboard. > > Create a dashboard with the chart (NOTE: you must include the UUID of the "Daily Totals" chart from above step) > curl -s 'http://'$SUPERSET_HOST'/api/v1/dashboard/' \ -H 'Authorization: Bearer '$TOKEN'' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "dashboard_title": "TestDashboard", "json_metadata": "{\"timed_refresh_immune_slices\": [], \"expanded_slices\": {}, \"refresh_frequency\": 0, \"default_filters\": \"{}\", \"color_scheme\": null}", "position_json": "{\"CHART-w2_C20sz-l\":{\"children\":[],\"id\":\"CHART-w2_C20sz-l\",\"meta\":{\"chartId\":67,\"height\":50,\"sliceName\":\"Daily Totals\",\"uuid\":\"5ffc22e4-244e-491d-965b-b7d178845df2\",\"width\":4},\"parents\":[\"ROOT_ID\",\"GRID_ID\",\"ROW-qDUg8z__N5\"],\"type\":\"CHART\"},\"DASHBOARD_VERSION_KEY\":\"v2\",\"GRID_ID\":{\"children\":[\"ROW-qDUg8z__N5\"],\"id\":\"GRID_ID\",\"parents\":[\"ROOT_ID\"],\"type\":\"GRID\"},\"HEADER_ID\":{\"id\":\"HEADER_ID\",\"meta\":{\"text\":\"[ untitled dashboard ]\"},\"type\":\"HEADER\"},\"ROOT_ID\":{\"children\":[\"GRID_ID\"],\"id\":\"ROOT_ID\",\"type\":\"ROOT\" },\"ROW-qDUg8z__N5\":{\"children\":[\"CHART-w2_C20sz-l\"],\"id\":\"ROW-qDUg8z__N5\",\"meta\":{\"background\":\"BACKGROUND_TRANSPARENT\"},\"parents\":[\"ROOT_ID\",\"GRID_ID\"],\"type\":\"ROW\"}}", "published": false }' > > An HTTP 200 Success response is returned with this body: > > { "id": 13, "result": { "dashboard_title": "TestDashboard", "json_metadata": "{\"timed_refresh_immune_slices\": [], \"expanded_slices\": {}, \"refresh_frequency\": 0, \"default_filters\": \"{}\", \"color_scheme\": null}", "position_json": "{\"CHART-w2_C20sz-l\":{\"children\":[],\"id\":\"CHART-w2_C20sz-l\",\"meta\":{\"chartId\":67,\"height\":50,\"sliceName\":\"Daily Totals\",\"uuid\":\"5ffc22e4-244e-491d-965b-b7d178845df2\",\"width\":4},\"parents\":[\"ROOT_ID\",\"GRID_ID\",\"ROW-qDUg8z__N5\"],\"type\":\"CHART\"},\"DASHBOARD_VERSION_KEY\":\"v2\",\"GRID_ID\":{\"children\":[\"ROW-qDUg8z__N5\"],\"id\":\"GRID_ID\",\"parents\":[\"ROOT_ID\"],\"type\":\"GRID\"},\"HEADER_ID\":{\"id\":\"HEADER_ID\",\"meta\":{\"text\":\"[ untitled dashboard ]\"},\"type\":\"HEADER\"},\"ROOT_ID\":{\"children\":[\"GRID_ID\"],\"id\":\"ROOT_ID\",\"type\":\"ROOT\"},\"ROW-qDUg8z__N5\":{\"children\":[\"CHART-w2_C20sz-l\"],\"id\":\"ROW-qDUg8z__N5\",\"meta\":{\"background\":\"BACKGROUND_TRANSPARENT\"},\"parents\": [\"ROOT_ID\",\"GRID_ID\"],\"type\":\"ROW\"}}", "published": false } } > > Using the Superset UI, examine the "TestDashboard" just created, the chart on the dashboard displays the message (see screenshot) > "There is no chart definition associated with this component, could it have been deleted? > Delete this container and save to remove this message." > > Note: After creation of a dashboard with the API, if you manually use the UI to edit the dashboard and do a simple change (such as changing the name of the dashboard) and then save it, the dashboard will be operational (after a reload). Whatever is "missing" from the dashboard (links to the charts?) is created at this time. ### Screenshots/recordings After creating the dashboard using the REST API  After editing the dashboard and changing its name:  ### Superset version 4.1.2 ### Python version 3.11 ### Node version 16 ### Browser Chrome ### Additional context _No response_ ### Checklist - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem. - [ ] I have searched the GitHub issue tracker and didn't find a similar bug report. - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
