mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
fix: metadata bug
This commit is contained in:
@@ -107,7 +107,7 @@ class DirentDetails extends React.Component {
|
||||
repoInfo={this.props.currentRepoInfo}
|
||||
dirent={dirent}
|
||||
direntDetail={direntDetail}
|
||||
path={this.props.dirent ? path + '/' + dirent.name : path}
|
||||
path={this.props.dirent ? Utils.joinPath(path, dirent.name) : path}
|
||||
/>
|
||||
:
|
||||
<FileDetails
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import React, { Fragment, memo, useCallback, useMemo } from 'react';
|
||||
import React, { Fragment, useCallback, useMemo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import { DragSource, DropTarget } from 'react-dnd';
|
||||
import { Icon, CustomizeSelect } from '@seafile/sf-metadata-ui-component';
|
||||
import { gettext } from '../../../../../utils/constants';
|
||||
import ObjectUtils from '../../../../utils/object-utils';
|
||||
import { getColumnByKey } from '../../../../utils/column';
|
||||
import { COLUMNS_ICON_CONFIG, SORT_TYPE, SORT_COLUMN_OPTIONS } from '../../../../constants';
|
||||
import { getGroupbyGranularityByColumn, isShowGroupCountType, getSelectedCountType, getDefaultCountType } from '../../../../utils/group';
|
||||
@@ -59,7 +58,7 @@ const dropCollect = (connect, monitor) => ({
|
||||
sort_type: 'xxx',
|
||||
}
|
||||
*/
|
||||
const GroupbyItem = memo(({
|
||||
const GroupbyItem = ({
|
||||
isOver, isDragging, canDrop, connectDragSource, connectDragPreview, connectDropTarget,
|
||||
showDragBtn, index, readOnly, groupby, columns, onDelete, onUpdate
|
||||
}) => {
|
||||
@@ -220,16 +219,7 @@ const GroupbyItem = memo(({
|
||||
)
|
||||
);
|
||||
|
||||
}, (props, nextProps) => {
|
||||
const isChanged =
|
||||
props.index !== nextProps.index ||
|
||||
!ObjectUtils.isSameObject(props.groupby, nextProps.groupby) ||
|
||||
props.isDragging !== nextProps.isDragging ||
|
||||
props.isOver !== nextProps.isOver ||
|
||||
props.canDrop !== nextProps.canDrop ||
|
||||
props.showDragBtn !== nextProps.showDragBtn;
|
||||
return !isChanged;
|
||||
});
|
||||
};
|
||||
|
||||
GroupbyItem.propTypes = {
|
||||
index: PropTypes.number,
|
||||
|
@@ -220,20 +220,20 @@ const HeaderDropdownMenu = ({ column, view, renameColumn, modifyColumnData, dele
|
||||
onChange={openOptionPopover}
|
||||
/>
|
||||
)}
|
||||
{type === CellType.NUMBER && (
|
||||
{/* {type === CellType.NUMBER && (
|
||||
TODO:
|
||||
<DropdownItem
|
||||
disabled={!canModifyColumnData}
|
||||
disabled={canModifyColumnData}
|
||||
target="sf-metadata-edit-column-format"
|
||||
iconName="set-up"
|
||||
title={gettext('Edit format settings')}
|
||||
tip={gettext('You do not have permission')}
|
||||
onChange={openOptionPopover}
|
||||
onChange={() => {}}
|
||||
/>
|
||||
)}
|
||||
)} */}
|
||||
{type === CellType.DATE && (
|
||||
<>{renderDateFormat(canModifyColumnData)}</>
|
||||
)}
|
||||
{[CellType.DATE, CellType.SINGLE_SELECT, CellType.NUMBER, CellType.MULTIPLE_SELECT].includes(column.type) && (
|
||||
{[CellType.DATE, CellType.SINGLE_SELECT, CellType.MULTIPLE_SELECT].includes(column.type) && (
|
||||
<DefaultDropdownItem key="divider-item" divider />
|
||||
)}
|
||||
<DropdownItem
|
||||
|
@@ -1551,7 +1551,7 @@ class LibContentView extends React.Component {
|
||||
currentDirent: dirent && dirent.isActive ? null : dirent
|
||||
});
|
||||
let direntList = this.state.direntList.map(item => {
|
||||
if (item.name === dirent.name) {
|
||||
if (dirent && item.name === dirent.name) {
|
||||
item.isSelected = !item.isSelected;
|
||||
}
|
||||
return item;
|
||||
@@ -2044,7 +2044,8 @@ class LibContentView extends React.Component {
|
||||
};
|
||||
|
||||
getMarkDownFileName = () => {
|
||||
return this.markdownFileName || this.state.currentDirent.name || '';
|
||||
const { currentDirent } = this.state;
|
||||
return this.markdownFileName || (currentDirent && currentDirent.name) || '';
|
||||
};
|
||||
|
||||
openMarkdownFile = () => {
|
||||
@@ -2144,7 +2145,7 @@ class LibContentView extends React.Component {
|
||||
direntList,
|
||||
selectedDirentList: []
|
||||
});
|
||||
const dirent = {};
|
||||
const dirent = null;
|
||||
this.onDirentSelected(dirent);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user