Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added alerts #15103

Merged
merged 2 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
useAvailableDatabases,
useDatabaseValidation,
getDatabaseImages,
getConnectionAlert,
} from 'src/views/CRUD/hooks';
import { useCommonConf } from 'src/views/CRUD/data/database/state';
import {
Expand Down Expand Up @@ -208,6 +209,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
const [isLoading, setLoading] = useState<boolean>(false);
const conf = useCommonConf();
const dbImages = getDatabaseImages();
const connectionAlert = getConnectionAlert();
const isEditMode = !!databaseId;
const sslForced = isFeatureEnabled(
FeatureFlag.FORCE_DATABASE_CONNECTIONS_SSL,
Expand Down Expand Up @@ -358,6 +360,24 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
</Select.Option>
))}
</Select>
<Alert
css={(theme: SupersetTheme) => antDAlertStyles(theme)}
type="info"
message={t('Want to add a new database?')}
description={
<>
Any databases that allow connetions via SQL Alchemy URIs can be
added. Learn about how to connect a database driver{' '}
<a
href={DOCUMENTATION_LINK}
target="_blank"
rel="noopener noreferrer"
>
here.
</a>
</>
}
/>
</div>
);

Expand Down Expand Up @@ -636,6 +656,14 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
dbName={dbName}
dbModel={dbModel}
/>
{connectionAlert && (
<Alert
css={(theme: SupersetTheme) => antDAlertStyles(theme)}
type="info"
message={t('Whitelisting IPs')}
description={connectionAlert.WHITELISTED_IPS}
/>
)}
<DatabaseConnectionForm
db={db}
sslForced={sslForced}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const antDModalStyles = (theme: SupersetTheme) => css`
export const antDAlertStyles = (theme: SupersetTheme) => css`
border: 1px solid ${theme.colors.info.base};
padding: ${theme.gridUnit * 4}px;
margin: ${theme.gridUnit * 8}px 0 0;
margin: ${theme.gridUnit * 8}px ${theme.gridUnit * 3}px 0;
.ant-alert-message {
color: ${theme.colors.info.dark2};
font-size: ${theme.typography.sizes.s + 1}px;
Expand Down
2 changes: 2 additions & 0 deletions superset-frontend/src/views/CRUD/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ export const copyQueryLink = (

export const getDatabaseImages = () => SupersetText.DB_IMAGES;

export const getConnectionAlert = () => SupersetText.ALERTS;

export const testDatabaseConnection = (
connection: DatabaseObject,
handleErrorMsg: (errorMsg: string) => void,
Expand Down