Commit 20b474a3 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Improved show main page functionality

parent 10812270
Loading
Loading
Loading
Loading
+1 −11
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@


<script>
<script>
import { mapState } from 'vuex';
import { mapState } from 'vuex';
import client from 'api-client';


function buildItems(values) {
function buildItems(values) {
  let groups = [];
  let groups = [];
@@ -50,16 +49,7 @@ export default {
  }),
  }),
  methods: {
  methods: {
    changeBreadcrumb: function(groupId) {
    changeBreadcrumb: function(groupId) {
      this.input.selectedGroupId = groupId;
      this.$store.dispatch('changeBreadcrumb', 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);
      }
    },
    },
    openEditGroupModal: function(group) {
    openEditGroupModal: function(group) {
      group.leaf = this.model.leaf;
      group.leaf = this.model.leaf;
+5 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,11 @@ export default {
  }),
  }),
  methods: {
  methods: {
    showMainPage() {
    showMainPage() {
      if (this.$router.currentRoute.path === '/') {
        this.$store.dispatch('changeBreadcrumb', 'ROOT');
      } else {
        this.$router.push('/', () => {});
        this.$router.push('/', () => {});
      }
    },
    },
    genericSearch() {
    genericSearch() {
      this.$router.push({ path: '/search', query: { q: this.input.genericSearch.filter } }, () => {});
      this.$router.push({ path: '/search', query: { q: this.input.genericSearch.filter } }, () => {});
+12 −0
Original line number Original line Diff line number Diff line
@@ -148,6 +148,18 @@ export default new Vuex.Store({
          break;
          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) {
    updateCurrentGroup({ dispatch, state }, data) {
      state.model.breadcrumbs[state.model.breadcrumbs.length - 1].groupName = data.newGroupName;
      state.model.breadcrumbs[state.model.breadcrumbs.length - 1].groupName = data.newGroupName;
      state.model.leaf = data.leaf;
      state.model.leaf = data.leaf;