Skip to content

Commit

Permalink
fix: metadata bug
Browse files Browse the repository at this point in the history
  • Loading branch information
杨国璇 authored and renjie-run committed Sep 18, 2024
1 parent f8b274e commit 4a4519e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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
}) => {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,20 @@ const HeaderDropdownMenu = ({ column, view, renameColumn, modifyColumnData, dele
onChange={openOptionPopover}
/>
)}
{type === CellType.NUMBER && (
{/* {type === CellType.NUMBER && (
<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}
tip={gettext('To do')}
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
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -2144,7 +2145,7 @@ class LibContentView extends React.Component {
direntList,
selectedDirentList: []
});
const dirent = {};
const dirent = null;
this.onDirentSelected(dirent);
};

Expand Down

0 comments on commit 4a4519e

Please sign in to comment.