mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 23:48:47 +00:00
repair refresh bug and rename bug
This commit is contained in:
@@ -64,9 +64,6 @@ class App extends Component {
|
|||||||
let href = window.location.href.split('/');
|
let href = window.location.href.split('/');
|
||||||
this.getDrafts();
|
this.getDrafts();
|
||||||
this.setState({currentTab: href[href.length - 2]});
|
this.setState({currentTab: href[href.length - 2]});
|
||||||
if (this.currentTab) {
|
|
||||||
this.setState({currentTab: this.currentTab});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getDrafts = () => {
|
getDrafts = () => {
|
||||||
|
@@ -44,6 +44,8 @@ class DirView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
//eg: http://127.0.0.1:8000/library/repo_id/repo_name/**/**/
|
||||||
|
let location = decodeURIComponent(window.location.href);
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||||
let repo = new Repo(res.data);
|
let repo = new Repo(res.data);
|
||||||
@@ -53,15 +55,20 @@ class DirView extends React.Component {
|
|||||||
permission: repo.permission === 'rw',
|
permission: repo.permission === 'rw',
|
||||||
currentRepo: repo,
|
currentRepo: repo,
|
||||||
});
|
});
|
||||||
|
let repoName = repo.repo_name;
|
||||||
this.updateDirentList(this.state.path);
|
let index = location.indexOf(repoName);
|
||||||
|
let path = location.slice(index + repoName.length);
|
||||||
|
this.updateDirentList(path);
|
||||||
|
this.setState({path: path});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDirentList = (filePath) => {
|
updateDirentList = (filePath) => {
|
||||||
let repoID = this.state.repoID;
|
let repoID = this.state.repoID;
|
||||||
this.setState({isDirentListLoading: true});
|
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 => {
|
let direntList = res.data.map(item => {
|
||||||
return new Dirent(item);
|
return new Dirent(item);
|
||||||
});
|
});
|
||||||
|
@@ -91,7 +91,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//todo change to library; div-view is not compatibility
|
//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 };
|
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}>
|
<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><img src={iconUrl} title={iconTitle} alt={iconTitle}/></td>
|
||||||
<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" title={repo.owner_contact_email}>{repo.owner_name}</span>
|
||||||
<span className="item-meta-info">{repo.size}</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>
|
<span className="item-meta-info" title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</span>
|
||||||
|
@@ -247,7 +247,8 @@ class Wiki extends Component {
|
|||||||
|
|
||||||
loadDirentList = (filePath) => {
|
loadDirentList = (filePath) => {
|
||||||
this.setState({isDirentListLoading: true});
|
this.setState({isDirentListLoading: true});
|
||||||
seafileAPI.listDir(repoID, filePath).then(res => {
|
const path = encodeURIComponent(filePath);
|
||||||
|
seafileAPI.listDir(repoID, path).then(res => {
|
||||||
let direntList = [];
|
let direntList = [];
|
||||||
res.data.forEach(item => {
|
res.data.forEach(item => {
|
||||||
let dirent = new Dirent(item);
|
let dirent = new Dirent(item);
|
||||||
|
Reference in New Issue
Block a user