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

Adds report node type #136

Merged
merged 4 commits into from
Sep 16, 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## dbt 0.19.0 (Release TBD)

## dbt 0.18.1 (Unreleased)
- Add Report nodes ([docs#135](https://github.com/fishtown-analytics/dbt-docs/issues/135), [docs#136](https://github.com/fishtown-analytics/dbt-docs/pull/136))

## dbt 0.18.0 (September 2, 2020)
- Add project level overviews ([docs#127](https://github.com/fishtown-analytics/dbt-docs/issues/127))

Expand Down
30 changes: 30 additions & 0 deletions ci-project/models/export.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2

reports:
- name: crm_export
type: application
maturity: medium
description: >
An export model that is synced to our CRM nightly at 11pm ET

depends_on:
- ref('fct_orders')
- ref('dim_customers')

owner:
name: Alice Analyst
email: alice@example.com

- name: weekly_metrics
type: dashboard
maturity: high
url: https://www.getdbt.com
description: >
The Big Numbers, shared in #product every Monday morning. **Cool dashboard**

depends_on:
- ref('dim_customers')

owner:
name: Data Team
email: data@example.com
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.

11 changes: 11 additions & 0 deletions src/app/components/model_tree/model_tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
<br />
</div>

<div ng-show="tree.reports.length > 0">
<strong>Reports</strong>
<ul style="display: block">
<model-tree-line
item="item"
resource-type="report"
ng-repeat="item in tree.reports"></model-tree-line>
</ul>
<br />
</div>

<strong>Projects</strong>
<ul>
<model-tree-line
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/references/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="panel">
<div class="panel-body" ng-if="!has_references">
No resources reference this macro
No resources reference this {{ node.resource_type }}
</div>
<div class="panel-body" ng-if="has_references">
<ul class="nav nav-tabs">
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/references/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ angular
return {
scope: {
references: '=',
node: '=',
},
restrict: 'E',
templateUrl: template,
Expand All @@ -30,6 +31,8 @@ angular
scope.mapResourceType = function(type) {
if (type == 'model') {
return 'Models';
} else if (type == 'seed') {
return 'Seeds';
} else if (type == 'test') {
return 'Tests';
} else if (type == 'snapshot') {
Expand All @@ -38,6 +41,8 @@ angular
return 'Analyses';
} else if (type == 'macro') {
return 'Macros';
} else if (type == 'report') {
return 'Reports';
} else {
return 'Nodes';
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/table_details/table_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h6>Details</h6>
</div>
<div class="detail-group">
<div class="detail-body">
<dl class='detail' ng-if="model.tags != undefined">
<dl class='detail' ng-if="model.tags != undefined && exclude.indexOf('tags') == -1">
<dt class="detail-label">Tags</dt>
<dd ng-if="model.tags.length > 0" class="detail-value">
<span ng-repeat="tag in model.tags"><code><a ng-click=queryTag(tag)>{{ tag }}</a></code>&nbsp;</span>
Expand Down
9 changes: 7 additions & 2 deletions src/app/components/table_details/table_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ angular
return {
scope: {
model: '=',
extras: '='
extras: '=',
exclude: '<',
},
templateUrl: template,
link: function(scope) {

scope.details = [];
scope.extended = [];
scope.exclude = scope.exclude || [];
scope.meta = null;
scope._show_expanded = false;

Expand Down Expand Up @@ -152,7 +154,10 @@ angular
scope.extended = getExtendedStats(nv.stats);

if (scope.extras) {
scope.details = scope.details.concat(scope.extras);
var extrasToAdd = _.filter(scope.extras, function(extra) {
return extra.value !== undefined && extra.value !== null;
});
scope.details = scope.details.concat(extrasToAdd);
}

scope.show_extended = _.where(scope.extended, {include: true}).length > 0;
Expand Down
9 changes: 0 additions & 9 deletions src/app/docs/analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ <h1>
<div class="app-frame app-pad-h">
<ul class="nav nav-tabs">
<li ui-sref-active='active'><a ui-sref="dbt.analysis({'#': 'description'})">Description</a></li>
<li ui-sref-active='active' ng-show = "referencesLength != 0"><a ui-sref="dbt.analysis({'#': 'referenced_by'})">Referenced By</a></li>
<li ui-sref-active='active' ng-show = "parentsLength != 0"><a ui-sref="dbt.analysis({'#': 'depends_on'})">Depends On</a></li>
<li ui-sref-active='active'><a ui-sref="dbt.analysis({'#': 'sql'})">SQL</a></li>
</ul>
Expand All @@ -56,14 +55,6 @@ <h6>Description</h6>
</div>
</section>

<section class="section" ng-show = "referencesLength != 0">
<div class="section-target" id="referenced_by"></div>
<div class="section-content">
<h6>Referenced By</h6>
<reference-list references="references" />
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
Expand Down
1 change: 1 addition & 0 deletions src/app/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ require('./snapshot');
require('./test');
require('./macro');
require('./analysis');
require('./report');
4 changes: 2 additions & 2 deletions src/app/docs/macro.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ <h6>Arguments</h6>
<div class="section-target" id="referenced_by"></div>
<div class="section-content">
<h6>Referenced By</h6>
<reference-list references="references" />
<reference-list references="references" node="macro" />
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" />
<reference-list references="parents" node="macro" />
</div>
</section>

Expand Down
4 changes: 2 additions & 2 deletions src/app/docs/model.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ <h6>Columns</h6>
<div class="section-target" id="referenced_by"></div>
<div class="section-content">
<h6>Referenced By</h6>
<reference-list references="references" />
<reference-list references="references" node="model" />
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" />
<reference-list references="parents" node="model" />
</div>
</section>

Expand Down
75 changes: 75 additions & 0 deletions src/app/docs/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<style>
/* TODO */
.section-target {
top: -8em;
}

.noflex {
flex: 0 0 160px !important;
}

.highlight {
color: #24292e;
background-color: white;
}

</style>

<div class='app-scroll'>
<div class="app-links app-sticky">
<div class="app-title">
<div class="app-frame app-pad app-flush-bottom">

<h1>
<span class="break">{{ report.name }}</span>
<small>report</small>

<div class='pull-right' ng-show="report.url">
<a class='btn text-white btn-primary btn-sm' ng-href="{{ report.url }}" target="_blank">View this report</a>
</div>

<div class='clearfix'></div>
</h1>

</div>
</div>
<div class="app-frame app-pad-h">
<ul class="nav nav-tabs">
<li ui-sref-active='active'><a ui-sref="dbt.report({'#': 'details'})">Details</a></li>
<li ui-sref-active='active'><a ui-sref="dbt.report({'#': 'description'})">Description</a></li>
<li ui-sref-active='active' ng-show = "parentsLength != 0"><a ui-sref="dbt.report({'#': 'depends_on'})">Depends On</a></li>
</ul>
</div>
</div>
<div class="app-details">
<div class="app-frame app-pad">

<section class="section">
<div class="section-target" id="details"></div>
<table-details model="report" extras="extra_table_fields" exclude="['tags']" />
</section>

<section class="section">
<div class="section-target" id="description"></div>
<div class="section-content">
<h6>Description</h6>
<div class="panel">
<div class="panel-body">
<div ng-if="report.description" class="model-markdown" marked="report.description"></div>
<div ng-if="!report.description">This {{ report.resource_type }} is not currently documented</div>
</div>
</div>
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" node="report" />
</div>
</section>

</div>
</div>
</div>
41 changes: 41 additions & 0 deletions src/app/docs/report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

const angular = require('angular');
const dag_utils = require('./dag_utils')
require("./styles.css");

angular
.module('dbt')
.controller('ReportCtrl', ['$scope', '$state', 'project', 'code', '$anchorScroll', '$location',
function($scope, $state, projectService, codeService, $anchorScroll, $location) {

$scope.model_uid = $state.params.unique_id;
$scope.project = projectService;

$scope.codeService = codeService;
$scope.extra_table_fields = [];
$scope.versions = {};

$scope.report = {};
projectService.ready(function(project) {
let report = project.nodes[$scope.model_uid];
$scope.report = report;
$scope.parents = dag_utils.getParents(project, report);
$scope.parentsLength = $scope.parents.length;

$scope.extra_table_fields = [
{
name: "Maturity",
value: $scope.report.maturity,
},
{
name: "Owner",
value: $scope.report.owner.name,
},
{
name: "Owner email",
value: $scope.report.owner.email,
},
]
})
}]);
4 changes: 2 additions & 2 deletions src/app/docs/seed.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ <h6>Columns</h6>
<div class="section-target" id="referenced_by"></div>
<div class="section-content">
<h6>Referenced By</h6>
<reference-list references="references" />
<reference-list references="references" node="model" />
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" />
<reference-list references="parents" node="model" />
</div>
</section>

Expand Down
4 changes: 2 additions & 2 deletions src/app/docs/snapshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ <h6>Columns</h6>
<div class="section-target" id="referenced_by"></div>
<div class="section-content">
<h6>Referenced By</h6>
<reference-list references="references" />
<reference-list references="references" node="model" />
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" />
<reference-list references="parents" node="model" />
</div>
</section>

Expand Down
11 changes: 1 addition & 10 deletions src/app/docs/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ <h1>
<li ui-sref-active='active'><a ui-sref="dbt.source({'#': 'description'})">Description</a></li>
<li ui-sref-active='active'><a ui-sref="dbt.source({'#': 'columns'})">Columns</a></li>
<li ui-sref-active='active' ng-show = "referencesLength != 0"><a ui-sref="dbt.source({'#': 'referenced_by'})">Referenced By</a></li>
<li ui-sref-active='active' ng-show = "parentsLength != 0"><a ui-sref="dbt.source({'#': 'depends_on'})">Depends On</a></li>
<li ui-sref-active='active'><a ui-sref="dbt.source({'#': 'code'})">SQL</a></li>
</ul>
</div>
Expand Down Expand Up @@ -67,15 +66,7 @@ <h6>Columns</h6>
<div class="section-target" id="referenced_by"></div>
<div class="section-content">
<h6>Referenced By</h6>
<reference-list references="references" />
</div>
</section>

<section class="section" ng-show = "parentsLength != 0">
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" />
<reference-list references="references" node="model" />
</div>
</section>

Expand Down
Loading