From 5fd0e7d02828df4bb02b6a3b34779517fe637123 Mon Sep 17 00:00:00 2001 From: Justin Park Date: Mon, 1 May 2017 08:59:02 -0700 Subject: [PATCH 1/4] [vis] bar values should match y axis format (#2701) It passes the user yAxis format value to the totalValue function to render the label text accordingly --- superset/assets/visualizations/nvd3_vis.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js index 6bc45e401992d..aa49d437f560b 100644 --- a/superset/assets/visualizations/nvd3_vis.js +++ b/superset/assets/visualizations/nvd3_vis.js @@ -23,8 +23,8 @@ const BREAKPOINTS = { small: 340, }; -const addTotalBarValues = function (svg, chart, data, stacked) { - const format = d3.format('.3s'); +const addTotalBarValues = function (svg, chart, data, stacked, axisFormat) { + const format = d3.format(axisFormat || '.3s'); const countSeriesDisplayed = data.length; const totalStackedValues = stacked && data.length !== 0 ? @@ -169,7 +169,7 @@ function nvd3Vis(slice, payload) { if (fd.show_bar_value) { setTimeout(function () { - addTotalBarValues(svg, chart, payload.data, stacked); + addTotalBarValues(svg, chart, payload.data, stacked, fd.y_axis_format); }, animationTime); } break; @@ -199,7 +199,7 @@ function nvd3Vis(slice, payload) { } if (fd.show_bar_value) { setTimeout(function () { - addTotalBarValues(svg, chart, payload.data, stacked); + addTotalBarValues(svg, chart, payload.data, stacked, fd.y_axis_format); }, animationTime); } if (!reduceXTicks) { From 2d5beb1f91c304df948e943100cbfb66345a00e9 Mon Sep 17 00:00:00 2001 From: Alanna Scott Date: Mon, 1 May 2017 08:59:44 -0700 Subject: [PATCH 2/4] improve csrf expiration error handling (#2695) * add message * re run query on result set mount if there is session time out error --- superset/assets/javascripts/SqlLab/actions.js | 3 +++ .../javascripts/SqlLab/components/ResultSet.jsx | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/superset/assets/javascripts/SqlLab/actions.js b/superset/assets/javascripts/SqlLab/actions.js index 2e60a4c8ba81b..0effacefcf1a5 100644 --- a/superset/assets/javascripts/SqlLab/actions.js +++ b/superset/assets/javascripts/SqlLab/actions.js @@ -151,6 +151,9 @@ export function runQuery(query) { } else if (msg === null) { msg = `[${textStatus}] ${errorThrown}`; } + if (msg.indexOf('The CSRF token is missing') > 0) { + msg = 'Your session timed out, please refresh your page and try again.'; + } dispatch(queryFailed(query, msg)); }, }); diff --git a/superset/assets/javascripts/SqlLab/components/ResultSet.jsx b/superset/assets/javascripts/SqlLab/components/ResultSet.jsx index f6661823fcc69..bee97d61a27e9 100644 --- a/superset/assets/javascripts/SqlLab/components/ResultSet.jsx +++ b/superset/assets/javascripts/SqlLab/components/ResultSet.jsx @@ -38,6 +38,10 @@ export default class ResultSet extends React.PureComponent { height: props.search ? props.height - RESULT_SET_CONTROLS_HEIGHT : props.height, }; } + componentDidMount() { + // only do this the first time the component is rendered/mounted + this.reRunQueryIfSessionTimeoutErrorOnMount(); + } componentWillReceiveProps(nextProps) { // when new results comes in, save them locally and clear in store if (this.props.cache && (!nextProps.query.cached) @@ -53,7 +57,6 @@ export default class ResultSet extends React.PureComponent { this.fetchResults(nextProps.query); } } - getControls() { if (this.props.search || this.props.visualize || this.props.csv) { let csvButton; @@ -132,7 +135,12 @@ export default class ResultSet extends React.PureComponent { reFetchQueryResults(query) { this.props.actions.reFetchQueryResults(query); } - + reRunQueryIfSessionTimeoutErrorOnMount() { + const { query } = this.props; + if (query.errorMessage && query.errorMessage.indexOf('session timed out') > 0) { + this.props.actions.runQuery(query, true); + } + } render() { const query = this.props.query; const results = query.results; From 33758bfff59b9cdc86b58973244ef0613942dc80 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 1 May 2017 09:00:48 -0700 Subject: [PATCH 3/4] 0.17.6-alpha.2 --- superset/assets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/package.json b/superset/assets/package.json index 56b0738faf309..16951e7406517 100644 --- a/superset/assets/package.json +++ b/superset/assets/package.json @@ -1,6 +1,6 @@ { "name": "superset", - "version": "0.17.6-alpha.1", + "version": "0.17.6-alpha.2", "description": "Superset is a data exploration platform designed to be visual, intuitive, and interactive.", "license": "Apache-2.0", "directories": { From 1887b5e934b17864850a46d6e88a606b594e0634 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 1 May 2017 13:13:06 -0700 Subject: [PATCH 4/4] 0.17.6 --- superset/assets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/package.json b/superset/assets/package.json index 16951e7406517..d586fe8c075fe 100644 --- a/superset/assets/package.json +++ b/superset/assets/package.json @@ -1,6 +1,6 @@ { "name": "superset", - "version": "0.17.6-alpha.2", + "version": "0.17.6", "description": "Superset is a data exploration platform designed to be visual, intuitive, and interactive.", "license": "Apache-2.0", "directories": {