Skip to content

Add previous/next navigation to detail pages - #12528

Open
ejspeed-cmd wants to merge 5 commits into
inventree:masterfrom
ejspeed-cmd:master
Open

Add previous/next navigation to detail pages#12528
ejspeed-cmd wants to merge 5 commits into
inventree:masterfrom
ejspeed-cmd:master

Conversation

@ejspeed-cmd

Copy link
Copy Markdown

Summary

Adds previous/next navigation buttons to detail pages, allowing users to move through a filtered and ordered list without returning to the table view.

Motivation

When reviewing many items from a filtered list (e.g. all in-stock items for a location), users currently have to navigate back to the list, find their place, and click into the next item. This adds prev/next chevron buttons to the detail page header that preserve the active filter and ordering context.

Changes

Backend

  • stock/api.py: Added pk_gt and pk_lt filter fields to StockFilter
  • part/api.py: Added pk_gt and pk_lt filter fields to PartFilter

These allow the frontend to query for the adjacent item in the current ordered/filtered set.

Frontend

  • hooks/UseNextPrev.tsx: New hook useNextPrevSiblings(pk) that reads nav context from _nav_* URL params and issues pk_gt/pk_lt API queries to find the previous and next item PKs
  • components/nav/NextPrevAction.tsx: New component rendering prev/next chevron buttons, disabled when no sibling exists
  • components/nav/PageDetail.tsx: Accepts a pk prop; calls useNextPrevSiblings internally and renders NextPrevAction in the header actions area
  • components/tables/InvenTreeTable.tsx: Row click handler now encodes the active endpoint, ordering and filters as _nav_* query params on the detail URL
  • components/panels/PanelGroup.tsx: Panel navigation now preserves existing query params so nav context is not lost when switching tabs
  • pages/part/PartDetail.tsx: Passes pk to PageDetail
  • pages/stock/StockDetail.tsx: Passes pk to PageDetail

Behaviour

  • Buttons only appear when arriving via a table row click (i.e. _nav_* params are present in the URL)
  • The URL is fully shareable: the filter/ordering context is encoded in query params
  • Ordering matches the list view exactly
  • Navigation preserves the current panel and nav context across clicks
  • The feature is implemented entirely in generic components (InvenTreeTable, PageDetail) with no per-page logic beyond passing pk

@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 75b7a8f
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a6dcf4c2e885a00082c8c59
😎 Deploy Preview https://deploy-preview-12528--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 1 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Encodes active filter/ordering context as _nav_* URL params when
clicking a table row. On the detail page, prev/next chevron buttons
query the API using pk_gt/pk_lt to find adjacent items in the same
filtered/ordered list.

- Add useNextPrevSiblings hook (UseNextPrev.tsx)
- Add NextPrevAction component with prev/next chevron buttons
- Wire pk prop into PageDetail; hook and buttons render there
- Encode nav context in InvenTreeTable row click handler
- Add pk_gt/pk_lt filter fields to StockFilter and PartFilter
- Preserve query params in PanelGroup panel navigation
- Wire pk into PartDetail and StockDetail PageDetail calls
Comment thread src/frontend/src/locales/ar/messages.po
Comment thread src/frontend/src/components/tables/InvenTreeTable.tsx Outdated
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.67%. Comparing base (5216203) to head (d83a435).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12528      +/-   ##
==========================================
- Coverage   86.75%   86.67%   -0.09%     
==========================================
  Files        1445     1445              
  Lines       96281    96278       -3     
  Branches    11229    11132      -97     
==========================================
- Hits        83526    83446      -80     
- Misses      12691    12768      +77     
  Partials       64       64              
Flag Coverage Δ
backend 90.74% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.15% <100.00%> (+<0.01%) ⬆️
Backend General 93.53% <ø> (ø)
Frontend 79.52% <ø> (-0.20%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ejspeed-cmd

Copy link
Copy Markdown
Author

@matmair is there anything i can do to fix the failing test ?, i checked them and it doesn't seem related to my changes

@ejspeed-cmd

ejspeed-cmd commented Aug 1, 2026

Copy link
Copy Markdown
Author

@matmair can you reapprove the ci ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] Add Next and Previous Icon to switch easily between 2 objects

2 participants