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

Implemented individual overview functionality. #129

Merged
merged 11 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ci-project/models/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ This [dbt](https://www.getdbt.com/) project is for demonstrations and tutorials.
The source code can be found [here](https:/clrcrl/jaffle_shop).

{% enddocs %}

{% docs __jaffle_shop__ %}
## Jaffle_shop Project level overview example
This [dbt](https://www.getdbt.com/) project may have only one project (`jaffle_shop`) currently.
However there may be other projects included in your own projects.

You can assign a unique overview for each project by adding a docs block in an .md file of your project
and giving it a name with the following convention __<project_name>__.
{% enddocs %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Could you add an entry for {% docs __dbt_utils__ %} below?
  • As Drew mentioned, to really see your change in the PR preview, we'll need to run dbt docs generate in the ci-project to replace the artifacts currently in data/. If you're up for doing this as part of this PR, great! If not, we can do it separately after merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtcohen6 Thanks for the suggestion I added a block for dbt_utils. I also generated docs in the ci-project and replaced the data/ files with them. I also signed the CLA. Please let me know if I did anything incorrectly with the data/ artifacts.

3 changes: 3 additions & 0 deletions src/app/components/model_tree/model_tree_line.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ angular
var source_name = item.name;
$state.go('dbt.source_list', {source: source_name});
}
else if (scope.depth === 0 && item.type !== 'database') {
$state.go('dbt.project_overview', { project_name: item.name });
}
}

scope.activate = function(item) {
Expand Down
10 changes: 9 additions & 1 deletion src/app/index.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ angular
.state('dbt.overview', {
url: 'overview?' + graph_params,
controller: 'OverviewCtrl',
templateUrl: templates.overview
templateUrl: templates.overview,
})
.state('dbt.project_overview', {
url: 'overview/:project_name?' + graph_params,
controller: 'OverviewCtrl',
templateUrl: templates.overview,
params: {
project_name: {type: 'string'}
}
})
.state('dbt.graph', {
url: 'graph',
Expand Down
16 changes: 12 additions & 4 deletions src/app/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@ angular
$scope.overview_md = '(loading)'

projectService.ready(function(project) {

let project_name = $state.params.project_name
? $state.params.project_name
: null;

// default;
var selected_overview = project.docs["dbt.__overview__"];

var overviews = _.filter(project.docs, {name: '__overview__'});
_.each(overviews, function(overview) {
_.each(overviews, function (overview) {
if (overview.package_name != 'dbt') {
selected_overview = overview;
}
});

if (project_name !== null) {
let project_key = `${project_name}.__${project_name}__`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll want to let top-level projects "override" the project-level overviews of installed packages. If my_project installs the snowplow package, I would want my_project.__snowplow__ to take precedence over snowplow.__snowplow__, especially if the latter doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @jtcohen6 I'm glad you like the idea, I agree with your comment completely. I added a new commit that I think should handle that scenario. Let me know if you think it needs any other change.

let project_overview = project.docs[project_key];
if (project_overview !== undefined) {
selected_overview = project_overview;
}
}
$scope.overview_md = selected_overview.block_contents;
});
}]);