Integrate Public Dataset Listing to regular Dataset Listing
This commit is contained in:
parent
d34d8a692c
commit
35b89edabc
|
@ -2,6 +2,7 @@ package eu.eudat.data.dao.criteria;
|
||||||
|
|
||||||
import eu.eudat.data.entities.Dataset;
|
import eu.eudat.data.entities.Dataset;
|
||||||
import eu.eudat.elastic.entities.Tag;
|
import eu.eudat.elastic.entities.Tag;
|
||||||
|
import eu.eudat.types.grant.GrantStateType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -22,6 +23,8 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
||||||
private List<UUID> collaborators;
|
private List<UUID> collaborators;
|
||||||
private List<UUID> datasetTemplates;
|
private List<UUID> datasetTemplates;
|
||||||
private List<UUID> groupIds;
|
private List<UUID> groupIds;
|
||||||
|
private Boolean isPublic;
|
||||||
|
private Short grantStatus;
|
||||||
|
|
||||||
public boolean getAllVersions() {
|
public boolean getAllVersions() {
|
||||||
return allVersions;
|
return allVersions;
|
||||||
|
@ -113,4 +116,20 @@ public class DatasetCriteria extends Criteria<Dataset> {
|
||||||
public void setGroupIds(List<UUID> groupIds) {
|
public void setGroupIds(List<UUID> groupIds) {
|
||||||
this.groupIds = groupIds;
|
this.groupIds = groupIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getIsPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsPublic(Boolean isPublic) {
|
||||||
|
this.isPublic = isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getGrantStatus() {
|
||||||
|
return grantStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrantStatus(Short grantStatus) {
|
||||||
|
this.grantStatus = grantStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import eu.eudat.data.entities.UserInfo;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
import eu.eudat.queryable.types.FieldSelectionType;
|
import eu.eudat.queryable.types.FieldSelectionType;
|
||||||
import eu.eudat.queryable.types.SelectionField;
|
import eu.eudat.queryable.types.SelectionField;
|
||||||
|
import eu.eudat.types.grant.GrantStateType;
|
||||||
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;
|
||||||
|
@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
|
||||||
import javax.persistence.criteria.Join;
|
import javax.persistence.criteria.Join;
|
||||||
import javax.persistence.criteria.JoinType;
|
import javax.persistence.criteria.JoinType;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -30,6 +32,13 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
||||||
@Override
|
@Override
|
||||||
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
|
public QueryableList<Dataset> getWithCriteria(DatasetCriteria criteria) {
|
||||||
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
|
QueryableList<Dataset> query = getDatabaseService().getQueryable(Dataset.getHints(), Dataset.class);
|
||||||
|
if (criteria.getIsPublic()) {
|
||||||
|
query.where((builder, root) -> builder.equal(root.get("dmp").get("isPublic"), true));
|
||||||
|
query.where((builder, root) -> builder.equal(root.get("status"), Dataset.Status.FINALISED.getValue()));
|
||||||
|
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
|
||||||
|
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
|
||||||
|
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
|
||||||
|
}
|
||||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.or(
|
query.where((builder, root) -> builder.or(
|
||||||
builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
|
builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"),
|
||||||
|
@ -57,6 +66,14 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
|
||||||
query.where((builder, root) -> root.join("dmp").join("organisations").get("reference").in(criteria.getOrganisations()));
|
query.where((builder, root) -> root.join("dmp").join("organisations").get("reference").in(criteria.getOrganisations()));
|
||||||
if (criteria.getGrants() != null && !criteria.getGrants().isEmpty())
|
if (criteria.getGrants() != null && !criteria.getGrants().isEmpty())
|
||||||
query.where((builder, root) -> root.join("dmp").join("grant").get("id").in(criteria.getGrants()));
|
query.where((builder, root) -> root.join("dmp").join("grant").get("id").in(criteria.getGrants()));
|
||||||
|
if (criteria.getGrantStatus() != null) {
|
||||||
|
if (criteria.getGrantStatus().equals(GrantStateType.FINISHED.getValue().shortValue()))
|
||||||
|
query.where((builder, root) -> builder.lessThan(root.get("dmp").get("grant").get("enddate"), new Date()));
|
||||||
|
if (criteria.getGrantStatus().equals(GrantStateType.ONGOING.getValue().shortValue()))
|
||||||
|
query.where((builder, root) ->
|
||||||
|
builder.or(builder.greaterThan(root.get("dmp").get("grant").get("enddate"), new Date())
|
||||||
|
, builder.isNull(root.get("dmp").get("grant").get("enddate"))));
|
||||||
|
}
|
||||||
if (criteria.getCollaborators() != null && !criteria.getCollaborators().isEmpty())
|
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) -> root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT).join("user", JoinType.LEFT).get("id").in(criteria.getCollaborators()));
|
||||||
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty())
|
if (criteria.getDatasetTemplates() != null && !criteria.getDatasetTemplates().isEmpty())
|
||||||
|
|
|
@ -18,7 +18,9 @@ public class DatasetCriteria extends Criteria {
|
||||||
private List<UUID> collaborators;
|
private List<UUID> collaborators;
|
||||||
private Boolean allowAllVersions;
|
private Boolean allowAllVersions;
|
||||||
private List<String> organiztions;
|
private List<String> organiztions;
|
||||||
public List<Tag> tags;
|
private List<Tag> tags;
|
||||||
|
private boolean isPublic;
|
||||||
|
private Short grantStatus;
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
|
@ -99,4 +101,20 @@ public class DatasetCriteria extends Criteria {
|
||||||
public void setTags(List<Tag> tags) {
|
public void setTags(List<Tag> tags) {
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublic(boolean aPublic) {
|
||||||
|
isPublic = aPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getGrantStatus() {
|
||||||
|
return grantStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrantStatus(Short grantStatus) {
|
||||||
|
this.grantStatus = grantStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,8 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
private List<Collaborator> collaborators;
|
private List<Collaborator> collaborators;
|
||||||
private Boolean lastVersion;
|
private Boolean lastVersion;
|
||||||
private List<Organization> organizations;
|
private List<Organization> organizations;
|
||||||
|
private Boolean isPublic;
|
||||||
|
private Short grantStatus;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -143,6 +145,22 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
this.organizations = organizations;
|
this.organizations = organizations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublic(Boolean aPublic) {
|
||||||
|
isPublic = aPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getGrantStatus() {
|
||||||
|
return grantStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrantStatus(Short grantStatus) {
|
||||||
|
this.grantStatus = grantStatus;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
|
@ -191,6 +209,12 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
});
|
});
|
||||||
builder.endArray();
|
builder.endArray();
|
||||||
}
|
}
|
||||||
|
if (this.isPublic != null) {
|
||||||
|
builder.field("public", this.isPublic.toString());
|
||||||
|
}
|
||||||
|
if (this.grantStatus != null) {
|
||||||
|
builder.field("grantStatus", this.grantStatus.toString());
|
||||||
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -215,6 +239,12 @@ public class Dataset implements ElasticEntity<Dataset> {
|
||||||
if (fields.get("organizations") != null) {
|
if (fields.get("organizations") != null) {
|
||||||
this.organizations = ((List<HashMap>) fields.get("organizations")).stream().map(hashMap -> new Organization().fromElasticEntity(hashMap)).collect(Collectors.toList());
|
this.organizations = ((List<HashMap>) fields.get("organizations")).stream().map(hashMap -> new Organization().fromElasticEntity(hashMap)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
if (fields.get("public") != null) {
|
||||||
|
this.isPublic = Boolean.valueOf((String) fields.get("public"));
|
||||||
|
}
|
||||||
|
if (fields.get("grantStatus") != null) {
|
||||||
|
this.grantStatus = Short.valueOf((String) fields.get("grantStatus"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,13 +58,16 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
||||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||||
|
|
||||||
CountRequest countRequest = new CountRequest("datasets");
|
CountRequest countRequest = new CountRequest("datasets");
|
||||||
countRequest.query(QueryBuilders.boolQuery().mustNot(QueryBuilders.termQuery("status.keyword", Dataset.Status.DELETED.getValue())));
|
countRequest.query(QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery("status.keyword", new short[]{Dataset.Status.DELETED.getValue(), Dataset.Status.CANCELED.getValue()})));
|
||||||
CountResponse countResponse = getClient().count(countRequest, RequestOptions.DEFAULT);
|
CountResponse countResponse = getClient().count(countRequest, RequestOptions.DEFAULT);
|
||||||
Long count = countResponse.getCount();
|
Long count = countResponse.getCount();
|
||||||
|
|
||||||
searchSourceBuilder.size(count.intValue());
|
searchSourceBuilder.size(count.intValue());
|
||||||
|
|
||||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().mustNot(QueryBuilders.termQuery("status.keyword", Dataset.Status.DELETED.getValue()));
|
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery("status.keyword", new short[]{Dataset.Status.DELETED.getValue(), Dataset.Status.CANCELED.getValue()}));
|
||||||
|
if (criteria.isPublic()) {
|
||||||
|
boolQuery = boolQuery.should(QueryBuilders.termQuery("public.keyword", "true"));
|
||||||
|
}
|
||||||
if (criteria.getLabel() != null && !criteria.getLabel().isEmpty()) {
|
if (criteria.getLabel() != null && !criteria.getLabel().isEmpty()) {
|
||||||
boolQuery = boolQuery.should(QueryBuilders.matchPhrasePrefixQuery("label", criteria.getLabel()));
|
boolQuery = boolQuery.should(QueryBuilders.matchPhrasePrefixQuery("label", criteria.getLabel()));
|
||||||
}
|
}
|
||||||
|
@ -89,6 +92,10 @@ public class DatasetRepository extends ElasticRepository<Dataset, DatasetCriteri
|
||||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("grant.keyword", criteria.getGrants().stream().map(UUID::toString).collect(Collectors.toList())));
|
boolQuery = boolQuery.should(QueryBuilders.termsQuery("grant.keyword", criteria.getGrants().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (criteria.getGrantStatus() != null) {
|
||||||
|
boolQuery = boolQuery.should(QueryBuilders.termQuery("grantStatus.keyword", criteria.getGrantStatus().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
if (criteria.getCollaborators() != null && criteria.getCollaborators().size() > 0) {
|
if (criteria.getCollaborators() != null && criteria.getCollaborators().size() > 0) {
|
||||||
boolQuery = boolQuery.should(QueryBuilders.termsQuery("collaborators.id.keyword", criteria.getCollaborators().stream().map(UUID::toString).collect(Collectors.toList())));
|
boolQuery = boolQuery.should(QueryBuilders.termsQuery("collaborators.id.keyword", criteria.getCollaborators().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class Datasets extends BaseController {
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = {"paged"}, consumes = "application/json", produces = "application/json")
|
@RequestMapping(method = RequestMethod.POST, value = {"paged"}, consumes = "application/json", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<DataTableData<DatasetListingModel>>> getPaged(@RequestBody DatasetTableRequest datasetTableRequest, Principal principal) throws Exception {
|
ResponseEntity<ResponseItem<DataTableData<DatasetListingModel>>> getPaged(@RequestBody DatasetTableRequest datasetTableRequest, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||||
DataTableData<DatasetListingModel> dataTable = this.datasetManager.getPaged(datasetTableRequest, principal);
|
DataTableData<DatasetListingModel> dataTable = this.datasetManager.getPaged(datasetTableRequest, principal);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class DashBoardManager {
|
||||||
user.setId(principal.getId());
|
user.setId(principal.getId());
|
||||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||||
datasetCriteria.setAllVersions(false);
|
datasetCriteria.setAllVersions(false);
|
||||||
|
datasetCriteria.setIsPublic(false);
|
||||||
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
||||||
dataManagementPlanCriteria.setAllVersions(false);
|
dataManagementPlanCriteria.setAllVersions(false);
|
||||||
GrantCriteria grantCriteria = new GrantCriteria();
|
GrantCriteria grantCriteria = new GrantCriteria();
|
||||||
|
|
|
@ -948,6 +948,8 @@ public class DataManagementPlanManager {
|
||||||
return organization;
|
return organization;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
datasetElastic.setPublic(dataset1.getDmp().isPublic());
|
||||||
|
datasetElastic.setGrantStatus(dataset1.getDmp().getGrant().getStatus());
|
||||||
try {
|
try {
|
||||||
apiContext.getOperationsContext().getDatasetRepository().createOrUpdate(datasetElastic);
|
apiContext.getOperationsContext().getDatasetRepository().createOrUpdate(datasetElastic);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -1313,6 +1315,13 @@ public class DataManagementPlanManager {
|
||||||
throw new Exception("DMP is not finalized");
|
throw new Exception("DMP is not finalized");
|
||||||
dmp.setPublic(true);
|
dmp.setPublic(true);
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(dmp);
|
||||||
|
dmp.getDataset().forEach(dataset -> {
|
||||||
|
try {
|
||||||
|
datasetManager.updateTags(apiContext.getOperationsContext().getDatasetRepository(), new DatasetWizardModel().fromDataModel(dataset));
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(principal.getId());
|
||||||
sendNotification(dmp, user, NotificationType.DMP_PUBLISH);
|
sendNotification(dmp, user, NotificationType.DMP_PUBLISH);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,12 @@ public class DatasetManager {
|
||||||
datasetCriteria.setAllowAllVersions(datasetTableRequest.getCriteria().getAllVersions());
|
datasetCriteria.setAllowAllVersions(datasetTableRequest.getCriteria().getAllVersions());
|
||||||
datasetCriteria.setOrganiztions(datasetTableRequest.getCriteria().getOrganisations());
|
datasetCriteria.setOrganiztions(datasetTableRequest.getCriteria().getOrganisations());
|
||||||
datasetCriteria.setTags(datasetTableRequest.getCriteria().getTags());
|
datasetCriteria.setTags(datasetTableRequest.getCriteria().getTags());
|
||||||
|
if (datasetTableRequest.getCriteria().getIsPublic() != null) {
|
||||||
|
datasetCriteria.setPublic(datasetTableRequest.getCriteria().getIsPublic());
|
||||||
|
}
|
||||||
|
if (datasetTableRequest.getCriteria().getGrantStatus() != null) {
|
||||||
|
datasetCriteria.setGrantStatus(datasetTableRequest.getCriteria().getGrantStatus());
|
||||||
|
}
|
||||||
List<eu.eudat.elastic.entities.Dataset> datasets;
|
List<eu.eudat.elastic.entities.Dataset> datasets;
|
||||||
try {
|
try {
|
||||||
datasets = datasetRepository.exists() ?
|
datasets = datasetRepository.exists() ?
|
||||||
|
@ -147,9 +153,29 @@ public class DatasetManager {
|
||||||
items = databaseRepository.getDatasetDao().getWithCriteria(datasetTableRequest.getCriteria()).withHint(HintedModelFactory.getHint(DatasetListingModel.class));
|
items = databaseRepository.getDatasetDao().getWithCriteria(datasetTableRequest.getCriteria()).withHint(HintedModelFactory.getHint(DatasetListingModel.class));
|
||||||
}
|
}
|
||||||
List<Integer> roles = new LinkedList<>();
|
List<Integer> roles = new LinkedList<>();
|
||||||
if (datasetTableRequest.getCriteria().getRole() != null) roles.add(datasetTableRequest.getCriteria().getRole());
|
QueryableList<eu.eudat.data.entities.Dataset> pagedItems;
|
||||||
QueryableList<eu.eudat.data.entities.Dataset> authItems = databaseRepository.getDatasetDao().getAuthenticated(items, userInfo, roles);
|
QueryableList<eu.eudat.data.entities.Dataset> authItems;
|
||||||
QueryableList<eu.eudat.data.entities.Dataset> pagedItems = PaginationManager.applyPaging(authItems, datasetTableRequest);
|
if (!datasetTableRequest.getCriteria().getIsPublic()) {
|
||||||
|
if (principal.getId() == null) {
|
||||||
|
throw new UnauthorisedException();
|
||||||
|
}
|
||||||
|
if (datasetTableRequest.getCriteria().getRole() != null)
|
||||||
|
roles.add(datasetTableRequest.getCriteria().getRole());
|
||||||
|
authItems = databaseRepository.getDatasetDao().getAuthenticated(items, userInfo, roles);
|
||||||
|
pagedItems = PaginationManager.applyPaging(authItems, datasetTableRequest);
|
||||||
|
} else {
|
||||||
|
if (principal.getId() != null && datasetTableRequest.getCriteria().getRole() != null) {
|
||||||
|
items.where((builder, root) -> {
|
||||||
|
Join userJoin = root.join("dmp", JoinType.LEFT).join("users", JoinType.LEFT);
|
||||||
|
return builder.and(builder.equal(userJoin.join("user", JoinType.LEFT).get("id"), principal.getId()), builder.equal(userJoin.get("role"), datasetTableRequest.getCriteria().getRole()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
String[] strings = new String[1];
|
||||||
|
strings[0] = "-dmp:publishedAt|join|";
|
||||||
|
datasetTableRequest.getOrderings().setFields(strings);
|
||||||
|
authItems = items;
|
||||||
|
pagedItems = PaginationManager.applyPaging(items, datasetTableRequest);
|
||||||
|
}
|
||||||
DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
|
DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
|
||||||
|
|
||||||
|
|
||||||
|
@ -490,7 +516,9 @@ public class DatasetManager {
|
||||||
|
|
||||||
Dataset dataset1 = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().createOrUpdate(dataset);
|
Dataset dataset1 = apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().createOrUpdate(dataset);
|
||||||
datasetWizardModel.setId(dataset1.getId());
|
datasetWizardModel.setId(dataset1.getId());
|
||||||
datasetWizardModel.setDmp(new DataManagementPlan().fromDataModelNoDatasets(dataset1.getDmp()));
|
if (datasetWizardModel.getDmp() == null) {
|
||||||
|
datasetWizardModel.setDmp(new DataManagementPlan().fromDataModelNoDatasets(dataset1.getDmp()));
|
||||||
|
}
|
||||||
updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
|
updateTags(apiContext.getOperationsContext().getDatasetRepository(), datasetWizardModel);
|
||||||
if (sendNotification) {
|
if (sendNotification) {
|
||||||
if (dataset1.getStatus() != Dataset.Status.FINALISED.getValue()) {
|
if (dataset1.getStatus() != Dataset.Status.FINALISED.getValue()) {
|
||||||
|
@ -594,6 +622,8 @@ public class DatasetManager {
|
||||||
return organization;
|
return organization;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
dataset.setPublic(datasetWizardModel.getDmp().getPublic());
|
||||||
|
dataset.setGrantStatus(datasetWizardModel.getDmp().getGrant().getStatus());
|
||||||
datasetRepository.createOrUpdate(dataset);
|
datasetRepository.createOrUpdate(dataset);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
private String doi;
|
private String doi;
|
||||||
private Project project;
|
private Project project;
|
||||||
private Funder funder;
|
private Funder funder;
|
||||||
|
private Boolean isPublic;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -211,6 +212,14 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
this.funder = funder;
|
this.funder = funder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublic(Boolean aPublic) {
|
||||||
|
isPublic = aPublic;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataManagementPlan fromDataModel(DMP entity) {
|
public DataManagementPlan fromDataModel(DMP entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
|
@ -269,6 +278,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
this.funder = new Funder();
|
this.funder = new Funder();
|
||||||
this.funder.fromDataModel(entity.getGrant().getFunder());
|
this.funder.fromDataModel(entity.getGrant().getFunder());
|
||||||
}
|
}
|
||||||
|
this.isPublic = entity.isPublic();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -308,6 +318,9 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
if (this.dynamicFields != null)
|
if (this.dynamicFields != null)
|
||||||
dataManagementPlanEntity.setDmpProperties(JSONObject.toJSONString(this.dynamicFields.stream().filter(item -> item.getValue() != null).collect(Collectors.toMap(DynamicFieldWithValue::getId, DynamicFieldWithValue::getValue))));
|
dataManagementPlanEntity.setDmpProperties(JSONObject.toJSONString(this.dynamicFields.stream().filter(item -> item.getValue() != null).collect(Collectors.toMap(DynamicFieldWithValue::getId, DynamicFieldWithValue::getValue))));
|
||||||
|
|
||||||
|
if (this.isPublic != null) {
|
||||||
|
dataManagementPlanEntity.setPublic(this.isPublic);
|
||||||
|
}
|
||||||
return dataManagementPlanEntity;
|
return dataManagementPlanEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +371,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
||||||
this.funder = new Funder();
|
this.funder = new Funder();
|
||||||
this.funder.fromDataModel(entity.getGrant().getFunder());
|
this.funder.fromDataModel(entity.getGrant().getFunder());
|
||||||
}
|
}
|
||||||
|
this.isPublic = entity.isPublic();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ const appRoutes: Routes = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'explore',
|
path: 'explore',
|
||||||
loadChildren: () => import('./ui/explore-dataset/explore-dataset.module').then(m => m.ExploreDatasetModule),
|
// loadChildren: () => import('./ui/explore-dataset/explore-dataset.module').then(m => m.ExploreDatasetModule),
|
||||||
|
loadChildren: () => import('./ui/dataset/dataset.module').then(m => m.DatasetModule),
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true,
|
breadcrumb: true,
|
||||||
title: 'GENERAL.TITLES.EXPLORE'
|
title: 'GENERAL.TITLES.EXPLORE'
|
||||||
|
|
|
@ -12,4 +12,6 @@ export class DatasetCriteria extends BaseCriteria {
|
||||||
public collaborators?: string[] = [];
|
public collaborators?: string[] = [];
|
||||||
public datasetTemplates?: string[] = [];
|
public datasetTemplates?: string[] = [];
|
||||||
public groupIds?: string[] = [];
|
public groupIds?: string[] = [];
|
||||||
|
public isPublic?: boolean = false;
|
||||||
|
public grantStatus?: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,7 +412,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
if (!isNullOrUndefined(this.lock)) {
|
if (!isNullOrUndefined(this.lock)) {
|
||||||
this.lockService.unlockTarget(this.datasetWizardModel.id).pipe(takeUntil(this._destroyed)).subscribe(
|
this.lockService.unlockTarget(this.datasetWizardModel.id).pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
complete => {
|
complete => {
|
||||||
this.router.navigate(['/datasets']);
|
this.location.back();
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.formGroup.get('status').setValue(DmpStatus.Draft);
|
this.formGroup.get('status').setValue(DmpStatus.Draft);
|
||||||
|
@ -421,7 +421,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate(['/datasets']);
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: DatasetListingComponent,
|
component: DatasetListingComponent,
|
||||||
canActivate: [AuthGuard],
|
// canActivate: [AuthGuard],
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<!-- End of Search Filter -->
|
<!-- End of Search Filter -->
|
||||||
|
|
||||||
<!-- Status Filter-->
|
<!-- Status Filter-->
|
||||||
<div class="col-10 gray-container" >
|
<div class="col-10 gray-container" *ngIf="!isPublic" >
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.STATUS'| translate}}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.STATUS'| translate}}</h6>
|
||||||
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
|
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
|
||||||
<mat-list-item><mat-radio-button checked value="null">{{ 'TYPES.DATASET-STATUS.ANY' | translate }}</mat-radio-button></mat-list-item>
|
<mat-list-item><mat-radio-button checked value="null">{{ 'TYPES.DATASET-STATUS.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||||
|
@ -23,6 +23,17 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- End of Status Filter-->
|
<!-- End of Status Filter-->
|
||||||
|
|
||||||
|
<!-- Grant Status -->
|
||||||
|
<div class="col-10 gray-container" *ngIf="isPublic">
|
||||||
|
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
|
||||||
|
<mat-radio-group [formControl]="formGroup.get('grantStatus')">
|
||||||
|
<mat-list-item><mat-radio-button checked value="null">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||||
|
<mat-list-item><mat-radio-button value="0">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button></mat-list-item>
|
||||||
|
<mat-list-item><mat-radio-button value="1">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button></mat-list-item>
|
||||||
|
</mat-radio-group>
|
||||||
|
</div>
|
||||||
|
<!-- End of Grant Status -->
|
||||||
|
|
||||||
<!-- Related Dataset Templates Filters -->
|
<!-- Related Dataset Templates Filters -->
|
||||||
<div class="col-10 gray-container">
|
<div class="col-10 gray-container">
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-DATASET-TEMPLATES' | translate}}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-DATASET-TEMPLATES' | translate}}</h6>
|
||||||
|
@ -48,7 +59,7 @@
|
||||||
<!-- End of Related DMP Filters -->
|
<!-- End of Related DMP Filters -->
|
||||||
|
|
||||||
<!-- All Versions Filter-->
|
<!-- All Versions Filter-->
|
||||||
<div class="col-10 gray-container" >
|
<div class="col-10 gray-container" *ngIf="!isPublic">
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ALL-VERSIONS'| translate}}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ALL-VERSIONS'| translate}}</h6>
|
||||||
<mat-slide-toggle [formControl]="formGroup.get('allVersions')"></mat-slide-toggle>
|
<mat-slide-toggle [formControl]="formGroup.get('allVersions')"></mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,7 +78,7 @@
|
||||||
<!-- End of Related Grants Filters -->
|
<!-- End of Related Grants Filters -->
|
||||||
|
|
||||||
<!-- Related Collaborators Filters -->
|
<!-- Related Collaborators Filters -->
|
||||||
<div class="col-10 gray-container">
|
<div class="col-10 gray-container" *ngIf="!isPublic">
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-COLLABORATORS' | translate}}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-COLLABORATORS' | translate}}</h6>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<app-multiple-auto-complete [formControl]="formGroup.get('collaborators')"
|
<app-multiple-auto-complete [formControl]="formGroup.get('collaborators')"
|
||||||
|
@ -79,7 +90,7 @@
|
||||||
<!-- End of Related Collaborators Filters -->
|
<!-- End of Related Collaborators Filters -->
|
||||||
|
|
||||||
<!-- Role Filter -->
|
<!-- Role Filter -->
|
||||||
<div class="col-10 gray-container">
|
<div class="col-10 gray-container" *ngIf="isAuthenticated()">
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ROLE' | translate }}</h6>
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ROLE' | translate }}</h6>
|
||||||
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')">
|
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')">
|
||||||
<mat-list-item><mat-radio-button checked value="null">{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
|
<mat-list-item><mat-radio-button checked value="null">{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||||
|
|
|
@ -33,6 +33,10 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
import { isNullOrUndefined } from 'util';
|
||||||
|
import { ExploreDmpCriteriaModel } from '@app/core/query/explore-dmp/explore-dmp-criteria';
|
||||||
|
import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-criteria-component',
|
selector: 'app-dataset-criteria-component',
|
||||||
|
@ -43,6 +47,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
|
|
||||||
@Input() dmpSearchEnabled;
|
@Input() dmpSearchEnabled;
|
||||||
@Input() status;
|
@Input() status;
|
||||||
|
@Input() isPublic: boolean;
|
||||||
public criteria: any;
|
public criteria: any;
|
||||||
public filteringTagsAsync = false;
|
public filteringTagsAsync = false;
|
||||||
public filteredTags: ExternalSourceItemModel[];
|
public filteredTags: ExternalSourceItemModel[];
|
||||||
|
@ -60,7 +65,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
collaborators: new FormControl(),
|
collaborators: new FormControl(),
|
||||||
datasetTemplates: new FormControl(),
|
datasetTemplates: new FormControl(),
|
||||||
tags: new FormControl(),
|
tags: new FormControl(),
|
||||||
allVersions: new FormControl()
|
allVersions: new FormControl(),
|
||||||
|
grantStatus: new FormControl()
|
||||||
});
|
});
|
||||||
|
|
||||||
tagsAutoCompleteConfiguration = {
|
tagsAutoCompleteConfiguration = {
|
||||||
|
@ -120,7 +126,9 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
private organisationService: OrganisationService,
|
private organisationService: OrganisationService,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private datasetService: DatasetService,
|
private datasetService: DatasetService,
|
||||||
fb: FormBuilder
|
fb: FormBuilder,
|
||||||
|
private authService: AuthService
|
||||||
|
|
||||||
) {
|
) {
|
||||||
super(new ValidationErrorModel());
|
super(new ValidationErrorModel());
|
||||||
// this.options = fb.group({
|
// this.options = fb.group({
|
||||||
|
@ -161,6 +169,9 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
this.formGroup.get('tags').valueChanges
|
this.formGroup.get('tags').valueChanges
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(x => this.controlModified());
|
.subscribe(x => this.controlModified());
|
||||||
|
this.formGroup.get('grantStatus').valueChanges
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(x => this.controlModified());
|
||||||
// if (this.criteria == null) { this.criteria = {}; }
|
// if (this.criteria == null) { this.criteria = {}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +185,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
|
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
|
||||||
this.formGroup.get('allVersions').patchValue(criteria.allVersions);
|
this.formGroup.get('allVersions').patchValue(criteria.allVersions);
|
||||||
this.formGroup.get('tags').patchValue(criteria.tags);
|
this.formGroup.get('tags').patchValue(criteria.tags);
|
||||||
|
this.formGroup.get('grantStatus').patchValue(criteria.grantStatus);
|
||||||
// this.criteria = criteria;
|
// this.criteria = criteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,22 +214,34 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
return this.externalSourcesService.searchDatasetTags(requestItem);
|
return this.externalSourcesService.searchDatasetTags(requestItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
filterDatasetTemplate(query: string) {
|
filterDatasetTemplate(query: string): Observable<any[]> {
|
||||||
const fields: Array<string> = new Array<string>();
|
const fields: Array<string> = new Array<string>();
|
||||||
fields.push('asc');
|
fields.push('asc');
|
||||||
const datasetTemplateRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields });
|
const datasetTemplateRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||||
datasetTemplateRequestItem.criteria = new DatasetProfileCriteria();
|
datasetTemplateRequestItem.criteria = new DatasetProfileCriteria();
|
||||||
datasetTemplateRequestItem.criteria.like = query;
|
datasetTemplateRequestItem.criteria.like = query;
|
||||||
|
if (this.isPublic) {
|
||||||
|
return this.datasetService.getDatasetProfiles(datasetTemplateRequestItem);
|
||||||
|
} else {
|
||||||
return this.datasetService.getDatasetProfilesUsedPaged(datasetTemplateRequestItem).pipe(map(x => x.data));
|
return this.datasetService.getDatasetProfilesUsedPaged(datasetTemplateRequestItem).pipe(map(x => x.data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filterDmps(value: string): Observable<DataTableData<DmpListingModel>> {
|
filterDmps(value: string): Observable<DataTableData<DmpListingModel>> {
|
||||||
const fields: Array<string> = new Array<string>();
|
const fields: Array<string> = new Array<string>();
|
||||||
fields.push('asc');
|
fields.push('asc');
|
||||||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
|
if (this.isPublic) {
|
||||||
|
const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
|
||||||
|
dmpDataTableRequest.criteria = new ExploreDmpCriteriaModel();
|
||||||
|
dmpDataTableRequest.criteria.like = value;
|
||||||
|
return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete");
|
||||||
|
} else {
|
||||||
|
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||||
dmpDataTableRequest.criteria.like = value;
|
dmpDataTableRequest.criteria.like = value;
|
||||||
return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete");
|
return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filterGrant(query: string) {
|
filterGrant(query: string) {
|
||||||
|
@ -226,7 +250,11 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
const grantRequestItem: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
const grantRequestItem: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||||
grantRequestItem.criteria = new GrantCriteria();
|
grantRequestItem.criteria = new GrantCriteria();
|
||||||
grantRequestItem.criteria.like = query;
|
grantRequestItem.criteria.like = query;
|
||||||
return this.grantService.getPaged(grantRequestItem, "autocomplete").pipe(map(x => x.data));
|
if (this.isPublic) {
|
||||||
|
return this.grantService.getPublicPaged(grantRequestItem).pipe(map(x => x.data));
|
||||||
|
} else {
|
||||||
|
return this.grantService.getPaged(grantRequestItem, "autocomplete").pipe(map(x => x.data));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filterOrganisations(value: string) {
|
filterOrganisations(value: string) {
|
||||||
|
@ -235,7 +263,12 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||||
dataTableRequest.criteria = new OrganisationCriteria();
|
dataTableRequest.criteria = new OrganisationCriteria();
|
||||||
dataTableRequest.criteria.labelLike = value;
|
dataTableRequest.criteria.labelLike = value;
|
||||||
return this.organisationService.searchInternalOrganisations(dataTableRequest).pipe(map(x => x.data));
|
if (this.isPublic) {
|
||||||
|
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
|
||||||
|
} else {
|
||||||
|
return this.organisationService.searchInternalOrganisations(dataTableRequest).pipe(map(x => x.data));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filterCollaborators(query: string) {
|
filterCollaborators(query: string) {
|
||||||
|
@ -279,4 +312,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
onCallbackError(error: any) {
|
onCallbackError(error: any) {
|
||||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Success);
|
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAuthenticated(): boolean {
|
||||||
|
return !isNullOrUndefined(this.authService.current());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
<div class="main-content">
|
<div class="header-image" *ngIf="isPublic">
|
||||||
|
<div class="header-text-container">
|
||||||
|
<h3>{{ 'ABOUT.WELCOME' | translate }}</h3>
|
||||||
|
<h4>{{ 'ABOUT.WELCOME-MESSAGE' | translate }}</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div [ngClass]="isPublic ? 'explore-dmp-content': 'main-content'">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="row card-header card-header-plain d-flex">
|
<div class="card-header card-header-plain d-flex">
|
||||||
<div class="card-desc d-flex flex-column justify-content-center">
|
<div class="card-desc d-flex flex-column justify-content-center">
|
||||||
<h4 class="card-title">{{'DASHBOARD.DATASETS' | translate}} {{titlePrefix}}</h4>
|
<h4 class="card-title">{{'DASHBOARD.DATASETS' | translate}} {{titlePrefix}}</h4>
|
||||||
<!-- <p class="card-category">{{'DATASET-LISTING.SUBTITLE' | translate}}</p> -->
|
<!-- <p class="card-category">{{'DATASET-LISTING.SUBTITLE' | translate}}</p> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="row ml-auto p-2">
|
<div class="row ml-auto p-2" *ngIf="!isPublic">
|
||||||
<button mat-raised-button color="primary" class="text-uppercase lightblue-btn" [routerLink]="['/datasets/new']">
|
<button mat-raised-button color="primary" class="text-uppercase lightblue-btn" [routerLink]="['/datasets/new']">
|
||||||
<mat-icon>add</mat-icon> {{'DATASET-LISTING.ACTIONS.NEW' | translate}}
|
<mat-icon>add</mat-icon> {{'DATASET-LISTING.ACTIONS.NEW' | translate}}
|
||||||
</button>
|
</button>
|
||||||
|
@ -15,11 +21,11 @@
|
||||||
<div class="card-body table-responsive">
|
<div class="card-body table-responsive">
|
||||||
<div class="listing row pb-2">
|
<div class="listing row pb-2">
|
||||||
<div class="col-12 col-sm-12 col-md-3">
|
<div class="col-12 col-sm-12 col-md-3">
|
||||||
<app-dataset-criteria-component [status]="status" class="col-auto"></app-dataset-criteria-component>
|
<app-dataset-criteria-component [isPublic]="isPublic" [status]="status" class="col-auto"></app-dataset-criteria-component>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-12 col-md-9 pt-4">
|
<div class="col-12 col-sm-12 col-md-9 pt-4">
|
||||||
<div *ngFor="let item of listingItems; let i = index">
|
<div *ngFor="let item of listingItems; let i = index">
|
||||||
<app-dataset-listing-item-component [dataset]="item" [showDivider]="i != (listingItems.length - 1)"></app-dataset-listing-item-component>
|
<app-dataset-listing-item-component [isPublic]="isPublic" [dataset]="item" [showDivider]="i != (listingItems.length - 1)"></app-dataset-listing-item-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-image {
|
||||||
|
background: url("/assets/images/new-dashboard-bg.png") no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
margin-top: 70px;
|
||||||
|
min-height: 15em;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text-container {
|
||||||
|
background: rgba(255, 255, 255, 0.7);
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
padding-left: 5em;
|
||||||
|
padding-right: 10em;
|
||||||
|
padding-top: 2em;
|
||||||
|
padding-bottom: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.explore-dmp-content {
|
||||||
|
padding: 30px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
::ng-deep .mat-paginator-container {
|
::ng-deep .mat-paginator-container {
|
||||||
flex-direction: row-reverse !important;
|
flex-direction: row-reverse !important;
|
||||||
justify-content: space-between !important;
|
justify-content: space-between !important;
|
||||||
|
|
|
@ -17,6 +17,8 @@ import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { ExternalTagEditorModel } from '../dataset-wizard/dataset-wizard-editor.model';
|
import { ExternalTagEditorModel } from '../dataset-wizard/dataset-wizard-editor.model';
|
||||||
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
import { isNullOrUndefined } from 'util';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-listing-component',
|
selector: 'app-dataset-listing-component',
|
||||||
|
@ -38,17 +40,24 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
dmpSearchEnabled = true;
|
dmpSearchEnabled = true;
|
||||||
listingItems: DatasetListingModel[] = [];
|
listingItems: DatasetListingModel[] = [];
|
||||||
|
|
||||||
|
isPublic: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private datasetService: DatasetService,
|
private datasetService: DatasetService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private dmpService: DmpService,
|
private dmpService: DmpService,
|
||||||
private language: TranslateService,
|
private language: TranslateService,
|
||||||
|
private authService: AuthService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.isPublic = this.router.url === '/explore';
|
||||||
|
if (!this.isPublic && isNullOrUndefined(this.authService.current())) {
|
||||||
|
this.router.navigateByUrl("/explore");
|
||||||
|
}
|
||||||
this.route.params
|
this.route.params
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(async (params: Params) => {
|
.subscribe(async (params: Params) => {
|
||||||
|
@ -78,7 +87,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
this.breadCrumbs = observableOf([{
|
this.breadCrumbs = observableOf([{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'),
|
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'),
|
||||||
url: "/datasets"
|
url: this.isPublic ? "/explore" : "/datasets"
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +135,13 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
if (value.datasetTemplates) {
|
if (value.datasetTemplates) {
|
||||||
request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id)
|
request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id)
|
||||||
}
|
}
|
||||||
|
if(value.grantStatus) {
|
||||||
|
request.criteria.grantStatus = value.grantStatus;
|
||||||
|
}
|
||||||
|
request.criteria.isPublic = this.isPublic;
|
||||||
|
if (this.isPublic) {
|
||||||
|
request.criteria.allVersions = true;
|
||||||
|
}
|
||||||
// if (this.itemId) {
|
// if (this.itemId) {
|
||||||
// // request.criteria.groupIds = [this.itemId];
|
// // request.criteria.groupIds = [this.itemId];
|
||||||
// request.criteria.allVersions = true;
|
// request.criteria.allVersions = true;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="listing-item" *ngIf="!isDeleted">
|
<div class="listing-item" *ngIf="!isDeleted">
|
||||||
<a [routerLink]="['/datasets/edit/' + dataset.id]">
|
<a [routerLink]="getItemLink()">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 gray-container container-header">
|
<div class="col-12 gray-container container-header">
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
<div matTooltip="{{ dataset.profile }}" class="chip ml-2 mr-2">{{ dataset.profile }}</div>
|
<div matTooltip="{{ dataset.profile }}" class="chip ml-2 mr-2">{{ dataset.profile }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row" *ngIf="!isPublic">
|
||||||
<mat-icon matTooltip="{{'DATASET-LISTING.TOOLTIP.VERSION' | translate}}" class="col-auto gray-icon pr-0 pt-2">
|
<mat-icon matTooltip="{{'DATASET-LISTING.TOOLTIP.VERSION' | translate}}" class="col-auto gray-icon pr-0 pt-2">
|
||||||
history
|
history
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
|
|
|
@ -12,6 +12,7 @@ export class DatasetListingItemComponent implements OnInit {
|
||||||
|
|
||||||
@Input() dataset: DatasetListingModel;
|
@Input() dataset: DatasetListingModel;
|
||||||
@Input() showDivider: boolean = true;
|
@Input() showDivider: boolean = true;
|
||||||
|
@Input() isPublic: boolean = false;
|
||||||
@Output() onClick: EventEmitter<DatasetListingModel> = new EventEmitter();
|
@Output() onClick: EventEmitter<DatasetListingModel> = new EventEmitter();
|
||||||
|
|
||||||
isDraft: boolean;
|
isDraft: boolean;
|
||||||
|
@ -32,6 +33,10 @@ export class DatasetListingItemComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getItemLink(): string[] {
|
||||||
|
return this.isPublic ? [`/datasets/publicEdit/${this.dataset.id}`] : [`/datasets/edit/${this.dataset.id}`];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// grantClicked(dataset: DatasetListingModel) {
|
// grantClicked(dataset: DatasetListingModel) {
|
||||||
// this.router.navigate(['/grants/edit/' + dataset.grantId]);
|
// this.router.navigate(['/grants/edit/' + dataset.grantId]);
|
||||||
|
|
Loading…
Reference in New Issue