Merge pull request #5361 from aignatov-bio/ai-sci-8390-fix-navigator-update

Fix navigator update [SCI-8390]
This commit is contained in:
aignatov-bio 2023-05-04 14:23:48 +02:00 committed by GitHub
commit ef0cacfded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -148,6 +148,7 @@ function init() {
initializeGraph(".diagram .module-large");
initializeFullZoom();
}
window.navigatorContainer.reloadChildrenLevel = true;
}
jsPlumb.ready(function () {

View file

@ -119,6 +119,7 @@
function refreshCurrentView() {
loadCardsView();
window.navigatorContainer.reloadChildrenLevel = true;
}
function selectDate($field) {

View file

@ -44,12 +44,13 @@ export default {
data: function() {
return {
childrenExpanded: false,
childrenLoaded: false,
children: []
};
},
computed: {
hasChildren: function() {
return this.item.has_children;
return this.item.has_children || this.children.length > 0;
},
sortedMenuItems: function() {
return this.children.sort((a, b) => {
@ -93,6 +94,13 @@ export default {
if (this.reloadCurrentLevel && this.children.find((item) => item.id == this.currentItemId)) {
this.loadChildren();
}
},
children: function() {
if (this.children.length > 0) {
this.childrenExpanded = true;
} else if (this.childrenLoaded) {
this.item.has_children = false;
}
}
},
methods: {
@ -103,6 +111,7 @@ export default {
loadChildren: function() {
$.get(this.item.children_url, {archived: this.archived}, (data) => {
this.children = data.items;
this.childrenLoaded = true;
});
},
treeExpand: function() {