Skip to content

Commit 558a31d

Browse files
authored
GitHub 562: Combine warning messages for file preview unknown/system fields with the warning for duplicate columns (#1920)
### version 7.8.1 *Released*: 6 January 2026 - GitHub 562: Combine warning messages for file preview unknown/system fields with the warning for duplicate columns - FilePreviewGrid to combine warningMsg with previewData.warningMsg in a single Alert
1 parent d593fd6 commit 558a31d

6 files changed

Lines changed: 22 additions & 19 deletions

File tree

packages/components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/components",
3-
"version": "7.8.0",
3+
"version": "7.8.1",
44
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
55
"sideEffects": false,
66
"files": [

packages/components/releaseNotes/components.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# @labkey/components
22
Components, models, actions, and utility functions for LabKey applications and pages
33

4+
### version 7.8.1
5+
*Released*: 6 January 2026
6+
- GitHub 562: Combine warning messages for file preview unknown/system fields with the warning for duplicate columns
7+
- FilePreviewGrid to combine warningMsg with previewData.warningMsg in a single Alert
8+
49
### version 7.8.0
510
*Released*: 5 January 2026
611
- Add a “Mixed” state in Bulk Edit when values differ across selected samples

packages/components/src/internal/components/files/FilePreviewGrid.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { ReactNode } from 'react';
22
import { List, Map } from 'immutable';
33

44
import { FileGridPreviewProps } from '../../../public/files/models';
@@ -8,7 +8,7 @@ import { Grid } from '../base/Grid';
88

99
export interface PreviewData {
1010
data: List<Map<string, any>>;
11-
warningMsg?: string;
11+
warningMsg?: ReactNode;
1212
}
1313

1414
type Props = FileGridPreviewProps & {
@@ -35,12 +35,12 @@ export class FilePreviewGrid extends React.Component<Props, any> {
3535
) : (
3636
<>
3737
<strong>{header}</strong>
38-
<Alert className="margin-top" bsStyle="warning">
39-
{warningMsg}
40-
</Alert>
41-
<Alert className="margin-top" bsStyle="warning">
42-
{previewData?.warningMsg}
43-
</Alert>
38+
{(warningMsg || previewData?.warningMsg) && (
39+
<Alert bsStyle="warning" className="margin-top">
40+
{warningMsg}
41+
{previewData?.warningMsg}
42+
</Alert>
43+
)}
4444
<p className="margin-top">
4545
<span>
4646
The {numRows === 1 ? 'one row ' : 'first ' + numRows + ' rows '} of your data file{' '}

packages/components/src/internal/components/files/__snapshots__/FilePreviewGrid.test.tsx.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,6 @@ exports[`<FilePreviewGrid/> warning message and previewData.warningMsg 1`] = `
725725
role="alert"
726726
>
727727
Testing warning message
728-
</div>
729-
<div
730-
class="margin-top alert alert-warning"
731-
role="alert"
732-
>
733728
Duplicate fields
734729
</div>
735730
<p

packages/components/src/internal/components/files/actions.ts renamed to packages/components/src/internal/components/files/actions.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) 2019 LabKey Corporation. All rights reserved. No portion of this work may be reproduced in
33
* any form or by any electronic or mechanical means without written permission from LabKey Corporation.
44
*/
5+
import React from 'react';
56
import { List, Map, OrderedMap } from 'immutable';
67

78
import { parseScientificInt } from '../../util/utils';
@@ -80,9 +81,11 @@ export function convertRowDataIntoPreviewData(
8081
return {
8182
data: rows,
8283
warningMsg:
83-
duplicateColumns.size > 0
84-
? 'Duplicate column(s) provided: ' + [...duplicateColumns].join(', ') + '.'
85-
: undefined,
84+
duplicateColumns.size > 0 ? (
85+
<p>
86+
Duplicate column(s) provided: <b>{[...duplicateColumns].join(', ')}</b>.
87+
</p>
88+
) : null,
8689
};
8790
}
8891

0 commit comments

Comments
 (0)