mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-27 23:56:18 +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:
@@ -13,6 +13,8 @@ import { getColumnByKey } from '../../metadata/utils/column';
|
|||||||
import { useMetadataStatus } from '../../hooks';
|
import { useMetadataStatus } from '../../hooks';
|
||||||
import { openInNewTab, openParentFolder } from '../../metadata/utils/file';
|
import { openInNewTab, openParentFolder } from '../../metadata/utils/file';
|
||||||
|
|
||||||
|
const { enableSeafileAI } = window.app.config;
|
||||||
|
|
||||||
const TableFilesToolbar = ({ repoID }) => {
|
const TableFilesToolbar = ({ repoID }) => {
|
||||||
const [selectedRecordIds, setSelectedRecordIds] = useState([]);
|
const [selectedRecordIds, setSelectedRecordIds] = useState([]);
|
||||||
const metadataRef = useRef([]);
|
const metadataRef = useRef([]);
|
||||||
@@ -48,17 +50,16 @@ const TableFilesToolbar = ({ repoID }) => {
|
|||||||
const length = selectedRecordIds.length;
|
const length = selectedRecordIds.length;
|
||||||
const list = [];
|
const list = [];
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
|
if (enableSeafileAI) {
|
||||||
const imageOrVideoRecords = records.filter(record => {
|
const imageOrVideoRecords = records.filter(record => {
|
||||||
const isFolder = checkIsDir(record);
|
if (checkIsDir(record) || !checkCanModifyRow(record)) return false;
|
||||||
if (isFolder) return false;
|
|
||||||
const canModifyRow = checkCanModifyRow(record);
|
|
||||||
if (!canModifyRow) return false;
|
|
||||||
const fileName = getFileName(record);
|
const fileName = getFileName(record);
|
||||||
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
|
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
|
||||||
});
|
});
|
||||||
if (imageOrVideoRecords.length > 0) {
|
if (imageOrVideoRecords.length > 0) {
|
||||||
list.push(EXTRACT_FILE_DETAILS);
|
list.push(EXTRACT_FILE_DETAILS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ const TableFilesToolbar = ({ repoID }) => {
|
|||||||
list.push(...modifyOptions);
|
list.push(...modifyOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFolder && canModifyRow) {
|
if (enableSeafileAI && !isFolder && canModifyRow) {
|
||||||
const { columns } = metadataRef.current;
|
const { columns } = metadataRef.current;
|
||||||
const fileName = getFileNameFromRecord(record);
|
const fileName = getFileNameFromRecord(record);
|
||||||
const isDescribableFile = canModifyRow && Utils.isDescriptionSupportedFile(fileName);
|
const isDescribableFile = canModifyRow && Utils.isDescriptionSupportedFile(fileName);
|
||||||
|
@@ -1,20 +1,21 @@
|
|||||||
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
|
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { gettext } from '../../../../utils/constants';
|
import { useMetadataStatus } from '@/hooks';
|
||||||
import { Utils } from '../../../../utils/utils';
|
import { gettext } from '@/utils/constants';
|
||||||
import { useMetadataView } from '../../../hooks/metadata-view';
|
import { Utils } from '@/utils/utils';
|
||||||
import { useMetadataStatus } from '../../../../hooks';
|
import DeleteFolderDialog from '@/components/dialog/delete-folder-dialog';
|
||||||
import { getColumnByKey, isNameColumn } from '../../../utils/column';
|
import MoveDirent from '@/components/dialog/move-dirent-dialog';
|
||||||
import { checkIsDir } from '../../../utils/row';
|
import { Dirent } from '@/models';
|
||||||
import { EVENT_BUS_TYPE, EVENT_BUS_TYPE as METADATA_EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../../constants';
|
import { useMetadataView } from '../../hooks/metadata-view';
|
||||||
import { getFileNameFromRecord, getParentDirFromRecord, getRecordIdFromRecord } from '../../../utils/cell';
|
import RowUtils from './utils/row-utils';
|
||||||
import FileTagsDialog from '../../../components/dialog/file-tags-dialog';
|
import { checkIsDir } from '../../utils/row';
|
||||||
import { openInNewTab, openParentFolder } from '../../../utils/file';
|
import { getColumnByKey, isNameColumn } from '../../utils/column';
|
||||||
import DeleteFolderDialog from '../../../../components/dialog/delete-folder-dialog';
|
import { EVENT_BUS_TYPE, EVENT_BUS_TYPE as METADATA_EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../constants';
|
||||||
import MoveDirent from '../../../../components/dialog/move-dirent-dialog';
|
import { getFileNameFromRecord, getParentDirFromRecord, getRecordIdFromRecord } from '../../utils/cell';
|
||||||
import { Dirent } from '../../../../models';
|
import FileTagsDialog from '../../components/dialog/file-tags-dialog';
|
||||||
import ContextMenuComponent from '../../../components/context-menu';
|
import ContextMenuComponent from '../../components/context-menu';
|
||||||
import RowUtils from '../utils/row-utils';
|
import { openInNewTab, openParentFolder } from '../../utils/file';
|
||||||
|
|
||||||
|
|
||||||
const OPERATION = {
|
const OPERATION = {
|
||||||
CLEAR_SELECTED: 'clear-selected',
|
CLEAR_SELECTED: 'clear-selected',
|
||||||
@@ -34,6 +35,8 @@ const OPERATION = {
|
|||||||
MOVE: 'move',
|
MOVE: 'move',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { enableSeafileAI } = window.app.config;
|
||||||
|
|
||||||
const ContextMenu = ({
|
const ContextMenu = ({
|
||||||
isGroupView, selectedRange, selectedPosition, recordMetrics, recordGetterByIndex, onClearSelected, onCopySelected,
|
isGroupView, selectedRange, selectedPosition, recordMetrics, recordGetterByIndex, onClearSelected, onCopySelected,
|
||||||
getTableContentRect, getTableCanvasContainerRect, deleteRecords, selectNone, updateFileTags, moveRecord, addFolder, updateRecordDetails,
|
getTableContentRect, getTableCanvasContainerRect, deleteRecords, selectNone, updateFileTags, moveRecord, addFolder, updateRecordDetails,
|
||||||
@@ -96,7 +99,10 @@ const ContextMenu = ({
|
|||||||
|
|
||||||
// handle selected multiple cells
|
// handle selected multiple cells
|
||||||
if (selectedRange) {
|
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') });
|
list.push({ value: OPERATION.COPY_SELECTED, label: gettext('Copy selected') });
|
||||||
|
|
||||||
const { topLeft, bottomRight } = selectedRange;
|
const { topLeft, bottomRight } = selectedRange;
|
||||||
@@ -113,6 +119,7 @@ const ContextMenu = ({
|
|||||||
list.push({ value: OPERATION.DELETE_RECORDS, label: gettext('Delete selected'), records: ableDeleteRecords });
|
list.push({ value: OPERATION.DELETE_RECORDS, label: gettext('Delete selected'), records: ableDeleteRecords });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enableSeafileAI) {
|
||||||
const imageOrVideoRecords = records.filter(record => {
|
const imageOrVideoRecords = records.filter(record => {
|
||||||
const fileName = getFileNameFromRecord(record);
|
const fileName = getFileNameFromRecord(record);
|
||||||
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
|
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
|
||||||
@@ -127,6 +134,7 @@ const ContextMenu = ({
|
|||||||
if (imageRecords.length > 0) {
|
if (imageRecords.length > 0) {
|
||||||
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
|
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,11 +153,9 @@ const ContextMenu = ({
|
|||||||
if (ableDeleteRecords.length > 0) {
|
if (ableDeleteRecords.length > 0) {
|
||||||
list.push({ value: OPERATION.DELETE_RECORDS, label: gettext('Delete'), records: ableDeleteRecords });
|
list.push({ value: OPERATION.DELETE_RECORDS, label: gettext('Delete'), records: ableDeleteRecords });
|
||||||
}
|
}
|
||||||
|
if (enableSeafileAI) {
|
||||||
const imageOrVideoRecords = records.filter(record => {
|
const imageOrVideoRecords = records.filter(record => {
|
||||||
const isFolder = checkIsDir(record);
|
if (checkIsDir(record) || !checkCanModifyRow(record)) return false;
|
||||||
if (isFolder) return false;
|
|
||||||
const canModifyRow = checkCanModifyRow(record);
|
|
||||||
if (!canModifyRow) return false;
|
|
||||||
const fileName = getFileNameFromRecord(record);
|
const fileName = getFileNameFromRecord(record);
|
||||||
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
|
return Utils.imageCheck(fileName) || Utils.videoCheck(fileName);
|
||||||
});
|
});
|
||||||
@@ -157,16 +163,14 @@ const ContextMenu = ({
|
|||||||
list.push({ value: OPERATION.FILE_DETAILS, label: gettext('Extract file details'), records: imageOrVideoRecords });
|
list.push({ value: OPERATION.FILE_DETAILS, label: gettext('Extract file details'), records: imageOrVideoRecords });
|
||||||
}
|
}
|
||||||
const imageRecords = records.filter(record => {
|
const imageRecords = records.filter(record => {
|
||||||
const isFolder = checkIsDir(record);
|
if (checkIsDir(record) || !checkCanModifyRow(record)) return false;
|
||||||
if (isFolder) return false;
|
|
||||||
const canModifyRow = checkCanModifyRow(record);
|
|
||||||
if (!canModifyRow) return false;
|
|
||||||
const fileName = getFileNameFromRecord(record);
|
const fileName = getFileNameFromRecord(record);
|
||||||
return Utils.imageCheck(fileName);
|
return Utils.imageCheck(fileName);
|
||||||
});
|
});
|
||||||
if (imageRecords.length > 0) {
|
if (imageRecords.length > 0) {
|
||||||
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
|
list.push({ value: OPERATION.DETECT_FACES, label: gettext('Detect faces'), records: imageRecords });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +206,7 @@ const ContextMenu = ({
|
|||||||
list.push(...modifyOptions);
|
list.push(...modifyOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFolder && canModifyRow) {
|
if (enableSeafileAI && !isFolder && canModifyRow) {
|
||||||
const fileName = getFileNameFromRecord(record);
|
const fileName = getFileNameFromRecord(record);
|
||||||
const isDescribableFile = checkIsDescribableFile(record);
|
const isDescribableFile = checkIsDescribableFile(record);
|
||||||
const isImage = Utils.imageCheck(fileName);
|
const isImage = Utils.imageCheck(fileName);
|
@@ -1,22 +1,22 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { HorizontalScrollbar } from '../../../../components/scrollbar';
|
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 Body from './body';
|
||||||
import GroupBody from './group-body';
|
import GroupBody from './group-body';
|
||||||
import RecordsHeader from '../records-header';
|
import RecordsHeader from '../records-header';
|
||||||
import RecordsFooter from '../records-footer';
|
import RecordsFooter from '../records-footer';
|
||||||
import ContextMenu from '../../context-menu';
|
import ContextMenu from '../../context-menu';
|
||||||
import { recalculate } from '../../../../utils/column';
|
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 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 { isWindowsBrowser, isWebkitBrowser } from '../../utils';
|
||||||
|
import { SEQUENCE_COLUMN_WIDTH, CANVAS_RIGHT_INTERVAL, GROUP_ROW_TYPE, EVENT_BUS_TYPE } from '../../../../constants';
|
||||||
|
|
||||||
class Records extends Component {
|
class Records extends Component {
|
||||||
|
|
||||||
|
@@ -7096,7 +7096,7 @@ msgstr "提取文件详细信息"
|
|||||||
#: frontend/src/metadata/views/table/context-menu/index.js:216
|
#: frontend/src/metadata/views/table/context-menu/index.js:216
|
||||||
#| msgid "Select Image"
|
#| msgid "Select Image"
|
||||||
msgid "Detect faces"
|
msgid "Detect faces"
|
||||||
msgstr "删除人脸"
|
msgstr "检测人脸"
|
||||||
|
|
||||||
#: frontend/src/metadata/views/table/context-menu/index.js:193
|
#: frontend/src/metadata/views/table/context-menu/index.js:193
|
||||||
#: frontend/src/utils/text-translation.js:257
|
#: frontend/src/utils/text-translation.js:257
|
||||||
|
Reference in New Issue
Block a user