-
Notifications
You must be signed in to change notification settings - Fork 78
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
Option to export DAG as png. #34
Conversation
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.
Really nice PR @groodt - thanks for opening it!! Couple of comments in here - let me know what you think :)
}; | ||
var png64 = cy.png(options); | ||
var url = png64.replace(/^data:image\/[^;]+/, 'data:application/octet-stream'); | ||
window.open(url); |
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.
This is a cool approach! Seems to work well, but it looks like the file is downloaded with the named download
on Chrome? What do you think about using a link instead? I think something like this should work:
var link = document.createElement('a');
link.download = 'dbt-dag.png'; // sets the filename for the download
link.href = url;
link.click();
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.
Yes, I wasn't sure about the browser support (~82% support: https://caniuse.com/#feat=download), but I guess it's progressive enhancement. If the browser doesn't support it, it will use the default filename. There is some crash in Edge13 apparently, but that's probably not a big percentage.
Changes in @drewbanin Thanks for the review! 👍 |
Thanks @groodt! This is a really neat feature - super excited to merge it :) This is going out in dbt v0.14.0 🎉 |
Adds a context menu to the DAG that allows it to be exported as a PNG.
Fixes #29