mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
Fix open folder error when select folder (#6899)
* 01 fix code bug when select another folder * 02 optimise codes * 03 fix no share link style
This commit is contained in:
@@ -20,7 +20,10 @@ const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, rep
|
|||||||
|
|
||||||
if (path === '/' && !dirent) {
|
if (path === '/' && !dirent) {
|
||||||
return (
|
return (
|
||||||
<LibDetail currentRepoInfo={currentRepoInfo} onClose={onClose} />
|
<LibDetail
|
||||||
|
currentRepoInfo={currentRepoInfo}
|
||||||
|
onClose={onClose}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -36,7 +39,8 @@ const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, rep
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}, (props, nextProps) => {
|
}, (props, nextProps) => {
|
||||||
const isChanged = props.repoID !== nextProps.repoID ||
|
const isChanged =
|
||||||
|
props.repoID !== nextProps.repoID ||
|
||||||
props.path !== nextProps.path ||
|
props.path !== nextProps.path ||
|
||||||
!ObjectUtils.isSameObject(props.dirent, nextProps.dirent) ||
|
!ObjectUtils.isSameObject(props.dirent, nextProps.dirent) ||
|
||||||
!ObjectUtils.isSameObject(props.currentRepoInfo, nextProps.currentRepoInfo) ||
|
!ObjectUtils.isSameObject(props.currentRepoInfo, nextProps.currentRepoInfo) ||
|
||||||
|
@@ -73,7 +73,7 @@ class LinkList extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{shareLinks.length == 0 ? (
|
{shareLinks.length == 0 ? (
|
||||||
<EmptyTip text={gettext('No share links')}/>
|
<EmptyTip text={gettext('No share links')} className='m-0' />
|
||||||
) : (
|
) : (
|
||||||
<div className='share-list-container share-link-list'>
|
<div className='share-list-container share-link-list'>
|
||||||
<table className="table-place-header">
|
<table className="table-place-header">
|
||||||
|
@@ -567,26 +567,24 @@ class LibContentView extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadDirentList = (path) => {
|
loadDirentList = (path) => {
|
||||||
|
const { repoID } = this.props;
|
||||||
|
const { sortBy, sortOrder } = this.state;
|
||||||
this.setState({
|
this.setState({
|
||||||
isDirentListLoading: true,
|
isDirentListLoading: true,
|
||||||
direntList: [],
|
direntList: [],
|
||||||
});
|
});
|
||||||
let repoID = this.props.repoID;
|
|
||||||
seafileAPI.listDir(repoID, path, { 'with_thumbnail': true }).then(res => {
|
seafileAPI.listDir(repoID, path, { 'with_thumbnail': true }).then(res => {
|
||||||
let direntList = [];
|
const { dirent_list, user_perm: userPerm, dir_id: dirID } = res.data;
|
||||||
res.data.dirent_list.forEach(item => {
|
const direntList = Utils.sortDirents(dirent_list.map(item => new Dirent(item)), sortBy, sortOrder);
|
||||||
let dirent = new Dirent(item);
|
|
||||||
direntList.push(dirent);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
pathExist: true,
|
pathExist: true,
|
||||||
userPerm: res.data.user_perm,
|
userPerm,
|
||||||
isDirentListLoading: false,
|
isDirentListLoading: false,
|
||||||
direntList: Utils.sortDirents(direntList, this.state.sortBy, this.state.sortOrder),
|
direntList,
|
||||||
dirID: res.data.dir_id,
|
dirID,
|
||||||
path: path,
|
path,
|
||||||
isSessionExpired: false,
|
isSessionExpired: false,
|
||||||
|
currentDirent: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.state.currentRepoInfo.is_admin) {
|
if (this.state.currentRepoInfo.is_admin) {
|
||||||
@@ -633,8 +631,7 @@ class LibContentView extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onListContainerScroll = () => {
|
onListContainerScroll = () => {
|
||||||
let itemsShowLength = this.state.itemsShowLength + 100;
|
this.setState({ itemsShowLength: this.state.itemsShowLength + 100 });
|
||||||
this.setState({ itemsShowLength: itemsShowLength });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
resetShowLength = () => {
|
resetShowLength = () => {
|
||||||
@@ -2018,19 +2015,11 @@ class LibContentView extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getSelectedDirentPaths = () => {
|
getSelectedDirentPaths = () => {
|
||||||
let paths = [];
|
return this.state.selectedDirentList.map(selectedDirent => Utils.joinPath(this.state.path, selectedDirent.name));
|
||||||
this.state.selectedDirentList.forEach(selectedDirent => {
|
|
||||||
paths.push(Utils.joinPath(this.state.path, selectedDirent.name));
|
|
||||||
});
|
|
||||||
return paths;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getSelectedDirentNames = () => {
|
getSelectedDirentNames = () => {
|
||||||
let names = [];
|
return this.state.selectedDirentList.map(selectedDirent => selectedDirent.name);
|
||||||
this.state.selectedDirentList.forEach(selectedDirent => {
|
|
||||||
names.push(selectedDirent.name);
|
|
||||||
});
|
|
||||||
return names;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
resetSelected = () => {
|
resetSelected = () => {
|
||||||
|
Reference in New Issue
Block a user