Created
May 21, 2020 14:19
-
-
Save newcat/0e72276243f71779debc86085ef9a78d to your computer and use it in GitHub Desktop.
BaklavaJS ERM Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>BaklavaJS Vanilla Example</title> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/baklavajs/dist/styles.css"> | |
</head> | |
<body> | |
<div style="width:90vw;height:90vh"> | |
<div id="editor"></div> | |
</div> | |
<script src="https://cdn.jsdelivr.net/npm/vue"></script> | |
<script src="https://cdn.jsdelivr.net/npm/baklavajs/dist/index.js"></script> | |
<script> | |
const plugin = BaklavaJS.createBaklava(document.getElementById("editor")); | |
const editor = plugin.editor; | |
const typePlugin = new BaklavaJS.PluginInterfaceTypes.InterfaceTypePlugin(); | |
editor.use(typePlugin); | |
typePlugin.addType("entity", "cyan"); | |
typePlugin.addType("property", "orange"); | |
const assignmentNode = new BaklavaJS.Core.NodeBuilder("Assignment") | |
.addInputInterface("Entity", undefined, null, { type: "entity" }) | |
.addOutputInterface("ClientName", { type: "property" }) | |
.addOutputInterface("GroupName", { type: "property" }) | |
.addOutputInterface("Id", { type: "property" }) | |
.build(); | |
const groupNode = new BaklavaJS.Core.NodeBuilder("Group") | |
.addInputInterface("Entity", undefined, null, { type: "entity" }) | |
.addOutputInterface("Name", { type: "property" }) | |
.build(); | |
const clientNode = new BaklavaJS.Core.NodeBuilder("Client") | |
.addInputInterface("Entity", undefined, null, { type: "entity" }) | |
.addOutputInterface("Name", { type: "property" }) | |
.build(); | |
const oneToOneRelationshipNode = new BaklavaJS.Core.NodeBuilder("1:1 Relationship") | |
.addInputInterface("Property", undefined, null, { type: "property" }) | |
.addOutputInterface("Entity", { type: "entity" }) | |
.build(); | |
editor.registerNodeType("Assignment", assignmentNode); | |
editor.registerNodeType("Group", groupNode); | |
editor.registerNodeType("Client", clientNode); | |
editor.registerNodeType("1:1 Relationship", oneToOneRelationshipNode); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment