Skip to content

Commit

Permalink
Merge pull request #71 from fishtown-analytics/feature/hide-models
Browse files Browse the repository at this point in the history
hide models from sidebar and dim in DAG
  • Loading branch information
drewbanin authored Mar 2, 2020
2 parents 6bbf4e3 + d4620e8 commit d8bbc40
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/app/docs/model.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<div class="app-links app-sticky">
<div class="app-title">
<div class="app-frame app-pad app-flush-bottom">
<h1 ng-if="model.docs.show === false">
<small class='text-bold text-right'>
<i data-icon="eye"></i>
This model is hidden
</small>
</h1>
<h1>
<span class="break">{{ model.name }}</span>
<small>{{ model.config.materialized }}</small>
Expand Down
6 changes: 6 additions & 0 deletions src/app/docs/seed.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<div class="app-links app-sticky">
<div class="app-title">
<div class="app-frame app-pad app-flush-bottom">
<h1 ng-if="model.docs.show === false">
<small class='text-bold text-right'>
<i data-icon="eye"></i>
This {{ model.resource_type }} is hidden
</small>
</h1>
<h1>
<span class="break">{{ model.name }}</span>
<small>{{ model.config.materialized }}</small>
Expand Down
6 changes: 6 additions & 0 deletions src/app/docs/snapshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<div class="app-links app-sticky">
<div class="app-title">
<div class="app-frame app-pad app-flush-bottom">
<h1 ng-if="model.docs.show === false">
<small class='text-bold text-right'>
<i data-icon="eye"></i>
This {{ model.resource_type }} is hidden
</small>
</h1>
<h1>
<span class="break">{{ model.name }}</span>
<small>{{ model.config.materialized }}</small>
Expand Down
14 changes: 13 additions & 1 deletion src/app/services/graph.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,14 @@ angular
style: {
'background-color': '#919599',
}
}
},
{
selector: 'node[hidden=1]',
style: {
'background-color': '#919599',
'background-opacity': 0.5,
}
},
],
ready: function(e) {
console.log("graph ready");
Expand Down Expand Up @@ -269,6 +276,7 @@ angular
_.each(service.graph.elements, function(el) {
el.data['display'] = 'none';
el.data['selected'] = 0;
el.data['hidden'] = 0;
el.classes = classes;
});

Expand All @@ -279,6 +287,10 @@ angular
if (highlight && _.includes(highlight, el.data.unique_id)) {
el.data['selected'] = 1;
}

if (el.data.docs && el.data.docs.show === false) {
el.data['hidden'] = 1;
}
});
service.graph.elements = _.filter(elements, function(e) { return e.data.display == 'element'});

Expand Down
9 changes: 7 additions & 2 deletions src/app/services/project_service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

const angular = require('angular');
const $ = require('jquery');
const _ = require('underscore');

import merge from 'deepmerge';

Expand Down Expand Up @@ -476,9 +475,12 @@ angular
var macros = macros || [];

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

if (node.original_file_path.indexOf("\\") != -1) {
Expand Down Expand Up @@ -530,7 +532,10 @@ angular

var databases = {};
var tree_nodes = _.select(nodes, function(node) {
if (_.indexOf(['source', 'snapshot', 'seed'], node.resource_type) != -1) {
var show = _.get(node, ['docs', 'show'], true);
if (!show) {
return false;
} else if (_.indexOf(['source', 'snapshot', 'seed'], node.resource_type) != -1) {
return true;
} else if (node.resource_type == 'model') {
return node.config.materialized != 'ephemeral';
Expand Down

0 comments on commit d8bbc40

Please sign in to comment.