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

Fixed search FE issue + updated mock data and minor improvements

parent 4644ba3a
No related branches found
No related tags found
No related merge requests found
{ {
"groups": [{ "groups": [{
"id": "744e38e8f6d04e4e9418ae5f131c9b6b", "groupId": "f747bb7af22b4b2f85abef8a3e54dcc7",
"name": "LBT", "groupCompleteName": ["LBT", "INAF", "P1"]
"path": "744e38e8f6d04e4e9418ae5f131c9b6b"
}], }],
"permissions": [{ "permissions": [{
"userId": "4", "groupId": "ROOT",
"groupId": "744e38e8f6d04e4e9418ae5f131c9b6b", "groupCompleteName": ["Root"],
"permission": "VIEW_MEMBERS", "permission": "ADMIN"
"groupPath": "744e38e8f6d04e4e9418ae5f131c9b6b"
}] }]
} }
{ {
"items": [{ "items": [{
"id": "4",
"type": "USER", "type": "USER",
"label": "Name Surname" "label": "Sonia Zorba (Google)",
}, "id": "4"
{ }, {
"id": "group_id",
"type": "GROUP", "type": "GROUP",
"label": "Group 1" "label": "TNG / test2",
} "id": "64f6795862944325b093c974b768dd39"
], }, {
"type": "GROUP",
"label": "test",
"id": "024fb0999cac4e74a4e4ee2af4d3800c"
}],
"currentPage": 1, "currentPage": 1,
"links": [1], "links": [1],
"totalItems": 2, "totalItems": 3,
"pageSize": 20, "pageSize": 20,
"totalPages": 1, "totalPages": 1,
"hasPreviousPages": false, "hasPreviousPages": false,
......
...@@ -50,12 +50,12 @@ export default new Vuex.Store({ ...@@ -50,12 +50,12 @@ export default new Vuex.Store({
openGroup(state, groupId) { openGroup(state, groupId) {
let input = this.state.input; let input = this.state.input;
input.selectedGroupId = groupId; input.selectedGroupId = groupId;
input.searchFilter = null; input.searchFilter = '';
client.fetchGroupsTab(input) client.fetchGroupsTab(input)
.then(model => { .then(model => {
this.commit('updateGroups', model);
if (model.groupsPanel.items.length > 0) { if (model.groupsPanel.items.length > 0) {
this.commit('setTabIndex', 0); this.commit('setTabIndex', 0);
this.commit('updateGroups', model);
} else { } else {
// If there are no subgroups show the members panel // If there are no subgroups show the members panel
this.commit('setTabIndex', 1); this.commit('setTabIndex', 1);
......
...@@ -109,8 +109,14 @@ public class SearchService { ...@@ -109,8 +109,14 @@ public class SearchService {
List<PermissionEntity> actorPermissions = permissionsDAO.findUserPermissions(actorUserId); List<PermissionEntity> actorPermissions = permissionsDAO.findUserPermissions(actorUserId);
UserSearchResponse response = new UserSearchResponse(); 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; return response;
} }
...@@ -167,4 +173,12 @@ public class SearchService { ...@@ -167,4 +173,12 @@ public class SearchService {
return permissions; 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);
});
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment