Compare commits

...

1 Commits

Author SHA1 Message Date
johnnyfish
595e3db0b3 fix(import-db): handle direct query copy-paste instead of fetched JSON 2025-02-17 20:28:15 +02:00

View File

@@ -87,6 +87,8 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
const [showSSMSInfoDialog, setShowSSMSInfoDialog] = useState(false); const [showSSMSInfoDialog, setShowSSMSInfoDialog] = useState(false);
const helpButtonRef = React.useRef<HTMLButtonElement>(null);
useEffect(() => { useEffect(() => {
const loadScripts = async () => { const loadScripts = async () => {
const { importMetadataScripts } = await import( const { importMetadataScripts } = await import(
@@ -134,6 +136,11 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
if (inputValue.length === 65535) { if (inputValue.length === 65535) {
setShowSSMSInfoDialog(true); setShowSSMSInfoDialog(true);
} }
// Show instructions when input contains "WITH fk_info as"
if (inputValue.toLowerCase().includes('with fk_info as')) {
helpButtonRef.current?.click();
}
}, },
[setScriptResult] [setScriptResult]
); );
@@ -398,7 +405,11 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
)} )}
{isDesktop ? ( {isDesktop ? (
<ZoomableImage src="/load-new-db-instructions.gif"> <ZoomableImage src="/load-new-db-instructions.gif">
<Button type="button" variant="link"> <Button
type="button"
variant="link"
ref={helpButtonRef}
>
{t( {t(
'new_diagram_dialog.import_database.instructions_link' 'new_diagram_dialog.import_database.instructions_link'
)} )}
@@ -450,7 +461,11 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
{!isDesktop ? ( {!isDesktop ? (
<ZoomableImage src="/load-new-db-instructions.gif"> <ZoomableImage src="/load-new-db-instructions.gif">
<Button type="button" variant="link"> <Button
type="button"
variant="link"
ref={helpButtonRef}
>
{t( {t(
'new_diagram_dialog.import_database.instructions_link' 'new_diagram_dialog.import_database.instructions_link'
)} )}