Skip to content

Commit

Permalink
Merge pull request #129 from Mr-Nobody99/feature/individual-overviews
Browse files Browse the repository at this point in the history
Implemented individual overview functionality.
  • Loading branch information
jtcohen6 authored Aug 27, 2020
2 parents 1d68168 + 73b3bf6 commit 294f68b
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 11 deletions.
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 %}
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;
});
}]);

0 comments on commit 294f68b

Please sign in to comment.