netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Closes: #9583 - Add column specific search field to tables

Open DanSheps opened this issue 1 year ago • 30 comments

Closes: #9583 - Add column specific search field to tables

The plan is to use the existing filterset to generate form fields on the table column headers to allow for inline-filtering using HTMX requests

Progress

  • Fields are generated for
  • HTMX requests are sent and account for both
  • Integrate with "quick search"
  • Works with custom fields
  • Allow dropdown to float outside of the parent div

Todo

  • ~~Add input fields for "name"~~ Not needed - Quick search is suitable for this
  • ~~Fix filter float (Move before field name perhaps)~~ Done
  • ~~Add show/hide filter (Optional)~~ Outside of scope

DanSheps avatar Feb 07 '24 18:02 DanSheps

Another concern: There's no way to quickly discern when a column filter has been applied.

jeremystretch avatar Mar 20 '24 20:03 jeremystretch

Another concern: There's no way to quickly discern when a column filter has been applied.

May be able to do a swap on the icon and change it out to indicate it is filtered.

DanSheps avatar Mar 22 '24 03:03 DanSheps

Another concern: There's no way to quickly discern when a column filter has been applied.

May be able to do a swap on the icon and change it out to indicate it is filtered.

It does have the filtering chits if you refresh the page, it just doesn't show them when you select the filters - it should be changed to show the filtering chits when you select the filters. Monosnap Devices | NetBox 2024-03-29 10-13-18

arthanson avatar Mar 29 '24 17:03 arthanson

There is a minor UI issue:

  1. Click one of the filters so it drops-down.
  2. Click on another of the filters so it drops-down.

Both filters get un-selected (not dropped down). It opens up the drop-down for the second filter, then closes the drop-down for the first filter, then closes the drop-down fro the second filter.

Also: Suggestion (not sure if this is just the way the components work) when you drop-down a filter it shows the small selection box which you then have to click to see the list. IMHO it would be nicer if when you first drop-down the filter it would show the list as well.

arthanson avatar Mar 29 '24 17:03 arthanson

Another minor UI issue - if you select multiple items it will get clipped in the window - the multi-select on edit pages (like tags) handles this by going to multi-line which should work here as well.

Monosnap Devices | NetBox 2024-03-29 10-23-49 Monosnap Add a new device | NetBox 2024-03-29 10-23-14 Monosnap Devices | NetBox 2024-03-29 10-26-38

arthanson avatar Mar 29 '24 17:03 arthanson

Suggestion - could we make the funnel icon smaller (use a smaller font-size for it) I think it would be just as visible and would reduce the header height to what it was before.

arthanson avatar Mar 29 '24 17:03 arthanson

It does have the filtering chits if you refresh the page, it just doesn't show them when you select the filters - it should be changed to show the filtering chits when you select the filters.

This is outside of the htmx container, so it doesn't get refreshed, I am not sure if there is an easy way to do this. Perhaps extracting the filtering chits in the same request, but any suggestions are appreciated.

There is a minor UI issue:

  1. Click one of the filters so it drops-down.
  2. Click on another of the filters so it drops-down.

Both filters get un-selected (not dropped down). It opens up the drop-down for the second filter, then closes the drop-down for the first filter, then closes the drop-down fro the second filter.

This is just the way the dropdown works. When the dropdown closes, it reloads the htmx container, which includes all of these fields.

Also: Suggestion (not sure if this is just the way the components work) when you drop-down a filter it shows the small selection box which you then have to click to see the list. IMHO it would be nicer if when you first drop-down the filter it would show the list as well.

I have fixed this. Removing btn did the trick

Another minor UI issue - if you select multiple items it will get clipped in the window - the multi-select on edit pages (like tags) handles this by going to multi-line which should work here as well.

Should be fixed via a max-width CSS attribute on the dropdown menu.

Suggestion - could we make the funnel icon smaller (use a smaller font-size for it) I think it would be just as visible and would reduce the header height to what it was before.

Done

DanSheps avatar Apr 15 '24 13:04 DanSheps

Another concern: There's no way to quickly discern when a column filter has been applied.

Should pop the badges now

DanSheps avatar Apr 15 '24 17:04 DanSheps

Still some weirdness - If I select a filter then I do a page refresh I get doubling up of the chits (see below) I tried it on feature branch and this doesn't happen.

Monosnap Devices | NetBox 2024-04-18 09-13-33

arthanson avatar Apr 18 '24 16:04 arthanson

If I select a filter (works correctly) then click on another filter again (as I want to change what it is filtering on) I get a blank drop-down so I can't actually select anything else. Sort of weird, possibly a timing thing as if I click around to other filters after a couple seconds they start rendering correctly

Monosnap Devices | NetBox 2024-04-18 09-16-13

arthanson avatar Apr 18 '24 16:04 arthanson

If you do select a filter (I did site -> Butler Communication) then click the checkbox next to Name (for select all in list) it doesn't select anything in the list. I also tried on feature and it works correctly.

Monosnap Devices | NetBox 2024-04-18 09-33-00

arthanson avatar Apr 18 '24 16:04 arthanson

Will take a peek when I can.

DanSheps avatar Apr 18 '24 21:04 DanSheps

If I select a filter (works correctly) then click on another filter again (as I want to change what it is filtering on) I get a blank drop-down so I can't actually select anything else. Sort of weird, possibly a timing thing as if I click around to other filters after a couple seconds they start rendering correctly

I think this is simply a timing thing as the HTMX re-renders the whole table, including headers.

Not sure if there is a way around this, an "easy" way would be to return the whole table but only swap the tbody on operations surrounding the column filters/search. I think the only way to handle this would be to break up the HTMX request into multiple more components with some OOB swaps, however that doesn't seem to work as intended.

DanSheps avatar Apr 23 '24 03:04 DanSheps

If you do select a filter (I did site -> Butler Communication) then click the checkbox next to Name (for select all in list) it doesn't select anything in the list. I also tried on feature and it works correctly.

I can't recreate this. I am able to select the full list as intended. We might need some additional testing on this one.

DanSheps avatar Apr 23 '24 03:04 DanSheps

Still some weirdness - If I select a filter then I do a page refresh I get doubling up of the chits (see below) I tried it on feature branch and this doesn't happen.

This one should be fixed. See comments for other two. Open to suggestions on those.

DanSheps avatar Apr 23 '24 03:04 DanSheps

This is looking really good Dan, I just see one minor issue - if you select a filter, then click the select all (next to name) it will show the "Select all xx devices matching query" the count is all the items in the table, not the filtered count. If you go through the filters tab and do the filter that way, then click the select all it will not show the "Select all xx..." message.

Monosnap Devices | NetBox 2024-04-23 08-42-03

arthanson avatar Apr 23 '24 15:04 arthanson

This is looking really good Dan, I just see one minor issue - if you select a filter, then click the select all (next to name) it will show the "Select all xx devices matching query" the count is all the items in the table, not the filtered count. If you go through the filters tab and do the filter that way, then click the select all it will not show the "Select all xx..." message.

Just checked, this bug is present in both feature and develop (it is a long standing bug I believe, just maybe no issue for it).

I think it would be pretty easy to fix but we should track it as a separate bug IMO.

DanSheps avatar Apr 23 '24 20:04 DanSheps

@DanSheps I'm not seeing the behavior with the select-all on feature (see screenshot), I'm only seeing it on your branch. I just go to filter tab, select a filter and then do the select-all button. If I do select-all after doing the filtering by the drop-downs, that is where I see it. What are the steps you are using when seeing it on feature?

Monosnap Sites | NetBox 2024-04-25 08-34-09

arthanson avatar Apr 25 '24 15:04 arthanson

Do a quick search, not a filter. The quick search does an HTMX request on the table only.

The issue is the edit div doesn't get updated because it is outside the scope of the htmx request.

We need to do an OOB swap for that as well.

DanSheps avatar Apr 25 '24 15:04 DanSheps

@DanSheps can you open a separate bug for the select-all issue?

arthanson avatar Apr 25 '24 16:04 arthanson

This PR has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further action is taken.

github-actions[bot] avatar May 22 '24 04:05 github-actions[bot]

Let me rebuild the CSS and then we can take a look at this again.

DanSheps avatar May 22 '24 16:05 DanSheps

@DanSheps any progress on this?

arthanson avatar May 30 '24 14:05 arthanson

@DanSheps any progress on this?

This week I should have something

DanSheps avatar Jun 03 '24 04:06 DanSheps

This PR has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further action is taken.

github-actions[bot] avatar Jun 29 '24 04:06 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further action is taken.

github-actions[bot] avatar Jul 17 '24 04:07 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further action is taken.

github-actions[bot] avatar Aug 07 '24 04:08 github-actions[bot]