Skip to content

Commit

Permalink
fix(db): Show the only db install guide when the db is already instal…
Browse files Browse the repository at this point in the history
…led and error is existed while importing file. (#20442)

* fix(db): make to show the db error msg when db installed and error is exist

* fix(db): make to replace dbinstall str into showDbInstallInstructions

(cherry picked from commit 23e62d3)
  • Loading branch information
prosdev0107 authored and michael-s-molina committed Jun 28, 2022
1 parent 63229dc commit 789f993
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
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

0 comments on commit 789f993

Please sign in to comment.