Fix critical issue with dataset's copy dropdown
This commit is contained in:
parent
dcd7f24cac
commit
d1e3aae36d
|
@ -34,6 +34,10 @@ public class ColumnOrderings {
|
||||||
ordering.fieldName(ordering.getFieldName().replace("|count|", "")).columnType(Ordering.ColumnType.COUNT);
|
ordering.fieldName(ordering.getFieldName().replace("|count|", "")).columnType(Ordering.ColumnType.COUNT);
|
||||||
else if (ordering.getFieldName().contains("|join|"))
|
else if (ordering.getFieldName().contains("|join|"))
|
||||||
ordering.fieldName(ordering.getFieldName().replace("|join|", "")).columnType(Ordering.ColumnType.JOIN_COLUMN);
|
ordering.fieldName(ordering.getFieldName().replace("|join|", "")).columnType(Ordering.ColumnType.JOIN_COLUMN);
|
||||||
|
else if (ordering.getFieldName().equals("asc"))
|
||||||
|
ordering.fieldName("label").orderByType(Ordering.OrderByType.ASC);
|
||||||
|
else if (ordering.getFieldName().equals("desc"))
|
||||||
|
ordering.fieldName("label").orderByType(Ordering.OrderByType.DESC);
|
||||||
return ordering;
|
return ordering;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class DmpCriteria extends Criteria {
|
||||||
private boolean allowAllVersions;
|
private boolean allowAllVersions;
|
||||||
private Short grantStatus;
|
private Short grantStatus;
|
||||||
private int offset;
|
private int offset;
|
||||||
private int size;
|
private Integer size;
|
||||||
private List<SortCriteria> sortCriteria;
|
private List<SortCriteria> sortCriteria;
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,11 +116,11 @@ public class DmpCriteria extends Criteria {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public Integer getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSize(int size) {
|
public void setSize(Integer size) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,6 @@ import org.springframework.core.env.Environment;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
|
||||||
import org.springframework.util.MultiValueMap;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.HttpServerErrorException;
|
import org.springframework.web.client.HttpServerErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
@ -137,6 +135,7 @@ public class DataManagementPlanManager {
|
||||||
criteria.setOffset(dataManagementPlanTableRequest.getOffset());
|
criteria.setOffset(dataManagementPlanTableRequest.getOffset());
|
||||||
criteria.setSize(dataManagementPlanTableRequest.getLength());
|
criteria.setSize(dataManagementPlanTableRequest.getLength());
|
||||||
criteria.setSortCriteria(DmpCriteriaMapper.toElasticSorting(dataManagementPlanTableRequest.getOrderings()));
|
criteria.setSortCriteria(DmpCriteriaMapper.toElasticSorting(dataManagementPlanTableRequest.getOrderings()));
|
||||||
|
|
||||||
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
|
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
|
||||||
if (dmps != null && !dmps.isEmpty()) {
|
if (dmps != null && !dmps.isEmpty()) {
|
||||||
List<Dmp> finalDmps = dmps;
|
List<Dmp> finalDmps = dmps;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class DmpCriteriaMapper {
|
||||||
if (columnOrderings.getFieldOrderings() != null && columnOrderings.getFieldOrderings().length > 0) {
|
if (columnOrderings.getFieldOrderings() != null && columnOrderings.getFieldOrderings().length > 0) {
|
||||||
for (Ordering ordering: columnOrderings.getFieldOrderings()) {
|
for (Ordering ordering: columnOrderings.getFieldOrderings()) {
|
||||||
SortCriteria sortCriteria1 = new SortCriteria();
|
SortCriteria sortCriteria1 = new SortCriteria();
|
||||||
sortCriteria1.setFieldName(ordering.getFieldName());
|
sortCriteria1.setFieldName(ordering.getFieldName() + ".keyword");
|
||||||
sortCriteria1.setColumnType(ordering.getColumnType() != null ? SortCriteria.ColumnType.valueOf(ordering.getColumnType().name()): SortCriteria.ColumnType.COLUMN);
|
sortCriteria1.setColumnType(ordering.getColumnType() != null ? SortCriteria.ColumnType.valueOf(ordering.getColumnType().name()): SortCriteria.ColumnType.COLUMN);
|
||||||
sortCriteria1.setOrderByType(SortCriteria.OrderByType.valueOf(ordering.getOrderByType().name()));
|
sortCriteria1.setOrderByType(SortCriteria.OrderByType.valueOf(ordering.getOrderByType().name()));
|
||||||
sortCriteria.add(sortCriteria1);
|
sortCriteria.add(sortCriteria1);
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
private int status;
|
private int status;
|
||||||
private UUID groupId;
|
private UUID groupId;
|
||||||
private List<DatasetUrlListing> datasets;
|
private List<DatasetUrlListing> datasets;
|
||||||
//private List<AssociatedProfile> associatedProfiles;
|
// private List<AssociatedProfile> associatedProfiles;
|
||||||
private List<UserInfoListingModel> users;
|
private List<UserInfoListingModel> users;
|
||||||
private String description;
|
private String description;
|
||||||
// private String grantAbbreviation;
|
// private String grantAbbreviation;
|
||||||
|
@ -187,8 +187,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.id = entity.getId().toString();
|
this.id = entity.getId().toString();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
this.groupId = entity.getGroupId();
|
this.groupId = entity.getGroupId();
|
||||||
/*this.creationTime = entity.getCreated();
|
// this.creationTime = entity.getCreated();
|
||||||
this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());*/
|
// this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,8 @@ export class DatasetCopyDialogueComponent {
|
||||||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||||
dmpDataTableRequest.criteria.like = query;
|
dmpDataTableRequest.criteria.like = query;
|
||||||
return this.dmpService.getPaged(dmpDataTableRequest, "profiles").pipe(map(x => x.data), map(x => x.filter(y => this.existsDatasetDescriptionTemplate(y.associatedProfiles))));
|
dmpDataTableRequest.criteria.datasetTemplates = [this.data.datasetProfileId];
|
||||||
|
return this.dmpService.getPaged(dmpDataTableRequest, "profiles").pipe(map(x => x.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
existsDatasetDescriptionTemplate(associatedProfiles: DmpAssociatedProfileModel[]): boolean {
|
existsDatasetDescriptionTemplate(associatedProfiles: DmpAssociatedProfileModel[]): boolean {
|
||||||
|
|
Loading…
Reference in New Issue