Fix critical issue with dataset's copy dropdown

This commit is contained in:
George Kalampokis 2021-06-30 12:51:12 +03:00
parent dcd7f24cac
commit d1e3aae36d
6 changed files with 14 additions and 10 deletions

View File

@ -34,6 +34,10 @@ public class ColumnOrderings {
ordering.fieldName(ordering.getFieldName().replace("|count|", "")).columnType(Ordering.ColumnType.COUNT);
else if (ordering.getFieldName().contains("|join|"))
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;
}
}

View File

@ -16,7 +16,7 @@ public class DmpCriteria extends Criteria {
private boolean allowAllVersions;
private Short grantStatus;
private int offset;
private int size;
private Integer size;
private List<SortCriteria> sortCriteria;
@ -116,11 +116,11 @@ public class DmpCriteria extends Criteria {
this.offset = offset;
}
public int getSize() {
public Integer getSize() {
return size;
}
public void setSize(int size) {
public void setSize(Integer size) {
this.size = size;
}

View File

@ -69,8 +69,6 @@ import org.springframework.core.env.Environment;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.*;
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.HttpServerErrorException;
import org.springframework.web.client.RestTemplate;
@ -137,6 +135,7 @@ public class DataManagementPlanManager {
criteria.setOffset(dataManagementPlanTableRequest.getOffset());
criteria.setSize(dataManagementPlanTableRequest.getLength());
criteria.setSortCriteria(DmpCriteriaMapper.toElasticSorting(dataManagementPlanTableRequest.getOrderings()));
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(criteria);
if (dmps != null && !dmps.isEmpty()) {
List<Dmp> finalDmps = dmps;

View File

@ -48,7 +48,7 @@ public class DmpCriteriaMapper {
if (columnOrderings.getFieldOrderings() != null && columnOrderings.getFieldOrderings().length > 0) {
for (Ordering ordering: columnOrderings.getFieldOrderings()) {
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.setOrderByType(SortCriteria.OrderByType.valueOf(ordering.getOrderByType().name()));
sortCriteria.add(sortCriteria1);

View File

@ -187,8 +187,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.groupId = entity.getGroupId();
/*this.creationTime = entity.getCreated();
this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());*/
// this.creationTime = entity.getCreated();
// this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
return this;
}

View File

@ -61,7 +61,8 @@ export class DatasetCopyDialogueComponent {
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
dmpDataTableRequest.criteria = new DmpCriteria();
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 {