mirror of
https://github.com/apache/superset.git
synced 2026-04-25 11:04:48 +00:00
* create structure for new forked explore view (#1099) * create structure for new forked explore view * update component name * add bootstrap data pattern * remove console.log * Created store and reducers (#1108) * Created store and reducers * Added spec * Modifications based on comments * do use bootstrap data for now * don't deal with bootstrap data for now * use victory as a base * import fake line data, add fake panels, make chart fixed * add fetch support * get slice data from json endpoint * render chart with slicejson * update chart and label demo * remove fetch config * remove dummy control panels * should be a func * make TimeSeriesLineChart * add a comment * inner height for height * don't need fetch yet * trailing comma breaks in package json * pass in viz data from props * add style sheet * set height on explore container * add legend * make chart responsive to window resize * can't use head_css in template bc overrides head_css in basic * fix linting * break labelItem into own SFC, make legend SFC * add propTypes and fix linter
43 lines
1.5 KiB
JavaScript
43 lines
1.5 KiB
JavaScript
import React from 'react';
|
|
import ReactDOM from 'react-dom';
|
|
import ExploreViewContainer from './components/ExploreViewContainer';
|
|
import { createStore, applyMiddleware, compose } from 'redux';
|
|
import { Provider } from 'react-redux';
|
|
import thunk from 'redux-thunk';
|
|
|
|
import { initialState } from './stores/store';
|
|
|
|
const exploreViewContainer = document.getElementById('js-explore-view-container');
|
|
const bootstrapData = JSON.parse(exploreViewContainer.getAttribute('data-bootstrap'));
|
|
|
|
import { exploreReducer } from './reducers/exploreReducer';
|
|
|
|
const bootstrappedState = Object.assign(initialState, {
|
|
datasources: bootstrapData.datasources,
|
|
datasourceId: parseInt(bootstrapData.datasource_id, 10),
|
|
datasourceType: bootstrapData.datasource_type,
|
|
sliceName: bootstrapData.viz.form_data.slice_name,
|
|
sliceId: bootstrapData.viz.form_data.slice_id,
|
|
vizType: bootstrapData.viz.form_data.viz_type,
|
|
timeColumn: bootstrapData.viz.form_data.granularity_sqla,
|
|
timeGrain: bootstrapData.viz.form_data.time_grain_sqla,
|
|
metrics: [bootstrapData.viz.form_data.metrics].map((m) => ({ value: m, label: m })),
|
|
since: bootstrapData.viz.form_data.since,
|
|
until: bootstrapData.viz.form_data.until,
|
|
havingClause: bootstrapData.viz.form_data.having,
|
|
whereClause: bootstrapData.viz.form_data.where,
|
|
});
|
|
const store = createStore(exploreReducer, bootstrappedState,
|
|
compose(applyMiddleware(thunk))
|
|
);
|
|
|
|
ReactDOM.render(
|
|
<Provider store={store}>
|
|
<ExploreViewContainer
|
|
data={bootstrapData}
|
|
/>
|
|
</Provider>,
|
|
exploreViewContainer
|
|
);
|
|
|