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

Option to export DAG as png. #34

Merged
merged 2 commits into from
Jun 7, 2019

Conversation

groodt
Copy link
Contributor

@groodt groodt commented Jun 6, 2019

Adds a context menu to the DAG that allows it to be exported as a PNG.

Fixes #29

Copy link
Contributor

@drewbanin drewbanin left a 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 :)

src/app/components/graph/graph-viz.js Show resolved Hide resolved
};
var png64 = cy.png(options);
var url = png64.replace(/^data:image\/[^;]+/, 'data:application/octet-stream');
window.open(url);
Copy link
Contributor

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();

Copy link
Contributor Author

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.

@groodt
Copy link
Contributor Author

groodt commented Jun 6, 2019

Changes in @drewbanin

Thanks for the review! 👍

@drewbanin
Copy link
Contributor

Thanks @groodt! This is a really neat feature - super excited to merge it :)

This is going out in dbt v0.14.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export model graph to file
2 participants