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

feat(id): produce UUID with generateId. move to /utils/Identifier.js #16

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b31bdd3
Update packages after install
white-gecko Aug 14, 2020
473e0bf
Allow adding new ports via drag and drop
white-gecko Aug 14, 2020
792996d
Allow to delete a port by clicking on it
white-gecko Aug 14, 2020
7103bf1
Move port text to the left
white-gecko Aug 14, 2020
feaa93f
Adjust height of DiagramNode if more properties are added
white-gecko Aug 14, 2020
0fd0f4e
Add drop and dropNode events
white-gecko Aug 14, 2020
44923da
Try use index.js as main
white-gecko Aug 14, 2020
79069e1
Add possibility to put object into node
white-gecko Aug 14, 2020
2530afd
Also allow payload for ports
white-gecko Aug 14, 2020
2f61e88
add method addPort to reduce redundancy
white-gecko Aug 18, 2020
5751327
Reduce rist of duplicate ids by three orders of magnitude, but still …
white-gecko Aug 18, 2020
3c15784
Add posibility to configure ports
white-gecko Aug 18, 2020
0c1c7cb
Merge pull request #1 from white-gecko/master
TonyMasse Dec 8, 2020
a96190d
fix(diagramlink): populate `positionFrom` and `positionTo`
TonyMasse Dec 9, 2020
88fe53a
Merge pull request #2 from TonyMasse/fix(diagramLink)
TonyMasse Dec 9, 2020
da7e1cd
feat(diagramport): add port hear
TonyMasse Dec 10, 2020
2208499
chore(environment): bump components to latest
TonyMasse Dec 10, 2020
8a4020d
feat(diagramport): add `input` port hear
TonyMasse Dec 11, 2020
116f1f3
feat(diagramlinks): improve links and points aspect
TonyMasse Dec 11, 2020
ee113f5
feat(diagramlinks): add cursor effect when dragging new link
TonyMasse Dec 11, 2020
da49934
feat(nodes): set width to be large enough to accomodate title text
TonyMasse Dec 11, 2020
3c5f856
feat(nodes): improve aspect
TonyMasse Dec 11, 2020
1383a9b
test(stories): add two new stories to test width and dark background
TonyMasse Dec 11, 2020
7f7c443
fix(node): add `Move` cursor to whole Title bar, and not just the `rect`
TonyMasse Dec 11, 2020
85f751d
feat(node): emit SelectNode message when a node is selected
TonyMasse Dec 11, 2020
9d434a4
test(story): update stories to output model on sreen
TonyMasse Dec 12, 2020
c4ad3a5
feat(port): add visual and behaviour to the Ports via Props
TonyMasse Dec 12, 2020
5d48b66
test(story): add new story to test Port visuals
TonyMasse Dec 12, 2020
5faa66a
fix(port): add isASpacer to both DiagramNode params in DiagramNode
TonyMasse Dec 12, 2020
03debf1
feat(node): make highlighted border color fall back to `color`
TonyMasse Dec 12, 2020
539f58e
test(story): update SRP-Logic story
TonyMasse Dec 12, 2020
0b31e1a
feat(port): start implementing port menu, for `Delete` and `Edit`
TonyMasse Dec 12, 2020
9bb9ab2
feat(id): produce UUID with `generateId`
TonyMasse Dec 12, 2020
5409e6c
Merge branch 'development' into feat(all)-improve-generateId
TonyMasse Dec 12, 2020
f92f1ad
Merge pull request #3 from TonyMasse/feat(all)-improve-generateId
TonyMasse Dec 12, 2020
bebc5e4
feat(id): produce UUID with `generateId`. move to `/utils/Identifier.js`
TonyMasse Dec 13, 2020
a5308e1
Merge branch 'development' into feat(all)-improve-generateId-II
TonyMasse Dec 13, 2020
f4a0970
Revert "Merge branch 'development' into feat(all)-improve-generateId-II"
TonyMasse Dec 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/DiagramModel.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import DiagramNode from "./DiagramNode";

var generateId = function() {
return Math.trunc(Math.random() * 1000);
};
import { generateId } from "./utils/Identifier";

/**
* @class DiagramModel
Expand Down
4 changes: 1 addition & 3 deletions src/DiagramNode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var generateId = function() {
return Math.trunc(Math.random() * 1000);
};
import { generateId } from "./utils/Identifier";

/**
* @class DiagramNode
Expand Down
10 changes: 3 additions & 7 deletions src/components/Diagram.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ import DiagramNode from "./DiagramNode";
import DiagramLink from "./DiagramLink";
import DiagramPort from "./DiagramPort";

var generateId = function() {
return Math.trunc(Math.random() * 1000);
};
import { generateId } from "./../utils/Identifier";

function getAbsoluteXY(element) {
var viewportElement = document.documentElement;
Expand Down Expand Up @@ -253,12 +251,10 @@ export default {

links[this.draggedItem.linkIndex].points[
this.draggedItem.pointIndex
].x =
coords.x;
].x = coords.x;
links[this.draggedItem.linkIndex].points[
this.draggedItem.pointIndex
].y =
coords.y;
].y = coords.y;
this.updateLinksPositions();
} else {
let coords = this.convertXYtoViewPort(this.mouseX, this.mouseY);
Expand Down
15 changes: 15 additions & 0 deletions src/utils/Identifier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Generate a UUID (v1)
* @param {Integer} c clock-seq-and-reserved clock-seq-low
* @return {String} The UUID
* http://www.rfcreader.com/#rfc4122_line385 allows random instead of MAC address
* https://www.famkruithof.net/uuid/uuidgen
* https://realityripple.com/Tools/UnUUID/
*/
export function generateId(c = 9999) {
const t = ((Date.now() + 12219292800000) * 1e4).toString(16);
const n = crypto.getRandomValues(new Uint8Array(6)).reduce((sum, x, i) => {
return sum + (i === 0 ? x | 1 : x).toString(16).padStart(2, "0");
}, "");
return `${t.slice(-8)}-${t.slice(-12, -8)}-1${t.slice(0, 3)}-${c}-${n}`;
}