use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel in project irida by phac-nml.
the class AnnouncementsController method getAnnouncementsAdmin.
/**
* Get all announcements to be displayed in a DataTables for admin control centre
*
* @param params
* {@link DataTablesParams} for the current DataTable.
*
* @return {@link DataTablesResponse}
*/
@RequestMapping(value = "/control/ajax/list")
@PreAuthorize("hasRole('ROLE_ADMIN')")
@ResponseBody
public DataTablesResponse getAnnouncementsAdmin(@DataTablesRequest DataTablesParams params) {
final Page<Announcement> page = announcementService.search(AnnouncementSpecification.searchAnnouncement(params.getSearchValue()), new PageRequest(params.getCurrentPage(), params.getLength(), params.getSort()));
final List<DataTablesResponseModel> announcements = page.getContent().stream().map(DTAnnouncementAdmin::new).collect(Collectors.toList());
return new DataTablesResponse(params, page, announcements);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel in project irida by phac-nml.
the class GroupsController method getGroupUsers.
/**
* List the members in the group.
*
* @param params
* the datatables parameters to search for.
* @param userGroupId
* the group ID to get members for.
* @return the datatables-formatted response with filtered users.
*/
@RequestMapping("/{userGroupId}/ajax/list")
@ResponseBody
public DataTablesResponse getGroupUsers(@DataTablesRequest DataTablesParams params, @PathVariable Long userGroupId) {
final UserGroup group = userGroupService.read(userGroupId);
final Page<UserGroupJoin> page = userGroupService.filterUsersByUsername(params.getSearchValue(), group, params.getCurrentPage(), params.getLength(), params.getSort());
List<DataTablesResponseModel> members = page.getContent().stream().map(DTGroupMember::new).collect(Collectors.toList());
return new DataTablesResponse(params, page, members);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel in project irida by phac-nml.
the class UsersController method getAjaxUserList.
/**
* Get a list of users based on search criteria.
* @param params {@link DataTablesParams} for the current Users DataTables.
* @param locale {@link Locale}
* @return {@link DataTablesResponse} of the filtered users list.
*/
@RequestMapping(value = "/ajax/list", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public DataTablesResponse getAjaxUserList(@DataTablesRequest DataTablesParams params, Locale locale) {
Page<User> userPage = userService.search(UserSpecification.searchUser(params.getSearchValue()), new PageRequest(params.getCurrentPage(), params.getLength(), params.getSort()));
List<DataTablesResponseModel> usersData = new ArrayList<>();
for (User user : userPage) {
// getting internationalized system role from the message source
String roleMessageName = "systemrole." + user.getSystemRole().getName();
String systemRole = messageSource.getMessage(roleMessageName, null, locale);
usersData.add(new DTUser(user.getId(), user.getUsername(), user.getFirstName(), user.getLastName(), user.getEmail(), systemRole, user.getCreatedDate(), user.getModifiedDate(), user.getLastLogin()));
}
return new DataTablesResponse(params, userPage, usersData);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel in project irida by phac-nml.
the class ProjectExportController method getExportsForProject.
/**
* Ajax method for getting the {@link NcbiExportSubmission}s for a given
* {@link Project}
*
* @param projectId {@link Project} id
* @param params Parameters from the datatables request
* @return DatatablesResponse of Map of submission params
*/
@RequestMapping("/ajax/projects/{projectId}/export/list")
@ResponseBody
public DataTablesResponse getExportsForProject(@DataTablesRequest DataTablesParams params, @PathVariable Long projectId) {
Project project = projectService.read(projectId);
List<NcbiExportSubmission> submissions = exportSubmissionService.getSubmissionsForProject(project);
List<DataTablesResponseModel> dtExportSubmissions = submissions.stream().map(s -> new DTExportSubmission(s)).collect(Collectors.toList());
return new DataTablesResponse(params, submissions.size(), dtExportSubmissions);
}
use of ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel in project irida by phac-nml.
the class ProjectMembersController method getProjectUserMembers.
/**
* Get a page of users on the project for display in a DataTable.
*
* @param params
* the datatables parameters for this DataTable
* @param projectId
* the id of the project we're looking at
* @return a {@link DataTablesResponseModel} of users on the project
*/
@RequestMapping(value = "/{projectId}/settings/ajax/members")
@ResponseBody
public DataTablesResponse getProjectUserMembers(@DataTablesRequest DataTablesParams params, @PathVariable final Long projectId) {
final Project project = projectService.read(projectId);
final Page<Join<Project, User>> usersForProject = userService.searchUsersForProject(project, params.getSearchValue(), params.getCurrentPage(), params.getLength(), params.getSort());
List<DataTablesResponseModel> modelList = new ArrayList<>();
for (Join<Project, User> join : usersForProject) {
modelList.add(new DTProjectMember((ProjectUserJoin) join));
}
return new DataTablesResponse(params, usersForProject, modelList);
}
Aggregations