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/03/04 15:04:43 UTC

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

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