Commit f29db93f authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Handled is leaf field also in UI

parent d66e51ab
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -28,5 +28,6 @@
    "hasPreviousPages": false,
    "hasFollowingPages": false
  },
  "permission": "ADMIN"
  "permission": "ADMIN",
  "leaf": false
}
+6 −4
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ const BASE_API_URL = process.env.VUE_APP_API_BASE_URL;

function apiRequest(url, options) {
  loading(true);
  return new Promise((resolve, reject) => {
  return new Promise((resolve) => {
    fetch(url, options)
      .then(response => {
        loading(false);
@@ -123,7 +123,7 @@ export default {
      }
    });
  },
  addGroup(newGroupName, input) {
  addGroup(newGroupName, leaf, input) {
    let url = BASE_API_URL + 'group';
    return apiRequest(url, {
      method: 'POST',
@@ -138,11 +138,12 @@ export default {
        parentGroupId: input.selectedGroupId,
        paginatorPageSize: input.paginatorPageSize,
        paginatorPage: input.paginatorPage,
        searchFilter: input.searchFilter
        searchFilter: input.searchFilter,
        leaf: leaf
      })
    });
  },
  renameGroup(groupId, newGroupName, input) {
  renameGroup(groupId, newGroupName, leaf, input) {
    let url = BASE_API_URL + 'group/' + groupId;
    return apiRequest(url, {
      method: 'PUT',
@@ -154,6 +155,7 @@ export default {
      },
      body: JSON.stringify({
        newGroupName: newGroupName,
        leaf: leaf,
        paginatorPageSize: input.paginatorPageSize,
        paginatorPage: input.paginatorPage,
        searchFilter: input.searchFilter
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ export default {
    changeBreadcrumb: function(groupId) {
      this.input.selectedGroupId = groupId;
      this.input.searchFilter = null;
      if (this.input.selectedTab === 'groups') {
      if (this.input.tabIndex === 0) {
        client.fetchGroupsTab(this.input)
          .then(model => {
            this.$store.commit('updateGroups', model);
+1 −1
Original line number Diff line number Diff line
<template>
<b-tab title="Groups" active>
<b-tab title="Groups" :title-link-class="{ 'd-none': model.leaf }">
  <b-row>
    <b-col xs="12">
      <b-form-input placeholder="Search group" v-model="input.searchFilter" v-on:input="filterGroups"></b-form-input>
+16 −31
Original line number Diff line number Diff line
@@ -47,48 +47,33 @@ export default {
  computed: mapState({
    model: state => state.model,
    input: state => state.input,
    showAddMemberBtn: state => state.model.permission === 'ADMIN' && state.input.selectedTab === 'members',
    showAddCollaboratorBtn: state => state.model.permission === 'MANAGE_MEMBERS' && state.input.selectedTab === 'members',
    showAddGroupBtn: state => state.model.permission === 'ADMIN' && state.input.selectedTab === 'groups',
    showAddPermissionBtn: state => state.model.permission === 'ADMIN' && state.input.selectedTab === 'permissions'
    showAddMemberBtn: state => state.model.permission === 'ADMIN' && state.input.tabIndex === 1,
    showAddCollaboratorBtn: state => state.model.permission === 'MANAGE_MEMBERS' && state.input.tabIndex === 1,
    showAddGroupBtn: state => state.model.permission === 'ADMIN' && state.input.tabIndex === 0,
    showAddPermissionBtn: state => state.model.permission === 'ADMIN' && state.input.tabIndex === 2
  }),
  methods: {
    tabChanged: function(tabIndex) {
      let tab;
      switch (tabIndex) {
        case 0:
          tab = 'groups';
          break;
        case 1:
          tab = 'members';
          break;
        case 2:
          tab = 'permissions';
          break;
      }
      if (this.input.selectedTab !== tab) {
        this.input.selectedTab = tab;
        switch (this.input.selectedTab) {
          case 'groups':
          client.fetchGroupsTab(this.input)
            .then(model => {
              this.$store.commit('updateGroups', model);
            });
          break;
          case 'members':
        case 1:
          client.fetchMembersPanel(this.input)
            .then(panel => {
              this.$store.commit('updateMembersPanel', panel);
            });
          break;
          case 'permissions':
        case 2:
          client.fetchPermissionsPanel(this.input)
            .then(panel => {
              this.$store.commit('updatePermissionsPanel', panel);
            });
          break;
      }
      }
    },
    openAddGroupModal: function() {
      this.$bvModal.show('add-group-modal');
Loading