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 all 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## dbt 0.18.0 (Release TBD)
- Add project level overviews ([docs#127](https://github.com/fishtown-analytics/dbt-docs/issues/127))

Contributors:
- [@Mr-Nobody99](https://github.com/Mr-Nobody99) ([docs#129](https://github.com/fishtown-analytics/dbt-docs/pull/129))

## dbt 0.18.0rc1 (August 19, 2020)

Expand Down
14 changes: 14 additions & 0 deletions ci-project/models/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ This [dbt](https://www.getdbt.com/) project is for demonstrations and tutorials.
The source code can be found [here](https://github.com/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 %}

{% docs __dbt_utils__ %}
## DBT_UTILS package overview
This [dbt package](https://docs.getdbt.com/docs/building-a-dbt-project/package-management) is a collection of tools to help with common tasks.
{% 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.

2 changes: 1 addition & 1 deletion data/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/run_results.json

Large diffs are not rendered by default.

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
24 changes: 17 additions & 7 deletions src/app/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@ angular
.module('dbt')
.controller('OverviewCtrl', ['$scope', '$state', 'project',
function($scope, $state, projectService) {

$scope.overview_md = '(loading)'

projectService.ready(function(project) {


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

// Select project-level overviews
if (project_name !== null) {
selected_overview = project.docs[`${project_name}.__${project_name}__`] || selected_overview
let overviews = _.filter(project.docs, { name: `__${project_name}__` })
_.each(overviews, (overview) => {
if (overview.package_name !== project_name) {
selected_overview = overview
}
})
}
$scope.overview_md = selected_overview.block_contents;
});
}]);