mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 11:51:27 +00:00
remove wrong logic about selected path (#6887)
* remove wrong logic about selected path * change function name --------- Co-authored-by: zhouwenxuan <aries@Mac.local> Co-authored-by: Michael An <2331806369@qq.com>
This commit is contained in:
@@ -42,7 +42,6 @@ class SelectDirentBody extends React.Component {
|
|||||||
try {
|
try {
|
||||||
const res = await seafileAPI.getRepoInfo(this.props.repoID);
|
const res = await seafileAPI.getRepoInfo(this.props.repoID);
|
||||||
const repoInfo = new RepoInfo(res.data);
|
const repoInfo = new RepoInfo(res.data);
|
||||||
this.props.setSelectedPath('/');
|
|
||||||
this.setState({
|
this.setState({
|
||||||
currentRepoInfo: repoInfo,
|
currentRepoInfo: repoInfo,
|
||||||
selectedRepo: repoInfo,
|
selectedRepo: repoInfo,
|
||||||
@@ -60,9 +59,6 @@ class SelectDirentBody extends React.Component {
|
|||||||
const repoList = repos.filter((repo) => repo.permission === 'rw' && repo.repo_id !== this.props.repoID);
|
const repoList = repos.filter((repo) => repo.permission === 'rw' && repo.repo_id !== this.props.repoID);
|
||||||
const sortedRepoList = Utils.sortRepos(repoList, 'name', 'asc');
|
const sortedRepoList = Utils.sortRepos(repoList, 'name', 'asc');
|
||||||
const selectedRepo = sortedRepoList.find((repo) => repo.repo_id === this.props.repoID);
|
const selectedRepo = sortedRepoList.find((repo) => repo.repo_id === this.props.repoID);
|
||||||
const path = this.props.path.substring(0, this.props.path.length - 1);
|
|
||||||
|
|
||||||
this.props.setSelectedPath(path);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
repoList: sortedRepoList,
|
repoList: sortedRepoList,
|
||||||
selectedRepo: selectedRepo || this.state.selectedRepo,
|
selectedRepo: selectedRepo || this.state.selectedRepo,
|
||||||
@@ -92,10 +88,6 @@ class SelectDirentBody extends React.Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
selectPath = (path) => {
|
|
||||||
this.props.setSelectedPath(path);
|
|
||||||
};
|
|
||||||
|
|
||||||
setBrowsingPath = (path) => {
|
setBrowsingPath = (path) => {
|
||||||
this.setState({ browsingPath: path });
|
this.setState({ browsingPath: path });
|
||||||
};
|
};
|
||||||
@@ -158,7 +150,7 @@ class SelectDirentBody extends React.Component {
|
|||||||
onDirentItemClick={this.onDirentItemClick}
|
onDirentItemClick={this.onDirentItemClick}
|
||||||
selectSearchedItem={this.selectSearchedItem}
|
selectSearchedItem={this.selectSearchedItem}
|
||||||
selectRepo={this.onSelectSearchedRepo}
|
selectRepo={this.onSelectSearchedRepo}
|
||||||
selectPath={this.selectPath}
|
setSelectedPath={this.props.setSelectedPath}
|
||||||
setBrowsingPath={this.setBrowsingPath}
|
setBrowsingPath={this.setBrowsingPath}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@@ -20,7 +20,7 @@ export const SearchStatus = {
|
|||||||
BROWSING: 'browsing',
|
BROWSING: 'browsing',
|
||||||
};
|
};
|
||||||
|
|
||||||
const Searcher = ({ searchStatus, onUpdateSearchStatus, onDirentItemClick, selectSearchedItem, selectRepo, selectPath, setBrowsingPath }) => {
|
const Searcher = ({ searchStatus, onUpdateSearchStatus, onDirentItemClick, selectSearchedItem, selectRepo, setSelectedPath, setBrowsingPath }) => {
|
||||||
const [inputValue, setInputValue] = useState('');
|
const [inputValue, setInputValue] = useState('');
|
||||||
const [isResultsPopoverOpen, setIsResultsPopoverOpen] = useState(false);
|
const [isResultsPopoverOpen, setIsResultsPopoverOpen] = useState(false);
|
||||||
const [searchResults, setSearchResults] = useState([]);
|
const [searchResults, setSearchResults] = useState([]);
|
||||||
@@ -125,7 +125,7 @@ const Searcher = ({ searchStatus, onUpdateSearchStatus, onDirentItemClick, selec
|
|||||||
const repoInfo = new RepoInfo(res.data);
|
const repoInfo = new RepoInfo(res.data);
|
||||||
const path = item.path.substring(0, item.path.length - 1);
|
const path = item.path.substring(0, item.path.length - 1);
|
||||||
selectRepo(repoInfo);
|
selectRepo(repoInfo);
|
||||||
selectPath(path);
|
setSelectedPath(path);
|
||||||
setBrowsingPath(item.path.substring(0, item.path.length - 1));
|
setBrowsingPath(item.path.substring(0, item.path.length - 1));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
const errMessage = Utils.getErrorMsg(err);
|
const errMessage = Utils.getErrorMsg(err);
|
||||||
@@ -199,7 +199,7 @@ Searcher.propTypes = {
|
|||||||
onDirentItemClick: PropTypes.func,
|
onDirentItemClick: PropTypes.func,
|
||||||
selectSearchedItem: PropTypes.func,
|
selectSearchedItem: PropTypes.func,
|
||||||
selectRepo: PropTypes.func,
|
selectRepo: PropTypes.func,
|
||||||
selectPath: PropTypes.func,
|
setSelectedPath: PropTypes.func,
|
||||||
setBrowsingPath: PropTypes.func,
|
setBrowsingPath: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user