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

Rename reports to exposures #137

Merged
merged 2 commits into from
Sep 22, 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 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))
- Add Exposure nodes ([docs#135](https://github.com/fishtown-analytics/dbt-docs/issues/135), [docs#136](https://github.com/fishtown-analytics/dbt-docs/pull/136), [docs#137](https://github.com/fishtown-analytics/dbt-docs/pull/137))

## dbt 0.18.0 (September 2, 2020)
- Add project level overviews ([docs#127](https://github.com/fishtown-analytics/dbt-docs/issues/127))
Expand Down
2 changes: 1 addition & 1 deletion ci-project/models/export.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2

reports:
exposures:
- name: crm_export
type: application
maturity: medium
Expand Down
2 changes: 1 addition & 1 deletion data/manifest.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/app/components/graph/graph-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ angular

if (node && node.resource_type == 'source') {
var nodes = graph.showFullGraph('source:' + node.source_name + "." + node.name);
} else if (node && node.resource_type == 'exposure') {
var nodes = graph.showFullGraph('exposure:' + node.name);
} else {
var nodes = graph.showFullGraph(node_name);
}
Expand All @@ -149,6 +151,8 @@ angular
var node = selectorService.getViewNode();
if (node && node.resource_type == 'source') {
var nodes = graph.showVerticalGraph('source:' + node.source_name + "." + node.name, true);
} else if (node && node.resource_type == 'exposure') {
var nodes = graph.showVerticalGraph('exposure:' + node.name, true);
} else {
var nodes = graph.showVerticalGraph(node.name, true);
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/model_tree/model_tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
<br />
</div>

<div ng-show="tree.reports.length > 0">
<strong>Reports</strong>
<div ng-show="tree.exposures.length > 0">
<strong>Exposures</strong>
<ul style="display: block">
<model-tree-line
item="item"
resource-type="report"
ng-repeat="item in tree.reports"></model-tree-line>
resource-type="exposure"
ng-repeat="item in tree.exposures"></model-tree-line>
</ul>
<br />
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/references/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ angular
return 'Analyses';
} else if (type == 'macro') {
return 'Macros';
} else if (type == 'report') {
return 'Reports';
} else if (type == 'exposure') {
return 'Exposures';
} else {
return 'Nodes';
}
Expand Down
22 changes: 11 additions & 11 deletions src/app/docs/report.html → src/app/docs/exposure.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<div class="app-frame app-pad app-flush-bottom">

<h1>
<span class="break">{{ report.name }}</span>
<small>report</small>
<span class="break">{{ exposure.name }}</span>
<small>exposure</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 class='pull-right' ng-show="exposure.url">
<a class='btn text-white btn-primary btn-sm' ng-href="{{ exposure.url }}" target="_blank">View this exposure</a>
</div>

<div class='clearfix'></div>
Expand All @@ -35,9 +35,9 @@ <h1>
</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>
<li ui-sref-active='active'><a ui-sref="dbt.exposure({'#': 'details'})">Details</a></li>
<li ui-sref-active='active'><a ui-sref="dbt.exposure({'#': 'description'})">Description</a></li>
<li ui-sref-active='active' ng-show = "parentsLength != 0"><a ui-sref="dbt.exposure({'#': 'depends_on'})">Depends On</a></li>
</ul>
</div>
</div>
Expand All @@ -46,7 +46,7 @@ <h1>

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

<section class="section">
Expand All @@ -55,8 +55,8 @@ <h1>
<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 ng-if="exposure.description" class="model-markdown" marked="exposure.description"></div>
<div ng-if="!exposure.description">This {{ exposure.resource_type }} is not currently documented</div>
</div>
</div>
</div>
Expand All @@ -66,7 +66,7 @@ <h6>Description</h6>
<div class="section-target" id="depends_on"></div>
<div class="section-content">
<h6>Depends On</h6>
<reference-list references="parents" node="report" />
<reference-list references="parents" node="exposure" />
</div>
</section>

Expand Down
14 changes: 7 additions & 7 deletions src/app/docs/report.js → src/app/docs/exposure.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ angular
$scope.extra_table_fields = [];
$scope.versions = {};

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

$scope.extra_table_fields = [
{
name: "Maturity",
value: $scope.report.maturity,
value: $scope.exposure.maturity,
},
{
name: "Owner",
value: $scope.report.owner.name,
value: $scope.exposure.owner.name,
},
{
name: "Owner email",
value: $scope.report.owner.email,
value: $scope.exposure.owner.email,
},
]
})
Expand Down
2 changes: 1 addition & 1 deletion src/app/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ require('./snapshot');
require('./test');
require('./macro');
require('./analysis');
require('./report');
require('./exposure');
2 changes: 2 additions & 0 deletions src/app/graph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ angular
function getNodeSelector(node) {
if (node && node.resource_type == 'source') {
return 'source:' + node.source_name + "." + node.name;
} else if (node && node.resource_type == 'exposure') {
return 'exposure:' + node.name;
} else if (node.name) {
return node.name;
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/app/index.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const templates = {
test: require('./docs/test.html'),
analysis: require('./docs/analysis.html'),
macro: require('./docs/macro.html'),
report: require('./docs/report.html'),
exposure: require('./docs/exposure.html'),
}

angular
Expand Down Expand Up @@ -115,10 +115,10 @@ angular
unique_id: {type: 'string'}
},
})
.state('dbt.report', {
url: 'report/:unique_id?section&' + graph_params,
.state('dbt.exposure', {
url: 'exposure/:unique_id?section&' + graph_params,
controller: 'ReportCtrl',
templateUrl: templates.report,
templateUrl: templates.exposure,
params: {
unique_id: {type: 'string'}
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ angular
$scope.tree.database = tree.database;
$scope.tree.project = tree.project;
$scope.tree.sources = tree.sources;
$scope.tree.reports = tree.reports;
$scope.tree.exposures = tree.exposures;

setTimeout(function() {
scrollToSelectedModel($scope.model_uid);
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/graph.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ angular
}
},
{
selector: 'node[resource_type="report"]',
selector: 'node[resource_type="exposure"]',
style: {
'background-color': '#ff694b',
}
Expand Down Expand Up @@ -329,7 +329,7 @@ angular


_.each(_.filter(service.manifest.nodes, function(node) {
var is_graph_type = _.includes(['model', 'seed', 'source', 'snapshot', 'analysis', 'report'], node.resource_type);
var is_graph_type = _.includes(['model', 'seed', 'source', 'snapshot', 'analysis', 'exposure'], node.resource_type);
var is_data_test = node.resource_type == 'test' && _.includes(node.tags, 'data');
return is_graph_type || is_data_test;
}), function(node) {
Expand Down
11 changes: 8 additions & 3 deletions src/app/services/node_selection_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ angular
'source',
'test',
'analysis',
'report',
'exposure',
],
depth: 1,
};
Expand All @@ -35,7 +35,7 @@ angular
options: {
packages: [],
tags: [null],
resource_types: ['model', 'seed', 'snapshot', 'source', 'test', 'analysis', 'report'],
resource_types: ['model', 'seed', 'snapshot', 'source', 'test', 'analysis', 'exposure'],
}
};

Expand All @@ -51,10 +51,12 @@ angular

service.resetSelection = function(node) {
var include_selection;
if (node && _.includes(['model', 'seed', 'snapshot', 'report'], node.resource_type)) {
if (node && _.includes(['model', 'seed', 'snapshot'], node.resource_type)) {
include_selection = '+' + node.name + '+';
} else if (node && node.resource_type == 'source') {
include_selection = '+source:' + node.source_name + "." + node.name + '+';
} else if (node && node.resource_type == 'exposure') {
include_selection = '+exposure:' + node.name;
} else if (node && _.includes(['analysis', 'test'], node.resource_type)) {
include_selection = '+' + node.name;
} else {
Expand Down Expand Up @@ -87,6 +89,9 @@ angular
if (node.resource_type == 'source') {
pre += "source:"
node_name = node.source_name + "." + node.name;
} else if (node.resource_type == 'exposure') {
pre += "exposure:"
node_name = node.name;
} else {
node_name = node.name;
}
Expand Down
40 changes: 20 additions & 20 deletions src/app/services/project_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ angular
service.files.manifest.nodes[node.unique_id] = node;
});

// Add reports back into nodes to make site logic work
_.each(service.files.manifest.reports, function(node) {
// Add exposures back into nodes to make site logic work
_.each(service.files.manifest.exposures, function(node) {
node.label = node.name;
service.files.manifest.nodes[node.unique_id] = node;
});
Expand Down Expand Up @@ -244,7 +244,7 @@ angular
});

var search_nodes = _.filter(service.project.nodes, function(node) {
return _.includes(['model', 'source', 'seed', 'snapshot', 'analysis', 'report'], node.resource_type);
return _.includes(['model', 'source', 'seed', 'snapshot', 'analysis', 'exposure'], node.resource_type);
});

service.project.searchable = _.filter(search_nodes.concat(search_macros), function(obj) {
Expand Down Expand Up @@ -352,7 +352,7 @@ angular
return true;
}

var accepted = ['snapshot', 'source', 'seed', 'model', 'analysis', 'report'];
var accepted = ['snapshot', 'source', 'seed', 'model', 'analysis', 'exposure'];
return _.includes(accepted, node.resource_type);
})

Expand All @@ -362,8 +362,8 @@ angular
var sources = _.values(service.project.sources);
service.tree.sources = buildSourceTree(sources, select);

var reports = _.values(service.project.reports);
service.tree.reports = buildReportTree(reports, select);
var exposures = _.values(service.project.exposures);
service.tree.exposures = buildReportTree(exposures, select);

cb(service.tree);
});
Expand Down Expand Up @@ -392,7 +392,7 @@ angular
service.updateSelectedInTree(select, service.tree.project);
service.updateSelectedInTree(select, service.tree.database);
service.updateSelectedInTree(select, service.tree.sources);
service.updateSelectedInTree(select, service.tree.reports);
service.updateSelectedInTree(select, service.tree.exposures);

return service.tree;
}
Expand Down Expand Up @@ -454,7 +454,7 @@ angular
}

function buildReportTree(nodes, select) {
var reports = {}
var exposures = {}

_.each(nodes, function(node) {
var name = node.name;
Expand All @@ -464,36 +464,36 @@ angular

var is_active = node.unique_id == select;

if (!reports[type]) {
reports[type] = {
if (!exposures[type]) {
exposures[type] = {
type: "folder",
name: type,
active: is_active,
items: []
};
} else if (is_active) {
reports[type].active = true;
exposures[type].active = true;
}

reports[type].items.push({
exposures[type].items.push({
type: 'file',
name: name,
node: node,
active: is_active,
unique_id: node.unique_id,
node_type: 'report'
node_type: 'exposure'
})
});

// sort report types
var reports = _.sortBy(_.values(reports), 'name');
// sort exposure types
var exposures = _.sortBy(_.values(exposures), 'name');

// sort entries in the report folder
_.each(reports, function(report) {
report.items = _.sortBy(report.items, 'name');
// sort entries in the exposure folder
_.each(exposures, function(exposure) {
exposure.items = _.sortBy(exposure.items, 'name');
});

return reports
return exposures
}

function consolidateAdapterMacros(macros, adapter) {
Expand Down Expand Up @@ -542,7 +542,7 @@ angular

_.each(nodes.concat(macros), function(node) {
var show = _.get(node, ['docs', 'show'], true);
if (node.resource_type == 'source' || node.resource_type == 'report') {
if (node.resource_type == 'source' || node.resource_type == 'exposure') {
// no sources in the model tree, sorry
return;
} else if (!show) {
Expand Down
Loading