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

Implemented select/deselect option for tags dropup in graph editor #138

Merged
merged 7 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## dbt 0.19.0 (Release TBD)
- Add select/deselect option in tags dropup in graph editor. ([docs#98](https://github.com/fishtown-analytics/dbt-docs/issues/98))

Contributors:
Copy link
Contributor

Choose a reason for hiding this comment

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

can you just add yourself as a contributor in the existing section below? Looks like we have two contributor sections for the 0.19.0 release now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, yep just corrected it thanks.

- [@Mr-Nobody99](https://github.com/Mr-Nobody99) ([docs#138](https://github.com/fishtown-analytics/dbt-docs/pull/138))

## dbt 0.18.1 (Unreleased)
- 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))
Expand Down
18 changes: 18 additions & 0 deletions src/app/components/graph/graph-launcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ <h6>
<ul
class="dropdown-menu"
ng-show="isVisible('resource_types')">
<li ng-click="onSelectAll('resource_types', allSelected ? false : true, $event)">
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious - why do allSelected ? false : true instead of !allSelected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason I didn't think of that, but that is a bit cleaner I'll change it.

<strong class="text-dark">Select All</strong>
<span ng-show="allSelected">
<svg class="checked" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/></svg>
</span>
</li>
<li
class='text-dark'
ng-repeat="item in selectorService.options.resource_types"
Expand Down Expand Up @@ -144,6 +150,12 @@ <h6>
<ul
class="dropdown-menu"
ng-show="isVisible('packages')">
<li ng-click="onSelectAll('packages', allSelected ? false : true, $event)">
<strong class="text-dark">Select All</strong>
<span ng-show="allSelected">
<svg class="checked" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/></svg>
</span>
</li>
<li
class='text-dark'
ng-repeat="item in selectorService.options.packages"
Expand Down Expand Up @@ -173,6 +185,12 @@ <h6>
<ul
class="dropdown-menu"
ng-show="isVisible('tags')">
<li ng-click="onSelectAll('tags', allSelected ? false : true, $event)">
<strong class="text-dark">Select All</strong>
<span ng-show="allSelected">
<svg class="checked" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/></svg>
</span>
</li>
<li
class='text-dark'
ng-repeat="item in selectorService.options.tags"
Expand Down
13 changes: 13 additions & 0 deletions src/app/components/graph/graph-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ angular

scope.graphService = graph;
scope.selectorService = selectorService;
scope.allSelected = true;

var forms = {
tags: {
Expand Down Expand Up @@ -79,6 +80,18 @@ angular
return dirty.indexOf(item) != -1;
}

scope.onSelectAll = function(form, mode, e) {
var dirty = selectorService.selection.dirty;
if (mode) {
dirty[form] = [...selectorService.options[form]];
} else {
dirty[form] = [];
}

scope.allSelected = !scope.allSelected;
e.preventDefault();
}

scope.onItemSelect = function(form, item, e) {
var dirty = selectorService.selection.dirty;
if (scope.isSelected(form, item)) {
Expand Down