-
Notifications
You must be signed in to change notification settings - Fork 90
pfFilterPanel #540
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
pfFilterPanel #540
Conversation
ec3d9f5 to
09a981e
Compare
|
@dtaylor113 this looks great! Just checking that this implementation will not restrict what we need in OpenShift. There we will need the keyword search to match multiple fields associated with the item ( name, description, label, etc ). I'm pretty sure that you already mentioned it's up to the developer using the filter panel, but wanted to verify. +1 to allowing us to see ngDocs and run the example without having to build 😃 👍 |
| * @description | ||
| * The Filter Panel is opened and closed by clicking on the Filter button. It can contain any HTML desired by | ||
| * the end user. As such, the end user is repsonsible for constructing the <code>appliedFilters</code> array which is passed to | ||
| * the filter results tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"end user" should probably say "application" or "application developer"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, Fixed, thanks
| updateFilterPanelModel(changedFilterId, changedFilterValue); | ||
| } else { | ||
| // the 'Clear All Filters' link was clicked | ||
| resetFilterPanelModel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I like this being stated as the way to determine that clear all was clicked. The appliedFilters list would be empty, that is all that should need to be known.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It they click on the 'x' for all the values of all filter, then the appliedFilters list would be empty, but they didn't click on the clear all. I could program it that way, but it's less efficient in the scenario I just mentioned because clicking on the last 'x' would trigger resetFilterPanelModel() which goes through the entire model (as opposed to just clearing the last filter value whose 'x' was clicked)
| var matches = true; | ||
| _.forEach(filters, function(filter) { | ||
| if (!matchesFilter(item, filter)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: would be nice to be consistent in the forEach use, either lodash or array.forEach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would have to be lodash because we need to break out of these loops and you can't break out of an array.forEach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, switch to lodash _forEach.
| <span class="toolbar-pf-results"> | ||
| <h5> | ||
| {{$ctrl.config.resultsCount}} | ||
| <span ng-if="$ctrl.config.appliedFilters.length > 0"> of {{$ctrl.config.totalCount}}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could remove the '> 0'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| <ul class="list-inline category-values"> | ||
| <li ng-repeat="value in filter.values"> | ||
| <span class="active-filter label label-info">{{value}} | ||
| <a><span ng-click="$ctrl.clearFilter($parent.$index, $index)" class="pficon pficon-close"></span></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use filter and value here and not then need to look them up in the controller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, got a little crazy here, a few rounds of implementation.
Fixed, removed the use of indexes.
src/filters/filters.less
Outdated
| } | ||
| } | ||
|
|
||
| .label-category { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems too generic to me, how about pf-filter-label-category ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/filters/filters.less
Outdated
| } | ||
| } | ||
| .list-inline > li { | ||
| padding-right: 0px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the px
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
|
||
| .category-option-label { | ||
| vertical-align: text-bottom; | ||
| font-size: 12px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: alpha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/filters/filters.less
Outdated
| background-color: @color-pf-blue-500; | ||
| font-weight: 700; | ||
| padding-right: 2px; | ||
| padding-left: 0px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove px
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/filters/filters.less
Outdated
| padding-right: 0px; | ||
| @media(max-width: @screen-md-min) { | ||
| margin-bottom: 3px; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Played with the responsiveness a bunch, there are some issues with the patternfly implementation here and the general layout. I don't think adding the 3px bottom margin does enough to fix this to warrant the need to include bootstrap's variables.less file. I worry that adding that could cause issues for applications pulling in the less files to build (as far as path and overrides and such).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but not sure what you are suggesting? Do more to resolve the responsiveness, remove the bootstrap variables.less usage, perhaps add our own @pf-screen-md-min, etc..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting removing the @media setting all together. It doesn't do enough to help with responsiveness to warrant having it and adding in bootstrap's less file dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
This looks great @dtaylor113! |
Yes, the app. developer has complete control on how they want to apply the filters. |
|
@dtaylor113 lgtm |
ad83af1 to
842ab1c
Compare
jeff-phillips-18
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @dtaylor113
cdcabrera
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some minor nits related to semicolons and left over comment but overall... kudos!
src/filters/examples/filter-panel.js
Outdated
| // called when filter is changed in the filter panel | ||
| $scope.filterChanged = function() { | ||
| applyFilters(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, missing semicolon..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed
src/filters/examples/filter-panel.js
Outdated
| delete $scope.filterPanelModel[0].value; | ||
| applyFilters(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, missing semicolon..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/filters/examples/filter-panel.js
Outdated
| title: filter.title, | ||
| values: values | ||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, missing semicolon..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| // do a deep compare on config | ||
| if (!angular.equals(ctrl.config, prevConfig)) { | ||
| // setupConfig(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, leftover comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, leftover, removed/fixed.
842ab1c to
7cdf406
Compare
|
I believe I've addressed all review issues. Squashed commits. Thanks for the review comments :-) |
Description
Filter Panel with Filter Result Tags which may contain multiple values:
Here is the ngDoc. I recommend reading the ngDoc descriptions before reviewing the code -it explains many of the functions and parameters.
I was able to post the ngDoc example by creating a new branch off of this PR branch; then in .gitignore I removed the '/doc' rule, then pushed the new ngDoc branch with all of the /doc files. (Note the rawgit url contains 'pfFilterPanelDocs' branch name).
JIRA: https://patternfly.atlassian.net/browse/OSUX-108
@serenamarie125
PR Checklist