1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

create a tag and checked by default (#3226)

* create a tag and checked by default

* repair code
This commit is contained in:
王健辉
2019-04-09 15:28:41 +08:00
committed by Daniel Pan
parent f2c2b71636
commit a7ad92b908
2 changed files with 12 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import { seafileAPI } from '../../utils/seafile-api';
const propTypes = {
repoID: PropTypes.string.isRequired,
onRepoTagCreated: PropTypes.func,
toggleCancel: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired
};
@@ -38,7 +39,9 @@ class CreateTagDialog extends React.Component {
let name = this.state.tagName;
let color = this.state.tagColor;
let repoID = this.props.repoID;
seafileAPI.createRepoTag(repoID, name, color).then(() =>{
seafileAPI.createRepoTag(repoID, name, color).then((res) => {
let repoTagID = res.data.repo_tag.repo_tag_id;
this.props.onRepoTagCreated(repoTagID);
this.props.toggleCancel();
});
}

View File

@@ -182,6 +182,13 @@ class EditFileTagDialog extends React.Component {
});
}
onRepoTagCreated = (repoTagID) => {
let {repoID, filePath} = this.props;
seafileAPI.addFileTag(repoID, filePath, repoTagID).then(() => {
this.props.onFileTagChanged();
});
}
render() {
return (
<Modal isOpen={true} toggle={this.props.toggleCancel}>
@@ -200,6 +207,7 @@ class EditFileTagDialog extends React.Component {
repoID={this.props.repoID}
onClose={this.props.toggleCancel}
toggleCancel={this.createNewTag}
onRepoTagCreated={this.onRepoTagCreated}
/>
}
</Modal>