1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 11:21:29 +00:00

['tag edit'] fixup for 'tag edit' in 'dir view - file details panel' & 'markdown file view - info panel' (#5962)

This commit is contained in:
llj
2024-02-23 16:23:35 +08:00
committed by GitHub
parent 9ff9a5610a
commit b8fe8ef0a2
5 changed files with 47 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ import ConfirmApplyFolderPropertiesDialog from '../dialog/confirm-apply-folder-p
const propTypes = {
repoInfo: PropTypes.object.isRequired,
repoID: PropTypes.string.isRequired,
repoTags: PropTypes.array.isRequired,
dirent: PropTypes.object.isRequired,
direntType: PropTypes.string.isRequired,
direntDetail: PropTypes.object.isRequired,
@@ -150,6 +151,7 @@ class DetailListView extends React.Component {
{this.state.isEditFileTagShow &&
<EditFileTagPopover
repoID={this.props.repoID}
repoTags={this.props.repoTags}
filePath={direntPath}
fileTagList={fileTagList}
toggleCancel={this.onEditFileTagToggle}

View File

@@ -17,6 +17,7 @@ const propTypes = {
onItemDetailsClose: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func.isRequired,
direntDetailPanelTab: PropTypes.string,
repoTags: PropTypes.array,
fileTags: PropTypes.array,
};
@@ -119,6 +120,7 @@ class DirentDetail extends React.Component {
dirent={this.props.dirent || folderDirent}
direntType={this.state.direntType}
direntDetail={this.state.direntDetail}
repoTags={this.props.repoTags}
fileTagList={dirent ? dirent.file_tags : fileTags}
onFileTagChanged={this.props.onFileTagChanged}
/>

View File

@@ -37,8 +37,8 @@ class EditFileTagPopover extends React.Component {
let color = this.generateRandomColor();
let repoID = this.props.repoID;
seafileAPI.createRepoTag(repoID, name, color).then((res) => {
let repoTagID = res.data.repo_tag.repo_tag_id;
this.onRepoTagCreated(repoTagID);
const { repo_tag: newTag } = res.data;
this.onRepoTagCreated(newTag);
this.setState({
searchVal: '',
highlightIndex: -1,
@@ -49,10 +49,14 @@ class EditFileTagPopover extends React.Component {
});
};
onRepoTagCreated = (repoTagID) => {
let {repoID, filePath} = this.props;
onRepoTagCreated = (newTag) => {
const { repoID, filePath } = this.props;
const { repo_tag_id: repoTagID } = newTag;
seafileAPI.addFileTag(repoID, filePath, repoTagID).then(() => {
this.props.onFileTagChanged();
if (this.props.onNewRepoTagAdded) {
this.props.onNewRepoTagAdded(newTag);
}
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
@@ -196,6 +200,7 @@ EditFileTagPopover.propTypes = {
repoTags: PropTypes.array.isRequired,
toggleCancel: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func.isRequired,
onNewRepoTagAdded: PropTypes.func
};
export default EditFileTagPopover;