mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-22 03:47:09 +00:00
root path show file_tag && tagged_files_count (#2715)
This commit is contained in:
@@ -9,6 +9,7 @@ import toaster from '../toast';
|
||||
import DirPanel from './dir-panel';
|
||||
import Dirent from '../../models/dirent';
|
||||
import FileTag from '../../models/file-tag';
|
||||
import RepoTag from '../../models/repo-tag';
|
||||
import RepoInfo from '../../models/repo-info';
|
||||
|
||||
const propTypes = {
|
||||
@@ -37,6 +38,7 @@ class DirView extends React.Component {
|
||||
selectedDirentList: [],
|
||||
dirID: '',
|
||||
errorMsg: '',
|
||||
usedRepoTags: [],
|
||||
};
|
||||
window.onpopstate = this.onpopstate;
|
||||
this.lastModifyTime = new Date();
|
||||
@@ -54,6 +56,16 @@ class DirView extends React.Component {
|
||||
let location = decodeURIComponent(window.location.href);
|
||||
let repoID = this.props.repoID;
|
||||
collabServer.watchRepo(repoID, this.onRepoUpdateEvent);
|
||||
seafileAPI.listRepoTags(repoID).then(res => {
|
||||
let usedRepoTags = [];
|
||||
res.data.repo_tags.forEach(item => {
|
||||
let usedRepoTag = new RepoTag(item);
|
||||
if (usedRepoTag.fileCount > 0) {
|
||||
usedRepoTags.push(usedRepoTag);
|
||||
}
|
||||
});
|
||||
this.setState({usedRepoTags: usedRepoTags});
|
||||
});
|
||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||
let repoInfo = new RepoInfo(res.data);
|
||||
this.setState({
|
||||
@@ -122,6 +134,10 @@ class DirView extends React.Component {
|
||||
})
|
||||
}
|
||||
|
||||
updateUsedRepoTags = (newUsedRepoTags) => {
|
||||
this.setState({usedRepoTags: newUsedRepoTags});
|
||||
}
|
||||
|
||||
updateDirentList = (filePath) => {
|
||||
let repoID = this.state.repoID;
|
||||
this.setState({isDirentListLoading: true});
|
||||
@@ -368,6 +384,17 @@ class DirView extends React.Component {
|
||||
});
|
||||
this.updateDirent(dirent, 'file_tags', fileTags);
|
||||
});
|
||||
|
||||
seafileAPI.listRepoTags(repoID).then(res => {
|
||||
let usedRepoTags = [];
|
||||
res.data.repo_tags.forEach(item => {
|
||||
let usedRepoTag = new RepoTag(item);
|
||||
if (usedRepoTag.fileCount > 0) {
|
||||
usedRepoTags.push(usedRepoTag);
|
||||
}
|
||||
});
|
||||
this.updateUsedRepoTags(usedRepoTags);
|
||||
});
|
||||
}
|
||||
|
||||
onMenuClick = () => {
|
||||
@@ -549,6 +576,7 @@ class DirView extends React.Component {
|
||||
onFileUploadSuccess={this.onFileUploadSuccess}
|
||||
libNeedDecrypt={this.state.libNeedDecrypt}
|
||||
onLibDecryptDialog={this.onLibDecryptDialog}
|
||||
usedRepoTags={this.state.usedRepoTags}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user