Implemets Collaborators filter to Dataset and DMP listing. (Ticket #77)

This commit is contained in:
gkolokythas 2019-05-16 13:10:28 +03:00
parent 61afbb8848
commit 4a1b9984c7
18 changed files with 183 additions and 20 deletions

View File

@ -17,6 +17,7 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
private Integer status; private Integer status;
private List<String> organisations; private List<String> organisations;
private Integer role; private Integer role;
private List<UUID> collaborators;
public Date getPeriodStart() { public Date getPeriodStart() {
return periodStart; return periodStart;
@ -73,4 +74,11 @@ public class DataManagementPlanCriteria extends Criteria<DMP> {
public void setRole(Integer role) { public void setRole(Integer role) {
this.role = role; this.role = role;
} }
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
} }

View File

@ -19,6 +19,7 @@ public class DatasetCriteria extends Criteria<Dataset> {
private List<String> organisations; private List<String> organisations;
private Integer role; private Integer role;
private List<UUID> projects; private List<UUID> projects;
private List<UUID> collaborators;
public boolean getAllVersions() { public boolean getAllVersions() {
return allVersions; return allVersions;
@ -89,4 +90,11 @@ public class DatasetCriteria extends Criteria<Dataset> {
public void setProjects(List<UUID> projects) { public void setProjects(List<UUID> projects) {
this.projects = projects; this.projects = projects;
} }
public List<UUID> getCollaborators() {
return collaborators;
}
public void setCollaborators(List<UUID> collaborators) {
this.collaborators = collaborators;
}
} }

View File

@ -8,11 +8,11 @@ import java.util.List;
public class UserInfoCriteria extends Criteria<UserInfo> { public class UserInfoCriteria extends Criteria<UserInfo> {
private String email; private String email;
private List<Integer> appRoles; private List<Integer> appRoles;
private String collaboratorLike;
public List<Integer> getAppRoles() { public List<Integer> getAppRoles() {
return appRoles; return appRoles;
} }
public void setAppRoles(List<Integer> appRoles) { public void setAppRoles(List<Integer> appRoles) {
this.appRoles = appRoles; this.appRoles = appRoles;
} }
@ -20,8 +20,14 @@ public class UserInfoCriteria extends Criteria<UserInfo> {
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
public String getCollaboratorLike() {
return collaboratorLike;
}
public void setCollaboratorLike(String collaboratorLike) {
this.collaboratorLike = collaboratorLike;
}
} }

View File

@ -13,6 +13,7 @@ import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import schemasMicrosoftComOfficeOffice.LeftDocument;
import javax.persistence.criteria.JoinType; import javax.persistence.criteria.JoinType;
import java.util.Arrays; import java.util.Arrays;
@ -64,6 +65,9 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
if (criteria.getOrganisations() != null && !criteria.getOrganisations().isEmpty()) { if (criteria.getOrganisations() != null && !criteria.getOrganisations().isEmpty()) {
query.where((builder, root) -> root.join("organisations").get("reference").in(criteria.getOrganisations())); query.where((builder, root) -> root.join("organisations").get("reference").in(criteria.getOrganisations()));
} }
if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty()) {
query.where((builder, root) -> root.join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
}
query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue())); query.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()));
return query; return query;
} }

View File

@ -52,6 +52,9 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
if (criteria.getProjects() != null && !criteria.getProjects().isEmpty()) { if (criteria.getProjects() != null && !criteria.getProjects().isEmpty()) {
query.where((builder, root) -> root.join("dmp").join("project").get("id").in(criteria.getProjects())); query.where((builder, root) -> root.join("dmp").join("project").get("id").in(criteria.getProjects()));
} }
if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty()) {
query.where((builder, root) -> root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
}
query.where(((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()))); query.where(((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue())));
return query; return query;
} }

View File

@ -66,6 +66,13 @@ public class Users extends BaseController {
userManager.updateSettings(settings, principal); userManager.updateSettings(settings, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UserProfile>().status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UserProfile>().status(ApiMessageCode.NO_MESSAGE));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/getCollaboratorsPaged"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<UserListingModel>>> getCollaboratorsPaged(@Valid @RequestBody UserInfoTableRequestItem userInfoTableRequestItem, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
DataTableData<UserListingModel> dataTable = userManager.getCollaboratorsPaged(userInfoTableRequestItem, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<UserListingModel>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
}
} }

View File

@ -1,7 +1,11 @@
package eu.eudat.logic.managers; package eu.eudat.logic.managers;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.data.dao.entities.DMPDao;
import eu.eudat.data.dao.entities.UserInfoDao;
import eu.eudat.data.entities.DMP; import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.UserDMP;
import eu.eudat.data.entities.UserRole; import eu.eudat.data.entities.UserRole;
import eu.eudat.data.query.items.table.userinfo.UserInfoTableRequestItem; import eu.eudat.data.query.items.table.userinfo.UserInfoTableRequestItem;
import eu.eudat.exceptions.security.UnauthorisedException; import eu.eudat.exceptions.security.UnauthorisedException;
@ -15,6 +19,7 @@ import eu.eudat.models.data.dmp.DataManagementPlan;
import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.login.Credentials; import eu.eudat.models.data.login.Credentials;
import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.security.Principal;
import eu.eudat.models.data.userinfo.UserInfo;
import eu.eudat.models.data.userinfo.UserListingModel; import eu.eudat.models.data.userinfo.UserListingModel;
import eu.eudat.models.data.userinfo.UserProfile; import eu.eudat.models.data.userinfo.UserProfile;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
@ -25,10 +30,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
@ -93,4 +95,49 @@ public class UserManager {
if (principal == null) throw new UnauthorisedException("Could not Sign In User"); if (principal == null) throw new UnauthorisedException("Could not Sign In User");
return principal; return principal;
} }
public DataTableData<UserListingModel> getCollaboratorsPaged(UserInfoTableRequestItem userInfoTableRequestItem, Principal principal) throws Exception {
//UserInfoDao userInfoDao = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao();
DMPDao dmpDao = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao();
// Gets all the DMPs the user is associated.
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
QueryableList<DMP> dmpItmes = dmpDao.getWithCriteria(dataManagementPlanCriteria);
QueryableList<DMP> dmpAuthItems = dmpDao.getAuthenticated(dmpItmes, principal.getId());
List<DMP> dmpList = dmpAuthItems.toList();
// List to place the associated users.
List<UserListingModel> associatedUsersList = new LinkedList<>();
// Iterate through the DMP list and get the users associated.
for (DMP dmp : dmpList) {
for (UserDMP userDMP : dmp.getUsers()) {
if (userDMP.getUser().getId() != principal.getId()) {
associatedUsersList.add(new UserListingModel().fromDataModel(userDMP.getUser()));
}
}
}
// Remove duplicates from the associated users list.
associatedUsersList = associatedUsersList.stream().distinct().collect(Collectors.toList());
// Filter using the criteria.
List<UserListingModel> associatedUsersListFiltered = new LinkedList<>();
associatedUsersList.stream()
.filter(item -> item.getName().toLowerCase().contains(userInfoTableRequestItem.getCriteria().getCollaboratorLike().toLowerCase())).forEach(
o -> {
associatedUsersListFiltered.add(o);
}
);
/*QueryableList<eu.eudat.data.entities.UserInfo> users = userInfoDao.getWithCriteria(userInfoTableRequestItem.getCriteria()).withHint(HintedModelFactory.getHint(UserListingModel.class));
QueryableList<eu.eudat.data.entities.UserInfo> pagedUsers = PaginationManager.applyPaging(users, userInfoTableRequestItem);*/
//List<UserListingModel> modelUsers = pagedUsers.select(item -> new listing model().fromDataModel(item));
DataTableData<UserListingModel> dataTableData = new DataTableData<>();
dataTableData.setData(associatedUsersListFiltered);
dataTableData.setTotalCount((long)associatedUsersListFiltered.size());
return dataTableData;
}
} }

View File

@ -9,4 +9,5 @@ export class DatasetCriteria extends BaseCriteria {
public allVersions?: boolean; public allVersions?: boolean;
public role?: number; public role?: number;
public organisations?: string[] = []; public organisations?: string[] = [];
public collaborators?: string[] = [];
} }

View File

@ -9,4 +9,5 @@ export class DmpCriteria extends BaseCriteria {
public allVersions?: boolean; public allVersions?: boolean;
public status?: number; public status?: number;
public role?: number; public role?: number;
public collaborators?: string[] = [];
} }

View File

@ -4,4 +4,5 @@ import { BaseCriteria } from "../base-criteria";
export class UserCriteria extends BaseCriteria { export class UserCriteria extends BaseCriteria {
public label: String; public label: String;
public appRoles: AppRole[]; public appRoles: AppRole[];
public collaboratorLike: string;
} }

View File

@ -16,7 +16,7 @@ export class UserService {
constructor(private http: BaseHttpService) { constructor(private http: BaseHttpService) {
this.actionUrl = environment.Server + '/user/'; this.actionUrl = environment.Server + 'user/';
} }
getPaged(dataTableRequest: DataTableRequest<UserCriteria>): Observable<DataTableData<UserListingModel>> { getPaged(dataTableRequest: DataTableRequest<UserCriteria>): Observable<DataTableData<UserListingModel>> {
@ -42,4 +42,8 @@ export class UserService {
updateUserSettings(value: any): Observable<any[]> { updateUserSettings(value: any): Observable<any[]> {
return this.http.post<any[]>(this.actionUrl + 'settings', value, { headers: this.headers }); return this.http.post<any[]>(this.actionUrl + 'settings', value, { headers: this.headers });
} }
getCollaboratorsPaged(dataTableRequest: DataTableRequest<UserCriteria>): Observable<DataTableData<UserListingModel>> {
return this.http.post<DataTableData<UserListingModel>>(this.actionUrl + 'getCollaboratorsPaged', JSON.stringify(dataTableRequest), { headers: this.headers });
}
} }

View File

@ -49,6 +49,19 @@
</div> </div>
<!-- End of Related Projects Filters --> <!-- End of Related Projects Filters -->
<!-- Related Collaborators Filters -->
<div class="col-10 gray-container">
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-COLLABORATORS' | translate}}</h6>
<mat-form-field>
<app-multiple-auto-complete [formControl]="formGroup.get('collaborators')"
placeholder="{{'CRITERIA.DATA-SETS.SELECT-COLLABORATORS' | translate }}"
[configuration]="collaboratorsAutoCompleteConfiguration">
</app-multiple-auto-complete>
<mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon>
</mat-form-field>
</div>
<!-- End of Related Collaborators Filters -->
<!-- Role Filter --> <!-- Role Filter -->
<div class="col-10 gray-container"> <div class="col-10 gray-container">
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ROLE' | translate }}</h6> <h6 class="category-title">{{'CRITERIA.DATA-SETS.ROLE' | translate }}</h6>

View File

@ -30,6 +30,8 @@ import { OrganisationCriteria } from '../../../../core/query/organisation/organi
import { OrganisationService } from '../../../../core/services/organisation/organisation.service'; import { OrganisationService } from '../../../../core/services/organisation/organisation.service';
import { ProjectCriteria } from '../../../../core/query/project/project-criteria'; import { ProjectCriteria } from '../../../../core/query/project/project-criteria';
import { ProjectService } from '../../../../core/services/project/project.service'; import { ProjectService } from '../../../../core/services/project/project.service';
import { UserCriteria } from '../../../../core/query/user/user-criteria';
import { UserService } from '../../../../core/services/user/user.service';
@Component({ @Component({
selector: 'app-dataset-criteria-component', selector: 'app-dataset-criteria-component',
@ -52,7 +54,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
projects: new FormControl(), projects: new FormControl(),
status: new FormControl(), status: new FormControl(),
role: new FormControl(), role: new FormControl(),
organisations: new FormControl() organisations: new FormControl(),
collaborators: new FormControl(),
}); });
tagsAutoCompleteConfiguration = { tagsAutoCompleteConfiguration = {
@ -69,6 +72,13 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
titleFn: (item) => item['label'] titleFn: (item) => item['label']
}; };
collaboratorsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterCollaborators.bind(this),
initialItems: (excludedItems: any[]) => this.filterCollaborators('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['name'],
titleFn: (item) => item['name']
};
projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = { projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterProject.bind(this), filterFn: this.filterProject.bind(this),
initialItems: (excludedItems: any[]) => this.filterProject('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)), initialItems: (excludedItems: any[]) => this.filterProject('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
@ -95,6 +105,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
private language: TranslateService, private language: TranslateService,
public projectService: ProjectService, public projectService: ProjectService,
private organisationService: OrganisationService, private organisationService: OrganisationService,
private userService: UserService,
fb: FormBuilder fb: FormBuilder
) { ) {
super(new ValidationErrorModel()); super(new ValidationErrorModel());
@ -124,6 +135,10 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
this.formGroup.get('organisations').valueChanges this.formGroup.get('organisations').valueChanges
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified()); .subscribe(x => this.controlModified());
this.formGroup.get('collaborators').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
// if (this.criteria == null) { this.criteria = {}; } // if (this.criteria == null) { this.criteria = {}; }
} }
@ -131,8 +146,9 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
this.formGroup.get('like').patchValue(criteria.like); this.formGroup.get('like').patchValue(criteria.like);
this.formGroup.get('dmpIds').patchValue(criteria.dmpIds); this.formGroup.get('dmpIds').patchValue(criteria.dmpIds);
this.formGroup.get('projects').patchValue(criteria.projects); this.formGroup.get('projects').patchValue(criteria.projects);
this.formGroup.get('status').patchValue(criteria.like); this.formGroup.get('status').patchValue(criteria.status);
this.formGroup.get('role').patchValue(criteria.like); this.formGroup.get('role').patchValue(criteria.role);
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
// this.criteria = criteria; // this.criteria = criteria;
} }
@ -188,6 +204,15 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
return this.organisationService.searchInternalOrganisations(dataTableRequest).map(x => x.data); return this.organisationService.searchInternalOrganisations(dataTableRequest).map(x => x.data);
} }
filterCollaborators(query: string) {
const fields: Array<string> = new Array<string>();
fields.push('asc');
const collaboratorsRequestItem: DataTableRequest<UserCriteria> = new DataTableRequest(0, null, { fields: fields });
collaboratorsRequestItem.criteria = new UserCriteria();
collaboratorsRequestItem.criteria.collaboratorLike = query;
return this.userService.getCollaboratorsPaged(collaboratorsRequestItem).map(x => x.data);
}
fileImport(event) { fileImport(event) {
const dialogRef = this.dialog.open(DatasetUploadDialogue, { const dialogRef = this.dialog.open(DatasetUploadDialogue, {
data: { data: {

View File

@ -85,6 +85,9 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
allVersions: value.allVersions, allVersions: value.allVersions,
role: value.role role: value.role
} }
if (value.collaborators) {
request.criteria.collaborators = value.collaborators.map(x => x.id)
}
if (value.dmpIds) { if (value.dmpIds) {
request.criteria.dmpIds = value.dmpIds.map(x => x.id); request.criteria.dmpIds = value.dmpIds.map(x => x.id);
} }

View File

@ -38,13 +38,13 @@
<!-- Collaborators Filter --> <!-- Collaborators Filter -->
<div *ngIf="showProject" class="col-10 gray-container"> <div *ngIf="showProject" class="col-10 gray-container">
<h6 class="category-title">{{ 'DMP-RELATED-COLLABORATOR.RELATED-COLLABORATOR' | translate}}</h6> <h6 class="category-title">{{ 'CRITERIA.DMP.RELATED-COLLABORATORS' | translate}}</h6>
<mat-form-field> <mat-form-field>
<input matInput placeholder="{{ 'DMP-RELATED-COLLABORATOR.SELECT-COLLABORATORS' | translate }}"> <input matInput placeholder="{{ 'CRITERIA.DMP.SELECT-COLLABORATORS' | translate }}">
<!-- <app-multiple-auto-complete [formControl]="formGroup.get('projects')" <app-multiple-auto-complete [formControl]="formGroup.get('collaborators')"
placeholder="{{'CRITERIA.DMP.SELECT-PROJECTS' | translate}}" placeholder="{{'CRITERIA.DMP.SELECT-COLLABORATORS' | translate}}"
[configuration]="projectAutoCompleteConfiguration"> [configuration]="collaboratorsAutoCompleteConfiguration">
</app-multiple-auto-complete> --> </app-multiple-auto-complete>
<mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon> <mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon>
</mat-form-field> </mat-form-field>
</div> </div>

View File

@ -21,6 +21,8 @@ import { OrganisationService } from '../../../../core/services/organisation/orga
import { OrganisationCriteria } from '../../../../core/query/organisation/organisation-criteria'; import { OrganisationCriteria } from '../../../../core/query/organisation/organisation-criteria';
import { OrganizationModel } from '../../../../core/model/organisation/organization'; import { OrganizationModel } from '../../../../core/model/organisation/organization';
import { DataTableData } from '../../../../core/model/data-table/data-table-data'; import { DataTableData } from '../../../../core/model/data-table/data-table-data';
import { UserCriteria } from '../../../../core/query/user/user-criteria';
import { UserService } from '../../../../core/services/user/user.service';
@Component({ @Component({
selector: 'app-dmp-criteria-component', selector: 'app-dmp-criteria-component',
@ -40,10 +42,18 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
like: new FormControl(), like: new FormControl(),
projects: new FormControl(), projects: new FormControl(),
status: new FormControl(), status: new FormControl(),
role: new FormControl,
organisations: new FormControl(), organisations: new FormControl(),
role: new FormControl collaborators: new FormControl(),
}); });
collaboratorsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterCollaborators.bind(this),
initialItems: (excludedItems: any[]) => this.filterCollaborators('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['name'],
titleFn: (item) => item['name']
};
projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = { projectAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterProject.bind(this), filterFn: this.filterProject.bind(this),
initialItems: (excludedItems: any[]) => this.filterProject('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)), initialItems: (excludedItems: any[]) => this.filterProject('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
@ -64,7 +74,8 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
private dmpService: DmpService, private dmpService: DmpService,
public formBuilder: FormBuilder, public formBuilder: FormBuilder,
private dialog: MatDialog, private dialog: MatDialog,
private organisationService: OrganisationService private organisationService: OrganisationService,
private userService: UserService,
) { ) {
super(new ValidationErrorModel()); super(new ValidationErrorModel());
} }
@ -86,6 +97,9 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
this.formGroup.get('like').valueChanges this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified()); .subscribe(x => this.controlModified());
this.formGroup.get('collaborators').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => this.controlModified());
//if (this.criteria == null) { this.criteria = new DataManagementPlanCriteria(); } //if (this.criteria == null) { this.criteria = new DataManagementPlanCriteria(); }
} }
@ -93,6 +107,8 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
this.formGroup.get('like').patchValue(criteria.like); this.formGroup.get('like').patchValue(criteria.like);
this.formGroup.get('projects').patchValue(criteria.projects); this.formGroup.get('projects').patchValue(criteria.projects);
this.formGroup.get('status').patchValue(criteria.status); this.formGroup.get('status').patchValue(criteria.status);
this.formGroup.get('role').patchValue(criteria.role);
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
} }
onCallbackError(error: any) { onCallbackError(error: any) {
@ -128,6 +144,15 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
return this.organisationService.searchInternalOrganisations(dataTableRequest).map(x => x.data); return this.organisationService.searchInternalOrganisations(dataTableRequest).map(x => x.data);
} }
filterCollaborators(query: string) {
const fields: Array<string> = new Array<string>();
fields.push('asc');
const collaboratorsRequestItem: DataTableRequest<UserCriteria> = new DataTableRequest(0, null, { fields: fields });
collaboratorsRequestItem.criteria = new UserCriteria();
collaboratorsRequestItem.criteria.collaboratorLike = query;
return this.userService.getCollaboratorsPaged(collaboratorsRequestItem).map(x => x.data);
}
fileSave(event) { fileSave(event) {
const dialogRef = this.dialog.open(DmpUploadDialogue, { const dialogRef = this.dialog.open(DmpUploadDialogue, {
data: { data: {

View File

@ -100,6 +100,9 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
status: value.status, status: value.status,
role: value.role role: value.role
} }
if (value.collaborators) {
request.criteria.collaborators = value.collaborators.map(x => x.id)
}
if (value.organisations) { if (value.organisations) {
request.criteria.organisations = value.organisations.map(x => x.id) request.criteria.organisations = value.organisations.map(x => x.id)
} }

View File

@ -493,12 +493,16 @@
"SELECT-SPEC": "Select Dataset Specification", "SELECT-SPEC": "Select Dataset Specification",
"RELATED-PROJECT": "Related Project", "RELATED-PROJECT": "Related Project",
"SELECT-DMP": "Select DMP", "SELECT-DMP": "Select DMP",
"RELATED-DMP": "Related DMPs" "RELATED-DMP": "Related DMPs",
"SELECT-COLLABORATORS": "Select Collaborators",
"RELATED-COLLABORATORS": "Related Collaborators"
}, },
"DMP": { "DMP": {
"LIKE": "Search DMPs", "LIKE": "Search DMPs",
"PROJECTS": "Projects", "PROJECTS": "Projects",
"SELECT-PROJECTS": "Select Projects" "SELECT-PROJECTS": "Select Projects",
"SELECT-COLLABORATORS": "Select Collaborators",
"RELATED-COLLABORATORS": "Related Collaborators"
}, },
"USERS": { "USERS": {
"LABEL": "Search", "LABEL": "Search",