Skip to content

Commit

Permalink
Merge pull request #393 from mboudet/fix_392
Browse files Browse the repository at this point in the history
Fix 392
  • Loading branch information
mboudet committed Mar 20, 2023
2 parents 56dbaf9 + 3da5c69 commit 6b405b0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@ This changelog was started for release 4.2.0.
- Fixed logs for production setup
- Fixed profile update & password reset tab in user profile page
- Fixed Gff Faldo integration (was only integrating the last selected entity)
- Fixed an issue when using filters and an 'UNION' node

### Changed

Expand Down
54 changes: 44 additions & 10 deletions askomics/react/src/routes/query/query.jsx
Expand Up @@ -112,14 +112,32 @@ export default class Query extends Component {
return this.specialNodeIdNumber
}

getLargestSpecialNodeGroupId (node) {
getLargestSpecialNodeGroupId (node, preRender=false) {
let listIds = new Set()
let remote

this.graphState.links.map(link => {
if (link.source.id == node.id) {
listIds.add(link.target.specialNodeGroupId)
}
if (link.target.id == node.id) {
listIds.add(link.source.specialNodeGroupId)
if (preRender) {
// Ugly, but before rendering source and target are IDs and not objects
if (link.source == node.id) {
remote = this.state.nodes.some(rem => {
return (link.source == rem.id )
})
listIds.add(remote.specialNodeGroupId)
}
if (link.target == node.id) {
remote = this.state.nodes.some(rem => {
return (link.target == rem.id )
})
listIds.add(remote.specialNodeGroupId)
}
} else {
if (link.source.id == node.id) {
listIds.add(link.target.specialNodeGroupId)
}
if (link.target.id == node.id) {
listIds.add(link.source.specialNodeGroupId)
}
}
})
return Math.max(...listIds)
Expand Down Expand Up @@ -1016,7 +1034,11 @@ export default class Query extends Component {
})
// Reset suggestion
this.removeAllSuggestion()
this.insertSuggestion(this.currentSelected)
if (this.currentSelected.type == "unionNode") {
this.insertSuggestion(this.currentSelected, this.getLargestSpecialNodeGroupId(this.currentSelected) + 1)
} else {
this.insertSuggestion(this.currentSelected)
}
this.updateGraphState()
}

Expand All @@ -1031,7 +1053,11 @@ export default class Query extends Component {
})
// Reset suggestion
this.removeAllSuggestion()
this.insertSuggestion(this.currentSelected)
if (this.currentSelected.type == "unionNode") {
this.insertSuggestion(this.currentSelected, this.getLargestSpecialNodeGroupId(this.currentSelected) + 1)
} else {
this.insertSuggestion(this.currentSelected)
}
this.updateGraphState()
}

Expand All @@ -1042,7 +1068,11 @@ export default class Query extends Component {
this.showFaldo = !this.showFaldo
// Reset suggestion
this.removeAllSuggestion()
this.insertSuggestion(this.currentSelected)
if (this.currentSelected.type == "unionNode") {
this.insertSuggestion(this.currentSelected, this.getLargestSpecialNodeGroupId(this.currentSelected) + 1)
} else {
this.insertSuggestion(this.currentSelected)
}
this.updateGraphState()
}

Expand Down Expand Up @@ -1468,7 +1498,11 @@ export default class Query extends Component {
this.setCurrentSelected()
if (this.currentSelected) {
if (this.currentSelected.type != "link") {
this.insertSuggestion(this.currentSelected)
if (this.currentSelected.type == "unionNode") {
this.insertSuggestion(this.currentSelected, this.getLargestSpecialNodeGroupId(this.currentSelected) + 1, true)
} else {
this.insertSuggestion(this.currentSelected)
}
}
}
this.updateGraphState()
Expand Down

0 comments on commit 6b405b0

Please sign in to comment.