[incubator-superset] branch master updated: Use react-alert for backend message flashing (#3315)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new 59268e9  Use react-alert for backend message flashing (#3315)
59268e9 is described below

commit 59268e978aa2753166371f790fa648ddaa398f52
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 23:00:23 2017 -0700

Use react-alert for backend message flashing (#3315)
---
 .../assets/javascripts/SqlLab/components/App.jsx |  4 +++-
 .../assets/javascripts/components/AlertsWrapper.jsx  | 20 
 superset/assets/javascripts/dashboard/Dashboard.jsx  |  8 ++--
 superset/assets/javascripts/explore/index.jsx|  3 +--
 superset/templates/superset/basic.html   |  1 -
 superset/templates/superset/dashboard.html   |  2 --
 superset/views/base.py   | 12 +++-
 superset/views/core.py   |  6 +-
 8 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/superset/assets/javascripts/SqlLab/components/App.jsx 
b/superset/assets/javascripts/SqlLab/components/App.jsx
index 2a6eb41..2d45281 100644
--- a/superset/assets/javascripts/SqlLab/components/App.jsx
+++ b/superset/assets/javascripts/SqlLab/components/App.jsx
@@ -70,7 +70,7 @@ class App extends React.PureComponent {
 }
 return (
   
-
+
 
   {content}
 
@@ -82,11 +82,13 @@ class App extends React.PureComponent {
 App.propTypes = {
   alerts: PropTypes.array,
   actions: PropTypes.object,
+  initMessages: PropTypes.array,
 };
 
 function mapStateToProps(state) {
   return {
 alerts: state.alerts,
+initMessages: state.flash_messages,
   };
 }
 function mapDispatchToProps(dispatch) {
diff --git a/superset/assets/javascripts/components/AlertsWrapper.jsx 
b/superset/assets/javascripts/components/AlertsWrapper.jsx
index bb3c2d6..672c56d 100644
--- a/superset/assets/javascripts/components/AlertsWrapper.jsx
+++ b/superset/assets/javascripts/components/AlertsWrapper.jsx
@@ -1,7 +1,25 @@
+/* global notify */
 import React from 'react';
 import AlertContainer from 'react-alert';
+import PropTypes from 'prop-types';
+
+const propTypes = {
+  initMessages: PropTypes.array,
+};
+const defaultProps = {
+  initMessages: [],
+};
 
 export default class AlertsWrapper extends React.PureComponent {
+  componentDidMount() {
+this.props.initMessages.forEach((msg) => {
+  if (['info', 'error', 'success'].indexOf(msg[0]) >= 0) {
+notify[msg[0]](msg[1]);
+  } else {
+notify.show(msg[1]);
+  }
+});
+  }
   render() {
 return (
   );
   }
 }
+AlertsWrapper.propTypes = propTypes;
+AlertsWrapper.defaultProps = defaultProps;
diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx 
b/superset/assets/javascripts/dashboard/Dashboard.jsx
index 283475a..7cc7699 100644
--- a/superset/assets/javascripts/dashboard/Dashboard.jsx
+++ b/superset/assets/javascripts/dashboard/Dashboard.jsx
@@ -18,7 +18,11 @@ const utils = require('../modules/utils');
 appSetup();
 
 export function getInitialState(boostrapData) {
-  const dashboard = Object.assign({}, utils.controllerInterface, 
boostrapData.dashboard_data);
+  const dashboard = Object.assign(
+{},
+utils.controllerInterface,
+boostrapData.dashboard_data,
+{ common: boostrapData.common });
   dashboard.firstLoad = true;
 
   dashboard.posDict = {};
@@ -62,7 +66,7 @@ function renderAlert() {
 function initDashboardView(dashboard) {
   render(
 
-  
+  
   
 ,
 document.getElementById('dashboard-header'),
diff --git a/superset/assets/javascripts/explore/index.jsx 
b/superset/assets/javascripts/explore/index.jsx
index 525f2c4..501002a 100644
--- a/superset/assets/javascripts/explore/index.jsx
+++ b/superset/assets/javascripts/explore/index.jsx
@@ -56,12 +56,11 @@ const initState = {
 const store = createStore(rootReducer, initState,
   compose(applyMiddleware(thunk), initEnhancer(false)),
 );
-
 ReactDOM.render(
   
 
   
-  
+  
 
   ,
   exploreViewContainer,
diff --git a/superset/templates/superset/basic.html 
b/superset/templates/superset/basic.html
index 87b058d..ea7f5b1 100644
--- a/superset/templates/superset/basic.html
+++ b/superset/templates/superset/basic.html
@@ -41,7 +41,6 @@
 {% endblock %}
 
 {% block body %}
-  {% include 'superset/flash_wrapper.html' %}
   
 
   
diff --git a/superset/templates/superset/dashboard.html 
b/superset/templates/superset/dashboard.html
index e297e51..d3e81f2 100644
--- a/superset/templates/superset/dashboard.html
+++ b/superset/templates/superset/dashboard.html
@@ -5,8 +5,6 @@
   class="dashboard container-fluid"
   data-bootstrap="{{ bootstrap_data }}"
 >
-  {% include 'superset/flash_wrapper.html' %}
-
   
 
   
diff --git a/superset/

[incubator-superset] branch master updated: Allow for multiple color schemes (#3295)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new b9a2fa4  Allow for multiple color schemes (#3295)
b9a2fa4 is described below

commit b9a2fa4015d3df9b8e0e066d20b9e75bc65a7a51
Author: Grace Guo 
AuthorDate: Wed Aug 16 22:20:11 2017 -0700

Allow for multiple color schemes (#3295)

* Allow for multiple color schemes

1. create ColorSchemeControl component
2. using the same new control component for linear colors

* add color spectum for linear color scheme

* remove dup css

* fix controls setting for linear color scheme

* minor fix by code review comment
---
 .../javascripts/explore/components/Control.jsx |  2 +
 .../components/controls/ColorSchemeControl.jsx | 87 ++
 superset/assets/javascripts/explore/main.css   | 13 
 .../assets/javascripts/explore/stores/controls.jsx | 16 +++-
 .../assets/javascripts/explore/stores/visTypes.js  | 21 ++
 superset/assets/javascripts/modules/colors.js  | 65 ++--
 .../spec/javascripts/modules/colors_spec.jsx   | 22 ++
 superset/assets/visualizations/chord.jsx   |  6 +-
 superset/assets/visualizations/histogram.js|  4 +-
 superset/assets/visualizations/nvd3_vis.js |  4 +-
 superset/assets/visualizations/sankey.js   |  4 +-
 superset/assets/visualizations/sunburst.js | 14 +++-
 superset/assets/visualizations/treemap.js  |  4 +-
 superset/assets/visualizations/word_cloud.js   |  4 +-
 14 files changed, 241 insertions(+), 25 deletions(-)

diff --git a/superset/assets/javascripts/explore/components/Control.jsx 
b/superset/assets/javascripts/explore/components/Control.jsx
index b0dce35..6022b9f 100644
--- a/superset/assets/javascripts/explore/components/Control.jsx
+++ b/superset/assets/javascripts/explore/components/Control.jsx
@@ -10,6 +10,7 @@ import SelectControl from './controls/SelectControl';
 import TextAreaControl from './controls/TextAreaControl';
 import TextControl from './controls/TextControl';
 import VizTypeControl from './controls/VizTypeControl';
+import ColorSchemeControl from './controls/ColorSchemeControl';
 
 const controlMap = {
   BoundsControl,
@@ -21,6 +22,7 @@ const controlMap = {
   TextAreaControl,
   TextControl,
   VizTypeControl,
+  ColorSchemeControl,
 };
 const controlTypes = Object.keys(controlMap);
 
diff --git 
a/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx
 
b/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx
new file mode 100644
index 000..db51792
--- /dev/null
+++ 
b/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx
@@ -0,0 +1,87 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { Creatable } from 'react-select';
+import ControlHeader from '../ControlHeader';
+
+import { colorScalerFactory } from '../../../modules/colors';
+
+const propTypes = {
+  description: PropTypes.string,
+  label: PropTypes.string.isRequired,
+  name: PropTypes.string.isRequired,
+  onChange: PropTypes.func,
+  value: PropTypes.string,
+  default: PropTypes.string,
+  choices: PropTypes.arrayOf(React.PropTypes.array).isRequired,
+  schemes: PropTypes.object.isRequired,
+  isLinear: PropTypes.bool,
+};
+
+const defaultProps = {
+  choices: [],
+  schemes: {},
+  onChange: () => {},
+};
+
+export default class ColorSchemeControl extends React.PureComponent {
+  constructor(props) {
+super(props);
+this.state = {
+  scheme: this.props.value,
+};
+
+this.onChange = this.onChange.bind(this);
+this.renderOption = this.renderOption.bind(this);
+  }
+
+  onChange(option) {
+const optionValue = option ? option.value : null;
+this.props.onChange(optionValue);
+this.setState({ scheme: optionValue });
+  }
+
+  renderOption(key) {
+const currentScheme = key.value ?
+  this.props.schemes[key.value] :
+  this.props.schemes[defaultProps.value];
+
+let colors = currentScheme;
+if (this.props.isLinear) {
+  const colorScaler = colorScalerFactory(currentScheme);
+  colors = [...Array(20).keys()].map(d => (colorScaler(d / 20)));
+}
+
+const list = colors.map((color, i) => (
+   
+));
+return ({list});
+  }
+
+  render() {
+const selectProps = {
+  multi: false,
+  name: `select-${this.props.name}`,
+  placeholder: `Select (${this.props.choices.length})`,
+  default: this.props.default,
+  options: this.props.choices.map(choice => ({ value: choice[0], label: 
choice[1] })),
+  value: this.props.value,
+  autosize: false,
+  clearable: false,
+  onChange: this.onChange,
+  optionRenderer: this.renderOption,
+  valueRenderer: this.renderOption,
+}

[incubator-superset] branch master updated: French translation (#3313)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new 3c8577b  French translation (#3313)
3c8577b is described below

commit 3c8577b853dab2417dafe3c1971c0daa2dc5fee7
Author: Invenis 
AuthorDate: Thu Aug 17 05:29:18 2017 +0200

French translation (#3313)
---
 babel/messages.pot   |  845 ++---
 superset/translations/fr/LC_MESSAGES/messages.mo |  Bin 16500 -> 24674 bytes
 superset/translations/fr/LC_MESSAGES/messages.po | 2123 +-
 3 files changed, 1473 insertions(+), 1495 deletions(-)

diff --git a/babel/messages.pot b/babel/messages.pot
index 198b467..5ebccd2 100755
--- a/babel/messages.pot
+++ b/babel/messages.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2017-06-19 23:49+0800\n"
+"POT-Creation-Date: 2017-08-17 03:23+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME \n"
 "Language-Team: LANGUAGE \n"
@@ -17,342 +17,526 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.4.0\n"
 
-#: superset/db_engine_specs.py:194 superset/db_engine_specs.py:225
-#: superset/db_engine_specs.py:269 superset/db_engine_specs.py:317
-#: superset/db_engine_specs.py:362 superset/db_engine_specs.py:770
-#: superset/db_engine_specs.py:806 superset/db_engine_specs.py:838
-#: superset/db_engine_specs.py:884
+#: superset/db_engine_specs.py:192 superset/db_engine_specs.py:223
+#: superset/db_engine_specs.py:267 superset/db_engine_specs.py:315
+#: superset/db_engine_specs.py:360 superset/db_engine_specs.py:810
+#: superset/db_engine_specs.py:846 superset/db_engine_specs.py:878
+#: superset/db_engine_specs.py:924 superset/db_engine_specs.py:961
+#: superset/db_engine_specs.py:987
 msgid "Time Column"
 msgstr ""
 
-#: superset/db_engine_specs.py:195 superset/db_engine_specs.py:226
-#: superset/db_engine_specs.py:318 superset/db_engine_specs.py:363
-#: superset/db_engine_specs.py:771 superset/db_engine_specs.py:839
+#: superset/db_engine_specs.py:193 superset/db_engine_specs.py:224
+#: superset/db_engine_specs.py:316 superset/db_engine_specs.py:361
+#: superset/db_engine_specs.py:811 superset/db_engine_specs.py:879
+#: superset/db_engine_specs.py:962
 msgid "second"
 msgstr ""
 
-#: superset/db_engine_specs.py:196 superset/db_engine_specs.py:229
-#: superset/db_engine_specs.py:321 superset/db_engine_specs.py:365
-#: superset/db_engine_specs.py:773 superset/db_engine_specs.py:807
-#: superset/db_engine_specs.py:841 superset/db_engine_specs.py:885
+#: superset/db_engine_specs.py:194 superset/db_engine_specs.py:227
+#: superset/db_engine_specs.py:319 superset/db_engine_specs.py:363
+#: superset/db_engine_specs.py:813 superset/db_engine_specs.py:847
+#: superset/db_engine_specs.py:881 superset/db_engine_specs.py:925
+#: superset/db_engine_specs.py:963 superset/db_engine_specs.py:988
 msgid "minute"
 msgstr ""
 
-#: superset/db_engine_specs.py:197 superset/db_engine_specs.py:233
-#: superset/db_engine_specs.py:323 superset/db_engine_specs.py:367
-#: superset/db_engine_specs.py:779 superset/db_engine_specs.py:809
-#: superset/db_engine_specs.py:843 superset/db_engine_specs.py:891
+#: superset/db_engine_specs.py:195 superset/db_engine_specs.py:231
+#: superset/db_engine_specs.py:321 superset/db_engine_specs.py:365
+#: superset/db_engine_specs.py:819 superset/db_engine_specs.py:849
+#: superset/db_engine_specs.py:883 superset/db_engine_specs.py:931
+#: superset/db_engine_specs.py:964 superset/db_engine_specs.py:989
 msgid "hour"
 msgstr ""
 
-#: superset/db_engine_specs.py:198 superset/db_engine_specs.py:238
-#: superset/db_engine_specs.py:270 superset/db_engine_specs.py:325
-#: superset/db_engine_specs.py:369 superset/db_engine_specs.py:781
-#: superset/db_engine_specs.py:811 superset/db_engine_specs.py:845
-#: superset/db_engine_specs.py:893
+#: superset/db_engine_specs.py:196 superset/db_engine_specs.py:236
+#: superset/db_engine_specs.py:268 superset/db_engine_specs.py:323
+#: superset/db_engine_specs.py:367 superset/db_engine_specs.py:821
+#: superset/db_engine_specs.py:851 superset/db_engine_specs.py:885
+#: superset/db_engine_specs.py:933 superset/db_engine_specs.py:965
+#: superset/db_engine_specs.py:990
 msgid "day"
 msgstr ""
 
-#: superset/db_engine_specs.py:199 superset/db_engine_specs.py:244
-#: superset/db_engine_specs.py:271 superset/db_engine_specs.py:326
-#: superset/db_engine_specs.py:371 superset/db_engine_specs.py:783
-#: superset/db_engine_specs.py:813 superset/db_engine_specs.py:847
+#: superset/db_engine_specs.py:197 superset/db_engine_specs.py:242
+#: superset/db_engine_specs.py:269 superset/db_engine_specs.py:324
+#: superset/db_engine_specs.py:369 superset/db_engine_specs.py:823
+#: superset/db_engine_spe

[incubator-superset] branch master updated: [sql lab] run button shortcut tooltip (#3310)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new c4e0569  [sql lab] run button shortcut tooltip (#3310)
c4e0569 is described below

commit c4e056929d0cb09bceb91c13a109e96868c81074
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 17:39:48 2017 -0700

[sql lab] run button shortcut tooltip (#3310)
---
 .../assets/javascripts/SqlLab/components/RunQueryActionButton.jsx| 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/superset/assets/javascripts/SqlLab/components/RunQueryActionButton.jsx 
b/superset/assets/javascripts/SqlLab/components/RunQueryActionButton.jsx
index 36b4702..0b0febc 100644
--- a/superset/assets/javascripts/SqlLab/components/RunQueryActionButton.jsx
+++ b/superset/assets/javascripts/SqlLab/components/RunQueryActionButton.jsx
@@ -18,7 +18,7 @@ export default function RunQueryActionButton(props) {
   const runBtnText = props.selectedText ? 'Run Selected Query' : 'Run Query';
   const btnStyle = props.selectedText ? 'warning' : 'primary';
   const shouldShowStopBtn = ['running', 'pending'].indexOf(props.queryState) > 
-1;
-  const asyncToolTip = 'Run query asynchronously';
+  const tooltip = 'shortcut: [alt+enter]';
 
   const commonBtnProps = {
 bsSize: 'small',
@@ -31,6 +31,7 @@ export default function RunQueryActionButton(props) {
   {...commonBtnProps}
   onClick={() => props.runQuery(false)}
   key="run-btn"
+  tooltip={tooltip}
 >
{runBtnText}
 
@@ -41,7 +42,7 @@ export default function RunQueryActionButton(props) {
   {...commonBtnProps}
   onClick={() => props.runQuery(true)}
   key="run-async-btn"
-  tooltip={asyncToolTip}
+  tooltip={tooltip}
 >
{runBtnText}
 

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].


[incubator-superset] branch master updated: [hive] improve error messages (#3305)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new 0aa3d2a  [hive] improve error messages (#3305)
0aa3d2a is described below

commit 0aa3d2a81853eb362ae84dfc6acd7fa309de4173
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 17:40:28 2017 -0700

[hive] improve error messages (#3305)

* [hive] improve error messages

* Addressing comments
---
 superset/db_engine_specs.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 5f67ec6..0fe9889 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -682,6 +682,14 @@ class HiveEngineSpec(PrestoEngineSpec):
 return uri
 
 @classmethod
+def extract_error_message(cls, e):
+try:
+msg = e.message.status.errorMessage
+except:
+msg = str(e)
+return msg
+
+@classmethod
 def progress(cls, log_lines):
 total_jobs = 1  # assuming there's at least 1 job
 current_job = 1

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].


[incubator-superset] branch master updated: Fix styles in Separator widget (#3309)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new fbd0d46  Fix styles in Separator widget (#3309)
fbd0d46 is described below

commit fbd0d46e8ab8e2928a5e5971679c3a2def98ed87
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 17:40:06 2017 -0700

Fix styles in Separator widget (#3309)

Style wasn't working right for separator widget since the iframe sandboxing 
of
the markup widget. This addresses this small issue and also now allows
for html in the separator widget
---
 superset/assets/javascripts/explore/stores/visTypes.js | 1 +
 superset/viz.py| 4 
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/superset/assets/javascripts/explore/stores/visTypes.js 
b/superset/assets/javascripts/explore/stores/visTypes.js
index e937b03..7e04237 100644
--- a/superset/assets/javascripts/explore/stores/visTypes.js
+++ b/superset/assets/javascripts/explore/stores/visTypes.js
@@ -358,6 +358,7 @@ export const visTypes = {
   {
 label: null,
 controlSetRows: [
+  ['markup_type'],
   ['code'],
 ],
   },
diff --git a/superset/viz.py b/superset/viz.py
index 100d8bb..98f2d1b 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -449,10 +449,6 @@ class SeparatorViz(MarkupViz):
 viz_type = "separator"
 verbose_name = _("Separator")
 
-def get_data(self, df):
-code = markdown(self.form_data.get("code", ''))
-return dict(html=code)
-
 
 class WordCloudViz(BaseViz):
 

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].


[incubator-superset] branch master updated: [bugfix] Presto KeyError 'errorLocation' (#3291)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new 84e59a1  [bugfix] Presto KeyError 'errorLocation' (#3291)
84e59a1 is described below

commit 84e59a11f160380134b8b14c2388514380e02f47
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 13:25:09 2017 -0700

[bugfix] Presto KeyError 'errorLocation' (#3291)
---
 superset/db_engine_specs.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 0b804b3..5f67ec6 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -497,9 +497,9 @@ class PrestoEngineSpec(BaseEngineSpec):
 isinstance(e.orig[0], dict)):
 error_dict = e.orig[0]
 return '{} at {}: {}'.format(
-error_dict['errorName'],
-error_dict['errorLocation'],
-error_dict['message']
+error_dict.get('errorName'),
+error_dict.get('errorLocation'),
+error_dict.get('message'),
 )
 return utils.error_msg_from_exception(e)
 

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].


[incubator-superset] branch master updated: [sql lab] add pending to the list of searchable statuses (#3292)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new 9fcd5d6  [sql lab] add pending to the list of searchable statuses 
(#3292)
9fcd5d6 is described below

commit 9fcd5d67e44c3ddbae2c1cbe4cd93b81023c655f
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 13:24:43 2017 -0700

[sql lab] add pending to the list of searchable statuses (#3292)
---
 superset/assets/javascripts/SqlLab/constants.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset/assets/javascripts/SqlLab/constants.js 
b/superset/assets/javascripts/SqlLab/constants.js
index 2a93275..6d67806 100644
--- a/superset/assets/javascripts/SqlLab/constants.js
+++ b/superset/assets/javascripts/SqlLab/constants.js
@@ -11,6 +11,7 @@ export const STATUS_OPTIONS = [
   'success',
   'failed',
   'running',
+  'pending',
 ];
 
 export const TIME_OPTIONS = [

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].


[incubator-superset] branch master updated: [mapbox] fix viewport alterations (#3293)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new ccf505a  [mapbox] fix viewport alterations (#3293)
ccf505a is described below

commit ccf505a4805203684e7416d2d9789f6f54f2f9ad
Author: Maxime Beauchemin 
AuthorDate: Wed Aug 16 11:23:01 2017 -0700

[mapbox] fix viewport alterations (#3293)

* [mapbox] fix viewport alterations

Since explorev2 it appears that altering the viewport hasn't been
changing the controls as it used to. This PR addresses it.

* lint
---
 .../explore/components/ChartContainer.jsx|  3 ++-
 .../explore/components/controls/TextControl.jsx  |  6 ++
 superset/assets/visualizations/mapbox.jsx| 20 ++--
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/superset/assets/javascripts/explore/components/ChartContainer.jsx 
b/superset/assets/javascripts/explore/components/ChartContainer.jsx
index 3243f32..d5b4545 100644
--- a/superset/assets/javascripts/explore/components/ChartContainer.jsx
+++ b/superset/assets/javascripts/explore/components/ChartContainer.jsx
@@ -178,7 +178,8 @@ class ChartContainer extends React.PureComponent {
 const mockSlice = this.getMockedSliceObject();
 this.setState({ mockSlice });
 try {
-  visMap[this.props.viz_type](mockSlice, this.props.queryResponse);
+  const viz = visMap[this.props.viz_type];
+  viz(mockSlice, this.props.queryResponse, 
this.props.actions.setControlValue);
 } catch (e) {
   this.props.actions.chartRenderingFailed(e);
 }
diff --git 
a/superset/assets/javascripts/explore/components/controls/TextControl.jsx 
b/superset/assets/javascripts/explore/components/controls/TextControl.jsx
index c3f7aa5..4fe558e 100644
--- a/superset/assets/javascripts/explore/components/controls/TextControl.jsx
+++ b/superset/assets/javascripts/explore/components/controls/TextControl.jsx
@@ -29,13 +29,10 @@ const defaultProps = {
 export default class TextControl extends React.Component {
   constructor(props) {
 super(props);
-const value = props.value ? props.value.toString() : '';
-this.state = { value };
 this.onChange = this.onChange.bind(this);
   }
   onChange(event) {
 let value = event.target.value || '';
-this.setState({ value });
 
 // Validation & casting
 const errors = [];
@@ -58,6 +55,7 @@ export default class TextControl extends React.Component {
 this.props.onChange(value, errors);
   }
   render() {
+const value = this.props.value ? this.props.value.toString() : '';
 return (
   
 
@@ -66,7 +64,7 @@ export default class TextControl extends React.Component {
 type="text"
 placeholder=""
 onChange={this.onChange}
-value={this.state.value}
+value={value}
   />
 
   
diff --git a/superset/assets/visualizations/mapbox.jsx 
b/superset/assets/visualizations/mapbox.jsx
index 9a86853..c01ad28 100644
--- a/superset/assets/visualizations/mapbox.jsx
+++ b/superset/assets/visualizations/mapbox.jsx
@@ -8,6 +8,7 @@ import ScatterPlotOverlay from 
'react-map-gl/dist/overlays/scatterplot.react';
 import Immutable from 'immutable';
 import supercluster from 'supercluster';
 import ViewportMercator from 'viewport-mercator-project';
+
 import {
   kmToPixels,
   rgbLuminance,
@@ -17,8 +18,9 @@ import {
   DEFAULT_LATITUDE,
   DEFAULT_ZOOM,
 } from '../utils/common';
+import './mapbox.css';
 
-require('./mapbox.css');
+const NOOP = () => {};
 
 class ScatterPlotGlowOverlay extends ScatterPlotOverlay {
   drawText(ctx, pixel, options = {}) {
@@ -201,9 +203,10 @@ class MapboxViz extends React.Component {
   }
 
   onChangeViewport(viewport) {
-this.setState({
-  viewport,
-});
+this.setState({ viewport });
+this.props.setControlValue('viewport_longitude', viewport.longitude);
+this.props.setControlValue('viewport_latitude', viewport.latitude);
+this.props.setControlValue('viewport_zoom', viewport.zoom);
   }
 
   render() {
@@ -220,11 +223,6 @@ class MapboxViz extends React.Component {
 const clusters = this.props.clusterer.getClusters(bbox, 
Math.round(this.state.viewport.zoom));
 const isDragging = this.state.viewport.isDragging === undefined ? false :
this.state.viewport.isDragging;
-
-d3.select('#viewport_longitude').attr('value', 
this.state.viewport.longitude);
-d3.select('#viewport_latitude').attr('value', 
this.state.viewport.latitude);
-d3.select('#viewport_zoom').attr('value', this.state.viewport.zoom);
-
 return (
   ,
 div.node(),
   );

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].


[incubator-superset] branch master updated: Fix raise error when query datasource (#3298)

2017-08-16 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
 new d1d1c49  Fix raise error when query datasource (#3298)
d1d1c49 is described below

commit d1d1c490094ed3ba08dcef687e9132d3b531581e
Author: Rogan 
AuthorDate: Thu Aug 17 01:18:43 2017 +0800

Fix raise error when query datasource (#3298)

* Catching the 'NoResultFound' exception when the datasource does't exist

* change one() to first()

* revert modify

* remove import
---
 superset/views/core.py | 28 +++-
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index 2088ebd..85aa460 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1039,12 +1039,8 @@ class Superset(BaseSupersetView):
 slc = db.session.query(models.Slice).filter_by(id=slice_id).first()
 
 error_redirect = '/slicemodelview/list/'
-datasource = (
-db.session.query(ConnectorRegistry.sources[datasource_type])
-.filter_by(id=datasource_id)
-.one()
-)
-
+datasource = ConnectorRegistry.get_datasource(
+datasource_type, datasource_id, db.session)
 if not datasource:
 flash(DATASOURCE_MISSING_ERR, "danger")
 return redirect(error_redirect)
@@ -1119,13 +1115,8 @@ class Superset(BaseSupersetView):
 :return:
 """
 # TODO: Cache endpoint by user, datasource and column
-datasource_class = ConnectorRegistry.sources[datasource_type]
-datasource = (
-db.session.query(datasource_class)
-.filter_by(id=datasource_id)
-.first()
-)
-
+datasource = ConnectorRegistry.get_datasource(
+datasource_type, datasource_id, db.session)
 if not datasource:
 return json_error_response(DATASOURCE_MISSING_ERR)
 if not self.datasource_access(datasource):
@@ -2000,7 +1991,7 @@ class Superset(BaseSupersetView):
 schema = request.form.get('schema') or None
 
 session = db.session()
-mydb = session.query(models.Database).filter_by(id=database_id).one()
+mydb = session.query(models.Database).filter_by(id=database_id).first()
 
 if not mydb:
 json_error_response(
@@ -2138,13 +2129,8 @@ class Superset(BaseSupersetView):
 def fetch_datasource_metadata(self):
 datasource_id, datasource_type = (
 request.args.get('datasourceKey').split('__'))
-datasource_class = ConnectorRegistry.sources[datasource_type]
-datasource = (
-db.session.query(datasource_class)
-.filter_by(id=int(datasource_id))
-.first()
-)
-
+datasource = ConnectorRegistry.get_datasource(
+datasource_type, datasource_id, db.session)
 # Check if datasource exists
 if not datasource:
 return json_error_response(DATASOURCE_MISSING_ERR)

-- 
To stop receiving notification emails like this one, please contact
['"comm...@superset.apache.org" '].