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/05/30 13:39:52 UTC
(superset) 01/01: fix: do not close database modal on mask click (#28750)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 4.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0e5593f8d7464a8b9aafcb1186386f6349031df8
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Wed May 29 13:53:35 2024 -0700
fix: do not close database modal on mask click (#28750)
(cherry picked from commit cbd3fa2190a72cac6f6b57c62bec71e3cecf4240)
---
.../src/features/databases/DatabaseModal/index.tsx | 21 ++++++++++++---------
tests/unit_tests/db_engine_specs/test_presto.py | 3 +--
tests/unit_tests/db_engine_specs/test_trino.py | 4 +---
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.tsx
index 47c9a8b658..06a655b456 100644
--- a/superset-frontend/src/features/databases/DatabaseModal/index.tsx
+++ b/superset-frontend/src/features/databases/DatabaseModal/index.tsx
@@ -1715,35 +1715,36 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
) {
return (
<Modal
+ centered
css={(theme: SupersetTheme) => [
antDModalNoPaddingStyles,
antDModalStyles(theme),
formHelperStyles(theme),
formStyles(theme),
]}
+ footer={renderModalFooter()}
+ maskClosable={false}
name="database"
- onHandledPrimaryAction={onSave}
onHide={onClose}
+ onHandledPrimaryAction={onSave}
primaryButtonName={t('Connect')}
- width="500px"
- centered
show={show}
title={<h4>{t('Connect a database')}</h4>}
- footer={renderModalFooter()}
+ width="500px"
>
<ModalHeader
- isLoading={isLoading}
- isEditMode={isEditMode}
- useSqlAlchemyForm={useSqlAlchemyForm}
- hasConnectedDb={hasConnectedDb}
db={db}
dbName={dbName}
dbModel={dbModel}
fileList={fileList}
+ hasConnectedDb={hasConnectedDb}
+ isEditMode={isEditMode}
+ isLoading={isLoading}
+ useSqlAlchemyForm={useSqlAlchemyForm}
/>
- {passwordNeededField()}
{confirmOverwriteField()}
{importingErrorAlert()}
+ {passwordNeededField()}
</Modal>
);
}
@@ -1771,6 +1772,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
<h4>{isEditMode ? t('Edit database') : t('Connect a database')}</h4>
}
footer={modalFooter}
+ maskClosable={false}
>
<StyledStickyHeader>
<TabHeader>
@@ -1930,6 +1932,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
show={show}
title={<h4>{t('Connect a database')}</h4>}
footer={renderModalFooter()}
+ maskClosable={false}
>
{!isLoading && hasConnectedDb ? (
<>
diff --git a/tests/unit_tests/db_engine_specs/test_presto.py b/tests/unit_tests/db_engine_specs/test_presto.py
index 08ee5173ea..5c91bc87fc 100644
--- a/tests/unit_tests/db_engine_specs/test_presto.py
+++ b/tests/unit_tests/db_engine_specs/test_presto.py
@@ -24,7 +24,6 @@ from pyhive.sqlalchemy_presto import PrestoDialect
from sqlalchemy import sql, text, types
from sqlalchemy.engine.url import make_url
-from superset.sql_parse import Table
from superset.utils.core import GenericDataType
from tests.unit_tests.db_engine_specs.utils import (
assert_column_spec,
@@ -135,7 +134,7 @@ def test_where_latest_partition(
str(
PrestoEngineSpec.where_latest_partition( # type: ignore
database=mock.MagicMock(),
- table=Table("table"),
+ table_name="table",
query=sql.select(text("* FROM table")),
columns=[
{
diff --git a/tests/unit_tests/db_engine_specs/test_trino.py b/tests/unit_tests/db_engine_specs/test_trino.py
index 8e67fffe76..df86b4701f 100644
--- a/tests/unit_tests/db_engine_specs/test_trino.py
+++ b/tests/unit_tests/db_engine_specs/test_trino.py
@@ -38,14 +38,12 @@ from superset.db_engine_specs.exceptions import (
SupersetDBAPIOperationalError,
SupersetDBAPIProgrammingError,
)
-from superset.sql_parse import Table
from superset.superset_typing import ResultSetColumnType, SQLAColumnType, SQLType
from superset.utils.core import GenericDataType
from tests.unit_tests.db_engine_specs.utils import (
assert_column_spec,
assert_convert_dttm,
)
-from tests.unit_tests.fixtures.common import dttm
def _assert_columns_equal(actual_cols, expected_cols) -> None:
@@ -576,7 +574,7 @@ def test_where_latest_partition(
str(
TrinoEngineSpec.where_latest_partition( # type: ignore
database=MagicMock(),
- table=Table("table"),
+ table_name="table",
query=sql.select(text("* FROM table")),
columns=[
{