puppetlabs/puppet-dashboard — pull request #217 by jeffweiss (2013-04-18 23:28:29+00:00)
Title: Exclude existing items from autosuggest

Prior to this commit, the autosuggest box (for nodes, classes, groups)
would include already assigned elements in the suggestion dropdown. This
commit excludes the assigned elements from the query results when
searching for a new item.

NOTE: this implementation does still contain an edge case where a newly
assigned group may still be shown if the query has already been cached.
As a concrete example, groups `gamma` and `beta` have been assigned,
but `delta` and `alpha` have not. When `a` is typed into the group
assignment box, `delta` and `alpha` will be suggested. Assume `delta`
selected. When `a` is again typed, jquery.tokeninput plugin will notice
that the query results for `a` have already been cached and show them
again, both `delta` and `alpha` in this case even though `delta` was
assigned moments ago. This is a limitation in the jquery.tokeninput
plugin in that it allows custom code to be inject upon query results,
but not upon cache results. A separate un-cached query, such as `l` in
this case, will not exhibit this behaviour, resulting in only `alpha`
being suggested.