[incubator-superset] branch master updated: fix: [logging] fix render chart error type (#10000)
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 656cdfb fix: [logging] fix render chart error type (#1) 656cdfb is described below commit 656cdfb86709fa525c1122e359d2e767c6174351 Author: Grace Guo AuthorDate: Fri Jun 5 14:44:52 2020 -0700 fix: [logging] fix render chart error type (#1) --- superset-frontend/src/chart/Chart.jsx| 4 ++-- superset-frontend/src/logger/LogUtils.js | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/chart/Chart.jsx b/superset-frontend/src/chart/Chart.jsx index 5fc9bc8..4205360 100644 --- a/superset-frontend/src/chart/Chart.jsx +++ b/superset-frontend/src/chart/Chart.jsx @@ -21,7 +21,7 @@ import React from 'react'; import { Alert } from 'react-bootstrap'; import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags'; -import { Logger, LOG_ACTIONS_RENDER_CHART_CONTAINER } from '../logger/LogUtils'; +import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils'; import Loading from '../components/Loading'; import RefreshChartOverlay from '../components/RefreshChartOverlay'; import ErrorMessageWithStackTrace from '../components/ErrorMessage/ErrorMessageWithStackTrace'; @@ -128,7 +128,7 @@ class Chart extends React.PureComponent { info ? info.componentStack : null, ); -actions.logEvent(LOG_ACTIONS_RENDER_CHART_CONTAINER, { +actions.logEvent(LOG_ACTIONS_RENDER_CHART, { slice_id: chartId, has_err: true, error_details: error.toString(), diff --git a/superset-frontend/src/logger/LogUtils.js b/superset-frontend/src/logger/LogUtils.js index 14299aa..17e4a0f 100644 --- a/superset-frontend/src/logger/LogUtils.js +++ b/superset-frontend/src/logger/LogUtils.js @@ -25,7 +25,6 @@ export const LOG_ACTIONS_MOUNT_DASHBOARD = 'mount_dashboard'; export const LOG_ACTIONS_MOUNT_EXPLORER = 'mount_explorer'; export const LOG_ACTIONS_SELECT_DASHBOARD_TAB = 'select_dashboard_tab'; -export const LOG_ACTIONS_RENDER_CHART_CONTAINER = 'render_chart_container'; export const LOG_ACTIONS_FORCE_REFRESH_CHART = 'force_refresh_chart'; export const LOG_ACTIONS_CHANGE_EXPLORE_CONTROLS = 'change_explore_controls'; export const LOG_ACTIONS_TOGGLE_EDIT_DASHBOARD = 'toggle_edit_dashboard'; @@ -57,7 +56,6 @@ export const LOG_EVENT_TYPE_USER = new Set([ LOG_ACTIONS_PERIODIC_RENDER_DASHBOARD, LOG_ACTIONS_OMNIBAR_TRIGGERED, LOG_ACTIONS_MOUNT_EXPLORER, - LOG_ACTIONS_RENDER_CHART_CONTAINER, ]); export const Logger = {
[incubator-superset] branch master updated: feat: finalize Word Cloud move to new chart data endpoint (#9975)
This is an automated email from the ASF dual-hosted git repository. villebro 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 5c4d4f1 feat: finalize Word Cloud move to new chart data endpoint (#9975) 5c4d4f1 is described below commit 5c4d4f16b323cd7f8dcdcbd788df3e6dd83200fc Author: Ville Brofeldt <33317356+ville...@users.noreply.github.com> AuthorDate: Fri Jun 5 14:08:46 2020 +0300 feat: finalize Word Cloud move to new chart data endpoint (#9975) * remove word cloud from viz.py * Fix Run in SQL Lab * remove deprecated python tests * break out legacy endpoint type into function * Break out exploreChart from exportChart and implement results type * Fix jest tests and refactor accordingly * lint * Rename v1 payload function * Add dashboard id to v1 chart data request url params * Add support for domain sharding to v1 chart data request --- .../spec/javascripts/chart/chartActions_spec.js| 18 +++-- .../sqllab/ExploreResultsButton_spec.jsx | 6 +- .../SqlLab/components/ExploreCtasResultsButton.jsx | 2 +- .../src/SqlLab/components/ExploreResultsButton.jsx | 4 +- superset-frontend/src/chart/chartAction.js | 67 +++- .../dashboard/components/gridComponents/Chart.jsx | 10 ++- .../src/explore/components/DisplayQueryButton.jsx | 6 +- .../explore/components/ExploreActionButtons.jsx| 12 ++- superset-frontend/src/explore/exploreUtils.js | 91 +- .../SqlLab/components/ExploreCtasResultsButton.jsx | 4 +- superset/charts/api.py | 40 +++--- superset/common/query_context.py | 3 +- superset/viz.py| 18 - superset/viz_sip38.py | 13 tests/core_tests.py| 81 --- 15 files changed, 177 insertions(+), 198 deletions(-) diff --git a/superset-frontend/spec/javascripts/chart/chartActions_spec.js b/superset-frontend/spec/javascripts/chart/chartActions_spec.js index 15566dd..b8205e6 100644 --- a/superset-frontend/spec/javascripts/chart/chartActions_spec.js +++ b/superset-frontend/spec/javascripts/chart/chartActions_spec.js @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import URI from 'urijs'; import fetchMock from 'fetch-mock'; import sinon from 'sinon'; @@ -25,17 +26,16 @@ import * as exploreUtils from 'src/explore/exploreUtils'; import * as actions from 'src/chart/chartAction'; describe('chart actions', () => { - const V1_URL = '/http//localhost/api/v1/chart/data'; const MOCK_URL = '/mockURL'; let dispatch; - let urlStub; + let getExploreUrlStub; + let getChartDataUriStub; let metadataRegistryStub; let buildQueryRegistryStub; let fakeMetadata; const setupDefaultFetchMock = () => { fetchMock.post(MOCK_URL, { json: {} }, { overwriteRoutes: true }); -fetchMock.post(V1_URL, { json: {} }, { overwriteRoutes: true }); }; beforeAll(() => { @@ -46,9 +46,12 @@ describe('chart actions', () => { beforeEach(() => { dispatch = sinon.spy(); -urlStub = sinon +getExploreUrlStub = sinon .stub(exploreUtils, 'getExploreUrl') .callsFake(() => MOCK_URL); +getChartDataUriStub = sinon + .stub(exploreUtils, 'getChartDataUri') + .callsFake(() => URI(MOCK_URL)); fakeMetadata = { useLegacyApi: true }; metadataRegistryStub = sinon .stub(chartlib, 'getChartMetadataRegistry') @@ -65,7 +68,8 @@ describe('chart actions', () => { }); afterEach(() => { -urlStub.restore(); +getExploreUrlStub.restore(); +getChartDataUriStub.restore(); fetchMock.resetHistory(); metadataRegistryStub.restore(); buildQueryRegistryStub.restore(); @@ -80,8 +84,8 @@ describe('chart actions', () => { const actionThunk = actions.postChartFormData({}); await actionThunk(dispatch); - expect(fetchMock.calls(V1_URL)).toHaveLength(1); - expect(fetchMock.calls(V1_URL)[0][1].body).toBe( + expect(fetchMock.calls(MOCK_URL)).toHaveLength(1); + expect(fetchMock.calls(MOCK_URL)[0][1].body).toBe( JSON.stringify({ some_param: 'fake query!', result_type: 'full', diff --git a/superset-frontend/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx b/superset-frontend/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx index fee2ba5..ad6639b 100644 --- a/superset-frontend/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx +++ b/superset-frontend/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx @@ -179,12 +179,14 @@ describe('ExploreResultsButton', () => { beforeEach(() => { sinon.stub(exploreUtils, 'getExploreUrl').callsFake(() =>
[incubator-superset] branch master updated: style(mypy): Enforcing typing for superset.views (#9939)
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 63e0188 style(mypy): Enforcing typing for superset.views (#9939) 63e0188 is described below commit 63e0188f45134c25267d183f5d7391577f9a6d63 Author: John Bodley <4567245+john-bod...@users.noreply.github.com> AuthorDate: Fri Jun 5 08:44:11 2020 -0700 style(mypy): Enforcing typing for superset.views (#9939) Co-authored-by: John Bodley --- setup.cfg| 2 +- superset/connectors/base/models.py | 18 +- superset/connectors/druid/models.py | 2 +- superset/connectors/sqla/models.py | 2 +- superset/sql_validators/base.py | 6 +- superset/sql_validators/presto_db.py | 2 +- superset/tasks/schedules.py | 6 +- superset/views/annotations.py| 8 +- superset/views/api.py| 7 +- superset/views/base.py | 56 +++-- superset/views/base_api.py | 34 ++- superset/views/base_schemas.py | 25 +- superset/views/core.py | 443 ++- superset/views/datasource.py | 11 +- superset/views/filters.py| 7 +- superset/views/log/__init__.py | 4 +- superset/views/log/api.py| 2 +- superset/views/schedules.py | 35 ++- superset/views/sql_lab.py| 43 ++-- superset/views/tags.py | 23 +- superset/views/utils.py | 26 +- superset/viz.py | 2 +- superset/viz_sip38.py| 16 +- 23 files changed, 440 insertions(+), 340 deletions(-) diff --git a/setup.cfg b/setup.cfg index fc94a24..81c7ed2 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,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 [...] +[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/connectors/base/models.py b/superset/connectors/base/models.py index 8ead670..0533aa1 100644 --- a/superset/connectors/base/models.py +++ b/superset/connectors/base/models.py @@ -62,14 +62,26 @@ class BaseDatasource( # --- __tablename__: Optional[str] = None # {connector_name}_datasource baselink: Optional[str] = None # url portion pointing to ModelView endpoint -column_class: Optional[Type] = None # link to derivative of BaseColumn -metric_class: Optional[Type] = None # link to derivative of BaseMetric + +@property +def column_class(self) -> Type: +# link to derivative of BaseColumn +raise NotImplementedError() + +@property +def metric_class(self) -> Type: +# link to derivative of BaseMetric +raise NotImplementedError() + owner_class: Optional[User] = None # Used to do code highlighting when displaying the query in the UI query_language: Optional[str] = None -name = None # can be a Column or a property pointing to one +@property +def name(self) -> str: +# can be a Column or a property pointing to one +raise NotImplementedError() # --- diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py index b0a3332..50f1637 100644 --- a/superset/connectors/druid/models.py +++ b/superset/connectors/druid/models.py @@ -548,7 +548,7 @@ class DruidDatasource(Model, BaseDatasource): return [c.column_name for c in self.columns if c.is_numeric] @property -def name(self) -> str: # type: ignore +def name(self) -> str: return self.datasource_name @property diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index