-
Notifications
You must be signed in to change notification settings - Fork 73
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
Support node_color and docs.show under the config object #281
Conversation
I know we talked about |
src/app/docs/analysis.html
Outdated
@@ -19,7 +19,7 @@ | |||
<div class="app-links app-sticky"> | |||
<div class="app-title"> | |||
<div class="app-frame app-pad app-flush-bottom"> | |||
<h1 ng-if="model.docs.show === false"> | |||
<h1 ng-if="model.docs.show === false || model.config.docs.show === false"> |
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.
I like the if else default here
@b-per can you take a first draft of adding the defensive code: https://gist.github.com/stu-k/aac9d0fb7bf5e325f4fa8d260bd28fc8 based on the comment: dbt-labs/dbt-core#5397 (comment) |
Yes, I will give it a shot 👍 |
@b-per thanks for much for progressing on this! I'll take a deeper look today/tomorrow. Per Stu's recommendation(dbt-labs/dbt-core#5397 (comment)) , we will keep the defensive code in one place for maintenance consistency. If this code is in two places, contributing to the dbt docs further will become more of a frankenstein than evolution. NOT APPLICABLE ANYMORE |
Very supportive of the "defensive" color validation logic living in this codebase. I have a very slight preference for accessing this metadata from node's top-level property always ( @dbt-labs/core-language very open to your thoughts here, as the team continues to develop its thinking around what should be a config and what should be a top-level property. |
Doing some manual testing to check for edge cases. No red flags! I noticed if you import a dbt package that people will have to color code that via code as well. You'll notice What's working well?
|
TODO: Also, with docs behaving the way that jerco mentioned, we will need to update the dbt-docs code to look under model.docs instead of model.config.docs (not a huge change but just keeping it in mind) |
@jtcohen6 any updates on whether we have the node_color under property vs. config hierarchy? I have a draft in #288 separated out until we answer the above to then officially merge those changes into this PR. This will require changes to dbt-labs/dbt-core#5397 based on the threads there. I want to make sure we're aligned on approach before we commit code in the wrong design pattern! |
I will own this to ensure the property is at the top-level vs. config level |
src/app/services/graph.service.js
Outdated
el.data['hidden'] = 1; | ||
} | ||
|
||
var color_config = _.get(el, ['data', 'config', 'docs', 'node_color']) |
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.
@b-per Is this still expected? If I remove the 'config' portion in the list, the custom colors do NOT work.
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.
Looks like this is expected based on this this line: here
This is ready for review!
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.
I just did a test with the latest dbt-core and it works without looking at config
. I think that we said we'd want to read from docs directly so I will push a small change.
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.
Looks good to me!
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.
Looks good. Can you please add a changelog entry indicating the change and then it should be ready to merge!
I just modified the CHANGELOG 😄 |
relates to #279
works in conjunction with dbt-labs/dbt-core#5397
I leveraged @sungchun12's logic and the modifications to dbt Core of dbt-labs/dbt-core#5397 to support defining
docs.show
anddocs.node_color
as node configs and have them update the docs accordingly.With this approach
docs.show
can be defined in 2 different places. Asdocs.show
, as it has been the case in the past versions (and kept like this to avoid breaking changes), and asconfig.docs.show
when we define the docs as a config item.The big advantage of the config item is that we can configure models at the folder level in
dbt_project.yml
For now, there is no validation of
node_color
on thedbt-docs
side but there is some validation on thedbt-core
side.The following config under
dbt_project.yml
generates the DAG below: