2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-02-25 16:17:58 +00:00

[API] Enhanced filtering for generic parameters (#11383)

* Enhanced filtering for parameter templates

- Allow filtering by model ID as well as model type

* Enhanced filtering for ParameterTemplate

- Required for the parameteric data tables
- Enable filtering by base model ID
- Enable filtering by related model ID

* Bump API version

* Remove outdated comments

* Fix typo

* Remove debug statement

* Added unit tests

* Playwright tests

* Fix unit test

* Bump requirements

* Revert
This commit is contained in:
Oliver
2026-02-20 09:32:33 +11:00
committed by GitHub
parent fc1bfe876c
commit dd423dccd6
12 changed files with 524 additions and 88 deletions

View File

@@ -4,10 +4,13 @@ import {
clickOnParamFilter,
clickOnRowMenu,
deletePart,
expectTableColumnCount,
getRowFromCell,
loadTab,
navigate,
setTableChoiceFilter
setTableChoiceFilter,
showParametricView,
showTableView
} from '../helpers';
import { doCachedLogin } from '../login';
import { setPluginState, setSettingState } from '../settings';
@@ -499,6 +502,58 @@ test('Parts - Attachments', async ({ browser }) => {
await page.getByRole('button', { name: 'Cancel' }).click();
});
test('Parts - Parameters by Category', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/category/4/parts' });
await showParametricView(page);
// Check for expected parameter columns
for (const col of [
'Total Stock',
'Capacitance [F]',
'Power [W]',
'Resistance [ohms]'
]) {
await page.getByRole('button', { name: col }).waitFor();
}
await expectTableColumnCount(page, 9);
// Now let's go to the "resistors" category
await navigate(page, 'part/category/5/parts');
await showParametricView(page);
// Fewer parameter templates displayed here
await expectTableColumnCount(page, 7);
// Check for expected parameter columns
for (const col of [
'Total Stock',
'Tolerance [percent]',
'Power [W]',
'Resistance [ohms]'
]) {
await page.getByRole('button', { name: col }).waitFor();
}
// Finally, let's go to the "capacitors" category, which has a different set of parameter templates
await navigate(page, 'part/category/6/parts');
await showParametricView(page);
await expectTableColumnCount(page, 7);
for (const col of [
'Total Stock',
'Tolerance [percent]',
'Polarized',
'Capacitance [F]'
]) {
await page.getByRole('button', { name: col }).waitFor();
}
// Reset to the table view
await showTableView(page);
});
test('Parts - Parameters', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/69/parameters' });
@@ -562,10 +617,8 @@ test('Parts - Parameter Filtering', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/' });
await loadTab(page, 'Parts', true);
await page
.getByRole('button', { name: 'segmented-icon-control-parametric' })
.click();
await showParametricView(page);
await clearTableFilters(page);
// All parts should be available (no filters applied)