You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/20 12:41:44 UTC

[GitHub] [superset] rafalpas opened a new issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

rafalpas opened a new issue #18109:
URL: https://github.com/apache/superset/issues/18109


   Problem reproduced with Superset 1.4rc4 with VERSIONED_EXPORT and DASHBOARD_NATIVE_FILTERS enabled - both are related to the problem.
   
   The native_filter_configuration section in dashboard's json metadata contains two fields that refer to charts with numeric IDs (chartsInScope and scope.excluded). When exporting and then importing a such a dashboard, while charts get new numeric IDs, the IDs are not updated. As a result the filter scoping definitions might be affected.
   
   #### How to reproduce the bug
   
   1. Install Superset 1.4rc4 with demo dashboards and VERSIONED_EXPORT, DASHBOARD_NATIVE_FILTERS feature flags enabled
   2. Create a new dashboard
   3. Add 2 charts (Boys, Girls) to the dashboard
   4. Add a Tab component
   5. Add 2 charts (Top 10 Boy Name Share, Top 1-- Girl Name Share) to the Tab component
   6. Save the dashboard
   ![image](https://user-images.githubusercontent.com/2510246/150337606-057563f2-2b02-4013-ae8a-9eecf29bdf52.png)
   7. Add a dashboard native filter on dataset "birth_names" and column "state"
   ![image](https://user-images.githubusercontent.com/2510246/150337733-f8e6a0cd-868d-4849-b1a0-ab45b46a98e8.png)
   8. Alter the scope of the filter to include only "boys" and "Top 10 Girl Name Share" and save
   ![image](https://user-images.githubusercontent.com/2510246/150337791-0a276bdd-79de-416f-a08f-c4ac1bd17bec.png)
   The filter is only applied to the desired charts
   ![image](https://user-images.githubusercontent.com/2510246/150337827-0c1129cf-c2b5-4975-9862-3cfb2abe3b51.png)
   9. Check the dashboard properties JSON METADATA - The native_filter_configuration contains references to numeric IDs of the charts ("chartsInScope" and "scope"."excluded")
   ![image](https://user-images.githubusercontent.com/2510246/150337895-e1fa12ef-c518-41a6-b51f-7405591051d0.png)
   10. Export the dashboard.
   11. Delete all charts and dashboards
   12. Import the exported dashboard -> notice that the numeric Ids of the 4 charts are now different (133, 134, 135, 136 in my case)
   13. Open the dashboard and activate the filter
   
   ### Expected results
   - The same two charts should be highlighted as after step 8
   ![image](https://user-images.githubusercontent.com/2510246/150337827-0c1129cf-c2b5-4975-9862-3cfb2abe3b51.png)
   
   ### Actual results
   - After step 13 all charts are highlighted (are in scope of the filter)
   ![image](https://user-images.githubusercontent.com/2510246/150338638-543d8dd1-e354-4a70-84fa-7183ea489dc1.png)
   - After checking filter scoping:
   ![image](https://user-images.githubusercontent.com/2510246/150338710-cf2a97fe-97fb-4929-87ae-aab4768d9f43.png)
   - After checking the JSON METADATA - still old IDs:
   ![image](https://user-images.githubusercontent.com/2510246/150338808-f6ce5f50-3641-474e-b1ab-25cbc632e447.png)
   
   #### Screenshots
   Added in the steps
   
   ### Environment
   
   - browser type and version: Microsoft Edge 96.0.1054.43
   - superset version: `superset version`: 1.4rc4
   - python version: `python --version`
   - node.js version: `node -v`
   - any feature flags active: VERSIONED_EXPORT, DASHBOARD_NATIVE_FILTERS, DASHBOARD_RBAC
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [ ] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   The problem can be partially reproduced with just two charts and without the tab component, but in this situation only one of the two fields with numeric IDs will be present in the dashboard's json metadata. Adding the tab component allows to see also the "scope"."excluded" field.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
eschutho commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1020561793


   Thanks for reporting this issue. 1.4.0 is based off 1.4.0rc4, so I would expect the bug to be in 1.4.0 as well. I'll add this to the open list of bugs for 1.4.1 and we'll see if someone can pick it up before we prepare the release. 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] gbusch commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
gbusch commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1059242546


   Just see that in the master, the second part is already there :)


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] gbusch commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
gbusch commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1059241195


   I have the same problem.
   
   I think it is easily fixable by adding 4 lines in the method "update_id_refs" in the file "superset/dashboards/commands/importers/v1/utils.py":
   
   ```
       # fix native filter references
       native_filter_configuration = fixed.get("metadata", {}).get(
           "native_filter_configuration", []
       )
       for native_filter in native_filter_configuration:
           targets = native_filter.get("targets", [])
           for target in targets:
               dataset_uuid = target.pop("datasetUuid", None)
               if dataset_uuid:
                   target["datasetId"] = dataset_info[dataset_uuid]["datasource_id"]
   
           charts_in_scope = native_filter.get("chartsInScope", [])
           native_filter["chartsInScope"] = [id_map[id] for id in charts_in_scope]
   
           excluded_scopes = native_filter.get("scope", {}).get("excluded", [])
           native_filter["scope"]["excluded"] = [id_map[id] for id in excluded_scopes]
   
       return fixed
   ```
   
   Will try to open a PR for this. Not sure whether I will manage as I never committed to this project...
   But maybe this already helps you?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
eschutho commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1020561793


   Thanks for reporting this issue. 1.4.0 is based off 1.4.0rc4, so I would expect the bug to be in 1.4.0 as well. I'll add this to the open list of bugs for 1.4.1 and we'll see if someone can pick it up before we prepare the release. 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rafalpas commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
rafalpas commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1046643619


   @eschutho @hughhhh - Is there any progress with fixing this bug? Can I expect it to be fixed in some 1.4.x release soon, or should I consider alternatives (revert back to not using native dashboard filters)?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rafalpas commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
rafalpas commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1019988695


   I have just noticed that 1.4 is already released. Does it make sense to try to reproduce this problem using 1.4, or should I expect it to be the same as 1.4.0rc4?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on issue #18109: Chart IDs not updated in native_filter_configuration when importing dashboard

Posted by GitBox <gi...@apache.org>.
eschutho commented on issue #18109:
URL: https://github.com/apache/superset/issues/18109#issuecomment-1061328953


   cc @villebro. Is this bug on your radar for 1.4.2?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org