mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-24 00:36:39 +00:00
[bug] Fix navigation when clicking a BOM row (#13345)
* Allow navigating to a sub-part by clicking a BOM row Clicking a row in the BOM table no longer did anything, as the cell click handler was disabled entirely. Only disable it while the BOM is being edited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add regression test for nested BOM row expansion and navigation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
da94e5cd91
commit
4dfbabe496
2 files changed
+58
-1
No files matched your search
@@ -878,7 +878,8 @@ export function BomTable({
|
||||
tableFilters: tableFilters,
|
||||
modelType: ModelType.part,
|
||||
modelField: 'sub_part',
|
||||
onCellClick: () => {},
|
||||
// Navigate to the sub-part when a row is clicked (except while editing)
|
||||
onCellClick: isEditing ? () => {} : undefined,
|
||||
rowActions: isEditing ? rowActions : undefined,
|
||||
enableSelection: isEditing && !isLocked,
|
||||
enableBulkDelete:
|
||||
|
||||
@@ -414,6 +414,62 @@ test('Parts - BOM Nesting', async ({ browser }) => {
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
/**
|
||||
* Clicking a BOM row opens the sub-part (but not while editing the BOM)
|
||||
*/
|
||||
test('Parts - BOM Navigation', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, { url: 'part/104/bom' });
|
||||
|
||||
const cell = page.getByText('Blue Paint', { exact: true }).first();
|
||||
const details = page.getByRole('link', { name: 'details-part-89' });
|
||||
|
||||
// While editing, clicking a row does not open the sub-part
|
||||
await page.getByRole('button', { name: 'action-button-edit-bom' }).click();
|
||||
await page
|
||||
.getByRole('button', { name: 'action-button-finish-editing-' })
|
||||
.waitFor();
|
||||
await cell.click();
|
||||
await page.waitForTimeout(500);
|
||||
await expect(details).toHaveCount(0);
|
||||
await expect(page).toHaveURL(/part\/104\/bom/);
|
||||
|
||||
// Otherwise, clicking a row opens the sub-part
|
||||
// (either directly, or via the preview drawer, depending on user settings)
|
||||
await navigate(page, 'part/104/bom');
|
||||
await cell.click();
|
||||
await page.getByText('Part: Blue Paint').or(details).first().waitFor();
|
||||
|
||||
// Sub-assembly rows can still be expanded and collapsed,
|
||||
// without opening the sub-assembly part
|
||||
await navigate(page, 'part/87/bom');
|
||||
|
||||
const assemblyRow = page
|
||||
.getByRole('row')
|
||||
.filter({ hasText: 'Widget Board (assembled)' });
|
||||
const assemblyDetails = page.getByRole('link', { name: 'details-part-88' });
|
||||
|
||||
await assemblyRow.getByRole('button', { name: 'nested-row-expand' }).click();
|
||||
await page.getByText('MAX232IDR').waitFor();
|
||||
await expect(assemblyDetails).toHaveCount(0);
|
||||
await expect(page).toHaveURL(/part\/87\/bom/);
|
||||
|
||||
await assemblyRow
|
||||
.getByRole('button', { name: 'nested-row-collapse' })
|
||||
.click();
|
||||
await expect(page.getByText('MAX232IDR')).toHaveCount(0);
|
||||
await expect(assemblyDetails).toHaveCount(0);
|
||||
await expect(page).toHaveURL(/part\/87\/bom/);
|
||||
|
||||
// Clicking a nested row opens the part for that row
|
||||
await assemblyRow.getByRole('button', { name: 'nested-row-expand' }).click();
|
||||
await page.getByText('MAX232IDR').click();
|
||||
await page
|
||||
.getByText('Part: MAX232IDR')
|
||||
.or(page.getByRole('link', { name: 'details-part-61' }))
|
||||
.first()
|
||||
.waitFor();
|
||||
});
|
||||
|
||||
/**
|
||||
* Perform BOM validation process
|
||||
* Note that this is a "background task" which is monitored by the "useBackgroundTask" hook
|
||||
|
||||
Reference in new issue
Block a user