Skip to content

Commit fd9a9fc

Browse files
committed
Issue 52959: LKSM/LKB: Existing file not shown in Bulk Edit
Issue 52900: LKSM: Moving a sample to another folder breaks other references to shared files Issue 53070: Moving files could result in duplicate exp.data records
1 parent eb3d434 commit fd9a9fc

6 files changed

Lines changed: 25 additions & 22 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": "6.43.3",
3+
"version": "6.43.4-fb-fileIssues256.1",
44
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
55
"sideEffects": false,
66
"files": [

packages/components/src/internal/components/forms/BulkUpdateForm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ export class BulkUpdateForm extends PureComponent<Props, State> {
209209
} = this.props;
210210
const fileFields = queryInfo.columns.valueArray.filter(col => col.inputType === 'file').map(col => col.name);
211211
const fieldValues =
212-
isLoadingDataForSelection || !dataForSelection ? undefined : getCommonDataValues(dataForSelection, fileFields);
212+
isLoadingDataForSelection || !dataForSelection
213+
? undefined
214+
: getCommonDataValues(dataForSelection, fileFields);
213215

214216
// if all selectedIds are from the same containerPath, use that for the lookups via QueryFormInputs > QuerySelect,
215217
// if selections are from multiple containerPaths, disable the lookup and file field inputs

packages/components/src/internal/components/forms/input/FileInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export interface FileInputProps extends DisableableInputProps {
4242
labelClassName?: string;
4343
maxFileSize?: number;
4444
name?: string;
45+
onChange?: (fileMap: Record<string, File>) => void;
4546
queryColumn?: QueryColumn;
4647
renderFieldLabel?: (queryColumn: QueryColumn, label?: string, description?: string) => ReactNode;
4748
showLabel?: boolean;
4849
toggleDisabledTooltip?: string;
49-
onChange?: (fileMap: Record<string, File>) => void;
5050
}
5151

5252
type FileInputImplProps = FileInputProps & FormsyInjectedProps<any>;
@@ -126,7 +126,9 @@ class FileInputImpl extends DisableableInput<FileInputImplProps, State> {
126126
}
127127

128128
if (maxFileSize && file.size > maxFileSize) {
129-
this.setState({ error: `File size must not exceed ${Math.round(maxFileSize / 1024).toLocaleString()} KB.` });
129+
this.setState({
130+
error: `File size must not exceed ${Math.round(maxFileSize / 1024).toLocaleString()} KB.`,
131+
});
130132
return;
131133
}
132134
if (emptyFileNotAllowed && file.size === 0) {

packages/components/src/internal/util/utils.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ describe('getCommonDataForSelection', () => {
256256
Pdf: {
257257
value: '/root/lk/Sample%20Management/blood.pdf',
258258
displayValue: 'sampletype/blood.pdf',
259-
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552'
260-
}
259+
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
260+
},
261261
},
262262
'447': {
263263
RowId: {
@@ -283,8 +283,8 @@ describe('getCommonDataForSelection', () => {
283283
Pdf: {
284284
value: '/root/lk/Sample%20Management/blood.pdf',
285285
displayValue: 'sampletype/blood.pdf',
286-
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552'
287-
}
286+
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
287+
},
288288
},
289289
'446': {
290290
RowId: {
@@ -310,8 +310,8 @@ describe('getCommonDataForSelection', () => {
310310
Pdf: {
311311
value: '/root/lk/Sample%20Management/blood.pdf',
312312
displayValue: 'sampletype/blood.pdf',
313-
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552'
314-
}
313+
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
314+
},
315315
},
316316
'445': {
317317
RowId: {
@@ -337,8 +337,8 @@ describe('getCommonDataForSelection', () => {
337337
Pdf: {
338338
value: '/root/lk/Sample%20Management/blood.pdf',
339339
displayValue: 'sampletype/blood.pdf',
340-
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552'
341-
}
340+
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
341+
},
342342
},
343343
'367': {
344344
RowId: {
@@ -364,23 +364,23 @@ describe('getCommonDataForSelection', () => {
364364
Pdf: {
365365
value: '/root/lk/Sample%20Management/blood.pdf',
366366
displayValue: 'sampletype/blood.pdf',
367-
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552'
368-
}
367+
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
368+
},
369369
},
370370
});
371371
expect(getCommonDataValues(data)).toEqual({
372372
AndAgain: 'again',
373373
Data: 'data1',
374-
Pdf: '/root/lk/Sample%20Management/blood.pdf'
374+
Pdf: '/root/lk/Sample%20Management/blood.pdf',
375375
});
376376
expect(getCommonDataValues(data, ['Pdf'])).toEqual({
377377
AndAgain: 'again',
378378
Data: 'data1',
379379
Pdf: fromJS({
380380
value: '/root/lk/Sample%20Management/blood.pdf',
381381
displayValue: 'sampletype/blood.pdf',
382-
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552'
383-
})
382+
url: '/labkey/Sample%20Management/core-downloadFileLink.view?propertyId=552',
383+
}),
384384
});
385385
});
386386
});

packages/components/src/internal/util/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export function getCommonDataValues(data: Map<any, any>, fileFields?: string[]):
211211
if (!fieldsInConflict.has(key)) {
212212
// skip fields that are already in conflict
213213
let value = data;
214-
let rawValue = data;
214+
const rawValue = data;
215215

216216
// Convert from immutable to regular JS
217217
if (Iterable.isIterable(data)) {
@@ -262,8 +262,7 @@ export function getCommonDataValues(data: Map<any, any>, fileFields?: string[]):
262262

263263
// return full file data map (url, displayValue, value) for file fields
264264
fileFields?.forEach(fileField => {
265-
if (valueMap.has(fileField))
266-
valueMap = valueMap.set(fileField, fileMap[fileField]);
265+
if (valueMap.has(fileField)) valueMap = valueMap.set(fileField, fileMap[fileField]);
267266
});
268267

269268
return valueMap.toObject();

0 commit comments

Comments
 (0)