[incubator-superset] branch master updated (a48a2e4 -> 21fc011)

2020-06-03 Thread tai
This is an automated email from the ASF dual-hosted git repository.

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


from a48a2e4  fix: display python_date_format in react views as well (#9934)
 add 21fc011  docs: add ELMO Cloud HR & Payroll to list of users on readme 
(#9960)

No new revisions were added by this update.

Summary of changes:
 README.md | 1 +
 1 file changed, 1 insertion(+)



[incubator-superset] branch master updated: fix: display python_date_format in react views as well (#9934)

2020-06-03 Thread tai
This is an automated email from the ASF dual-hosted git repository.

tai 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 a48a2e4  fix: display python_date_format in react views as well (#9934)
a48a2e4 is described below

commit a48a2e44b52240675cf733246abb191b9912cd2c
Author: Bogdan 
AuthorDate: Wed Jun 3 20:24:25 2020 -0700

fix: display python_date_format in react views as well (#9934)

Co-authored-by: bogdan kyryliuk 
---
 superset/connectors/sqla/models.py | 16 
 1 file changed, 16 insertions(+)

diff --git a/superset/connectors/sqla/models.py 
b/superset/connectors/sqla/models.py
index 7236eac..b413ebd 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -300,6 +300,22 @@ class TableColumn(Model, BaseColumn):
 # TODO(john-bodley): SIP-15 will explicitly require a type conversion.
 return f"""'{dttm.strftime("%Y-%m-%d %H:%M:%S.%f")}'"""
 
+@property
+def data(self) -> Dict[str, Any]:
+attrs = (
+"id",
+"column_name",
+"verbose_name",
+"description",
+"expression",
+"filterable",
+"groupby",
+"is_dttm",
+"type",
+"python_date_format",
+)
+return {s: getattr(self, s) for s in attrs if hasattr(self, s)}
+
 
 class SqlMetric(Model, BaseMetric):
 



[incubator-superset] branch master updated: fix: fetch all owners for dashboard, chart listview filters and properties modal (#9784)

2020-06-03 Thread tai
This is an automated email from the ASF dual-hosted git repository.

tai 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 d187d28  fix: fetch all owners for dashboard, chart listview filters 
and properties modal (#9784)
d187d28 is described below

commit d187d2887ea9348ffbc6de277ab56a1e0abab0f1
Author: ʈᵃᵢ 
AuthorDate: Wed Jun 3 19:57:03 2020 -0700

fix: fetch all owners for dashboard, chart listview filters and properties 
modal (#9784)
---
 .../javascripts/views/chartList/ChartList_spec.jsx |  2 +-
 .../views/dashboardList/DashboardList_spec.jsx |  2 +-
 .../views/datasetList/DatasetList_spec.jsx |  2 +-
 .../src/components/ListView/Filters.tsx|  2 +-
 superset-frontend/src/components/ListView/types.ts |  6 +-
 superset-frontend/src/components/ListView/utils.ts |  1 +
 .../src/explore/components/PropertiesModal.tsx |  6 +-
 .../src/views/chartList/ChartList.tsx  | 71 +++---
 .../src/views/dashboardList/DashboardList.tsx  | 83 +-
 .../src/views/datasetList/DatasetList.tsx  |  9 +--
 10 files changed, 116 insertions(+), 68 deletions(-)

diff --git 
a/superset-frontend/spec/javascripts/views/chartList/ChartList_spec.jsx 
b/superset-frontend/spec/javascripts/views/chartList/ChartList_spec.jsx
index faf0c09..d5785bf 100644
--- a/superset-frontend/spec/javascripts/views/chartList/ChartList_spec.jsx
+++ b/superset-frontend/spec/javascripts/views/chartList/ChartList_spec.jsx
@@ -102,7 +102,7 @@ describe('ChartList', () => {
 const callsD = fetchMock.calls(/chart\/\?q/);
 expect(callsD).toHaveLength(1);
 expect(callsD[0][0]).toMatchInlineSnapshot(
-  
`"/http//localhost/api/v1/chart/?q={%22order_column%22:%22changed_on%22,%22order_direction%22:%22desc%22,%22page%22:0,%22page_size%22:25}"`,
+  
`"/http//localhost/api/v1/chart/?q=(order_column:changed_on,order_direction:desc,page:0,page_size:25)"`,
 );
   });
 });
diff --git 
a/superset-frontend/spec/javascripts/views/dashboardList/DashboardList_spec.jsx 
b/superset-frontend/spec/javascripts/views/dashboardList/DashboardList_spec.jsx
index 5dbcb81..086d9d1 100644
--- 
a/superset-frontend/spec/javascripts/views/dashboardList/DashboardList_spec.jsx
+++ 
b/superset-frontend/spec/javascripts/views/dashboardList/DashboardList_spec.jsx
@@ -92,7 +92,7 @@ describe('DashboardList', () => {
 const callsD = fetchMock.calls(/dashboard\/\?q/);
 expect(callsD).toHaveLength(1);
 expect(callsD[0][0]).toMatchInlineSnapshot(
-  
`"/http//localhost/api/v1/dashboard/?q={%22order_column%22:%22changed_on%22,%22order_direction%22:%22desc%22,%22page%22:0,%22page_size%22:25}"`,
+  
`"/http//localhost/api/v1/dashboard/?q=(order_column:changed_on,order_direction:desc,page:0,page_size:25)"`,
 );
   });
   it('edits', () => {
diff --git 
a/superset-frontend/spec/javascripts/views/datasetList/DatasetList_spec.jsx 
b/superset-frontend/spec/javascripts/views/datasetList/DatasetList_spec.jsx
index b7b3e58..c393a98 100644
--- a/superset-frontend/spec/javascripts/views/datasetList/DatasetList_spec.jsx
+++ b/superset-frontend/spec/javascripts/views/datasetList/DatasetList_spec.jsx
@@ -92,7 +92,7 @@ describe('DatasetList', () => {
 const callsD = fetchMock.calls(/dataset\/\?q/);
 expect(callsD).toHaveLength(1);
 expect(callsD[0][0]).toMatchInlineSnapshot(
-  
`"/http//localhost/api/v1/dataset/?q={%22order_column%22:%22changed_on%22,%22order_direction%22:%22desc%22,%22page%22:0,%22page_size%22:25}"`,
+  
`"/http//localhost/api/v1/dataset/?q=(order_column:changed_on,order_direction:desc,page:0,page_size:25)"`,
 );
   });
 });
diff --git a/superset-frontend/src/components/ListView/Filters.tsx 
b/superset-frontend/src/components/ListView/Filters.tsx
index a97e498..69421d5 100644
--- a/superset-frontend/src/components/ListView/Filters.tsx
+++ b/superset-frontend/src/components/ListView/Filters.tsx
@@ -116,7 +116,7 @@ function SelectFilter({
 // TODO: allow real async search with `inputValue`
 if (optionsCache.current) return optionsCache.current;
 if (fetchSelects) {
-  const selectValues = await fetchSelects();
+  const selectValues = await fetchSelects(inputValue);
   // update matching option at initial load
   const matchingOption = result.find(x => x.value === initialValue);
   if (matchingOption) {
diff --git a/superset-frontend/src/components/ListView/types.ts 
b/superset-frontend/src/components/ListView/types.ts
index 0a1cc24..3df36a8 100644
--- a/superset-frontend/src/components/ListView/types.ts
+++ b/superset-frontend/src/components/ListView/types.ts
@@ -37,7 +37,11 @@ export interface Filter {
   unfilteredLabel?: string;
   selects?: SelectOption[];
   onFilterOpen?: () => void;
-  fetchSelects?: () => Promise;
+  fetchSelects?: (
+filterValue?: string,
+

[incubator-superset] branch release--0.67 created (now 244677c)

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

graceguo pushed a change to branch release--0.67
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


  at 244677c  style(mypy): Enforcing typing for superset (#9943)

No new revisions were added by this update.



[incubator-superset] branch release--0.68 created (now 244677c)

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

graceguo pushed a change to branch release--0.68
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


  at 244677c  style(mypy): Enforcing typing for superset (#9943)

No new revisions were added by this update.



[incubator-superset] branch master updated: style(mypy): Enforcing typing for superset (#9943)

2020-06-03 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 244677c  style(mypy): Enforcing typing for superset (#9943)
244677c is described below

commit 244677cf5e0ecb7c767455e96655af6c18cc58bc
Author: John Bodley <4567245+john-bod...@users.noreply.github.com>
AuthorDate: Wed Jun 3 15:26:12 2020 -0700

style(mypy): Enforcing typing for superset (#9943)

Co-authored-by: John Bodley 
---
 setup.cfg |   2 +-
 superset/app.py   |  66 +
 superset/cli.py   |  56 
 superset/config.py|  21 +--
 superset/exceptions.py|   2 +-
 superset/extensions.py|  45 +++---
 superset/forms.py |  16 +--
 superset/jinja_context.py |  26 ++--
 superset/sql_lab.py   |  76 +-
 superset/sql_parse.py |   6 +-
 superset/stats_logger.py  |  27 ++--
 superset/typing.py|   1 +
 superset/viz.py   | 357 ++
 superset/viz_sip38.py |   3 +-
 tests/viz_tests.py|   2 +-
 15 files changed, 393 insertions(+), 313 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index 1115de9..fc94a24 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -53,7 +53,7 @@ order_by_type = false
 ignore_missing_imports = true
 no_implicit_optional = true
 
-[mypy-superset.bin.*,superset.charts.*,superset.commands.*,superset.common.*,superset.connectors.*,superset.dao.*,superset.dashboards.*,superset.datasets.*,superset.db_engine_specs.*,superset.db_engines.*,superset.examples.*,superset.migrations.*,superset.models.*,uperset.queries.*,superset.security.*,superset.sql_validators.*,superset.tasks.*,superset.translations.*,superset.utils.*,superset.views.chart.*,superset.views.dashboard.*,superset.views.database.*]
+[mypy-superset,superset.app,superset.bin.*,superset.charts.*,superset.cli,superset.commands.*,superset.common.*,superset.config,superset.connectors.*,superset.constants,superset.dataframe,superset.dao.*,superset.dashboards.*,superset.datasets.*,superset.db_engine_specs.*,superset.db_engines.*,superset.errors,superset.examples.*,superset.exceptions,superset.extensions,superset.forms,superset.jinja_context,superset.legacy,superset.migrations.*,superset.models.*,superset.result_set,superset
 [...]
 check_untyped_defs = true
 disallow_untyped_calls = true
 disallow_untyped_defs = true
diff --git a/superset/app.py b/superset/app.py
index 98f1459..18165ed 100644
--- a/superset/app.py
+++ b/superset/app.py
@@ -17,6 +17,7 @@
 
 import logging
 import os
+from typing import Any, Callable, Dict
 
 import wtforms_json
 from flask import Flask, redirect
@@ -41,13 +42,14 @@ from superset.extensions import (
 talisman,
 )
 from superset.security import SupersetSecurityManager
+from superset.typing import FlaskResponse
 from superset.utils.core import pessimistic_connection_handling
 from superset.utils.log import DBEventLogger, get_event_logger_from_cfg_value
 
 logger = logging.getLogger(__name__)
 
 
-def create_app():
+def create_app() -> Flask:
 app = Flask(__name__)
 
 try:
@@ -68,7 +70,7 @@ def create_app():
 
 class SupersetIndexView(IndexView):
 @expose("/")
-def index(self):
+def index(self) -> FlaskResponse:
 return redirect("/superset/welcome")
 
 
@@ -109,8 +111,8 @@ class SupersetAppInitializer:
 abstract = True
 
 # Grab each call into the task and set up an app context
-def __call__(self, *args, **kwargs):
-with flask_app.app_context():
+def __call__(self, *args: Any, **kwargs: Any) -> Any:
+with flask_app.app_context():  # type: ignore
 return task_base.__call__(self, *args, **kwargs)
 
 celery_app.Task = AppContextTask
@@ -454,51 +456,41 @@ class SupersetAppInitializer:
 order to fully init the app
 """
 self.pre_init()
-
 self.setup_db()
-
 self.configure_celery()
-
 self.setup_event_logger()
-
 self.setup_bundle_manifest()
-
 self.register_blueprints()
-
 self.configure_wtf()
-
 self.configure_logging()
-
 self.configure_middlewares()
-
 self.configure_cache()
-
 self.configure_jinja_context()
 
-with self.flask_app.app_context():
+with self.flask_app.app_context():  # type: ignore
 self.init_app_in_ctx()
 
 self.post_init()
 
-def setup_event_logger(self):
+def setup_event_logger(self) -> None:
 _event_logger["event_logger"] = get_event_logger_from_cfg_value(
 self.flask_app.config.get("EVENT_LOGGER", DBEventLogger())
 )
 
-def configure_data_sources(self):
+def configure_data_sources(self) -> None:
 # Registering sources
 module_datasource_map = 

[incubator-superset] branch master updated: feat: [dashboard] notification and warning for auto force refresh (#9886)

2020-06-03 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 dcac860  feat: [dashboard] notification and warning for auto force 
refresh (#9886)
dcac860 is described below

commit dcac860f3e5528ecbc39e58f045c7388adb5c3d0
Author: Grace Guo 
AuthorDate: Wed Jun 3 10:20:56 2020 -0700

feat: [dashboard] notification and warning for auto force refresh (#9886)

* feat: [dashboard] notification and warning for auto force refresh

* fix review comments
---
 .../dashboard/components/Header_spec.jsx   |  8 
 .../components/RefreshIntervalModal_spec.jsx   | 19 +++-
 .../src/dashboard/components/Header.jsx| 40 -
 .../dashboard/components/HeaderActionsDropdown.jsx | 14 ++
 .../dashboard/components/RefreshIntervalModal.jsx  | 50 +-
 .../src/dashboard/components/SaveModal.jsx | 10 -
 .../src/dashboard/containers/DashboardHeader.jsx   |  1 +
 .../src/dashboard/reducers/dashboardState.js   |  1 +
 .../src/dashboard/reducers/getInitialState.js  |  3 ++
 .../src/dashboard/stylesheets/dashboard.less   |  4 ++
 .../src/datasource/DatasourceEditor.jsx|  2 +-
 superset/config.py |  8 
 superset/views/base.py |  2 +
 13 files changed, 156 insertions(+), 6 deletions(-)

diff --git 
a/superset-frontend/spec/javascripts/dashboard/components/Header_spec.jsx 
b/superset-frontend/spec/javascripts/dashboard/components/Header_spec.jsx
index 336a100..b2d7bc0 100644
--- a/superset-frontend/spec/javascripts/dashboard/components/Header_spec.jsx
+++ b/superset-frontend/spec/javascripts/dashboard/components/Header_spec.jsx
@@ -36,6 +36,10 @@ describe('Header', () => {
   dash_edit_perm: true,
   dash_save_perm: true,
   userId: 1,
+  metadata: {},
+  common: {
+conf: {},
+  },
 },
 dashboardTitle: 'title',
 charts: {},
@@ -79,6 +83,7 @@ describe('Header', () => {
   describe('read-only-user', () => {
 const overrideProps = {
   dashboardInfo: {
+...props.dashboardInfo,
 id: 1,
 dash_edit_perm: false,
 dash_save_perm: false,
@@ -121,6 +126,7 @@ describe('Header', () => {
 const overrideProps = {
   editMode: false,
   dashboardInfo: {
+...props.dashboardInfo,
 id: 1,
 dash_edit_perm: true,
 dash_save_perm: true,
@@ -163,6 +169,7 @@ describe('Header', () => {
 const overrideProps = {
   editMode: true,
   dashboardInfo: {
+...props.dashboardInfo,
 id: 1,
 dash_edit_perm: true,
 dash_save_perm: true,
@@ -204,6 +211,7 @@ describe('Header', () => {
   describe('logged-out-user', () => {
 const overrideProps = {
   dashboardInfo: {
+...props.dashboardInfo,
 id: 1,
 dash_edit_perm: false,
 dash_save_perm: false,
diff --git 
a/superset-frontend/spec/javascripts/dashboard/components/RefreshIntervalModal_spec.jsx
 
b/superset-frontend/spec/javascripts/dashboard/components/RefreshIntervalModal_spec.jsx
index 09cb78f..92f34ba 100644
--- 
a/superset-frontend/spec/javascripts/dashboard/components/RefreshIntervalModal_spec.jsx
+++ 
b/superset-frontend/spec/javascripts/dashboard/components/RefreshIntervalModal_spec.jsx
@@ -17,9 +17,11 @@
  * under the License.
  */
 import React from 'react';
-import { mount } from 'enzyme';
+import { mount, shallow } from 'enzyme';
 
+import ModalTrigger from 'src/components/ModalTrigger';
 import RefreshIntervalModal from 
'src/dashboard/components/RefreshIntervalModal';
+import { Modal, Alert } from 'react-bootstrap';
 
 describe('RefreshIntervalModal', () => {
   const mockedProps = {
@@ -44,7 +46,22 @@ describe('RefreshIntervalModal', () => {
   it('should change refreshFrequency with edit mode', () => {
 const wrapper = mount();
 wrapper.instance().handleFrequencyChange({ value: 30 });
+wrapper.instance().onSave();
 expect(mockedProps.onChange).toHaveBeenCalled();
 expect(mockedProps.onChange).toHaveBeenCalledWith(30, 
mockedProps.editMode);
   });
+  it('should show warning message', () => {
+const props = {
+  ...mockedProps,
+  refreshLimit: 3600,
+  refreshWarning: 'Show warning',
+};
+
+const wrapper = shallow();
+wrapper.instance().handleFrequencyChange({ value: 30 });
+expect(wrapper.find(ModalTrigger).dive().find(Alert)).toHaveLength(1);
+
+wrapper.instance().handleFrequencyChange({ value: 3601 });
+expect(wrapper.find(ModalTrigger).dive().find(Alert)).toHaveLength(0);
+  });
 });
diff --git a/superset-frontend/src/dashboard/components/Header.jsx 
b/superset-frontend/src/dashboard/components/Header.jsx
index 89ba785..45c6727 100644
--- 

[incubator-superset] branch master updated: fix(mypy): Resolves regression introducted in #9824 (#9973)

2020-06-03 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 ee777ac  fix(mypy): Resolves regression introducted in #9824 (#9973)
ee777ac is described below

commit ee777acd572dbc24831ce319045e883458257a84
Author: John Bodley <4567245+john-bod...@users.noreply.github.com>
AuthorDate: Wed Jun 3 00:20:34 2020 -0700

fix(mypy): Resolves regression introducted in #9824 (#9973)

Co-authored-by: John Bodley 
---
 superset/common/query_object.py| 4 ++--
 superset/connectors/sqla/models.py | 4 ++--
 superset/tasks/cache.py| 2 +-
 superset/utils/core.py | 8 
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/superset/common/query_object.py b/superset/common/query_object.py
index ea1f3f5..3c5b778 100644
--- a/superset/common/query_object.py
+++ b/superset/common/query_object.py
@@ -58,8 +58,8 @@ class QueryObject:
 """
 
 granularity: Optional[str]
-from_dttm: datetime
-to_dttm: datetime
+from_dttm: Optional[datetime]
+to_dttm: Optional[datetime]
 is_timeseries: bool
 time_shift: Optional[timedelta]
 groupby: List[str]
diff --git a/superset/connectors/sqla/models.py 
b/superset/connectors/sqla/models.py
index 955424f..7236eac 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -714,8 +714,8 @@ class SqlaTable(Model, BaseDatasource):
 self,
 metrics: List[Metric],
 granularity: str,
-from_dttm: datetime,
-to_dttm: datetime,
+from_dttm: Optional[datetime],
+to_dttm: Optional[datetime],
 columns: Optional[List[str]] = None,
 groupby: Optional[List[str]] = None,
 filter: Optional[List[Dict[str, Any]]] = None,
diff --git a/superset/tasks/cache.py b/superset/tasks/cache.py
index b530deb..a5b0199 100644
--- a/superset/tasks/cache.py
+++ b/superset/tasks/cache.py
@@ -163,7 +163,7 @@ class TopNDashboardsStrategy(Strategy):
 def __init__(self, top_n: int = 5, since: str = "7 days ago") -> None:
 super(TopNDashboardsStrategy, self).__init__()
 self.top_n = top_n
-self.since = parse_human_datetime(since)
+self.since = parse_human_datetime(since) if since else None
 
 def get_urls(self) -> List[str]:
 urls = []
diff --git a/superset/utils/core.py b/superset/utils/core.py
index 58a425f..00e3484 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -1022,7 +1022,7 @@ def get_since_until(
 time_shift: Optional[str] = None,
 relative_start: Optional[str] = None,
 relative_end: Optional[str] = None,
-) -> Tuple[datetime, datetime]:
+) -> Tuple[Optional[datetime], Optional[datetime]]:
 """Return `since` and `until` date time tuple from string representations 
of
 time_range, since, until and time_shift.
 
@@ -1078,8 +1078,8 @@ def get_since_until(
 since, until = time_range.split(separator, 1)
 if since and since not in common_time_frames:
 since = add_ago_to_since(since)
-since = parse_human_datetime(since)  # type: ignore
-until = parse_human_datetime(until)  # type: ignore
+since = parse_human_datetime(since) if since else None  # type: 
ignore
+until = parse_human_datetime(until) if until else None  # type: 
ignore
 elif time_range in common_time_frames:
 since, until = common_time_frames[time_range]
 elif time_range == "No filter":
@@ -1100,7 +1100,7 @@ def get_since_until(
 since = since or ""
 if since:
 since = add_ago_to_since(since)
-since = parse_human_datetime(since)  # type: ignore
+since = parse_human_datetime(since) if since else None  # type: ignore
 until = parse_human_datetime(until) if until else relative_end  # 
type: ignore
 
 if time_shift:



[incubator-superset] branch master updated (1d9dbcd -> 3fd6e06)

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

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


from 1d9dbcd  fix: pinot select query logic (#9954)
 add 3fd6e06  fix #8302, disabling save button when can_add: false, 
can_overwrite: false (#9456)

No new revisions were added by this update.

Summary of changes:
 superset-frontend/src/explore/components/ExploreViewContainer.jsx | 3 ++-
 superset-frontend/src/explore/components/QueryAndSaveBtns.jsx | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)



[incubator-superset] branch master updated (209392e -> 1d9dbcd)

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

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


from 209392e  feat: make CRUD annotations inline (#9888)
 add 1d9dbcd  fix: pinot select query logic (#9954)

No new revisions were added by this update.

Summary of changes:
 superset/db_engine_specs/pinot.py| 22 --
 tests/db_engine_specs/pinot_tests.py |  2 +-
 2 files changed, 9 insertions(+), 15 deletions(-)



[incubator-superset] branch master updated: feat: make CRUD annotations inline (#9888)

2020-06-03 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 209392e  feat: make CRUD annotations inline (#9888)
209392e is described below

commit 209392e9efaca0f2331e621745dd87959509dd8c
Author: Maxime Beauchemin 
AuthorDate: Tue Jun 2 23:12:37 2020 -0700

feat: make CRUD annotations inline (#9888)

* feat: make CRUD annotations inline

This makes the annotations inline of the "annotation layers". Originally
they were setup as separate ModelViews because of a bug in FAB.

* fix pylint
---
 superset/app.py   | 10 +-
 superset/views/annotations.py | 27 +--
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/superset/app.py b/superset/app.py
index b1ce22c..98f1459 100644
--- a/superset/app.py
+++ b/superset/app.py
@@ -199,15 +199,6 @@ class SupersetAppInitializer:
 category_icon="",
 )
 appbuilder.add_view(
-AnnotationModelView,
-"Annotations",
-label=__("Annotations"),
-icon="fa-comments",
-category="Manage",
-category_label=__("Manage"),
-category_icon="",
-)
-appbuilder.add_view(
 DatabaseView,
 "Databases",
 label=__("Databases"),
@@ -288,6 +279,7 @@ class SupersetAppInitializer:
 appbuilder.add_view_no_menu(SliceAsync)
 appbuilder.add_view_no_menu(SqlLab)
 appbuilder.add_view_no_menu(SqlMetricInlineView)
+appbuilder.add_view_no_menu(AnnotationModelView)
 appbuilder.add_view_no_menu(Superset)
 appbuilder.add_view_no_menu(TableColumnInlineView)
 appbuilder.add_view_no_menu(TableModelView)
diff --git a/superset/views/annotations.py b/superset/views/annotations.py
index 6d87972..e29883d 100644
--- a/superset/views/annotations.py
+++ b/superset/views/annotations.py
@@ -14,6 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from flask_appbuilder import CompactCRUDMixin
 from flask_appbuilder.models.sqla.interface import SQLAInterface
 from flask_babel import lazy_gettext as _
 from wtforms.validators import StopValidation
@@ -21,7 +22,7 @@ from wtforms.validators import StopValidation
 from superset.constants import RouteMethod
 from superset.models.annotations import Annotation, AnnotationLayer
 
-from .base import DeleteMixin, SupersetModelView
+from .base import SupersetModelView
 
 
 class StartEndDttmValidator:  # pylint: disable=too-few-public-methods
@@ -43,17 +44,17 @@ class StartEndDttmValidator:  # pylint: 
disable=too-few-public-methods
 
 
 class AnnotationModelView(
-SupersetModelView, DeleteMixin
+SupersetModelView, CompactCRUDMixin
 ):  # pylint: disable=too-many-ancestors
 datamodel = SQLAInterface(Annotation)
 include_route_methods = RouteMethod.CRUD_SET
 
-list_title = _("List Annotation")
+list_title = _("Annotations")
 show_title = _("Show Annotation")
 add_title = _("Add Annotation")
 edit_title = _("Edit Annotation")
 
-list_columns = ["layer", "short_descr", "start_dttm", "end_dttm"]
+list_columns = ["short_descr", "start_dttm", "end_dttm"]
 edit_columns = [
 "layer",
 "short_descr",
@@ -67,10 +68,10 @@ class AnnotationModelView(
 
 label_columns = {
 "layer": _("Layer"),
-"short_descr": _("Short Descr"),
-"start_dttm": _("Start Dttm"),
-"end_dttm": _("End Dttm"),
-"long_descr": _("Long Descr"),
+"short_descr": _("Label"),
+"long_descr": _("Description"),
+"start_dttm": _("Start"),
+"end_dttm": _("End"),
 "json_metadata": _("JSON Metadata"),
 }
 
@@ -91,18 +92,16 @@ class AnnotationModelView(
 self.pre_add(item)
 
 
-class AnnotationLayerModelView(
-SupersetModelView, DeleteMixin
-):  # pylint: disable=too-many-ancestors
+class AnnotationLayerModelView(SupersetModelView):  # pylint: 
disable=too-many-ancestors
 datamodel = SQLAInterface(AnnotationLayer)
 include_route_methods = RouteMethod.CRUD_SET | {RouteMethod.API_READ}
-
-list_title = _("List Annotation Layer")
+related_views = [AnnotationModelView]
+list_title = _("Annotation Layers")
 show_title = _("Show Annotation Layer")
 add_title = _("Add Annotation Layer")
 edit_title = _("Edit Annotation Layer")
 
-list_columns = ["id", "name"]
+list_columns = ["name", "descr"]
 edit_columns = ["name", "descr"]
 add_columns = edit_columns