betodealmeida commented on a change in pull request #16170:
URL: https://github.com/apache/superset/pull/16170#discussion_r686137995
##########
File path:
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
##########
@@ -852,25 +852,33 @@ 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 path = window.location.hostname;
+ const region = path.split('.')[1];
+ const ipAlert =
+ connectionAlert?.REGIONAL_IPS[region] ||
+ connectionAlert?.REGIONAL_IPS?.us1a;
Review comment:
Even if it currently only exists in Preset, we shouldn't have
Preset-specific logic here. Other users might want to define an alert for their
systems using the same scaffolding we use for Preset, and their hostnames
probably follow a different convention.
A more generic pattern is to have the keys be regular expressions, and we
test it against the whole hostname.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]