[incubator-superset] branch master updated: Fix returned time parse_human_datetime (#2033)
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 c17ffc1 Fix returned time parse_human_datetime (#2033) c17ffc1 is described below commit c17ffc1e9c4c2ad7bfaae430c0bf00f9d46e52f4 Author: Emanuele Cesena AuthorDate: Thu Aug 10 23:04:49 2017 -0700 Fix returned time parse_human_datetime (#2033) parse_human_datetime parses date-only strings, e.g. "today", returning the correct date but time set at 9am. This is an internal implementation in parsedatetime. This patch resets to midnight. If time is specified and parsed, it is correctly returned. --- superset/utils.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/superset/utils.py b/superset/utils.py index ed84186..cd70e0c 100644 --- a/superset/utils.py +++ b/superset/utils.py @@ -203,7 +203,11 @@ def parse_human_datetime(s): except Exception: try: cal = parsedatetime.Calendar() -dttm = dttm_from_timtuple(cal.parse(s)[0]) +parsed_dttm, parsed_flags = cal.parseDT(s) +# when time is not extracted, we "reset to midnight" +if parsed_flags & 2 == 0: +parsed_dttm = parsed_dttm.replace(hour=0, minute=0, second=0) +dttm = dttm_from_timtuple(parsed_dttm.utctimetuple()) except Exception as e: logging.exception(e) raise ValueError("Couldn't parse date string [{}]".format(s)) -- To stop receiving notification emails like this one, please contact ['"comm...@superset.apache.org" '].
[incubator-superset] branch master updated: Add translatable columns in label_columns of the view (#3032)
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 0d4137d Add translatable columns in label_columns of the view (#3032) 0d4137d is described below commit 0d4137d21ef04626b5ed5fc93d279f3c7b2a574e Author: Rogan AuthorDate: Fri Aug 11 13:28:06 2017 +0800 Add translatable columns in label_columns of the view (#3032) * add translatable columns in label_columns of the view * display the verbose_name of columns in list view, just like in the metrics list * Revert "display the verbose_name of columns in list view, just like in the metrics list" This reverts commit f815d3b3ede4e691f4adcbb51654940e8572ad10. --- superset/connectors/sqla/views.py | 14 ++ superset/views/core.py| 7 ++- superset/views/sql_lab.py | 17 + 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py index 6c9b233..21529b1 100644 --- a/superset/connectors/sqla/views.py +++ b/superset/connectors/sqla/views.py @@ -91,7 +91,8 @@ class TableColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa 'expression': _("Expression"), 'is_dttm': _("Is temporal"), 'python_date_format': _("Datetime Format"), -'database_expression': _("Database Expression") +'database_expression': _("Database Expression"), +'type': _('Type'), } appbuilder.add_view_no_menu(TableColumnInlineView) @@ -133,6 +134,8 @@ class SqlMetricInlineView(CompactCRUDMixin, SupersetModelView): # noqa 'metric_type': _("Type"), 'expression': _("SQL Expression"), 'table': _("Table"), +'d3format': _("D3 Format"), +'is_restricted': _('Is Restricted') } def post_add(self, metric): @@ -216,11 +219,14 @@ class TableModelView(DatasourceModelView, DeleteMixin): # noqa 'changed_on_': _("Last Changed"), 'filter_select_enabled': _("Enable Filter Select"), 'schema': _("Schema"), -'default_endpoint': _( -"Redirects to this endpoint when clicking on the datasource " -"from the datasource list"), +'default_endpoint': _('Default Endpoint'), 'offset': _("Offset"), 'cache_timeout': _("Cache Timeout"), +'table_name': _("Table Name"), +'fetch_values_predicate': _('Fetch Values Predicate'), +'owner': _("Owner"), +'main_dttm_col': _("Main Datetime Column"), +'description': _('Description'), } def pre_add(self, table): diff --git a/superset/views/core.py b/superset/views/core.py index 83acd8a..67b353a 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -247,6 +247,8 @@ class DatabaseView(SupersetModelView, DeleteMixin): # noqa 'sqlalchemy_uri': _("SQLAlchemy URI"), 'cache_timeout': _("Cache Timeout"), 'extra': _("Extra"), +'allow_run_sync': _("Allow Run Sync"), +'allow_run_async': _("Allow Run Async"), } def pre_add(self, db): @@ -333,7 +335,7 @@ class SliceModelView(SupersetModelView, DeleteMixin): # noqa can_add = False label_columns = { -'datasource_link': 'Datasource', +'datasource_link': _('Datasource'), } search_columns = ( 'slice_name', 'description', 'viz_type', 'owners', @@ -2307,6 +2309,9 @@ class CssTemplateModelView(SupersetModelView, DeleteMixin): list_columns = ['template_name'] edit_columns = ['template_name', 'css'] add_columns = edit_columns +label_columns = { +'template_name': _('Template Name'), +} class CssTemplateAsyncModelView(CssTemplateModelView): diff --git a/superset/views/sql_lab.py b/superset/views/sql_lab.py index 03f382e..eea71d4 100644 --- a/superset/views/sql_lab.py +++ b/superset/views/sql_lab.py @@ -14,6 +14,13 @@ from .base import SupersetModelView, BaseSupersetView, DeleteMixin class QueryView(SupersetModelView): datamodel = SQLAInterface(Query) list_columns = ['user', 'database', 'status', 'start_time', 'end_time'] +label_columns = { +'user': _('User'), +'database': _('Database'), +'status': _('Status'), +'start_time': _('Start Time'), +'end_time': _('End Time'), +} appbuilder.add_view( QueryView, @@ -42,6 +49,16 @@ class SavedQueryView(SupersetModelView, DeleteMixin): add_columns = ['label', 'database', 'description', 'sql'] edit_columns = add_columns base_order = ('changed_on', 'desc') +label_columns = { +'label': _('Label'), +'user': _('User'), +'database': _('Database'), +'description': _('Description'), +'modified': _('Modified'), +'end_
[incubator-superset] branch master updated: [security] prevent XSS markup viz (#3211)
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 0c5db55 [security] prevent XSS markup viz (#3211) 0c5db55 is described below commit 0c5db55d55471c1c61c0750733733c157551b2d8 Author: Maxime Beauchemin AuthorDate: Thu Aug 10 21:38:33 2017 -0700 [security] prevent XSS markup viz (#3211) * Prevent XSS in Markup viz We protect the browser by sandboxing the user code inside an iframe * Helvetica --- superset/__init__.py | 27 -- .../components/controls/TextAreaControl.jsx| 2 +- .../assets/stylesheets/less/cosmo/variables.less | 2 +- superset/assets/stylesheets/superset.less | 12 -- superset/assets/visualizations/markup.js | 22 -- superset/viz.py| 4 ++-- 6 files changed, 49 insertions(+), 20 deletions(-) diff --git a/superset/__init__.py b/superset/__init__.py index 9576458..2e44ebd 100644 --- a/superset/__init__.py +++ b/superset/__init__.py @@ -32,22 +32,35 @@ app = Flask(__name__) app.config.from_object(CONFIG_MODULE) conf = app.config +# # Handling manifest file logic at app start +# MANIFEST_FILE = APP_DIR + '/static/assets/dist/manifest.json' -get_manifest_file = lambda x: x manifest = {} -try: -with open(MANIFEST_FILE, 'r') as f: -manifest = json.load(f) -get_manifest_file = lambda x: '/static/assets/dist/' + manifest.get(x, '') -except Exception: -print("no manifest file found at " + MANIFEST_FILE) +def parse_manifest_json(): +global manifest +try: +with open(MANIFEST_FILE, 'r') as f: +manifest = json.load(f) +except Exception: +print("no manifest file found at " + MANIFEST_FILE) + + +def get_manifest_file(filename): +if app.debug: +parse_manifest_json() +return '/static/assets/dist/' + manifest.get(filename, '') + +parse_manifest_json() + @app.context_processor def get_js_manifest(): return dict(js_manifest=get_manifest_file) +# + for bp in conf.get('BLUEPRINTS'): try: diff --git a/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx b/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx index 4fe9b77..31fe2bb 100644 --- a/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx +++ b/superset/assets/javascripts/explore/components/controls/TextAreaControl.jsx @@ -76,7 +76,7 @@ export default class TextAreaControl extends React.Component { modalTitle={controlHeader} triggerNode={ - Edit {this.props.language} in modal + Edit {this.props.language} in modal } modalBody={this.renderEditor(true)} diff --git a/superset/assets/stylesheets/less/cosmo/variables.less b/superset/assets/stylesheets/less/cosmo/variables.less index ce6b85a..fb2abf6 100644 --- a/superset/assets/stylesheets/less/cosmo/variables.less +++ b/superset/assets/stylesheets/less/cosmo/variables.less @@ -41,7 +41,7 @@ // //## Font, line-height, and color for body text, headings, and more. -@font-family-sans-serif: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif; +@font-family-sans-serif: Helvetica, Arial; @font-family-serif: Georgia, "Times New Roman", Times, serif; //** Default monospace fonts for ``, ``, and ``. diff --git a/superset/assets/stylesheets/superset.less b/superset/assets/stylesheets/superset.less index aa5678c..bacc18a 100644 --- a/superset/assets/stylesheets/superset.less +++ b/superset/assets/stylesheets/superset.less @@ -1,9 +1,3 @@ -@font-face { - font-family: "Roboto"; - src: url("./fonts/Roboto-Regular.woff2") format("woff2"), - url("./fonts/Roboto-Regular.woff") format("woff"); -} - body { margin: 0px !important; } @@ -255,4 +249,8 @@ div.widget .slice_container { .panel .table-responsive{ width: 98%; } -} \ No newline at end of file +} +iframe { +border: none; +width: 100%; +} diff --git a/superset/assets/visualizations/markup.js b/superset/assets/visualizations/markup.js index ba0ad44..379e2ef 100644 --- a/superset/assets/visualizations/markup.js +++ b/superset/assets/visualizations/markup.js @@ -4,11 +4,29 @@ require('./markup.css'); function markupWidget(slice, payload) { $('#code').attr('rows', '15'); - slice.container.css({ + const jqdiv = slice.container; + jqdiv.css({ overflow: 'auto', height: slice.container.height(), }); - slice.container.html(payload.data.html); + +
[incubator-superset] branch master updated: add `_()` to Exception messages (#3034)
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 bd4a4c2 add `_()` to Exception messages (#3034) bd4a4c2 is described below commit bd4a4c2753d9411c0032f4bd24ea36faba8cd3f5 Author: Rogan AuthorDate: Fri Aug 11 11:57:05 2017 +0800 add `_()` to Exception messages (#3034) * add `_()` to Exception messages * fix error --- superset/connectors/sqla/models.py | 4 +-- superset/connectors/sqla/views.py | 4 +-- superset/views/base.py | 3 +- superset/views/core.py | 2 +- superset/viz.py| 73 +++--- 5 files changed, 44 insertions(+), 42 deletions(-) diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index b836a15..6dccdf8 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -578,9 +578,9 @@ class SqlaTable(Model, BaseDatasource): try: table = self.get_sqla_table_object() except Exception: -raise Exception( +raise Exception(_( "Table doesn't seem to exist in the specified database, " -"couldn't fetch column information") +"couldn't fetch column information")) TC = TableColumn # noqa shortcut to class M = SqlMetric # noqa diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py index 4aa577d..6c9b233 100644 --- a/superset/connectors/sqla/views.py +++ b/superset/connectors/sqla/views.py @@ -239,11 +239,11 @@ class TableModelView(DatasourceModelView, DeleteMixin): # noqa table.get_sqla_table_object() except Exception as e: logging.exception(e) -raise Exception( +raise Exception(_( "Table [{}] could not be found, " "please double check your " "database connection, schema, and " -"table name".format(table.name)) +"table name").format(table.name)) def post_add(self, table, flash_message=True): table.fetch_metadata() diff --git a/superset/views/base.py b/superset/views/base.py index f2cbd9b..d036258 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -5,6 +5,7 @@ import traceback from flask import g, redirect, Response, flash, abort from flask_babel import gettext as __ +from flask_babel import lazy_gettext as _ from flask_appbuilder import BaseView from flask_appbuilder import ModelView @@ -202,7 +203,7 @@ def validate_json(form, field): # noqa json.loads(field.data) except Exception as e: logging.exception(e) -raise Exception("json isn't valid") +raise Exception(_("json isn't valid")) class DeleteMixin(object): diff --git a/superset/views/core.py b/superset/views/core.py index b2a3be4..83acd8a 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -2034,7 +2034,7 @@ class Superset(BaseSupersetView): query_id = query.id session.commit() # shouldn't be necessary if not query_id: -raise Exception("Query record was not created as expected.") +raise Exception(_("Query record was not created as expected.")) logging.info("Triggering query_id: {}".format(query_id)) # Async request. diff --git a/superset/viz.py b/superset/viz.py old mode 100755 new mode 100644 index b7b72ba..c2d65e6 --- a/superset/viz.py +++ b/superset/viz.py @@ -46,7 +46,7 @@ class BaseViz(object): def __init__(self, datasource, form_data): if not datasource: -raise Exception("Viz is missing a datasource") +raise Exception(_("Viz is missing a datasource")) self.datasource = datasource self.request = request self.viz_type = form_data.get("viz_type") @@ -155,7 +155,7 @@ class BaseViz(object): until = extra_filters.get('__to') or form_data.get("until", "now") to_dttm = utils.parse_human_datetime(until) if from_dttm > to_dttm: -raise Exception("From date cannot be larger than to date") +raise Exception(_("From date cannot be larger than to date")) # extras are used to query elements specific to a datasource type # for instance the extra where clause that applies only to Tables @@ -331,9 +331,9 @@ class TableViz(BaseViz): (fd.get('granularity_sqla') and fd.get('time_grain_sqla')) ) if fd.get('include_time') and not conditions_met: -raise Exception( +raise Exception(_( "Pick a granularity in the Time section or " -"uncheck 'Include Time'") +"uncheck 'Include Time'"))
[incubator-superset] branch master updated: display the verbose_name of columns in list view, just like in the metrics list (#3275)
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 f399fcd display the verbose_name of columns in list view, just like in the metrics list (#3275) f399fcd is described below commit f399fcd624c433e36e61e5b3e862147569fb9e94 Author: Rogan AuthorDate: Fri Aug 11 11:52:24 2017 +0800 display the verbose_name of columns in list view, just like in the metrics list (#3275) --- superset/connectors/druid/views.py | 2 +- superset/connectors/sqla/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/superset/connectors/druid/views.py b/superset/connectors/druid/views.py index b9a87e3..b85e611 100644 --- a/superset/connectors/druid/views.py +++ b/superset/connectors/druid/views.py @@ -35,7 +35,7 @@ class DruidColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa 'groupby', 'filterable', 'count_distinct', 'sum', 'min', 'max'] add_columns = edit_columns list_columns = [ -'column_name', 'type', 'groupby', 'filterable', 'count_distinct', +'column_name', 'verbose_name', 'type', 'groupby', 'filterable', 'count_distinct', 'sum', 'min', 'max'] can_delete = False page_size = 500 diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py index ef87d31..4aa577d 100644 --- a/superset/connectors/sqla/views.py +++ b/superset/connectors/sqla/views.py @@ -39,7 +39,7 @@ class TableColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa 'is_dttm', 'python_date_format', 'database_expression'] add_columns = edit_columns list_columns = [ -'column_name', 'type', 'groupby', 'filterable', 'count_distinct', +'column_name', 'verbose_name', 'type', 'groupby', 'filterable', 'count_distinct', 'sum', 'min', 'max', 'is_dttm'] page_size = 500 description_columns = { -- To stop receiving notification emails like this one, please contact ['"comm...@superset.apache.org" '].
[incubator-superset] branch master updated: add placeholder to Select components (#3274)
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 08e40e2 add placeholder to Select components (#3274) 08e40e2 is described below commit 08e40e2d78bde55a185480130e0ced9f979453aa Author: Rogan AuthorDate: Fri Aug 11 11:51:36 2017 +0800 add placeholder to Select components (#3274) --- superset/assets/javascripts/explore/components/SaveModal.jsx | 1 + superset/assets/visualizations/filter_box.jsx| 1 + 2 files changed, 2 insertions(+) diff --git a/superset/assets/javascripts/explore/components/SaveModal.jsx b/superset/assets/javascripts/explore/components/SaveModal.jsx index beb07b2..b3a69a3 100644 --- a/superset/assets/javascripts/explore/components/SaveModal.jsx +++ b/superset/assets/javascripts/explore/components/SaveModal.jsx @@ -188,6 +188,7 @@ class SaveModal extends React.Component { onChange={this.onChange.bind(this, 'saveToDashboardId')} autoSize={false} value={this.state.saveToDashboardId} +placeholder="Select Dashboard" /> {field.replace('__', '')} '].
[incubator-superset] branch master updated: Added Konfio to 'Who uses Superset' list. (#3277)
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 2898f9d Added Konfio to 'Who uses Superset' list. (#3277) 2898f9d is described below commit 2898f9d37981d66fd998c904c462514518c5a67d Author: Luis Rodriguez AuthorDate: Thu Aug 10 22:50:49 2017 -0500 Added Konfio to 'Who uses Superset' list. (#3277) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7382789..b8ea466 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ the world know they are using Superset. Join our growing community! - [FBK - ICT center](http://ict.fbk.eu) - [Faasos](http://faasos.com/) - [GfK Data Lab](http://datalab.gfk.com) + - [KonfĂo](http://konfio.mx) - [Maieutical Labs](https://cloudschooling.it) - [Qunar](https://www.qunar.com/) - [Shopkick](https://www.shopkick.com) @@ -187,3 +188,4 @@ the world know they are using Superset. Join our growing community! - [Udemy](https://www.udemy.com/) - [Yahoo!](https://yahoo.com/) - [Zalando](https://www.zalando.com) + -- To stop receiving notification emails like this one, please contact ['"comm...@superset.apache.org" '].
[incubator-superset] branch master updated: Fix celery worker (#3278)
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 dfea8df Fix celery worker (#3278) dfea8df is described below commit dfea8df7c9c3d469fcf5605e71c803a9ceb5cc69 Author: Alex Guziel AuthorDate: Thu Aug 10 20:50:21 2017 -0700 Fix celery worker (#3278) --- superset/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/cli.py b/superset/cli.py index e4165e6..c5dea44 100755 --- a/superset/cli.py +++ b/superset/cli.py @@ -195,7 +195,7 @@ def worker(workers): CELERYD_CONCURRENCY=config.get("SUPERSET_CELERY_WORKERS")) worker = celery_app.Worker(optimization='fair') -worker.run() +worker.start() @manager.option( -- To stop receiving notification emails like this one, please contact ['"comm...@superset.apache.org" '].
[incubator-superset] branch master updated: [add] Save filters to dashboard (#3183)
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 a5320a0 [add] Save filters to dashboard (#3183) a5320a0 is described below commit a5320a0f3729f0513cf88a548d5fbd1bf59aa506 Author: Rogan AuthorDate: Fri Aug 11 11:49:49 2017 +0800 [add] Save filters to dashboard (#3183) * [add] Save filters to dashboard * format code * fix CI error * add semicolon semi * fix none object * add test data optimize the js code fix the compatibility issue * fix urllib to urllib.parse * add space * update test case * remove 'return' * fix error * update test case --- .../assets/javascripts/dashboard/Dashboard.jsx | 35 - .../javascripts/dashboard/components/SaveModal.jsx | 1 + superset/assets/visualizations/filter_box.jsx | 18 +++ superset/models/core.py| 8 + superset/views/core.py | 1 + tests/core_tests.py| 36 ++ 6 files changed, 85 insertions(+), 14 deletions(-) diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index b6c97b6..283475a 100644 --- a/superset/assets/javascripts/dashboard/Dashboard.jsx +++ b/superset/assets/javascripts/dashboard/Dashboard.jsx @@ -166,6 +166,10 @@ export function dashboardContainer(dashboard, datasources, userid) { } }, effectiveExtraFilters(sliceId) { + // Don't filter the filter_box itself by preselect_filters + if (this.getSlice(sliceId).formData.viz_type === 'filter_box') { +return []; + } const f = []; const immuneSlices = this.metadata.filter_immune_slices || []; if (sliceId && immuneSlices.includes(sliceId)) { @@ -195,21 +199,24 @@ export function dashboardContainer(dashboard, datasources, userid) { return f; }, addFilter(sliceId, col, vals, merge = true, refresh = true) { - if (!(sliceId in this.filters)) { -this.filters[sliceId] = {}; - } - if (!(col in this.filters[sliceId]) || !merge) { -this.filters[sliceId][col] = vals; + if (this.getSlice(sliceId) && (col === '__from' || col === '__to' || + this.getSlice(sliceId).formData.groupby.indexOf(col) !== -1)) { +if (!(sliceId in this.filters)) { + this.filters[sliceId] = {}; +} +if (!(col in this.filters[sliceId]) || !merge) { + this.filters[sliceId][col] = vals; -// d3.merge pass in array of arrays while some value form filter components -// from and to filter box require string to be process and return - } else if (this.filters[sliceId][col] instanceof Array) { -this.filters[sliceId][col] = d3.merge([this.filters[sliceId][col], vals]); - } else { -this.filters[sliceId][col] = d3.merge([[this.filters[sliceId][col]], vals])[0] || ''; - } - if (refresh) { -this.refreshExcept(sliceId); + // d3.merge pass in array of arrays while some value form filter components + // from and to filter box require string to be process and return +} else if (this.filters[sliceId][col] instanceof Array) { + this.filters[sliceId][col] = d3.merge([this.filters[sliceId][col], vals]); +} else { + this.filters[sliceId][col] = d3.merge([[this.filters[sliceId][col]], vals])[0] || ''; +} +if (refresh) { + this.refreshExcept(sliceId); +} } this.updateFilterParamsInUrl(); }, diff --git a/superset/assets/javascripts/dashboard/components/SaveModal.jsx b/superset/assets/javascripts/dashboard/components/SaveModal.jsx index a22f4ac..82b44df 100644 --- a/superset/assets/javascripts/dashboard/components/SaveModal.jsx +++ b/superset/assets/javascripts/dashboard/components/SaveModal.jsx @@ -80,6 +80,7 @@ class SaveModal extends React.PureComponent { css: this.state.css, expanded_slices: expandedSlices, dashboard_title: dashboard.dashboard_title, + default_filters: dashboard.readFilters(), }; let url = null; if (saveType === 'overwrite') { diff --git a/superset/assets/visualizations/filter_box.jsx b/superset/assets/visualizations/filter_box.jsx index a97ec3f..7e02dd5 100644 --- a/superset/assets/visualizations/filter_box.jsx +++ b/superset/assets/visualizations/filter_box.jsx @@ -74,6 +74,24 @@ class FilterBox extends React.Component { ); }); } +// Add created options to filtersChoices, even though it doesn't exist, +// or these options will exist in query sql but invisible to end user. +if (this.state.selected
[incubator-superset] branch master updated: Explore view save modal spec (#3110)
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 b68084b Explore view save modal spec (#3110) b68084b is described below commit b68084b9ac76c943e55f44b1b5ae22d79fc19d6f Author: Grace Guo AuthorDate: Thu Aug 10 17:04:44 2017 -0700 Explore view save modal spec (#3110) * split reducer logic for ExploreViewContainer * fix saveModal component and unit tests * revert changes in SaveModal_spec. will make another commit just to improve test coverage for SaveModal component. * improve test coverage for explore view components: - SaveModal component - URLShortLinkButton * remove comment-out code * [bugfix] wrong 'Cant have overlap between Series and Breakdowns' (#3254) * [explore] make edit datasource a basic link (#3244) * Relying on FAB for font-awesome.min.css (#3261) * Modernize SQLA pessimistic handling (#3256) Looks like SQLAlchemy has redefined the best practice around pessimistic connection handling. * [webpack] break CSS and JS files while webpackin' (#3262) * [webpack] break CSS and JS files while webpackin' * cleaning up some templates * Fix pylint issue * import logging (#3264) * [bugfix] preserve order in groupby (#3268) Recently in https://github.com/apache/incubator-superset/commit/4c3313b01cb508ced8519a68f6479db423974929 I introduced an issue where the order of groupby fields might change. This addresses this issue and will preserve ordering. * Explicitly add Flask as dependancy (#3252) * Use sane Celery defaults to prevent tasks from being delayed (#3267) * Improve the chart type of Visualize in sqllab (#3241) * Improve the chart type of Visualize in sqllab & Add some css & Fix the link address in the navbar * add vizTypes filter * Set default ports Druid (#3266) For Druid set the default port for the broker and coordinator. * [explore] Split large reducer logic in ExploreViewContainer (#3088) * split reducer logic for ExploreViewContainer * fix saveModal component and unit tests * revert changes in SaveModal_spec. will make another commit just to improve test coverage for SaveModal component. * remove comment-out code * fix merge confilicts --- .../javascripts/explore/actions/exploreActions.js | 38 .../explore/components/CheckboxControl_spec.jsx| 12 +- .../explore/components/SaveModal_spec.jsx | 221 + .../explore/components/URLShortLinkButton_spec.jsx | 6 + 4 files changed, 238 insertions(+), 39 deletions(-) diff --git a/superset/assets/javascripts/explore/actions/exploreActions.js b/superset/assets/javascripts/explore/actions/exploreActions.js index 32fa3c5..f539aa1 100644 --- a/superset/assets/javascripts/explore/actions/exploreActions.js +++ b/superset/assets/javascripts/explore/actions/exploreActions.js @@ -14,6 +14,11 @@ export function setDatasource(datasource) { return { type: SET_DATASOURCE, datasource }; } +export const SET_DATASOURCES = 'SET_DATASOURCES'; +export function setDatasources(datasources) { + return { type: SET_DATASOURCES, datasources }; +} + export const FETCH_DATASOURCE_STARTED = 'FETCH_DATASOURCE_STARTED'; export function fetchDatasourceStarted() { return { type: FETCH_DATASOURCE_STARTED }; @@ -29,6 +34,21 @@ export function fetchDatasourceFailed(error) { return { type: FETCH_DATASOURCE_FAILED, error }; } +export const FETCH_DATASOURCES_STARTED = 'FETCH_DATASOURCES_STARTED'; +export function fetchDatasourcesStarted() { + return { type: FETCH_DATASOURCES_STARTED }; +} + +export const FETCH_DATASOURCES_SUCCEEDED = 'FETCH_DATASOURCES_SUCCEEDED'; +export function fetchDatasourcesSucceeded() { + return { type: FETCH_DATASOURCES_SUCCEEDED }; +} + +export const FETCH_DATASOURCES_FAILED = 'FETCH_DATASOURCES_FAILED'; +export function fetchDatasourcesFailed(error) { + return { type: FETCH_DATASOURCES_FAILED, error }; +} + export const RESET_FIELDS = 'RESET_FIELDS'; export function resetControls() { return { type: RESET_FIELDS }; @@ -61,6 +81,24 @@ export function fetchDatasourceMetadata(datasourceKey, alsoTriggerQuery = false) }; } +export function fetchDatasources() { + return function (dispatch) { +dispatch(fetchDatasourcesStarted()); +const url = '/superset/datasources/'; +$.ajax({ + type: 'GET', + url, + success: (data) => { +dispatch(setDatasources(data)); +dispatch(fetchDatasourcesSucceeded()); + }, + error(error) { +dispatch(fetchDatasourcesFailed(error.responseJSON.error)); + }, +}); + }; +}
[incubator-superset] branch master updated: [explore] fixed padding bug on filter section (#3279)
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 3b24d7d [explore] fixed padding bug on filter section (#3279) 3b24d7d is described below commit 3b24d7df83b1390c9f09e19bb222145b2875394d Author: timifasubaa <30888507+timifasu...@users.noreply.github.com> AuthorDate: Thu Aug 10 16:48:30 2017 -0700 [explore] fixed padding bug on filter section (#3279) --- superset/assets/javascripts/explore/main.css | 1 + 1 file changed, 1 insertion(+) diff --git a/superset/assets/javascripts/explore/main.css b/superset/assets/javascripts/explore/main.css index ab04eaa..388be8f 100644 --- a/superset/assets/javascripts/explore/main.css +++ b/superset/assets/javascripts/explore/main.css @@ -13,6 +13,7 @@ bottom: 0px; overflow-y: auto; margin-right: 0px; + margin-bottom: 40px; } .fave-unfave-icon, .edit-desc-icon { -- To stop receiving notification emails like this one, please contact ['"comm...@superset.apache.org" '].
[incubator-superset] branch master updated: [explore] Split large reducer logic in ExploreViewContainer (#3088)
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 b3107bb [explore] Split large reducer logic in ExploreViewContainer (#3088) b3107bb is described below commit b3107bb603d2ddae38fec97d81878b2dae339624 Author: Grace Guo AuthorDate: Thu Aug 10 14:21:45 2017 -0700 [explore] Split large reducer logic in ExploreViewContainer (#3088) * split reducer logic for ExploreViewContainer * fix saveModal component and unit tests * revert changes in SaveModal_spec. will make another commit just to improve test coverage for SaveModal component. * remove comment-out code * fix merge confilicts --- .../javascripts/explore/actions/chartActions.js| 70 .../javascripts/explore/actions/exploreActions.js | 123 + .../explore/actions/saveModalActions.js| 57 ++ .../explore/components/ChartContainer.jsx | 38 +++ .../explore/components/ControlPanelsContainer.jsx | 10 +- .../explore/components/ExploreViewContainer.jsx| 28 +++-- .../javascripts/explore/components/SaveModal.jsx | 26 ++--- superset/assets/javascripts/explore/index.jsx | 24 ++-- .../javascripts/explore/reducers/chartReducer.js | 72 .../javascripts/explore/reducers/exploreReducer.js | 102 - .../assets/javascripts/explore/reducers/index.js | 11 ++ .../explore/reducers/saveModalReducer.js | 28 + .../spec/javascripts/explore/chartActions_spec.js | 36 ++ .../javascripts/explore/exploreActions_spec.js | 68 +--- 14 files changed, 364 insertions(+), 329 deletions(-) diff --git a/superset/assets/javascripts/explore/actions/chartActions.js b/superset/assets/javascripts/explore/actions/chartActions.js new file mode 100644 index 000..6c9291d --- /dev/null +++ b/superset/assets/javascripts/explore/actions/chartActions.js @@ -0,0 +1,70 @@ +import { getExploreUrl } from '../exploreUtils'; +import { getFormDataFromControls } from '../stores/store'; +import { QUERY_TIMEOUT_THRESHOLD } from '../../constants'; +import { triggerQuery } from './exploreActions'; + +const $ = window.$ = require('jquery'); + +export const CHART_UPDATE_STARTED = 'CHART_UPDATE_STARTED'; +export function chartUpdateStarted(queryRequest, latestQueryFormData) { + return { type: CHART_UPDATE_STARTED, queryRequest, latestQueryFormData }; +} + +export const CHART_UPDATE_SUCCEEDED = 'CHART_UPDATE_SUCCEEDED'; +export function chartUpdateSucceeded(queryResponse) { + return { type: CHART_UPDATE_SUCCEEDED, queryResponse }; +} + +export const CHART_UPDATE_STOPPED = 'CHART_UPDATE_STOPPED'; +export function chartUpdateStopped(queryRequest) { + if (queryRequest) { +queryRequest.abort(); + } + return { type: CHART_UPDATE_STOPPED }; +} + +export const CHART_UPDATE_TIMEOUT = 'CHART_UPDATE_TIMEOUT'; +export function chartUpdateTimeout(statusText) { + return { type: CHART_UPDATE_TIMEOUT, statusText }; +} + +export const CHART_UPDATE_FAILED = 'CHART_UPDATE_FAILED'; +export function chartUpdateFailed(queryResponse) { + return { type: CHART_UPDATE_FAILED, queryResponse }; +} + +export const UPDATE_CHART_STATUS = 'UPDATE_CHART_STATUS'; +export function updateChartStatus(status) { + return { type: UPDATE_CHART_STATUS, status }; +} + +export const CHART_RENDERING_FAILED = 'CHART_RENDERING_FAILED'; +export function chartRenderingFailed(error) { + return { type: CHART_RENDERING_FAILED, error }; +} + +export const RUN_QUERY = 'RUN_QUERY'; +export function runQuery(formData, force = false) { + return function (dispatch, getState) { +const { explore } = getState(); +const lastQueryFormData = getFormDataFromControls(explore.controls); +const url = getExploreUrl(formData, 'json', force); +const queryRequest = $.ajax({ + url, + dataType: 'json', + success(queryResponse) { +dispatch(chartUpdateSucceeded(queryResponse)); + }, + error(err) { +if (err.statusText === 'timeout') { + dispatch(chartUpdateTimeout(err.statusText)); +} else if (err.statusText !== 'abort') { + dispatch(chartUpdateFailed(err.responseJSON)); +} + }, + timeout: QUERY_TIMEOUT_THRESHOLD, +}); +dispatch(chartUpdateStarted(queryRequest, lastQueryFormData)); +dispatch(triggerQuery(false)); + }; +} diff --git a/superset/assets/javascripts/explore/actions/exploreActions.js b/superset/assets/javascripts/explore/actions/exploreActions.js index d45acd5..32fa3c5 100644 --- a/superset/assets/javascripts/explore/actions/exploreActions.js +++ b/superset/assets/javascripts/explore/actions/exploreActions.js @@ -1,6 +1,4 @@ /* eslint camelcase: 0 */ -import { getExploreUrl } from '../exploreUtils'; -import { QUERY_TI