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_r180884064
########## File path: superset/assets/javascripts/dashboard/reducers/index.js ########## @@ -0,0 +1,116 @@ +import { combineReducers } from 'redux'; +import shortid from 'shortid'; + +import charts, { chart } from '../../chart/chartReducer'; +import dashboardReducer from './dashboard'; +import datasourcesReducer from './datasources'; +import allSlices, { initAllSlices } from './allSlices'; +import layoutReducer from '../v2/reducers/index'; +import messageToasts from '../v2/reducers/messageToasts'; +import { getParam } from '../../modules/utils'; +import layoutConverter from '../util/dashboardLayoutConverter'; +import { applyDefaultFormData } from '../../explore/stores/store'; +import { getColorFromScheme } from '../../modules/colors'; + +export function getInitialState(bootstrapData) { + const { user_id, datasources, common } = bootstrapData; + delete common.locale; + delete common.language_pack; + + const dashboard = { ...bootstrapData.dashboard_data }; + let filters = {}; + try { + // allow request parameter overwrite dashboard metadata + filters = JSON.parse(getParam('preselect_filters') || dashboard.metadata.default_filters); + } catch (e) { + // + } + + // Priming the color palette with user's label-color mapping provided in + // the dashboard's JSON metadata + if (dashboard.metadata && dashboard.metadata.label_colors) { + const colorMap = dashboard.metadata.label_colors; + for (const label in colorMap) { + getColorFromScheme(label, null, colorMap[label]); + } + } + + // dashboard layout + const position_json = dashboard.position_json; + let layout; Review comment: please leave a comment about converting between different layouts ---------------------------------------------------------------- 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