williaster commented on a change in pull request #4791: apply new Dashboard 
builder to dashboard
URL: 
https://github.com/apache/incubator-superset/pull/4791#discussion_r180880670
 
 

 ##########
 File path: superset/assets/javascripts/dashboard/reducers/allSlices.js
 ##########
 @@ -0,0 +1,74 @@
+import * as actions from '../actions/allSlices';
+import { t } from '../../locales';
+
+export const initAllSlices = {
+  slices: {},
+  isLoading: true,
+  errorMsg: null,
+  lastUpdated: 0,
+};
+
+export default function allSlicesReducer(state = initAllSlices, action) {
+  const actionHandlers = {
+    [actions.UPDATE_SLICE_NAME]() {
+      const updatedSlice = {
+        ...state.slices[action.key],
+        slice_name: action.sliceName,
+      };
+      const updatedSlices = {
+        ...state.slices,
+        [action.key]: updatedSlice,
+      };
+      return { ...state, slices: updatedSlices };
+    },
+    [actions.FETCH_ALL_SLICES_STARTED]() {
+      return {
+        ...state,
+        isLoading: true,
+      }
+    },
+    [actions.SET_ALL_SLICES]() {
+      let slices = { ...state.slices };
+      action.result.map(slice => (
+        slices['slice_' + slice.id] = {
 
 Review comment:
   why not just use `slice.id`? then you have to encode / decode the same way 
everywhere and it doesn't match `slice.id`

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to