1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

file chooser bug repair (#2839)

This commit is contained in:
杨顺强
2019-01-17 10:37:40 +08:00
committed by Daniel Pan
parent ca4dee899b
commit aeff5144dd

View File

@@ -29,17 +29,19 @@ class DirentListItem extends React.Component {
};
}
onItemClick = () => {
onItemClick = (e) => {
e.stopPropagation(); // need prevent event popup
if (this.props.selectedPath !== this.state.filePath) {
this.props.onDirentItemClick(this.state.filePath, this.props.dirent);
} else {
if (this.props.dirent.type === 'dir') {
this.onToggleClick();
this.onToggleClick(e);
}
}
}
onToggleClick = () => {
onToggleClick = (e) => {
e.stopPropagation(); // need prevent event popup
if (!this.state.hasRequest) {
seafileAPI.listDir(this.props.repo.repo_id, this.state.filePath).then(res => {
let direntList = [];
@@ -53,18 +55,14 @@ class DirentListItem extends React.Component {
direntList.push(dirent);
}
}
direntList = Utils.sortDirents(direntList, 'name', 'asc');
this.setState({
hasRequest: true,
direntList: direntList,
});
});
direntList = Utils.sortDirents(direntList, 'name', 'asc');
this.setState({
hasRequest: true,
direntList: direntList,
});
if (res.data.length === 0 || direntList.length === 0) {
this.setState({
hasRequest: true,
direntList: [],
hasChildren: false
});
this.setState({hasChildren: false});
}
});
}