Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

add ssms instructions

Guy Ben-Aharon5c5fcc3dfb66
diff --git a/src/assets/ssms-instructions.png b/src/assets/ssms-instructions.png
new file mode 100644
index 00000000..a5d412f3
Binary files /dev/null and b/src/assets/ssms-instructions.png differ
diff --git a/src/components/zoomable-image/zoomable-image.tsx b/src/components/zoomable-image/zoomable-image.tsx
new file mode 100644
index 00000000..7116ecb2
--- /dev/null
+++ b/src/components/zoomable-image/zoomable-image.tsx
@@ -0,0 +1,40 @@
+import React from 'react';
+import { DialogTrigger } from '../command/dialog';
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogTitle,
+} from '../dialog/dialog';
+
+// import Image from 'next/image'
+// import { Dialog, DialogContent, DialogTrigger } from './ui/dialog'
+// import { DetailedHTMLProps, ImgHTMLAttributes } from 'react'
+
+export const ZoomableImage = React.forwardRef<
+ React.ElementRef<typeof DialogTrigger>,
+ React.DetailedHTMLProps<
+ React.ImgHTMLAttributes<HTMLImageElement>,
+ HTMLImageElement
+ >
+>((props, ref) => {
+ if (!props.src) return null;
+ return (
+ <Dialog>
+ <DialogTrigger asChild ref={ref}>
+ <img {...props} />
+ </DialogTrigger>
+ <DialogContent className="max-w-4xl border-0 bg-transparent p-0">
+ <DialogTitle className="hidden" />
+ <DialogDescription className="hidden" />
+ <img
+ src={props.src}
+ alt={props.alt}
+ className="object-contain"
+ />
+ </DialogContent>
+ </Dialog>
+ );
+});
+
+ZoomableImage.displayName = 'ZoomableImage';
diff --git a/src/context/full-screen-spinner-context/full-screen-spinner-provider.tsx b/src/context/full-screen-spinner-context/full-screen-spinner-provider.tsx
index cf80a01a..59bbdb7e 100644
--- a/src/context/full-screen-spinner-context/full-screen-spinner-provider.tsx
+++ b/src/context/full-screen-spinner-context/full-screen-spinner-provider.tsx
@@ -3,7 +3,11 @@ import {
FullScreenLoaderContext,
fullScreenLoaderContext,
} from './full-screen-spinner-context';
-import { Dialog, DialogContent } from '@/components/dialog/dialog';
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+} from '@/components/dialog/dialog';
import { Spinner } from '@/components/spinner/spinner';
import { Hourglass } from 'lucide-react';
import { DialogTitle } from '@radix-ui/react-dialog';
@@ -38,6 +42,7 @@ export const FullScreenLoaderProvider: React.FC<React.PropsWithChildren> = ({
<Dialog open={open}>
<DialogContent className="justify-center border-none bg-transparent shadow-none outline-none">
<DialogTitle className="hidden"></DialogTitle>
+ <DialogDescription className="hidden" />
<div className="w-fit rounded-xl bg-white p-3">
{animated ? (
<Spinner size={'large'} />
diff --git a/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database.tsx b/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database/create-diagram-dialog-import-database.tsx
similarity index 95%
rename from src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database.tsx
rename to src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database/create-diagram-dialog-import-database.tsx
index 4864f499..9678dd47 100644
--- a/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database.tsx
+++ b/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database/create-diagram-dialog-import-database.tsx
@@ -23,7 +23,8 @@ import {
AvatarFallback,
AvatarImage,
} from '@/components/avatar/avatar';
-import { CreateDiagramDialogStep } from './create-diagram-dialog-step';
+import { CreateDiagramDialogStep } from '../create-diagram-dialog-step';
+import { SSMSInfo } from './ssms-info/ssms-info';
export interface CreateDiagramDialogImportDatabaseProps {
setStep: React.Dispatch<React.SetStateAction<CreateDiagramDialogStep>>;
@@ -143,9 +144,12 @@ export const CreateDiagramDialogImportDatabase: React.FC<
</div>
) : null}
<div className="flex flex-col gap-1">
- <p className="text-sm text-muted-foreground">
- 1. Run this script in your database:
- </p>
+ <div className="flex flex-col gap-1 text-sm text-muted-foreground md:flex-row md:justify-between">
+ <div>1. Run this script in your database:</div>
+ {databaseType === DatabaseType.SQL_SERVER && (
+ <SSMSInfo />
+ )}
+ </div>
<CodeSnippet
className="max-h-40 w-full"
code={importMetadataScripts[databaseType]({
diff --git a/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database/ssms-info/ssms-info.tsx b/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database/ssms-info/ssms-info.tsx
new file mode 100644
index 00000000..a9fb3427
--- /dev/null
+++ b/src/dialogs/create-diagram-dialog/create-diagram-dialog-import-database/ssms-info/ssms-info.tsx
@@ -0,0 +1,61 @@
+import {
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+} from '@/components/hover-card/hover-card';
+import { Label } from '@/components/label/label';
+import { Info } from 'lucide-react';
+import React from 'react';
+import SSMSInstructions from '@/assets/ssms-instructions.png';
+import { ZoomableImage } from '@/components/zoomable-image/zoomable-image';
+
+export interface SSMSInfoProps {}
+
+export const SSMSInfo = React.forwardRef<
+ React.ElementRef<typeof HoverCardTrigger>,
+ SSMSInfoProps
+>((props, ref) => {
+ const [open, setOpen] = React.useState(false);
+ return (
+ <HoverCard
+ open={open}
+ onOpenChange={(isOpen) => {
+ setOpen(isOpen);
+ }}
+ >
+ <HoverCardTrigger ref={ref} {...props} asChild>
+ <div
+ className="flex flex-row items-center gap-1 text-pink-600"
+ onClick={() => {
+ setOpen(!open);
+ }}
+ >
+ <Info size={14} />
+ <Label className="text-xs">SSMS Instructions</Label>
+ </div>
+ </HoverCardTrigger>
+ <HoverCardContent className="w-80">
+ <div className="flex">
+ <div className="space-y-1">
+ <h4 className="text-sm font-semibold">Instructions</h4>
+ <p className="text-xs text-muted-foreground">
+ <span className="font-semibold">1. </span>
+ {
+ 'Go to Tools > Options > Query Results > SQL Server.'
+ }
+ </p>
+ <p className="text-xs text-muted-foreground">
+ <span className="font-semibold">2. </span>
+ {`If you're using "Results to Grid," change the Maximum Characters Retrieved for Non-XML data (set to 9999999).`}
+ </p>
+ <div className="flex items-center pt-2">
+ <ZoomableImage src={SSMSInstructions} />
+ </div>
+ </div>
+ </div>
+ </HoverCardContent>
+ </HoverCard>
+ );
+});
+
+SSMSInfo.displayName = 'SSMSInfo';
diff --git a/src/dialogs/create-diagram-dialog/create-diagram-dialog-select-database.tsx b/src/dialogs/create-diagram-dialog/create-diagram-dialog-select-database/create-diagram-dialog-select-database.tsx
similarity index 98%
rename from src/dialogs/create-diagram-dialog/create-diagram-dialog-select-database.tsx
rename to src/dialogs/create-diagram-dialog/create-diagram-dialog-select-database/create-diagram-dialog-select-database.tsx
index 29354a7f..9d3643e1 100644
--- a/src/dialogs/create-diagram-dialog/create-diagram-dialog-select-database.tsx
+++ b/src/dialogs/create-diagram-dialog/create-diagram-dialog-select-database/create-diagram-dialog-select-database.tsx
@@ -13,7 +13,7 @@ import { DatabaseType } from '@/lib/domain/database-type';
import { databaseLogoMap } from '@/lib/databases';
import { Link } from '@/components/link/link';
import { LayoutGrid } from 'lucide-react';
-import { CreateDiagramDialogStep } from './create-diagram-dialog-step';
+import { CreateDiagramDialogStep } from '../create-diagram-dialog-step';
export interface CreateDiagramDialogSelectDatabaseProps {
setStep: React.Dispatch<React.SetStateAction<CreateDiagramDialogStep>>;
diff --git a/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx b/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx
index a54ec800..6e4235bb 100644
--- a/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx
+++ b/src/dialogs/create-diagram-dialog/create-diagram-dialog.tsx
@@ -15,9 +15,9 @@ import { generateId } from '@/lib/utils';
import { useChartDB } from '@/hooks/use-chartdb';
import { useDialog } from '@/hooks/use-dialog';
import { DatabaseEdition } from '@/lib/domain/database-edition';
-import { CreateDiagramDialogSelectDatabase } from './create-diagram-dialog-select-database';
+import { CreateDiagramDialogSelectDatabase } from './create-diagram-dialog-select-database/create-diagram-dialog-select-database';
import { CreateDiagramDialogStep } from './create-diagram-dialog-step';
-import { CreateDiagramDialogImportDatabase } from './create-diagram-dialog-import-database';
+import { CreateDiagramDialogImportDatabase } from './create-diagram-dialog-import-database/create-diagram-dialog-import-database';
const errorScriptOutputMessage =
'Invalid JSON. Please correct it or contact us at [email protected] for help.';
@@ -142,7 +142,7 @@ export const CreateDiagramDialog: React.FC<CreateDiagramDialogProps> = ({
}}
>
<DialogContent
- className="flex w-[90vw] flex-col overflow-y-auto xl:min-w-[45vw]"
+ className="flex w-[90vw] flex-col overflow-visible overflow-y-auto xl:min-w-[45vw]"
showClose={hasExistingDiagram}
>
{step === CreateDiagramDialogStep.SELECT_DATABASE ? (