Skip to content

Commit

Permalink
remove adjacent excess Divider (#5680)
Browse files Browse the repository at this point in the history
* remove adjacent excess 'Divider'

* fix upload file tags may cover previous tags
  • Loading branch information
Michael18811380328 authored Oct 11, 2023
1 parent 7c6e2bf commit d4445fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/popover/list-tag-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export default class ListTagPopover extends React.Component {
});
};

updateTags = (repotagList) => {
this.setState({ repotagList });
updateTags = (newRepotagList) => {
this.setState({
repotagList: [...this.state.repotagList, ...newRepotagList],
});
};

onDeleteTag = (tag) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/models/repo-tag.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class RepoTag {
constructor(object) {
this.id = object.repo_tag_id;
this.fileCount = object.files_count;
this.fileCount = object.files_count || 0;
this.name = object.tag_name;
this.color = object.tag_color;
}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,15 @@ export const Utils = {
if (list[list.length - 1] === 'Divider') {
list.pop();
}

// Remove adjacent excess 'Divider'
for (let i = 0; i < list.length; i++) {
if (list[i] === 'Divider' && list[i + 1] === 'Divider') {
list.splice(i, 1);
i--;
}
}

return list;
},

Expand Down

0 comments on commit d4445fa

Please sign in to comment.