diff --git a/app/javascript/packs/vue/navigation/navigator.js b/app/javascript/packs/vue/navigation/navigator.js index 3b3c7afad..35f4a4933 100644 --- a/app/javascript/packs/vue/navigation/navigator.js +++ b/app/javascript/packs/vue/navigation/navigator.js @@ -8,7 +8,8 @@ function addNavigationNavigatorContainer() { data() { return { reloadCurrentLevel: false, - reloadChildrenLevel: false + reloadChildrenLevel: false, + reloadExpandedChildrenLevel: false } }, created() { @@ -25,6 +26,14 @@ function addNavigationNavigatorContainer() { // refresh action toolbar width on navigator toggle, take into account transition time of .4s if (window.actionToolbarComponent) setTimeout(window.actionToolbarComponent.setWidth, 401); + }, + reloadNavigator(withExpandedChildren = false) { + this.reloadCurrentLevel = true; + if (withExpandedChildren) { + this.reloadExpandedChildrenLevel = true; + } else { + this.reloadChildrenLevel = true; + } } }, watch: { @@ -41,6 +50,13 @@ function addNavigationNavigatorContainer() { this.reloadChildrenLevel = false; }); } + }, + reloadExpandedChildrenLevel() { + if (this.reloadExpandedChildrenLevel) { + this.$nextTick(() => { + this.reloadExpandedChildrenLevel = false; + }); + } } } }); diff --git a/app/javascript/vue/navigation/navigator.vue b/app/javascript/vue/navigation/navigator.vue index ffd96827a..81b78c258 100644 --- a/app/javascript/vue/navigation/navigator.vue +++ b/app/javascript/vue/navigation/navigator.vue @@ -30,6 +30,7 @@ :reloadCurrentLevel="reloadCurrentLevel" :paddingLeft="0" :reloadChildrenLevel="reloadChildrenLevel" + :reloadExpandedChildrenLevel="reloadExpandedChildrenLevel" :archived="archived" /> @@ -62,7 +63,8 @@ export default { }, props: { reloadCurrentLevel: Boolean, - reloadChildrenLevel: Boolean + reloadChildrenLevel: Boolean, + reloadExpandedChildrenLevel: Boolean }, computed: { sortedMenuItems() { diff --git a/app/javascript/vue/navigation/navigator_item.vue b/app/javascript/vue/navigation/navigator_item.vue index 7d31232d8..a38ab92fd 100644 --- a/app/javascript/vue/navigation/navigator_item.vue +++ b/app/javascript/vue/navigation/navigator_item.vue @@ -33,6 +33,7 @@ :paddingLeft="24 + paddingLeft" :reloadCurrentLevel="reloadCurrentLevel" :reloadChildrenLevel="reloadChildrenLevel" + :reloadExpandedChildrenLevel="reloadExpandedChildrenLevel" :item="item" :archived="archived" /> @@ -52,7 +53,8 @@ export default { archived: Boolean, paddingLeft: Number, reloadCurrentLevel: Boolean, - reloadChildrenLevel: Boolean + reloadChildrenLevel: Boolean, + reloadExpandedChildrenLevel: Boolean }, data() { return { @@ -112,6 +114,11 @@ export default { this.loadChildren(); } }, + reloadExpandedChildrenLevel() { + if (this.reloadExpandedChildrenLevel && this.childrenExpanded) { + this.loadChildren(); + } + }, reloadCurrentLevel() { if (this.reloadCurrentLevel && this.children.find((item) => item.id == this.currentItemId)) { this.loadChildren(); diff --git a/app/javascript/vue/projects/list.vue b/app/javascript/vue/projects/list.vue index 00ff46445..5728f0a0d 100644 --- a/app/javascript/vue/projects/list.vue +++ b/app/javascript/vue/projects/list.vue @@ -44,18 +44,18 @@ ref="exportModal" > + :project="editProject" @close="editProject = null" @update="updateTable(); updateNavigator()" /> + @close="editFolder = null" @update="updateTable(); updateNavigator()" /> + @close="newProject = false" @create="updateTable(); updateNavigator()" /> + @close="newFolder = false" @create="updateTable(); updateNavigator()" /> + @close="objectsToMove = null" @move="updateTable(); updateNavigator(true)" /> @@ -305,6 +305,9 @@ export default { this.objectsToMove = null; this.reloadingTable = true; }, + updateNavigator(withExpanedChildren = false) { + window.navigatorContainer.reloadNavigator(withExpanedChildren); + }, async deleteFolder(event, rows) { const description = `

${this.i18n.t('projects.index.modal_delete_folders.description_1_html', { number: rows.length })}

diff --git a/app/views/shared/navigation/_navigator.html.erb b/app/views/shared/navigation/_navigator.html.erb index 4931c39af..468a5d5c3 100644 --- a/app/views/shared/navigation/_navigator.html.erb +++ b/app/views/shared/navigation/_navigator.html.erb @@ -11,5 +11,6 @@ @navigator:colapse="toggleNavigatorState(true)" :reload-current-level="reloadCurrentLevel" :reload-children-level="reloadChildrenLevel" + :reload-expanded-children-level="reloadExpandedChildrenLevel" />