williaster commented on a change in pull request #3581: Dashboard refactory
URL:
https://github.com/apache/incubator-superset/pull/3581#discussion_r147906610
##########
File path: superset/assets/javascripts/dashboard/reducers.js
##########
@@ -0,0 +1,193 @@
+import { combineReducers } from 'redux';
+import d3 from 'd3';
+
+import charts, { chart } from '../chart/chartReducer';
+import * as actions from './actions';
+import { getParam } from '../modules/utils';
+import { alterInArr, removeFromArr } from '../reduxUtils';
+import { applyDefaultFormData } from '../explore/stores/store';
+
+export function getInitialState(bootstrapData) {
+ const { user_id, datasources, common } = bootstrapData;
+ delete common.locale;
+ delete common.language_pack;
+
+ const dashboard = Object.assign({}, bootstrapData.dashboard_data);
+ const filters = {};
+ try {
+ // allow request parameter overwrite dashboard metadata
+ const filterData = JSON.parse(getParam('preselect_filters') ||
dashboard.metadata.default_filters);
+ for (const key in filterData) {
+ const sliceId = parseInt(key, 10);
+ filters[sliceId] = filterData[key];
+ }
+ } catch (e) {
+ //
Review comment:
should we log something here?
----------------------------------------------------------------
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