mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
Merge pull request #3336 from haiwen/fix-delete-tag-bug
fix delete file tag
This commit is contained in:
@@ -123,6 +123,7 @@ class DirTool extends React.Component {
|
|||||||
onClose={this.onCloseRepoTagDialog}
|
onClose={this.onCloseRepoTagDialog}
|
||||||
toggleCancel={this.onUpdateRepoTagToggle}
|
toggleCancel={this.onUpdateRepoTagToggle}
|
||||||
onDeleteRepoTag={this.props.onDeleteRepoTag}
|
onDeleteRepoTag={this.props.onDeleteRepoTag}
|
||||||
|
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -46,14 +46,15 @@ class TagListItem extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
let color = this.props.item.color;
|
let color = this.props.item.color;
|
||||||
let drakColor = Utils.getDarkColor(color);
|
let drakColor = Utils.getDarkColor(color);
|
||||||
|
const fileCount = this.props.item.fileCount;
|
||||||
|
let fileTranslation = (fileCount === 1 || fileCount === 0) ? gettext('file') : gettext('files');
|
||||||
return (
|
return (
|
||||||
<li className="tag-list-item">
|
<li className="tag-list-item">
|
||||||
<div className="tag-demo" style={{backgroundColor:color}} onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut}>
|
<div className="tag-demo" style={{backgroundColor:color}} onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut}>
|
||||||
<span className={`${this.state.showSelectedTag ? 'show-tag-selected': ''}`} style={{backgroundColor: drakColor}}></span>
|
<span className={`${this.state.showSelectedTag ? 'show-tag-selected': ''}`} style={{backgroundColor: drakColor}}></span>
|
||||||
<span className="tag-name">{this.props.item.name}</span>
|
<span className="tag-name">{this.props.item.name}</span>
|
||||||
<span className="tag-files" onClick={this.onListTaggedFiles}>
|
<span className="tag-files" onClick={this.onListTaggedFiles}>
|
||||||
{/* todo 0 file 2 files */}
|
{fileCount}{' '}{fileTranslation}
|
||||||
{this.props.item.fileCount}{' '}{'files'}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<i className="tag-edit fa fa-pencil-alt" onClick={this.onTagUpdate}></i>
|
<i className="tag-edit fa fa-pencil-alt" onClick={this.onTagUpdate}></i>
|
||||||
|
@@ -12,6 +12,7 @@ const propTypes = {
|
|||||||
toggleCancel: PropTypes.func.isRequired,
|
toggleCancel: PropTypes.func.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
updateUsedRepoTags: PropTypes.func.isRequired,
|
updateUsedRepoTags: PropTypes.func.isRequired,
|
||||||
|
onFileTagChanged: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ListTaggedFilesDialog extends React.Component {
|
class ListTaggedFilesDialog extends React.Component {
|
||||||
@@ -23,12 +24,20 @@ class ListTaggedFilesDialog extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFileTagChanged = (TaggedFile) => {
|
||||||
|
const path = TaggedFile.parent_path;
|
||||||
|
const dirent = {name: TaggedFile.filename};
|
||||||
|
let direntPath = path === '/' ? path + TaggedFile.filename : path + '/' + TaggedFile.filename;
|
||||||
|
this.props.onFileTagChanged(dirent, direntPath);
|
||||||
|
}
|
||||||
|
|
||||||
onDeleteTaggedFile = (taggedFile) => {
|
onDeleteTaggedFile = (taggedFile) => {
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
let fileTagID = taggedFile.file_tag_id;
|
let fileTagID = taggedFile.file_tag_id;
|
||||||
seafileAPI.deleteFileTag(repoID, fileTagID).then(res => {
|
seafileAPI.deleteFileTag(repoID, fileTagID).then(res => {
|
||||||
this.getTaggedFiles();
|
this.getTaggedFiles();
|
||||||
this.props.updateUsedRepoTags();
|
this.props.updateUsedRepoTags();
|
||||||
|
if (this.props.onFileTagChanged) this.onFileTagChanged(taggedFile);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ const propTypes = {
|
|||||||
repoID: PropTypes.string.isRequired,
|
repoID: PropTypes.string.isRequired,
|
||||||
toggleCancel: PropTypes.func.isRequired,
|
toggleCancel: PropTypes.func.isRequired,
|
||||||
onDeleteRepoTag: PropTypes.func.isRequired,
|
onDeleteRepoTag: PropTypes.func.isRequired,
|
||||||
|
updateUsedRepoTags: PropTypes.func.isRequired,
|
||||||
onClose: PropTypes.func.isRequired
|
onClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ class UpdateTagDialog extends React.Component {
|
|||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.updateRepoTag(repoID, tag_id, name, color).then(() => {
|
seafileAPI.updateRepoTag(repoID, tag_id, name, color).then(() => {
|
||||||
this.props.toggleCancel();
|
this.props.toggleCancel();
|
||||||
|
this.props.updateUsedRepoTags();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,6 +64,7 @@ class DirListView extends React.Component {
|
|||||||
draftCounts={this.props.draftCounts}
|
draftCounts={this.props.draftCounts}
|
||||||
usedRepoTags={this.props.usedRepoTags}
|
usedRepoTags={this.props.usedRepoTags}
|
||||||
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
||||||
|
onFileTagChanged={this.props.onFileTagChanged}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<DirentListView
|
<DirentListView
|
||||||
|
@@ -16,6 +16,7 @@ const propTypes = {
|
|||||||
readmeMarkdown: PropTypes.object,
|
readmeMarkdown: PropTypes.object,
|
||||||
draftCounts: PropTypes.number,
|
draftCounts: PropTypes.number,
|
||||||
updateUsedRepoTags: PropTypes.func.isRequired,
|
updateUsedRepoTags: PropTypes.func.isRequired,
|
||||||
|
onFileTagChanged: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class RepoInfoBar extends React.Component {
|
class RepoInfoBar extends React.Component {
|
||||||
@@ -107,6 +108,7 @@ class RepoInfoBar extends React.Component {
|
|||||||
onClose={this.onCloseDialog}
|
onClose={this.onCloseDialog}
|
||||||
toggleCancel={this.onListTaggedFiles}
|
toggleCancel={this.onListTaggedFiles}
|
||||||
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
||||||
|
onFileTagChanged={this.props.onFileTagChanged}
|
||||||
/>
|
/>
|
||||||
</ModalPortal>
|
</ModalPortal>
|
||||||
)}
|
)}
|
||||||
|
Reference in New Issue
Block a user