Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign

This commit is contained in:
apapachristou 2020-07-27 13:53:08 +03:00
commit 8e7d426947
43 changed files with 607 additions and 265 deletions

View File

@ -210,7 +210,15 @@ public class DMPs extends BaseController {
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<UUID>> createOrUpdate(@RequestBody eu.eudat.models.data.dmp.DataManagementPlanEditorModel dataManagementPlanEditorModel, Principal principal) throws Exception {
DMP dmp = this.dataManagementPlanManager.createOrUpdate(this.getApiContext(), dataManagementPlanEditorModel, principal);
DMP dmp = this.dataManagementPlanManager.createOrUpdate(dataManagementPlanEditorModel, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created").payload(dmp.getId()));
}
@Transactional
@RequestMapping(method = RequestMethod.POST, path = "full", consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<UUID>> createOrUpdateWithDatasets(@RequestBody eu.eudat.models.data.dmp.DataManagementPlanEditorModel dataManagementPlanEditorModel, Principal principal) throws Exception {
DMP dmp = this.dataManagementPlanManager.createOrUpdateWithDatasets(dataManagementPlanEditorModel, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<UUID>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created").payload(dmp.getId()));
}
@ -261,7 +269,8 @@ public class DMPs extends BaseController {
this.dataManagementPlanManager.makePublic(UUID.fromString(id), principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Data Datamanagement Plan made public."));
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
logger.error(e.getMessage(), e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to make Data Management Plan public."));
}
}
@ -272,7 +281,8 @@ public class DMPs extends BaseController {
this.dataManagementPlanManager.makeFinalize(UUID.fromString(id), principal, datasetsToBeFinalized);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Data Datamanagement Plan made finalized."));
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
logger.error(e.getMessage(), e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to finalize Data Management Plan."));
}
}
@ -283,7 +293,8 @@ public class DMPs extends BaseController {
this.dataManagementPlanManager.undoFinalize(UUID.fromString(id), principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DMP>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully Data Datamanagement Plan made active."));
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
logger.error(e.getMessage(), e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DMP>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to unfinalize the Data Management Plan."));
}
}
@ -312,7 +323,7 @@ public class DMPs extends BaseController {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Successfully created DOI for Data Datamanagement Plan in question.").payload(zenodoDOI));
} catch (Exception e) {
logger.error(e.getMessage(), e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message(e.getMessage()));
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<String>().status(ApiMessageCode.ERROR_MESSAGE).message("Failed to create DOI for the Data Management Plan."));
}
}

View File

@ -137,10 +137,10 @@ public class DashBoardManager {
List<Integer> roles = new LinkedList<>();
List<Dmp> finalDmps = dmps;
CompletableFuture dmpFuture = dataManagementPlanRepository.getAuthenticated(dmps != null ? dataManagementPlanRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList()))) : dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles).distinct().countAsync()
CompletableFuture dmpFuture = dataManagementPlanRepository.getAuthenticated((dmps != null && !dmps.isEmpty()) ? dataManagementPlanRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList()))) : dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles).distinct().countAsync()
.whenComplete((dmpsStats, throwable) -> statistics.setTotalDataManagementPlanCount(dmpsStats));
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
CompletableFuture datasetFuture = datasetRepository.getAuthenticated(datasets != null ? datasetRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList()))) : datasetRepository.getWithCriteria(datasetCriteria), user, roles).countAsync()
CompletableFuture datasetFuture = datasetRepository.getAuthenticated((datasets != null && !datasets.isEmpty()) ? datasetRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList()))) : datasetRepository.getWithCriteria(datasetCriteria), user, roles).countAsync()
.whenComplete((datasetsStats, throwable) -> statistics.setTotalDataSetCount(datasetsStats));
CompletableFuture grantFuture = grantRepository.getAuthenticated(grantRepository.getWithCriteria(grantCriteria), user).countAsync()
.whenComplete((grantsStats, throwable) -> statistics.setTotalGrantCount(grantsStats));
@ -193,6 +193,7 @@ public class DashBoardManager {
@Transactional
public List<RecentActivityModel> getNewRecentActivity(RecentActivityTableRequest tableRequest, Principal principal) {
boolean isAuthenticated = principal.getId() != null;
List<RecentActivityModel> recentActivityModels = new ArrayList<>();
DMPDao dataManagementPlanRepository = databaseRepository.getDmpDao();
DatasetDao datasetRepository = databaseRepository.getDatasetDao();
@ -201,26 +202,67 @@ public class DashBoardManager {
DatasetCriteria datasetCriteria = new DatasetCriteria();
datasetCriteria.setLike(tableRequest.getCriteria().getLike());
datasetCriteria.setAllVersions(false);
datasetCriteria.setIsPublic(!isAuthenticated);
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
dataManagementPlanCriteria.setAllVersions(false);
dataManagementPlanCriteria.setLike(tableRequest.getCriteria().getLike());
dataManagementPlanCriteria.setIsPublic(!isAuthenticated);
dataManagementPlanCriteria.setOnlyPublic(!isAuthenticated);
QueryableList<DMP> dmpList;
QueryableList<Dataset> datasetList;
if (principal.getId() != null) {
datasetCriteria.setIsPublic(false);
List<Integer> roles = new LinkedList<>();
dmpList = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles);
datasetList = datasetRepository.getAuthenticated(datasetRepository.getWithCriteria(datasetCriteria), user, roles);
List<eu.eudat.elastic.entities.Dataset> datasets = null;
List<eu.eudat.elastic.entities.Dmp> dmps = null;
if (apiContext.getOperationsContext().getElasticRepository().getDatasetRepository() != null) {
try {
eu.eudat.elastic.criteria.DatasetCriteria datasetElasticCriteria = new eu.eudat.elastic.criteria.DatasetCriteria();
datasetElasticCriteria.setLike(tableRequest.getCriteria().getLike());
datasetElasticCriteria.setAllowAllVersions(false);
datasetElasticCriteria.setPublic(!isAuthenticated);
datasets = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().query(datasetElasticCriteria);
}catch (Exception e) {
logger.warn(e.getMessage(), e);
datasets = null;
}
}
if (apiContext.getOperationsContext().getElasticRepository().getDmpRepository() != null) {
try {
eu.eudat.elastic.criteria.DmpCriteria dmpElasticCriteria = new eu.eudat.elastic.criteria.DmpCriteria();
dmpElasticCriteria.setLike(tableRequest.getCriteria().getLike());
dmpElasticCriteria.setAllowAllVersions(false);
dmpElasticCriteria.setPublic(!isAuthenticated);
dmps = apiContext.getOperationsContext().getElasticRepository().getDmpRepository().query(dmpElasticCriteria);
}catch (Exception e) {
logger.warn(e.getMessage(), e);
datasets = null;
}
}
if (dmps != null && !dmps.isEmpty()) {
List<Dmp> finalDmps = dmps;
dmpList = dataManagementPlanRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDmps.stream().map(Dmp::getId).collect(Collectors.toList()))).distinct();
} else {
dmpList = dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria).distinct();
}
if (datasets != null && !datasets.isEmpty()) {
List<eu.eudat.elastic.entities.Dataset> finalDatasets = datasets;
datasetList = datasetRepository.asQueryable().where((builder, root) -> root.get("id").in(finalDatasets.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())));
} else {
dataManagementPlanCriteria.setIsPublic(true);
dataManagementPlanCriteria.setOnlyPublic(true);
datasetCriteria.setIsPublic(true);
dmpList = dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria);
datasetList = datasetRepository.getWithCriteria(datasetCriteria);
}
if (isAuthenticated) {
List<Integer> roles = new LinkedList<>();
dmpList = dataManagementPlanRepository.getAuthenticated(dmpList, principal.getId(), roles);
datasetList = datasetRepository.getAuthenticated(datasetList, user, roles);
}
/*CompletableFuture future = CompletableFuture.runAsync(() -> */{
recentActivityModels.addAll(dmpList
.withHint(HintedModelFactory.getHint(RecentDmpModel.class))

View File

@ -208,6 +208,15 @@ public class DataManagementPlanManager {
throw new ForbiddenException("Selected DMP is not public");
}
dataManagementPlan.fromDataModel(dataManagementPlanEntity);
List<Dataset> datasetEnities = new ArrayList<>(dataManagementPlanEntity.getDataset());
for (int i = 0; i < datasetEnities.size(); i++) {
for (int j = i; j < dataManagementPlan.getDatasets().size(); j++) {
if (dataManagementPlan.getDatasets().get(j).getId().equals(datasetEnities.get(i).getId())) {
dataManagementPlan.getDatasets().get(j).setDatasetProfileDefinition(datasetManager.getPagedProfile(dataManagementPlan.getDatasets().get(j), datasetEnities.get(i)));
break;
}
}
}
if (isPublic) {
dataManagementPlan.setDatasets(dataManagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList()));
}
@ -333,7 +342,7 @@ public class DataManagementPlanManager {
* Data Management
* */
public DMP createOrUpdate(ApiContext apiContext, DataManagementPlanEditorModel dataManagementPlan, Principal principal) throws Exception {
public DMP createOrUpdate(DataManagementPlanEditorModel dataManagementPlan, Principal principal) throws Exception {
boolean setNotification = false;
if (dataManagementPlan.getId() != null) {
DMP dmp1 = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(dataManagementPlan.getId());
@ -412,9 +421,9 @@ public class DataManagementPlanManager {
.update(root -> root.<Integer>get("status"), Dataset.Status.FINALISED.getValue());
List<UUID> datasetsToBeCanceled = new LinkedList<>();
for (DatasetListingModel dataset : dataManagementPlan.getDatasets()) {
if (!(dataset.getStatus() == (int) Dataset.Status.FINALISED.getValue()) && !dataManagementPlan.getDatasetsToBeFinalized().contains(UUID.fromString(dataset.getId()))) {
datasetsToBeCanceled.add(UUID.fromString(dataset.getId()));
for (DatasetWizardModel dataset : dataManagementPlan.getDatasets()) {
if (!(dataset.getStatus() == (int) Dataset.Status.FINALISED.getValue()) && !dataManagementPlan.getDatasetsToBeFinalized().contains(dataset.getId())) {
datasetsToBeCanceled.add(UUID.fromString(dataset.getId().toString()));
}
}
if (!datasetsToBeCanceled.isEmpty())
@ -423,9 +432,9 @@ public class DataManagementPlanManager {
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue());
} else {
List<UUID> datasetsToBeCanceled = new LinkedList<>();
for (DatasetListingModel dataset : dataManagementPlan.getDatasets()) {
for (DatasetWizardModel dataset : dataManagementPlan.getDatasets()) {
if (!(dataset.getStatus() == (int) Dataset.Status.FINALISED.getValue())) {
datasetsToBeCanceled.add(UUID.fromString(dataset.getId()));
datasetsToBeCanceled.add(dataset.getId());
}
}
if (!datasetsToBeCanceled.isEmpty())
@ -451,6 +460,20 @@ public class DataManagementPlanManager {
return newDmp;
}
public DMP createOrUpdateWithDatasets(DataManagementPlanEditorModel dataManagementPlan, Principal principal) throws Exception {
List<Dataset> datasets = new ArrayList<>();
DMP tempDMP = dataManagementPlan.toDataModel();
for (DatasetWizardModel datasetWizardModel: dataManagementPlan.getDatasets()) {
datasetWizardModel.setDmp(new DataManagementPlan().fromDataModel(tempDMP));
Dataset dataset = datasetManager.createOrUpdate(datasetWizardModel, principal);
datasets.add(dataset);
}
DMP result = createOrUpdate(dataManagementPlan, principal);
return result;
}
public void newVersion(UUID uuid, DataManagementPlanNewVersionModel dataManagementPlan, Principal principal) throws Exception {
DMP oldDmp = databaseRepository.getDmpDao().find(uuid);
if (!isUserOwnerOfDmp(oldDmp, principal)) {
@ -1381,7 +1404,7 @@ public class DataManagementPlanManager {
dm.setDefinition(dmpProfile);
//createOrUpdate(apiContext, dm, principal);
DMP dmp = this.createOrUpdate(apiContext, dm, principal);
DMP dmp = this.createOrUpdate(dm, principal);
if (dmp.getOrganisations() == null) {
dmp.setOrganisations(new HashSet<>());
}

View File

@ -23,6 +23,9 @@ public class DatasetMapper {
}
public Dataset toElastic(eu.eudat.data.entities.Dataset dataset, List<Tag> tags) throws Exception {
if (dataset.getProfile() == null) {
return null;
}
Dataset elastic = new Dataset();
elastic.setId(dataset.getId().toString());
if (tags != null && !tags.isEmpty()) {

View File

@ -1,9 +1,7 @@
package eu.eudat.logic.mapper.elastic;
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
import eu.eudat.data.dao.entities.DMPDao;
import eu.eudat.data.entities.DMP;
import eu.eudat.elastic.entities.Collaborator;
import eu.eudat.elastic.entities.Dataset;
import eu.eudat.elastic.entities.Dmp;
import eu.eudat.elastic.entities.Tag;
@ -12,10 +10,10 @@ import eu.eudat.logic.services.ApiContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class DmpMapper {
@ -70,7 +68,7 @@ public class DmpMapper {
logger.error(e.getMessage(), e);
}
return null;
}).collect(Collectors.toList()));
}).filter(Objects::nonNull).collect(Collectors.toList()));
}
if (dmp.getAssociatedDmps() != null) {
elastic.setTemplates(dmp.getAssociatedDmps().stream().map(DatasetTemplateMapper::toElastic).collect(Collectors.toList()));

View File

@ -1,6 +1,6 @@
package eu.eudat.logic.utilities.documents.word;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.logic.services.forms.VisibilityRuleService;
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
@ -13,8 +13,6 @@ import eu.eudat.models.data.user.components.datasetprofile.Section;
import eu.eudat.models.data.user.composite.DatasetProfilePage;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import org.apache.poi.xwpf.usermodel.*;
import org.json.JSONArray;
import org.json.JSONObject;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLvl;
@ -24,9 +22,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class WordBuilder {
private static final Logger logger = LoggerFactory.getLogger(WordBuilder.class);
@ -234,15 +230,33 @@ public class WordBuilder {
String comboboxType = ((ComboBoxData) field.getData()).getType();
if (comboboxType.equals("autocomplete")) {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
if (field.getValue() == null) return null;
Map<String, String> map = new HashMap<>();
if (!field.getValue().equals("")) {
List<Map<String, Object>> mapList = new ArrayList<>();
if (!field.getValue().equals("") && field.getValue().toString() != null) {
try {
JSONArray jsonarray = new JSONArray(field.getValue().toString());
for (int i = 0; i < jsonarray.length(); i++) {
JSONObject jsonobject = jsonarray.getJSONObject(i);
String id = jsonobject.getString("id");
String label = jsonobject.getString("label");
mapList = Arrays.asList(mapper.readValue(field.getValue().toString(), HashMap[].class));
}catch (Exception e) {
logger.warn(e.getMessage(), e);
Map <String, Object> map = new HashMap<>();
map.put("label", field.getValue().toString());
mapList.add(map);
}
/*try {
if (field.getValue().toString().startsWith("[")) {
JSONArray jsonarray = new JSONArray(field.getValue().toString());
for (int i = 0; i < jsonarray.length(); i++) {
JSONObject jsonObject = jsonarray.getJSONObject(i);
String id = jsonObject.get("id").toString();
String label = jsonObject.getString("label");
if (id != null && label != null) {
map.put(id, label);
}
}
} else if (field.getValue().toString().startsWith("{")) {
JSONObject jsonObject = new JSONObject(field.getValue().toString());
String id = jsonObject.get("id").toString();
String label = jsonObject.getString("label");
if (id != null && label != null) {
map.put(id, label);
}
@ -251,13 +265,21 @@ public class WordBuilder {
Map<String, String> exMap = mapper.readValue(field.getValue().toString(), new TypeReference<Map<String, String>>() {
});
return exMap.get("label");
}
}*/
}
StringBuilder sb = new StringBuilder();
int index = 0;
for (Map.Entry<String, String> entry : map.entrySet()) {
sb.append(entry.getValue());
if (index != map.size() - 1) sb.append(", ");
for (Map<String, Object> map: mapList) {
if (!map.containsKey("label") && !map.containsKey("description")) {
logger.error("Value is missing the \"label\" and the \"description\" attributes");
map.put("label", "unknown Name");
}
for (Map.Entry<String, Object> entry : map.entrySet()) {
if (entry.getValue() != null && (entry.getKey().equals("label") || entry.getKey().equals("description"))) {
sb.append(entry.getValue().toString());
}
}
if (index != mapList.size() - 1) sb.append(", ");
index++;
}
return sb.toString();
@ -269,7 +291,7 @@ public class WordBuilder {
if (field.getValue() != null && field.getValue().equals("true")) return "Yes";
else return "No";
case "radiobox":
return field.getValue().toString();
return field.getValue() != null ? field.getValue().toString() : null;
case "checkBox":
CheckBoxData data = (CheckBoxData) field.getData();
if (field.getValue() == null || field.getValue().equals("false")) return null;

View File

@ -1,6 +1,7 @@
package eu.eudat.models.data.dashboard.recent.model;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import eu.eudat.queryable.queryableentity.DataEntity;
@ -20,7 +21,7 @@ public abstract class RecentActivityModel<T extends DataEntity, S extends DataMo
private String grantId;
private Date finalizedAt;
private Date publishedAt;
private String profile;
private DatasetProfileOverviewModel profile;
private int type;
private List<UserInfoListingModel> users;
private Boolean isPublic;
@ -121,11 +122,11 @@ public abstract class RecentActivityModel<T extends DataEntity, S extends DataMo
this.publishedAt = publishedAt;
}
public String getProfile() {
public DatasetProfileOverviewModel getProfile() {
return profile;
}
public void setProfile(String profile) {
public void setProfile(DatasetProfileOverviewModel profile) {
this.profile = profile;
}

View File

@ -4,6 +4,7 @@ import eu.eudat.data.entities.Dataset;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
import eu.eudat.models.data.dataset.DataRepository;
import eu.eudat.models.data.dataset.Service;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import java.util.Date;
@ -70,7 +71,7 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
this.setGrantAbbreviation(entity.getDmp() != null ? entity.getDmp().getGrant().getAbbreviation() : "");
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
this.setGrantId(entity.getDmp() != null ? entity.getDmp().getGrant().getId().toString() : "");
this.setProfile(entity.getProfile() != null ? entity.getProfile().getLabel() : "");
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()): null);
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
this.setDataRepositories(entity.getDatasetDataRepositories() != null && !entity.getDatasetDataRepositories().isEmpty()? LabelBuilder.getLabel(entity.getDatasetDataRepositories().stream().map(item -> new DataRepository().fromDataModel(item.getDataRepository())).collect(Collectors.toList())) : "");
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
@ -95,7 +96,7 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
this.setGrantAbbreviation(entity.getDmp() != null ? entity.getDmp().getGrant().getAbbreviation() : "");
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
this.setGrantId(entity.getDmp() != null ? entity.getDmp().getGrant().getId().toString() : "");
this.setProfile(entity.getProfile() != null ? entity.getProfile().getLabel() : "");
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()) : null);
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");

View File

@ -4,7 +4,6 @@ import eu.eudat.data.entities.DMP;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
import eu.eudat.models.data.dmp.AssociatedProfile;
import eu.eudat.models.data.dmp.Organisation;
import eu.eudat.models.data.listingmodels.DatasetListingModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import eu.eudat.models.data.urls.DatasetUrlListing;
@ -92,7 +91,7 @@ public class RecentDmpModel extends RecentActivityModel<DMP, RecentDmpModel> {
this.groupId = entity.getGroupId();
this.setPublic(entity.isPublic());
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
if (entity.getProfile() != null) this.setProfile(entity.getProfile().getLabel());
//if (entity.getProfile() != null) this.setProfile(new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()));
this.setPublishedAt(entity.getPublishedAt());
this.setUsers(entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()));
return this;

View File

@ -6,7 +6,6 @@ import eu.eudat.models.DataModel;
import eu.eudat.models.data.dataset.DataRepository;
import eu.eudat.models.data.dataset.Registry;
import eu.eudat.models.data.dataset.Service;
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.dmp.DataManagementPlan;
import eu.eudat.models.data.externaldataset.ExternalDatasetListingModel;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
@ -191,6 +190,40 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
return this;
}
public DatasetWizardModel fromDataModelNoDmp(Dataset entity) {
this.id = entity.getId();
this.label = entity.getLabel();
this.status = entity.getStatus();
this.reference = entity.getReference();
this.description = entity.getDescription();
this.profile = entity.getProfile().getId();
this.uri = entity.getUri();
this.registries = entity.getRegistries() != null ? entity.getRegistries().stream().map(item -> new Registry().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.dataRepositories = entity.getDatasetDataRepositories() != null ? entity.getDatasetDataRepositories().stream().map(item -> {
DataRepository dataRepository = new DataRepository().fromDataModel(item.getDataRepository());
if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
Map<String, String> values = data.get("data");
dataRepository.setInfo(values.get("info"));
}
return dataRepository;
}).collect(Collectors.toList()) : new ArrayList<>();
this.services = entity.getServices() != null ? entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()) : new ArrayList<>();
this.created = entity.getCreated();
this.externalDatasets = entity.getDatasetExternalDatasets() != null ? entity.getDatasetExternalDatasets().stream().map(item -> {
ExternalDatasetListingModel externalDatasetListingModel = new ExternalDatasetListingModel().fromDataModel(item.getExternalDataset());
if (item.getData() != null) {
Map<String, Map<String, String>> data = (Map<String, Map<String, String>>) JSONValue.parse(item.getData());
Map<String, String> values = data.get("data");
externalDatasetListingModel.setInfo(values.get("info"));
externalDatasetListingModel.setType(Integer.parseInt(values.get("type")));
}
return externalDatasetListingModel;
}).collect(Collectors.toList()) : new ArrayList<>();
this.modified = entity.getModified();
return this;
}
@Override
public Dataset toDataModel() throws Exception {
eu.eudat.data.entities.Dataset entity = new eu.eudat.data.entities.Dataset();

View File

@ -3,6 +3,7 @@ package eu.eudat.models.data.dmp;
import eu.eudat.data.entities.*;
import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile;
import eu.eudat.models.data.funder.Funder;
@ -26,7 +27,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
private int status;
private boolean lockable;
private String description;
private List<DatasetListingModel> datasets;
private List<DatasetWizardModel> datasets;
private List<AssociatedProfile> profiles;
private Grant grant;
private List<Organisation> organisations;
@ -178,10 +179,11 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.lockable = lockable;
}
public List<DatasetListingModel> getDatasets() {
public List<DatasetWizardModel> getDatasets() {
return datasets;
}
public void setDatasets(List<DatasetListingModel> datasets) {
public void setDatasets(List<DatasetWizardModel> datasets) {
this.datasets = datasets;
}
@ -233,8 +235,8 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
public DataManagementPlan fromDataModel(DMP entity) {
this.id = entity.getId();
this.profile = entity.getProfile() != null ? new Tuple<UUID, String>(entity.getProfile().getId(), entity.getProfile().getLabel()) : null;
this.organisations = entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList());
this.researchers = entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList());
this.organisations = entity.getOrganisations() != null ? entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.researchers = entity.getOrganisations() != null ? entity.getResearchers().stream().map(item -> new Researcher().fromDataModel(item)).collect(Collectors.toList()): new ArrayList<>();
this.version = entity.getVersion();
this.groupId = this.groupId == null ? null : entity.getGroupId();
this.label = entity.getLabel();
@ -243,7 +245,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.grant.fromDataModel(entity.getGrant());
this.creator = new eu.eudat.models.data.userinfo.UserInfo();
this.groupId = entity.getGroupId();
this.lockable = entity.getDataset().stream().findAny().isPresent();
this.lockable = entity.getDataset() != null && entity.getDataset().stream().findAny().isPresent();
this.definition = entity.getProfile() == null ? null : new DataManagementPlanProfile().fromXml(XmlBuilder.fromXml(entity.getProfile().getDefinition()).getDocumentElement());
if (this.definition != null && this.definition.getFields() != null && !this.definition.getFields().isEmpty() && this.properties != null) {
this.definition.getFields().forEach(item -> {
@ -251,7 +253,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
if (fieldOptional.isPresent()) item.setValue(fieldOptional.get().get("value"));
});
}
if (entity.getUsers().stream().anyMatch(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())))
if (entity.getUsers() != null && entity.getUsers().stream().anyMatch(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())))
this.creator.fromDataModel(entity.getUsers().stream().filter(user -> user.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser());
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
@ -261,21 +263,23 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
this.profiles.add(associatedProfile);
}
}
if (entity.isPublic()) {
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()) && !dataset.getStatus().equals(Dataset.Status.SAVED.getValue()))
.map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList());
} else {
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()))
.map(x-> new DatasetListingModel().fromDataModel(x)).collect(Collectors.toList());
if (entity.getDataset() != null) {
if (entity.isPublic()) {
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()) && !dataset.getStatus().equals(Dataset.Status.SAVED.getValue()))
.map(x -> new DatasetWizardModel().fromDataModelNoDmp(x)).collect(Collectors.toList());
} else {
this.datasets = entity.getDataset().stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue()))
.map(x -> new DatasetWizardModel().fromDataModelNoDmp(x)).collect(Collectors.toList());
}
}
this.modified = entity.getModified();
this.created = entity.getCreated();
this.description = entity.getDescription();
this.status = entity.getStatus();
this.associatedUsers = entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList());
this.users = entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList());
this.associatedUsers = entity.getUsers() != null ? entity.getUsers().stream().map(item -> new UserListingModel().fromDataModel(item.getUser())).collect(Collectors.toList()) : new ArrayList<>();
this.users = entity.getUsers() != null ? entity.getUsers().stream().map(item -> new UserInfoListingModel().fromDataModel(item)).collect(Collectors.toList()) : new ArrayList<>();
this.doi = entity.getDoi();
if (entity.getProject() != null) {

View File

@ -3,6 +3,7 @@ package eu.eudat.models.data.dmp;
import eu.eudat.data.entities.*;
import eu.eudat.logic.utilities.builders.XmlBuilder;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
import eu.eudat.models.data.dynamicfields.DynamicFieldWithValue;
import eu.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.DataManagementPlanProfile;
import eu.eudat.models.data.funder.FunderDMPEditorModel;
@ -26,7 +27,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
private int status;
private boolean lockable;
private String description;
private List<DatasetListingModel> datasets;
private List<DatasetWizardModel> datasets;
private List<AssociatedProfile> profiles;
private eu.eudat.models.data.grant.GrantDMPEditorModel grant;
private List<Organisation> organisations;
@ -177,10 +178,11 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
this.lockable = lockable;
}
public List<DatasetListingModel> getDatasets() {
public List<DatasetWizardModel> getDatasets() {
return datasets;
}
public void setDatasets(List<DatasetListingModel> datasets) {
public void setDatasets(List<DatasetWizardModel> datasets) {
this.datasets = datasets;
}
@ -253,7 +255,7 @@ public class DataManagementPlanEditorModel implements DataModel<DMP, DataManagem
this.profiles.add(associatedProfile);
}
}
this.datasets = entity.getDataset().stream().map(item -> new DatasetListingModel().fromDataModel(item)).collect(Collectors.toList());
this.datasets = entity.getDataset().stream().map(item -> new DatasetWizardModel().fromDataModelNoDmp(item)).collect(Collectors.toList());
this.modified = entity.getModified();
this.created = entity.getCreated();
this.description = entity.getDescription();

View File

@ -176,12 +176,12 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.groupId = entity.getGroupId();
this.status = entity.getStatus();
return this;
}
public DataManagementPlanOverviewModel fromDataModelDatasets(DMP entity) {
this.fromDataModel(entity);
this.status = entity.getStatus();
this.version = entity.getVersion();
this.grant = new GrantOverviewModel().fromDataModel(entity.getGrant());
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();

View File

@ -5,6 +5,7 @@ import eu.eudat.models.DataModel;
import eu.eudat.models.data.dataset.DataRepository;
import eu.eudat.models.data.dataset.Service;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import java.util.ArrayList;
import java.util.Date;
@ -18,7 +19,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private String grant;
private String dmp;
private String dmpId;
private String profile;
private DatasetProfileOverviewModel profile;
private String dataRepositories;
private String registries;
private String services;
@ -70,10 +71,11 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.dmpId = dmpId;
}
public String getProfile() {
public DatasetProfileOverviewModel getProfile() {
return profile;
}
public void setProfile(String profile) {
public void setProfile(DatasetProfileOverviewModel profile) {
this.profile = profile;
}
@ -194,7 +196,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "";
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : "";
this.profile = entity.getProfile() != null ? entity.getProfile().getLabel() : "";
this.profile = entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()) : null;
this.description = entity.getDescription();
this.status = entity.getStatus();
this.grantAbbreviation = entity.getDmp() != null ? entity.getDmp().getGrant().getAbbreviation() : "";

View File

@ -1,3 +1,5 @@
import { DatasetProfileModel } from './dataset-profile';
export interface DatasetListingModel {
id: string;
label: String;
@ -6,7 +8,7 @@ export interface DatasetListingModel {
grant: String;
grantId: String;
grantAbbreviation: String;
profile: String;
profile: DatasetProfileModel;
dataRepositories: String;
registries: String;
services: String;

View File

@ -1,5 +1,6 @@
import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
import { UserInfoListingModel } from '../user/user-info-listing';
import { DatasetProfileModel } from '../dataset/dataset-profile';
export class RecentActivityModel {
id: string;
@ -14,7 +15,7 @@ export class RecentActivityModel {
grantId: String;
finalizedAt: Date;
publishedAt: Date;
profile: String;
profile: DatasetProfileModel;
type: RecentActivityType;
users: UserInfoListingModel[];
public: boolean;

View File

@ -70,6 +70,10 @@ export class DmpService {
return this.http.post<String>(this.actionUrl, dataManagementPlanModel, { headers: this.headers });
}
createDmpWithDatasets(dataManagementPlanModel: DmpModel): Observable<String> {
return this.http.post<String>(this.actionUrl + 'full', dataManagementPlanModel, { headers: this.headers });
}
inactivate(id: String): Observable<DmpModel> {
return this.http.delete<DmpModel>(this.actionUrl + 'inactivate/' + id, { headers: this.headers });
}
@ -98,12 +102,12 @@ export class DmpService {
return this.http.post<DmpModel>(this.actionUrl + 'finalize/' + id, datasetsToBeFinalized, { headers: this.headers });
}
unfinalize( id: String): Observable<DmpModel> {
unfinalize(id: String): Observable<DmpModel> {
return this.http.post<DmpModel>(this.actionUrl + 'unfinalize/' + id, { headers: this.headers });
}
updateUsers(id: string, users: UserInfoListingModel[]): Observable<DmpModel> {
return this.http.post<DmpModel>(`${this.actionUrl}updateusers/${id}`, users, {headers: this.headers});
return this.http.post<DmpModel>(`${this.actionUrl}updateusers/${id}`, users, { headers: this.headers });
}
getDoi(id: string): Observable<string> {

View File

@ -67,8 +67,8 @@
</div>
</div>
</div>
<div class="card-footer laptop-img"></div>
</div>
<div class="card-footer laptop-img"></div>
</div>

View File

@ -322,8 +322,9 @@ span.zenodoIcon {
width: 116px;
height: 200px;
position: relative;
top: 58px;
top: -140px;
left: 243px;
border-top: none;
}
.login-bg {

View File

@ -21,7 +21,7 @@
</div>
<div *ngFor="let activity of datasetDrafts">
<div class="dataset-card">
<div [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
<a [routerLink]="['../datasets/overview/' + activity.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
@ -37,13 +37,13 @@
<span class="col">{{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{activity.grant}}</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-4">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
<div class="col-auto dataset-subtitle pr-0">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<!-- <div class="col-auto dmp-label">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div> -->
<div class="col dmp-title">{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{activity.dmp}}</div>
<div class="col dmp-title">{{activity.dmp}}</div>
</div>
</div>
</a>
<div class="dataset-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(activity.dmpId, activity.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a>
@ -51,10 +51,10 @@
<!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
</div>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="openDmpSearchDialogue(activity.id)" class="menu-item">
<button mat-menu-item (click)="openDmpSearchDialogue(activity)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button mat-menu-item (click)="openConfirm(activity.id)" class="menu-item">
<button mat-menu-item (click)="deleteClicked(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -23,6 +23,8 @@ import { UiNotificationService } from '@app/core/services/notification/ui-notifi
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
import { Role } from '@app/core/common/enum/role';
import { LockService } from '@app/core/services/lock/lock.service';
@Component({
selector: 'app-drafts',
@ -57,7 +59,8 @@ export class DraftsComponent extends BaseComponent implements OnInit {
private datasetWizardService: DatasetWizardService,
public enumUtils: EnumUtils,
private uiNotificationService: UiNotificationService,
private location: Location
private location: Location,
private lockService: LockService
) {
super();
}
@ -140,7 +143,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
data: {
formControl: formControl,
datasetId: dataset.id,
datasetProfileId: dataset.profile,
datasetProfileId: dataset.profile.id,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
@ -150,13 +153,25 @@ export class DraftsComponent extends BaseComponent implements OnInit {
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
const newDmpId = result.formControl.value.id;
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ]);
window.open(url.toString(), '_blank');
}
});
}
openConfirm(id: string): void {
deleteClicked(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDialog(id);
} else {
this.openLockedByUserDialog();
}
});
}
openDeleteDialog(id: string): void {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -179,6 +194,16 @@ export class DraftsComponent extends BaseComponent implements OnInit {
});
}
openLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DATASET-WIZARD.ACTIONS.LOCK')
}
});
}
openShareDialog(dmpRowId: any, dmpRowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px',
@ -191,6 +216,11 @@ export class DraftsComponent extends BaseComponent implements OnInit {
});
}
isUserOwner(activity: DatasetListingModel): boolean {
const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
}
onCallbackSuccess(id?: String): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']);

View File

@ -22,7 +22,7 @@
<div *ngFor="let activity of allRecentActivities">
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dmp.valueOf()">
<div class="dmp-card">
<div [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<a [routerLink]="['../plans/overview/' + activity.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modified | date: "longDate" }}</div>
@ -48,12 +48,12 @@
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="getDatasets(activity).length > 3" [routerLink]="['../plans/overview/' + activity.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</div>
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity) && isUserOwner" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner"(click)="openShareDialog(activity.id, activity.title)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity)" [routerLink]="['/datasets/new/' + activity.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(activity)" (click)="openShareDialog(activity.id, activity.title)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" [routerLink]="['/plans/clone/' + activity.id]" target="_blank"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
@ -82,7 +82,7 @@
<button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title, activity)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked(activity)" class="menu-item">
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteDmpClicked(activity)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>
@ -90,7 +90,7 @@
</div>
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset.valueOf()">
<div class="dataset-card">
<div [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
<a [routerLink]="['../datasets/overview/' + activity.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
@ -106,13 +106,13 @@
<span class="col">{{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{activity.grant}}</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-4">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
<div class="col-auto dataset-subtitle pr-0">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<!-- <div class="col-auto dmp-label">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div> -->
<div class="col dmp-title">{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{ getDmp(activity) }}</div>
<div class="col dmp-title">{{ getDmp(activity) }}</div>
</div>
</div>
</a>
<div class="dataset-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(getDmpId(activity), getDmp(activity))"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a>
@ -123,7 +123,7 @@
<button mat-menu-item (click)="openDmpSearchDialogue(activity)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button mat-menu-item (click)="openConfirm(activity.id)" class="menu-item">
<button mat-menu-item (click)="deleteDatasetClicked(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -31,6 +31,7 @@ import { FormControl, FormBuilder } from '@angular/forms';
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
import { LockService } from '@app/core/services/lock/lock.service';
@Component({
selector: 'app-recent-edited-activity',
@ -66,7 +67,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
private dialog: MatDialog,
private uiNotificationService: UiNotificationService,
private datasetWizardService: DatasetWizardService,
private location: Location
private location: Location,
private lockService: LockService
) {
super();
}
@ -139,12 +141,18 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.router.navigate(['/plans/edit/' + dmp.id]);
}
cloneClicked(dmp: DmpListingModel) {
let url = this.router.createUrlTree(['/plans/clone/', dmp.id]);
window.open(url.toString(), '_blank');
deleteDmpClicked(dmp: DmpListingModel) {
this.lockService.checkLockStatus(dmp.id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDmpDialog(dmp);
} else {
this.openDmpLockedByUserDialog();
}
});
}
deleteClicked(dmp: DmpListingModel) {
openDeleteDmpDialog(dmp: DmpListingModel) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -167,6 +175,16 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
});
}
openDmpLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DMP-EDITOR.ACTIONS.LOCK')
}
});
}
openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px',
@ -352,19 +370,20 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
return filename;
}
addDataset(activityId: String) {
this.router.navigate(['/datasets/new/' + activityId]);
}
newVersion(id: String, label: String) {
this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]);
let url = this.router.createUrlTree(['/plans/new_version/', id, { dmpLabel: label }]);
window.open(url.toString(), '_blank');
}
viewVersions(rowId: String, rowLabel: String, activity: DmpListingModel) {
if (activity.public && !this.isUserOwner) {
this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
if (activity.public && !this.isUserOwner(activity)) {
let url = this.router.createUrlTree(['/explore-plans/versions/', rowId, { groupLabel: rowLabel }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
} else {
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
let url = this.router.createUrlTree(['/plans/versions/', rowId, { groupLabel: rowLabel }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
}
}
@ -376,7 +395,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
data: {
formControl: formControl,
datasetId: dataset.id,
datasetProfileId: dataset.profile,
datasetProfileId: dataset.profile.id,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
@ -386,13 +405,26 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
const newDmpId = result.formControl.value.id;
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
}
});
}
openConfirm(id: string): void {
deleteDatasetClicked(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDatasetDialog(id);
} else {
this.openDatasetLockedByUserDialog();
}
});
}
openDeleteDatasetDialog(id: string): void {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -415,6 +447,16 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
});
}
openDatasetLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DATASET-WIZARD.ACTIONS.LOCK')
}
});
}
refresh(): void {
const fields: Array<string> = [];
// const fields: Array<string> = ["-modified"];

View File

@ -21,7 +21,7 @@
</div>
<div *ngFor="let activity of datasetActivities">
<div class="dataset-card">
<div [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
<a [routerLink]="['../datasets/overview/' + activity.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
@ -37,13 +37,13 @@
<span class="col">{{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{activity.grant}}</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-4">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
<div class="col-auto dataset-subtitle pr-0">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<!-- <div class="col-auto dmp-label">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div> -->
<div class="col dmp-title">{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{activity.dmp}}</div>
<div class="col dmp-title">{{activity.dmp}}</div>
</div>
</div>
</a>
<div class="dataset-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(activity)" (click)="openShareDialog(activity.dmpId, activity.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a>
@ -51,10 +51,10 @@
<!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
</div>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item *ngIf="isAuthenticated()" (click)="openDmpSearchDialogue(activity.id)" class="menu-item">
<button mat-menu-item *ngIf="isAuthenticated()" (click)="openDmpSearchDialogue(activity)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="openConfirm(activity.id)" class="menu-item">
<button mat-menu-item (click)="deleteClicked(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -24,6 +24,7 @@ import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitat
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Role } from '@app/core/common/enum/role';
import { Location } from '@angular/common';
import { LockService } from '@app/core/services/lock/lock.service';
@Component({
selector: 'app-recent-edited-dataset-activity',
@ -55,7 +56,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
public router: Router,
private datasetWizardService: DatasetWizardService,
private uiNotificationService: UiNotificationService,
private location: Location
private location: Location,
private lockService: LockService
) {
super();
}
@ -154,7 +156,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
data: {
formControl: formControl,
datasetId: dataset.id,
datasetProfileId: dataset.profile,
datasetProfileId: dataset.profile.id,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
@ -165,13 +167,24 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id;
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ])
window.open(url.toString(), '_blank')
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ]);
window.open(url.toString(), '_blank');
}
});
}
openConfirm(id: string): void {
deleteClicked(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDialog(id);
} else {
this.openLockedByUserDialog();
}
});
}
openDeleteDialog(id: string): void {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -194,6 +207,16 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
});
}
openLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DATASET-WIZARD.ACTIONS.LOCK')
}
});
}
openShareDialog(dmpRowId: any, dmpRowName: any, activity: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px',

View File

@ -21,7 +21,7 @@
</div>
<div *ngFor="let activity of dmpActivities">
<div class="dmp-card">
<div [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
<a [routerLink]="['../plans/overview/' + activity.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modifiedTime | date: "longDate" }}</div>
@ -47,12 +47,12 @@
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="activity.datasets.length > 3" [routerLink]="['../plans/overview/' + activity.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</div>
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity) && isUserOwner" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner" (click)="openShareDialog(activity.id, activity.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity)" [routerLink]="['/datasets/new/' + activity.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(activity)" (click)="openShareDialog(activity.id, activity.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" [routerLink]="['/plans/clone/' + activity.id]" target="_blank"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
@ -81,7 +81,7 @@
<button mat-menu-item (click)="viewVersions(activity.groupId, activity.label, activity)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>

View File

@ -23,6 +23,7 @@ import { Role } from '@app/core/common/enum/role';
import { FormBuilder, FormControl } from '@angular/forms';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
import { LockService } from '@app/core/services/lock/lock.service';
@Component({
selector: 'app-recent-edited-dmp-activity',
@ -57,7 +58,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
private language: TranslateService,
private dialog: MatDialog,
private uiNotificationService: UiNotificationService,
private location: Location
private location: Location,
private lockService: LockService
) {
super();
}
@ -129,7 +131,18 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
window.open(url.toString(), '_blank');
}
deleteClicked(dmp: DmpListingModel) {
deleteClicked(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDialog(id);
} else {
this.openLockedByUserDialog();
}
});
}
openDeleteDialog(id: string) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -142,7 +155,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.dmpService.delete(dmp.id)
this.dmpService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onDeleteCallbackSuccess(),
@ -152,6 +165,16 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
});
}
openLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DMP-EDITOR.ACTIONS.LOCK')
}
});
}
openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px',
@ -303,19 +326,20 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
return filename;
}
addDataset(activityId: String) {
this.router.navigate(['/datasets/new/' + activityId]);
}
newVersion(id: String, label: String) {
this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]);
let url = this.router.createUrlTree(['/plans/new_version/', id, { dmpLabel: label }]);
window.open(url.toString(), '_blank');
}
viewVersions(rowId: String, rowLabel: String, activity: DmpListingModel) {
if (activity.public && !this.isUserOwner) {
this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
if (activity.public && !this.isUserOwner(activity)) {
let url = this.router.createUrlTree(['/explore-plans/versions/', rowId, { groupLabel: rowLabel }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
} else {
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
let url = this.router.createUrlTree(['/plans/versions/', rowId, { groupLabel: rowLabel }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
}
}

View File

@ -1,13 +1,13 @@
<div class="dataset-card">
<a [routerLink]="['../datasets/overview/' + dataset.id]" class="pointer">
<a [routerLink]="isPublic ? ['/datasets/publicOverview/' + dataset.id] : ['/datasets/overview/' + dataset.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{dataset.modified | date:"longDate"}}</div>
</div>
<div class="col-auto dataset-title">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{dataset.label}}</div>
<div class="dataset-subtitle">
<span class="col-auto">{{ roleDisplay(dataset.users) }}</span>
<span>.</span>
<span *ngIf="isUserDatasetRelated()" class="col-auto">{{ roleDisplay(dataset.users) }}</span>
<span *ngIf="isUserDatasetRelated()">.</span>
<span class="col-auto" *ngIf="dataset.status === 1 && dataset.public === true"><span class="material-icons icon-align">public</span>{{'DATASET-LISTING.STATES.PUBLIC' | translate}}</span>
<span *ngIf="dataset.status === 1 && dataset.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(dataset.status) }}</span>
<span *ngIf="dataset.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(dataset.status) }}</span>
@ -15,11 +15,11 @@
<span class="col">{{'DATASET-LISTING.COLUMNS.GRANT' | translate}}: {{dataset.grant}}</span>
</div>
<div class="d-flex flex-direction-row pt-3 pb-3">
<div class="col-auto dataset-subtitle">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-4">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
<div class="col-auto dataset-subtitle pr-0">{{'DATASET-LISTING.TOOLTIP.PART-OF' | translate}}
<div class="col-auto dmp-label ml-3">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div>
</div>
<!-- <div class="col-auto dmp-label">{{'DATASET-LISTING.TOOLTIP.DMP' | translate}}</div> -->
<div class="col dmp-title">{{'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate}}: {{dataset.dmp}}</div>
<div class="col dmp-title">{{dataset.dmp}}</div>
</div>
</a>
<div class="dataset-card-actions">
@ -32,7 +32,7 @@
<button *ngIf="isAuthenticated()" mat-menu-item (click)="openDmpSearchDialogue(dataset)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button *ngIf="isUserOwner" mat-menu-item (click)="openConfirm(dataset.id)" class="menu-item">
<button *ngIf="isUserDatasetRelated()" mat-menu-item (click)="deleteClicked(dataset.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -35,7 +35,6 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
isDraft: boolean;
isDeleted: boolean;
lockStatus: Boolean;
isUserOwner: boolean;
constructor(
@ -56,7 +55,6 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
if (this.dataset.status === DatasetStatus.Draft) {
this.isDraft = true;
this.isDeleted = false;
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
} else if (this.dataset.status === DatasetStatus.Deleted) {
this.isDeleted = true;
@ -64,16 +62,10 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
else {
this.isDraft = false;
this.isDeleted = false;
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
}
}
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
}
setIsUserOwner() {
if (this.dataset) {
const principal: Principal = this.authentication.current();
@ -165,7 +157,7 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
data: {
formControl: formControl,
datasetId: dataset.id,
datasetProfileId: dataset.profile,
datasetProfileId: dataset.profile.id,
datasetProfileExist: false,
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
@ -175,13 +167,25 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
const newDmpId = result.formControl.value.id;
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId }]);
window.open(url.toString(), '_blank');
}
});
}
openConfirm(id: string): void {
deleteClicked(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDialog(id);
} else {
this.openLockedByUserDialog();
}
});
}
openDeleteDialog(id: string): void {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -204,6 +208,16 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
});
}
openLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DATASET-WIZARD.ACTIONS.LOCK')
}
});
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
@ -246,6 +260,19 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
}
}
isUserDatasetRelated() {
const principal: Principal = this.authentication.current();
let isRelated: boolean = false;
if (this.dataset && principal) {
this.dataset.users.forEach(element => {
if (element.id === principal.id) {
isRelated = true;
}
})
}
return isRelated;
}
// onCallbackError(error: any) {

View File

@ -12,28 +12,31 @@
<p class="col dataset-label p-0 ml-3 mb-0">{{ dataset.label }}</p>
</div>
<div class="row d-flex align-items-center mt-3 mb-4 label-txt">
<div *ngIf="isUserDatasetRelated()" class="d-flex mr-2">
<div *ngIf="isUserDatasetRelated()" class="d-flex">
<p class="ml-0 mb-0 label2-txt">
{{ roleDisplayFromList(dataset.users) }}
</p>
</div>
<span>.</span>
<div class="d-flex ml-2 mr-2">
<div *ngIf="dataset.public" class="d-flex flex-row">
<mat-icon class="status-icon">public</mat-icon>
{{'DMP-OVERVIEW.PUBLIC' | translate}}
</div>
<div *ngIf="!dataset.public" class="d-flex flex-row">
<mat-icon class="status-icon">public_off</mat-icon>
{{'DMP-OVERVIEW.PRIVATE' | translate}}
</div>
<span *ngIf="isUserDatasetRelated()" class="ml-2 mr-2">.</span>
<!-- UNCOMMENT TO ADD PRIVATE ICON -->
<!-- <span *ngIf="isUserDatasetRelated() && (dataset.public || !dataset.public || lockStatus)" class="ml-2 mr-2">.</span> -->
<div *ngIf="dataset.public" class="d-flex flex-row">
<mat-icon class="status-icon">public</mat-icon>
{{'DMP-OVERVIEW.PUBLIC' | translate}}
</div>
<span>.</span>
<div *ngIf="lockStatus" class="d-flex flex-row ml-2 mr-2">
<span *ngIf="dataset.public" class="ml-2 mr-2">.</span>
<!-- UNCOMMENT TO ADD PRIVATE ICON -->
<!-- <div *ngIf="!dataset.public" class="d-flex flex-row">
<mat-icon class="status-icon">public_off</mat-icon>
{{'DMP-OVERVIEW.PRIVATE' | translate}}
</div>
<span *ngIf="!dataset.public" class="ml-2 mr-2">.</span> -->
<div *ngIf="lockStatus" class="d-flex flex-row">
<mat-icon class="status-icon">lock_outline</mat-icon>
{{'DMP-OVERVIEW.LOCKED' | translate}}
</div>
<div class="d-flex ml-2 mr-2">{{'GENERAL.STATUSES.EDIT' | translate}} :
<span *ngIf="lockStatus" class="ml-2 mr-2">.</span>
<div class="d-flex mr-2">{{'GENERAL.STATUSES.EDIT' | translate}} :
{{dataset.modified | date:"longDate"}}
</div>
<div class="d-flex ml-2 mr-4">
@ -49,12 +52,12 @@
matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="isDraftDataset(dataset) && isUserOwner && !lockStatus"
<button *ngIf="isDraftDataset(dataset) && !lockStatus"
(click)="editClicked(dataset)" mat-mini-fab class="mr-3 actions-btn"
matTooltip="{{'DMP-LISTING.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
<button *ngIf="isUserOwner && !lockStatus" (click)="deleteClicked()" mat-mini-fab
<button *ngIf="isUserDatasetRelated() && !lockStatus" (click)="deleteClicked()" mat-mini-fab
class="mr-3 actions-btn" matTooltip="{{'DMP-LISTING.ACTIONS.DELETE' | translate}}"
matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
@ -65,7 +68,6 @@
<button class="dmp-btn" (click)="dmpClicked(dataset.dmp.id)">
<div class="dmp-btn-label">
{{ this.dataset.dmp.label }}
<!-- {{ 'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate }}: {{ dataset.datasetTemplate.label }} -->
</div>
<mat-icon>launch</mat-icon>
</button>
@ -92,7 +94,7 @@
</div>
<div class="col-md-4 col-lg-4 p-0">
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<div *ngIf="!dataset.status && isDraftDataset(dataset) && isUserOwner && !lockStatus">
<div *ngIf="!dataset.status && isDraftDataset(dataset) && !lockStatus">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dataset)">
<button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon check-icon">check</mat-icon>
@ -103,7 +105,7 @@
<hr class="hr-line">
</div>
</div>
<div *ngIf="hasReversableStatus(dataset) && !lockStatus" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="reverse(dataset)">
<div *ngIf="hasReversableStatus(dataset)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center" (click)="reverse(dataset)">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">unarchive</mat-icon>
</button>

View File

@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { BaseComponent } from '@common/base/base.component';
import { DatasetOverviewModel } from '@app/core/model/dataset/dataset-overview';
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
import { Observable, of as observableOf, interval } from 'rxjs';
import { Observable, of as observableOf } from 'rxjs';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { DatasetService } from '@app/core/services/dataset/dataset.service';
import { TranslateService } from '@ngx-translate/core';
@ -166,11 +166,9 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([path]);
});
}
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => this.router.navigate([path]));
}
getDmpResearchers() {
this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed))
@ -266,10 +264,10 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
editClicked(dataset: DatasetOverviewModel) {
if (dataset.public) {
let url = this.router.createUrlTree(['/datasets/publicEdit/', dataset.id])
window.open(url.toString(), '_blank')
window.open(url.toString(), '_blank')
} else {
let url = this.router.createUrlTree(['/datasets/edit/', dataset.id])
window.open(url.toString(), '_blank')
window.open(url.toString(), '_blank')
}
}
@ -410,8 +408,8 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
.subscribe(result => {
if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ])
window.open(url.toString(), '_blank')
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId }])
window.open(url.toString(), '_blank')
}
});
}

View File

@ -5,7 +5,7 @@
<a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a>
<div class="card-content info-text mb-0 pt-0">
<p>{{'DMP-LISTING.TEXT-INFO' | translate}}</p>
<p class="mt-4 pt-2">{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} <u>{{'DMP-LISTING.LINK-ZENODO' | translate}}</u> {{'DMP-LISTING.GET-IDEA' | translate}}</p>
<p class="mt-4 pt-2">{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} <a class="zenodo-link" href="https://zenodo.org/communities/liber-dmp-cat/?page=1&size=20" target="_blank">{{'DMP-LISTING.LINK-ZENODO' | translate}}</a> {{'DMP-LISTING.GET-IDEA' | translate}}</p>
</div>
</div>
<div class="filter-btn" [style.right]="dialog.openDialogs.length > 0 ? '446px' : '0px'" [style.width]="scrollbar ? '57px' : '37px'" (click)="openFiltersDialog()">

View File

@ -218,7 +218,12 @@
opacity: 0.6;
}
.pointer:hover {
.zenodo-link {
text-decoration: underline;
color: black;
}
.pointer:hover, .zenodo-link:hover {
color: #00b29f;
}

View File

@ -1,13 +1,13 @@
<div class="dmp-card">
<a [routerLink]="isPublic ? ['/explore-plans/publicOverview/' + dmp.id] : ['/plans/overview/' + dmp.id]" class="pointer">
<a [routerLink]="isPublic ? ['/explore-plans/publicOverview/' + dmp.id] : ['/plans/overview/' + dmp.id]" target="_blank" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.modifiedTime | date: "longDate" }}</div>
</div>
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{dmp.label}}</div>
<div class="dmp-subtitle">
<span class="col-auto">{{ roleDisplay(dmp.users) }}</span>
<span>.</span>
<span *ngIf="isUserDMPRelated()" class="col-auto">{{ roleDisplay(dmp.users) }}</span>
<span *ngIf="isUserDMPRelated()">.</span>
<span class="col-auto" *ngIf="dmp.status === 1 && dmp.public === true"><span class="material-icons icon-align">public</span>{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}}</span>
<span *ngIf="dmp.status === 1 && dmp.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(dmp.status) }}</span>
<span *ngIf="dmp.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(dmp.status) }}</span>
@ -28,9 +28,9 @@
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="addDataset(dmp.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(dmp.id, dmp.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="cloneClicked(dmp)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp)" [routerLink]="['/datasets/new/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(dmp)" (click)="openShareDialog(dmp.id, dmp.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" [routerLink]="['/plans/clone/' + dmp.id]" target="_blank"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
@ -56,11 +56,10 @@
<button *ngIf="isUserOwner(dmp)" mat-menu-item (click)="newVersion(dmp.id, dmp.label)">
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label)">
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label, dmp)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
<!-- <button mat-menu-item *ngIf="isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked()" class="menu-item"> -->
<button mat-menu-item *ngIf="isUserOwner(dmp) && !lockStatus" (click)="deleteClicked(dmp)" class="menu-item">
<button mat-menu-item *ngIf="isUserOwner(dmp)" (click)="deleteClicked(dmp.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>

View File

@ -34,7 +34,6 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
isDraft: boolean;
isFinalized: boolean;
isPublished: boolean;
lockStatus: Boolean;
constructor(
private router: Router,
@ -46,28 +45,25 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
private uiNotificationService: UiNotificationService,
private lockService: LockService,
private location: Location) {
super();
}
super();
}
ngOnInit() {
if (this.dmp.status == DmpStatus.Draft) {
this.isDraft = true;
this.isFinalized = false;
this.isPublished = false;
this.checkLockStatus(this.dmp.id);
}
else if (this.dmp.status == DmpStatus.Finalized) {
this.isDraft = false;
this.isFinalized = true;
this.isPublished = false;
this.checkLockStatus(this.dmp.id);
if (this.dmp.public == true) { this.isPublished = true }
}
}
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
openShareDialog(rowId: any, rowName: any) {
@ -86,16 +82,20 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
this.router.navigate(['/plans/edit/' + dmpId]);
}
addDataset(rowId: String) {
this.router.navigate(['/datasets/new/' + rowId]);
}
showDatasets(rowId: String, rowLabel: String) {
this.router.navigate(['/datasets/dmp/' + rowId, { dmpLabel: rowLabel }]);
}
viewVersions(rowId: String, rowLabel: String) {
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
viewVersions(rowId: String, rowLabel: String, dmp: DmpListingModel) {
if (dmp.public && !this.isUserOwner(dmp)) {
let url = this.router.createUrlTree(['/explore-plans/versions/', rowId, { groupLabel: rowLabel }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/explore-plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
} else {
let url = this.router.createUrlTree(['/plans/versions/', rowId, { groupLabel: rowLabel }]);
window.open(url.toString(), '_blank');
// this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
}
}
// itemClicked() {
@ -131,12 +131,26 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
}
}
isUserDMPRelated() {
const principal: Principal = this.authentication.current();
let isRelated: boolean = false;
if (this.dmp && principal) {
this.dmp.users.forEach(element => {
if (element.id === principal.id) {
isRelated = true;
}
})
}
return isRelated;
}
cloneClicked(dmp: DmpListingModel) {
this.router.navigate(['/plans/clone/' + dmp.id]);
}
newVersion(id: String, label: String) {
this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]);
let url = this.router.createUrlTree(['/plans/new_version/', id, { dmpLabel: label }]);
window.open(url.toString(), '_blank');
}
downloadXml(id: string) {
@ -200,7 +214,18 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
return filename;
}
deleteClicked(dmp: DmpListingModel) {
deleteClicked(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
if (!lockStatus) {
this.openDeleteDialog(id);
} else {
this.openLockedByUserDialog();
}
});
}
openDeleteDialog(id: string) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
@ -213,7 +238,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.dmpService.delete(dmp.id)
this.dmpService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onDeleteCallbackSuccess(),
@ -223,6 +248,16 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
});
}
openLockedByUserDialog() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '400px',
restoreFocus: false,
data: {
message: this.language.instant('DMP-EDITOR.ACTIONS.LOCK')
}
});
}
isDraftDmp(activity: DmpListingModel) {
return activity.status == DmpStatus.Draft;
}

View File

@ -13,28 +13,28 @@
</div>
<div class="row d-flex align-items-center mt-3 mb-4 label-txt">
<div *ngIf="isUserDMPRelated()" class="d-flex">
<p class="ml-0 mr-2 mb-0 label2-txt">
<p class="ml-0 mb-0 label2-txt">
{{ roleDisplayFromList(dmp.users) }}</p>
</div>
<span>.</span>
<div class="d-flex ml-2 mr-2">
<div *ngIf="dmp.isPublic" class="d-flex flex-row">
<mat-icon class="status-icon">public</mat-icon>
{{'DMP-OVERVIEW.PUBLIC' | translate}}
</div>
<div *ngIf="!dmp.isPublic" class="d-flex flex-row">
<mat-icon class="status-icon">public_off</mat-icon>
{{'DMP-OVERVIEW.PRIVATE' | translate}}
</div>
<span *ngIf="isUserDMPRelated() && (dmp.isPublic || lockStatus)" class="ml-2 mr-2">.</span>
<!-- UNCOMMENT TO ADD PRIVATE ICON -->
<!-- <span *ngIf="isUserDMPRelated() && (dmp.isPublic || !dmp.isPublic || lockStatus)" class="ml-2 mr-2">.</span> -->
<div *ngIf="dmp.isPublic" class="d-flex flex-row">
<mat-icon class="status-icon">public</mat-icon>
{{'DMP-OVERVIEW.PUBLIC' | translate}}
</div>
<div *ngIf="lockStatus" class="d-flex flex-row mr-2">
<span>.</span>
<mat-icon class="status-icon ml-2">lock_outline</mat-icon>
<span *ngIf="dmp.isPublic && lockStatus" class="ml-2 mr-2">.</span>
<!-- UNCOMMENT TO ADD PRIVATE ICON -->
<!-- <div *ngIf="!dmp.isPublic" class="d-flex flex-row">
<mat-icon class="status-icon">public_off</mat-icon>
{{'DMP-OVERVIEW.PRIVATE' | translate}}
</div>
<span *ngIf="!dmp.isPublic && lockStatus" class="ml-2 mr-2">.</span> -->
<div *ngIf="lockStatus" class="d-flex flex-row">
<mat-icon class="status-icon">lock_outline</mat-icon>
{{'DMP-OVERVIEW.LOCKED' | translate}}
</div>
<span>.</span>
<mat-form-field appearance="outline" class="versions-select ml-2 mr-4">
<mat-form-field appearance="outline" class="versions-select ml-3 mr-3">
<mat-select placeholder="{{'DMP-LISTING.VERSION' | translate}} {{dmp.version}}"
[(ngModel)]="version" (ngModelChange)="versionChanged(version.id)">
<mat-option *ngFor="let version of versions" [value]="version">
@ -52,7 +52,7 @@
</div>
</div>
<div class="row">
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dmp)" mat-mini-fab
<button *ngIf="isAuthenticated()" (click)="cloneClicked(dmp)" mat-mini-fab
class="mr-3 d-flex justify-content-center align-items-center"
matTooltip="{{'DMP-LISTING.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
@ -88,7 +88,7 @@
<div class="row header">{{'DMP-OVERVIEW.DATASETS-USED' | translate}}</div>
<div class="d-flex flex-column">
<div *ngFor="let dataset of dmp.datasets">
<div class="row" (click)="datasetClicked(dataset.id)">
<a class="row" [routerLink]="['/datasets/overview/' + dataset.id]" target="_blank">
<button mat-raised-button class="mb-2 mr-2 pl-0 pr-0">
<div matTooltip="{{ dataset.label }}"
class="col-auto dataset-btn">
@ -96,15 +96,14 @@
<mat-icon>launch</mat-icon>
</div>
</button>
</div>
</a>
</div>
</div>
<div class="row mt-2 add-dataset-txt">
<button class="add-dataset-btn" *ngIf="isDraftDmp(dmp) && isUserOwner"
(click)="addDataset(dmp.id)">
<a class="add-dataset-btn" *ngIf="isDraftDmp(dmp)" [routerLink]="['/datasets/new/' + dmp.id]" target="_blank">
<mat-icon>add</mat-icon>
{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}
</button>
</a>
</div>
</div>
<div class="col-md-4 col-lg-4 p-0">
@ -131,7 +130,7 @@
</div>
</div>
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<div *ngIf="!dmp.status && isDraftDmp(dmp) && isUserOwner && !lockStatus">
<div *ngIf="isDraftDmp(dmp) && isUserOwner && !lockStatus">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)">
<button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon">check</mat-icon>
@ -149,7 +148,7 @@
</button>
<p class="mb-0 pl-2 frame-txt">{{ 'DMP-LISTING.ACTIONS.DEPOSIT' | translate }}</p>
</div>
<div *ngIf="(isFinalizedDmp(dmp) && hasDoi(dmp) && !isPublishedDMP(dmp)) && isUserOwner"
<div *ngIf="isFinalizedDmp(dmp) && hasDoi(dmp) && !isPublishedDMP(dmp) && isUserOwner"
(click)="reverse(dmp)" class="row ml-0 mr-0 pl-4 pb-3 d-flex align-items-center">
<button mat-mini-fab class="frame-btn">
<mat-icon class="mat-mini-fab-icon">unarchive</mat-icon>

View File

@ -191,7 +191,7 @@
letter-spacing: 0.009em;
color: #7d7d7d;
width: 12em;
height: 1em;
height: 1.2em;
overflow: hidden;
border: none;
padding: 0px;

View File

@ -7,6 +7,7 @@ import { UrlListingModule } from '@app/library/url-listing/url-listing.module';
import { DmpOverviewComponent } from '@app/ui/dmp/overview/dmp-overview.component';
import { CommonFormsModule } from '@common/forms/common-forms.module';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [
@ -16,7 +17,8 @@ import { CommonUiModule } from '@common/ui/common-ui.module';
ConfirmationDialogModule,
ExportMethodDialogModule,
FormattingModule,
AutoCompleteModule
AutoCompleteModule,
RouterModule
],
declarations: [
DmpOverviewComponent

View File

@ -66,25 +66,32 @@
<div class="row title-4">Translators</div>
</div>
<div class="card mt-3 flex-row">
<img class="col-4 flag" alt="Flag of Greece" src="../assets/img/flag-greece.png">
<div class="col-8 card-body" class="flex-column align-items-center">
<img class="col-4 flag" alt="Flag of Greece" src="../assets/img/flag-of-greece.png">
<div class="col-8 card-body pl-0" class="flex-column align-items-center">
<p class="card-text-1">Athena Research & Innovation Center</p>
<p class="card-text-2">Dimitra Aglamisi, Elli Papadopoulou</p>
</div>
</div>
<div class="card flex-row">
<img class="col-4 card-img" alt="Flag of Spain" src="../assets/img/NoPath - Copy (7).png">
<div class="col-8 card-body" class="flex-column align-items-center">
<img class="col-4 card-img" alt="Flag of Spain" src="../assets/img/flag-of-spain.png">
<div class="col-8 card-body pl-0" class="flex-column align-items-center">
<p class="card-text-1">Consorcio Madroño</p>
<p class="card-text-2">Lanko López, Juan Corrales Correyero, Fernando González Ballesteros</p>
</div>
</div>
<div class="card flex-row">
<img class="col-4 card-img" alt="Flag of Turkey" src="../assets/img/Image 82.png">
<div class="col-8 card-body" class="flex-column align-items-center">
<img class="col-4 card-img" alt="Flag of Turkey" src="../assets/img/flag-of-turkey.png">
<div class="col-8 card-body pl-0" class="flex-column align-items-center">
<p class="card-text-1">Turkish Higher Education Council Research Data and Open Data working group</p>
</div>
</div>
</div>
<div class="card flex-row">
<img class="col-4 flag" alt="Flag of Austria" src="../assets/img/flag-of-germany.png">
<div class="col-8 card-body pl-0" class="flex-column align-items-center">
<p class="card-text-1">UNIVERSITY OF VIENNA</p>
<p class="card-text-2">Gerda McNeill, Raman Ganguly, Mihaela Hubert</p>
</div>
</div>
</div>
</section>
<!-- Footer-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB