1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 10:50:24 +00:00
* show path

* [repo trash dialog] improved 'current path'

* update

---------

Co-authored-by: 孙永强 <11704063+s-yongqiang@user.noreply.gitee.com>
Co-authored-by: llj <lingjun.li1@gmail.com>
This commit is contained in:
awu0403
2024-09-19 10:25:34 +08:00
committed by GitHub
parent 33ffeab306
commit a5d8ef3fe2
2 changed files with 63 additions and 12 deletions

View File

@@ -141,6 +141,43 @@ class TrashDialog extends React.Component {
});
};
clickFolderPath = (folderPath, e) => {
e.preventDefault();
const { commitID, baseDir } = this.state;
this.renderFolder(commitID, baseDir, folderPath);
};
clickRoot = (e) => {
e.preventDefault();
this.refreshTrash2();
};
renderFolderPath = () => {
const pathList = this.state.folderPath.split('/');
const repoFolderName = this.props.currentRepoInfo.repo_name;
return (
<React.Fragment>
<a href="#" onClick={this.clickRoot} className="path-item" title={repoFolderName}>{repoFolderName}</a>
<span className="path-split">/</span>
{pathList.map((item, index) => {
if (index > 0 && index != pathList.length - 1) {
return (
<React.Fragment key={index}>
<a className="path-item" href="#" onClick={this.clickFolderPath.bind(this, pathList.slice(0, index + 1).join('/'))} title={pathList[index]}>{pathList[index]}</a>
<span className="path-split">/</span>
</React.Fragment>
);
}
return null;
}
)}
<span className="last-path-item" title={pathList[pathList.length - 1]}>{pathList[pathList.length - 1]}</span>
</React.Fragment>
);
};
render() {
const { showTrashDialog, toggleTrashDialog } = this.props;
const { isCleanTrashDialogOpen, showFolder, isLoading, items } = this.state;
@@ -171,17 +208,26 @@ class TrashDialog extends React.Component {
<EmptyTip text={gettext('No file')} className="m-0" />
}
{!isLoading && items.length > 0 &&
<Content
data={this.state}
repoID={this.props.repoID}
getMore={this.getMore}
currentPage={this.state.currentPage}
curPerPage={this.state.perPage}
hasNextPage={this.state.hasNextPage}
renderFolder={this.renderFolder}
getListByPage={this.getItems2}
resetPerPage={this.resetPerPage}
/>
<div>
<div className="path-container dir-view-path mb-2">
<span className="path-label mr-1">{gettext('Current path: ')}</span>
{showFolder ?
this.renderFolderPath() :
<span className="last-path-item" title={repoFolderName}>{repoFolderName}</span>
}
</div>
<Content
data={this.state}
repoID={this.props.repoID}
getMore={this.getMore}
currentPage={this.state.currentPage}
curPerPage={this.state.perPage}
hasNextPage={this.state.hasNextPage}
renderFolder={this.renderFolder}
getListByPage={this.getItems2}
resetPerPage={this.resetPerPage}
/>
</div>
}
{isCleanTrashDialogOpen &&
<ModalPortal>