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(wrap-stream-in-html): highlight connected edges #346

Merged
merged 2 commits into from
Aug 7, 2020

Conversation

forivall
Copy link
Contributor

@forivall forivall commented Aug 6, 2020

Description

Highlights connected edges to hovered node, and connected nodes to hovered edges.

Motivation and Context

#343 (comment) you said it's on your wishlist, and i knew i could bang it out quickly. 😄

How Has This Been Tested?

I just launched it in the browser and hacked away. I was feeling nostalgic so it's es5.

Screenshots

Screen Shot 2020-08-06 at 12 58 06 PM

Screen Shot 2020-08-06 at 12 58 13 PM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

@forivall
Copy link
Contributor Author

forivall commented Aug 6, 2020

When i update the docs, i'd also like to mention this bookmarklet i just made, so that clicking opens vscode instead of in the browser https://gist.github.com/forivall/373425de70964c8c271020cab3650048

document.querySelector('svg').querySelectorAll('a').forEach(function (a) {
  var u = new URL(a.href.baseVal, document.location.href);
  u.protocol = 'vscode:';
  u.pathname = u.pathname.replace(/^\/*/, '//file/');
  a.href.baseVal = u.href;
});

@sverweij
Copy link
Owner

sverweij commented Aug 6, 2020

@forivall whoa - that looks nice!! I'll give it a spin tomorrow!

About the bookmarklet - that's creative! Did you consider using the prefix option? I didn't know about the vscode protocol, but it totally works:

  // in the options section of .dependency-cruiser.js plonk something like this:
  prefix: `vscode://file/${process.cwd()}/`,
# or in a command line variant for it:
depcruise -v -T dot --prefix "vscode://file/`pwd`/" -- src | dot -T svg | depcruise-wrap-stream-in-html | browser

That way the links in the dot (/svg) get this as a prefix. The documentation currently has an example that prefixes it with the base url of an online repository, but it's usable with other protocols as well.

@forivall
Copy link
Contributor Author

forivall commented Aug 6, 2020

Yeah, I just saw the prefix option earlier. Once again, you've already got something there :P

@sverweij
Copy link
Owner

sverweij commented Aug 7, 2020

@forivall thanks for this! It makes a huge difference in the usability of these reports. Nice touch to also highlight both nodes at the end of an edge on hover - and a good call to leave the existing css in place so there's a fallback for folks who disabled their javascript.

@sverweij
Copy link
Owner

sverweij commented Aug 7, 2020

(the results look too pretty not to have in the cli documentation - so I've added :-) )

@sverweij sverweij merged commit 1d0bffe into sverweij:develop Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: released
Development

Successfully merging this pull request may close these issues.

2 participants