fix(db): Show the only db install guide when the db is already installed 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
This commit is contained in:
smileydev
2022-06-28 08:53:02 -04:00
committed by GitHub
parent 364bb7c639
commit 23e62d3782
2 changed files with 30 additions and 17 deletions

View File

@@ -31,9 +31,13 @@ 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)}
@@ -41,21 +45,25 @@ const ErrorAlert: FunctionComponent<IProps> = ({ errorMessage }) => (
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>
.
</>
) : (
''
)
}
/>
);

View File

@@ -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>