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

Feature/0.18 node selectors #118

Merged
merged 5 commits into from
Aug 3, 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
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
dev:
DBT_DOCS_ENV=development npm start

watch:
npm run-script watch

test:
npm test

dist: clean
DBT_DOCS_ENV=production webpack
rm -rf dist/fonts dist/main.js dist/main.js.map

dist-ci: clean
submodule:
git submodule init
git submodule update
jekyll build -s styles/ -d styles/_site

dist-ci: clean submodule test
DBT_DOCS_ENV=production webpack
cp data/*.json dist/

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"scripts": {
"test": "jest src/app/services",
"watch": "jest --watch src/app/services",
"start": "webpack-dev-server --disable-host-check"
},
"devDependencies": {
"angular": "^1.7.9",
"angular-loader": "~1.5.0",
Expand All @@ -25,6 +30,7 @@
"html-webpack-plugin": "^3.2.0",
"html5-boilerplate": "^5.3.0",
"inline-source": "^6.1.5",
"jest": "^26.2.2",
"jquery": "~3.4.0",
"md5": "^2.2.1",
"ngtemplate-loader": "^2.0.1",
Expand All @@ -40,10 +46,6 @@
"webpack-dev-server": "^3.1.11",
"webpack-inline-svg-plugin": "^1.1.4"
},
"scripts": {
"test": "echo 'Error: no test specified' && exit 1",
"start": "webpack-dev-server"
},
"dependencies": {
"prismjs": "^1.20.0"
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/code_block/code_block.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ <h6>Code</h6>
</li>
</ul>
<div style="margin-top: 1px">
<pre class='code line-numbers'><code class="source-code highlight language-sql" ng-bind-html="highlighted"></code></pre>
<pre style="background-color: white"
class='code line-numbers'><code class="source-code highlight language-sql" ng-bind-html="highlighted"></code></pre>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion src/app/components/graph/graph-launcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ <h6>
class="field-input form-control input-dark"
ng-model="selectorService.selection.dirty.include"
placeholder="..." />
<div class="field-label">--models</div>
<div class="field-label">--select</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this changes the --models label to --select, which feels appropriate if not 100% accurate all of the time. Probably something we should give more thought to for a future iteration of this UI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this change. It feels right to have the DAG mirror the behavior and syntax of dbt ls. And as Jake pointed out to me (not long ago), dbt ls --models ... is basically dbt ls --resource-type model --select.

</label>
<label class="field" style="flex: 4 0 160px">
<input type="text"
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/graph/graph-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ angular
var clean_selector = selectorService.selection.clean;
var dirty_selector = selectorService.selection.dirty;

var clean_nodes = selectorService.select_nodes(dag, all_nodes, clean_selector)
var dirty_nodes = selectorService.select_nodes(dag, all_nodes, dirty_selector)
var clean_nodes = selectorService.selectNodes(dag, all_nodes, clean_selector)
var dirty_nodes = selectorService.selectNodes(dag, all_nodes, dirty_selector)

var nodes_to_remove = _.difference(clean_nodes.nodes, dirty_nodes.nodes);
var nodes_to_remove = _.difference(clean_nodes.selected, dirty_nodes.selected);

graph.markDirty(nodes_to_remove)

Expand Down
13 changes: 7 additions & 6 deletions src/app/services/graph.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const $ = require('jquery');
const _ = require('underscore');

const graphlib = require('graphlib');
const selectorGraph = require('./selector_graph');

angular
.module('dbt')
Expand Down Expand Up @@ -44,8 +45,8 @@ angular
}

var dag = service.graph.pristine.dag;
var parents = _.sortBy(selectorService.ancestors(dag, primary_node_id, 1));
var children = _.sortBy(selectorService.descendents(dag, primary_node_id, 1));
var parents = _.sortBy(selectorGraph.ancestorNodes(dag, primary_node_id, 1));
var children = _.sortBy(selectorGraph.descendentNodes(dag, primary_node_id, 1));

var is_parent = _.partial(_.includes, parents);
var is_child = _.partial(_.includes, children);
Expand Down Expand Up @@ -394,10 +395,10 @@ angular
// good: "+source:quickbooks.invoices+"

var pristine = service.graph.pristine.nodes;
var selected = selectorService.select_nodes(dag, pristine, selected_spec);
var selected = selectorService.selectNodes(dag, pristine, selected_spec);
var highlight_nodes = should_highlight ? selected.matched : [];

return setNodes(selected.nodes, highlight_nodes, classes);
return setNodes(selected.selected, highlight_nodes, classes);
}

service.hideGraph = function() {
Expand Down Expand Up @@ -479,8 +480,8 @@ angular

// get all edges that pass through this node
var dag = service.graph.pristine.dag;
var parents = _.indexBy(selectorService.ancestors(dag, node_id));
var children = _.indexBy(selectorService.descendents(dag, node_id));
var parents = _.indexBy(selectorGraph.ancestorNodes(dag, node_id));
var children = _.indexBy(selectorGraph.descendentNodes(dag, node_id));

parents[node_id] = node_id;
children[node_id] = node_id;
Expand Down
Loading