1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-27 15:54:39 +00:00

Change translation and ai menu permission (#7901)

* 01 fix error zh-cn translation

* 02 change table view AI menu permission

* 03 delete useless path
This commit is contained in:
Michael An
2025-06-07 16:29:55 +08:00
committed by GitHub
parent 5b3b2defe9
commit 794dbe0b87
4 changed files with 76 additions and 71 deletions

View File

@@ -13,6 +13,8 @@ import { getColumnByKey } from '../../metadata/utils/column';
import { useMetadataStatus } from '../../hooks';
import { openInNewTab, openParentFolder } from '../../metadata/utils/file';
const { enableSeafileAI } = window.app.config;
const TableFilesToolbar = ({ repoID }) => {
const [selectedRecordIds, setSelectedRecordIds] = useState([]);
const metadataRef = useRef([]);
@@ -48,16 +50,15 @@ const TableFilesToolbar = ({ repoID }) => {
const length = selectedRecordIds.length;
const list = [];
if (length > 1) {
const imageOrVideoRecords = records.filter(record => {
const isFolder = checkIsDir(record);
if (isFolder) return false;
const canModifyRow = checkCanModifyRow(record);
if (!canModifyRow) return false;
const fileName = getFileName(record);
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
});
if (imageOrVideoRecords.length > 0) {
list.push(EXTRACT_FILE_DETAILS);
if (enableSeafileAI) {
const imageOrVideoRecords = records.filter(record => {
if (checkIsDir(record) || !checkCanModifyRow(record)) return false;
const fileName = getFileName(record);
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
});
if (imageOrVideoRecords.length > 0) {
list.push(EXTRACT_FILE_DETAILS);
}
}
return list;
@@ -77,7 +78,7 @@ const TableFilesToolbar = ({ repoID }) => {
list.push(...modifyOptions);
}
if (!isFolder && canModifyRow) {
if (enableSeafileAI && !isFolder && canModifyRow) {
const { columns } = metadataRef.current;
const fileName = getFileNameFromRecord(record);
const isDescribableFile = canModifyRow && Utils.isDescriptionSupportedFile(fileName);

View File

@@ -1,20 +1,21 @@
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../../../utils/constants';
import { Utils } from '../../../../utils/utils';
import { useMetadataView } from '../../../hooks/metadata-view';
import { useMetadataStatus } from '../../../../hooks';
import { getColumnByKey, isNameColumn } from '../../../utils/column';
import { checkIsDir } from '../../../utils/row';
import { EVENT_BUS_TYPE, EVENT_BUS_TYPE as METADATA_EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../../constants';
import { getFileNameFromRecord, getParentDirFromRecord, getRecordIdFromRecord } from '../../../utils/cell';
import FileTagsDialog from '../../../components/dialog/file-tags-dialog';
import { openInNewTab, openParentFolder } from '../../../utils/file';
import DeleteFolderDialog from '../../../../components/dialog/delete-folder-dialog';
import MoveDirent from '../../../../components/dialog/move-dirent-dialog';
import { Dirent } from '../../../../models';
import ContextMenuComponent from '../../../components/context-menu';
import RowUtils from '../utils/row-utils';
import { useMetadataStatus } from '@/hooks';
import { gettext } from '@/utils/constants';
import { Utils } from '@/utils/utils';
import DeleteFolderDialog from '@/components/dialog/delete-folder-dialog';
import MoveDirent from '@/components/dialog/move-dirent-dialog';
import { Dirent } from '@/models';
import { useMetadataView } from '../../hooks/metadata-view';
import RowUtils from './utils/row-utils';
import { checkIsDir } from '../../utils/row';
import { getColumnByKey, isNameColumn } from '../../utils/column';
import { EVENT_BUS_TYPE, EVENT_BUS_TYPE as METADATA_EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../constants';
import { getFileNameFromRecord, getParentDirFromRecord, getRecordIdFromRecord } from '../../utils/cell';
import FileTagsDialog from '../../components/dialog/file-tags-dialog';
import ContextMenuComponent from '../../components/context-menu';
import { openInNewTab, openParentFolder } from '../../utils/file';
const OPERATION = {
CLEAR_SELECTED: 'clear-selected',
@@ -34,6 +35,8 @@ const OPERATION = {
MOVE: 'move',
};
const { enableSeafileAI } = window.app.config;
const ContextMenu = ({
isGroupView, selectedRange, selectedPosition, recordMetrics, recordGetterByIndex, onClearSelected, onCopySelected,
getTableContentRect, getTableCanvasContainerRect, deleteRecords, selectNone, updateFileTags, moveRecord, addFolder, updateRecordDetails,
@@ -96,7 +99,10 @@ const ContextMenu = ({
// handle selected multiple cells
if (selectedRange) {
!isReadonly && list.push({ value: OPERATION.CLEAR_SELECTED, label: gettext('Clear selected') });
if (!isReadonly) {
list.push({ value: OPERATION.CLEAR_SELECTED, label: gettext('Clear selected') });
}
list.push({ value: OPERATION.COPY_SELECTED, label: gettext('Copy selected') });
const { topLeft, bottomRight } = selectedRange;
@@ -113,19 +119,21 @@ const ContextMenu = ({
list.push({ value: OPERATION.DELETE_RECORDS, label: gettext('Delete selected'), records: ableDeleteRecords });
}
const imageOrVideoRecords = records.filter(record => {
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
});
if (imageOrVideoRecords.length > 0) {
list.push({ value: OPERATION.FILE_DETAILS, label: gettext('Extract file details'), records: imageOrVideoRecords });
}
const imageRecords = records.filter(record => {
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName);
});
if (imageRecords.length > 0) {
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
if (enableSeafileAI) {
const imageOrVideoRecords = records.filter(record => {
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
});
if (imageOrVideoRecords.length > 0) {
list.push({ value: OPERATION.FILE_DETAILS, label: gettext('Extract file details'), records: imageOrVideoRecords });
}
const imageRecords = records.filter(record => {
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName);
});
if (imageRecords.length > 0) {
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
}
}
return list;
}
@@ -145,27 +153,23 @@ const ContextMenu = ({
if (ableDeleteRecords.length > 0) {
list.push({ value: OPERATION.DELETE_RECORDS, label: gettext('Delete'), records: ableDeleteRecords });
}
const imageOrVideoRecords = records.filter(record => {
const isFolder = checkIsDir(record);
if (isFolder) return false;
const canModifyRow = checkCanModifyRow(record);
if (!canModifyRow) return false;
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
});
if (imageOrVideoRecords.length > 0) {
list.push({ value: OPERATION.FILE_DETAILS, label: gettext('Extract file details'), records: imageOrVideoRecords });
}
const imageRecords = records.filter(record => {
const isFolder = checkIsDir(record);
if (isFolder) return false;
const canModifyRow = checkCanModifyRow(record);
if (!canModifyRow) return false;
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName);
});
if (imageRecords.length > 0) {
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
if (enableSeafileAI) {
const imageOrVideoRecords = records.filter(record => {
if (checkIsDir(record) || !checkCanModifyRow(record)) return false;
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
});
if (imageOrVideoRecords.length > 0) {
list.push({ value: OPERATION.FILE_DETAILS, label: gettext('Extract file details'), records: imageOrVideoRecords });
}
const imageRecords = records.filter(record => {
if (checkIsDir(record) || !checkCanModifyRow(record)) return false;
const fileName = getFileNameFromRecord(record);
return Utils.imageCheck(fileName);
});
if (imageRecords.length > 0) {
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
}
}
return list;
}
@@ -202,7 +206,7 @@ const ContextMenu = ({
list.push(...modifyOptions);
}
if (!isFolder && canModifyRow) {
if (enableSeafileAI && !isFolder && canModifyRow) {
const fileName = getFileNameFromRecord(record);
const isDescribableFile = checkIsDescribableFile(record);
const isImage = Utils.imageCheck(fileName);

View File

@@ -1,22 +1,22 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { HorizontalScrollbar } from '../../../../components/scrollbar';
import EmptyTip from '../../../../../components/empty-tip';
import EmptyTip from '@/components/empty-tip';
import { isMobile } from '@/utils/utils';
import { isShiftKeyDown } from '@/utils/keyboard-utils';
import { gettext } from '@/utils/constants';
import { addClassName, removeClassName, getEventClassName } from '@/utils/dom';
import { getColOverScanEndIdx, getColOverScanStartIdx } from '@/components/sf-table/utils/grid';
import { getVisibleBoundaries } from '@/components/sf-table/utils/viewport';
import Body from './body';
import GroupBody from './group-body';
import RecordsHeader from '../records-header';
import RecordsFooter from '../records-footer';
import ContextMenu from '../../context-menu';
import { recalculate } from '../../../../utils/column';
import { addClassName, removeClassName, getEventClassName } from '../../../../../utils/dom';
import { SEQUENCE_COLUMN_WIDTH, CANVAS_RIGHT_INTERVAL, GROUP_ROW_TYPE, EVENT_BUS_TYPE } from '../../../../constants';
import { isMobile } from '../../../../../utils/utils';
import { isShiftKeyDown } from '../../../../../utils/keyboard-utils';
import { gettext } from '../../../../../utils/constants';
import RecordMetrics from '../../utils/record-metrics';
import { getColOverScanEndIdx, getColOverScanStartIdx } from '../../../../../components/sf-table/utils/grid';
import { getVisibleBoundaries } from '../../../../../components/sf-table/utils/viewport';
import { isWindowsBrowser, isWebkitBrowser } from '../../utils';
import { SEQUENCE_COLUMN_WIDTH, CANVAS_RIGHT_INTERVAL, GROUP_ROW_TYPE, EVENT_BUS_TYPE } from '../../../../constants';
class Records extends Component {

View File

@@ -7096,7 +7096,7 @@ msgstr "提取文件详细信息"
#: frontend/src/metadata/views/table/context-menu/index.js:216
#| msgid "Select Image"
msgid "Detect faces"
msgstr "删除人脸"
msgstr "检测人脸"
#: frontend/src/metadata/views/table/context-menu/index.js:193
#: frontend/src/utils/text-translation.js:257