diff --git a/superset/assets/javascripts/explorev2/components/TextField.jsx b/superset/assets/javascripts/explorev2/components/TextField.jsx index d1b7e943465..9d52e26fd9c 100644 --- a/superset/assets/javascripts/explorev2/components/TextField.jsx +++ b/superset/assets/javascripts/explorev2/components/TextField.jsx @@ -7,7 +7,7 @@ const propTypes = { label: PropTypes.string, description: PropTypes.string, onChange: PropTypes.func, - value: PropTypes.oneOf([ + value: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), diff --git a/superset/assets/visualizations/cal_heatmap.js b/superset/assets/visualizations/cal_heatmap.js index 5e5a6b21b87..c87e1585499 100644 --- a/superset/assets/visualizations/cal_heatmap.js +++ b/superset/assets/visualizations/cal_heatmap.js @@ -8,9 +8,9 @@ require('../node_modules/cal-heatmap/cal-heatmap.css'); const CalHeatMap = require('cal-heatmap'); function calHeatmap(slice) { - const div = d3.select(slice.selector); const render = function () { + const div = d3.select(slice.selector); d3.json(slice.jsonEndpoint(), function (error, json) { const data = json.data; if (error !== null) { diff --git a/superset/assets/visualizations/directed_force.js b/superset/assets/visualizations/directed_force.js index b4f792d37d2..ec5d9f94d91 100644 --- a/superset/assets/visualizations/directed_force.js +++ b/superset/assets/visualizations/directed_force.js @@ -5,9 +5,8 @@ require('./directed_force.css'); /* Modified from http://bl.ocks.org/d3noob/5141278 */ function directedForceVis(slice) { - const div = d3.select(slice.selector); - const render = function () { + const div = d3.select(slice.selector); const width = slice.width(); const height = slice.height() - 25; d3.json(slice.jsonEndpoint(), function (error, json) { @@ -15,6 +14,7 @@ function directedForceVis(slice) { slice.error(error.responseText, error); return; } + console.log(json); const linkLength = json.form_data.link_length || 200; const charge = json.form_data.charge || -500; @@ -92,6 +92,7 @@ function directedForceVis(slice) { .attr('width', width) .attr('height', height); + // build the arrow. svg.append('svg:defs').selectAll('marker') .data(['end']) // Different link/path types can be defined here diff --git a/superset/assets/visualizations/filter_box.jsx b/superset/assets/visualizations/filter_box.jsx index b600a83e762..539c1888823 100644 --- a/superset/assets/visualizations/filter_box.jsx +++ b/superset/assets/visualizations/filter_box.jsx @@ -110,9 +110,8 @@ FilterBox.propTypes = propTypes; FilterBox.defaultProps = defaultProps; function filterBox(slice) { - const d3token = d3.select(slice.selector); - const refresh = function () { + const d3token = d3.select(slice.selector); d3token.selectAll('*').remove(); // filter box should ignore the dashboard's filters diff --git a/superset/assets/visualizations/histogram.js b/superset/assets/visualizations/histogram.js index cfb58fab9ee..4bb3a9a977c 100644 --- a/superset/assets/visualizations/histogram.js +++ b/superset/assets/visualizations/histogram.js @@ -4,7 +4,7 @@ import d3 from 'd3'; require('./histogram.css'); function histogram(slice) { - const div = d3.select(slice.selector); + let div; const draw = function (data, numBins) { // Set Margins @@ -128,6 +128,7 @@ function histogram(slice) { }; const render = function () { + div = d3.select(slice.selector); d3.json(slice.jsonEndpoint(), function (error, json) { if (error !== null) { slice.error(error.responseText, error); diff --git a/superset/assets/visualizations/mapbox.jsx b/superset/assets/visualizations/mapbox.jsx index 2d0e9d40524..46aacdf08ce 100644 --- a/superset/assets/visualizations/mapbox.jsx +++ b/superset/assets/visualizations/mapbox.jsx @@ -276,10 +276,10 @@ MapboxViz.propTypes = { function mapbox(slice) { const DEFAULT_POINT_RADIUS = 60; const DEFAULT_MAX_ZOOM = 16; - const div = d3.select(slice.selector); let clusterer; const render = function () { + const div = d3.select(slice.selector); d3.json(slice.jsonEndpoint(), function (error, json) { if (error !== null) { slice.error(error.responseText); diff --git a/superset/assets/visualizations/sankey.js b/superset/assets/visualizations/sankey.js index b1e81187dd6..1507a0aaeb1 100644 --- a/superset/assets/visualizations/sankey.js +++ b/superset/assets/visualizations/sankey.js @@ -7,8 +7,8 @@ d3.sankey = require('d3-sankey').sankey; require('./sankey.css'); function sankeyVis(slice) { - const div = d3.select(slice.selector); const render = function () { + const div = d3.select(slice.selector); const margin = { top: 5, right: 5, diff --git a/superset/assets/visualizations/sunburst.js b/superset/assets/visualizations/sunburst.js index 391d252bbe9..05fed1d2fb0 100644 --- a/superset/assets/visualizations/sunburst.js +++ b/superset/assets/visualizations/sunburst.js @@ -7,9 +7,9 @@ require('./sunburst.css'); // Modified from http://bl.ocks.org/kerryrodden/7090426 function sunburstVis(slice) { - const container = d3.select(slice.selector); const render = function () { + const container = d3.select(slice.selector); // vars with shared scope within this function const margin = { top: 10, right: 5, bottom: 10, left: 5 }; const containerWidth = slice.width(); diff --git a/superset/assets/visualizations/table.js b/superset/assets/visualizations/table.js index 652723d5c7f..4f4453d9eec 100644 --- a/superset/assets/visualizations/table.js +++ b/superset/assets/visualizations/table.js @@ -13,9 +13,9 @@ dt(window, $); function tableVis(slice) { const fC = d3.format('0,000'); let timestampFormatter; - const container = $(slice.selector); function refresh() { + const container = $(slice.selector); function onError(xhr) { slice.error(xhr.responseText, xhr); return; diff --git a/superset/assets/visualizations/treemap.js b/superset/assets/visualizations/treemap.js index 5d0ef1381a3..be9d0ac3194 100644 --- a/superset/assets/visualizations/treemap.js +++ b/superset/assets/visualizations/treemap.js @@ -6,7 +6,7 @@ require('./treemap.css'); /* Modified from http://bl.ocks.org/ganeshv/6a8e9ada3ab7f2d88022 */ function treemap(slice) { - const div = d3.select(slice.selector); + let div; const _draw = function (data, eltWidth, eltHeight, formData) { const margin = { top: 0, right: 0, bottom: 0, left: 0 }; @@ -227,6 +227,7 @@ function treemap(slice) { }; const render = function () { + div = d3.select(slice.selector); d3.json(slice.jsonEndpoint(), function (error, json) { if (error !== null) { slice.error(error.responseText, error); diff --git a/superset/assets/visualizations/word_cloud.js b/superset/assets/visualizations/word_cloud.js index d999b494870..93b7698a6e3 100644 --- a/superset/assets/visualizations/word_cloud.js +++ b/superset/assets/visualizations/word_cloud.js @@ -4,9 +4,9 @@ import cloudLayout from 'd3-cloud'; import { category21 } from '../javascripts/modules/colors'; function wordCloudChart(slice) { - const chart = d3.select(slice.selector); function refresh() { + const chart = d3.select(slice.selector); d3.json(slice.jsonEndpoint(), function (error, json) { if (error !== null) { slice.error(error.responseText, error); diff --git a/superset/assets/webpack.config.js b/superset/assets/webpack.config.js index 128840cfb2e..aa49f3b8e11 100644 --- a/superset/assets/webpack.config.js +++ b/superset/assets/webpack.config.js @@ -14,13 +14,13 @@ const config = { entry: { 'css-theme': APP_DIR + '/javascripts/css-theme.js', common: APP_DIR + '/javascripts/common.js', - dashboard: ['babel-polyfill', APP_DIR + '/javascripts/dashboard/Dashboard.jsx'], - explore: ['babel-polyfill', APP_DIR + '/javascripts/explore/explore.jsx'], + //dashboard: ['babel-polyfill', APP_DIR + '/javascripts/dashboard/Dashboard.jsx'], + //explore: ['babel-polyfill', APP_DIR + '/javascripts/explore/explore.jsx'], explorev2: ['babel-polyfill', APP_DIR + '/javascripts/explorev2/index.jsx'], - sqllab: ['babel-polyfill', APP_DIR + '/javascripts/SqlLab/index.jsx'], - standalone: ['babel-polyfill', APP_DIR + '/javascripts/standalone.js'], - welcome: ['babel-polyfill', APP_DIR + '/javascripts/welcome.js'], - profile: ['babel-polyfill', APP_DIR + '/javascripts/profile/index.jsx'], + //sqllab: ['babel-polyfill', APP_DIR + '/javascripts/SqlLab/index.jsx'], + //standalone: ['babel-polyfill', APP_DIR + '/javascripts/standalone.js'], + //welcome: ['babel-polyfill', APP_DIR + '/javascripts/welcome.js'], + //profile: ['babel-polyfill', APP_DIR + '/javascripts/profile/index.jsx'], }, output: { path: BUILD_DIR, diff --git a/superset/viz.py b/superset/viz.py index 611555997d2..20d0d091e06 100755 --- a/superset/viz.py +++ b/superset/viz.py @@ -357,10 +357,7 @@ class BaseViz(object): if not payload: is_cached = False cache_timeout = self.cache_timeout - try: - data = self.get_data() - except Exception as e: - data = None + data = self.get_data() payload = { 'cache_key': cache_key,