[incubator-superset] branch master updated: Add lyftColor to the game  (#4682)

2018-03-23 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 9abc5c7  Add lyftColor to the game  (#4682)
9abc5c7 is described below

commit 9abc5c724ff878ca92edce3e074ce6a4d9ea60b9
Author: Hugh A. Miles II 
AuthorDate: Fri Mar 23 18:02:29 2018 -0700

Add lyftColor to the game  (#4682)

* add lyftColor to the game 

* fix json
---
 superset/assets/backendSync.json  | 4 
 superset/assets/javascripts/modules/colors.js | 8 
 2 files changed, 12 insertions(+)

diff --git a/superset/assets/backendSync.json b/superset/assets/backendSync.json
index 9e1ce4c..9145cc9 100644
--- a/superset/assets/backendSync.json
+++ b/superset/assets/backendSync.json
@@ -2747,6 +2747,10 @@
 [
   "googleCategory20c",
   "googleCategory20c"
+],
+[
+  "lyftColors",
+  "lyftColors"
 ]
   ],
   "description": "The color scheme for rendering chart",
diff --git a/superset/assets/javascripts/modules/colors.js 
b/superset/assets/javascripts/modules/colors.js
index f2bba3b..909a8bf 100644
--- a/superset/assets/javascripts/modules/colors.js
+++ b/superset/assets/javascripts/modules/colors.js
@@ -27,6 +27,14 @@ export const bnbColors = [
   '#b37e00',
   '#988b4e',
 ];
+
+export const lyftColors = [
+  '#ff00bf', // pink
+  '#352384', // purple
+  '#333447', // carbon
+  '#f3f3f5', // silver
+];
+
 const d3Category10 = d3.scale.category10().range();
 const d3Category20 = d3.scale.category20().range();
 const d3Category20b = d3.scale.category20b().range();

-- 
To stop receiving notification emails like this one, please contact
maximebeauche...@apache.org.


[incubator-superset] branch master updated: add yarn lock info to contributing.md (#4679)

2018-03-23 Thread johnbodley
This is an automated email from the ASF dual-hosted git repository.

johnbodley 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 00cab7e  add yarn lock info to contributing.md (#4679)
00cab7e is described below

commit 00cab7e1073ba8d810b5dd323cb6fdb706ced537
Author: timifasubaa <30888507+timifasu...@users.noreply.github.com>
AuthorDate: Fri Mar 23 15:31:47 2018 -0700

add yarn lock info to contributing.md (#4679)
---
 CONTRIBUTING.md | 4 
 1 file changed, 4 insertions(+)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b337dad..7f7ff50 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -259,6 +259,10 @@ superset runserver -d -p 8081
 npm run dev
 ```
 
+ Upgrading npm packages
+
+Should you add or upgrade a npm package, which involves changing 
`package.json`, you'll need to re-run `yarn install` and push the newly 
generated `yarn.lock` file so we get the reproducible build. More information 
at (https://yarnpkg.com/blog/2016/11/24/lockfiles-for-all/)
+
 ## Testing
 
 Before running python unit tests, please setup local testing environment:

-- 
To stop receiving notification emails like this one, please contact
johnbod...@apache.org.


[incubator-superset] branch master updated: forms: make csv import parse dates accepts a list of columns (#4639)

2018-03-23 Thread graceguo
This is an automated email from the ASF dual-hosted git repository.

graceguo 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 76394d3  forms: make csv import parse dates accepts a list of columns 
(#4639)
76394d3 is described below

commit 76394d3f8f711c2754dbfdd0c6cf7deb6d3ef122
Author: Riccardo Magliocchetti 
AuthorDate: Fri Mar 23 22:16:02 2018 +0100

forms: make csv import parse dates accepts a list of columns (#4639)

Instead of a boolean which has way less chances to work. While
at it add a proper label for the "con" field.

Fixes #4637
---
 superset/forms.py  | 36 +---
 superset/views/core.py |  1 -
 tests/form_tests.py| 28 
 3 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/superset/forms.py b/superset/forms.py
index eb8aba8..e846d57 100644
--- a/superset/forms.py
+++ b/superset/forms.py
@@ -10,7 +10,7 @@ from flask_appbuilder.forms import DynamicForm
 from flask_babel import lazy_gettext as _
 from flask_wtf.file import FileAllowed, FileField, FileRequired
 from wtforms import (
-BooleanField, IntegerField, SelectField, StringField)
+BooleanField, Field, IntegerField, SelectField, StringField)
 from wtforms.ext.sqlalchemy.fields import QuerySelectField
 from wtforms.validators import DataRequired, NumberRange, Optional
 
@@ -20,6 +20,32 @@ from superset.models import core as models
 config = app.config
 
 
+class CommaSeparatedListField(Field):
+widget = BS3TextFieldWidget()
+
+def _value(self):
+if self.data:
+return u', '.join(self.data)
+else:
+return u''
+
+def process_formdata(self, valuelist):
+if valuelist:
+self.data = [x.strip() for x in valuelist[0].split(',')]
+else:
+self.data = []
+
+
+def filter_not_empty_values(value):
+"""Returns a list of non empty values or None"""
+if not value:
+return None
+data = [x for x in value if x]
+if not data:
+return None
+return data
+
+
 class CsvToDatabaseForm(DynamicForm):
 # pylint: disable=E0211
 def all_db_items():
@@ -36,6 +62,7 @@ class CsvToDatabaseForm(DynamicForm):
 validators=[
 FileRequired(), FileAllowed(['csv'], _('CSV Files Only!'))])
 con = QuerySelectField(
+_('Database'),
 query_factory=all_db_items,
 get_pk=lambda a: a.id, get_label=lambda a: a.database_name)
 sep = StringField(
@@ -99,9 +126,12 @@ class CsvToDatabaseForm(DynamicForm):
 description=_(
 'Skip blank lines rather than interpreting them '
 'as NaN values.'))
-parse_dates = BooleanField(
+parse_dates = CommaSeparatedListField(
 _('Parse Dates'),
-description=_('Parse date values.'))
+description=_(
+'A comma separated list of columns that should be '
+'parsed as dates.'),
+filters=[filter_not_empty_values])
 infer_datetime_format = BooleanField(
 _('Infer Datetime Format'),
 description=_(
diff --git a/superset/views/core.py b/superset/views/core.py
index 723e8cc..a080a4b 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -339,7 +339,6 @@ class CsvToDatabaseView(SimpleFormView):
 form.mangle_dupe_cols.data = True
 form.skipinitialspace.data = False
 form.skip_blank_lines.data = True
-form.parse_dates.data = True
 form.infer_datetime_format.data = True
 form.decimal.data = '.'
 form.if_exists.data = 'append'
diff --git a/tests/form_tests.py b/tests/form_tests.py
new file mode 100644
index 000..82178a2
--- /dev/null
+++ b/tests/form_tests.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from tests.base_tests import SupersetTestCase
+from wtforms.form import Form
+
+from superset.forms import (
+CommaSeparatedListField, filter_not_empty_values)
+
+
+class FormTestCase(SupersetTestCase):
+
+def test_comma_separated_list_field(self):
+field = CommaSeparatedListField().bind(Form(), 'foo')
+field.process_formdata([u''])
+self.assertEqual(field.data, [u''])
+
+field.process_formdata(['a,comma,separated,list'])
+self.assertEqual(field.data, [u'a', u'comma', u'separated', u'list'])
+
+def test_filter_not_empty_values(self):
+self.assertEqual(filter_not_empty_values(None), None)
+self.assertEqual(filter_not_empty_values([]), None)
+self.assertEqual(filter_not_empty_values(['']), None)
+self.assertEqual(filter_not_empty_values(['hi']), ['hi'])

-- 
To stop receiving notification emails like 

[incubator-superset] branch master updated: Fix setup.py, comma makes download_url a tuple (#4676)

2018-03-23 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 b24a6fd  Fix setup.py, comma makes download_url a tuple (#4676)
b24a6fd is described below

commit b24a6fd4b56d9a89ac1ce507f6f545c509306ceb
Author: Maxime Beauchemin 
AuthorDate: Fri Mar 23 11:21:19 2018 -0700

Fix setup.py, comma makes download_url a tuple (#4676)
---
 setup.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index bdb0d5e..f8f785e 100644
--- a/setup.py
+++ b/setup.py
@@ -104,7 +104,8 @@ setup(
 author_email='maximebeauche...@gmail.com',
 url='https://github.com/apache/incubator-superset',
 download_url=(
-'https://github.com/apache/incubator-superset/tarball/' + 
version_string,
+'https://github.com'
+'/apache/incubator-superset/tarball/' + version_string
 ),
 classifiers=[
 'Programming Language :: Python :: 2.7',

-- 
To stop receiving notification emails like this one, please contact
maximebeauche...@apache.org.


[incubator-superset] branch dashboard-builder updated: [dashboard-builder] add top-level tabs + undo-redo (#4626)

2018-03-23 Thread ccwilliams
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/dashboard-builder by this push:
 new 1aebfd6  [dashboard-builder] add top-level tabs + undo-redo (#4626)
1aebfd6 is described below

commit 1aebfd6e6cff4be3b50bd3d9db0d807adc6608e5
Author: Chris Williams 
AuthorDate: Fri Mar 23 10:53:48 2018 -0700

[dashboard-builder] add top-level tabs + undo-redo (#4626)

* [top-level-tabs] initial working version of top-level tabs

* [top-level-tabs] simplify redux and disable ability to displace top-level 
tabs with other tabs

* [top-level-tabs] improve tab drag and drop css

* [undo-redo] add redux undo redo

* [dnd] clean up dropResult shape, add new component source id + type, use 
css for drop indicator instead of styles and fix tab indicators.

* [top-level-tabs] add 'Collapse tab content' to delete tabs button

* [dnd] add depth validation to drag and drop logic

* [dashboard-builder] add resize action, enforce minimum width of columns, 
column children inherit column size when necessary, meta.rowStyle => 
meta.background, add background to columns

* [dashboard-builder] make sure getChildWidth returns a number
---
 .../javascripts/components/EditableTitle.jsx   |   6 +-
 superset/assets/javascripts/dashboard/index.jsx|   8 +-
 .../javascripts/dashboard/v2/actions/index.js  | 113 +--
 .../dashboard/v2/components/Dashboard.jsx  |  21 +--
 .../dashboard/v2/components/DashboardBuilder.jsx   |  97 -
 .../dashboard/v2/components/DashboardGrid.jsx  |  64 +++-
 .../dashboard/v2/components/DashboardHeader.jsx|  71 +++--
 .../dashboard/v2/components/IconButton.jsx |  12 +-
 .../dashboard/v2/components/dnd/DragDroppable.jsx  |  41 --
 .../v2/components/dnd/dragDroppableConfig.js   |  11 +-
 .../dashboard/v2/components/dnd/handleDrop.js  |  20 ++-
 .../dashboard/v2/components/dnd/handleHover.js |  18 +--
 .../v2/components/gridComponents/Chart.jsx |   5 +-
 .../v2/components/gridComponents/Column.jsx| 132 -
 .../v2/components/gridComponents/Divider.jsx   |   3 +
 .../v2/components/gridComponents/Header.jsx|  23 +--
 .../dashboard/v2/components/gridComponents/Row.jsx |  27 ++--
 .../v2/components/gridComponents/Spacer.jsx|   9 +-
 .../dashboard/v2/components/gridComponents/Tab.jsx |  31 ++--
 .../v2/components/gridComponents/Tabs.jsx  |  61 +---
 .../gridComponents/new/DraggableNewComponent.jsx   |   5 +-
 ...yleDropdown.jsx => BackgroundStyleDropdown.jsx} |  12 +-
 .../v2/components/menu/WithPopoverMenu.jsx |  10 +-
 .../v2/components/resizable/ResizableContainer.jsx |  41 --
 .../{DashboardGrid.jsx => DashboardBuilder.jsx}|  12 +-
 .../dashboard/v2/containers/DashboardComponent.jsx |  33 +++--
 .../dashboard/v2/containers/DashboardGrid.jsx  |  12 +-
 .../dashboard/v2/containers/DashboardHeader.jsx|  31 
 .../dashboard/v2/fixtures/emptyDashboardLayout.js  |  36 +
 .../dashboard/v2/fixtures/testLayout.js| 161 -
 .../javascripts/dashboard/v2/reducers/dashboard.js | 146 +--
 .../javascripts/dashboard/v2/reducers/index.js |   9 +-
 .../dashboard/v2/stylesheets/builder.less  |  64 
 .../dashboard/v2/stylesheets/buttons.less  |   8 +-
 .../v2/stylesheets/components/DashboardBuilder.jsx | 127 
 .../v2/stylesheets/components/column.less  |  10 +-
 .../v2/stylesheets/components/new-component.less   |   1 +
 .../dashboard/v2/stylesheets/components/row.less   |   6 +-
 .../dashboard/v2/stylesheets/components/tabs.less  |  39 +++--
 .../javascripts/dashboard/v2/stylesheets/dnd.less  |  54 ---
 .../javascripts/dashboard/v2/stylesheets/grid.less |  43 +-
 .../dashboard/v2/stylesheets/hover-menu.less   |  14 +-
 .../dashboard/v2/stylesheets/index.less|   1 +
 .../dashboard/v2/stylesheets/popover-menu.less |  24 ++-
 .../dashboard/v2/stylesheets/resizable.less|  12 +-
 .../dashboard/v2/util/backgroundStyleOptions.js|   7 +
 .../dashboard/v2/util/componentTypes.js|  10 +-
 .../javascripts/dashboard/v2/util/constants.js |  11 +-
 .../dashboard/v2/util/countChildRowsAndColumns.js  |  14 --
 .../javascripts/dashboard/v2/util/dnd-reorder.js   |  18 +--
 .../javascripts/dashboard/v2/util/findParentId.js  |  15 ++
 .../javascripts/dashboard/v2/util/getChildWidth.js |  16 ++
 .../dashboard/v2/util/getDropPosition.js   |  16 +-
 .../javascripts/dashboard/v2/util/isValidChild.js  |  96 +++-
 .../dashboard/v2/util/newComponentFactory.js   |  12 +-
 

[incubator-superset] branch 0.24 updated: 0.24.0

2018-03-23 Thread maximebeauchemin
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/0.24 by this push:
 new d8f514c  0.24.0
d8f514c is described below

commit d8f514ce583e775b7e79f84a0c11fdfea3ddcd08
Author: Maxime Beauchemin 
AuthorDate: Fri Mar 23 08:28:20 2018 -0700

0.24.0
---
 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 79a369a..636a789 100644
--- a/superset/assets/package.json
+++ b/superset/assets/package.json
@@ -1,6 +1,6 @@
 {
   "name": "superset",
-  "version": "0.24rc1",
+  "version": "0.24.0",
   "description": "Superset is a data exploration platform designed to be 
visual, intuitive, and interactive.",
   "license": "Apache-2.0",
   "directories": {

-- 
To stop receiving notification emails like this one, please contact
maximebeauche...@apache.org.


[incubator-superset] branch master updated: [Bug fix] Fixed/Refactored annotation layer code so that non-timeseries annotations are applied based on the updated chart object after adding all data (#46

2018-03-23 Thread graceguo
This is an automated email from the ASF dual-hosted git repository.

graceguo 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 73f7f81  [Bug fix] Fixed/Refactored annotation layer code so that 
non-timeseries annotations are applied based on the updated chart object after 
adding all data (#4630)
73f7f81 is described below

commit 73f7f817d30f960f16611f01ac8daee52ad92830
Author: EvelynTurner <36863942+evelyntur...@users.noreply.github.com>
AuthorDate: Fri Mar 23 02:10:40 2018 -0400

[Bug fix] Fixed/Refactored annotation layer code so that non-timeseries 
annotations are applied based on the updated chart object after adding all data 
(#4630)

* Fix how the annotation layer interpretes the timestamp string without 
timezone info; use it as UTC

* [Bug fix] Fixed/Refactored annotation layer code so that non-timeseries 
annotations are applied based on the updated chart object after adding all data

* [Bug fix] Fixed/Refactored annotation layer code so that non-timeseries 
annotations are applied based on the updated chart object after adding all data

* Fixed indentation
---
 superset/assets/visualizations/nvd3_vis.js | 53 ++
 1 file changed, 24 insertions(+), 29 deletions(-)

diff --git a/superset/assets/visualizations/nvd3_vis.js 
b/superset/assets/visualizations/nvd3_vis.js
index 7cfb1c3..9ce02bd 100644
--- a/superset/assets/visualizations/nvd3_vis.js
+++ b/superset/assets/visualizations/nvd3_vis.js
@@ -533,6 +533,28 @@ function nvd3Vis(slice, payload) {
 chart.yAxis.axisLabel(fd.y_axis_label).axisLabelDistance(distance);
   }
 
+  const annotationLayers = (slice.formData.annotation_layers || 
[]).filter(x => x.show);
+  if (isTimeSeries && annotationLayers && slice.annotationData) {
+// Time series annotations add additional data
+const timeSeriesAnnotations = annotationLayers
+  .filter(a => a.annotationType === 
AnnotationTypes.TIME_SERIES).reduce((bushel, a) =>
+bushel.concat((slice.annotationData[a.name] || []).map((series) => {
+  if (!series) {
+return {};
+  }
+  const key = Array.isArray(series.key) ?
+`${a.name}, ${series.key.join(', ')}` : a.name;
+  return {
+...series,
+key,
+color: a.color,
+strokeWidth: a.width,
+classed: `${a.opacity} ${a.style}`,
+  };
+})), []);
+data.push(...timeSeriesAnnotations);
+  }
+
   // render chart
   svg
   .datum(data)
@@ -544,8 +566,7 @@ function nvd3Vis(slice, payload) {
   // on scroll, hide tooltips. throttle to only 4x/second.
   $(window).scroll(throttle(hideTooltips, 250));
 
-  const annotationLayers = (slice.formData.annotation_layers || 
[]).filter(x => x.show);
-
+  // The below code should be run AFTER rendering because chart is updated 
in call()
   if (isTimeSeries && annotationLayers) {
 // Formula annotations
 const formulas = annotationLayers.filter(a => a.annotationType === 
AnnotationTypes.FORMULA)
@@ -620,7 +641,7 @@ function nvd3Vis(slice, payload) {
   '' + body.join(', ') + '';
   });
 
-if (slice.annotationData && Object.keys(slice.annotationData).length) {
+if (slice.annotationData) {
   // Event annotations
   annotationLayers.filter(x => (
 x.annotationType === AnnotationTypes.EVENT &&
@@ -674,7 +695,6 @@ function nvd3Vis(slice, payload) {
 }
   });
 
-
   // Interval annotations
   annotationLayers.filter(x => (
 x.annotationType === AnnotationTypes.INTERVAL &&
@@ -737,33 +757,8 @@ function nvd3Vis(slice, payload) {
 .call(tip);
 }
   });
-
-  // Time series annotations
-  const timeSeriesAnnotations = annotationLayers
-.filter(a => a.annotationType === 
AnnotationTypes.TIME_SERIES).reduce((bushel, a) =>
-  bushel.concat((slice.annotationData[a.name] || []).map((series) 
=> {
-if (!series) {
-  return {};
-}
-const key = Array.isArray(series.key) ?
-  `${a.name}, ${series.key.join(', ')}` : a.name;
-return {
-  ...series,
-  key,
-  color: a.color,
-  strokeWidth: a.width,
-  classed: `${a.opacity} ${a.style}`,
-};
-  })), []);
-  data.push(...timeSeriesAnnotations);
 }
   }
-
-  // rerender chart
-  svg.datum(data)
-.attr('height', height)
-.attr('width', width)
-.call(chart);
 }
 return chart;
   };

-- 
To stop receiving notification emails like