This is an automated email from the ASF dual-hosted git repository. suddjian pushed a commit to branch fix/dash-change-chart-title in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 24b2b2dbb7d5d780e609a22708c6133cef3bcc63 Author: David Aaron Suddjian <[email protected]> AuthorDate: Wed Aug 5 15:40:13 2020 -0700 changing slice names in dashboard should not change chart title --- .../dashboard/components/gridComponents/ChartHolder.jsx | 8 ++++++-- superset/dashboards/dao.py | 14 -------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx b/superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx index 57a00b5..09a1ae5 100644 --- a/superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx +++ b/superset-frontend/src/dashboard/components/gridComponents/ChartHolder.jsx @@ -156,7 +156,7 @@ class ChartHolder extends React.Component { ...component, meta: { ...component.meta, - sliceName: nextName, + sliceNameOverride: nextName, }, }, }); @@ -255,7 +255,11 @@ class ChartHolder extends React.Component { dashboardId={dashboardId} width={chartWidth} height={chartHeight} - sliceName={component.meta.sliceName || ''} + sliceName={ + component.meta.sliceNameOverride || + component.meta.sliceName || + '' + } updateSliceName={this.handleUpdateSliceName} isComponentVisible={isComponentVisible} handleToggleFullSize={this.handleToggleFullSize} diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py index 5859640..7a4ee14 100644 --- a/superset/dashboards/dao.py +++ b/superset/dashboards/dao.py @@ -89,31 +89,17 @@ class DashboardDAO(BaseDAO): positions = data["positions"] # find slices in the position data slice_ids = [] - slice_id_to_name = {} for value in positions.values(): if isinstance(value, dict): try: slice_id = value["meta"]["chartId"] slice_ids.append(slice_id) - slice_id_to_name[slice_id] = value["meta"]["sliceName"] except KeyError: pass current_slices = db.session.query(Slice).filter(Slice.id.in_(slice_ids)).all() dashboard.slices = current_slices - # update slice names. this assumes user has permissions to update the slice - # we allow user set slice name be empty string - for slc in dashboard.slices: - try: - new_name = slice_id_to_name[slc.id] - if slc.slice_name != new_name: - slc.slice_name = new_name - db.session.merge(slc) - db.session.flush() - except KeyError: - pass - # remove leading and trailing white spaces in the dumped json dashboard.position_json = json.dumps( positions, indent=None, separators=(",", ":"), sort_keys=True
