You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/08/16 05:49:03 UTC
[superset] 13/34: feat: Added multi-regional IPs to Database
Connections (#16170)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 1.3
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 2b6a8652ecdda4f94e89361b192d74089257790f
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Tue Aug 10 20:25:49 2021 -0400
feat: Added multi-regional IPs to Database Connections (#16170)
* added google alert
* multi-regional IPs
* beto revisions
* Update superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
Co-authored-by: Beto Dealmeida <ro...@dealmeida.net>
* Update superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
Co-authored-by: Beto Dealmeida <ro...@dealmeida.net>
* Update superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
Co-authored-by: Beto Dealmeida <ro...@dealmeida.net>
Co-authored-by: Beto Dealmeida <ro...@dealmeida.net>
(cherry picked from commit 2dc0bdda5d5016dc8743b7d36f7e9afcb84ad106)
---
.../CRUD/data/database/DatabaseModal/index.tsx | 47 +++++++++++++---------
1 file changed, 29 insertions(+), 18 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 9683c40..54c9702 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -848,25 +848,36 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
setTabKey(key);
};
- const renderStepTwoAlert = () =>
- db?.engine && (
- <StyledAlertMargin>
- <Alert
- closable={false}
- css={(theme: SupersetTheme) => antDAlertStyles(theme)}
- type="info"
- showIcon
- message={
- engineSpecificAlertMapping[db.engine]?.message ||
- connectionAlert?.DEFAULT?.message
- }
- description={
- engineSpecificAlertMapping[db.engine]?.description ||
- connectionAlert?.DEFAULT?.description
- }
- />
- </StyledAlertMargin>
+ const renderStepTwoAlert = () => {
+ const { hostname } = window.location;
+ let ipAlert = connectionAlert?.REGIONAL_IPS?.default || '';
+ const regionalIPs = connectionAlert?.REGIONAL_IPS || {};
+ Object.entries(regionalIPs).forEach(([regex, ipRange]) => {
+ if (regex.match(hostname)) {
+ ipAlert = ipRange;
+ }
+ });
+ return (
+ db?.engine && (
+ <StyledAlertMargin>
+ <Alert
+ closable={false}
+ css={(theme: SupersetTheme) => antDAlertStyles(theme)}
+ type="info"
+ showIcon
+ message={
+ engineSpecificAlertMapping[db.engine]?.message ||
+ connectionAlert?.DEFAULT?.message
+ }
+ description={
+ engineSpecificAlertMapping[db.engine]?.description ||
+ connectionAlert?.DEFAULT?.description + ipAlert
+ }
+ />
+ </StyledAlertMargin>
+ )
);
+ };
const errorAlert = () => {
if (