Commit 640aca6c authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed search FE issue + updated mock data and minor improvements

parent 4644ba3a
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
{
  "groups": [{
    "id": "744e38e8f6d04e4e9418ae5f131c9b6b",
    "name": "LBT",
    "path": "744e38e8f6d04e4e9418ae5f131c9b6b"
    "groupId": "f747bb7af22b4b2f85abef8a3e54dcc7",
    "groupCompleteName": ["LBT", "INAF", "P1"]
  }],
  "permissions": [{
    "userId": "4",
    "groupId": "744e38e8f6d04e4e9418ae5f131c9b6b",
    "permission": "VIEW_MEMBERS",
    "groupPath": "744e38e8f6d04e4e9418ae5f131c9b6b"
    "groupId": "ROOT",
    "groupCompleteName": ["Root"],
    "permission": "ADMIN"
  }]
}
+13 −11
Original line number Diff line number Diff line
{
  "items": [{
      "id": "4",
    "type": "USER",
      "label": "Name Surname"
    },
    {
      "id": "group_id",
    "label": "Sonia Zorba (Google)",
    "id": "4"
  }, {
    "type": "GROUP",
      "label": "Group 1"
    }
  ],
    "label": "TNG / test2",
    "id": "64f6795862944325b093c974b768dd39"
  }, {
    "type": "GROUP",
    "label": "test",
    "id": "024fb0999cac4e74a4e4ee2af4d3800c"
  }],
  "currentPage": 1,
  "links": [1],
  "totalItems": 2,
  "totalItems": 3,
  "pageSize": 20,
  "totalPages": 1,
  "hasPreviousPages": false,
+2 −2
Original line number Diff line number Diff line
@@ -50,12 +50,12 @@ export default new Vuex.Store({
    openGroup(state, groupId) {
      let input = this.state.input;
      input.selectedGroupId = groupId;
      input.searchFilter = null;
      input.searchFilter = '';
      client.fetchGroupsTab(input)
        .then(model => {
          this.commit('updateGroups', model);
          if (model.groupsPanel.items.length > 0) {
            this.commit('setTabIndex', 0);
            this.commit('updateGroups', model);
          } else {
            // If there are no subgroups show the members panel
            this.commit('setTabIndex', 1);
+16 −2
Original line number Diff line number Diff line
@@ -109,8 +109,14 @@ public class SearchService {
        List<PermissionEntity> actorPermissions = permissionsDAO.findUserPermissions(actorUserId);

        UserSearchResponse response = new UserSearchResponse();
        response.setGroups(getUserGroups(targetUserId, actorPermissions));
        response.setPermissions(getUserPermission(targetUserId, actorPermissions));

        List<UserGroup> groups = getUserGroups(targetUserId, actorPermissions);
        sortByGroupCompleteName(groups);
        response.setGroups(groups);

        List<UserPermission> permissions = getUserPermission(targetUserId, actorPermissions);
        sortByGroupCompleteName(permissions);
        response.setPermissions(permissions);

        return response;
    }
@@ -167,4 +173,12 @@ public class SearchService {

        return permissions;
    }

    private void sortByGroupCompleteName(List<? extends UserGroup> items) {
        items.sort((i1, i2) -> {
            String completeName1 = String.join(" / ", i1.getGroupCompleteName());
            String completeName2 = String.join(" / ", i2.getGroupCompleteName());
            return completeName1.compareTo(completeName2);
        });
    }
}