-
-
Notifications
You must be signed in to change notification settings - Fork 197
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(ui): improve mesh graph #458
Conversation
Show us screenshots 🥸 |
@AlCalzone nothing good to show yet, tomorrow you will see something 🙏🏻😎 |
Found the reason: https://observablehq.com/@d3/d3v6-migration-guide |
// add nodes to graph | ||
for (let i = 0; i < nodes.length; i++) { | ||
const node = nodes[i] | ||
g.setNode(node.id, node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robertsLando according to https://github.com/dagrejs/graphlib/wiki/API-Reference#setNode the second parameter to setNode()
is the label, so I think it should be g.setNode(node.id, node.id)
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, label can be an object so it's correct to use the node object there AFAIK. Did you try to use a string instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Yes, I've tried and the graph vanished ;-).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just a misleading documentation to name it "label" if it can be an object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe https://github.com/dagrejs/graphlib/wiki/API-Reference#setDefaultNodeLabel can be used to set the default label for nodes. I'll try.
🚧 It seems like this PR has lint errors 🚧 |
Pull Request Test Coverage Report for Build 547441464
💛 - Coveralls |
@robertsLando I'd like to keep you up-to-date about the approach I'll take on the filter possibilities for the mesh graph we talked about privately and get some feedback on it. Since I'd like to reuse as much of the filtering code as possible from the nodes table on the control panel I'm going to refactor much of it into an UI-independent reusable component that provides functionality that can be used by the table as well as the mesh graph. I'm creating a
It will have absolutely no hard-coded dependency on Z-Wave nodes, so it may be used as well for other item collections (e.g. hass devices, ...) if it makes sense. This would also allow us to view the table and the mesh graph just as a different visual representation of the same things and keep the filters, selection, ... on both sides in sync (in case we'd want to have it that way) or keep them completely separated. Of course everything will be quality checked using unit tests :-). |
I think that would be awesome! Nice idea @ahochsteger ! Btw I think we could merge this for now and keep that for another PR? At least we can get some feedbacks about the new implementation :) |
Yes, let's merge it and I'll start a new PR. |
Fixes #384
Preview: