replaysMike / Binner

Open source parts inventory system for makers, electronics hobby, and professional engineers
https://binner.io
GNU General Public License v3.0
268 stars 41 forks source link

Filtering Inventory by a field like "Bin Number" doesn't work #69

Closed michaelajax closed 1 year ago

michaelajax commented 1 year ago

When you click on a specific "Bin Number", like "Connectors" below:

image

the URI that gets sent is: https://{server}:8090/inventory/inventory?by=binNumber&value=Connectors, which navigates to the "Edit Inventory" page. It should instead be https://{server}:8090/inventory?by=binNumber&value=Connectors

It looks like the reason for this is that PartsGrid.js is adding an extra inventory to the Link To URI.:

<Link to={`inventory?by=binNumber&value=${p.binNumber}`} onClick={this.handleSelfLink}>

If you manually load https://{server}:8090/inventory?by=binNumber&value=Connectors, it works, and you can correctly see a filtered list:

image

I tried to fix this in PartsGrid.js, and the URI correctly changes to add the by=binNumber&value=Connectors part, but the table of parts doesn't update to apply the filtering. Likewise, if I refresh to force it to apply, and then click to remove the filter, the filter disappears from the UI (and the URL goes back to https://{server}:8090/inventory), but the table of parts doesn't update to show all of them again:

image

I fiddled with it for a while, but don't really know what I'm doing with JS/web, and couldn't figure out how to force it to properly refresh.

Along with this, two other requests for inventory management:

  1. Could this page be set up so I could filter by "Bin Number" and search by text at the same time? For example, I'd like to be able to select my "Connectors" bin, and then search for components within it. Right now, if I have a filter applied and type a search, it clears my filter.
  2. Could you add "Part Type" as a column to the left of "Bin Number"? I'd like to be able to filter my inventory by Part Type. I fiddled with it and got it to display the integer ID for Part Type, but couldn't figure out how to map that to the string.

Thanks!

replaysMike commented 1 year ago

Thanks Michael I'll take a look at this asap. I'm just wrapping up another project so I can come back and give this project more love.

replaysMike commented 1 year ago

Fixed in 2.0.79