Skip to content
Snippets Groups Projects
Commit 20b474a3 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Improved show main page functionality

parent 10812270
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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 } }, () => {});
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment