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

fix(db): Show the only db install guide when the db is already installed and error is existed while importing file. #20442

Merged
merged 2 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 24 additions & 16 deletions superset-frontend/src/components/ImportModal/ErrorAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,39 @@ export const DOCUMENTATION_LINK = supersetTextDocs

export interface IProps {
errorMessage: string;
showDbInstallInstructions: boolean;
}

const ErrorAlert: FunctionComponent<IProps> = ({ errorMessage }) => (
const ErrorAlert: FunctionComponent<IProps> = ({
errorMessage,
showDbInstallInstructions,
}) => (
<Alert
closable={false}
css={(theme: SupersetTheme) => antdWarningAlertStyles(theme)}
type="error"
showIcon
message={errorMessage}
description={
<>
<br />
{t(
'Database driver for importing maybe not installed. Visit the Superset documentation page for installation instructions:',
)}
<a
href={DOCUMENTATION_LINK}
target="_blank"
rel="noopener noreferrer"
className="additional-fields-alert-description"
>
{t('here')}
</a>
.
</>
showDbInstallInstructions ? (
<>
<br />
{t(
'Database driver for importing maybe not installed. Visit the Superset documentation page for installation instructions:',
)}
<a
href={DOCUMENTATION_LINK}
target="_blank"
rel="noopener noreferrer"
className="additional-fields-alert-description"
>
{t('here')}
</a>
.
</>
) : (
''
)
}
/>
);
Expand Down
7 changes: 6 additions & 1 deletion superset-frontend/src/components/ImportModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,12 @@ const ImportModelsModal: FunctionComponent<ImportModelsModalProps> = ({
<Button loading={importingModel}>Select file</Button>
</Upload>
</StyledInputContainer>
{errorMessage && <ErrorAlert errorMessage={errorMessage} />}
{errorMessage && (
<ErrorAlert
errorMessage={errorMessage}
showDbInstallInstructions={passwordFields.length > 0}
/>
)}
{renderPasswordFields()}
{renderOverwriteConfirmation()}
</Modal>
Expand Down