Compare commits
2 Commits
master
...
Remove_exp
Author | SHA1 | Date |
---|---|---|
George Kalampokis | d5374d41b4 | 4 years ago |
George Kalampokis | c93f8eda52 | 4 years ago |
@ -1,56 +0,0 @@
|
|||||||
package eu.eudat.data.query.items.table.dataset;
|
|
||||||
|
|
||||||
import eu.eudat.data.dao.criteria.DatasetPublicCriteria;
|
|
||||||
import eu.eudat.data.entities.Dataset;
|
|
||||||
import eu.eudat.data.query.definition.TableQuery;
|
|
||||||
import eu.eudat.queryable.QueryableList;
|
|
||||||
import eu.eudat.queryable.types.FieldSelectionType;
|
|
||||||
import eu.eudat.queryable.types.SelectionField;
|
|
||||||
import eu.eudat.types.grant.GrantStateType;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by ikalyvas on 10/2/2018.
|
|
||||||
*/
|
|
||||||
public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria, Dataset, UUID> {
|
|
||||||
@Override
|
|
||||||
public QueryableList<Dataset> applyCriteria() {
|
|
||||||
QueryableList<Dataset> query = this.getQuery();
|
|
||||||
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 (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
|
||||||
query.where((builder, root) -> builder.or(
|
|
||||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
|
||||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
|
||||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
|
||||||
query.where(((builder, root) -> root.get("dmp").get("grant").get("id").in(this.getCriteria().getGrants())));
|
|
||||||
if (this.getCriteria().getGrantStatus() != null) {
|
|
||||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.FINISHED.getValue()))
|
|
||||||
query.where((builder, root) -> builder.lessThan(root.get("dmp").get("grant").get("enddate"), new Date()));
|
|
||||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.ONGOING.getValue()))
|
|
||||||
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 (this.getCriteria().getDmpIds() != null && !this.getCriteria().getDmpIds().isEmpty()) {
|
|
||||||
query.where(((builder, root) -> root.get("dmp").get("id").in(this.getCriteria().getDmpIds())));
|
|
||||||
}
|
|
||||||
if (this.getCriteria().getDatasetProfile() != null && !this.getCriteria().getDatasetProfile().isEmpty()) query
|
|
||||||
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().getDatasetProfile())));
|
|
||||||
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty()) query
|
|
||||||
.where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
|
||||||
query.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()));
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryableList<Dataset> applyPaging(QueryableList<Dataset> items) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
package eu.eudat.data.query.items.table.dmp;
|
|
||||||
|
|
||||||
import eu.eudat.data.dao.criteria.DataManagementPlanPublicCriteria;
|
|
||||||
import eu.eudat.data.entities.DMP;
|
|
||||||
import eu.eudat.data.query.PaginationService;
|
|
||||||
import eu.eudat.data.query.definition.TableQuery;
|
|
||||||
import eu.eudat.queryable.QueryableList;
|
|
||||||
import eu.eudat.queryable.types.FieldSelectionType;
|
|
||||||
import eu.eudat.queryable.types.SelectionField;
|
|
||||||
import eu.eudat.types.grant.GrantStateType;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class DataManagmentPlanPublicTableRequest extends TableQuery<DataManagementPlanPublicCriteria, DMP, UUID> {
|
|
||||||
|
|
||||||
public QueryableList<DMP> applyCriteria() {
|
|
||||||
QueryableList<DMP> query = this.getQuery();
|
|
||||||
query.where((builder, root) -> builder.equal(root.get("isPublic"), true));
|
|
||||||
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
|
||||||
query.where((builder, root) -> builder.or(
|
|
||||||
builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"),
|
|
||||||
builder.like(builder.upper(root.get("description")), "%" + this.getCriteria().getLike().toUpperCase() + "%")));
|
|
||||||
if (this.getCriteria().getGrants() != null && !this.getCriteria().getGrants().isEmpty())
|
|
||||||
query.where(((builder, root) -> root.get("grant").get("id").in(this.getCriteria().getGrants())));
|
|
||||||
if (this.getCriteria().getGrantStatus() != null) {
|
|
||||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.FINISHED.getValue()))
|
|
||||||
query.where((builder, root) -> builder.lessThan(root.get("grant").get("enddate"), new Date()));
|
|
||||||
if (this.getCriteria().getGrantStatus().getValue().equals(GrantStateType.ONGOING.getValue()))
|
|
||||||
query.where((builder, root) ->
|
|
||||||
builder.or(builder.greaterThan(root.get("grant").get("enddate"), new Date())
|
|
||||||
, builder.isNull(root.get("grant").get("enddate"))));
|
|
||||||
}
|
|
||||||
if (this.getCriteria().datasetProfile != null && !this.getCriteria().datasetProfile.isEmpty())
|
|
||||||
query.where((builder, root) -> root.join("associatedDmps").get("id").in(this.getCriteria().datasetProfile));
|
|
||||||
if (this.getCriteria().getDmpOrganisations() != null && !this.getCriteria().getDmpOrganisations().isEmpty())
|
|
||||||
query.where(((builder, root) -> root.join("organisations").get("reference").in(this.getCriteria().getDmpOrganisations())));
|
|
||||||
if (!this.getCriteria().getAllVersions()) {
|
|
||||||
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("version"),
|
|
||||||
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.and(builder1.equal(externalRoot.get("groupId"),
|
|
||||||
nestedRoot.get("groupId")), builder1.equal(nestedRoot.get("isPublic"), true)), Arrays.asList(new SelectionField(FieldSelectionType.FIELD, "version")), String.class)));
|
|
||||||
}
|
|
||||||
if (this.getCriteria().getGroupIds() != null && !this.getCriteria().getGroupIds().isEmpty()) {
|
|
||||||
query.where((builder, root) -> root.get("groupId").in(this.getCriteria().getGroupIds()));
|
|
||||||
}
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryableList<DMP> applyPaging(QueryableList<DMP> items) {
|
|
||||||
return PaginationService.applyPaging(items, this);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import eu.eudat.data.entities.UserInfo;
|
|
||||||
|
|
||||||
public class ContactRDAExportModel {
|
|
||||||
private String mbox;
|
|
||||||
private String name;
|
|
||||||
private IdRDAExportModel contact_id;
|
|
||||||
|
|
||||||
public String getMbox() {
|
|
||||||
return mbox;
|
|
||||||
}
|
|
||||||
public void setMbox(String mbox) {
|
|
||||||
this.mbox = mbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdRDAExportModel getContact_id() {
|
|
||||||
return contact_id;
|
|
||||||
}
|
|
||||||
public void setContact_id(IdRDAExportModel contact_id) {
|
|
||||||
this.contact_id = contact_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContactRDAExportModel fromDataModel(UserInfo entity) {
|
|
||||||
ContactRDAExportModel contact = new ContactRDAExportModel();
|
|
||||||
contact.mbox = entity.getEmail();
|
|
||||||
contact.name = entity.getName();
|
|
||||||
// TODO: we should use a contact_id and not our UUID.
|
|
||||||
if (!entity.getId().toString().isEmpty()) {
|
|
||||||
contact.contact_id = new IdRDAExportModel(entity.getId().toString(), "other");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
contact.contact_id = null;
|
|
||||||
}
|
|
||||||
return contact;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DatasetDistributionRDAExportModel {
|
|
||||||
private String access_url;
|
|
||||||
private String available_till;
|
|
||||||
private String byte_size;
|
|
||||||
private String data_access; // Allowed values: open / shared / closed
|
|
||||||
private String description;
|
|
||||||
private String download_url;
|
|
||||||
private List<String> format; // Format according to: https://www.iana.org/assignments/media-types/media-types.xhtml if appropriate, otherwise use the common name for this format
|
|
||||||
private HostRDAExportModel host;
|
|
||||||
private List<LicenseRDAExportModel> license;
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
public String getAccess_url() {
|
|
||||||
return access_url;
|
|
||||||
}
|
|
||||||
public void setAccess_url(String access_url) {
|
|
||||||
this.access_url = access_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvailable_till() {
|
|
||||||
return available_till;
|
|
||||||
}
|
|
||||||
public void setAvailable_till(String available_till) {
|
|
||||||
this.available_till = available_till;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getByte_size() {
|
|
||||||
return byte_size;
|
|
||||||
}
|
|
||||||
public void setByte_size(String byte_size) {
|
|
||||||
this.byte_size = byte_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getData_access() {
|
|
||||||
return data_access;
|
|
||||||
}
|
|
||||||
public void setData_access(String data_access) {
|
|
||||||
this.data_access = data_access;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDownload_url() {
|
|
||||||
return download_url;
|
|
||||||
}
|
|
||||||
public void setDownload_url(String download_url) {
|
|
||||||
this.download_url = download_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getFormat() {
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
public void setFormat(List<String> format) {
|
|
||||||
this.format = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HostRDAExportModel getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
public void setHost(HostRDAExportModel host) {
|
|
||||||
this.host = host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<LicenseRDAExportModel> getLicense() {
|
|
||||||
return license;
|
|
||||||
}
|
|
||||||
public void setLicense(List<LicenseRDAExportModel> license) {
|
|
||||||
this.license = license;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
public boolean isValid() {
|
|
||||||
return title != null || data_access != null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
|
|
||||||
public class DatasetMetadataRDAExportModel {
|
|
||||||
private String description; // Not mandatory.
|
|
||||||
private String language;
|
|
||||||
private IdRDAExportModel metadata_standard_id;
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdRDAExportModel getMetadata_standard_id() {
|
|
||||||
return metadata_standard_id;
|
|
||||||
}
|
|
||||||
public void setMetadata_standard_id(IdRDAExportModel metadata_standard_id) {
|
|
||||||
this.metadata_standard_id = metadata_standard_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatasetMetadataRDAExportModel fromDataModel(String key, Object value) {
|
|
||||||
DatasetMetadataRDAExportModel metadataRDAExportModel = new DatasetMetadataRDAExportModel();
|
|
||||||
if (key.contains("metadata_standard_id"))
|
|
||||||
metadataRDAExportModel.setMetadata_standard_id(new IdRDAExportModel(value.toString(), "other"));
|
|
||||||
else if (key.contains("language"))
|
|
||||||
metadataRDAExportModel.setLanguage(value.toString());
|
|
||||||
else if (key.contains("description"))
|
|
||||||
metadataRDAExportModel.setDescription(value.toString());
|
|
||||||
|
|
||||||
return metadataRDAExportModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
public boolean isValid() {
|
|
||||||
return description != null || language != null || metadata_standard_id != null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,474 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.jayway.jsonpath.JsonPath;
|
|
||||||
import eu.eudat.data.entities.Dataset;
|
|
||||||
import eu.eudat.logic.managers.DatasetManager;
|
|
||||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
|
||||||
import eu.eudat.models.data.security.Principal;
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import javax.xml.xpath.*;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static java.util.stream.Collectors.groupingBy;
|
|
||||||
|
|
||||||
public class DatasetRDAExportModel {
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DatasetRDAExportModel.class);
|
|
||||||
|
|
||||||
private static final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
private Map<String, String> multiplicityIdToFieldSetId = new HashMap<>();
|
|
||||||
|
|
||||||
private List<String> data_quality_assurance;
|
|
||||||
private IdRDAExportModel dataset_id;
|
|
||||||
private String description;
|
|
||||||
private List<DatasetDistributionRDAExportModel> distribution;
|
|
||||||
private String issued; // Created Date, could also use finalized one.
|
|
||||||
private List<String> keyword;
|
|
||||||
private String language;
|
|
||||||
private List<DatasetMetadataRDAExportModel> metadata;
|
|
||||||
private String personal_data; // Allowed Values: yes no unknown.
|
|
||||||
private String preservation_statement;
|
|
||||||
private List<DatasetSecurityAndPrivacyRDAExportModel> security_and_privacy;
|
|
||||||
private String sensitive_data; // Allowed Values: yes no unknown.
|
|
||||||
private List<DatasetTechnicalResourceRDAExportModel> technical_resource;
|
|
||||||
private String title;
|
|
||||||
private String type; // Type according to: http://vocabularies.coar-repositories.org/pubby/resource_type.html
|
|
||||||
|
|
||||||
public List<String> getData_quality_assurance() {
|
|
||||||
return data_quality_assurance;
|
|
||||||
}
|
|
||||||
public void setData_quality_assurance(List<String> data_quality_assurance) {
|
|
||||||
this.data_quality_assurance = data_quality_assurance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdRDAExportModel getDataset_id() {
|
|
||||||
return dataset_id;
|
|
||||||
}
|
|
||||||
public void setDataset_id(IdRDAExportModel dataset_id) {
|
|
||||||
this.dataset_id = dataset_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DatasetDistributionRDAExportModel> getDistribution() {
|
|
||||||
return distribution;
|
|
||||||
}
|
|
||||||
public void setDistribution(List<DatasetDistributionRDAExportModel> distribution) {
|
|
||||||
this.distribution = distribution;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIssued() {
|
|
||||||
return issued;
|
|
||||||
}
|
|
||||||
public void setIssued(String issued) {
|
|
||||||
this.issued = issued;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getKeyword() {
|
|
||||||
return keyword;
|
|
||||||
}
|
|
||||||
public void setKeyword(List<String> keyword) {
|
|
||||||
this.keyword = keyword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DatasetMetadataRDAExportModel> getMetadata() {
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
public void setMetadata(List<DatasetMetadataRDAExportModel> metadata) {
|
|
||||||
this.metadata = metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPersonal_data() {
|
|
||||||
return personal_data;
|
|
||||||
}
|
|
||||||
public void setPersonal_data(String personal_data) {
|
|
||||||
this.personal_data = personal_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPreservation_statement() {
|
|
||||||
return preservation_statement;
|
|
||||||
}
|
|
||||||
public void setPreservation_statement(String preservation_statement) {
|
|
||||||
this.preservation_statement = preservation_statement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DatasetSecurityAndPrivacyRDAExportModel> getSecurity_and_privacy() {
|
|
||||||
return security_and_privacy;
|
|
||||||
}
|
|
||||||
public void setSecurity_and_privacy(List<DatasetSecurityAndPrivacyRDAExportModel> security_and_privacy) {
|
|
||||||
this.security_and_privacy = security_and_privacy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSensitive_data() {
|
|
||||||
return sensitive_data;
|
|
||||||
}
|
|
||||||
public void setSensitive_data(String sensitive_data) {
|
|
||||||
this.sensitive_data = sensitive_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DatasetTechnicalResourceRDAExportModel> getTechnical_resource() {
|
|
||||||
return technical_resource;
|
|
||||||
}
|
|
||||||
public void setTechnical_resource(List<DatasetTechnicalResourceRDAExportModel> technical_resource) {
|
|
||||||
this.technical_resource = technical_resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DatasetRDAExportModel fromDataModel(Dataset dataset, DatasetManager datasetManager, Principal principal) {
|
|
||||||
// Map of template Ids to rda values.
|
|
||||||
JSONObject jObject = new JSONObject(dataset.getProperties());
|
|
||||||
Map<String, Object> templateIdsToValues = jObject.toMap();
|
|
||||||
|
|
||||||
/*--------- Building dataset rda export model ---------*/
|
|
||||||
DatasetRDAExportModel datasetRDAExportModel = new DatasetRDAExportModel();
|
|
||||||
datasetRDAExportModel.setDataset_id(new IdRDAExportModel(dataset.getId().toString(), "other"));
|
|
||||||
if (dataset.getDescription() != null) datasetRDAExportModel.setDescription(dataset.getDescription().replace("\n", " "));
|
|
||||||
datasetRDAExportModel.setIssued(DateFormat.getDateInstance(DateFormat.SHORT).format(dataset.getCreated()));
|
|
||||||
datasetRDAExportModel.setLanguage("en"); // mock data
|
|
||||||
datasetRDAExportModel.setTitle(dataset.getLabel());
|
|
||||||
|
|
||||||
// Transform the answered dataset description to json so we can parse it and fill the rda model.
|
|
||||||
JSONObject datasetDescriptionJson = null;
|
|
||||||
try {
|
|
||||||
String jsonResult = mapper.writeValueAsString(datasetManager.getSingle(dataset.getId().toString(), principal).getDatasetProfileDefinition());
|
|
||||||
datasetDescriptionJson = new JSONObject(jsonResult);
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
setMultiplicityIdToFieldSetId(datasetDescriptionJson);
|
|
||||||
|
|
||||||
/*--------- Building personal data. ---------*/
|
|
||||||
String personalData = buildSingleProperties("dataset.personal_data", datasetDescriptionJson, templateIdsToValues);
|
|
||||||
if (personalData != null) {
|
|
||||||
datasetRDAExportModel.setPersonal_data(personalData);
|
|
||||||
} else {
|
|
||||||
datasetRDAExportModel.setPersonal_data("unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*--------- Building preservation statement. ---------*/
|
|
||||||
datasetRDAExportModel.setPreservation_statement(buildSingleProperties("dataset.preservation_statement", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
|
|
||||||
/*--------- Building sensitive data. ---------*/
|
|
||||||
String sensitiveData = buildSingleProperties("dataset.sensitive_data", datasetDescriptionJson, templateIdsToValues);
|
|
||||||
if (personalData != null) {
|
|
||||||
datasetRDAExportModel.setSensitive_data(sensitiveData);
|
|
||||||
} else {
|
|
||||||
datasetRDAExportModel.setSensitive_data("unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*--------- Building type. ---------*/
|
|
||||||
datasetRDAExportModel.setType(buildSingleProperties("dataset.type", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
|
|
||||||
/*--------- Building data_quality_assurance. ---------*/
|
|
||||||
datasetRDAExportModel.setData_quality_assurance(buildDataQualityAssurance(datasetDescriptionJson, templateIdsToValues, dataset.getProfile().getDefinition()));
|
|
||||||
|
|
||||||
/*--------- Building distribution. ---------*/
|
|
||||||
datasetRDAExportModel.setDistribution(buildDistribution(datasetDescriptionJson, templateIdsToValues, dataset.getProfile().getDefinition()));
|
|
||||||
|
|
||||||
/*--------- Building keywords. ---------*/
|
|
||||||
datasetRDAExportModel.setKeyword(buildKeywords(datasetDescriptionJson, templateIdsToValues, dataset.getProfile().getDefinition()));
|
|
||||||
|
|
||||||
/*--------- Building metadata items. ---------*/
|
|
||||||
datasetRDAExportModel.setMetadata(buildMetadata(datasetDescriptionJson, templateIdsToValues, dataset.getProfile().getDefinition()));
|
|
||||||
|
|
||||||
/*--------- Building security and privacy items. ---------*/
|
|
||||||
datasetRDAExportModel.setSecurity_and_privacy(buildSecurityAndPrivacy(datasetDescriptionJson, templateIdsToValues, dataset.getProfile().getDefinition()));
|
|
||||||
|
|
||||||
/*--------- Building technical_resource. ---------*/
|
|
||||||
datasetRDAExportModel.setTechnical_resource(buildTechnicalResource(datasetDescriptionJson, templateIdsToValues, dataset.getProfile().getDefinition()));
|
|
||||||
|
|
||||||
return datasetRDAExportModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildSingleProperties(String rdaKey, JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues) {
|
|
||||||
String expression = "$..fields[*][?(@.rdaProperty == \"" + rdaKey + "\" )].id";
|
|
||||||
List<String> list = jsonValueListFromExpression(datasetDescriptionJson, expression);
|
|
||||||
if (!list.isEmpty()) {
|
|
||||||
return templateIdsToValues.get(list.get(0)).toString();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> buildDataQualityAssurance(JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues, String datasetProfileDefinition) {
|
|
||||||
List<RdaField> dataQualityFields = getRDAFieldsFromJson(datasetDescriptionJson, new String[]{"dataset.data_quality_assurance"}, datasetProfileDefinition);
|
|
||||||
for (RdaField rdaField : dataQualityFields) {
|
|
||||||
rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString());
|
|
||||||
}
|
|
||||||
List<String> dataQualityAssuranceList = new LinkedList<>();
|
|
||||||
for (RdaField rdaField : dataQualityFields) {
|
|
||||||
dataQualityAssuranceList.add(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
return dataQualityAssuranceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DatasetDistributionRDAExportModel> buildDistribution(JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues, String datasetProfileDefinition) {
|
|
||||||
DatasetDistributionRDAExportModel distributionModel = new DatasetDistributionRDAExportModel();
|
|
||||||
distributionModel.setAccess_url(buildSingleProperties("dataset.distribution.access_url", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
distributionModel.setAvailable_till(buildSingleProperties("dataset.distribution.available_till", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
distributionModel.setByte_size(buildSingleProperties("dataset.distribution.byte_size", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
distributionModel.setData_access(buildSingleProperties("dataset.distribution.data_access", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
distributionModel.setDescription(buildSingleProperties("dataset.distribution.description", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
distributionModel.setDownload_url(buildSingleProperties("dataset.distribution.download_url", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
distributionModel.setTitle(buildSingleProperties("dataset.distribution.title", datasetDescriptionJson, templateIdsToValues));
|
|
||||||
|
|
||||||
/*--------- Building format. ---------*/
|
|
||||||
|
|
||||||
|
|
||||||
// We currently support the return of only one distribution.
|
|
||||||
List<DatasetDistributionRDAExportModel> distributionList = new LinkedList<>();
|
|
||||||
if (distributionModel.isValid()) {
|
|
||||||
distributionList.add(distributionModel);
|
|
||||||
} else {
|
|
||||||
DatasetDistributionRDAExportModel model = new DatasetDistributionRDAExportModel();
|
|
||||||
model.setDescription("Distribution data was not valid");
|
|
||||||
distributionList.add(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
return distributionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> buildKeywords(JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues, String datasetProfileDefinition) {
|
|
||||||
List<RdaField> keywordFields = getRDAFieldsFromJson(datasetDescriptionJson, new String[]{"dataset.keyword"}, datasetProfileDefinition);
|
|
||||||
for (RdaField rdaField : keywordFields) {
|
|
||||||
rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString());
|
|
||||||
}
|
|
||||||
List<String> keywordsList = new LinkedList<>();
|
|
||||||
for (RdaField rdaField : keywordFields) {
|
|
||||||
keywordsList.add(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
return keywordsList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DatasetMetadataRDAExportModel> buildMetadata(JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues, String datasetProfileDefinition) {
|
|
||||||
List<RdaField> metadataFields = getRDAFieldsFromJson(datasetDescriptionJson,
|
|
||||||
new String[]{"dataset.metadata.metadata_standard_id.type", "dataset.metadata.metadata_standard_id.identifier", "dataset.metadata.description", "dataset.metadata.language", "dataset.metadata.metadata_standard_id"},
|
|
||||||
datasetProfileDefinition);
|
|
||||||
|
|
||||||
// Adding rdaValue and FieldSetIds on metadataFields.
|
|
||||||
for (RdaField rdaField : metadataFields) {
|
|
||||||
rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString());
|
|
||||||
}
|
|
||||||
// Group metadataFields based on their field set id.
|
|
||||||
Map<String, List<RdaField>> groupedMetadataFields = metadataFields.stream().collect(groupingBy(RdaField::getFieldSetId));
|
|
||||||
|
|
||||||
// Creating the metadata.
|
|
||||||
List<DatasetMetadataRDAExportModel> metadataRDAExportModelList = new LinkedList<>();
|
|
||||||
for (String fieldSetId : groupedMetadataFields.keySet()) {
|
|
||||||
DatasetMetadataRDAExportModel metadataRda = new DatasetMetadataRDAExportModel();
|
|
||||||
for (RdaField rdaField : groupedMetadataFields.get(fieldSetId)) {
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.metadata.metadata_standard_id.identifier")) {
|
|
||||||
if (metadataRda.getMetadata_standard_id() != null) {
|
|
||||||
metadataRda.getMetadata_standard_id().setIdentifier(rdaField.getRdaValue());
|
|
||||||
} else {
|
|
||||||
metadataRda.setMetadata_standard_id(new IdRDAExportModel(rdaField.getRdaValue(), "other"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.metadata.metadata_standard_id.type")) {
|
|
||||||
if (metadataRda.getMetadata_standard_id() != null) {
|
|
||||||
metadataRda.getMetadata_standard_id().setType(rdaField.getRdaValue());
|
|
||||||
} else {
|
|
||||||
metadataRda.setMetadata_standard_id(new IdRDAExportModel("", rdaField.getRdaValue()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.metadata.description")) {
|
|
||||||
metadataRda.setDescription(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.metadata.language")) {
|
|
||||||
metadataRda.setLanguage(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.metadata.metadata_standard_id") && !rdaField.getRdaValue().isEmpty()) {
|
|
||||||
JSONArray jsonArray = new JSONArray(rdaField.getRdaValue());
|
|
||||||
for (int i = 0; i < jsonArray.length(); i++) {
|
|
||||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
||||||
Map<String, Object> jsonObjectMap = jsonObject.toMap();
|
|
||||||
DatasetMetadataRDAExportModel metadataRda1 = new DatasetMetadataRDAExportModel();
|
|
||||||
// metadataRda1.setMetadata_standard_id(new IdRDAExportModel(jsonObjectMap.get("label").toString(), jsonObjectMap.get("source").toString()));
|
|
||||||
metadataRda1.setMetadata_standard_id(new IdRDAExportModel(jsonObjectMap.get("uri").toString(), "url"));
|
|
||||||
metadataRDAExportModelList.add(metadataRda1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (metadataRda.isValid()) {
|
|
||||||
metadataRDAExportModelList.add(metadataRda);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new LinkedList<>(metadataRDAExportModelList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DatasetSecurityAndPrivacyRDAExportModel> buildSecurityAndPrivacy(JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues, String datasetProfileDefinition) {
|
|
||||||
List<RdaField> secAndPrFields = getRDAFieldsFromJson(
|
|
||||||
datasetDescriptionJson,
|
|
||||||
new String[]{"dataset.security_and_privacy.description", "dataset.security_and_privacy.title", "dataset.security_and_privacy"},
|
|
||||||
datasetProfileDefinition);
|
|
||||||
for (RdaField rdaField : secAndPrFields) {
|
|
||||||
rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString());
|
|
||||||
}
|
|
||||||
Map<String, List<RdaField>> groupedSecurityAndPrivacyFields = secAndPrFields.stream().collect(groupingBy(RdaField::getFieldSetId));
|
|
||||||
|
|
||||||
List<DatasetSecurityAndPrivacyRDAExportModel> securityAndPrivacyRDAExportModelList = new LinkedList<>();
|
|
||||||
for (String fieldSetId : groupedSecurityAndPrivacyFields.keySet()) {
|
|
||||||
DatasetSecurityAndPrivacyRDAExportModel securityAndPrivacyModel = new DatasetSecurityAndPrivacyRDAExportModel();
|
|
||||||
for (RdaField rdaField : groupedSecurityAndPrivacyFields.get(fieldSetId)) {
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.security_and_privacy.description")) {
|
|
||||||
securityAndPrivacyModel.setDescription(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.security_and_privacy.title")) {
|
|
||||||
securityAndPrivacyModel.setTitle(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.security_and_privacy")) {
|
|
||||||
JSONArray jsonArray = new JSONArray(rdaField.getRdaValue());
|
|
||||||
for (int i = 0; i < jsonArray.length(); i++) {
|
|
||||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
||||||
Map<String, Object> jsonObjectMap = jsonObject.toMap();
|
|
||||||
DatasetSecurityAndPrivacyRDAExportModel secAndPrivacy = new DatasetSecurityAndPrivacyRDAExportModel(jsonObjectMap.get("label").toString(), jsonObjectMap.get("source").toString());
|
|
||||||
securityAndPrivacyRDAExportModelList.add(secAndPrivacy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
securityAndPrivacyRDAExportModelList.add(securityAndPrivacyModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return securityAndPrivacyRDAExportModelList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DatasetTechnicalResourceRDAExportModel> buildTechnicalResource(JSONObject datasetDescriptionJson, Map<String, Object> templateIdsToValues, String datasetProfileDefinition) {
|
|
||||||
List<RdaField> dataQualityFields = getRDAFieldsFromJson(datasetDescriptionJson,
|
|
||||||
new String[]{"dataset.technical_resource.technical_resource", "dataset.technical_resource.technical_resource.description", "dataset.technical_resource.technical_resource.name"},
|
|
||||||
datasetProfileDefinition);
|
|
||||||
for (RdaField rdaField : dataQualityFields) {
|
|
||||||
rdaField.setRdaValue(templateIdsToValues.get(rdaField.getFieldId()).toString());
|
|
||||||
}
|
|
||||||
List<DatasetTechnicalResourceRDAExportModel> technicalResourceList = new LinkedList<>();
|
|
||||||
Map<String, List<RdaField>> groupedDataQualityFields = dataQualityFields.stream().collect(groupingBy(RdaField::getFieldSetId));
|
|
||||||
for (String fieldSetId : groupedDataQualityFields.keySet()) {
|
|
||||||
DatasetTechnicalResourceRDAExportModel technicalResourceModel = new DatasetTechnicalResourceRDAExportModel();
|
|
||||||
for (RdaField rdaField : groupedDataQualityFields.get(fieldSetId)) {
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.technical_resource.technical_resource.description")) {
|
|
||||||
technicalResourceModel.setDescription(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.technical_resource.technical_resource.name")) {
|
|
||||||
technicalResourceModel.setName(rdaField.getRdaValue());
|
|
||||||
}
|
|
||||||
if (rdaField.getRdaProperty().equals("dataset.security_and_privacy")) {
|
|
||||||
JSONArray jsonArray = new JSONArray(rdaField.getRdaValue());
|
|
||||||
for (int i = 0; i < jsonArray.length(); i++) {
|
|
||||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
||||||
Map<String, Object> jsonObjectMap = jsonObject.toMap();
|
|
||||||
DatasetTechnicalResourceRDAExportModel technicalResource = new DatasetTechnicalResourceRDAExportModel(jsonObjectMap.get("label").toString(), jsonObjectMap.get("label").toString());
|
|
||||||
technicalResourceList.add(technicalResource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
technicalResourceList.add(technicalResourceModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return technicalResourceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setMultiplicityIdToFieldSetId(JSONObject json) {
|
|
||||||
String multiplicityItemsFieldSetIdExp = "$..multiplicityItems[*].id";
|
|
||||||
List<String> multiplicityItemsFieldSetIdList = jsonValueListFromExpression(json, multiplicityItemsFieldSetIdExp);
|
|
||||||
for (String fieldSetId : multiplicityItemsFieldSetIdList) {
|
|
||||||
String fieldsFromFieldSetIdExp = "$..multiplicityItems[*][?(@.id == \""+ fieldSetId +"\")].fields[*].id";
|
|
||||||
List<String> fieldsIdList = jsonValueListFromExpression(json, fieldsFromFieldSetIdExp);
|
|
||||||
for (String fieldId : fieldsIdList) {
|
|
||||||
this.multiplicityIdToFieldSetId.put(fieldId, fieldSetId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<RdaField> getRDAFieldsFromJson(JSONObject json, String[] rdaKey, String datasetProfileDefinition) {
|
|
||||||
List<RdaField> rdaFields = new LinkedList<>();
|
|
||||||
for (String key : rdaKey) {
|
|
||||||
String fieldIdExpression = "$..fields[*][?(@.rdaProperty == \"" + key + "\" )].id";
|
|
||||||
List<String> listFromExpression = jsonValueListFromExpression(json, fieldIdExpression);
|
|
||||||
for (String fieldId : listFromExpression) {
|
|
||||||
RdaField rdaField = new RdaField();
|
|
||||||
rdaField.setRdaProperty(key);
|
|
||||||
rdaField.setFieldId(fieldId);
|
|
||||||
if (fieldId.startsWith("multiple_")) {
|
|
||||||
rdaField.setFieldSetId(this.multiplicityIdToFieldSetId.get(fieldId));
|
|
||||||
} else {
|
|
||||||
rdaField.setFieldSetId(getFieldSetIdForFieldFromXML(datasetProfileDefinition, fieldId));
|
|
||||||
}
|
|
||||||
rdaFields.add(rdaField);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rdaFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> jsonValueListFromExpression(JSONObject json, String expression) {
|
|
||||||
net.minidev.json.JSONArray jsonArray = JsonPath.parse(json.toString()).read(expression);
|
|
||||||
List<String> valueList = new LinkedList<>();
|
|
||||||
for (Object o : jsonArray) {
|
|
||||||
valueList.add(o.toString());
|
|
||||||
}
|
|
||||||
return valueList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getFieldSetIdForFieldFromXML(String datasetProfileDefinition, String fieldId) {
|
|
||||||
String fieldSetIdExpression = "//field[@id ='" + fieldId + "']/ancestor::fieldSet/@id";
|
|
||||||
List<String> listFromExpression = xmlValueListFromExpression(datasetProfileDefinition, fieldSetIdExpression);
|
|
||||||
if (listFromExpression.size() == 1) return listFromExpression.get(0);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> xmlValueListFromExpression(String xml, String expression) {
|
|
||||||
List<String> valuesList = new LinkedList<>();
|
|
||||||
Document document = XmlBuilder.fromXml(xml);
|
|
||||||
XPathFactory xpathFactory = XPathFactory.newInstance();
|
|
||||||
XPath xpath = xpathFactory.newXPath();
|
|
||||||
try {
|
|
||||||
XPathExpression expr = xpath.compile(expression);
|
|
||||||
NodeList nodeList = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
|
|
||||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
|
||||||
Node node = nodeList.item(i);
|
|
||||||
valuesList.add(node.getNodeValue());
|
|
||||||
}
|
|
||||||
} catch (XPathExpressionException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return valuesList;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class DatasetSecurityAndPrivacyRDAExportModel {
|
|
||||||
private String description;
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
public DatasetSecurityAndPrivacyRDAExportModel() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatasetSecurityAndPrivacyRDAExportModel(String description, String title) {
|
|
||||||
this.description = description;
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class DatasetTechnicalResourceRDAExportModel {
|
|
||||||
private String description;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatasetTechnicalResourceRDAExportModel(String description, String name) {
|
|
||||||
this.description = description;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatasetTechnicalResourceRDAExportModel() {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import eu.eudat.data.entities.UserInfo;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DmpContributorRDAExportModel {
|
|
||||||
private IdRDAExportModel contributor_id;
|
|
||||||
private String mbox;
|
|
||||||
private String name;
|
|
||||||
private List<String> role;
|
|
||||||
|
|
||||||
public IdRDAExportModel getContributor_id() {
|
|
||||||
return contributor_id;
|
|
||||||
}
|
|
||||||
public void setContributor_id(IdRDAExportModel contributor_id) {
|
|
||||||
this.contributor_id = contributor_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMbox() {
|
|
||||||
return mbox;
|
|
||||||
}
|
|
||||||
public void setMbox(String mbox) {
|
|
||||||
this.mbox = mbox;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getRole() {
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
public void setRole(List<String> role) {
|
|
||||||
this.role = role;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DmpContributorRDAExportModel fromDataModel(UserInfo user, String role) {
|
|
||||||
DmpContributorRDAExportModel contributor = new DmpContributorRDAExportModel();
|
|
||||||
contributor.contributor_id = new IdRDAExportModel(user.getId().toString(), "other");
|
|
||||||
contributor.mbox = user.getEmail();
|
|
||||||
contributor.name = user.getName();
|
|
||||||
contributor.role = new LinkedList<>();
|
|
||||||
contributor.role.add(role);
|
|
||||||
|
|
||||||
return contributor;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class DmpCostRDAExportModel {
|
|
||||||
private String currency_code; //Allowed values defined by ISO 4217.
|
|
||||||
private String description;
|
|
||||||
private String title;
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public String getCurrency_code() {
|
|
||||||
return currency_code;
|
|
||||||
}
|
|
||||||
public void setCurrency_code(String currency_code) {
|
|
||||||
this.currency_code = currency_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,164 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import eu.eudat.data.entities.DMP;
|
|
||||||
import eu.eudat.data.entities.Dataset;
|
|
||||||
import eu.eudat.data.entities.UserDMP;
|
|
||||||
import eu.eudat.data.entities.UserInfo;
|
|
||||||
import eu.eudat.logic.managers.DatasetManager;
|
|
||||||
import eu.eudat.models.data.security.Principal;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class DmpRDAExportModel {
|
|
||||||
private ContactRDAExportModel contact;
|
|
||||||
private List<DmpContributorRDAExportModel> contributor;
|
|
||||||
private List<DmpCostRDAExportModel> cost;
|
|
||||||
private String created;
|
|
||||||
private List<DatasetRDAExportModel> dataset;
|
|
||||||
private String description;
|
|
||||||
private IdRDAExportModel dmp_id;
|
|
||||||
private String ethical_issues_description;
|
|
||||||
private String ethical_issues_exist; // Allowed Values: yes no unknown.
|
|
||||||
private String ethical_issues_report;
|
|
||||||
private String language;
|
|
||||||
private String modified;
|
|
||||||
private ProjectRDAExportModel project;
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
public ContactRDAExportModel getContact() {
|
|
||||||
return contact;
|
|
||||||
}
|
|
||||||
public void setContact(ContactRDAExportModel contact) {
|
|
||||||
this.contact = contact;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DmpContributorRDAExportModel> getContributor() {
|
|
||||||
return contributor;
|
|
||||||
}
|
|
||||||
public void setContributor(List<DmpContributorRDAExportModel> contributor) {
|
|
||||||
this.contributor = contributor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DmpCostRDAExportModel> getCost() {
|
|
||||||
return cost;
|
|
||||||
}
|
|
||||||
public void setCost(List<DmpCostRDAExportModel> cost) {
|
|
||||||
this.cost = cost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreated() {
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
public void setCreated(String created) {
|
|
||||||
this.created = created;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DatasetRDAExportModel> getDataset() {
|
|
||||||
return dataset;
|
|
||||||
}
|
|
||||||
public void setDataset(List<DatasetRDAExportModel> dataset) {
|
|
||||||
this.dataset = dataset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdRDAExportModel getDmp_id() {
|
|
||||||
return dmp_id;
|
|
||||||
}
|
|
||||||
public void setDmp_id(IdRDAExportModel dmp_id) {
|
|
||||||
this.dmp_id = dmp_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEthical_issues_description() {
|
|
||||||
return ethical_issues_description;
|
|
||||||
}
|
|
||||||
public void setEthical_issues_description(String ethical_issues_description) {
|
|
||||||
this.ethical_issues_description = ethical_issues_description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEthical_issues_exist() {
|
|
||||||
return ethical_issues_exist;
|
|
||||||
}
|
|
||||||
public void setEthical_issues_exist(String ethical_issues_exist) {
|
|
||||||
this.ethical_issues_exist = ethical_issues_exist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEthical_issues_report() {
|
|
||||||
return ethical_issues_report;
|
|
||||||
}
|
|
||||||
public void setEthical_issues_report(String ethical_issues_report) {
|
|
||||||
this.ethical_issues_report = ethical_issues_report;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getModified() {
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
public void setModified(String modified) {
|
|
||||||
this.modified = modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectRDAExportModel getProject() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
public void setProject(ProjectRDAExportModel project) {
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DmpRDAExportModel fromDataModel(DMP entity, DatasetManager datasetManager, Principal principal) {
|
|
||||||
DmpRDAExportModel dmpRda = new DmpRDAExportModel();
|
|
||||||
dmpRda.contact = new ContactRDAExportModel().fromDataModel(entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
|
|
||||||
if (entity.getUsers().stream().anyMatch(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue()))) {
|
|
||||||
dmpRda.contributor = new LinkedList<>();
|
|
||||||
for (UserDMP userdmp : entity.getUsers().stream().filter(x -> x.getRole().equals(UserDMP.UserDMPRoles.USER.getValue())).collect(Collectors.toList())) {
|
|
||||||
dmpRda.contributor.add(new DmpContributorRDAExportModel().fromDataModel(userdmp.getUser(), UserDMP.UserDMPRoles.fromInteger(userdmp.getRole()).toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dmpRda.cost = null;
|
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
|
|
||||||
dmpRda.created = formatter.format(entity.getCreated());
|
|
||||||
dmpRda.dataset = new LinkedList<>();
|
|
||||||
for (Dataset dataset : entity.getDataset()) {
|
|
||||||
if (dataset.getStatus() != Dataset.Status.DELETED.getValue() && dataset.getStatus() != Dataset.Status.CANCELED.getValue())
|
|
||||||
dmpRda.dataset.add(new DatasetRDAExportModel().fromDataModel(dataset, datasetManager, principal));
|
|
||||||
}
|
|
||||||
dmpRda.description = entity.getDescription().replace("\n", " ");
|
|
||||||
if (entity.getDoi() != null) {
|
|
||||||
dmpRda.dmp_id = new IdRDAExportModel(entity.getDoi(), "zenodo");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dmpRda.dmp_id = new IdRDAExportModel(entity.getId().toString(), "other");
|
|
||||||
}
|
|
||||||
// Mock up data on "language" and "ethical_issues_*" for now.
|
|
||||||
dmpRda.ethical_issues_exist = "unknown";
|
|
||||||
dmpRda.language = "en";
|
|
||||||
dmpRda.modified = formatter.format(new Date());
|
|
||||||
dmpRda.project = new ProjectRDAExportModel().fromDataModel(entity.getGrant());
|
|
||||||
dmpRda.title = entity.getLabel();
|
|
||||||
|
|
||||||
return dmpRda;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import eu.eudat.data.entities.Funder;
|
|
||||||
import eu.eudat.data.entities.Grant;
|
|
||||||
|
|
||||||
public class FundingRDAExportModel {
|
|
||||||
private IdRDAExportModel funder_id;
|
|
||||||
private IdRDAExportModel grant_id;
|
|
||||||
private String funding_status;
|
|
||||||
|
|
||||||
public IdRDAExportModel getFunder_id() {
|
|
||||||
return funder_id;
|
|
||||||
}
|
|
||||||
public void setFunder_id(IdRDAExportModel funder_id) {
|
|
||||||
this.funder_id = funder_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IdRDAExportModel getGrant_id() {
|
|
||||||
return grant_id;
|
|
||||||
}
|
|
||||||
public void setGrant_id(IdRDAExportModel grant_id) {
|
|
||||||
this.grant_id = grant_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFunding_status() {
|
|
||||||
return funding_status;
|
|
||||||
}
|
|
||||||
public void setFunding_status(String funding_status) {
|
|
||||||
this.funding_status = funding_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FundingRDAExportModel fromDataModel(Funder funder, Grant grant) {
|
|
||||||
FundingRDAExportModel funding = new FundingRDAExportModel();
|
|
||||||
funding.funding_status = "planned"; // mock data
|
|
||||||
if (funder != null) {
|
|
||||||
funding.funder_id = new IdRDAExportModel(funder.getReference(), "other");
|
|
||||||
}
|
|
||||||
if (grant != null) {
|
|
||||||
funding.grant_id = new IdRDAExportModel(grant.getReference(), "other");
|
|
||||||
}
|
|
||||||
return funding;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HostRDAExportModel {
|
|
||||||
private String availability;
|
|
||||||
private String backup__frequency;
|
|
||||||
private String backup_type;
|
|
||||||
private String certified_with; // Repository certified with one the following standards: DIN31644 / DINI-Zertifikat / DSA / ISO16363 / ISO16919 /TRAC / WDS / CoreTrustSeal
|
|
||||||
private String description;
|
|
||||||
private String geo_location; // Physical location of the data expressed using ISO 3166-1 country code.
|
|
||||||
private List<String> pid_system; // PID System: ark arxiv bibcode doi ean13 eissn handle igsn isbn issn istc lissn lsid pmid purl upc url urn other
|
|
||||||
private String storage_type;
|
|
||||||
private String support_versioning; // Allowed values: yes / no / unknown
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
public String getAvailability() {
|
|
||||||
return availability;
|
|
||||||
}
|
|
||||||
public void setAvailability(String availability) {
|
|
||||||
this.availability = availability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBackup__frequency() {
|
|
||||||
return backup__frequency;
|
|
||||||
}
|
|
||||||
public void setBackup__frequency(String backup__frequency) {
|
|
||||||
this.backup__frequency = backup__frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBackup_type() {
|
|
||||||
return backup_type;
|
|
||||||
}
|
|
||||||
public void setBackup_type(String backup_type) {
|
|
||||||
this.backup_type = backup_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCertified_with() {
|
|
||||||
return certified_with;
|
|
||||||
}
|
|
||||||
public void setCertified_with(String certified_with) {
|
|
||||||
this.certified_with = certified_with;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGeo_location() {
|
|
||||||
return geo_location;
|
|
||||||
}
|
|
||||||
public void setGeo_location(String geo_location) {
|
|
||||||
this.geo_location = geo_location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getPid_system() {
|
|
||||||
return pid_system;
|
|
||||||
}
|
|
||||||
public void setPid_system(List<String> pid_system) {
|
|
||||||
this.pid_system = pid_system;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStorage_type() {
|
|
||||||
return storage_type;
|
|
||||||
}
|
|
||||||
public void setStorage_type(String storage_type) {
|
|
||||||
this.storage_type = storage_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSupport_versioning() {
|
|
||||||
return support_versioning;
|
|
||||||
}
|
|
||||||
public void setSupport_versioning(String support_versioning) {
|
|
||||||
this.support_versioning = support_versioning;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class IdRDAExportModel {
|
|
||||||
private String identifier;
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
public String getIdentifier() {
|
|
||||||
return identifier;
|
|
||||||
}
|
|
||||||
public void setIdentifier(String identifier) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
IdRDAExportModel(String identifier, String type) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class LicenseRDAExportModel {
|
|
||||||
private String license_ref;
|
|
||||||
private String start_date; // If date is set in the future, it indicates embargo period.
|
|
||||||
|
|
||||||
public String getLicense_ref() {
|
|
||||||
return license_ref;
|
|
||||||
}
|
|
||||||
public void setLicense_ref(String license_ref) {
|
|
||||||
this.license_ref = license_ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStart_date() {
|
|
||||||
return start_date;
|
|
||||||
}
|
|
||||||
public void setStart_date(String start_date) {
|
|
||||||
this.start_date = start_date;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import eu.eudat.data.entities.Grant;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class ProjectRDAExportModel {
|
|
||||||
private String title;
|
|
||||||
private String description;
|
|
||||||
private Date project_start;
|
|
||||||
private Date project_end;
|
|
||||||
private FundingRDAExportModel funding;
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getProject_start() {
|
|
||||||
return project_start;
|
|
||||||
}
|
|
||||||
public void setProject_start(Date project_start) {
|
|
||||||
this.project_start = project_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getProject_end() {
|
|
||||||
return project_end;
|
|
||||||
}
|
|
||||||
public void setProject_end(Date project_end) {
|
|
||||||
this.project_end = project_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FundingRDAExportModel getFunding() {
|
|
||||||
return funding;
|
|
||||||
}
|
|
||||||
public void setFunding(FundingRDAExportModel funding) {
|
|
||||||
this.funding = funding;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ProjectRDAExportModel fromDataModel(Grant grant) {
|
|
||||||
this.funding = new FundingRDAExportModel().fromDataModel(grant.getFunder(), grant);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
import eu.eudat.data.entities.DMP;
|
|
||||||
import eu.eudat.data.entities.Dataset;
|
|
||||||
import eu.eudat.logic.managers.DatasetManager;
|
|
||||||
import eu.eudat.models.data.security.Principal;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RDAExportModel {
|
|
||||||
private DmpRDAExportModel dmp;
|
|
||||||
|
|
||||||
public DmpRDAExportModel getDmp() {
|
|
||||||
return dmp;
|
|
||||||
}
|
|
||||||
public void setDmp(DmpRDAExportModel dmp) {
|
|
||||||
this.dmp = dmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RDAExportModel fromDataModel(DMP dmp, DatasetManager datasetManager, Principal principal) {
|
|
||||||
this.dmp = new DmpRDAExportModel().fromDataModel(dmp, datasetManager, principal);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package eu.eudat.models.data.rda;
|
|
||||||
|
|
||||||
public class RdaField {
|
|
||||||
private String rdaProperty;
|
|
||||||
private String rdaValue;
|
|
||||||
private String fieldId;
|
|
||||||
private String fieldSetId;
|
|
||||||
|
|
||||||
public String getRdaProperty() {
|
|
||||||
return rdaProperty;
|
|
||||||
}
|
|
||||||
public void setRdaProperty(String rdaProperty) {
|
|
||||||
this.rdaProperty = rdaProperty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRdaValue() {
|
|
||||||
return rdaValue;
|
|
||||||
}
|
|
||||||
public void setRdaValue(String rdaValue) {
|
|
||||||
this.rdaValue = rdaValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFieldId() {
|
|
||||||
return fieldId;
|
|
||||||
}
|
|
||||||
public void setFieldId(String fieldId) {
|
|
||||||
this.fieldId = fieldId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFieldSetId() {
|
|
||||||
return fieldSetId;
|
|
||||||
}
|
|
||||||
public void setFieldSetId(String fieldSetId) {
|
|
||||||
this.fieldSetId = fieldSetId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
import { GrantStateType } from "../../common/enum/grant-state-type";
|
|
||||||
import { BaseCriteria } from "../base-criteria";
|
|
||||||
import { Role } from '../../common/enum/role';
|
|
||||||
|
|
||||||
export class ExploreDatasetCriteriaModel extends BaseCriteria {
|
|
||||||
public grantStatus: GrantStateType;
|
|
||||||
public role: Role;
|
|
||||||
public dmpIds: string[] = [];
|
|
||||||
public grants: string[] = [];
|
|
||||||
public datasetProfile: string[] = [];
|
|
||||||
public dmpOrganisations: string[] = [];
|
|
||||||
public tags = [];
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
import { BaseCriteria } from "../base-criteria";
|
|
||||||
import { GrantStateType } from "../../common/enum/grant-state-type";
|
|
||||||
import { Role } from '../../common/enum/role';
|
|
||||||
|
|
||||||
export class ExploreDmpCriteriaModel extends BaseCriteria {
|
|
||||||
public grantStatus: GrantStateType;
|
|
||||||
public role: Role;
|
|
||||||
public grants: string[] = [];
|
|
||||||
public datasetProfile: string[] = [];
|
|
||||||
public dmpOrganisations: string[] = [];
|
|
||||||
public allVersions: boolean;
|
|
||||||
public groupIds: string[] = [];
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
<div class="header-image">
|
|
||||||
<div class="header-text-container">
|
|
||||||
<h3>Welcome to ARGOS</h3>
|
|
||||||
<h4>Create, Link, Share Data Management Plans</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="explore-dmp-content">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header card-header-plain d-flex">
|
|
||||||
<div class="card-desc d-flex flex-column justify-content-center">
|
|
||||||
<h4 class="card-title">{{'DASHBOARD.DATASETS' | translate}}</h4>
|
|
||||||
<!-- <p class="card-category">{{'DATASET-LISTING.SUBTITLE' | translate}}</p> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body table-responsive">
|
|
||||||
<div class="dmp-listing row pb-2">
|
|
||||||
<div class="col-12 col-sm-12 col-md-3">
|
|
||||||
<app-explore-dataset-filters-component (facetCriteriaChange)="onCriteriaChange($event)"></app-explore-dataset-filters-component>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-9 pt-4">
|
|
||||||
<div *ngFor="let item of listingItems; let i = index">
|
|
||||||
<app-explore-dataset-listing-item-component [dataset]="item" [showDivider]="i !== (listingItems.length - 1)"></app-explore-dataset-listing-item-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-sm-12 col-md-9 ml-auto paginator">
|
|
||||||
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)"></mat-paginator>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="main-content">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="explore-dataset">
|
|
||||||
<h3 class="text-center">{{'DATASET-PUBLIC-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<app-explore-dataset-filters-component (facetCriteriaChange)="onCriteriaChange($event)"></app-explore-dataset-filters-component>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<div>
|
|
||||||
<mat-card class="mat-card">
|
|
||||||
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
|
|
||||||
<ng-container cdkColumnDef="label">
|
|
||||||
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
|
||||||
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container cdkColumnDef="grant">
|
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.GRANT' |
|
|
||||||
translate}}</mat-header-cell>
|
|
||||||
<mat-cell *matCellDef="let row"> {{row.grant}} </mat-cell>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container cdkColumnDef="profile">
|
|
||||||
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE'
|
|
||||||
| translate}}</mat-header-cell>
|
|
||||||
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container cdkColumnDef="description">
|
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}</mat-header-cell>
|
|
||||||
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container cdkColumnDef="created">
|
|
||||||
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' |
|
|
||||||
translate}}</mat-header-cell>
|
|
||||||
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
|
|
||||||
</ng-container>
|
|
||||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
|
||||||
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
|
|
||||||
</mat-table>
|
|
||||||
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
|
|
||||||
</mat-paginator>
|
|
||||||
</mat-card>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
@ -1,78 +0,0 @@
|
|||||||
@import "node_modules/bootstrap/scss/functions";
|
|
||||||
@import "node_modules/bootstrap/scss/variables";
|
|
||||||
@import "node_modules/bootstrap/scss/mixins/_breakpoints";
|
|
||||||
|
|
||||||
@include media-breakpoint-down(sm) {
|
|
||||||
.lightblue-btn {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
::ng-deep .mat-paginator-container {
|
|
||||||
height: auto !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
text-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-desc {
|
|
||||||
min-height: 5vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator {
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-container {
|
|
||||||
flex-direction: row-reverse !important;
|
|
||||||
justify-content: space-between !important;
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
height: 30px;
|
|
||||||
min-height: 30px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-page-size {
|
|
||||||
height: 43px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-icon-button {
|
|
||||||
height: 30px !important;
|
|
||||||
font-size: 12px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-range-label {
|
|
||||||
margin: 15px 32px 0 24px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-range-actions {
|
|
||||||
width: auto !important;
|
|
||||||
min-width: 55% !important;
|
|
||||||
min-height: 43px !important;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-navigation-previous {
|
|
||||||
margin-left: auto !important;
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
||||||
import { MatPaginator } from '@angular/material/paginator';
|
|
||||||
import { MatSort } from '@angular/material/sort';
|
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
|
||||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
|
||||||
import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing';
|
|
||||||
import { ExploreDatasetCriteriaModel } from '@app/core/query/explore-dataset/explore-dataset-criteria';
|
|
||||||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
|
|
||||||
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dataset-listing-component',
|
|
||||||
templateUrl: 'explore-dataset-listing.component.html',
|
|
||||||
styleUrls: ['./explore-dataset-listing.component.scss'],
|
|
||||||
})
|
|
||||||
export class ExploreDatasetListingComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
|
||||||
|
|
||||||
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
|
||||||
@ViewChild(MatSort, { static: false }) sort: MatSort;
|
|
||||||
|
|
||||||
totalCount: number;
|
|
||||||
listingItems: DatasetListingModel[] = [];
|
|
||||||
exploreDatasetCriteriaModel: ExploreDatasetCriteriaModel;
|
|
||||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
|
||||||
dmpId: string;
|
|
||||||
dmpSearchEnabled = true;
|
|
||||||
titlePrefix: String;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private datasetService: DatasetService,
|
|
||||||
private dmpService: DmpService,
|
|
||||||
private router: Router,
|
|
||||||
private route: ActivatedRoute,
|
|
||||||
private language: TranslateService,
|
|
||||||
) {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.route.params
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(async (params: Params) => {
|
|
||||||
const queryParams = this.route.snapshot.queryParams;
|
|
||||||
this.dmpId = queryParams['dmpId'];
|
|
||||||
if (this.dmpId != null) {
|
|
||||||
this.dmpSearchEnabled = false;
|
|
||||||
const dmp = await this.dmpService.getSinglePublic(this.dmpId).toPromise();
|
|
||||||
|
|
||||||
const fields: Array<string> = [];
|
|
||||||
const dmpDataTableRequest: DataTableRequest<ExploreDatasetCriteriaModel> = new DataTableRequest(0, this._paginator.pageSize, { fields: fields });
|
|
||||||
dmpDataTableRequest.criteria = new ExploreDatasetCriteriaModel();
|
|
||||||
dmpDataTableRequest.criteria.dmpIds.push(this.dmpId);
|
|
||||||
|
|
||||||
this.datasetService.getPublicPaged(dmpDataTableRequest).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
||||||
if (!result) { return []; }
|
|
||||||
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
|
||||||
this.listingItems = result.data;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const breadCrumbs = [];
|
|
||||||
breadCrumbs.push({
|
|
||||||
parentComponentName: null,
|
|
||||||
label: this.language.instant('NAV-BAR.PUBLIC DATASETS'),
|
|
||||||
url: "/explore"
|
|
||||||
})
|
|
||||||
this.breadCrumbs = observableOf(breadCrumbs);
|
|
||||||
}
|
|
||||||
|
|
||||||
refresh(resetPages = false) {
|
|
||||||
if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
|
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
|
||||||
let fields: Array<string> = new Array();
|
|
||||||
if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
|
|
||||||
const request = new DataTableRequest<ExploreDatasetCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
|
|
||||||
request.criteria = this.exploreDatasetCriteriaModel || this.getDefaultCriteria();
|
|
||||||
this.datasetService.getPublicPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
||||||
if (!result) { return []; }
|
|
||||||
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
|
||||||
this.listingItems = result.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// rowClicked(dataset: DatasetListingModel) {
|
|
||||||
// this.router.navigate(['/datasets/publicEdit/' + dataset.id]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
onCriteriaChange(event: ExploreDatasetCriteriaModel) {
|
|
||||||
this.exploreDatasetCriteriaModel = event;
|
|
||||||
this._paginator.pageIndex = 0;
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
getDefaultCriteria(): ExploreDatasetCriteriaModel {
|
|
||||||
const defaultCriteria = new ExploreDatasetCriteriaModel();
|
|
||||||
// if (dmp != null) {
|
|
||||||
// defaultCriteria.dmpIds.push(dmp.id);
|
|
||||||
// }
|
|
||||||
return defaultCriteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
pageThisEvent(event) {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
|
||||||
import { ExploreDatasetListingComponent } from '@app/ui/explore-dataset/explore-dataset-listing.component';
|
|
||||||
import { ExploreDatasetRoutingModule } from '@app/ui/explore-dataset/explore-dataset.routing';
|
|
||||||
import { ExploreDatasetFilterItemComponent } from '@app/ui/explore-dataset/filters/explore-dataset-filter-item/explore-dataset-filter-item.component';
|
|
||||||
import { ExploreDatasetFiltersComponent } from '@app/ui/explore-dataset/filters/explore-dataset-filters.component';
|
|
||||||
import { ExploreDatasetListingItemComponent } from '@app/ui/explore-dataset/listing-item/explore-dataset-listing-item.component';
|
|
||||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
|
||||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonUiModule,
|
|
||||||
CommonFormsModule,
|
|
||||||
AutoCompleteModule,
|
|
||||||
ExploreDatasetRoutingModule
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
ExploreDatasetListingComponent,
|
|
||||||
ExploreDatasetFiltersComponent,
|
|
||||||
ExploreDatasetFilterItemComponent,
|
|
||||||
ExploreDatasetListingItemComponent
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class ExploreDatasetModule { }
|
|
@ -1,19 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
|
||||||
import { ExploreDatasetListingComponent } from './explore-dataset-listing.component';
|
|
||||||
|
|
||||||
const routes: Routes = [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: ExploreDatasetListingComponent,
|
|
||||||
data: {
|
|
||||||
breadcrumb: true
|
|
||||||
},
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [RouterModule.forChild(routes)],
|
|
||||||
exports: [RouterModule]
|
|
||||||
})
|
|
||||||
export class ExploreDatasetRoutingModule { }
|
|
@ -1,20 +0,0 @@
|
|||||||
<div *ngIf="searchEnabled">
|
|
||||||
<mat-form-field>
|
|
||||||
<input type="text" placeholder="{{ 'FACET-SEARCH.FILTER' | translate }}" matInput [formControl]="optionSearchControl">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<mat-chip-list *ngIf="searchEnabled">
|
|
||||||
<mat-chip [removable]="true" (removed)="removeOption(option)" *ngFor="let option of selectedOptions">{{
|
|
||||||
displayLabel(option) }}
|
|
||||||
<mat-icon matChipRemove>cancel</mat-icon>
|
|
||||||
</mat-chip>
|
|
||||||
</mat-chip-list>
|
|
||||||
|
|
||||||
<div class="data-expand-panel">
|
|
||||||
<mat-selection-list #optionsList (selectionChange)="selectionChanged($event)">
|
|
||||||
<mat-list-option class="facet-option-item" *ngFor="let option of (options | async)" [value]="option" [selected]="isOptionSelected(option)">
|
|
||||||
<p>{{ displayLabel(option) }}</p>
|
|
||||||
</mat-list-option>
|
|
||||||
</mat-selection-list>
|
|
||||||
</div>
|
|
@ -1,14 +0,0 @@
|
|||||||
.facet-option-item {
|
|
||||||
height: auto !important;
|
|
||||||
min-height: 48px;
|
|
||||||
padding: 0.5em;
|
|
||||||
.mat-list-item-content {
|
|
||||||
min-height: inherit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.data-expand-panel{
|
|
||||||
max-height: 20em;
|
|
||||||
overflow-x: hidden;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
|
|
||||||
import { SelectionModel } from '@angular/cdk/collections';
|
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
||||||
import { FormControl } from '@angular/forms';
|
|
||||||
import { MatListOption, MatSelectionList } from '@angular/material/list';
|
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dataset-filter-item-component',
|
|
||||||
templateUrl: './explore-dataset-filter-item.component.html',
|
|
||||||
styleUrls: ['./explore-dataset-filter-item.component.scss']
|
|
||||||
})
|
|
||||||
export class ExploreDatasetFilterItemComponent extends BaseComponent implements OnInit {
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
searchEnabled = false;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
requestDelay = 200;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
multipleSelect = true;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
filterOptions: (value) => Observable<any[]>;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
options: Observable<any[]> = observableOf([]);
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
displayTitleFunc: (value) => string;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
displayValueFunc: (value) => string;
|
|
||||||
|
|
||||||
@Output()
|
|
||||||
selectedChanged = new EventEmitter();
|
|
||||||
|
|
||||||
@Output()
|
|
||||||
optionRemoved = new EventEmitter();
|
|
||||||
|
|
||||||
optionSearchControl = new FormControl('');
|
|
||||||
|
|
||||||
private selectedOptions: any[] = [];
|
|
||||||
|
|
||||||
@ViewChild('optionsList', { static: true }) selectionList: MatSelectionList;
|
|
||||||
|
|
||||||
constructor() { super(); }
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
if (!this.multipleSelect) { this.selectionList.selectedOptions = new SelectionModel<MatListOption>(this.multipleSelect); }
|
|
||||||
this.optionSearchControl.valueChanges.pipe(debounceTime(this.requestDelay),
|
|
||||||
distinctUntilChanged())
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => { if (this.filterOptions) { this.options = this.filterOptions(x); } });
|
|
||||||
}
|
|
||||||
|
|
||||||
public selectionChanged(event: any) {
|
|
||||||
const eventValue = event.option.value;
|
|
||||||
if (event.option.selected) { this.selectedOptions.push(eventValue); }
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.selectedOptions.map(x => this.displayValue(x)).indexOf(this.displayValue(eventValue));
|
|
||||||
this.selectedOptions.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.selectedChanged.emit(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
public removeOption(grant) {
|
|
||||||
const list = this.selectionList.selectedOptions.selected.map(x => x.value);
|
|
||||||
const indexOfGrant = list.indexOf(grant);
|
|
||||||
if (this.selectionList.selectedOptions.selected[indexOfGrant]) {
|
|
||||||
this.selectionList.selectedOptions.selected[indexOfGrant].selected = false;
|
|
||||||
this.selectionList.selectedOptions.selected.splice(indexOfGrant, 1);
|
|
||||||
}
|
|
||||||
this.selectedOptions.splice(this.selectedOptions.map(x => this.displayValue(x)).indexOf(this.displayValue(grant)), 1);
|
|
||||||
this.optionRemoved.emit(grant);
|
|
||||||
}
|
|
||||||
|
|
||||||
public isOptionSelected(value) {
|
|
||||||
return this.selectedOptions.map(x => this.displayValue(x)).indexOf(this.displayValue(value)) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
displayLabel(value) {
|
|
||||||
return this.displayTitleFunc ? this.displayTitleFunc(value) : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
displayValue(value) {
|
|
||||||
return this.displayValueFunc ? this.displayValueFunc(value) : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
<div class="filters">
|
|
||||||
<h6 class="filters-title">{{'CRITERIA.FILTERS'| translate}}</h6>
|
|
||||||
<div class="row" style="justify-content: center;">
|
|
||||||
|
|
||||||
<mat-form-field class="col-11 search">
|
|
||||||
<input matInput placeholder="{{'CRITERIA.GRANTS.LIKE'| translate}}" name="dmpCriteriaName" [(ngModel)]="facetCriteria.like" (ngModelChange)="controlModified()">
|
|
||||||
<mat-icon matSuffix class="style-icon">search</mat-icon>
|
|
||||||
<app-multiple-auto-complete [(ngModel)]="facetCriteria.tags" (ngModelChange)="controlModified()" placeholder="{{'CRITERIA.DATA-SETS.TAGS' | translate}}" [configuration]="tagsAutoCompleteConfiguration">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
|
|
||||||
<mat-radio-group>
|
|
||||||
<mat-list-item><mat-radio-button value="null" checked (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button></mat-list-item>
|
|
||||||
<mat-list-item><mat-radio-button value="0" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button></mat-list-item>
|
|
||||||
<mat-list-item><mat-radio-button value="1" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button></mat-list-item>
|
|
||||||
</mat-radio-group>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{'CRITERIA.DATA-SETS.RELATED-DMP' | translate}}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{'CRITERIA.DATA-SETS.SELECT-DMP' | translate }}" [configuration]="dmpAutoCompleteConfiguration" (optionSelected)="onDmpOptionSelected($event)" (optionRemoved)="onDmpOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT.TITLE' | translate }}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-GRANTS' | translate }}" [configuration]="grantAutoCompleteConfiguration" (optionSelected)="onGrantOptionSelected($event)" (optionRemoved)="onGrantOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.PROFILES.TITLE' | translate }}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-SPEC' | translate }}" [configuration]="profileAutoCompleteConfiguration" (optionSelected)="onProfileOptionSelected($event)" (optionRemoved)="onProfileOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="isAuthenticated()" class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.ROLE.TITLE' | translate }}</h6>
|
|
||||||
<mat-radio-group>
|
|
||||||
<mat-list-item><mat-radio-button value="null" checked (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
|
|
||||||
<mat-list-item><mat-radio-button value="0" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.OWNER' | translate }}</mat-radio-button></mat-list-item>
|
|
||||||
<mat-list-item><mat-radio-button value="1" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.MEMBER' | translate }}</mat-radio-button></mat-list-item>
|
|
||||||
</mat-radio-group>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.DMP-ORGANISATIONS.TITLE' | translate }}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-ORGANIZATIONS' | translate }}" [configuration]="organizationAutoCompleteConfiguration" (optionSelected)="onOrganizationOptionSelected($event)" (optionRemoved)="onOrganizationOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <mat-accordion #facetAccordion="matAccordion" [multi]="true" class="facet-search-component">
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.FILTER' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<div>
|
|
||||||
<mat-form-field>
|
|
||||||
<input matInput placeholder="{{'CRITERIA.GRANTS.LIKE'| translate}}" name="datasetCriteriaName" [(ngModel)]="facetCriteria.like"
|
|
||||||
(ngModelChange)="controlModified()">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete [(ngModel)]="facetCriteria.tags" (ngModelChange)="controlModified()" placeholder="{{'CRITERIA.DATA-SETS.TAGS' | translate}}"
|
|
||||||
[configuration]="tagsAutoCompleteConfiguration">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dataset-filter-item-component [multipleSelect]="false" [options]="this.grantStateOptions"
|
|
||||||
(selectedChanged)="grantStatusChanged($event)" [displayTitleFunc]="displayGrantStateLabel" [displayValueFunc]="displayGrantStateValue">
|
|
||||||
</app-explore-dataset-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel *ngIf="this.facetCriteria.grantStatus == GrantStateType.OnGoing || this.facetCriteria.grantStatus == GrantStateType.Finished">
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.GRANT.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dataset-filter-item-component [options]="this.grants" (selectedChanged)="grantChanged($event)"
|
|
||||||
[filterOptions]="grantSearch.bind(this)" [searchEnabled]="true" (optionRemoved)="removeGrant($event)"
|
|
||||||
[displayTitleFunc]="displayGrantLabel" [displayValueFunc]="displayGrantValue">
|
|
||||||
</app-explore-dataset-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.PROFILES.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dataset-filter-item-component [options]="this.profiles" (selectedChanged)="profileChanged($event)"
|
|
||||||
[filterOptions]="profileSearch.bind(this)" (optionRemoved)="removeProfile($event)" [displayTitleFunc]="displayProfileLabel"
|
|
||||||
[displayValueFunc]="displayProfileValue">
|
|
||||||
</app-explore-dataset-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.DMP-ORGANISATIONS.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dataset-filter-item-component [options]="this.dmpOrganisations" (selectedChanged)="dmpOrganisationChanged($event)"
|
|
||||||
[filterOptions]="dmpOrganisationSearch.bind(this)" (optionRemoved)="removeOrganisation($event)" [searchEnabled]="true"
|
|
||||||
[displayTitleFunc]="displayDmpOrganisationsLabel" [displayValueFunc]="displayDmpOrganisationsValue">
|
|
||||||
</app-explore-dataset-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
</mat-accordion> -->
|
|
@ -1,106 +0,0 @@
|
|||||||
.facet-search-component {
|
|
||||||
.mat-form-field {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tags-chips {
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.search ::ng-deep.mat-form-field-infix {
|
|
||||||
margin-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-title {
|
|
||||||
color: black;
|
|
||||||
// color: #089dbb;
|
|
||||||
margin-top: 8px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.import {
|
|
||||||
margin: 10px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filters {
|
|
||||||
border: 1px solid #e4e4e4;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filters-title {
|
|
||||||
width: 90px;
|
|
||||||
color: #089dbb;
|
|
||||||
background-color: white;
|
|
||||||
padding: 0px 20px;
|
|
||||||
margin-top: -10px;
|
|
||||||
margin-left: 20px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.style-icon {
|
|
||||||
color: #adadad;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ::ng-deep .mat-checkbox-inner-container {
|
|
||||||
// background: white;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep .mat-focused .mat-form-field-label {
|
|
||||||
// color: #00b29f !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep.mat-form-field-underline {
|
|
||||||
// background-color: #adadad;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep.mat-form-field-ripple {
|
|
||||||
// background-color: #00b29f !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep .mat-checkbox {
|
|
||||||
// background-color: #f6f6f6 !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
::ng-deep .mat-checkbox .mat-checkbox-frame {
|
|
||||||
border: 1px solid #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-background,
|
|
||||||
.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background,
|
|
||||||
.mat-accent .mat-pseudo-checkbox-checked,
|
|
||||||
.mat-accent .mat-pseudo-checkbox-indeterminate,
|
|
||||||
.mat-pseudo-checkbox-checked,
|
|
||||||
.mat-pseudo-checkbox-indeterminate {
|
|
||||||
background-color: #00b29f;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-ripple-element {
|
|
||||||
background-color: #2e74b649 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-container {
|
|
||||||
border-radius: 1em;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-button .mat-radio-outer-circle {
|
|
||||||
border: 1px solid #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle {
|
|
||||||
border-color: #777777;
|
|
||||||
// border-color: #00b29f;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle {
|
|
||||||
color: #777777;
|
|
||||||
background-color: #777777;
|
|
||||||
// color: #00b29f;
|
|
||||||
// background-color: #00b29f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
|
|
||||||
background-color: #2e74b649;
|
|
||||||
}
|
|
@ -1,366 +0,0 @@
|
|||||||
|
|
||||||
import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
||||||
import { MatAccordion } from '@angular/material/expansion';
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { GrantStateType } from '@app/core/common/enum/grant-state-type';
|
|
||||||
import { DataTableData } from '@app/core/model/data-table/data-table-data';
|
|
||||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
|
||||||
import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
|
|
||||||
import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
|
|
||||||
import { ExternalSourceItemModel } from '@app/core/model/external-sources/external-source-item';
|
|
||||||
import { GrantListingModel } from '@app/core/model/grant/grant-listing';
|
|
||||||
import { OrganizationModel } from '@app/core/model/organisation/organization';
|
|
||||||
import { DatasetProfileCriteria } from '@app/core/query/dataset-profile/dataset-profile-criteria';
|
|
||||||
import { ExploreDatasetCriteriaModel } from '@app/core/query/explore-dataset/explore-dataset-criteria';
|
|
||||||
import { ExploreDmpCriteriaModel } from '@app/core/query/explore-dmp/explore-dmp-criteria';
|
|
||||||
import { GrantCriteria } from '@app/core/query/grant/grant-criteria';
|
|
||||||
import { OrganisationCriteria } from '@app/core/query/organisation/organisation-criteria';
|
|
||||||
import { RequestItem } from '@app/core/query/request-item';
|
|
||||||
import { TagCriteria } from '@app/core/query/tag/tag-criteria';
|
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
|
||||||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|
||||||
import { ExternalSourcesService } from '@app/core/services/external-sources/external-sources.service';
|
|
||||||
import { GrantService } from '@app/core/services/grant/grant.service';
|
|
||||||
import { OrganisationService } from '@app/core/services/organisation/organisation.service';
|
|
||||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { map } from 'rxjs/operators';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dataset-filters-component',
|
|
||||||
templateUrl: './explore-dataset-filters.component.html',
|
|
||||||
styleUrls: ['./explore-dataset-filters.component.scss']
|
|
||||||
})
|
|
||||||
export class ExploreDatasetFiltersComponent extends BaseComponent implements OnInit, AfterViewInit {
|
|
||||||
|
|
||||||
@Input() facetCriteria = new ExploreDatasetCriteriaModel();
|
|
||||||
@Output() facetCriteriaChange = new EventEmitter();
|
|
||||||
public filteringTagsAsync = false;
|
|
||||||
public filteredTags: ExternalSourceItemModel[];
|
|
||||||
GrantStateType = GrantStateType;
|
|
||||||
grants: Observable<GrantListingModel[]>;
|
|
||||||
profiles: Observable<DatasetProfileModel[]>;
|
|
||||||
dmpOrganisations: Observable<ExternalSourceItemModel[]>;
|
|
||||||
dmpIds: Observable<DataTableData<DmpListingModel>>;
|
|
||||||
grantOptions: Observable<GrantListingModel[]>;
|
|
||||||
grantStateOptions: Observable<any[]>;
|
|
||||||
filteringOrganisationsAsync = false;
|
|
||||||
@ViewChild('facetAccordion', { static: false }) accordion: MatAccordion;
|
|
||||||
|
|
||||||
displayGrantStateValue = (option) => option['value'];
|
|
||||||
displayGrantStateLabel = (option) => option['label'];
|
|
||||||
|
|
||||||
displayGrantValue = (option) => option['id'];
|
|
||||||
displayGrantLabel = (option) => option['label'];
|
|
||||||
|
|
||||||
displayProfileValue = (option) => option['id'];
|
|
||||||
displayProfileLabel = (option) => option['label'];
|
|
||||||
|
|
||||||
displayDmpOrganisationsValue = (option) => option['id'];
|
|
||||||
displayDmpOrganisationsLabel = (option) => option['name'];
|
|
||||||
|
|
||||||
tagsAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterTags.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) => this.filterTags('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['name'],
|
|
||||||
titleFn: (item) => item['name']
|
|
||||||
};
|
|
||||||
|
|
||||||
dmpAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: (x, excluded) => this.filterDmps(x).pipe(map(x => x.data)),
|
|
||||||
initialItems: (extraData) => this.filterDmps('').pipe(map(x => x.data)),
|
|
||||||
displayFn: (item) => item['label'],
|
|
||||||
titleFn: (item) => item['label']
|
|
||||||
};
|
|
||||||
|
|
||||||
grantAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterGrant.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) =>
|
|
||||||
this.filterGrant('').pipe(
|
|
||||||
map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['label'],
|
|
||||||
titleFn: (item) => item['label']
|
|
||||||
}
|
|
||||||
|
|
||||||
profileAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterProfile.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) =>
|
|
||||||
this.filterProfile('').pipe(
|
|
||||||
map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['label'],
|
|
||||||
titleFn: (item) => item['label']
|
|
||||||
};
|
|
||||||
|
|
||||||
organizationAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterOrganisation.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) =>
|
|
||||||
this.getOrganisations().pipe(
|
|
||||||
map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['name'],
|
|
||||||
titleFn: (item) => item['name']
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public activatedRoute: ActivatedRoute,
|
|
||||||
private authentication: AuthService,
|
|
||||||
public grantService: GrantService,
|
|
||||||
public dmpService: DmpService,
|
|
||||||
public organisationService: OrganisationService,
|
|
||||||
public languageService: TranslateService,
|
|
||||||
public datasetProfileService: DatasetService,
|
|
||||||
public externalSourcesService: ExternalSourcesService,
|
|
||||||
) { super(); }
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.grantStateOptions = observableOf(
|
|
||||||
[
|
|
||||||
{ label: this.languageService.instant('FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE'), value: GrantStateType.Finished },
|
|
||||||
{ label: this.languageService.instant('FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE'), value: GrantStateType.OnGoing },
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
// this.profiles = this.datasetProfileService.getDatasetProfiles();
|
|
||||||
this.dmpOrganisations = this.externalSourcesService.searchDMPOrganizations('');
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
|
||||||
// this.accordion.openAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public grantStatusChanged(event) {
|
|
||||||
this.facetCriteria.grantStatus = event.value;
|
|
||||||
if (event.value === 'null') {
|
|
||||||
this.facetCriteria.grantStatus = null;
|
|
||||||
this.grants = observableOf([]);
|
|
||||||
this.facetCriteria.grants = [];
|
|
||||||
}
|
|
||||||
// if (event.option.selected) {
|
|
||||||
// if (event.source.checked) {
|
|
||||||
else {
|
|
||||||
// const grantCriteria = new GrantCriteria();
|
|
||||||
// grantCriteria.grantStateType = this.facetCriteria.grantStatus;
|
|
||||||
//grantCriteria['length'] = 10;
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new GrantCriteria();
|
|
||||||
dataTableRequest.criteria.grantStateType = this.facetCriteria.grantStatus;
|
|
||||||
dataTableRequest.criteria['length'] = 10;
|
|
||||||
|
|
||||||
this.grants = this.grantService.getPublicPaged(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
this.facetCriteria.grants = [];
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public grantChanged(event: any) {
|
|
||||||
const eventValue = event.option.value.id;
|
|
||||||
if (event.option.selected) { this.facetCriteria.grants.push(eventValue); }
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.facetCriteria.grants.indexOf(eventValue);
|
|
||||||
this.facetCriteria.grants.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeGrant(grant) {
|
|
||||||
this.facetCriteria.grants.splice(this.facetCriteria.grants.indexOf(grant), 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public profileChanged(event: any) {
|
|
||||||
const eventValue = event.option.value.id;
|
|
||||||
if (event.option.selected) {
|
|
||||||
this.facetCriteria.datasetProfile.push(eventValue);
|
|
||||||
}
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.facetCriteria.datasetProfile.indexOf(eventValue);
|
|
||||||
this.facetCriteria.datasetProfile.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
// getProfiles() {
|
|
||||||
// return this.datasetProfileService.getDatasetProfiles();
|
|
||||||
// }
|
|
||||||
|
|
||||||
removeProfile(profile) {
|
|
||||||
this.facetCriteria.datasetProfile.splice(this.facetCriteria.datasetProfile.indexOf(profile), 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrganisations() {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new OrganisationCriteria();
|
|
||||||
dataTableRequest.criteria.labelLike = '';
|
|
||||||
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public roleChanged(event: any) {
|
|
||||||
this.facetCriteria.role = event.value;
|
|
||||||
if (event.value === 'null') {
|
|
||||||
this.facetCriteria.role = null;
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public dmpOrganisationChanged(event: any) {
|
|
||||||
const eventValue = event.option.value.id;
|
|
||||||
if (event.option.selected) { this.facetCriteria.dmpOrganisations.push(eventValue); }
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.facetCriteria.dmpOrganisations.indexOf(eventValue);
|
|
||||||
this.facetCriteria.dmpOrganisations.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
public grantSearch(value: string): Observable<GrantListingModel[]> {
|
|
||||||
|
|
||||||
const grantCriteria = new GrantCriteria();
|
|
||||||
grantCriteria.grantStateType = this.facetCriteria.grantStatus;
|
|
||||||
grantCriteria['length'] = 10;
|
|
||||||
grantCriteria.like = value;
|
|
||||||
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
|
|
||||||
const dataTableRequest: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = grantCriteria;
|
|
||||||
//const dataTableRequest: RequestItem<GrantCriteria> = { criteria: grantCriteria };
|
|
||||||
//return this.grantService.getPaged(dataTableRequest, "autocomplete").map(x => x.data);
|
|
||||||
return this.grantService.getPublicPaged(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public dmpOrganisationSearch(value: string): Observable<ExternalSourceItemModel[]> {
|
|
||||||
return this.externalSourcesService.searchDMPOrganizations(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeOrganisation(organisation) {
|
|
||||||
this.facetCriteria.dmpOrganisations.splice(this.facetCriteria.dmpOrganisations.indexOf(organisation), 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public profileSearch(value: string) {
|
|
||||||
// return this.datasetProfileService.getDatasetProfiles();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public controlModified() {
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onGrantOptionSelected(item: GrantListingModel) {
|
|
||||||
this.facetCriteria.grants.push(item.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onGrantOptionRemoved(item: GrantListingModel) {
|
|
||||||
const index = this.facetCriteria.grants.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.grants.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onDmpOptionSelected(item: DmpListingModel) {
|
|
||||||
this.facetCriteria.dmpIds.push(item.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onDmpOptionRemoved(item: DmpListingModel) {
|
|
||||||
const index = this.facetCriteria.dmpIds.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.dmpIds.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onProfileOptionSelected(item: DatasetProfileModel) {
|
|
||||||
this.facetCriteria.datasetProfile.push(item.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onProfileOptionRemoved(item: DatasetProfileModel) {
|
|
||||||
const index = this.facetCriteria.datasetProfile.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.datasetProfile.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onOrganizationOptionSelected(item: OrganizationModel) {
|
|
||||||
this.facetCriteria.dmpOrganisations.push(item.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onOrganizationOptionRemoved(item: OrganizationModel) {
|
|
||||||
const index = this.facetCriteria.dmpOrganisations.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.dmpOrganisations.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filterDmps(value: string): Observable<DataTableData<DmpListingModel>> {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('-finalizedAt');
|
|
||||||
const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dmpDataTableRequest.criteria = new ExploreDmpCriteriaModel();
|
|
||||||
dmpDataTableRequest.criteria.like = value;
|
|
||||||
return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete")
|
|
||||||
}
|
|
||||||
|
|
||||||
filterTags(value: string): Observable<ExternalSourceItemModel[]> {
|
|
||||||
this.filteredTags = undefined;
|
|
||||||
this.filteringTagsAsync = true;
|
|
||||||
const requestItem: RequestItem<TagCriteria> = new RequestItem();
|
|
||||||
const criteria: TagCriteria = new TagCriteria();
|
|
||||||
criteria.like = value;
|
|
||||||
requestItem.criteria = criteria;
|
|
||||||
return this.externalSourcesService.searchDatasetTags(requestItem);
|
|
||||||
// .subscribe(items => {
|
|
||||||
// this.filteredTags = items;
|
|
||||||
// this.filteringTagsAsync = false;
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
filterGrant(query: string) {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const grantRequestItem: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
grantRequestItem.criteria = new GrantCriteria();
|
|
||||||
grantRequestItem.criteria.like = query;
|
|
||||||
return this.grantService.getPublicPaged(grantRequestItem).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
filterProfile(query: string) {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const profileRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
profileRequestItem.criteria = new DatasetProfileCriteria();
|
|
||||||
profileRequestItem.criteria.like = query;
|
|
||||||
|
|
||||||
return this.datasetProfileService.getDatasetProfiles(profileRequestItem);
|
|
||||||
// this.dmpService.getPublicPaged(profileRequestItem, "listing").pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
filterOrganisation(value: string) {
|
|
||||||
this.filteringOrganisationsAsync = true;
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new OrganisationCriteria();
|
|
||||||
dataTableRequest.criteria.labelLike = value;
|
|
||||||
|
|
||||||
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
public isAuthenticated(): boolean {
|
|
||||||
return !(!this.authentication.current());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
<div class="listing-item">
|
|
||||||
<a [routerLink]="['/datasets/publicEdit/' + dataset.id]">
|
|
||||||
<div class="col">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 gray-container container-header">
|
|
||||||
<p>{{ dataset.grantAbbreviation }}</p>
|
|
||||||
<!-- <button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto"
|
|
||||||
(click)="$event.stopImmediatePropagation();">
|
|
||||||
<mat-icon class="more-horiz">more_horiz</mat-icon>
|
|
||||||
</button> -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-auto">
|
|
||||||
<mat-icon *ngIf="!isDraft" matTooltip="{{'DATASET-PUBLIC-LISTING.TOOLTIP.FINALIZED' | translate}}" class="finalized-bookmark">bookmark</mat-icon>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<div class="row d-flex flex-wrap">
|
|
||||||
<div class="col pl-0">
|
|
||||||
<h4 class="title pl-0" *ngIf="!isDraft">{{ dataset.label }}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col pl-0">
|
|
||||||
<p class="mt-1 mb-2">{{dataset.description}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-auto about-item pl-0">
|
|
||||||
<div class="row">
|
|
||||||
<mat-icon matTooltip="{{'DATASET-PUBLIC-LISTING.TOOLTIP.DMP' | translate}}" class="col-auto gray-icon pr-0 pt-2">storage</mat-icon>
|
|
||||||
<h4 class="col mt-2 ml-1 mr-3 p-1">{{ dataset.dmp }}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto about-item pl-0">
|
|
||||||
<div class="row">
|
|
||||||
<mat-icon matTooltip="{{'DATASET-PUBLIC-LISTING.TOOLTIP.GRANT' | translate}}" class="col-auto gray-icon pr-0 pt-2">work_outline</mat-icon>
|
|
||||||
<h4 class="col mt-2 ml-1 mr-3 p-1">{{ dataset.grant }}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto about-item pl-0">
|
|
||||||
<mat-icon matTooltip="{{'DATASET-PUBLIC-LISTING.TOOLTIP.TEMPLATES-INVOLVED' | translate}}" class="gray-icon pt-2">assignment</mat-icon>
|
|
||||||
<div class="pt-1">
|
|
||||||
<div matTooltip="{{ dataset.profile }}" class="chip ml-2 mr-2">{{ dataset.profile }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col about-item ml-auto">
|
|
||||||
<p>{{'DATASET-LISTING.COLUMNS.PUBLISHED' | translate}} {{dataset.dmpPublishedAt | date: "shortDate"}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div class="row">
|
|
||||||
<div class="col-12 title">
|
|
||||||
<mat-icon *ngIf="!isDraft" matTooltip="{{'DATASET-PUBLIC-LISTING.TOOLTIP.FINALIZED' | translate}}" class="finalized-bookmark">bookmark</mat-icon>
|
|
||||||
<h4 *ngIf="!isDraft">{{ dataset.label }}</h4>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <div class="info">
|
|
||||||
<h6>{{ dataset.dmp }}</h6>
|
|
||||||
<p>{{ dataset.grant }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-left: 0px !important">
|
|
||||||
<div class="chip">
|
|
||||||
<p>{{ dataset.profile }}</p>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<!-- <mat-divider *ngIf="showDivider"></mat-divider> -->
|
|
@ -1,99 +0,0 @@
|
|||||||
.gray-container {
|
|
||||||
letter-spacing: 5px;
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
margin-top: 0px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-header p {
|
|
||||||
letter-spacing: 5px;
|
|
||||||
color: #aaaaaa;
|
|
||||||
padding-top: 10px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
display: inline;
|
|
||||||
padding-left: 1em;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title h4 {
|
|
||||||
padding-left: 30px;
|
|
||||||
line-height: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item .length {
|
|
||||||
color: #00b29f;
|
|
||||||
// color: #089dbb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item .title {
|
|
||||||
margin: 2px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item p {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
padding-top: 7px;
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.finalized-bookmark {
|
|
||||||
color: #08bd63;
|
|
||||||
}
|
|
||||||
|
|
||||||
// .explore-dataset-info {
|
|
||||||
// background-color: #f6f6f6;
|
|
||||||
// padding: 8px 15px;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .explore-dataset-info p {
|
|
||||||
// margin-bottom: 0px;
|
|
||||||
// color: rgb(37, 35, 140);
|
|
||||||
// font-weight: 600;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .template-name {
|
|
||||||
// padding-left: 0px;
|
|
||||||
// border: 1px solid rgb(218, 227, 243);
|
|
||||||
// color: rgb(43, 104, 209);
|
|
||||||
// background-color: rgb(236, 241, 249);
|
|
||||||
// border-radius: 10em;
|
|
||||||
// justify-content: center;
|
|
||||||
// text-transform: uppercase;
|
|
||||||
// display: flex;
|
|
||||||
// width: 25em;
|
|
||||||
// height: 1.8em;
|
|
||||||
// margin-top: 15px;
|
|
||||||
// font-size: 13px;
|
|
||||||
// font-weight: 500;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .draft-bookmark {
|
|
||||||
// color: #e7e6e6;
|
|
||||||
// display: inline;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .finalized-bookmark {
|
|
||||||
// color: #92d050;
|
|
||||||
// display: inline;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// h4 {
|
|
||||||
// display: inline;
|
|
||||||
// }
|
|
@ -1,29 +0,0 @@
|
|||||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
||||||
import { DatasetListingModel } from '../../../core/model/dataset/dataset-listing';
|
|
||||||
import { DatasetStatus } from '../../../core/common/enum/dataset-status';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dataset-listing-item-component',
|
|
||||||
templateUrl: './explore-dataset-listing-item.component.html',
|
|
||||||
styleUrls: ['./explore-dataset-listing-item.component.scss']
|
|
||||||
})
|
|
||||||
export class ExploreDatasetListingItemComponent implements OnInit {
|
|
||||||
|
|
||||||
@Input() dataset: DatasetListingModel;
|
|
||||||
@Input() showDivider: boolean = true;
|
|
||||||
@Output() onClick: EventEmitter<DatasetListingModel> = new EventEmitter();
|
|
||||||
|
|
||||||
isDraft: boolean;
|
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
if (this.dataset.status == DatasetStatus.Draft) { this.isDraft = true }
|
|
||||||
else { this.isDraft = false }
|
|
||||||
}
|
|
||||||
|
|
||||||
// itemClicked() {
|
|
||||||
// this.onClick.emit(this.dataset);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
<div *ngIf="searchEnabled">
|
|
||||||
<mat-form-field>
|
|
||||||
<input type="text" placeholder="{{ 'FACET-SEARCH.FILTER' | translate }}" matInput [formControl]="optionSearchControl">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<mat-chip-list *ngIf="searchEnabled">
|
|
||||||
<mat-chip [removable]="true" (removed)="removeOption(option)" *ngFor="let option of selectedOptions">{{
|
|
||||||
displayLabel(option) }}
|
|
||||||
<mat-icon matChipRemove>cancel</mat-icon>
|
|
||||||
</mat-chip>
|
|
||||||
</mat-chip-list>
|
|
||||||
|
|
||||||
<div class="data-expand-panel">
|
|
||||||
<mat-selection-list #optionsList (selectionChange)="selectionChanged($event)">
|
|
||||||
<mat-list-option class="facet-option-item" *ngFor="let option of (options | async)" [value]="option" [selected]="isOptionSelected(option)">
|
|
||||||
<p>{{ displayLabel(option) }}</p>
|
|
||||||
</mat-list-option>
|
|
||||||
</mat-selection-list>
|
|
||||||
</div>
|
|
@ -1,14 +0,0 @@
|
|||||||
.facet-option-item {
|
|
||||||
height: auto !important;
|
|
||||||
min-height: 48px;
|
|
||||||
padding: 0.5em;
|
|
||||||
.mat-list-item-content {
|
|
||||||
min-height: inherit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.data-expand-panel{
|
|
||||||
max-height: 20em;
|
|
||||||
overflow-x: hidden;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
|
|
||||||
import { SelectionModel } from '@angular/cdk/collections';
|
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
||||||
import { FormControl } from '@angular/forms';
|
|
||||||
import { MatListOption, MatSelectionList } from '@angular/material/list';
|
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dmp-filter-item-component',
|
|
||||||
templateUrl: './explore-dmp-filter-item.component.html',
|
|
||||||
styleUrls: ['./explore-dmp-filter-item.component.scss']
|
|
||||||
})
|
|
||||||
export class ExploreDmpFilterItemComponent extends BaseComponent implements OnInit {
|
|
||||||
@Input()
|
|
||||||
searchEnabled = false;
|
|
||||||
@Input()
|
|
||||||
requestDelay = 200;
|
|
||||||
@Input()
|
|
||||||
multipleSelect = true;
|
|
||||||
@Input()
|
|
||||||
filterOptions: (value) => Observable<any[]>;
|
|
||||||
@Input()
|
|
||||||
options: Observable<any[]> = observableOf([]);
|
|
||||||
@Input()
|
|
||||||
displayTitleFunc: (value) => string;
|
|
||||||
@Input()
|
|
||||||
displayValueFunc: (value) => string;
|
|
||||||
@Output()
|
|
||||||
selectedChanged = new EventEmitter();
|
|
||||||
@Output()
|
|
||||||
optionRemoved = new EventEmitter();
|
|
||||||
|
|
||||||
|
|
||||||
optionSearchControl = new FormControl('');
|
|
||||||
public selectedOptions: any[] = [];
|
|
||||||
|
|
||||||
@ViewChild('optionsList', { static: true }) selectionList: MatSelectionList;
|
|
||||||
|
|
||||||
constructor() { super(); }
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
if (!this.multipleSelect) { this.selectionList.selectedOptions = new SelectionModel<MatListOption>(this.multipleSelect); }
|
|
||||||
this.optionSearchControl.valueChanges.pipe(debounceTime(this.requestDelay),
|
|
||||||
distinctUntilChanged())
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => { if (this.filterOptions) { this.options = this.filterOptions(x); } });
|
|
||||||
}
|
|
||||||
|
|
||||||
public selectionChanged(event: any) {
|
|
||||||
const eventValue = event.option.value;
|
|
||||||
if (event.option.selected) { this.selectedOptions.push(eventValue); }
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.selectedOptions.map(x => this.displayValue(x)).indexOf(this.displayValue(eventValue));
|
|
||||||
this.selectedOptions.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.selectedChanged.emit(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
public removeOption(grant) {
|
|
||||||
const list = this.selectionList.selectedOptions.selected.map(x => x.value);
|
|
||||||
const indexOfGrant = list.indexOf(grant);
|
|
||||||
if (this.selectionList.selectedOptions.selected[indexOfGrant]) {
|
|
||||||
this.selectionList.selectedOptions.selected[indexOfGrant].selected = false;
|
|
||||||
this.selectionList.selectedOptions.selected.splice(indexOfGrant, 1);
|
|
||||||
}
|
|
||||||
this.selectedOptions.splice(this.selectedOptions.map(x => this.displayValue(x)).indexOf(this.displayValue(grant)), 1);
|
|
||||||
this.optionRemoved.emit(grant);
|
|
||||||
}
|
|
||||||
|
|
||||||
public isOptionSelected(value) {
|
|
||||||
return this.selectedOptions.map(x => this.displayValue(x)).indexOf(this.displayValue(value)) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
displayLabel(value) {
|
|
||||||
return this.displayTitleFunc ? this.displayTitleFunc(value) : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
displayValue(value) {
|
|
||||||
return this.displayValueFunc ? this.displayValueFunc(value) : value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
<div class="filters">
|
|
||||||
<h6 class="filters-title">{{'CRITERIA.FILTERS'| translate}}</h6>
|
|
||||||
<div class="row" style="justify-content: center;">
|
|
||||||
|
|
||||||
<mat-form-field class="col-11 search">
|
|
||||||
<input matInput placeholder="{{'CRITERIA.GRANTS.LIKE'| translate}}" name="dmpCriteriaName" [(ngModel)]="facetCriteria.like" (ngModelChange)="controlModified()">
|
|
||||||
<mat-icon matSuffix class="style-icon">search</mat-icon>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
|
|
||||||
<mat-radio-group>
|
|
||||||
<mat-list-item>
|
|
||||||
<mat-radio-button value="null" checked (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button>
|
|
||||||
</mat-list-item>
|
|
||||||
<mat-list-item>
|
|
||||||
<mat-radio-button value="0" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button>
|
|
||||||
</mat-list-item>
|
|
||||||
<mat-list-item>
|
|
||||||
<mat-radio-button value="1" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button>
|
|
||||||
</mat-list-item>
|
|
||||||
</mat-radio-group>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT.TITLE' | translate }}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-GRANTS' | translate }}" [configuration]="grantAutoCompleteConfiguration" (optionSelected)="onGrantOptionSelected($event)" (optionRemoved)="onGrantOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.PROFILES.TITLE' | translate }}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-SPEC' | translate }}" [configuration]="profileAutoCompleteConfiguration" (optionSelected)="onProfileOptionSelected($event)" (optionRemoved)="onProfileOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="isAuthenticated()" class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.ROLE.TITLE' | translate }}</h6>
|
|
||||||
<mat-radio-group>
|
|
||||||
<mat-list-item>
|
|
||||||
<mat-radio-button value="null" checked (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.ANY' | translate }}</mat-radio-button>
|
|
||||||
</mat-list-item>
|
|
||||||
<mat-list-item>
|
|
||||||
<mat-radio-button value="0" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.OWNER' | translate }}</mat-radio-button>
|
|
||||||
</mat-list-item>
|
|
||||||
<mat-list-item>
|
|
||||||
<mat-radio-button value="1" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.MEMBER' | translate }}</mat-radio-button>
|
|
||||||
</mat-list-item>
|
|
||||||
</mat-radio-group>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-10 gray-container">
|
|
||||||
<h6 class="category-title">{{ 'FACET-SEARCH.DMP-ORGANISATIONS.TITLE' | translate }}</h6>
|
|
||||||
<mat-form-field>
|
|
||||||
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-ORGANIZATIONS' | translate }}" [configuration]="organizationAutoCompleteConfiguration" (optionSelected)="onOrganizationOptionSelected($event)" (optionRemoved)="onOrganizationOptionRemoved($event)">
|
|
||||||
</app-multiple-auto-complete>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <mat-accordion #facetAccordion="matAccordion" [multi]="true" class="facet-search-component">
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.FILTER' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<div>
|
|
||||||
<mat-form-field>
|
|
||||||
<input matInput placeholder="{{'CRITERIA.GRANTS.LIKE'| translate}}" name="dmpCriteriaName" [(ngModel)]="facetCriteria.like"
|
|
||||||
(ngModelChange)="controlModified()">
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dmp-filter-item-component [multipleSelect]="false" [options]="this.grantStateOptions" (selectedChanged)="grantStatusChanged($event)"
|
|
||||||
[displayTitleFunc]="displayGrantStateLabel" [displayValueFunc]="displayGrantStateValue">
|
|
||||||
</app-explore-dmp-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel *ngIf="this.facetCriteria.grantStatus == GrantStateType.OnGoing || this.facetCriteria.grantStatus == GrantStateType.Finished">
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.GRANT.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dmp-filter-item-component [options]="this.grants" (selectedChanged)="grantChanged($event)" [filterOptions]="grantSearch.bind(this)"
|
|
||||||
[searchEnabled]="true" (optionRemoved)="removeGrant($event)" [displayTitleFunc]="displayGrantLabel" [displayValueFunc]="displayGrantValue">
|
|
||||||
</app-explore-dmp-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.PROFILES.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dmp-filter-item-component [options]="this.profiles" (selectedChanged)="profileChanged($event)" [filterOptions]="profileSearch.bind(this)"
|
|
||||||
(optionRemoved)="removeProfile($event)" [displayTitleFunc]="displayProfileLabel" [displayValueFunc]="displayProfileValue">
|
|
||||||
</app-explore-dmp-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
<mat-expansion-panel>
|
|
||||||
<mat-expansion-panel-header>
|
|
||||||
<mat-panel-title>
|
|
||||||
{{ 'FACET-SEARCH.DMP-ORGANISATIONS.TITLE' | translate }}
|
|
||||||
</mat-panel-title>
|
|
||||||
</mat-expansion-panel-header>
|
|
||||||
<app-explore-dmp-filter-item-component [options]="this.dmpOrganisations" (selectedChanged)="dmpOrganisationChanged($event)"
|
|
||||||
[filterOptions]="dmpOrganisationSearch.bind(this)" (optionRemoved)="removeOrganisation($event)" [searchEnabled]="true"
|
|
||||||
[displayTitleFunc]="displayDmpOrganisationsLabel" [displayValueFunc]="displayDmpOrganisationsValue">
|
|
||||||
</app-explore-dmp-filter-item-component>
|
|
||||||
</mat-expansion-panel>
|
|
||||||
</mat-accordion> -->
|
|
@ -1,106 +0,0 @@
|
|||||||
.facet-search-component {
|
|
||||||
.mat-form-field {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tags-chips {
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.search ::ng-deep.mat-form-field-infix {
|
|
||||||
margin-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-title {
|
|
||||||
color: black;
|
|
||||||
// color: #089dbb;
|
|
||||||
margin-top: 8px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.import {
|
|
||||||
margin: 10px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filters {
|
|
||||||
border: 1px solid #e4e4e4;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filters-title {
|
|
||||||
width: 93px;
|
|
||||||
color: #089dbb;
|
|
||||||
background-color: white;
|
|
||||||
padding: 0px 20px;
|
|
||||||
margin-top: -10px;
|
|
||||||
margin-left: 20px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.style-icon {
|
|
||||||
color: #adadad;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ::ng-deep .mat-checkbox-inner-container {
|
|
||||||
// background: white;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep .mat-focused .mat-form-field-label {
|
|
||||||
// color: #00b29f !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep.mat-form-field-underline {
|
|
||||||
// background-color: #adadad;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep.mat-form-field-ripple {
|
|
||||||
// background-color: #00b29f !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ::ng-deep .mat-checkbox {
|
|
||||||
// background-color: #f6f6f6 !important;
|
|
||||||
// }
|
|
||||||
|
|
||||||
::ng-deep .mat-checkbox .mat-checkbox-frame {
|
|
||||||
border: 1px solid #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-background,
|
|
||||||
.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background,
|
|
||||||
.mat-accent .mat-pseudo-checkbox-checked,
|
|
||||||
.mat-accent .mat-pseudo-checkbox-indeterminate,
|
|
||||||
.mat-pseudo-checkbox-checked,
|
|
||||||
.mat-pseudo-checkbox-indeterminate {
|
|
||||||
background-color: #00b29f;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-ripple-element {
|
|
||||||
background-color: #2e74b649 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-container {
|
|
||||||
border-radius: 1em;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-button .mat-radio-outer-circle {
|
|
||||||
border: 1px solid #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle {
|
|
||||||
border-color: #777777;
|
|
||||||
// border-color: #00b29f;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle {
|
|
||||||
color: #777777;
|
|
||||||
background-color: #777777;
|
|
||||||
// color: #00b29f;
|
|
||||||
// background-color: #00b29f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element {
|
|
||||||
background-color: #2e74b649;
|
|
||||||
}
|
|
@ -1,347 +0,0 @@
|
|||||||
|
|
||||||
import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild } from "@angular/core";
|
|
||||||
import { MatAccordion } from "@angular/material/expansion";
|
|
||||||
import { ActivatedRoute } from "@angular/router";
|
|
||||||
import { GrantStateType } from '@app/core/common/enum/grant-state-type';
|
|
||||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
|
||||||
import { DatasetProfileModel } from '@app/core/model/dataset/dataset-profile';
|
|
||||||
import { GrantListingModel } from '@app/core/model/grant/grant-listing';
|
|
||||||
import { OrganizationModel } from '@app/core/model/organisation/organization';
|
|
||||||
import { DatasetProfileCriteria } from '@app/core/query/dataset-profile/dataset-profile-criteria';
|
|
||||||
import { ExploreDmpCriteriaModel } from '@app/core/query/explore-dmp/explore-dmp-criteria';
|
|
||||||
import { GrantCriteria } from '@app/core/query/grant/grant-criteria';
|
|
||||||
import { OrganisationCriteria } from '@app/core/query/organisation/organisation-criteria';
|
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
|
||||||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|
||||||
import { ExternalSourcesService } from '@app/core/services/external-sources/external-sources.service';
|
|
||||||
import { GrantService } from '@app/core/services/grant/grant.service';
|
|
||||||
import { OrganisationService } from '@app/core/services/organisation/organisation.service';
|
|
||||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
|
||||||
import { BaseCriteriaComponent } from '@app/ui/misc/criteria/base-criteria.component';
|
|
||||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { map } from 'rxjs/operators';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dmp-filters-component',
|
|
||||||
templateUrl: './explore-dmp-filters.component.html',
|
|
||||||
styleUrls: ['./explore-dmp-filters.component.scss']
|
|
||||||
})
|
|
||||||
export class ExploreDmpFiltersComponent extends BaseCriteriaComponent implements OnInit, AfterViewInit {
|
|
||||||
|
|
||||||
@Input() facetCriteria = new ExploreDmpCriteriaModel();
|
|
||||||
@Output() facetCriteriaChange = new EventEmitter();
|
|
||||||
@Input() displayTitleFunc: (value) => string;
|
|
||||||
GrantStateType = GrantStateType;
|
|
||||||
grants: Observable<GrantListingModel[]>;
|
|
||||||
profiles: Observable<DatasetProfileModel[]>;
|
|
||||||
dmpOrganisations: Observable<OrganizationModel[]>;
|
|
||||||
grantOptions: Observable<GrantListingModel[]>;
|
|
||||||
grantStateOptions: Observable<any[]>;
|
|
||||||
filteringOrganisationsAsync = false;
|
|
||||||
filteredOrganisations: OrganizationModel[];
|
|
||||||
status: GrantStateType;
|
|
||||||
IsChecked: boolean;
|
|
||||||
IsIndeterminate: boolean;
|
|
||||||
LabelAlign: string;
|
|
||||||
IsDisabled: boolean;
|
|
||||||
Active: string;
|
|
||||||
Inactive: string;
|
|
||||||
|
|
||||||
@ViewChild('facetAccordion', { static: false }) accordion: MatAccordion;
|
|
||||||
|
|
||||||
displayGrantStateValue = (option) => option['value'];
|
|
||||||
displayGrantStateLabel = (option) => option['label'];
|
|
||||||
|
|
||||||
displayGrantValue = (option) => option['id'];
|
|
||||||
displayGrantLabel = (option) => option['label'];
|
|
||||||
|
|
||||||
displayProfileValue = (option) => option['id'];
|
|
||||||
displayProfileLabel = (option) => option['label'];
|
|
||||||
|
|
||||||
displayDmpOrganisationsValue = (option) => option['id'];
|
|
||||||
displayDmpOrganisationsLabel = (option) => option['name'];
|
|
||||||
|
|
||||||
profileAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterProfile.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) =>
|
|
||||||
this.filterProfile('').pipe(
|
|
||||||
map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['label'],
|
|
||||||
titleFn: (item) => item['label']
|
|
||||||
};
|
|
||||||
|
|
||||||
organizationAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterOrganisation.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) =>
|
|
||||||
this.getOrganisations().pipe(
|
|
||||||
map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['name'],
|
|
||||||
titleFn: (item) => item['name']
|
|
||||||
}
|
|
||||||
|
|
||||||
grantAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
|
||||||
filterFn: this.filterGrant.bind(this),
|
|
||||||
initialItems: (excludedItems: any[]) =>
|
|
||||||
this.filterGrant('').pipe(
|
|
||||||
map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
|
||||||
displayFn: (item) => item['label'],
|
|
||||||
titleFn: (item) => item['label']
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public activatedRoute: ActivatedRoute,
|
|
||||||
public languageService: TranslateService,
|
|
||||||
public grantService: GrantService,
|
|
||||||
private authentication: AuthService,
|
|
||||||
public datasetProfileService: DatasetService,
|
|
||||||
public organisationService: OrganisationService,
|
|
||||||
public externalSourcesService: ExternalSourcesService,
|
|
||||||
private dmpService: DmpService
|
|
||||||
) {
|
|
||||||
super(new ValidationErrorModel());
|
|
||||||
this.IsChecked = false;
|
|
||||||
this.IsIndeterminate = false;
|
|
||||||
this.LabelAlign = 'after';
|
|
||||||
this.IsDisabled = false;
|
|
||||||
this.Active = "0";
|
|
||||||
this.Inactive = "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
setTimeout(x => {
|
|
||||||
this.grantStateOptions = observableOf(
|
|
||||||
[
|
|
||||||
{ label: this.languageService.instant('FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE'), value: GrantStateType.Finished },
|
|
||||||
{ label: this.languageService.instant('FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE'), value: GrantStateType.OnGoing },
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
//this.profiles = this.datasetProfileService.getDatasetProfiles();
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
this.dmpOrganisations = this.organisationService.searchPublicOrganisations(new DataTableRequest<OrganisationCriteria>(0, null, { fields: fields })).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
|
||||||
// this.accordion.openAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
OnChange($event) {
|
|
||||||
console.log($event);
|
|
||||||
}
|
|
||||||
|
|
||||||
OnIndeterminateChange($event) {
|
|
||||||
console.log($event);
|
|
||||||
}
|
|
||||||
|
|
||||||
controlModified() {
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
grantSearch(value: string): Observable<GrantListingModel[]> {
|
|
||||||
const grantCriteria = new GrantCriteria();
|
|
||||||
grantCriteria.grantStateType = this.facetCriteria.grantStatus;
|
|
||||||
grantCriteria['length'] = 10;
|
|
||||||
grantCriteria.like = value;
|
|
||||||
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
|
|
||||||
const dataTableRequest: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = grantCriteria;
|
|
||||||
return this.grantService.getPublicPaged(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
grantStatusChanged(event) {
|
|
||||||
this.facetCriteria.grantStatus = event.value;
|
|
||||||
// this.facetCriteria.grantStatus = +event.source.ariaLabel; // For checkboxes
|
|
||||||
// this.facetCriteria.grantStatus = event.option.value.value; // For <app-explore-dmp-filter-item-component>
|
|
||||||
// if (!event.source.checked) {
|
|
||||||
if (event.value === 'null') {
|
|
||||||
this.facetCriteria.grantStatus = null;
|
|
||||||
this.grants = observableOf([]);
|
|
||||||
this.facetCriteria.grants = [];
|
|
||||||
}
|
|
||||||
// if (event.checked) {
|
|
||||||
// if (event.option.selected) {
|
|
||||||
// if (event.source.checked) {
|
|
||||||
else {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new GrantCriteria();
|
|
||||||
dataTableRequest.criteria.grantStateType = this.facetCriteria.grantStatus;
|
|
||||||
dataTableRequest.criteria['length'] = 10;
|
|
||||||
|
|
||||||
this.grants = this.grantService.getPublicPaged(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
this.facetCriteria.grants = [];
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
grantChanged(event: any) {
|
|
||||||
const eventValue = event.option.value.id;
|
|
||||||
if (event.option.selected) { this.facetCriteria.grants.push(eventValue); }
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.facetCriteria.grants.indexOf(eventValue);
|
|
||||||
this.facetCriteria.grants.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeGrant(grant) {
|
|
||||||
this.facetCriteria.grants.splice(this.facetCriteria.grants.indexOf(grant), 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onProfileOptionSelected(items: DatasetProfileModel) {
|
|
||||||
//this.facetCriteria.datasetProfile.splice(0);
|
|
||||||
this.facetCriteria.datasetProfile.push(items.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onProfileOptionRemoved(item: DatasetProfileModel) {
|
|
||||||
const index = this.facetCriteria.datasetProfile.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.datasetProfile.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
profileChanged(event: any) {
|
|
||||||
const eventValue = event.option.value.id;
|
|
||||||
if (event.option.selected) {
|
|
||||||
this.facetCriteria.datasetProfile.push(eventValue);
|
|
||||||
}
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.facetCriteria.datasetProfile.indexOf(eventValue);
|
|
||||||
this.facetCriteria.datasetProfile.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeProfile(profile) {
|
|
||||||
this.facetCriteria.datasetProfile.splice(this.facetCriteria.datasetProfile.indexOf(profile), 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onOrganizationOptionSelected(item: OrganizationModel) {
|
|
||||||
this.facetCriteria.dmpOrganisations.push(item.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onOrganizationOptionRemoved(item: OrganizationModel) {
|
|
||||||
const index = this.facetCriteria.dmpOrganisations.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.dmpOrganisations.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onGrantOptionSelected(item: GrantListingModel) {
|
|
||||||
this.facetCriteria.grants.push(item.id);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
onGrantOptionRemoved(item: GrantListingModel) {
|
|
||||||
const index = this.facetCriteria.grants.indexOf(item.id);
|
|
||||||
if (index >= 0) {
|
|
||||||
this.facetCriteria.grants.splice(index, 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public roleChanged(event: any) {
|
|
||||||
this.facetCriteria.role = event.value;
|
|
||||||
if (event.value === 'null') {
|
|
||||||
this.facetCriteria.role = null;
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
dmpOrganisationChanged(event: any) {
|
|
||||||
const eventValue = event.option.value.id;
|
|
||||||
if (event.option.selected) { this.facetCriteria.dmpOrganisations.push(eventValue); }
|
|
||||||
if (!event.option.selected) {
|
|
||||||
const index = this.facetCriteria.dmpOrganisations.indexOf(eventValue);
|
|
||||||
this.facetCriteria.dmpOrganisations.splice(index, 1);
|
|
||||||
}
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
// profileSearch(value: string) {
|
|
||||||
// return this.datasetProfileService.getDatasetProfiles();
|
|
||||||
// }
|
|
||||||
|
|
||||||
dmpOrganisationSearch(value: string): Observable<OrganizationModel[]> {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new OrganisationCriteria();
|
|
||||||
dataTableRequest.criteria.labelLike = value;
|
|
||||||
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
removeOrganisation(organisation) {
|
|
||||||
this.facetCriteria.dmpOrganisations.splice(this.facetCriteria.dmpOrganisations.indexOf(organisation), 1);
|
|
||||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
// getProfiles() {
|
|
||||||
// return this.datasetProfileService.getDatasetProfiles();
|
|
||||||
// }
|
|
||||||
|
|
||||||
getOrganisations() {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new OrganisationCriteria();
|
|
||||||
dataTableRequest.criteria.labelLike = '';
|
|
||||||
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
filterGrant(query: string) {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const grantRequestItem: DataTableRequest<GrantCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
grantRequestItem.criteria = new GrantCriteria();
|
|
||||||
grantRequestItem.criteria.like = query;
|
|
||||||
return this.grantService.getPublicPaged(grantRequestItem).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
filterProfile(query: string) {
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const profileRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
profileRequestItem.criteria = new DatasetProfileCriteria();
|
|
||||||
profileRequestItem.criteria.like = query;
|
|
||||||
|
|
||||||
return this.datasetProfileService.getDatasetProfiles(profileRequestItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
filterOrganisation(value: string) {
|
|
||||||
this.filteringOrganisationsAsync = true;
|
|
||||||
const fields: Array<string> = new Array<string>();
|
|
||||||
fields.push('asc');
|
|
||||||
const dataTableRequest: DataTableRequest<OrganisationCriteria> = new DataTableRequest(0, null, { fields: fields });
|
|
||||||
dataTableRequest.criteria = new OrganisationCriteria();
|
|
||||||
dataTableRequest.criteria.labelLike = value;
|
|
||||||
|
|
||||||
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
displayLabel(value) {
|
|
||||||
return this.displayTitleFunc ? this.displayTitleFunc(value) : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
isOptionSelected(profile: any) {
|
|
||||||
return this.formGroup.value.map(x => x.id).indexOf(profile.id) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public isAuthenticated(): boolean {
|
|
||||||
return !(!this.authentication.current());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
<div class="header-image">
|
|
||||||
<div class="header-text-container">
|
|
||||||
<h3>{{ 'ABOUT.WELCOME' | translate }}</h3>
|
|
||||||
<h4>{{ 'ABOUT.WELCOME-MESSAGE' | translate }}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="explore-dmp-content">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header card-header-plain d-flex">
|
|
||||||
<div class="card-desc d-flex flex-column justify-content-center">
|
|
||||||
<h4 class="card-title">{{'DMP-LISTING.TITLE' | translate}}</h4>
|
|
||||||
<div *ngIf="allVersions">
|
|
||||||
<span class="all-versions">
|
|
||||||
{{'DMP-LISTING.VIEW-ALL-VERSIONS' | translate}}
|
|
||||||
</span>
|
|
||||||
<span class="dmp-label">
|
|
||||||
{{this.groupLabel}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body table-responsive">
|
|
||||||
<div class="explore-dmp-listing row pb-2">
|
|
||||||
<div class="col-12 col-sm-12 col-md-3">
|
|
||||||
<app-explore-dmp-filters-component class="col-auto" (facetCriteriaChange)="onCriteriaChange($event)"></app-explore-dmp-filters-component>
|
|
||||||
<!-- <app-explore-dmp-filters-component class="col-auto" [showGrant]="showGrant" (facetCriteriaChange)="onCriteriaChange($event)"></app-explore-dmp-filters-component> -->
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-sm-12 col-md-9 pt-4">
|
|
||||||
<div *ngFor="let item of listingItems; let i = index">
|
|
||||||
<app-explore-dmp-listing-item-component [showDivider]="i !== (listingItems.length - 1)" [dmp]="item"></app-explore-dmp-listing-item-component>
|
|
||||||
</div>
|
|
||||||
<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)"></mat-paginator>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,86 +0,0 @@
|
|||||||
@import "node_modules/bootstrap/scss/functions";
|
|
||||||
@import "node_modules/bootstrap/scss/variables";
|
|
||||||
@import "node_modules/bootstrap/scss/mixins/_breakpoints";
|
|
||||||
|
|
||||||
@include media-breakpoint-down(sm) {
|
|
||||||
.lightblue-btn {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
::ng-deep .mat-paginator-container {
|
|
||||||
height: auto !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
text-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-desc {
|
|
||||||
min-height: 5vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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 {
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-container {
|
|
||||||
flex-direction: row-reverse !important;
|
|
||||||
justify-content: space-between !important;
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
height: 30px;
|
|
||||||
min-height: 30px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-page-size {
|
|
||||||
height: 43px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-icon-button {
|
|
||||||
height: 30px !important;
|
|
||||||
font-size: 12px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-range-label {
|
|
||||||
margin: 15px 32px 0 24px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-range-actions {
|
|
||||||
width: auto !important;
|
|
||||||
min-width: 55% !important;
|
|
||||||
min-height: 43px !important;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
::ng-deep .mat-paginator-navigation-previous {
|
|
||||||
margin-left: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.all-versions {
|
|
||||||
color: #999999 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dmp-label {
|
|
||||||
color: #089dbb !important;
|
|
||||||
}
|
|
@ -1,198 +0,0 @@
|
|||||||
|
|
||||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
|
||||||
import { MatPaginator } from "@angular/material/paginator";
|
|
||||||
import { MatSort } from "@angular/material/sort";
|
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
|
||||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
|
||||||
import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
|
|
||||||
import { ExploreDmpCriteriaModel } from '@app/core/query/explore-dmp/explore-dmp-criteria';
|
|
||||||
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|
||||||
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
|
||||||
import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
|
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dmp-listing-component',
|
|
||||||
templateUrl: 'explore-dmp-listing.component.html',
|
|
||||||
styleUrls: ['./explore-dmp-listing.component.scss'],
|
|
||||||
})
|
|
||||||
export class ExploreDmpListingComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
|
||||||
|
|
||||||
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
|
||||||
sort = new MatSort();
|
|
||||||
|
|
||||||
exploreDmpCriteriaModel: ExploreDmpCriteriaModel = new ExploreDmpCriteriaModel();
|
|
||||||
titlePrefix: string;
|
|
||||||
totalCount: number;
|
|
||||||
listingItems: DmpListingModel[] = [];
|
|
||||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
|
||||||
linkToDmpId: string;
|
|
||||||
groupId: string;
|
|
||||||
allVersions: boolean = false;
|
|
||||||
groupLabel: string;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private dmpService: DmpService,
|
|
||||||
private router: Router,
|
|
||||||
private route: ActivatedRoute,
|
|
||||||
private language: TranslateService,
|
|
||||||
) {
|
|
||||||
super();
|
|
||||||
this.sort.direction = 'desc';
|
|
||||||
this.sort.active = "publishedAt";
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.route.params
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(params => {
|
|
||||||
if (params['groupId']) {
|
|
||||||
this.groupId = params['groupId'];
|
|
||||||
this.exploreDmpCriteriaModel.groupIds.push(this.groupId);
|
|
||||||
this.exploreDmpCriteriaModel.allVersions = true;
|
|
||||||
this.allVersions = true;
|
|
||||||
this.route.queryParams
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(queryParams => {
|
|
||||||
if (queryParams["groupLabel"]) {
|
|
||||||
this.groupLabel = queryParams["groupLabel"];
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.refresh();
|
|
||||||
const breadCrumbs = [];
|
|
||||||
breadCrumbs.push({
|
|
||||||
parentComponentName: null,
|
|
||||||
label: this.language.instant('NAV-BAR.PUBLIC-DMPS'),
|
|
||||||
url: "/explore-plans"
|
|
||||||
})
|
|
||||||
this.breadCrumbs = observableOf(breadCrumbs);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
refresh() {
|
|
||||||
if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
|
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
|
||||||
let fields: Array<string> = new Array();
|
|
||||||
if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
|
|
||||||
const request = new DataTableRequest<ExploreDmpCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
|
|
||||||
request.criteria = this.exploreDmpCriteriaModel || this.getDefaultCriteria();
|
|
||||||
this.dmpService.getPublicPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
||||||
if (!result) { return []; }
|
|
||||||
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
|
||||||
this.listingItems = result.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
getDefaultCriteria(): ExploreDmpCriteriaModel {
|
|
||||||
const defaultCriteria = new ExploreDmpCriteriaModel();
|
|
||||||
return defaultCriteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
onCriteriaChange(event: ExploreDmpCriteriaModel) {
|
|
||||||
this.exploreDmpCriteriaModel = event;
|
|
||||||
if (this.allVersions == true) this.exploreDmpCriteriaModel.allVersions = this.allVersions;
|
|
||||||
if (this.groupId) this.exploreDmpCriteriaModel.groupIds.push(this.groupId);
|
|
||||||
this._paginator.pageIndex = 0;
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
pageThisEvent(event) {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
// rowClicked(dmp: DmpListingModel) {
|
|
||||||
// this.router.navigate(['overview', dmp.id], { relativeTo: this.route });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @ViewChild(MatPaginator) _paginator: MatPaginator;
|
|
||||||
// @ViewChild(MatSort) sort: MatSort;
|
|
||||||
// criteria: ExploreDmpCriteriaModel = new ExploreDmpCriteriaModel();
|
|
||||||
|
|
||||||
// dataSource: DmpDataSource | null;
|
|
||||||
// displayedColumns: String[] = ['name', 'grant', 'organisations', 'created'];
|
|
||||||
// pageEvent: PageEvent;
|
|
||||||
// titlePrefix: String;
|
|
||||||
// dmpId: string;
|
|
||||||
|
|
||||||
// constructor(
|
|
||||||
// public dmpService: DmpService,
|
|
||||||
// private router: Router,
|
|
||||||
// private languageService: TranslateService,
|
|
||||||
// public snackBar: MatSnackBar,
|
|
||||||
// public route: ActivatedRoute
|
|
||||||
// ) {
|
|
||||||
// super();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ngOnInit() {
|
|
||||||
// this.refresh();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// rowClick(rowId: String) {
|
|
||||||
// this.router.navigate(['/plans/publicEdit/' + rowId]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// refresh() {
|
|
||||||
// this.dataSource = new DmpDataSource(this.dmpService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// getDefaultCriteria(dmpId: String): DmpCriteria {
|
|
||||||
// const defaultCriteria = new DmpCriteria();
|
|
||||||
// return defaultCriteria;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// onCriteriaChange(event: ExploreDmpCriteriaModel) {
|
|
||||||
// //console.log(event)
|
|
||||||
// this.criteria = event;
|
|
||||||
// this.refresh();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// export class DmpDataSource extends DataSource<DmpListingModel> {
|
|
||||||
|
|
||||||
// totalCount = 0;
|
|
||||||
|
|
||||||
// constructor(
|
|
||||||
// private _service: DmpService,
|
|
||||||
// private _paginator: MatPaginator,
|
|
||||||
// private _sort: MatSort,
|
|
||||||
// private _languageService: TranslateService,
|
|
||||||
// private _snackBar: MatSnackBar,
|
|
||||||
// private _criteria: ExploreDmpCriteriaModel,
|
|
||||||
// ) {
|
|
||||||
// super();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// connect(): Observable<DmpListingModel[]> {
|
|
||||||
// const displayDataChanges = [
|
|
||||||
// this._paginator.page
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// return Observable.merge(...displayDataChanges)
|
|
||||||
// .startWith(null)
|
|
||||||
// .switchMap(() => {
|
|
||||||
// const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
|
||||||
// let fields: Array<string> = new Array();
|
|
||||||
// if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
|
||||||
// const request = new DataTableRequest<ExploreDmpCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
|
|
||||||
// request.criteria = this._criteria;
|
|
||||||
// //if (this.dmpId) request.criteria.allVersions = true;
|
|
||||||
// return this._service.getPublicPaged(request);
|
|
||||||
// })
|
|
||||||
// .map(result => {
|
|
||||||
// if (!result) { return []; }
|
|
||||||
// if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
|
||||||
// return result.data;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// disconnect(): void {
|
|
||||||
// // No-op
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,27 +0,0 @@
|
|||||||
import { NgModule } from "@angular/core";
|
|
||||||
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
|
||||||
import { DmpOverviewModule } from '@app/ui/dmp/overview/dmp-overview.module';
|
|
||||||
import { ExploreDmpFilterItemComponent } from '@app/ui/explore-dmp/dmp-explore-filters/explore-dmp-filter-item/explore-dmp-filter-item.component';
|
|
||||||
import { ExploreDmpFiltersComponent } from '@app/ui/explore-dmp/dmp-explore-filters/explore-dmp-filters.component';
|
|
||||||
import { ExploreDmpListingComponent } from '@app/ui/explore-dmp/explore-dmp-listing.component';
|
|
||||||
import { ExploreDmpRoutingModule } from '@app/ui/explore-dmp/explore-dmp.routing';
|
|
||||||
import { ExploreDmpListingItemComponent } from '@app/ui/explore-dmp/listing-item/explore-dmp-listing-item.component';
|
|
||||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
|
||||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
CommonUiModule,
|
|
||||||
CommonFormsModule,
|
|
||||||
AutoCompleteModule,
|
|
||||||
ExploreDmpRoutingModule,
|
|
||||||
DmpOverviewModule
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
ExploreDmpListingComponent,
|
|
||||||
ExploreDmpFiltersComponent,
|
|
||||||
ExploreDmpFilterItemComponent,
|
|
||||||
ExploreDmpListingItemComponent
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class ExploreDmpModule { }
|
|
@ -1,35 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
|
||||||
import { ExploreDmpListingComponent } from './explore-dmp-listing.component';
|
|
||||||
import { DmpOverviewComponent } from '../dmp/overview/dmp-overview.component';
|
|
||||||
|
|
||||||
const routes: Routes = [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: ExploreDmpListingComponent,
|
|
||||||
data: {
|
|
||||||
breadcrumb: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'versions/:groupId',
|
|
||||||
component: ExploreDmpListingComponent,
|
|
||||||
data: {
|
|
||||||
breadcrumb: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'overview/:publicId',
|
|
||||||
component: DmpOverviewComponent,
|
|
||||||
data: {
|
|
||||||
breadcrumb: true,
|
|
||||||
title: 'GENERAL.TITLES.EXPLORE-PLANS-OVERVIEW'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [RouterModule.forChild(routes)],
|
|
||||||
exports: [RouterModule]
|
|
||||||
})
|
|
||||||
export class ExploreDmpRoutingModule { }
|
|
@ -1,88 +0,0 @@
|
|||||||
<div class="listing-item">
|
|
||||||
<a [routerLink]="['/explore-plans/overview/' + this.dmp.id]">
|
|
||||||
<div class="col">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 gray-container container-header">
|
|
||||||
{{dmp.grantAbbreviation}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-auto">
|
|
||||||
<div class="outer-circle"><div class="inner-circle" matTooltip="{{'DMP-PUBLIC-LISTING.TOOLTIP.PUBLISHED' | translate}}"></div></div>
|
|
||||||
<!-- <mat-icon matTooltip="{{'DMP-PUBLIC-LISTING.TOOLTIP.PUBLISHED' | translate}}" class="published-icon">fiber_manual_record</mat-icon> -->
|
|
||||||
<!-- <mat-icon matTooltip="{{'DMP-PUBLIC-LISTING.TOOLTIP.PUBLISHED' | translate}}" class="published-icon">radio_button_checked</mat-icon> -->
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<div class="row d-flex flex-wrap">
|
|
||||||
<div class="col pl-0">
|
|
||||||
<h4 class="title pl-0">{{dmp.label}}</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-auto pl-0">
|
|
||||||
<p class="mt-1 description">{{dmp.description}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto about-item ml-auto">
|
|
||||||
<p>{{'DMP-LISTING.COLUMNS.VERSION' | translate}} : {{dmp.version}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-auto about-item pl-0">
|
|
||||||
<!-- <mat-icon class="gray-icon pt-2">settings</mat-icon> -->
|
|
||||||
<!-- <h4 class="mt-2 ml-1 mr-3 p-1">{{roleDisplay(dmp.users).toUpperCase()}}</h4> -->
|
|
||||||
|
|
||||||
<mat-icon matTooltip="{{'DMP-PUBLIC-LISTING.TOOLTIP.INVOLVED-DATASETS' | translate}}" class="gray-icon pt-2">storage</mat-icon>
|
|
||||||
<h4 class="length mt-2 ml-1 mr-3 p-1">{{dmp.datasets.length}}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto about-item">
|
|
||||||
<mat-icon matTooltip="{{'DMP-PUBLIC-LISTING.TOOLTIP.TEMPLATES-INVOLVED' | translate}}" class="gray-icon pt-2">assignment</mat-icon>
|
|
||||||
<div *ngFor="let profile of dmp.associatedProfiles" class="pt-1">
|
|
||||||
<div matTooltip="{{profile.label}}" class="chip ml-2 mr-2">{{profile.label}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto about-item ml-auto">
|
|
||||||
<p>{{'DMP-PROFILE-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.finalizedAt | date: "shortDate"}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <div class="explore-dmp-listing-item row" (click)="itemClicked()">
|
|
||||||
<div class="col-auto">
|
|
||||||
<mat-icon>lock</mat-icon>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<div class="row">
|
|
||||||
<h4 class="col-12 title">{{dmp.label}}</h4>
|
|
||||||
<h4 class="col-12 grant-title">{{dmp.grant}}</h4>
|
|
||||||
</div>
|
|
||||||
<div class="row d-flex align-items-center my-1">
|
|
||||||
<mat-icon class="col-auto gray-icon">storage</mat-icon>
|
|
||||||
<h4 class="col-auto m-2 p-1">{{dmp.associatedProfiles.length}}</h4>
|
|
||||||
<div class="row" *ngFor="let profile of dmp.associatedProfiles">
|
|
||||||
<div class="col-auto explore-dmp-chip ml-2">{{profile.label}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row d-flex align-items-center my-1">
|
|
||||||
<mat-icon class="col-auto gray-icon">settings</mat-icon>
|
|
||||||
<h4 class="col-auto m-0 p-0">OWNER</h4>
|
|
||||||
</div>
|
|
||||||
<div class="row d-flex align-items-center my-1">
|
|
||||||
<mat-icon class="col-auto gray-icon">group</mat-icon>
|
|
||||||
<div class="col-auto explore-dmp-squared-chip mr-2">JOHN DOE</div>
|
|
||||||
<div class="col-auto explore-dmp-squared-chip mr-2">JOHN DOE</div>
|
|
||||||
<div class="col-auto explore-dmp-squared-chip mr-2">JOHN DOE</div>
|
|
||||||
<div class="col-auto explore-dmp-squared-chip mr-2">JOHN DOE</div>
|
|
||||||
<div class="col-auto explore-dmp-squared-chip mr-2">JOHN DOE</div>
|
|
||||||
<div class="col-auto explore-dmp-squared-chip mr-2">JOHN DOE</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-auto">
|
|
||||||
<mat-icon>more_horiz</mat-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<mat-divider *ngIf="showDivider"></mat-divider> -->
|
|
@ -1,142 +0,0 @@
|
|||||||
.gray-container {
|
|
||||||
letter-spacing: 5px;
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
margin-top: 0px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item h4 {
|
|
||||||
font-size: 1rem;
|
|
||||||
line-height: 1.25em;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item .length {
|
|
||||||
color: #00b29f;
|
|
||||||
// color: #089dbb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item .title {
|
|
||||||
margin: 2px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.about-item p {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
padding-top: 7px;
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.draft-icon {
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.more-horiz {
|
|
||||||
font-size: 28px;
|
|
||||||
color: #aaaaaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-published-icon {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #08bd6342;
|
|
||||||
margin-top: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.published-icon {
|
|
||||||
color: #08bd63;
|
|
||||||
font-size: 12px;
|
|
||||||
margin-left: 4px;
|
|
||||||
padding-bottom: 7px;
|
|
||||||
// padding-top: 2px;
|
|
||||||
// padding-left: 4px;
|
|
||||||
// color: #92d050;
|
|
||||||
}
|
|
||||||
|
|
||||||
.outer-circle {
|
|
||||||
background: #08bd6342;
|
|
||||||
border-radius: 50%;
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
position: relative;
|
|
||||||
margin-top: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inner-circle {
|
|
||||||
position: absolute;
|
|
||||||
background: #08bd63;
|
|
||||||
border-radius: 50%;
|
|
||||||
height: 10px;
|
|
||||||
width: 10px;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
margin: -5px 0px 0px -5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
display: inline;
|
|
||||||
padding-left: 1em;
|
|
||||||
line-height: 1.7em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h4 > span {
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
margin-bottom: 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
// .explore-dmp-listing-item {
|
|
||||||
// margin-top: 2em;
|
|
||||||
// margin-bottom: 2em;
|
|
||||||
// cursor: pointer;
|
|
||||||
|
|
||||||
// .title {
|
|
||||||
// color: black;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .grant-title {
|
|
||||||
// color: rgb(93, 125, 173);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .gray-icon {
|
|
||||||
// color: rgb(191, 191, 191);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .explore-dmp-chip {
|
|
||||||
// padding: 0.1em 1em;
|
|
||||||
// border: 0.1em solid rgb(236, 241, 249);
|
|
||||||
// border-radius: 10em;
|
|
||||||
// background-color: rgb(236, 241, 249);
|
|
||||||
// color: rgb(68, 114, 196);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .explore-dmp-squared-chip {
|
|
||||||
// padding: 0.1em 1em;
|
|
||||||
// border: 0.1em solid rgb(236, 241, 249);
|
|
||||||
// border-radius: 0.5em;
|
|
||||||
// background-color: rgb(246, 246, 246);
|
|
||||||
// color: rgb(127, 127, 127);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// mat-icon {
|
|
||||||
// width: auto;
|
|
||||||
// height: auto;
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,53 +0,0 @@
|
|||||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
||||||
import { DmpListingModel } from '../../../core/model/dmp/dmp-listing';
|
|
||||||
import { Principal } from '../../../core/model/auth/principal';
|
|
||||||
import { AuthService } from '../../../core/services/auth/auth.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-explore-dmp-listing-item-component',
|
|
||||||
templateUrl: './explore-dmp-listing-item.component.html',
|
|
||||||
styleUrls: ['./explore-dmp-listing-item.component.scss'],
|
|
||||||
})
|
|
||||||
export class ExploreDmpListingItemComponent implements OnInit {
|
|
||||||
|
|
||||||
@Input() dmp: DmpListingModel;
|
|
||||||
@Input() showDivider: boolean = true;
|
|
||||||
@Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter();
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private authentication: AuthService,
|
|
||||||
private translate: TranslateService,
|
|
||||||
private router: Router,
|
|
||||||
private route: ActivatedRoute
|
|
||||||
) { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// itemClicked() {
|
|
||||||
// this.onClick.emit(this.dmp);
|
|
||||||
// }
|
|
||||||
|
|
||||||
roleDisplay(value: any) {
|
|
||||||
const principal: Principal = this.authentication.current();
|
|
||||||
let role: number;
|
|
||||||
if (principal) {
|
|
||||||
value.forEach(element => {
|
|
||||||
if (principal.id === element.id) {
|
|
||||||
role = element.role;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (role === 0) {
|
|
||||||
return this.translate.instant('DMP-PUBLIC-LISTING.OWNER');
|
|
||||||
}
|
|
||||||
else if (role === 1) {
|
|
||||||
return this.translate.instant('DMP-PUBLIC-LISTING.MEMBER');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return this.translate.instant('DMP-PUBLIC-LISTING.VIEW-ONLY');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue