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 helpButtonRef = React.useRef<HTMLButtonElement>(null);
useEffect(() => {
const loadScripts = async () => {
const { importMetadataScripts } = await import(
@@ -130,10 +132,15 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
const inputValue = e.target.value;
setScriptResult(inputValue);
// Automatically open SSMS info when input length is close to 65535 (±500)
if (inputValue.length >= 65035 && inputValue.length <= 66035) {
// Automatically open SSMS info when input length is exactly 65535
if (inputValue.length === 65535) {
setShowSSMSInfoDialog(true);
}
// Show instructions when input contains "WITH fk_info as"
if (inputValue.toLowerCase().includes('with fk_info as')) {
helpButtonRef.current?.click();
}
},
[setScriptResult]
);
@@ -398,7 +405,11 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
)}
{isDesktop ? (
<ZoomableImage src="/load-new-db-instructions.gif">
<Button type="button" variant="link">
<Button
type="button"
variant="link"
ref={helpButtonRef}
>
{t(
'new_diagram_dialog.import_database.instructions_link'
)}
@@ -450,7 +461,11 @@ export const ImportDatabase: React.FC<ImportDatabaseProps> = ({
{!isDesktop ? (
<ZoomableImage src="/load-new-db-instructions.gif">
<Button type="button" variant="link">
<Button
type="button"
variant="link"
ref={helpButtonRef}
>
{t(
'new_diagram_dialog.import_database.instructions_link'
)}