diff --git a/caravel/assets/utils/common.js b/caravel/assets/utils/common.js index f96c33bf70b65..13f7071c119b7 100644 --- a/caravel/assets/utils/common.js +++ b/caravel/assets/utils/common.js @@ -1,4 +1,7 @@ /* eslint global-require: 0 */ +import persistState from 'redux-localstorage'; +import { compose } from 'redux'; + const d3 = window.d3 || require('d3'); export const EARTH_CIRCUMFERENCE_KM = 40075.16; diff --git a/caravel/templates/caravel/explore.html b/caravel/templates/caravel/explore.html index 1ea84c5de88dc..57e0c3a4c7fae 100644 --- a/caravel/templates/caravel/explore.html +++ b/caravel/templates/caravel/explore.html @@ -1,307 +1,15 @@ {% extends "caravel/basic.html" %} -{% block title %} - {% if slice %} - [slice] {{ slice.slice_name }} - {% else %} - [explore] {{ viz.datasource.table_name }} - {% endif %} -{% endblock %} - {% block body %} - {% set datasource = viz.datasource %} - {% set form = viz.form %} - - {% macro panofield(fieldname)%} -
- {% set field = form.get_field(fieldname)%} -
- {{ field.label }} - {% if field.description %} - - {% endif %} - {{ field(class_=form.field_css_classes(field.name)) }} -
-
- {% endmacro %} - -
- +
{% endblock %} {% block tail_js %} {{ super() }} - {% with filename="explore" %} + {% with filename="explorev2" %} {% include "caravel/partials/_script_tag.html" %} {% endwith %} {% endblock %} diff --git a/caravel/views.py b/caravel/views.py index 11e6a6901f2d9..8e682ff0a2d18 100755 --- a/caravel/views.py +++ b/caravel/views.py @@ -1195,11 +1195,18 @@ def explore(self, datasource_type, datasource_id, slice_id=None): template = "caravel/standalone.html" else: template = "caravel/explore.html" - return self.render_template( - template, viz=viz_obj, slice=slc, datasources=datasources, - can_add=slice_add_perm, can_edit=slice_edit_perm, - can_download=slice_download_perm, - userid=g.user.get_id() if g.user else '') + bootstrap_data = { + "can_add": slice_add_perm, + "can_download": slice_download_perm, + "can_edit": slice_edit_perm, + # TODO: separate endpoint for fetching datasources + "datasources": [(d.id, d.full_name) for d in datasources], + "datasource_id": datasource_id, + "datasource_type": datasource_type, + "user_id": g.user.get_id() if g.user else None, + "viz": json.loads(viz_obj.get_json()) + } + return self.render_template(template, bootstrap_data=json.dumps(bootstrap_data)) @has_access @expose("/exploreV2////")