Commit 18d45bca authored by Sonia Zorba's avatar Sonia Zorba
Browse files

UI improvements; Added logout

parent 359bf2b9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
VUE_APP_API_CLIENT = 'server'
VUE_APP_API_CLIENT = 'server'
VUE_APP_API_BASE_URL = '/'
VUE_APP_API_BASE_URL = ''
+6 −1
Original line number Original line Diff line number Diff line
@@ -61,7 +61,12 @@ export default {
      this.$store.state.input.searchFilter = null;
      this.$store.state.input.searchFilter = null;
      client.fetchGroupsTab(this.input)
      client.fetchGroupsTab(this.input)
        .then(model => {
        .then(model => {
          if (model.groupsPanel.items.length > 0) {
            this.$store.commit('updateGroups', model);
            this.$store.commit('updateGroups', model);
          } else {
            // If there are no subgroups show the members panel
            this.$store.commit('setTabIndex', '1');
          }
        });
        });
    },
    },
    openRenameGroupModal: function(group) {
    openRenameGroupModal: function(group) {
+11 −4
Original line number Original line Diff line number Diff line
@@ -9,14 +9,14 @@


      <!-- Right aligned nav items -->
      <!-- Right aligned nav items -->
      <b-navbar-nav class="ml-auto">
      <b-navbar-nav class="ml-auto">
        <!--
        <b-nav-form>
        <b-nav-form>
          <b-form-input size="sm" class="mr-sm-2" placeholder="Search"></b-form-input>
          <b-form-input size="sm" class="mr-sm-2" placeholder="Search"></b-form-input>
          <b-button size="sm" class="my-2 my-sm-0" type="submit">Search</b-button>
          <b-button size="sm" class="my-2 my-sm-0" type="submit">Search</b-button>
        </b-nav-form>
        </b-nav-form>

        -->
        <b-nav-item-dropdown right v-if="user">
        <b-nav-item-dropdown :text="user" right v-if="user">
          <template slot="button-content"><em>{{user}}</em></template>
          <b-dropdown-item href="logout">Logout</b-dropdown-item>
          <b-dropdown-item href="#">Preferences</b-dropdown-item>
        </b-nav-item-dropdown>
        </b-nav-item-dropdown>
      </b-navbar-nav>
      </b-navbar-nav>
    </b-collapse>
    </b-collapse>
@@ -32,3 +32,10 @@ export default {
  }
  }
}
}
</script>
</script>

<style>
.navbar-dark .nav-link {
  color: rgba(255, 255, 255, .7);
  font-weight: bold;
}
</style>
+15 −14
Original line number Original line Diff line number Diff line
<template>
<template>
<b-modal id="add-group-modal" title="Add group" @show="resetModal" ok-title="Add" @ok="addGroup">
<b-modal id="add-group-modal" title="Add group" @show="resetModal" @shown="afterShow" ok-title="Add" @ok="addGroup">
  <b-form inline>
  <b-form inline>
    <label class="w-25" for="new-group-name-input">Group name:</label>
    <label class="w-25" for="new-group-name-input">Group name:</label>
    <b-form-input v-model="newGroupName" id="new-group-name-input" class="w-75" aria-describedby="new-group-name-input-feedback" :state="newGroupNameState" v-on:input="resetError">
    <b-form-input v-model="newGroupName" id="new-group-name-input" ref="newGroupNameInput" class="w-75" aria-describedby="new-group-name-input-feedback" :state="newGroupNameState" v-on:input="resetError" @keydown.native.enter="addGroup">
    </b-form-input>
    </b-form-input>
    <b-form-invalid-feedback id="new-group-name-input-feedback">{{newGroupNameError}}</b-form-invalid-feedback>
    <b-form-invalid-feedback id="new-group-name-input-feedback">{{newGroupNameError}}</b-form-invalid-feedback>
  </b-form>
  </b-form>
@@ -32,6 +32,9 @@ export default {
      this.newGroupName = null;
      this.newGroupName = null;
      this.resetError();
      this.resetError();
    },
    },
    afterShow: function() {
      this.$refs.newGroupNameInput.focus();
    },
    resetError: function() {
    resetError: function() {
      this.newGroupNameError = null;
      this.newGroupNameError = null;
    },
    },
@@ -41,10 +44,7 @@ export default {


      if (!this.newGroupName) {
      if (!this.newGroupName) {
        this.newGroupNameError = "Group name is required";
        this.newGroupNameError = "Group name is required";
        return;
      } else {
      }

      let parent = this.$store.getters.selectedGroupId;
        client.addGroup(this.newGroupName, this.$store.state.input)
        client.addGroup(this.newGroupName, this.$store.state.input)
          .then(res => {
          .then(res => {
            if (res.status === 400) {
            if (res.status === 400) {
@@ -57,4 +57,5 @@ export default {
      }
      }
    }
    }
  }
  }
}
</script>
</script>
+12 −3
Original line number Original line Diff line number Diff line
<template>
<template>
<b-modal id="add-member-modal" title="Add member" ok-title="Add" @ok="addMember">
<b-modal id="add-member-modal" title="Add member" ok-title="Add" @shown="afterShow" @ok="addMember">
  <SearchUser ref="searchUser" />
  <SearchUser ref="searchUser" @searchUserEnter="addMember" />
</b-modal>
</b-modal>
</template>
</template>


@@ -17,13 +17,22 @@ export default {
    SearchUser
    SearchUser
  },
  },
  methods: {
  methods: {
    afterShow: function() {
      this.$refs.searchUser.$refs.userInput.focus();
    },
    addMember: function(event) {
    addMember: function(event) {
      // Prevent modal from closing
      // Prevent modal from closing
      if (event) {
        event.preventDefault();
        event.preventDefault();
      }


      let userId = this.$refs.searchUser.selectedUser;
      let userId = this.$refs.searchUser.selectedUser;
      let permission = this.$refs.searchUser.permission;
      let permission = this.$refs.searchUser.permission;


      if (!userId || !permission) {
        return;
      }

      client.addMember(userId, permission, this.$store.state.input)
      client.addMember(userId, permission, this.$store.state.input)
        .then(res => {
        .then(res => {
          this.$store.commit('updateMembersPanel', res);
          this.$store.commit('updateMembersPanel', res);
Loading