From dbbf58c10d20ffccd1d2e035db79e9fafe02a9d7 Mon Sep 17 00:00:00 2001 From: AAfghahi <48933336+AAfghahi@users.noreply.github.com> Date: Fri, 11 Jun 2021 11:55:17 -0400 Subject: [PATCH 1/3] fix: add icons (#15122) * added alerts * revisions * added icon --- .../src/views/CRUD/data/database/DatabaseModal/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 40721000a9ed0..e35020065974d 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -361,6 +361,7 @@ const DatabaseModal: FunctionComponent = ({ ))} antDAlertStyles(theme)} type="info" message={t('Want to add a new database?')} @@ -532,6 +533,7 @@ const DatabaseModal: FunctionComponent = ({ antDAlertStyles(theme)} message="Additional fields may be required" + showIcon description={ <> Select databases require additional fields to be completed in @@ -548,7 +550,6 @@ const DatabaseModal: FunctionComponent = ({ } type="info" - showIcon /> )} @@ -660,6 +661,7 @@ const DatabaseModal: FunctionComponent = ({ antDAlertStyles(theme)} type="info" + showIcon message={t('Whitelisting IPs')} description={connectionAlert.WHITELISTED_IPS} /> From a95c06e5565f37b208bf06a37f69588ed4b74784 Mon Sep 17 00:00:00 2001 From: Arash Date: Wed, 16 Jun 2021 17:13:43 -0400 Subject: [PATCH 2/3] fixed typescript error, made test better --- .../data/database/DatabaseModal/index.tsx | 2 +- tests/databases/api_tests.py | 97 ++++++------------- 2 files changed, 32 insertions(+), 67 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index b8009128639b0..945b8429ad89d 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -237,7 +237,7 @@ function dbReducer( if (action.payload?.parameters?.credentials_info) { // deserialize credentials info for big query editting - action.payload.parameters.credentials_info = JSON.stringify( + deserializeExtraJSON = JSON.stringify( action.payload?.parameters.credentials_info, ); } diff --git a/tests/databases/api_tests.py b/tests/databases/api_tests.py index 479a4dfd6c0ff..13a607accf923 100644 --- a/tests/databases/api_tests.py +++ b/tests/databases/api_tests.py @@ -1675,74 +1675,39 @@ def test_validate_parameters_invalid_payload_schema(self): response = json.loads(rv.data.decode("utf-8")) assert rv.status_code == 422 - invalid_schema = response["errors"][0]["extra"]["invalid"][0] - # This is done because this array of errors does not have a deterministic order - if invalid_schema == "engine": - assert response == { - "errors": [ - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["engine"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, - }, - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["configuration_method"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, - }, - ] - } - else: - assert response == { - "errors": [ - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["configuration_method"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, + response["errors"].sort(key=lambda error: error["extra"]["invalid"][0]) + assert response == { + "errors": [ + { + "message": "Missing data for required field.", + "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", + "level": "error", + "extra": { + "invalid": ["configuration_method"], + "issue_codes": [ + { + "code": 1020, + "message": "Issue 1020 - The submitted payload has the incorrect schema.", + } + ], }, - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["engine"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, + }, + { + "message": "Missing data for required field.", + "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", + "level": "error", + "extra": { + "invalid": ["engine"], + "issue_codes": [ + { + "code": 1020, + "message": "Issue 1020 - The submitted payload has the incorrect schema.", + } + ], }, - ] - } + }, + ] + } def test_validate_parameters_missing_fields(self): self.login(username="admin") From 4f0104ff0cc73af32f5fb7c92f2568d5eb80ca8d Mon Sep 17 00:00:00 2001 From: Arash Date: Wed, 16 Jun 2021 17:49:07 -0400 Subject: [PATCH 3/3] credentials info is no longer required --- tests/databases/api_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/databases/api_tests.py b/tests/databases/api_tests.py index 13a607accf923..59023cca4ba75 100644 --- a/tests/databases/api_tests.py +++ b/tests/databases/api_tests.py @@ -1498,7 +1498,6 @@ def test_available(self, app, get_available_engine_specs): "x-encrypted-extra": True, } }, - "required": ["credentials_info"], "type": "object", }, "preferred": True,