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 editor for schema designer. #18689

Draft
wants to merge 53 commits into
base: main
Choose a base branch
from
Draft

Adding editor for schema designer. #18689

wants to merge 53 commits into from

Conversation

aasimkhan30
Copy link
Contributor

@aasimkhan30 aasimkhan30 commented Feb 14, 2025

  1. Editing Table:

    Screen.Recording.2025-02-14.at.9.37.34.AM.mov
  2. Updating Editor Position with graph changes (scroll and scale)

    Screen.Recording.2025-02-14.at.9.39.12.AM.mov
  3. Add new table

    Screen.Recording.2025-02-14.at.9.43.35.AM.mov
  4. Add and editing edge

    Screen.Recording.2025-02-14.at.10.03.16.AM.mov
  5. Undo / Redo

    Screen.Recording.2025-02-14.at.10.05.42.AM.mov

@@ -207,6 +208,7 @@
"tmp": "^0.0.28",
"tunnel": "0.0.6",
"underscore": "^1.8.3",
"uuid": "^11.0.5",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we already have a util function for UUIDs, presumably to keep dependencies lighter. If we wanted to pull in a package instead, maybe we can remove that util function.

save: l10n.t("Save"),
cancel: l10n.t("Cancel"),
dataType: l10n.t("Type"),
primaryKey: l10n.t("PK"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why abbreviated when "Foreign Keys" is spelled out?

editorDiv.style.transform = `scale(${scale})`;
editorDiv.style.top = `${y}px`;
editorDiv.style.left = `${x}px`;
}
function createGraph() {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a long function to stick in an effect; can you shift it out to a helper function and add comment?

setSchemaDesigner(graph);

const exportAsButton = document.querySelector(
".sd-toolbar-button[title='Export']",
Copy link
Contributor

Choose a reason for hiding this comment

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

where does this hardcoded string .sd-toolbar-button come from?

);
return;
}
// transperant background
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: "transparent"

}
createGraph();
}, [context.schema]);

return <div id="graphContainer"></div>;
async function exportAs(format: "svg" | "png" | "jpg") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an odd thing to have in the react layer (and likely more difficult to test). Can you tell me more about why this is here? When might imageContent or context be undefined resulting in the bulk of this code being executed?

};

function calculateEditorPosition(
Copy link
Contributor

Choose a reason for hiding this comment

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

docstring

tableForeignKeys.filter((fk) => fk.columns.includes(column.name))
.length > 0;

const isColumnAlsoAReferencedColumn =
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to calculate this one if the first has already triggered, right?

Buffer.from(payload.svgFileContents),
);
} else {
//const outputPath = `/Users/aasimkhan/src/newFile.${payload.format}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove


this._schemaDesignerService.onModelReady(() => {
vscodeWrapper.showInformationMessage(
"Schema Designer model is ready.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Loc?

@aasimkhan30 aasimkhan30 marked this pull request as draft February 25, 2025 18:41
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.

2 participants