williaster commented on a change in pull request #5213: [fix] new dashboard
state
URL:
https://github.com/apache/incubator-superset/pull/5213#discussion_r196904348
##########
File path: superset/views/core.py
##########
@@ -1562,17 +1564,22 @@ def copy_dash(self, dashboard_id):
session.add(new_slice)
session.flush()
new_slice.dashboards.append(dash)
- old_to_new_sliceids[slc.id] = new_slice.id
+ old_to_new_sliceids['{}'.format(slc.id)] = \
+ '{}'.format(new_slice.id)
# update chartId of layout entities
- for value in data['positions'].values():
- if (
- isinstance(value, dict) and value.get('meta') and
- value.get('meta').get('chartId')
- ):
- old_id = value.get('meta').get('chartId')
- new_id = old_to_new_sliceids[old_id]
- value['meta']['chartId'] = new_id
+ if is_v2_dash:
+ for value in data['positions'].values():
+ if (
+ isinstance(value, dict) and value.get('meta') and
+ value.get('meta').get('chartId')
+ ):
+ old_id = '{}'.format(value.get('meta').get('chartId'))
Review comment:
@graceguo-supercat can you add a comment about strings vs ints here so the
logic is documented somewhere?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]