1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

feat: delete multiple select, not allow generate description op (#6835)

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-09-23 17:34:13 +08:00
committed by GitHub
parent 322879f24e
commit 56b5ad57d4

View File

@@ -56,36 +56,11 @@ const ContextMenu = ({
if (selectedRange) { if (selectedRange) {
!isReadonly && list.push({ value: OPERATION.CLEAR_SELECTED, label: gettext('Clear selected') }); !isReadonly && list.push({ value: OPERATION.CLEAR_SELECTED, label: gettext('Clear selected') });
list.push({ value: OPERATION.COPY_SELECTED, label: gettext('Copy selected') }); list.push({ value: OPERATION.COPY_SELECTED, label: gettext('Copy selected') });
if (descriptionColumn) {
const { topLeft, bottomRight } = selectedRange;
for (let i = topLeft.rowIdx; i <= bottomRight.rowIdx; i++) {
const record = recordGetterByIndex({ isGroupView, groupRecordIndex: topLeft.groupRecordIndex, recordIndex: i });
const fileName = record[PRIVATE_COLUMN_KEY.FILE_NAME];
if (Utils.isDescriptionSupportedFile(fileName) && canModifyRow(record)) {
list.push({ value: OPERATION.GENERATE_DESCRIPTION, label: gettext('Generate description') });
break;
}
}
}
return list; return list;
} }
const selectedRecords = recordMetrics ? Object.keys(recordMetrics.idSelectedRecordMap) : []; const selectedRecords = recordMetrics ? Object.keys(recordMetrics.idSelectedRecordMap) : [];
if (selectedRecords.length > 1) { if (selectedRecords.length > 1) {
if (descriptionColumn) {
const isIncludeSdocRecord = selectedRecords.filter(id => {
const record = metadata.id_row_map[id];
if (record) {
const fileName = record[PRIVATE_COLUMN_KEY.FILE_NAME];
return Utils.isDescriptionSupportedFile(fileName) && canModifyRow(record);
}
return false;
});
if (isIncludeSdocRecord.length > 0) {
list.push({ value: OPERATION.GENERATE_DESCRIPTION, label: gettext('Generate description') });
}
}
return list; return list;
} }