Add sidebar filters menu - #6
Conversation
| if (releaseName) newUrl += `&release=${releaseName}`; | ||
| for (const key in sidebarFilters) { | ||
| for (const value of sidebarFilters[key]) { | ||
| newUrl += `&${key}=${value}`; |
There was a problem hiding this comment.
I think we need to URL-encoded the value here (or use URLSearchParams) to preserve special variant characters like "+".
There was a problem hiding this comment.
Ok, in 6b68cda, I changed this function to create the redirect with new URL(...).searchParams.append(...), which does automatic encoding of the params
| function clearAllSidebarFilters() { | ||
| sidebarFilters = {}; | ||
| const menuContent = document.getElementById('filters-menu-content'); | ||
| $(menuContent).find('button.checked').each((index, button) => { toggleCheckbox(button) }); |
There was a problem hiding this comment.
I think we are leaving stale .checked classes behind on these buttons here. Compare with line 545 above where we explicitly remove this class.
There was a problem hiding this comment.
You're right, that left the checked class around even though the checkbox becomes unchecked. I explicitly remove the checked class in ac7f706.
| </div> | ||
| </div> | ||
| </div> | ||
| </div> No newline at end of file |
There was a problem hiding this comment.
This looks like an extra / imbalanced </div> that can be removed
| for (const key in sidebarFilters) { | ||
| const valueSpecs = attrValueSpecs[key] || attrValueSpecs[key + 's']; | ||
| for (value of sidebarFilters[key]) { | ||
| matchComplete &= !!valueSpecs[value]; |
There was a problem hiding this comment.
Should we use the logical operator (&&=) instead of the bitwise operator here? Or we could really spell it out:
matchComplete = matchComplete && !!valueSpecs[value];
There was a problem hiding this comment.
Thanks, I often confuse the two operators. Changed both occurrences in 763e4b7.
| } | ||
| } | ||
| } | ||
| match &= matchComplete && matchingSpecs && matchingSpecs.size > 0; |
There was a problem hiding this comment.
my fear of bitwise operations also applies here
This PR adds a filters menu to the sidebar which allows users to specify values of other attributes in their search. If filters are applied in the sidebar when the user clicks on a package in the results, the same filters will be applied to the specs table for that package.
Preview available at https://annehaley.github.io/spack-cache/