diff --git a/gms-ui/src/components/GroupsBreadcrumb.vue b/gms-ui/src/components/GroupsBreadcrumb.vue index faefa3a0e1977201eec8d16aa9a4e74e158d1994..f8da78ef1b764e2e1c2cf73d5ac2e1c44b34a736 100644 --- a/gms-ui/src/components/GroupsBreadcrumb.vue +++ b/gms-ui/src/components/GroupsBreadcrumb.vue @@ -20,7 +20,6 @@ <script> import { mapState } from 'vuex'; -import client from 'api-client'; function buildItems(values) { let groups = []; @@ -50,16 +49,7 @@ export default { }), methods: { changeBreadcrumb: function(groupId) { - this.input.selectedGroupId = groupId; - this.input.searchFilter = null; - if (this.input.tabIndex === 0) { - client.fetchGroupsTab(this.input) - .then(model => { - this.$store.commit('updateGroups', model); - }); - } else { - this.$store.dispatch('changeTab', 0); - } + this.$store.dispatch('changeBreadcrumb', groupId); }, openEditGroupModal: function(group) { group.leaf = this.model.leaf; diff --git a/gms-ui/src/components/TopMenu.vue b/gms-ui/src/components/TopMenu.vue index 71ad85afc939d2012a46b51e272da1884e1c221c..c689fdb034ee9f7187312f3ae8dffa530dd36139 100644 --- a/gms-ui/src/components/TopMenu.vue +++ b/gms-ui/src/components/TopMenu.vue @@ -36,7 +36,11 @@ export default { }), methods: { showMainPage() { - this.$router.push('/', () => {}); + if (this.$router.currentRoute.path === '/') { + this.$store.dispatch('changeBreadcrumb', 'ROOT'); + } else { + this.$router.push('/', () => {}); + } }, genericSearch() { this.$router.push({ path: '/search', query: { q: this.input.genericSearch.filter } }, () => {}); diff --git a/gms-ui/src/store.js b/gms-ui/src/store.js index 9d8ffa828db3dde6d36cae49dfe779466b2e2e6c..2f5ce009da62cb641c60e1722538059531fec89a 100644 --- a/gms-ui/src/store.js +++ b/gms-ui/src/store.js @@ -148,6 +148,18 @@ export default new Vuex.Store({ break; } }, + changeBreadcrumb({ state, commit, dispatch }, groupId) { + state.input.selectedGroupId = groupId; + state.input.searchFilter = null; + if (state.input.tabIndex === 0) { + client.fetchGroupsTab(state.input) + .then(model => { + commit('updateGroups', model); + }); + } else { + dispatch('changeTab', 0); + } + }, updateCurrentGroup({ dispatch, state }, data) { state.model.breadcrumbs[state.model.breadcrumbs.length - 1].groupName = data.newGroupName; state.model.leaf = data.leaf;