Skip to content

[UI] Keep Add Parts button visible in Parametric View - #12392

Open
hanielee wants to merge 16 commits into
inventree:masterfrom
hanielee:fix-issue-add-parts-button
Open

[UI] Keep Add Parts button visible in Parametric View#12392
hanielee wants to merge 16 commits into
inventree:masterfrom
hanielee:fix-issue-add-parts-button

Conversation

@hanielee

@hanielee hanielee commented Jul 14, 2026

Copy link
Copy Markdown

Problem

The "Add Parts" button disappears when switching to Parametric View on the Parts page, even for admin users. This isn't a permissions issue: PartListTable (Table View) and ParametricPartTable (Parametric View) are separate components, and only PartListTable builds a toolbar with an "Add Parts" action. The generic ParametricDataTable that Parametric View wraps only supports per-row actions (like "Add Parameter"), so the button was never in that view in the first place.

Solution

Brought the "Add Parts" button from Table View into Parametric View so both views behave consistently. Added an optional customActions prop to ParametricDataTable, following the same pattern as the existing customColumns and customFilters props, and wired the same "Add Parts" dropdown (Create Part, Import from File, Import from Supplier) into Parametric View through that prop, gated by the same hasAddRole(UserRoles.part) permission check Table View already uses. However, since the dropdown was duplicated between the two tables, I extracted it into a shared PartCreationMenu component used by both.

Before:
issue-add-parts-button

After:
fix-issue-add-parts-button

Testing

Added Playwright tests confirming the button is visible for admins, hidden for read-only users, and that creating a part through the Parametric View works end to end.

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit a677646
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a694b891a16950008b78609
😎 Deploy Preview https://deploy-preview-12392--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: 97 (no change 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.

@SchrodingersGat SchrodingersGat added the User Interface Related to the frontend / User Interface label Jul 14, 2026
@SchrodingersGat SchrodingersGat added this to the 1.5.0 milestone Jul 14, 2026
@hanielee
hanielee force-pushed the fix-issue-add-parts-button branch from c7197cf to 2d9620e Compare July 14, 2026 04:18
@hanielee
hanielee force-pushed the fix-issue-add-parts-button branch from b32eb9d to f337f2d Compare July 14, 2026 04:45
@hanielee
hanielee force-pushed the fix-issue-add-parts-button branch from f337f2d to 1370a9d Compare July 14, 2026 04:46
@hanielee
hanielee marked this pull request as ready for review July 14, 2026 04:48
@hanielee

Copy link
Copy Markdown
Author

@SchrodingersGat Thank you for the approval on the draft, I've marked it as ready for review!

@SchrodingersGat

Copy link
Copy Markdown
Member

The combination of "create new part" / "import parts" is a repeated pattern here - I think it would be worth offloading this to a common component e.g. PartCreationMenu which can be used in both locations

@hanielee

Copy link
Copy Markdown
Author

@SchrodingersGat I've implemented the PartCreationMenu component that both the Table View and Parametric View now use. Thanks for mentioning this, I noticed the SonarCloud code duplication check flagging it while I was working on the PR and I wasn't sure if I should've created separate component, but it makes sense since it's cleaner this way.

@SchrodingersGat

Copy link
Copy Markdown
Member

@hanielee please address merge conflicts here, sorry

@hanielee
hanielee force-pushed the fix-issue-add-parts-button branch from e76b215 to e559539 Compare July 23, 2026 00:54
@hanielee

Copy link
Copy Markdown
Author

@SchrodingersGat I noticed some of the checks are failing, but some seem unrelated to this PR (aside from the prek one which I'll look into). I'm wondering if there are other remaining blockers or anything else needing to be addressed? Thanks!

@SchrodingersGat

Copy link
Copy Markdown
Member

The failing frontend tests seem to be flaky tests elsewhere - I'll look into that. But please address the prek tests

@hanielee

Copy link
Copy Markdown
Author

The failing frontend tests seem to be flaky tests elsewhere - I'll look into that. But please address the prek tests

@SchrodingersGat Thanks for confirming! I’ve addressed the prek test failure and pushed the changes.

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

Labels

User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants