1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 12:58:34 +00:00

fix: metadata file status submit key (#6806)

* fix: metadata file status submit key

* feat: update code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

---------

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-09-20 16:02:28 +08:00
committed by GitHub
parent d4685d8e1b
commit 9c25c1c661
7 changed files with 100 additions and 31 deletions

View File

@@ -7,7 +7,7 @@ import DetailItem from '../../../components/dirent-detail/detail-item';
import { Utils } from '../../../utils/utils';
import metadataAPI from '../../api';
import Column from '../../model/metadata/column';
import { getCellValueByColumn, getOptionName, getColumnOptionNamesByIds } from '../../utils/cell';
import { getCellValueByColumn, getOptionName, getColumnOptionNamesByIds, getColumnOptionNameById } from '../../utils/cell';
import { normalizeFields } from './utils';
import { gettext } from '../../../utils/constants';
import { CellType, PREDEFINED_COLUMN_KEYS, PRIVATE_COLUMN_KEY } from '../../constants';
@@ -55,9 +55,8 @@ const MetadataDetails = ({ repoID, filePath, repoInfo, direntType }) => {
const field = fields.find(f => f.key === fieldKey);
const fileName = getColumnOriginName(field);
let update = { [fileName]: newValue };
if (!PREDEFINED_COLUMN_KEYS.includes(field.key) && field.type === CellType.SINGLE_SELECT) {
const options = getColumnOptions(field);
update = { [fileName]: getOptionName(options, newValue) };
if (field.type === CellType.SINGLE_SELECT) {
update = { [fileName]: getColumnOptionNameById(field, newValue) };
} else if (field.type === CellType.MULTIPLE_SELECT) {
update = { [fileName]: newValue ? getColumnOptionNamesByIds(field, newValue) : [] };
}