Skip to content

Commit

Permalink
Improve role select when editing membership
Browse files Browse the repository at this point in the history
* Only match role names to avoid false positives
* Remove unnecessary sort since it's sorted in the controller
* Add a `track by` to the repeat
* Highlight search matches in the dropdown
  • Loading branch information
spadgett committed Oct 13, 2017
1 parent ce05a60 commit 5f0e71a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions app/views/membership.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ <h3>
<span ng-bind="subject.newRole.metadata.name"></span>
</ui-select-match>
<ui-select-choices
repeat="role as role in filteredRoles | filter: excludeExistingRoles(subject.roles) | filter: $select.search | orderBy: 'metadata.name'">
<div>{{ role.metadata.name }}</div>
repeat="role as role in filteredRoles | filter: excludeExistingRoles(subject.roles) | filter: { metadata: { name: $select.search } } track by (role | uid)">
<div ng-bind-html="role.metadata.name | highlight: $select.search"></div>
<div ng-if="role | annotation : 'description'">
<small>{{role | annotation : 'description'}}</small>
</div>
Expand Down Expand Up @@ -251,8 +251,8 @@ <h3>
<span ng-bind="newBinding.newRole.metadata.name"></span>
</ui-select-match>
<ui-select-choices
repeat="role as role in filteredRoles | filter: $select.search | orderBy: 'metadata.name'">
<div>{{ role.metadata.name }}</div>
repeat="role as role in filteredRoles | filter: { metadata: { name: $select.search } } track by (role | uid)">
<div ng-bind-html="role.metadata.name | highlight: $select.search"></div>
<div ng-if="role | annotation : 'description'">
<small>{{role | annotation : 'description'}}</small>
</div>
Expand Down
8 changes: 4 additions & 4 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -10510,8 +10510,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<ui-select-match placeholder=\"Select a role\">\n" +
"<span ng-bind=\"subject.newRole.metadata.name\"></span>\n" +
"</ui-select-match>\n" +
"<ui-select-choices repeat=\"role as role in filteredRoles | filter: excludeExistingRoles(subject.roles) | filter: $select.search | orderBy: 'metadata.name'\">\n" +
"<div>{{ role.metadata.name }}</div>\n" +
"<ui-select-choices repeat=\"role as role in filteredRoles | filter: excludeExistingRoles(subject.roles) | filter: { metadata: { name: $select.search } } track by (role | uid)\">\n" +
"<div ng-bind-html=\"role.metadata.name | highlight: $select.search\"></div>\n" +
"<div ng-if=\"role | annotation : 'description'\">\n" +
"<small>{{role | annotation : 'description'}}</small>\n" +
"</div>\n" +
Expand Down Expand Up @@ -10564,8 +10564,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<ui-select-match placeholder=\"Select a role\">\n" +
"<span ng-bind=\"newBinding.newRole.metadata.name\"></span>\n" +
"</ui-select-match>\n" +
"<ui-select-choices repeat=\"role as role in filteredRoles | filter: $select.search | orderBy: 'metadata.name'\">\n" +
"<div>{{ role.metadata.name }}</div>\n" +
"<ui-select-choices repeat=\"role as role in filteredRoles | filter: { metadata: { name: $select.search } } track by (role | uid)\">\n" +
"<div ng-bind-html=\"role.metadata.name | highlight: $select.search\"></div>\n" +
"<div ng-if=\"role | annotation : 'description'\">\n" +
"<small>{{role | annotation : 'description'}}</small>\n" +
"</div>\n" +
Expand Down

0 comments on commit 5f0e71a

Please sign in to comment.