You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2024/02/22 21:09:55 UTC

(superset) branch 3.1 updated (7f3012a01b -> 10d2a6f189)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a change to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git


 discard 7f3012a01b fix: Failed to execute importScripts on worker-css (#27191)
    omit 0eec53ad96 fix(sqllab): typeahead search is broken in db selector (#27181)
    omit 1382aa6f39 fix: CSRF exempt unit_tests (#27168)
    omit 7b589878b7 fix: unlock and bump werkzeug (#27164)
     new 9a842dc1ea fix(ci): mypy pre-commit issues (#27161)
     new 1abe0054dc fix: CSRF exempt unit_tests (#27168)
     new 7ff823b02f fix(sqllab): typeahead search is broken in db selector (#27181)
     new 10d2a6f189 fix: Failed to execute importScripts on worker-css (#27191)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (7f3012a01b)
            \
             N -- N -- N   refs/heads/3.1 (10d2a6f189)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 requirements/base.txt                             | 22 ++++++++++++++++------
 requirements/development.txt                      |  2 ++
 requirements/integration.txt                      |  6 ++++++
 requirements/testing.txt                          |  4 ++--
 setup.py                                          |  1 +
 superset/sqllab/api.py                            |  6 +++++-
 superset/views/core.py                            |  3 +--
 tests/integration_tests/async_events/api_tests.py |  4 +++-
 tests/integration_tests/charts/data/api_tests.py  |  2 +-
 9 files changed, 37 insertions(+), 13 deletions(-)


(superset) 03/04: fix(sqllab): typeahead search is broken in db selector (#27181)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 7ff823b02f427cf352565e97720d669e8d75daa3
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Wed Feb 21 06:03:41 2024 -0800

    fix(sqllab): typeahead search is broken in db selector (#27181)
    
    (cherry picked from commit 8fbaf84f66585146c17c23ec3e530d59902efd75)
---
 .../DatabaseSelector/DatabaseSelector.test.tsx     | 26 ++++++++++++++++++++++
 .../src/components/DatabaseSelector/index.tsx      |  4 ++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx
index 874d22ea6b..18e6769912 100644
--- a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx
+++ b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx
@@ -229,6 +229,32 @@ test('Should database select display options', async () => {
   expect(await screen.findByText('test-mysql')).toBeInTheDocument();
 });
 
+test('Should fetch the search keyword when total count exceeds initial options', async () => {
+  fetchMock.get(
+    databaseApiRoute,
+    {
+      ...fakeDatabaseApiResult,
+      count: fakeDatabaseApiResult.result.length + 1,
+    },
+    { overwriteRoutes: true },
+  );
+
+  const props = createProps();
+  render(<DatabaseSelector {...props} />, { useRedux: true, store });
+  const select = screen.getByRole('combobox', {
+    name: 'Select database or type to search databases',
+  });
+  await waitFor(() =>
+    expect(fetchMock.calls(databaseApiRoute)).toHaveLength(1),
+  );
+  expect(select).toBeInTheDocument();
+  userEvent.type(select, 'keywordtest');
+  await waitFor(() =>
+    expect(fetchMock.calls(databaseApiRoute)).toHaveLength(2),
+  );
+  expect(fetchMock.calls(databaseApiRoute)[1][0]).toContain('keywordtest');
+});
+
 test('should show empty state if there are no options', async () => {
   fetchMock.reset();
   fetchMock.get(databaseApiRoute, { result: [] });
diff --git a/superset-frontend/src/components/DatabaseSelector/index.tsx b/superset-frontend/src/components/DatabaseSelector/index.tsx
index 7b4afd9af0..0c0268db5c 100644
--- a/superset-frontend/src/components/DatabaseSelector/index.tsx
+++ b/superset-frontend/src/components/DatabaseSelector/index.tsx
@@ -167,7 +167,7 @@ export default function DatabaseSelector({
         });
         const endpoint = `/api/v1/database/?q=${queryParams}`;
         return SupersetClient.get({ endpoint }).then(({ json }) => {
-          const { result } = json;
+          const { result, count } = json;
           if (getDbList) {
             getDbList(result);
           }
@@ -189,7 +189,7 @@ export default function DatabaseSelector({
 
           return {
             data: options,
-            totalCount: options.length,
+            totalCount: count ?? options.length,
           };
         });
       },


(superset) 02/04: fix: CSRF exempt unit_tests (#27168)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1abe0054dcc673abe7c5912c74f806bc76d8663d
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Tue Feb 20 16:18:30 2024 +0000

    fix: CSRF exempt unit_tests (#27168)
---
 .github/workflows/superset-python-unittest.yml | 14 +++++++++++---
 tests/unit_tests/security/api_test.py          |  6 +++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/superset-python-unittest.yml b/.github/workflows/superset-python-unittest.yml
index 5f7639e67c..6eb9dcae95 100644
--- a/.github/workflows/superset-python-unittest.yml
+++ b/.github/workflows/superset-python-unittest.yml
@@ -5,8 +5,16 @@ on:
   push:
     branches-ignore:
       - "dependabot/npm_and_yarn/**"
+    paths:
+      - "superset/**"
+      - "requirements/**"
+      - "tests/unit_tests/**"
   pull_request:
     types: [synchronize, opened, reopened, ready_for_review]
+    paths:
+      - "superset/**"
+      - "requirements/**"
+      - "tests/unit_tests/**"
 
 jobs:
   unit-tests:
@@ -34,9 +42,9 @@ jobs:
         uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
-          cache: 'pip'
-          cache-dependency-path: 'requirements/testing.txt'
-# TODO: separated requirements.txt file just for unit tests
+          cache: "pip"
+          cache-dependency-path: "requirements/testing.txt"
+      # TODO: separated requirements.txt file just for unit tests
       - name: Install dependencies
         if: steps.check.outcome == 'failure'
         uses: ./.github/actions/cached-dependencies
diff --git a/tests/unit_tests/security/api_test.py b/tests/unit_tests/security/api_test.py
index 5d596073e9..73227166c2 100644
--- a/tests/unit_tests/security/api_test.py
+++ b/tests/unit_tests/security/api_test.py
@@ -28,4 +28,8 @@ def test_csrf_not_exempt(app_context: None) -> None:
     """
     Test that REST API is not exempt from CSRF.
     """
-    assert csrf._exempt_blueprints == {"MenuApi", "SecurityApi", "OpenApi"}
+    assert {blueprint.name for blueprint in csrf._exempt_blueprints} == {
+        "MenuApi",
+        "SecurityApi",
+        "OpenApi",
+    }


(superset) 04/04: fix: Failed to execute importScripts on worker-css (#27191)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 10d2a6f189962f3c14c1e674ca21f151838fc194
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Wed Feb 21 13:01:26 2024 -0500

    fix: Failed to execute importScripts on worker-css (#27191)
    
    (cherry picked from commit 983a1646c439116d0f65b7f2e9907ebb5046d672)
---
 .../src/components/AsyncAceEditor/index.tsx           |  4 ++++
 superset-frontend/src/types/ace-builds.ts             | 19 +++++++++++++++++++
 superset-frontend/webpack.config.js                   |  4 ++++
 superset/views/core.py                                |  2 +-
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/superset-frontend/src/components/AsyncAceEditor/index.tsx b/superset-frontend/src/components/AsyncAceEditor/index.tsx
index 2e499e150b..1b755f50ef 100644
--- a/superset-frontend/src/components/AsyncAceEditor/index.tsx
+++ b/superset-frontend/src/components/AsyncAceEditor/index.tsx
@@ -24,11 +24,15 @@ import {
   TextMode as OrigTextMode,
 } from 'brace';
 import AceEditor, { IAceEditorProps } from 'react-ace';
+import { config } from 'ace-builds';
 import { acequire } from 'ace-builds/src-noconflict/ace';
 import AsyncEsmComponent, {
   PlaceholderProps,
 } from 'src/components/AsyncEsmComponent';
 import useEffectEvent from 'src/hooks/useEffectEvent';
+import cssWorkerUrl from 'ace-builds/src-noconflict/worker-css';
+
+config.setModuleUrl('ace/mode/css_worker', cssWorkerUrl);
 
 export interface AceCompleterKeywordData {
   name: string;
diff --git a/superset-frontend/src/types/ace-builds.ts b/superset-frontend/src/types/ace-builds.ts
new file mode 100644
index 0000000000..0c34a85403
--- /dev/null
+++ b/superset-frontend/src/types/ace-builds.ts
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+declare module 'ace-builds/src-noconflict/worker-css';
diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js
index dea99be2cf..2fa922873e 100644
--- a/superset-frontend/webpack.config.js
+++ b/superset-frontend/webpack.config.js
@@ -346,6 +346,10 @@ const config = {
         ],
         use: [babelLoader],
       },
+      {
+        test: /ace-builds.*\/worker-.*$/,
+        type: 'asset/resource',
+      },
       // react-hot-loader use "ProxyFacade", which is a wrapper for react Component
       // see https://github.com/gaearon/react-hot-loader/issues/1311
       // TODO: refactor recurseReactClone
diff --git a/superset/views/core.py b/superset/views/core.py
index 3e895e6b4b..12230680ed 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# pylint: disable=invalid-name
+# pylint: disable=invalid-name,too-many-lines
 from __future__ import annotations
 
 import contextlib


(superset) 01/04: fix(ci): mypy pre-commit issues (#27161)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 9a842dc1eabbb5469f421b6a4f8566ee167d379f
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Mon Feb 19 16:29:20 2024 +0000

    fix(ci): mypy pre-commit issues (#27161)
    
    (cherry picked from commit 8dc6cbe206b4a4e5da365f66c3d2fcfec7dd9c6b)
---
 superset/sqllab/api.py                         | 4 +++-
 superset/sqllab/execution_context_convertor.py | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/superset/sqllab/api.py b/superset/sqllab/api.py
index 6be378a9b5..eeb95e6aad 100644
--- a/superset/sqllab/api.py
+++ b/superset/sqllab/api.py
@@ -343,7 +343,9 @@ class SqlLabRestApi(BaseSupersetApi):
         # return the result without special encoding
         return json_success(
             json.dumps(
-                result, default=utils.json_iso_dttm_ser, ignore_nan=True, encoding=None
+                result,
+                default=utils.json_iso_dttm_ser,
+                ignore_nan=True,
             ),
             200,
         )
diff --git a/superset/sqllab/execution_context_convertor.py b/superset/sqllab/execution_context_convertor.py
index 430db0d52f..a1e7a86d0a 100644
--- a/superset/sqllab/execution_context_convertor.py
+++ b/superset/sqllab/execution_context_convertor.py
@@ -60,7 +60,6 @@ class ExecutionContextConvertor:
                 ),
                 default=utils.pessimistic_json_iso_dttm_ser,
                 ignore_nan=True,
-                encoding=None,
             )
 
         return json.dumps(