Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Crow's Foot and IDEF1X notation for diagrams #334

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Francisco-Galindo
Copy link

@Francisco-Galindo Francisco-Galindo commented Jan 14, 2025

We want to add both notations to the editor, through a setting so users can select which notation they like best. Adding IDEF1X in particular this would allow our school to use this project as their main DBER editor. Would fix #301.

Support for hierarchical relationships is being worked on, in a non-breaking manner so this doesn't disrupt other people's workflows.

IDEF1X would look like this:
image

Hierarchies would look something like this:
image

Copy link

vercel bot commented Jan 14, 2025

@Francisco-Galindo is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

@1ilit
Copy link
Member

1ilit commented Jan 16, 2025

nice work, is this pr ready for review?

Copy link

vercel bot commented Mar 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drawdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 3:31pm

@pabloem
Copy link

pabloem commented Mar 14, 2025

@1ilit could you please approve CI to build / deploy? we think this is ready for reciew : )

@1ilit 1ilit marked this pull request as ready for review March 20, 2025 21:51
Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work guys, really appreciate it. I'm leaving some comments for now but will take a closer look once these are resolved. Feel free to reach out if you need clarification or have any questions

@@ -134,7 +134,8 @@
}

.table-border {
border-color: rgba(var(--semi-grey-2), 1);
/* border-color: rgba(var(--semi-grey-2), 1); */
border-color: rgba(0, 255, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this change? Actaully i'm checking now and this class is not used anywhere you can remove it if it has no use

@@ -50,6 +50,10 @@ const en = {
reset_view: "Reset view",
show_grid: "Show grid",
show_cardinality: "Show cardinality",
default_notation: "Default notation",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the word 'notation' here so that we have 'Notation'>'Crow's foot' | 'IDEF1X' | 'Default'

@@ -10,6 +10,7 @@ const defaultSettings = {
panning: true,
showCardinality: true,
showRelationshipLabels: true,
notation: "default",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using string constants here let's have an object like this in constants.js

const Notation = {
  DEFAULT: "default",
  CROWS_FOOT: "crows_foot",
  IDEF1X: "idef1x",
  NONE: "none",
};

and you can use Notation.DEFAULT, for example, instead of constants

This way we can mimic an enum and have a more unified approach

notation: {
children: [
{
default_notation: () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you add the Notation object you can reuse the keys here

idef1x_notation: () => {
setSettings((prev) => ({ ...prev, notation: "idef1x" }));
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also keep the option to not show cardinalities at all. Some people, e.g. me, don't really care about the cardinality and prefer not to set it and not to show it

</text>
</>
)}
{format(pathRef.current, cardinalityEndX, cardinalityEndY, cardinalityStartX, cardinalityStartY, direction, cardinalityStart, cardinalityEnd)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format this

y2={cardinalityEndY-15}
stroke="gray"
strokeWidth='2'
className="group-hover:fill-sky-700"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hovering over the relationship doesn't make these lines blue:

image

you'll need to set the stroke color instead of fill to have this take effect

@@ -10,6 +10,7 @@ const defaultSettings = {
panning: true,
showCardinality: true,
showRelationshipLabels: true,
notation: "default",
tableWidth: tableWidth,
showDebugCoordinates: false,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 26 add this to prevent any errors that might arise for the cached settings not containing the notation field

setSettings({ ...defaultSettings, ...JSON.parse(settings) });

@@ -10,6 +10,8 @@ import { useDiagram, useSettings, useLayout, useSelect } from "../../hooks";
import { useTranslation } from "react-i18next";
import { SideSheet } from "@douyinfe/semi-ui";
import RelationshipInfo from "../EditorSidePanel/RelationshipsTab/RelationshipInfo";
import { CrowOM, CrowOO, CrowZM, IDEFZM, DefaultNotation } from "./RelationshipFormat";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CromZM is imported but not used, causes linting error. Also remove the function definition if not used

@@ -10,6 +10,7 @@ const defaultSettings = {
panning: true,
showCardinality: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Crow's foot option
5 participants