-
Notifications
You must be signed in to change notification settings - Fork 79
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
Added "Referenced By" and "Depends On" section for each SQL file #106
Conversation
…ed fixed comments and modified overview.html
FWIW this is a lovely addition - well done! |
hey @stephen8chang - this is AWESOME! I'll try to dig in here today, but just wanted to give you an early heads up that
|
Thanks for sending through this PR @stephen8chang (and h/t to @Matt343 as well!). I've spent some time clicking around in here today, and I do buy the utility of some new components in the UI for "referenced by" and "depends on" for sure. I think that at a certain point, we're going to need to rethink the UI/layout of this page. I don't love the fact that our only place for information like this today is inline in the page. Ideally, I'd like to consider some alternative layouts that keep the primary information front-and-center, while still making information like this accessible when it is relevant. @amy-byrum, you think maybe we can use this PR as an opportunity to give some thought to the future of the Docs UI? All this said, I don't think we need to block merging this PR on a redesign of the Docs site :D. @jtcohen6 adding you for review here. I'll take care of the code review piece, but it would be awesome if you could spend some time clicking around in here and noting your thoughts. I would really like to get this change shipped for 0.18.0 if we can! Thanks again all - super exciting! |
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.
Just dropped a couple of comments in here, happy to discuss!
src/app/docs/utils.js
Outdated
@@ -0,0 +1,36 @@ | |||
const _ = require('underscore'); | |||
export function getReferences(project, model) { |
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.
We've historically leveraged services for things like this, but I'm increasingly super into the idea of just using a require
instead of going through Angular's dependency injection flow.
Can you just rename this from utils.js
to something more specific like dag_utils.js
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.
Can do!
src/app/docs/macro.js
Outdated
@@ -15,25 +15,47 @@ angular | |||
$scope.project = projectService; | |||
$scope.codeService = codeService; | |||
|
|||
function getReferences(project, macro) { | |||
var references = _.filter(project.nodes, function(node) { | |||
function getReferences(project, self) { |
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.
Do you think there's a way to reconcile this logic with the code in src/app/docs/utils.js
? I totally get that the different namespaces for macros and nodes could make this challenging, but it feels funny to have two very similar sets of functions so far apart from each other. Let me know what you think!
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.
The decision to include these two functions in macro.js
and separate from utils.js
was to accommodate for the differing properties of macros and nodes. Would it make sense to you to have the two functions in macro.js
included in utils.js
as well?
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.
@drewbanin I moved the functions related to obtaining references and parents for macros from macro.js
to dag_utils.js
(previously utils.js). Let me know what you think.
src/app/docs/model.html
Outdated
@@ -36,6 +36,8 @@ <h1> | |||
<li ui-sref-active='active'><a ui-sref="dbt.model({'#': 'details'})">Details</a></li> | |||
<li ui-sref-active='active'><a ui-sref="dbt.model({'#': 'description'})">Description</a></li> | |||
<li ui-sref-active='active'><a ui-sref="dbt.model({'#': 'columns'})">Columns</a></li> | |||
<li ui-sref-active='active'><a ui-sref="dbt.model({'#': 'referenced_by'})">Referenced By</a></li> |
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.
We can and should figure out a better way to reduce the copy/paste necessary for these different node types. Not a problem at all for right now though :)
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.
Sounds good! Let me know if you would like me to spend some time on figuring out how to reduce the copy pasting.
This is really cool! I agree with your comments above @drewbanin. Let's think about a better home for this information during a future redesign. A couple of oddities I noticed:
The only change I'd request of the current PR relates to the last point. I think the simplest solution would be to exclude the |
The reason for this is that the relevant sections in the manifest.json file are always empty for macros. I'm not sure why that is, but |
@jtcohen6 The References By/Depends On section now appears only if it exists for that specific table. |
Re: inter-macro dependencies: it sounds like we're not recording those in the manifest as we should be. Thanks for making the change around empty Depends On / Referenced By! I definitely like the look better. I think we may now be missing some sections in cases where a model is referenced by or depends on only non-model nodes. In the deploy preview, e.g.
|
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.
Nice! Looks like that resolved it. Thanks so much for the contribution @stephen8chang
Problem
When one is trying to view SQL files and their immediate relationships to other SQL files in DBT docs, they have to go through a rather annoying process of clicking the lineage graph, and possibly few other clicks just to view the parent or child of the currently selected SQL file.
Solution
To make this process more convenient for the user, this PR adds a "Referenced By" and "Depends On" section in addition to the description of each SQL file, thus allowing the user to view the immediate parent and immediate child files (of any type) of the currently selected SQL file.
To accomplish this, the following changes were made to most files in src/app/docs :
Other Information