Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
"version": "7.41.0",
"version": "7.41.1-fb-terminalStorageUseBarcode.1",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
Expand Down
6 changes: 6 additions & 0 deletions packages/components/releaseNotes/components.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# @labkey/components
Components, models, actions, and utility functions for LabKey applications and pages

### version TBD
*Released*: TBD
- App support for terminal storage barcodes
- add `StorageUnitBarcode` as an allowed field for import
- Updated resolveDuplicatesAsName() to check for the "barcode" identifier

### version 7.41.0
*Released*: 1 June 2026
- GitHub Issue 903: Remove Cross-Container Sample and Data Class Import Feature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,17 @@ export const SAMPLE_STORAGE_COLUMNS_WITH_SUBSELECT_EXPR = [
'StorageLocation',
];

export const SAMPLE_INSERT_EXTRA_COLUMNS = [...AMOUNT_AND_UNITS_COLUMNS, ...SAMPLE_STORAGE_COLUMNS, ALIQUOTED_FROM_COL];
export const SAMPLE_INSERT_EXTRA_COLUMNS = [
...AMOUNT_AND_UNITS_COLUMNS,
...SAMPLE_STORAGE_COLUMNS,
ALIQUOTED_FROM_COL,
];
export const SAMPLE_IMPORT_EXTRA_ALLOWED_COLUMNS = [
...SAMPLE_INSERT_EXTRA_COLUMNS,
'SampleID',
'EnteredStorage',
'ExpirationDate',
'StorageUnitBarcode',
];

export const SAMPLE_DATA_EXPORT_CONFIG = {
Expand Down
31 changes: 31 additions & 0 deletions packages/components/src/internal/util/messaging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,35 @@ describe('resolveDuplicatesAsName', () => {
);
});
});

describe('barcode constraint', () => {
const barcodeError =
'ERROR: duplicate key value violates unique constraint "uq_box_barcode"\n' +
' Detail: Key (barcode)=(BC-123) already exists.';

test('uses "barcode" identifier when constraint is uq_box_barcode', () => {
expect(resolveDuplicatesAsName(barcodeError, 'boxes')).toBe(
"There was a problem creating your boxes. Duplicate barcode 'BC-123' found."
);
});

test('uq_box_barcode check is case-insensitive', () => {
const upperCaseError = barcodeError.replace('uq_box_barcode', 'UQ_BOX_BARCODE');
expect(resolveDuplicatesAsName(upperCaseError, 'boxes')).toBe(
"There was a problem creating your boxes. Duplicate barcode 'BC-123' found."
);
});

test('uses "name" identifier when constraint is not uq_box_barcode', () => {
expect(resolveDuplicatesAsName('Key (name)=(BC-123) already exists.', 'boxes')).toBe(
"There was a problem creating your boxes. Duplicate name 'BC-123' found."
);
});

test('respects optional params', () => {
expect(resolveDuplicatesAsName(barcodeError, 'box', 'boxes', 'importing')).toBe(
"There was a problem importing your boxes. Duplicate barcode 'BC-123' found."
);
});
});
});
3 changes: 2 additions & 1 deletion packages/components/src/internal/util/messaging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export function resolveDuplicatesAsName(
}
let retMsg = `There was a problem ${verbPresParticiple || 'creating'} your ${nounPlural || noun || 'data'}.`;
if (name) {
retMsg += ` Duplicate name '${name}' found.`;
const identifierType = errorMsg.toLowerCase().indexOf('uq_box_barcode') > -1 ? 'barcode' : 'name';
retMsg += ` Duplicate ${identifierType} '${name}' found.`;
} else {
retMsg += ` Check the existing ${nounPlural || noun || 'data'} for possible duplicates and make sure any referenced ${
nounPlural || noun || 'data'
Expand Down