Skip to content

Commit d58878e

Browse files
Merge pull request #7592 from haiwen/fix-metadata-modify-record-bug
Fix metadata modify record bug
2 parents 890183f + 75401f8 commit d58878e

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

frontend/src/metadata/components/cell-formatter/file-tags/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const FileTagsFormatter = ({ tagsData, value: oldValue, className, children: emp
3535

3636
FileTagsFormatter.propTypes = {
3737
value: PropTypes.array,
38-
tagsData: PropTypes.array,
38+
tagsData: PropTypes.object,
3939
className: PropTypes.string,
4040
showName: PropTypes.bool,
4141
};

frontend/src/metadata/hooks/metadata-view.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export const MetadataViewProvider = ({
343343
idOriginalRecordUpdates[updateRecordId][locationColumnKey] = detail[locationColumnKey];
344344
}
345345
});
346-
modifyRecords({ recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData });
346+
modifyRecords(recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData);
347347
}
348348
});
349349
}, [metadata, extractFilesDetails, modifyRecords]);
@@ -366,7 +366,7 @@ export const MetadataViewProvider = ({
366366
let idOriginalRecordUpdates = {};
367367
idRecordUpdates[updateRecordId] = { [descriptionColumnKey]: description };
368368
idOriginalRecordUpdates[updateRecordId] = { [descriptionColumnKey]: description };
369-
modifyRecords({ recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData });
369+
modifyRecords(recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData);
370370
}
371371
});
372372
}, [modifyRecords, generateDescription]);
@@ -388,7 +388,7 @@ export const MetadataViewProvider = ({
388388
let idOriginalRecordUpdates = {};
389389
idRecordUpdates[updateRecordId] = { [ocrResultColumnKey]: ocrResult ? JSON.stringify(ocrResult) : null };
390390
idOriginalRecordUpdates[updateRecordId] = { [ocrResultColumnKey]: ocrResult ? JSON.stringify(ocrResult) : null };
391-
modifyRecords({ recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData });
391+
modifyRecords(recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData);
392392
},
393393
});
394394
}, [modifyRecords, onOCR]);

frontend/src/metadata/views/table/masks/interaction-masks/index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,11 +562,7 @@ class InteractionMasks extends React.Component {
562562
}
563563

564564
if (updateRecordIds.length > 0) {
565-
const isCopyPaste = true;
566-
this.props.updateRecords({
567-
recordIds: updateRecordIds, idRecordUpdates, idOriginalRecordUpdates,
568-
idOldRecordData, idOriginalOldRecordData, isCopyPaste,
569-
});
565+
this.props.modifyRecords(updateRecordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData);
570566
}
571567
};
572568

@@ -1025,10 +1021,11 @@ class InteractionMasks extends React.Component {
10251021
};
10261022

10271023
handleDragCopy = (draggedRange) => {
1028-
const { columns, groupMetrics, table: { rows, id_row_map }, gridUtils, updateRecords } = this.props;
1024+
const { columns, groupMetrics, table: { rows, id_row_map }, gridUtils, modifyRecords } = this.props;
10291025
// compute the new records
10301026
const newRecords = gridUtils.getUpdateDraggedRecords(draggedRange, columns, rows, id_row_map, groupMetrics);
1031-
updateRecords({ ...newRecords, isCopyPaste: true });
1027+
const { recordIds, idRecordUpdates, idOriginalRecordUpdates, idOriginalOldRecordData, idOldRecordData } = newRecords;
1028+
modifyRecords(recordIds, idRecordUpdates, idOriginalRecordUpdates, idOldRecordData, idOriginalOldRecordData);
10321029
};
10331030

10341031
handleDragStart = (e) => {
@@ -1216,7 +1213,7 @@ InteractionMasks.propTypes = {
12161213
modifyRecord: PropTypes.func.isRequired,
12171214
recordGetterByIndex: PropTypes.func,
12181215
recordGetterById: PropTypes.func,
1219-
updateRecords: PropTypes.func,
1216+
modifyRecords: PropTypes.func.isRequired,
12201217
deleteRecordsLinks: PropTypes.func,
12211218
paste: PropTypes.func,
12221219
editMobileCell: PropTypes.func,

frontend/src/metadata/views/table/table-main/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const TableMain = ({
7777
modifyColumnData={modifyColumnData}
7878
insertColumn={handelInsertColumn}
7979
updateFileTags={updateFileTags}
80+
modifyRecords={modifyRecords}
8081
{...props}
8182
/>
8283
</div>

frontend/src/metadata/views/table/table-main/records/body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ class RecordsBody extends Component {
543543
modifyRecord={this.props.modifyRecord}
544544
recordGetterByIndex={this.props.recordGetterByIndex}
545545
recordGetterById={this.props.recordGetterById}
546-
updateRecords={this.props.updateRecords}
546+
modifyRecords={this.props.modifyRecords}
547547
paste={this.props.paste}
548548
editMobileCell={this.props.editMobileCell}
549549
frozenColumnsWidth={this.props.frozenColumnsWidth}
@@ -611,7 +611,7 @@ RecordsBody.propTypes = {
611611
onCellClick: PropTypes.func,
612612
onCellRangeSelectionUpdated: PropTypes.func,
613613
onSelectRecord: PropTypes.func,
614-
updateRecords: PropTypes.func,
614+
modifyRecords: PropTypes.func.isRequired,
615615
deleteRecordsLinks: PropTypes.func,
616616
paste: PropTypes.func,
617617
searchResult: PropTypes.object,

frontend/src/metadata/views/table/table-main/records/group-body/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ class GroupBody extends Component {
899899
modifyRecord={this.props.modifyRecord}
900900
recordGetterByIndex={this.props.recordGetterByIndex}
901901
recordGetterById={this.props.recordGetterById}
902-
updateRecords={this.props.updateRecords}
902+
modifyRecords={this.props.modifyRecords}
903903
paste={this.props.paste}
904904
editMobileCell={this.props.editMobileCell}
905905
frozenColumnsWidth={this.props.frozenColumnsWidth}
@@ -967,7 +967,7 @@ GroupBody.propTypes = {
967967
modifyRecord: PropTypes.func,
968968
recordGetterByIndex: PropTypes.func,
969969
recordGetterById: PropTypes.func,
970-
updateRecords: PropTypes.func,
970+
modifyRecords: PropTypes.func.isRequired,
971971
paste: PropTypes.func,
972972
selectNone: PropTypes.func,
973973
onSelectRecord: PropTypes.func,

0 commit comments

Comments
 (0)