zhaoyongjie commented on code in PR #21497:
URL: https://github.com/apache/superset/pull/21497#discussion_r973861286
##########
superset-frontend/src/explore/actions/saveModalActions.js:
##########
@@ -215,3 +218,23 @@ export const getDashboard = dashboardId => async dispatch
=> {
throw error;
}
};
+
+// Get dashboards the slice is added to
+export const getSliceDashboards = slice => async dispatch => {
+ if (slice) {
+ try {
+ const response = await SupersetClient.get({
+ endpoint: `/api/v1/chart/${slice.slice_id}?q=${rison.encode({
+ columns: ['dashboards.id'],
+ })}`,
+ });
+
+ return response.json.result.dashboards.map(({ id }) => id);
+ } catch (error) {
+ dispatch(saveSliceFailed());
+ throw error;
+ }
+ }
+
+ return [];
Review Comment:
`return []` should be removed if remove the `if clause`
--
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]