1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 17:33:18 +00:00

repair refresh bug and rename bug

This commit is contained in:
shanshuirenjia
2018-12-12 22:58:58 +08:00
parent a088b50514
commit c216f199a2
4 changed files with 14 additions and 9 deletions

View File

@@ -64,9 +64,6 @@ class App extends Component {
let href = window.location.href.split('/');
this.getDrafts();
this.setState({currentTab: href[href.length - 2]});
if (this.currentTab) {
this.setState({currentTab: this.currentTab});
}
}
getDrafts = () => {

View File

@@ -44,6 +44,8 @@ class DirView extends React.Component {
}
componentDidMount() {
//eg: http://127.0.0.1:8000/library/repo_id/repo_name/**/**/
let location = decodeURIComponent(window.location.href);
let repoID = this.props.repoID;
seafileAPI.getRepoInfo(repoID).then(res => {
let repo = new Repo(res.data);
@@ -53,15 +55,20 @@ class DirView extends React.Component {
permission: repo.permission === 'rw',
currentRepo: repo,
});
this.updateDirentList(this.state.path);
let repoName = repo.repo_name;
let index = location.indexOf(repoName);
let path = location.slice(index + repoName.length);
this.updateDirentList(path);
this.setState({path: path});
});
}
updateDirentList = (filePath) => {
let repoID = this.state.repoID;
this.setState({isDirentListLoading: true});
seafileAPI.listDir(repoID, filePath).then(res => {
const path = encodeURIComponent(filePath);
seafileAPI.listDir(repoID, path).then(res => {
let direntList = res.data.map(item => {
return new Dirent(item);
});

View File

@@ -91,7 +91,7 @@ class SharedRepoListItem extends React.Component {
});
//todo change to library; div-view is not compatibility
let libPath = `${siteRoot}library/${this.props.repo.repo_id}/`;
let libPath = `${siteRoot}library/${this.props.repo.repo_id}/${this.props.repo.repo_name}/`;
return { iconUrl, iconTitle, libPath };
}
@@ -285,7 +285,7 @@ class SharedRepoListItem extends React.Component {
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
<td><img src={iconUrl} title={iconTitle} alt={iconTitle}/></td>
<td>
<a href={libPath}>{repo.repo_name}</a><br />
<Link to={libPath}>{repo.repo_name}</Link><br />
<span className="item-meta-info" title={repo.owner_contact_email}>{repo.owner_name}</span>
<span className="item-meta-info">{repo.size}</span>
<span className="item-meta-info" title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</span>

View File

@@ -247,7 +247,8 @@ class Wiki extends Component {
loadDirentList = (filePath) => {
this.setState({isDirentListLoading: true});
seafileAPI.listDir(repoID, filePath).then(res => {
const path = encodeURIComponent(filePath);
seafileAPI.listDir(repoID, path).then(res => {
let direntList = [];
res.data.forEach(item => {
let dirent = new Dirent(item);