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 9683c407436..54c97026591 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 = ({ setTabKey(key); }; - const renderStepTwoAlert = () => - db?.engine && ( - - antDAlertStyles(theme)} - type="info" - showIcon - message={ - engineSpecificAlertMapping[db.engine]?.message || - connectionAlert?.DEFAULT?.message - } - description={ - engineSpecificAlertMapping[db.engine]?.description || - connectionAlert?.DEFAULT?.description - } - /> - + 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 && ( + + antDAlertStyles(theme)} + type="info" + showIcon + message={ + engineSpecificAlertMapping[db.engine]?.message || + connectionAlert?.DEFAULT?.message + } + description={ + engineSpecificAlertMapping[db.engine]?.description || + connectionAlert?.DEFAULT?.description + ipAlert + } + /> + + ) ); + }; const errorAlert = () => { if (