Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign
This commit is contained in:
commit
aec542a067
|
@ -2,7 +2,6 @@ package eu.eudat.data.dao.entities.security;
|
|||
|
||||
import eu.eudat.data.dao.DatabaseAccessLayer;
|
||||
import eu.eudat.data.entities.Credential;
|
||||
import sun.security.krb5.Credentials;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
|
@ -29,7 +29,16 @@ import java.util.stream.Collectors;
|
|||
@NamedEntityGraph(
|
||||
name = "dmpRecentActivity",
|
||||
attributeNodes = {
|
||||
@NamedAttributeNode("users"), @NamedAttributeNode("creator")})
|
||||
@NamedAttributeNode("users"), @NamedAttributeNode("creator")}),
|
||||
@NamedEntityGraph(
|
||||
name = "recentDmpModel",
|
||||
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"), @NamedAttributeNode("associatedDmps"),
|
||||
@NamedAttributeNode("grant"), @NamedAttributeNode(value = "users", subgraph = "users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode(value = "dataset", subgraph = "dataset")},
|
||||
subgraphs = {
|
||||
@NamedSubgraph(name = "users", attributeNodes = {@NamedAttributeNode("user")}),
|
||||
@NamedSubgraph(name = "dataset", attributeNodes = {@NamedAttributeNode("id"), @NamedAttributeNode("label")})
|
||||
}
|
||||
)
|
||||
})
|
||||
public class DMP implements DataEntity<DMP, UUID> {
|
||||
|
||||
|
|
|
@ -36,7 +36,17 @@ import java.util.stream.Collectors;
|
|||
@NamedEntityGraph(
|
||||
name = "datasetDataRepositories",
|
||||
attributeNodes = {@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("creator")},
|
||||
subgraphs = @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")}))
|
||||
subgraphs = @NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")})),
|
||||
@NamedEntityGraph(
|
||||
name = "recentDatasetModel",
|
||||
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"),
|
||||
@NamedAttributeNode(value = "datasetExternalDatasets", subgraph = "datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
||||
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
|
||||
subgraphs = {
|
||||
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("grant"), @NamedAttributeNode("organisations")}),
|
||||
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")}),
|
||||
@NamedSubgraph(name = "datasetExternalDatasets", attributeNodes = {@NamedAttributeNode("externalDataset")})
|
||||
})
|
||||
})
|
||||
public class Dataset implements DataEntity<Dataset, UUID> {
|
||||
|
||||
|
|
|
@ -195,6 +195,36 @@
|
|||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ public class ResponsesCache {
|
|||
caches.add(new GuavaCache("tags", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
|
||||
caches.add(new GuavaCache("researchers", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
|
||||
caches.add(new GuavaCache("externalDatasets", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
|
||||
caches.add(new GuavaCache("currencies", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
|
||||
caches.add(new GuavaCache("licenses", CacheBuilder.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build()));
|
||||
simpleCacheManager.setCaches(caches);
|
||||
logger.info("OK");
|
||||
return simpleCacheManager;
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.eudat.controllers;
|
|||
|
||||
import eu.eudat.logic.managers.ContactEmailManager;
|
||||
import eu.eudat.models.data.ContactEmail.ContactEmailModel;
|
||||
import eu.eudat.models.data.ContactEmail.PublicContactEmailModel;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
|
@ -38,4 +39,18 @@ public class ContactEmail {
|
|||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, path = "public", consumes = "application/x-www-form-urlencoded", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity sendContactEmailNoAuth(@ModelAttribute PublicContactEmailModel contactEmailModel) {
|
||||
logger.info(contactEmailModel.toString());
|
||||
try {
|
||||
this.contactEmailManager.sendContactEmailNoAuth(contactEmailModel);
|
||||
return ResponseEntity.status(HttpStatus.NO_CONTENT).body(new ResponseItem().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.logic.managers.LocalFetchManager;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.local.LocalFetchModel;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = "api/currency")
|
||||
public class CurrencyController {
|
||||
|
||||
private LocalFetchManager localFetchManager;
|
||||
|
||||
@Autowired
|
||||
public CurrencyController(LocalFetchManager localFetchManager) {
|
||||
this.localFetchManager = localFetchManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
public ResponseEntity<ResponseItem<List<LocalFetchModel>>> getCurrencies( @RequestParam(value = "query", required = false) String query) throws Exception {
|
||||
List<LocalFetchModel> currencies = localFetchManager.getCurrency(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<LocalFetchModel>>().status(ApiMessageCode.NO_MESSAGE).payload(currencies));
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.dashboard.recent.RecentActivity;
|
||||
import eu.eudat.models.data.dashboard.recent.model.RecentActivityModel;
|
||||
import eu.eudat.models.data.dashboard.recent.tablerequest.RecentActivityTableRequest;
|
||||
import eu.eudat.models.data.dashboard.searchbar.SearchBarItem;
|
||||
import eu.eudat.models.data.dashboard.statistics.DashBoardStatistics;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
|
@ -47,9 +48,9 @@ public class DashBoardController extends BaseController {
|
|||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/dashboard/recentActivity"}, produces = "application/json")
|
||||
@Transactional
|
||||
public ResponseEntity<ResponseItem<List<RecentActivityModel>>> getNewRecentActivity(@RequestBody RecentActivityCriteria criteria, @RequestParam(name = "numOfActivities", required = false, defaultValue = "5") Integer numberOfActivities,
|
||||
public ResponseEntity<ResponseItem<List<RecentActivityModel>>> getNewRecentActivity(@RequestBody RecentActivityTableRequest tableRequest,
|
||||
@ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
List<RecentActivityModel> statistics = dashBoardManager.getNewRecentActivity(criteria, principal, numberOfActivities);
|
||||
List<RecentActivityModel> statistics = dashBoardManager.getNewRecentActivity(tableRequest, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<RecentActivityModel>>().status(ApiMessageCode.NO_MESSAGE).payload(statistics));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,12 @@ import eu.eudat.data.entities.Dataset;
|
|||
import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
|
||||
import eu.eudat.data.query.items.table.dataset.DatasetTableRequest;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.exceptions.security.UnauthorisedException;
|
||||
import eu.eudat.logic.managers.DatasetManager;
|
||||
import eu.eudat.logic.managers.DatasetWizardManager;
|
||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.dataset.DatasetOverviewModel;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
|
@ -52,6 +55,32 @@ public class Datasets extends BaseController {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/overview/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity getOverviewSingle(@PathVariable String id,@ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) {
|
||||
try {
|
||||
DatasetOverviewModel dataset = this.datasetManager.getOverviewSingle(id, principal, false);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
} catch (Exception e) {
|
||||
if (e instanceof UnauthorisedException) {
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(new ResponseItem<DatasetOverviewModel>().status(ApiMessageCode.ERROR_MESSAGE));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ResponseItem<DatasetOverviewModel>().status(ApiMessageCode.ERROR_MESSAGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/publicOverview/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity getOverviewSinglePublic(@PathVariable String id, @ClaimedAuthorities(claims = {Authorities.ADMIN, Authorities.MANAGER, Authorities.USER, Authorities.ANONYMOUS}) Principal principal) throws Exception {
|
||||
// try {
|
||||
DatasetOverviewModel dataset = this.datasetManager.getOverviewSingle(id, principal, true);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetOverviewModel>().status(ApiMessageCode.NO_MESSAGE).payload(dataset));
|
||||
// } catch (Exception ex) {
|
||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseItem<DataManagementPlanOverviewModel>().status(ApiMessageCode.NO_MESSAGE).message(ex.getMessage()));
|
||||
// }
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/makepublic/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
|
@ -82,5 +111,13 @@ public class Datasets extends BaseController {
|
|||
this.datasetManager.clearIndex(principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Cleared").payload(null));
|
||||
}
|
||||
|
||||
@javax.transaction.Transactional
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Dataset>> delete(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
|
||||
new DatasetWizardManager().delete(this.getApiContext(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Dataset>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Deleted"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.logic.managers.LicenseManager;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.license.LicenseModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api/external/licenses"})
|
||||
public class Licenses extends BaseController {
|
||||
|
||||
private LicenseManager licenseManager;
|
||||
|
||||
@Autowired
|
||||
public Licenses(ApiContext apiContext, LicenseManager licenseManager) {
|
||||
super(apiContext);
|
||||
this.licenseManager = licenseManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<LicenseModel>>> listExternalLicenses(
|
||||
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal
|
||||
) throws HugeResultSet, NoURLFound {
|
||||
List<LicenseModel> licenseModels = this.licenseManager.getLicenses(query, type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<LicenseModel>>().status(ApiMessageCode.NO_MESSAGE).payload(licenseModels));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import eu.eudat.logic.managers.LockManager;
|
||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.models.data.lock.Lock;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
|
|
|
@ -4,7 +4,6 @@ import eu.eudat.exceptions.security.UnauthorisedException;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
@ -20,11 +19,9 @@ import javax.annotation.Priority;
|
|||
@Priority(4)
|
||||
public class ControllerUnauthorisedHandler {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ControllerUnauthorisedHandler.class);
|
||||
// private Logger logger;
|
||||
|
||||
@Autowired
|
||||
public ControllerUnauthorisedHandler(/*Logger logger*/) {
|
||||
// this.logger = logger;
|
||||
public ControllerUnauthorisedHandler() {
|
||||
}
|
||||
|
||||
@ExceptionHandler(UnauthorisedException.class)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.eudat.controllers.interceptors;
|
||||
|
||||
import eu.eudat.logic.services.helpers.LoggerService;
|
||||
import eu.eudat.types.WarningLevel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -18,11 +17,9 @@ import java.util.Date;
|
|||
@Component
|
||||
public class RequestInterceptor extends HandlerInterceptorAdapter {
|
||||
private static final Logger logger = LoggerFactory.getLogger(RequestInterceptor.class);
|
||||
// private LoggerService loggerService;
|
||||
|
||||
@Autowired
|
||||
public RequestInterceptor(/*LoggerService loggerService*/) {
|
||||
// this.loggerService = loggerService;
|
||||
public RequestInterceptor() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,10 +26,26 @@ public class AdminManager {
|
|||
viewStyleDoc.appendChild(elementViewStyle);
|
||||
String xml = XmlBuilder.generateXml(viewStyleDoc);
|
||||
|
||||
if (profile.getDescription() == null) {
|
||||
profile.setDescription("");
|
||||
}
|
||||
|
||||
if (profile.getLanguage() == null) {
|
||||
profile.setLanguage("en");
|
||||
}
|
||||
|
||||
eu.eudat.data.entities.DatasetProfile datasetProfile = apiContext.getOperationsContext().getBuilderFactory().getBuilder(DatasetProfileBuilder.class).definition(xml).label(profile.getLabel())
|
||||
.status(profile.getStatus()).created(new Date()).description(profile.getDescription()).language(profile.getLanguage())
|
||||
.build();
|
||||
|
||||
if (datasetProfile.getGroupId() == null) {
|
||||
datasetProfile.setGroupId(UUID.randomUUID());
|
||||
}
|
||||
|
||||
if (datasetProfile.getVersion() == null) {
|
||||
datasetProfile.setVersion((short)1);
|
||||
}
|
||||
|
||||
return datasetProfile;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.logic.managers;
|
|||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.ContactEmail.ContactEmailModel;
|
||||
import eu.eudat.models.data.ContactEmail.PublicContactEmailModel;
|
||||
import eu.eudat.models.data.mail.SimpleMail;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
@ -35,6 +36,17 @@ public class ContactEmailManager {
|
|||
apiContext.getUtilitiesService().getMailService().sendSimpleMail(mail);
|
||||
}
|
||||
|
||||
public void sendContactEmailNoAuth(PublicContactEmailModel contactEmailModel) throws MessagingException {
|
||||
SimpleMail mail = new SimpleMail();
|
||||
String enrichedMail = contactEmailModel.getMessage() + "\n\n" + "Send by user: " + contactEmailModel.getEmail() ;
|
||||
mail.setSubject(contactEmailModel.getAffiliation());
|
||||
mail.setTo(environment.getProperty("contact_email.mail"));
|
||||
mail.setContent(enrichedMail);
|
||||
mail.setFrom(contactEmailModel.getEmail());
|
||||
|
||||
apiContext.getUtilitiesService().getMailService().sendSimpleMail(mail);
|
||||
}
|
||||
|
||||
public void emailValidation(ContactEmailModel contactEmailModel) throws Exception {
|
||||
if (contactEmailModel.getSubject() == null || contactEmailModel.getSubject().trim().isEmpty()) {
|
||||
throw new Exception("Subject is empty");
|
||||
|
|
|
@ -18,6 +18,7 @@ import eu.eudat.models.data.dashboard.recent.RecentActivityData;
|
|||
import eu.eudat.models.data.dashboard.recent.model.RecentActivityModel;
|
||||
import eu.eudat.models.data.dashboard.recent.model.RecentDatasetModel;
|
||||
import eu.eudat.models.data.dashboard.recent.model.RecentDmpModel;
|
||||
import eu.eudat.models.data.dashboard.recent.tablerequest.RecentActivityTableRequest;
|
||||
import eu.eudat.models.data.dashboard.searchbar.SearchBarItem;
|
||||
import eu.eudat.models.data.dashboard.statistics.DashBoardStatistics;
|
||||
import eu.eudat.models.data.listingmodels.DataManagementPlanListingModel;
|
||||
|
@ -35,11 +36,19 @@ import java.io.IOException;
|
|||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Component
|
||||
public class DashBoardManager {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DashBoardManager.class);
|
||||
|
||||
private final Map<String, Comparator<RecentActivityModel>> comparators = Stream.of(new Object[][] {
|
||||
{ "modified", Comparator.comparing(o -> ((RecentActivityModel)o).getModified()).reversed()},
|
||||
{ "created", Comparator.comparing(o -> ((RecentActivityModel)o).getCreated()).reversed()},
|
||||
{ "label", Comparator.comparing(o -> ((RecentActivityModel)o).getTitle())},
|
||||
{ "status", Comparator.comparing(o -> ((RecentActivityModel)o).getStatus())}
|
||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Comparator<RecentActivityModel>)data[1]));
|
||||
|
||||
private ApiContext apiContext;
|
||||
private DatabaseRepository databaseRepository;
|
||||
|
||||
|
@ -183,18 +192,18 @@ public class DashBoardManager {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public List<RecentActivityModel> getNewRecentActivity(RecentActivityCriteria criteria, Principal principal, Integer numberofactivities) {
|
||||
public List<RecentActivityModel> getNewRecentActivity(RecentActivityTableRequest tableRequest, Principal principal) {
|
||||
List<RecentActivityModel> recentActivityModels = new ArrayList<>();
|
||||
DMPDao dataManagementPlanRepository = databaseRepository.getDmpDao();
|
||||
DatasetDao datasetRepository = databaseRepository.getDatasetDao();
|
||||
UserInfo user = new UserInfo();
|
||||
user.setId(principal.getId());
|
||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||
datasetCriteria.setLike(criteria.getLike());
|
||||
datasetCriteria.setLike(tableRequest.getCriteria().getLike());
|
||||
datasetCriteria.setAllVersions(false);
|
||||
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
||||
dataManagementPlanCriteria.setAllVersions(false);
|
||||
dataManagementPlanCriteria.setLike(criteria.getLike());
|
||||
dataManagementPlanCriteria.setLike(tableRequest.getCriteria().getLike());
|
||||
|
||||
QueryableList<DMP> dmpList;
|
||||
QueryableList<Dataset> datasetList;
|
||||
|
@ -211,26 +220,31 @@ public class DashBoardManager {
|
|||
datasetList = datasetRepository.getWithCriteria(datasetCriteria);
|
||||
}
|
||||
|
||||
CompletableFuture<List<RecentActivityModel>> dmps = dmpList
|
||||
.withHint(HintedModelFactory.getHint(DataManagementPlanListingModel.class))
|
||||
.orderBy((builder, root) -> builder.desc(root.get(criteria.getOrder())))
|
||||
.take(numberofactivities)
|
||||
.selectAsync(item -> {
|
||||
CompletableFuture future = CompletableFuture.runAsync(() -> {
|
||||
recentActivityModels.addAll(dmpList
|
||||
.withHint(HintedModelFactory.getHint(RecentDmpModel.class))
|
||||
.orderBy((builder, root) -> builder.desc(root.get(tableRequest.getCriteria().getOrder())))
|
||||
.skip(tableRequest.getOffset())
|
||||
.take(tableRequest.getLength())
|
||||
.select(item -> {
|
||||
return new RecentDmpModel().fromEntity(item);
|
||||
})
|
||||
.whenComplete((dmpActivities, throwable) -> recentActivityModels.addAll(dmpActivities));
|
||||
}));
|
||||
|
||||
CompletableFuture<List<RecentActivityModel>> datasets = datasetList
|
||||
.withHint(HintedModelFactory.getHint(DatasetListingModel.class))
|
||||
.orderBy((builder, root) -> builder.desc(root.get(criteria.getOrder())))
|
||||
.take(numberofactivities)
|
||||
.selectAsync(item -> {
|
||||
recentActivityModels.addAll(datasetList
|
||||
.withHint(HintedModelFactory.getHint(RecentDatasetModel.class))
|
||||
.orderBy((builder, root) -> builder.desc(root.get(tableRequest.getCriteria().getOrder())))
|
||||
.skip(tableRequest.getOffset())
|
||||
.take(tableRequest.getLength())
|
||||
.select(item -> {
|
||||
return new RecentDatasetModel().fromEntity(item);
|
||||
})
|
||||
.whenComplete((datasetActivities, throwable) -> recentActivityModels.addAll(datasetActivities));
|
||||
}));
|
||||
});
|
||||
|
||||
CompletableFuture.allOf(dmps, datasets).join();
|
||||
return recentActivityModels.stream().sorted(Comparator.comparing(RecentActivityModel::getModified)).collect(Collectors.toList());
|
||||
|
||||
CompletableFuture.allOf(future).join();
|
||||
// CompletableFuture.allOf(dmps, datasets).join();
|
||||
|
||||
return recentActivityModels.stream().sorted(this.comparators.get(tableRequest.getCriteria().getOrder())).limit(tableRequest.getLength()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<SearchBarItem> searchUserData(String like, Principal principal) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.configurations.dynamicgrant.DynamicGrantConfiguration;
|
||||
|
@ -14,10 +13,8 @@ import eu.eudat.data.enumeration.notification.ActiveStatus;
|
|||
import eu.eudat.data.enumeration.notification.ContactType;
|
||||
import eu.eudat.data.enumeration.notification.NotificationType;
|
||||
import eu.eudat.data.enumeration.notification.NotifyState;
|
||||
import eu.eudat.data.query.items.item.dmp.DataManagementPlanCriteriaRequest;
|
||||
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest;
|
||||
import eu.eudat.data.query.items.table.dmp.DataManagmentPlanPublicTableRequest;
|
||||
import eu.eudat.elastic.criteria.DmpCriteria;
|
||||
import eu.eudat.elastic.entities.Collaborator;
|
||||
import eu.eudat.elastic.entities.Dmp;
|
||||
|
@ -83,14 +80,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.file.Files;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -1412,7 +1408,9 @@ public class DataManagementPlanManager {
|
|||
}
|
||||
databaseRepository.getDmpDao().createOrUpdate(dmp);
|
||||
assignUser(dmp, me);
|
||||
if (this.apiContext.getOperationsContext().getElasticRepository().getDmpRepository().getClient() != null) {
|
||||
this.updateIndex(dmp);
|
||||
}
|
||||
dmp.getDataset().forEach(dataset -> {
|
||||
dataset.setStatus(Dataset.Status.SAVED.getValue());
|
||||
dataset.setCreated(new Date());
|
||||
|
@ -1665,6 +1663,7 @@ public class DataManagementPlanManager {
|
|||
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
String createData = null;
|
||||
Map<String, Object> extraProperties = dmp.getExtraProperties() != null ? new org.json.JSONObject(dmp.getExtraProperties()).toMap() : new HashMap<>();
|
||||
StringBuilder dataBuilder = new StringBuilder();
|
||||
dataBuilder.append("{\n \"metadata\": {\n");
|
||||
dataBuilder.append( " \"title\": \"").append(dmp.getLabel()).append("\",\n");
|
||||
|
@ -1673,15 +1672,27 @@ public class DataManagementPlanManager {
|
|||
dataBuilder.append(" \"description\": \"").append((dmp.getDescription() != null && !dmp.getDescription().isEmpty() ? dmp.getDescription() : "<p></p>")).append("\",\n");
|
||||
dataBuilder.append(" \"version\": \"").append(dmp.getVersion()).append("\",\n");
|
||||
dataBuilder.append(" \"access_right\": \"");
|
||||
if (dmp.isPublic()) {
|
||||
if (((Boolean)extraProperties.get("visible"))) {
|
||||
Instant publicationDate = Instant.parse(extraProperties.get("publicDate").toString());
|
||||
if (publicationDate.isBefore(Instant.now())) {
|
||||
dataBuilder.append("open\",\n");
|
||||
dataBuilder.append(" \"related_identifiers\": [{\n");
|
||||
dataBuilder.append(" \t\t\"identifier\": \"").append((this.environment.getProperty("dmp.domain") + "/external/zenodo/" + id.toString())).append("\",\n");
|
||||
dataBuilder.append(" \t\t\"relation\": \"isIdenticalTo\"}],\n");
|
||||
} else {
|
||||
dataBuilder.append("embargoed\",\n");
|
||||
dataBuilder.append(" \"embargo_date\": \"" + publicationDate + "\",\n");
|
||||
}
|
||||
|
||||
if (extraProperties.get("license") != null) {
|
||||
dataBuilder.append(" \"license\": \"").append(((Map)extraProperties.get("license")).get("pid")).append("\",\n");
|
||||
}
|
||||
} else {
|
||||
dataBuilder.append("restricted\",\n");
|
||||
dataBuilder.append(" \"access_conditions\": \"\",\n");
|
||||
}
|
||||
if (dmp.isPublic()) {
|
||||
dataBuilder.append(" \"related_identifiers\": [{\n");
|
||||
dataBuilder.append(" \t\t\"identifier\": \"").append((this.environment.getProperty("dmp.domain") + "/external/zenodo/" + id.toString())).append("\",\n");
|
||||
dataBuilder.append(" \t\t\"relation\": \"isIdenticalTo\"}],\n");
|
||||
}
|
||||
dataBuilder.append(" \"contributors\": [");
|
||||
int i = 0;
|
||||
for(UserDMP userDMP: dmp.getUsers()) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequest
|
|||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.eudat.elastic.repository.DatasetRepository;
|
||||
import eu.eudat.exceptions.security.ForbiddenException;
|
||||
import eu.eudat.exceptions.security.UnauthorisedException;
|
||||
import eu.eudat.logic.builders.BuilderFactory;
|
||||
import eu.eudat.logic.builders.entity.UserInfoBuilder;
|
||||
|
@ -32,6 +33,7 @@ import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
|
|||
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
|
||||
import eu.eudat.logic.utilities.json.JsonSearcher;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.data.dataset.DatasetOverviewModel;
|
||||
import eu.eudat.models.data.datasetImport.DatasetImportField;
|
||||
import eu.eudat.models.data.datasetImport.DatasetImportPagedDatasetProfile;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
|
||||
|
@ -39,6 +41,7 @@ import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
|||
import eu.eudat.models.data.dmp.AssociatedProfile;
|
||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
|
||||
import eu.eudat.models.data.listingmodels.DatasetListingModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||
|
@ -325,6 +328,26 @@ public class DatasetManager {
|
|||
}
|
||||
}
|
||||
|
||||
public DatasetOverviewModel getOverviewSingle(String id, Principal principal, boolean isPublic) throws Exception {
|
||||
Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id));
|
||||
if (datasetEntity.getStatus() == Dataset.Status.DELETED.getValue()) {
|
||||
throw new Exception("Dataset is deleted.");
|
||||
}
|
||||
if (!isPublic && principal == null) {
|
||||
throw new UnauthorisedException();
|
||||
} else
|
||||
if (!isPublic && datasetEntity.getDmp().getUsers()
|
||||
.stream().noneMatch(userInfo -> userInfo.getUser().getId() == principal.getId())) {
|
||||
throw new UnauthorisedException();
|
||||
} else if (isPublic && !datasetEntity.getDmp().isPublic()) {
|
||||
throw new ForbiddenException("Selected Dataset is not public");
|
||||
}
|
||||
DatasetOverviewModel dataset = new DatasetOverviewModel();
|
||||
dataset.fromDataModel(datasetEntity);
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public PagedDatasetProfile getPagedProfile(DatasetWizardModel dataset, eu.eudat.data.entities.Dataset datasetEntity) {
|
||||
eu.eudat.models.data.user.composite.DatasetProfile datasetprofile = userManager.generateDatasetProfileModel(datasetEntity.getProfile());
|
||||
datasetprofile.setStatus(dataset.getStatus());
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.data.dao.criteria.DataRepositoryCriteria;
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.logic.proxy.config.ExternalUrlCriteria;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.models.data.datarepository.DataRepositoryModel;
|
||||
import eu.eudat.models.data.license.LicenseModel;
|
||||
import eu.eudat.models.data.security.Principal;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 9/3/2018.
|
||||
*/
|
||||
@Component
|
||||
public class LicenseManager {
|
||||
private ApiContext apiContext;
|
||||
|
||||
@Autowired
|
||||
public LicenseManager(ApiContext apiContext) {
|
||||
this.apiContext = apiContext;
|
||||
}
|
||||
|
||||
public List<LicenseModel> getLicenses(String query, String type) throws HugeResultSet, NoURLFound {
|
||||
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
|
||||
List<Map<String, String>> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getlicenses(externalUrlCriteria, type);
|
||||
|
||||
DataRepositoryCriteria criteria = new DataRepositoryCriteria();
|
||||
if (!query.isEmpty()) criteria.setLike(query);
|
||||
|
||||
List<LicenseModel> licenseModels = new LinkedList<>();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
licenseModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, LicenseModel.class)).collect(Collectors.toList()));
|
||||
licenseModels = licenseModels.stream().filter(licenseModel -> licenseModel.getName().contains(query)).collect(Collectors.toList());
|
||||
return licenseModels;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import eu.eudat.logic.proxy.fetching.LocalFetcher;
|
||||
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
|
||||
import eu.eudat.models.data.local.LocalFetchModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class LocalFetchManager {
|
||||
private LocalFetcher localFetcher;
|
||||
|
||||
@Autowired
|
||||
public LocalFetchManager(LocalFetcher localFetcher) {
|
||||
this.localFetcher = localFetcher;
|
||||
}
|
||||
|
||||
public List<LocalFetchModel> getCurrency(String query) throws Exception {
|
||||
List<Map<String, String>> data = localFetcher.retrieveCurrency();
|
||||
List<LocalFetchModel> result = data.stream().map(entry -> new LocalFetchModel(entry.get("name"), entry.get("value"))).collect(Collectors.toList());
|
||||
result = result.stream().filter(localFetchModel -> localFetchModel.getValue() != null).filter(StreamDistinctBy.distinctByKey(LocalFetchModel::getValue)).filter(localFetchModel -> localFetchModel.getName().contains(query)).collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -34,8 +34,9 @@ public class RDAManager {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"));
|
||||
|
||||
DMPWrap wrap = new DMPWrap(rdaDmp);
|
||||
result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(wrap);
|
||||
RDAModel model = new RDAModel();
|
||||
model.setDmp(rdaDmp);
|
||||
result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -44,28 +45,7 @@ public class RDAManager {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"));
|
||||
|
||||
|
||||
Dmp rda = mapper.readValue(json, DMPWrap.class).getDmp();
|
||||
Dmp rda = mapper.readValue(json, RDAModel.class).getDmp();
|
||||
return dmpRDAMapper.toEntity(rda, profiles);
|
||||
}
|
||||
|
||||
public static class DMPWrap implements Serializable {
|
||||
@JsonProperty("dmp")
|
||||
private Dmp dmp;
|
||||
|
||||
public DMPWrap() {
|
||||
}
|
||||
|
||||
public DMPWrap(Dmp dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public Dmp getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(Dmp dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package eu.eudat.logic.mapper.elastic;
|
|||
import eu.eudat.data.dao.criteria.DataManagementPlanCriteria;
|
||||
import eu.eudat.data.entities.DMP;
|
||||
import eu.eudat.elastic.criteria.DatasetCriteria;
|
||||
import eu.eudat.elastic.entities.Collaborator;
|
||||
import eu.eudat.elastic.entities.Dataset;
|
||||
import eu.eudat.elastic.entities.Organization;
|
||||
import eu.eudat.elastic.entities.Tag;
|
||||
import eu.eudat.logic.managers.DatasetManager;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
|
|
|
@ -58,7 +58,7 @@ public class DmpMapper {
|
|||
}
|
||||
if (dmp.getDataset() != null) {
|
||||
|
||||
elastic.setDatasets(dmp.getDataset().stream().map(dataset -> {
|
||||
elastic.setDatasets(dmp.getDataset().stream().filter(dataset -> dataset.getId() != null).map(dataset -> {
|
||||
List<Tag> tags = null;
|
||||
try {
|
||||
Dataset dataset1 = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString());
|
||||
|
|
|
@ -24,6 +24,7 @@ public class ExternalUrls implements Serializable {
|
|||
DatasetUrls datasets;
|
||||
/*TagUrls tags;*/
|
||||
FunderUrls funders;
|
||||
LicenseUrls licenses;
|
||||
|
||||
|
||||
public RegistryUrls getRegistries() {
|
||||
|
@ -133,6 +134,15 @@ public class ExternalUrls implements Serializable {
|
|||
public void setDatasets(DatasetUrls datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
public LicenseUrls getLicenses() {
|
||||
return licenses;
|
||||
}
|
||||
|
||||
@XmlElement(name = "licenses")
|
||||
public void setLicenses(LicenseUrls licenses) {
|
||||
this.licenses = licenses;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package eu.eudat.logic.proxy.config.entities;
|
||||
|
||||
import eu.eudat.logic.proxy.config.FetchStrategy;
|
||||
import eu.eudat.logic.proxy.config.UrlConfiguration;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class LicenseUrls {
|
||||
List<UrlConfiguration> urls;
|
||||
FetchStrategy fetchMode;
|
||||
|
||||
public List<UrlConfiguration> getUrls() {
|
||||
return urls;
|
||||
}
|
||||
|
||||
@XmlElementWrapper
|
||||
@XmlElement(name = "urlConfig")
|
||||
public void setUrls(List<UrlConfiguration> urls) {
|
||||
this.urls = urls;
|
||||
}
|
||||
|
||||
public FetchStrategy getFetchMode() {
|
||||
return fetchMode;
|
||||
}
|
||||
|
||||
@XmlElement(name = "fetchMode")
|
||||
public void setFetchMode(FetchStrategy fetchMode) {
|
||||
this.fetchMode = fetchMode;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package eu.eudat.logic.proxy.fetching;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.logic.proxy.fetching.entities.Config;
|
||||
import eu.eudat.logic.proxy.fetching.entities.ConfigSingle;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class LocalFetcher {
|
||||
|
||||
@Cacheable("currencies")
|
||||
public List<Map<String, String>> retrieveCurrency() throws Exception {
|
||||
InputStream is = getClass().getClassLoader().getResource("internal/fetchConfig.xml").openStream();
|
||||
JAXBContext context = JAXBContext.newInstance(Config.class);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
Config config = (Config) unmarshaller.unmarshal(is);
|
||||
ConfigSingle currencyConfig = config.getConfigs().stream().filter(configSingle -> configSingle.getType().equals("currency")).findFirst().get();
|
||||
|
||||
return retrieveData(currencyConfig);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> retrieveData(ConfigSingle configSingle) throws Exception {
|
||||
List<Map<String, String>> result = new ArrayList<>();
|
||||
InputStream is = getClass().getClassLoader().getResource(configSingle.getFilePath()).openStream();
|
||||
FileType type = FileType.fromName(configSingle.getFileType());
|
||||
switch(type) {
|
||||
case XML:
|
||||
{
|
||||
Class<?> aClass = Class.forName(configSingle.getParseClass());
|
||||
JAXBContext context = JAXBContext.newInstance(aClass);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
|
||||
Object object = unmarshaller.unmarshal(is);
|
||||
|
||||
Method reader = null;
|
||||
if (configSingle.getParseField() != null && !configSingle.getParseField().isEmpty()) {
|
||||
reader = new PropertyDescriptor(configSingle.getParseField(), aClass).getReadMethod();
|
||||
}
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, String>> values = new ArrayList<>();
|
||||
int max = 1;
|
||||
if (reader != null) {
|
||||
Object invokedField = reader.invoke(object);
|
||||
if (invokedField instanceof Collection) {
|
||||
max = ((Collection) invokedField).size();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i< max; i++) {
|
||||
Object value;
|
||||
if (reader != null) {
|
||||
Object invokedField = reader.invoke(object);
|
||||
if (invokedField instanceof Collection) {
|
||||
value = ((Collection) invokedField).toArray()[i];
|
||||
} else {
|
||||
value = invokedField;
|
||||
}
|
||||
} else {
|
||||
value = object;
|
||||
}
|
||||
Map<String, String> map = objectMapper.convertValue(value, Map.class);
|
||||
result.add(new HashMap<>());
|
||||
result.get(result.size() - 1).put("name", map.get(configSingle.getName()));
|
||||
result.get(result.size() - 1).put("value", map.get(configSingle.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public enum FileType {
|
||||
XML("xml"), JSON("json");
|
||||
private String name;
|
||||
|
||||
FileType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static FileType fromName(String name) {
|
||||
for (FileType type: FileType.values()) {
|
||||
if (name.equals(type.getName())) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException("File Type [" + name + "] is not supported");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -126,6 +126,15 @@ public class RemoteFetcher {
|
|||
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
|
||||
}
|
||||
|
||||
@Cacheable("licenses")
|
||||
public List<Map<String, String>> getlicenses(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
|
||||
List<UrlConfiguration> urlConfigs =
|
||||
key != null && !key.isEmpty() ? configLoader.getExternalUrls().getLicenses().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||
: configLoader.getExternalUrls().getLicenses().getUrls();
|
||||
FetchStrategy fetchStrategy = configLoader.getExternalUrls().getLicenses().getFetchMode();
|
||||
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
|
||||
}
|
||||
|
||||
|
||||
private List<Map<String, String>> getAll(List<UrlConfiguration> urlConfigs, FetchStrategy fetchStrategy, ExternalUrlCriteria externalUrlCriteria) throws NoURLFound, HugeResultSet {
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package eu.eudat.logic.proxy.fetching.entities;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "fetchConfig")
|
||||
public class Config {
|
||||
private List<ConfigSingle> configs;
|
||||
|
||||
@XmlElementWrapper
|
||||
@XmlElement(name = "config")
|
||||
public List<ConfigSingle> getConfigs() {
|
||||
return configs;
|
||||
}
|
||||
public void setConfigs(List<ConfigSingle> configs) {
|
||||
this.configs = configs;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package eu.eudat.logic.proxy.fetching.entities;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "config")
|
||||
public class ConfigSingle {
|
||||
private String type;
|
||||
private String fileType;
|
||||
private String filePath;
|
||||
private String parseClass;
|
||||
private String parseField;
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
@XmlElement(name = "type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@XmlElement(name = "fileType")
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
@XmlElement(name = "filePath")
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
@XmlElement(name = "parseClass")
|
||||
public String getParseClass() {
|
||||
return parseClass;
|
||||
}
|
||||
public void setParseClass(String parseClass) {
|
||||
this.parseClass = parseClass;
|
||||
}
|
||||
|
||||
@XmlElement(name = "parseField")
|
||||
public String getParseField() {
|
||||
return parseField;
|
||||
}
|
||||
public void setParseField(String parseField) {
|
||||
this.parseField = parseField;
|
||||
}
|
||||
|
||||
@XmlElement(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement(name = "value")
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package eu.eudat.logic.proxy.fetching.entities;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "ISO_4217")
|
||||
public class CurrencyModel {
|
||||
private List<CurrencySingleModel> currencies;
|
||||
|
||||
@XmlElementWrapper(name = "CcyTbl")
|
||||
@XmlElement(name = "CcyNtry")
|
||||
public List<CurrencySingleModel> getCurrencies() {
|
||||
return currencies;
|
||||
}
|
||||
public void setCurrencies(List<CurrencySingleModel> currencies) {
|
||||
this.currencies = currencies;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package eu.eudat.logic.proxy.fetching.entities;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "CcyNtry")
|
||||
public class CurrencySingleModel {
|
||||
private String country;
|
||||
private String currency;
|
||||
private String code;
|
||||
private Integer numericCode;
|
||||
private Integer unit;
|
||||
|
||||
@XmlElement(name = "CtryNm")
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
@XmlElement(name = "CcyNm")
|
||||
public String getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
public void setCurrency(String currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Ccy")
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@XmlElement(name = "CcyNbr")
|
||||
public Integer getNumericCode() {
|
||||
return numericCode;
|
||||
}
|
||||
public void setNumericCode(Integer numericCode) {
|
||||
this.numericCode = numericCode;
|
||||
}
|
||||
|
||||
@XmlElement(name = "CcyMnrUnts")
|
||||
public Integer getUnit() {
|
||||
return unit;
|
||||
}
|
||||
public void setUnit(Integer unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
}
|
|
@ -93,6 +93,7 @@ public class ModelBuilder {
|
|||
if (type.equals("researchers")) return (FieldData<U>) new ResearcherData().fromData(data);
|
||||
if (type.equals("organizations")) return (FieldData<U>) new OrganizationsData().fromData(data);
|
||||
if (type.equals("datasetIdentifier")) return (FieldData<U>) new DatasetIdentifierData().fromData(data);
|
||||
if (type.equals("currency")) return (FieldData<U>) new CurrencyData().fromData(data);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -130,6 +131,7 @@ public class ModelBuilder {
|
|||
if (type.equals("researchers")) return (FieldData<U>) new ResearcherData().fromData(data);
|
||||
if (type.equals("organizations")) return (FieldData<U>) new OrganizationsData().fromData(data);
|
||||
if (type.equals("datasetIdentifier")) return (FieldData<U>) new DatasetIdentifierData().fromData(data);
|
||||
if (type.equals("currency")) return (FieldData<U>) new CurrencyData().fromData(data);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,10 +217,12 @@ public class ExportXmlBuilderDatasetProfile {
|
|||
AutoCompleteData autoCompleteDataObject = (AutoCompleteData) field.getData();
|
||||
dataOut.setAttribute("label", autoCompleteDataObject.getLabel());
|
||||
dataOut.setAttribute("type", autoCompleteDataObject.getType());
|
||||
dataOut.setAttribute("multiAutoComplete", autoCompleteDataObject.getMultiAutoComplete().toString());
|
||||
for (AutoCompleteData.AutoCompleteSingleData singleData: autoCompleteDataObject.getAutoCompleteSingleDataList()) {
|
||||
Element singleItem = element.createElement("autocompleteSingle");
|
||||
singleItem.setAttribute("optionsRoot", singleData.getOptionsRoot());
|
||||
singleItem.setAttribute("url", singleData.getUrl());
|
||||
singleItem.setAttribute("autoCompleteType", Integer.toString(singleData.getAutocompleteType()));
|
||||
if (singleData.getAutoCompleteOptions() != null) {
|
||||
Element optionChild = element.createElement("option");
|
||||
optionChild.setAttribute("label", singleData.getAutoCompleteOptions().getLabel());
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package eu.eudat.models.data.ContactEmail;
|
||||
|
||||
public class PublicContactEmailModel {
|
||||
|
||||
private String fullName;
|
||||
private String email;
|
||||
private String affiliation;
|
||||
private String message;
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
public void setFullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getAffiliation() {
|
||||
return affiliation;
|
||||
}
|
||||
|
||||
public void setAffiliation(String affiliation) {
|
||||
this.affiliation = affiliation;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
|
@ -128,7 +128,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
|||
if (data != null) {
|
||||
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
|
||||
|
||||
List<Map<String, Object>> dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autoCompleteSingleDataList");
|
||||
List<Map<String, Object>> dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autocompleteSingle");
|
||||
|
||||
this.autoCompleteSingleDataList = new ArrayList<>();
|
||||
|
||||
|
@ -168,16 +168,36 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
|||
public Map<String, Object> toMap(Element item) {
|
||||
HashMap dataMap = new HashMap();
|
||||
dataMap.put("label", item != null ? item.getAttribute("label") : "");
|
||||
dataMap.put("url", item != null ? item.getAttribute("url") : "");
|
||||
//dataMap.put("url", item != null ? item.getAttribute("url") : "");
|
||||
dataMap.put("type", item != null ? item.getAttribute("type") : "autocomplete");
|
||||
dataMap.put("optionsRoot", item != null ? item.getAttribute("optionsRoot") : "");
|
||||
Element optionElement = (Element) item.getElementsByTagName("option").item(0);
|
||||
dataMap.put("multiAutoComplete", item != null ? Boolean.valueOf(item.getAttribute("multiAutoComplete")) : false);
|
||||
List<Map<String, Object>> autoCompletes = new ArrayList<>();
|
||||
NodeList autoCompleteSingles = item.getChildNodes();
|
||||
for (int i = 0; i < autoCompleteSingles.getLength(); i++) {
|
||||
if (autoCompleteSingles.item(i) instanceof Element && !((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) {
|
||||
Element node = (Element) autoCompleteSingles.item(i);
|
||||
if (!node.hasChildNodes()) {
|
||||
node.appendChild(node);
|
||||
}
|
||||
|
||||
autoCompletes.add(singleToMap(node));
|
||||
} else if (((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) {
|
||||
Element node = item.getOwnerDocument().createElement("autocompleteSingle");
|
||||
node.appendChild(autoCompleteSingles.item(i));
|
||||
node.setAttribute("url", item.getAttribute("url"));
|
||||
node.setAttribute("optionsRoot", item.getAttribute("optionsRoot"));
|
||||
autoCompletes.add(singleToMap(node));
|
||||
}
|
||||
}
|
||||
dataMap.put("autocompleteSingle", autoCompletes);
|
||||
//dataMap.put("optionsRoot", item != null ? item.getAttribute("optionsRoot") : "");
|
||||
//Element optionElement = (Element) item.getElementsByTagName("option").item(0);
|
||||
// if (optionElement != null) {
|
||||
// this.autoCompleteOptions = new Option();
|
||||
// this.autoCompleteOptions.setLabel(optionElement.getAttribute("label"));
|
||||
// this.autoCompleteOptions.setValue(optionElement.getAttribute("value"));
|
||||
// }
|
||||
dataMap.put("autoCompleteOptions", item != null ? optionToMap(optionElement) : null);
|
||||
// dataMap.put("autoCompleteOptions", item != null ? optionToMap(optionElement) : null);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
@ -189,6 +209,18 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
|||
return dataMap;
|
||||
}
|
||||
|
||||
private Map<String, Object> singleToMap(Element item) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
if (!item.getAttribute("autoCompleteType").isEmpty()) {
|
||||
dataMap.put("autoCompleteType", Integer.parseInt(item.getAttribute("autoCompleteType")));
|
||||
}
|
||||
dataMap.put("optionsRoot", item != null ? item.getAttribute("optionsRoot") : "");
|
||||
dataMap.put("url", item != null ? item.getAttribute("url") : "");
|
||||
Element optionElement = (Element) item.getElementsByTagName("option").item(0);
|
||||
dataMap.put("autoCompleteOptions", item != null ? optionToMap(optionElement) : null);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public enum AutocompleteType {
|
||||
UNCACHED(0), CACHED(1);
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package eu.eudat.models.data.components.commons.datafield;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CurrencyData extends FieldData<CurrencyData> {
|
||||
@Override
|
||||
public CurrencyData fromData(Object data) {
|
||||
if (data != null) {
|
||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object toData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("data");
|
||||
root.setAttribute("label", this.getLabel());
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurrencyData fromXml(Element item) {
|
||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap(Element item) {
|
||||
HashMap dataMap = new HashMap();
|
||||
dataMap.put("label", item != null ? item.getAttribute("label") : "");
|
||||
return dataMap;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,13 @@
|
|||
package eu.eudat.models.data.dashboard.recent.model;
|
||||
|
||||
import java.util.Date;
|
||||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||
|
||||
public abstract class RecentActivityModel<T> {
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class RecentActivityModel<T extends DataEntity, S extends DataModel> implements DataModel<T, S> {
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
|
@ -16,7 +21,9 @@ public abstract class RecentActivityModel<T> {
|
|||
private Date finalizedAt;
|
||||
private Date publishedAt;
|
||||
private String profile;
|
||||
private RecentActivityType type;
|
||||
private int type;
|
||||
private List<UserInfoListingModel> users;
|
||||
private Boolean isPublic;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -122,18 +129,34 @@ public abstract class RecentActivityModel<T> {
|
|||
this.profile = profile;
|
||||
}
|
||||
|
||||
public RecentActivityType getType() {
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(RecentActivityType type) {
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<UserInfoListingModel> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UserInfoListingModel> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Boolean getPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(Boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
public abstract RecentActivityModel fromEntity(T entity);
|
||||
|
||||
public enum RecentActivityType {
|
||||
DMP(1), DATASET(2);
|
||||
DMP(2), DATASET(1);
|
||||
|
||||
private final int index;
|
||||
|
||||
|
@ -147,9 +170,9 @@ public abstract class RecentActivityModel<T> {
|
|||
|
||||
public static RecentActivityType fromIndex(int index) {
|
||||
switch (index) {
|
||||
case 1:
|
||||
return DMP;
|
||||
case 2:
|
||||
return DMP;
|
||||
case 1:
|
||||
return DATASET;
|
||||
default:
|
||||
throw new IllegalArgumentException("Recent Activity Type : \"" + index + "\" is not supported.");
|
||||
|
|
|
@ -4,11 +4,12 @@ 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.listingmodels.UserInfoListingModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RecentDatasetModel extends RecentActivityModel<Dataset> {
|
||||
public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatasetModel> {
|
||||
private String dmp;
|
||||
private String dmpId;
|
||||
private String dataRepositories;
|
||||
|
@ -57,6 +58,7 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset> {
|
|||
|
||||
@Override
|
||||
public RecentActivityModel fromEntity(Dataset entity) {
|
||||
this.setType(RecentActivityType.DATASET.getIndex());
|
||||
this.setId(entity.getId().toString());
|
||||
this.setTitle(entity.getLabel());
|
||||
this.setDescription(entity.getDescription());
|
||||
|
@ -75,11 +77,13 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset> {
|
|||
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
|
||||
this.setRegistries(LabelBuilder.getLabel(entity.getRegistries().stream().map(item -> new eu.eudat.models.data.dataset.Registry().fromDataModel(item)).collect(Collectors.toList())));
|
||||
this.setServices(LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList())));
|
||||
this.setPublic(entity.getDmp().isPublic());
|
||||
this.setUsers(entity.getDmp().getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public RecentDatasetModel fromDmpEntity(Dataset entity) {
|
||||
this.setType(RecentActivityType.DATASET);
|
||||
this.setType(RecentActivityType.DATASET.getIndex());
|
||||
this.setId(entity.getId().toString());
|
||||
this.setTitle(entity.getLabel());
|
||||
this.setDescription(entity.getDescription());
|
||||
|
@ -97,4 +101,20 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset> {
|
|||
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RecentDatasetModel fromDataModel(Dataset entity) {
|
||||
return (RecentDatasetModel) this.fromEntity(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dataset toDataModel() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return "recentDatasetModel";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ 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;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
@ -12,15 +14,13 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RecentDmpModel extends RecentActivityModel<DMP> {
|
||||
public class RecentDmpModel extends RecentActivityModel<DMP, RecentDmpModel> {
|
||||
private String doi;
|
||||
private Map<String, Object> extraProperties;
|
||||
private List<RecentDatasetModel> datasets;
|
||||
private List<DatasetUrlListing> datasets;
|
||||
private List<AssociatedProfile> associatedProfiles;
|
||||
private String organisations;
|
||||
private UUID groupId;
|
||||
private List<UserInfoListingModel> users;
|
||||
private Boolean isPublic;
|
||||
|
||||
|
||||
public String getDoi() {
|
||||
|
@ -39,11 +39,11 @@ public class RecentDmpModel extends RecentActivityModel<DMP> {
|
|||
this.extraProperties = extraProperties;
|
||||
}
|
||||
|
||||
public List<RecentDatasetModel> getDatasets() {
|
||||
public List<DatasetUrlListing> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(List<RecentDatasetModel> datasets) {
|
||||
public void setDatasets(List<DatasetUrlListing> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
|
@ -71,26 +71,10 @@ public class RecentDmpModel extends RecentActivityModel<DMP> {
|
|||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public List<UserInfoListingModel> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UserInfoListingModel> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public Boolean getPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(Boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public RecentActivityModel fromEntity(DMP entity) {
|
||||
this.setType(RecentActivityType.DMP);
|
||||
this.setType(RecentActivityType.DMP.getIndex());
|
||||
this.setId(entity.getId().toString());
|
||||
this.setTitle(entity.getLabel());
|
||||
this.setDescription(entity.getDescription());
|
||||
|
@ -98,18 +82,34 @@ public class RecentDmpModel extends RecentActivityModel<DMP> {
|
|||
this.setModified(entity.getModified());
|
||||
this.setStatus(entity.getStatus());
|
||||
this.setVersion(entity.getVersion());
|
||||
this.datasets = entity.getDataset().stream().map(dataset -> new RecentDatasetModel().fromDmpEntity(dataset)).collect(Collectors.toList());
|
||||
//this.datasets = entity.getDataset().stream().map(dataset -> new RecentDatasetModel().fromDmpEntity(dataset)).collect(Collectors.toList());
|
||||
this.datasets = entity.getDataset().stream().map(dataset -> new DatasetUrlListing().fromDataModel(dataset)).collect(Collectors.toList());
|
||||
this.associatedProfiles = entity.getAssociatedDmps().stream().map(item -> new AssociatedProfile().fromData(item)).collect(Collectors.toList());
|
||||
this.setFinalizedAt(entity.getFinalizedAt());
|
||||
this.setGrant(entity.getGrant().getLabel());
|
||||
this.setGrantAbbreviation(entity.getGrant().getAbbreviation());
|
||||
this.setGrantId(entity.getGrant().getId().toString());
|
||||
this.groupId = entity.getGroupId();
|
||||
this.isPublic = entity.isPublic();
|
||||
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());
|
||||
this.setPublishedAt(entity.getPublishedAt());
|
||||
this.users = entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
||||
this.setUsers(entity.getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecentDmpModel fromDataModel(DMP entity) {
|
||||
return (RecentDmpModel) this.fromEntity(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMP toDataModel() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return "recentDmpModel";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package eu.eudat.models.data.dashboard.recent.tablerequest;
|
||||
|
||||
import eu.eudat.criteria.RecentActivityCriteria;
|
||||
|
||||
public class RecentActivityTableRequest {
|
||||
private RecentActivityCriteria criteria;
|
||||
private int offset;
|
||||
private int length;
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(int length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public RecentActivityCriteria getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void setCriteria(RecentActivityCriteria criteria) {
|
||||
this.criteria = criteria;
|
||||
}
|
||||
}
|
|
@ -3,8 +3,12 @@ package eu.eudat.models.data.dataset;
|
|||
import eu.eudat.data.entities.Dataset;
|
||||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
|
||||
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DatasetOverviewModel implements DataModel<Dataset, DatasetOverviewModel> {
|
||||
|
||||
|
@ -12,6 +16,12 @@ public class DatasetOverviewModel implements DataModel<Dataset, DatasetOverviewM
|
|||
private String label;
|
||||
private short status;
|
||||
private DatasetProfileOverviewModel datasetTemplate;
|
||||
private List<UserInfoListingModel> users;
|
||||
private String dmp;
|
||||
private String grant;
|
||||
private String description;
|
||||
private Boolean isPublic;
|
||||
private Date modified;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -41,12 +51,66 @@ public class DatasetOverviewModel implements DataModel<Dataset, DatasetOverviewM
|
|||
this.datasetTemplate = datasetTemplate;
|
||||
}
|
||||
|
||||
public List<UserInfoListingModel> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UserInfoListingModel> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public String getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(String dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public String getGrant() {
|
||||
return grant;
|
||||
}
|
||||
|
||||
public void setGrant(String grant) {
|
||||
this.grant = grant;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Boolean getPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(Boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetOverviewModel fromDataModel(Dataset entity) {
|
||||
this.id = entity.getId();
|
||||
this.label = entity.getLabel();
|
||||
this.status = entity.getStatus();
|
||||
this.datasetTemplate = new DatasetProfileOverviewModel().fromDataModel(entity.getProfile());
|
||||
this.users = entity.getDmp().getUsers().stream().map(x -> new UserInfoListingModel().fromDataModel(x)).collect(Collectors.toList());
|
||||
this.dmp = entity.getDmp().getLabel();
|
||||
this.grant = entity.getDmp().getGrant().getLabel();
|
||||
this.description = entity.getDescription();
|
||||
this.isPublic = entity.getDmp().isPublic();
|
||||
this.modified = entity.getModified();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import eu.eudat.models.data.funder.FunderDMPEditorModel;
|
|||
import eu.eudat.models.data.grant.GrantDMPEditorModel;
|
||||
import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
||||
import eu.eudat.models.data.userinfo.UserInfo;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -31,6 +32,7 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
private List<Dataset> datasets;
|
||||
private ProjectDMPEditorModel project;
|
||||
private FunderDMPEditorModel funder;
|
||||
private Map<String, Object> extraProperties;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -144,6 +146,14 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
this.funder = funder;
|
||||
}
|
||||
|
||||
public Map<String, Object> getExtraProperties() {
|
||||
return extraProperties;
|
||||
}
|
||||
|
||||
public void setExtraProperties(Map<String, Object> extraProperties) {
|
||||
this.extraProperties = extraProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataManagementPlanNewVersionModel fromDataModel(DMP entity) {
|
||||
return null;
|
||||
|
@ -244,6 +254,7 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
}
|
||||
}
|
||||
|
||||
entity.setExtraProperties(this.extraProperties != null ? JSONObject.toJSONString(this.extraProperties) : null);
|
||||
if (this.profiles != null)
|
||||
entity.setAssociatedDmps(this.profiles.stream().map(x -> x.toData()).collect(Collectors.toSet()));
|
||||
return entity;
|
||||
|
|
19
dmp-backend/web/src/main/java/eu/eudat/models/data/external/LicensesExternalSourcesModel.java
vendored
Normal file
19
dmp-backend/web/src/main/java/eu/eudat/models/data/external/LicensesExternalSourcesModel.java
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.models.data.external;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class LicensesExternalSourcesModel extends ExternalListingItem<LicensesExternalSourcesModel> {
|
||||
@Override
|
||||
public LicensesExternalSourcesModel fromExternalItem(List<Map<String, String>> values) {
|
||||
for (Map<String, String> item : values) {
|
||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||
model.setId(item.get("id"));
|
||||
model.setUri(item.get("uri"));
|
||||
model.setName(item.get("name"));
|
||||
this.add(model);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package eu.eudat.models.data.license;
|
||||
|
||||
import eu.eudat.data.entities.DataRepository;
|
||||
import eu.eudat.data.entities.UserInfo;
|
||||
import eu.eudat.models.DataModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LicenseModel implements DataModel<DataRepository, LicenseModel> {
|
||||
private UUID id;
|
||||
private String name;
|
||||
private String pid;
|
||||
private String abbreviation;
|
||||
private String uri;
|
||||
private Date created;
|
||||
private Date modified;
|
||||
private String tag; // Api fetching the data
|
||||
private String source; // Actual harvested source
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getModified() {
|
||||
return modified;
|
||||
}
|
||||
public void setModified(Date modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LicenseModel fromDataModel(DataRepository entity) {
|
||||
this.setAbbreviation(entity.getAbbreviation());
|
||||
this.setName(entity.getLabel());
|
||||
this.setUri(entity.getUri());
|
||||
this.setId(entity.getId());
|
||||
this.setPid(entity.getReference());
|
||||
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||
if (source1.equals("dmp")) {
|
||||
this.source = "Internal";
|
||||
} else {
|
||||
this.source = source1;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataRepository toDataModel() throws Exception {
|
||||
DataRepository dataRepository = new DataRepository();
|
||||
dataRepository.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||
dataRepository.setAbbreviation(this.abbreviation);
|
||||
dataRepository.setCreated(this.created != null ? this.created : new Date());
|
||||
dataRepository.setModified(new Date());
|
||||
dataRepository.setLabel(this.name);
|
||||
if (this.source != null) {
|
||||
if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) {
|
||||
dataRepository.setReference(this.id.toString());
|
||||
} else {
|
||||
dataRepository.setReference(this.source + ":" + dataRepository.getId());
|
||||
}
|
||||
} else {
|
||||
dataRepository.setReference("dmp:" + dataRepository.getId());
|
||||
}
|
||||
dataRepository.setUri(this.uri);
|
||||
dataRepository.setStatus((short) 0);
|
||||
dataRepository.setCreationUser(new UserInfo());
|
||||
return dataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package eu.eudat.models.data.local;
|
||||
|
||||
public class LocalFetchModel {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public LocalFetchModel(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -6,10 +6,7 @@ import eu.eudat.models.data.dmp.AssociatedProfile;
|
|||
import eu.eudat.models.data.security.Principal;
|
||||
import eu.eudat.models.data.userinfo.UserListingModel;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class DmpQuickWizardModel {
|
||||
|
@ -19,6 +16,7 @@ public class DmpQuickWizardModel {
|
|||
private AssociatedProfile datasetProfile;
|
||||
private String description;
|
||||
private eu.eudat.models.data.grant.Grant grant;
|
||||
private String language;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
|
@ -65,6 +63,14 @@ public class DmpQuickWizardModel {
|
|||
this.grant = grant;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public eu.eudat.models.data.dmp.DataManagementPlan toDataDmp(Grant grant, Project project, Principal principal) {
|
||||
eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlanEntity = new eu.eudat.models.data.dmp.DataManagementPlan();
|
||||
|
||||
|
@ -93,6 +99,8 @@ public class DmpQuickWizardModel {
|
|||
eu.eudat.models.data.userinfo.UserInfo userInfo = new eu.eudat.models.data.userinfo.UserInfo();
|
||||
userInfo.setId(principal.getId());
|
||||
dataManagementPlanEntity.setAssociatedUsers(user);
|
||||
dataManagementPlanEntity.setExtraProperties(new HashMap<>());
|
||||
dataManagementPlanEntity.getExtraProperties().put("language", this.language);
|
||||
return dataManagementPlanEntity;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import eu.eudat.models.data.properties.PropertiesGenerator;
|
|||
import eu.eudat.models.data.user.composite.PropertiesModelBuilder;
|
||||
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
||||
import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition;
|
||||
import sun.rmi.runtime.NewThreadAction;
|
||||
|
||||
import java.security.Key;
|
||||
import java.util.*;
|
||||
|
|
|
@ -217,6 +217,7 @@ public class DatasetRDAMapper {
|
|||
properties.putAll(DistributionRDAMapper.toProperties(rda.getDistribution().get(0), datasetDescriptionObj));
|
||||
}
|
||||
|
||||
if (rda.getKeyword() != null) {
|
||||
List<String> keywordIds = rda.getAdditionalProperties().entrySet().stream().filter(entry -> entry.getKey().startsWith("keyword")).map(entry -> entry.getValue().toString()).collect(Collectors.toList());
|
||||
boolean takeAll = false;
|
||||
if (keywordIds.size() < rda.getKeyword().size()) {
|
||||
|
@ -233,6 +234,7 @@ public class DatasetRDAMapper {
|
|||
properties.put(keywordIds.get(i), mapper.writeValueAsString(toTagEntity(rda.getKeyword().get(i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<JsonNode> personalDataNodes = JsonSearcher.findNodes(datasetDescriptionObj, "rdaProperty", "dataset.personal_data");
|
||||
if (!personalDataNodes.isEmpty()) {
|
||||
|
|
|
@ -42,7 +42,9 @@ public class DmpRDAMapper {
|
|||
rda.setTitle(dmp.getLabel());
|
||||
|
||||
Map<String, Object> extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap();
|
||||
if (!extraProperties.isEmpty()) {
|
||||
rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(extraProperties.get("language").toString()));
|
||||
}
|
||||
|
||||
UserInfo creator;
|
||||
if (dmp.getCreator() != null) {
|
||||
|
|
|
@ -77,7 +77,7 @@ zenodo.login.redirect_uri=http://localhost:4200/login/external/zenodo
|
|||
#############CONTACT EMAIL CONFIGURATIONS#########
|
||||
contact_email.mail=
|
||||
|
||||
language.path=i18n/
|
||||
language.path=dmp-frontend/src/assets/i18n/
|
||||
|
||||
#############LOGGING#########
|
||||
logging.config=classpath:logging/logback-${spring.profiles.active}.xml
|
|
@ -497,7 +497,7 @@
|
|||
<repositories>
|
||||
<urls>
|
||||
<urlConfig>
|
||||
<key>openAire</key>
|
||||
<key>openaire</key>
|
||||
<label>OpenAIRE</label>
|
||||
<ordinal>1</ordinal>
|
||||
<type>External</type>
|
||||
|
@ -514,6 +514,24 @@
|
|||
</data>
|
||||
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||
</urlConfig>
|
||||
<urlConfig>
|
||||
<key>openairealt</key>
|
||||
<label>OpenAIRE Alternative</label>
|
||||
<ordinal>1</ordinal>
|
||||
<type>External</type>
|
||||
<url>https://services.openaire.eu/search/v2/api/resources?query=oaftype%20exact%20datasource%20and%20{like}&page={page}&size={pageSize}&format=json</url>
|
||||
<firstPage>0</firstPage>
|
||||
<contenttype>application/json;charset=UTF-8</contenttype>
|
||||
<data>
|
||||
<path>$['results'][*]['result']['metadata']['oaf:entity']['oaf:datasource']</path>
|
||||
<fields>
|
||||
<id>'originalId'</id>
|
||||
<name>'officialname'</name>
|
||||
<count>'count'</count>
|
||||
</fields>
|
||||
</data>
|
||||
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||
</urlConfig>
|
||||
<!--<urlConfig>
|
||||
<key>cristin</key>
|
||||
<label>Cristin</label>
|
||||
|
@ -799,6 +817,24 @@
|
|||
</data>
|
||||
<paginationpath>$['number_of_results']</paginationpath>
|
||||
</urlConfig>
|
||||
<urlConfig>
|
||||
<key>openaire</key>
|
||||
<label>OpenAIRE</label>
|
||||
<ordinal>1</ordinal>
|
||||
<type>External</type>
|
||||
<url>https://services.openaire.eu/search/v2/api/organizations/?q={like}&page={page}&size={pageSize}&format=json</url>
|
||||
<firstPage>0</firstPage>
|
||||
<contenttype>application/json; charset=utf-8</contenttype>
|
||||
<data>
|
||||
<path>$['results'][*]['result']['metadata']['oaf:entity']['oaf:organization']</path>
|
||||
<fields>
|
||||
<id>'originalId'</id>
|
||||
<name>'legalname'</name>
|
||||
<count>'count'</count>
|
||||
</fields>
|
||||
</data>
|
||||
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||
</urlConfig>
|
||||
<!-- <urlConfig>
|
||||
<key>openAire</key>
|
||||
<label>OpenAIRE</label>
|
||||
|
@ -901,6 +937,30 @@
|
|||
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||
</datasets>
|
||||
|
||||
<licenses>
|
||||
<urls>
|
||||
<urlConfig>
|
||||
<key>opendefinition</key>
|
||||
<label>Open Definition</label>
|
||||
<ordinal>1</ordinal>
|
||||
<type>External</type>
|
||||
<url>https://licenses.opendefinition.org/licenses/groups/all.json</url>
|
||||
<firstPage>1</firstPage>
|
||||
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||
<data>
|
||||
<path>$[*]</path>
|
||||
<fields>
|
||||
<id>'id'</id>
|
||||
<name>'title'</name>
|
||||
<uri>'url'</uri>
|
||||
<description>'maintainer'</description>
|
||||
</fields>
|
||||
</data>
|
||||
</urlConfig>
|
||||
</urls>
|
||||
<fetchMode>FIRST</fetchMode>
|
||||
</licenses>
|
||||
|
||||
|
||||
</externalUrls>
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<fetchConfig>
|
||||
<configs>
|
||||
<config>
|
||||
<type>currency</type>
|
||||
<fileType>xml</fileType>
|
||||
<filePath>internal/iso-4217.xml</filePath>
|
||||
<parseClass>eu.eudat.logic.proxy.fetching.entities.CurrencyModel</parseClass>
|
||||
<parseField>currencies</parseField>
|
||||
<name>currency</name>
|
||||
<value>code</value>
|
||||
</config>
|
||||
</configs>
|
||||
</fetchConfig>
|
File diff suppressed because it is too large
Load Diff
|
@ -140,13 +140,21 @@ const appRoutes: Routes = [
|
|||
}
|
||||
},
|
||||
{
|
||||
path: 'terms-of-service',
|
||||
path: 'terms-and-conditions',
|
||||
loadChildren: () => import('./ui/sidebar/sidebar-footer/terms/terms.module').then(m => m.TermsModule),
|
||||
data: {
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.TERMS'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'cookies-policy',
|
||||
loadChildren: () => import('./ui/sidebar/sidebar-footer/cookies-policy/cookies-policy.module').then(m => m.CookiesPolicyModule),
|
||||
data: {
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.COOKIES-POLICY'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'home',
|
||||
loadChildren: () => import('./ui/dashboard/dashboard.module').then(m => m.DashboardModule),
|
||||
|
@ -154,20 +162,13 @@ const appRoutes: Routes = [
|
|||
breadcrumb: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'guest',
|
||||
loadChildren: () => import('./ui/guest/guest.module').then(m => m.GuestModule),
|
||||
data: {
|
||||
breadcrumb: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'splash',
|
||||
loadChildren: () => import('./ui/splash/splash.module').then(m => m.SplashModule),
|
||||
data: {
|
||||
breadcrumb: true
|
||||
}
|
||||
},
|
||||
// {
|
||||
// path: 'splash',
|
||||
// loadChildren: () => import('./ui/splash/splash.module').then(m => m.SplashModule),
|
||||
// data: {
|
||||
// breadcrumb: true
|
||||
// }
|
||||
// },
|
||||
{
|
||||
path: 'unauthorized',
|
||||
loadChildren: () => import('./ui/misc/unauthorized/unauthorized.module').then(m => m.UnauthorizedModule),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="wrapper" *ngIf="isAuthenticated()">
|
||||
<div class="wrapper" *ngIf="!onlySplash">
|
||||
<app-navbar (sidebarToggled)="sidenav.toggle(); toggleNavbar($event);"></app-navbar>
|
||||
<mat-sidenav-container fullscreen class="main-container">
|
||||
<mat-sidenav #sidenav mode="side" opened class="sidenav" [fixedInViewport]="true" [fixedTopGap]="80">
|
||||
|
@ -10,8 +10,17 @@
|
|||
</div>
|
||||
</mat-sidenav-content>
|
||||
</mat-sidenav-container>
|
||||
<!-- <div class="sidebar sidebar-shadow" data-color="danger" data-background-color="white" data-image="./assets/images/logan-troxell-9187-unsplash.jpg">
|
||||
<app-sidebar></app-sidebar>
|
||||
<div class="sidebar-background" style="background-image: url(./assets/images/logan-troxell-9187-unsplash.jpg)">
|
||||
</div>
|
||||
<div class="wrapper" *ngIf="!isAuthenticated()">
|
||||
</div>
|
||||
<div class="main-panel">
|
||||
<app-navbar></app-navbar>
|
||||
<div>
|
||||
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
|
||||
</div>
|
||||
<app-notification></app-notification>
|
||||
</div> -->
|
||||
</div>
|
||||
<app-notification *ngIf="!onlySplash"></app-notification>
|
||||
<router-outlet *ngIf="onlySplash"></router-outlet>
|
||||
|
|
|
@ -32,6 +32,7 @@ export class AppComponent implements OnInit {
|
|||
sideNavOpen = false;
|
||||
helpContentEnabled: boolean;
|
||||
private statusChangeSubscription: Subscription;
|
||||
onlySplash = true;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
@ -60,17 +61,18 @@ export class AppComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.location.path() === '' || this.location.path() === '/home') {
|
||||
if (this.isAuthenticated()) {
|
||||
if (this.location.path() === '') {
|
||||
if (!this.configurationService.useSplash) {
|
||||
this.onlySplash = false;
|
||||
this.router.navigate(['/reload']).then(() => this.router.navigate(['/home']));
|
||||
} else if (!this.isAuthenticated()) {
|
||||
this.router.navigate(['/reload']).then(() => this.router.navigate(['/guest']));
|
||||
} else {
|
||||
this.onlySplash = true;
|
||||
this.router.navigate(['/reload']).then(() => this.router.navigate(['/splash']));
|
||||
}
|
||||
// if (!this.configurationService.useSplash) {
|
||||
// this.router.navigate(['/reload']).then(() => this.router.navigate(['/home']));
|
||||
// } else {
|
||||
// this.router.navigate(['/reload']).then(() => this.router.navigate(['/splash']));
|
||||
// }
|
||||
} else if (this.location.path() === '/splash') {
|
||||
this.onlySplash = true;
|
||||
} else {
|
||||
this.onlySplash = false;
|
||||
}
|
||||
if (!this.cookieService.check("cookiesConsent")) {
|
||||
this.cookieService.set("cookiesConsent", "false", 356);
|
||||
|
@ -117,7 +119,7 @@ export class AppComponent implements OnInit {
|
|||
}
|
||||
});
|
||||
|
||||
this.ccService.getConfig().content.href = this.configurationService.app + "terms-of-service";
|
||||
this.ccService.getConfig().content.href = this.configurationService.app + "cookies-policy";
|
||||
this.ccService.getConfig().cookie.domain = this.configurationService.app;
|
||||
this.translate
|
||||
.get(['COOKIE.MESSAGE', 'COOKIE.DISMISS', 'COOKIE.DENY', 'COOKIE.LINK', 'COOKIE.POLICY'])
|
||||
|
|
|
@ -31,7 +31,6 @@ import { TranslateServerLoader } from './core/services/language/server.loader';
|
|||
import { BaseHttpService } from './core/services/http/base-http.service';
|
||||
import { ConfigurationService } from './core/services/configuration/configuration.service';
|
||||
import { Oauth2DialogModule } from './ui/misc/oauth2-dialog/oauth2-dialog.module';
|
||||
import { GuestModule } from './ui/guest/guest.module';
|
||||
|
||||
// AoT requires an exported function for factories
|
||||
export function HttpLoaderFactory(http: HttpClient, appConfig: ConfigurationService) {
|
||||
|
@ -63,7 +62,7 @@ const cookieConfig: NgcCookieConsentConfig = {
|
|||
deny: "Refuse cookies",
|
||||
link: "Learn more",
|
||||
href: "",//environment.App + "terms-of-service",
|
||||
policy: "Cookie Policy"
|
||||
policy: "Cookies Policy"
|
||||
},
|
||||
position: "bottom-right",
|
||||
theme: 'edgeless',
|
||||
|
@ -99,7 +98,6 @@ const cookieConfig: NgcCookieConsentConfig = {
|
|||
DatasetCreateWizardModule,
|
||||
NavbarModule,
|
||||
SidebarModule,
|
||||
GuestModule,
|
||||
NgcCookieConsentModule.forRoot(cookieConfig),
|
||||
Oauth2DialogModule
|
||||
],
|
||||
|
|
|
@ -14,5 +14,6 @@ export enum DatasetProfileFieldViewStyle {
|
|||
Tags = "tags",
|
||||
Researchers = "researchers",
|
||||
Organizations = "organizations",
|
||||
DatasetIdentifier = "datasetIdentifier"
|
||||
DatasetIdentifier = "datasetIdentifier",
|
||||
Currency = "currency"
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import { UserGuideService } from './services/user-guide/user-guide.service';
|
|||
import { ConfigurationService } from './services/configuration/configuration.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { LanguageInfoService } from './services/culture/language-info-service';
|
||||
import { CurrencyService } from './services/currency/currency.service';
|
||||
//
|
||||
//
|
||||
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
||||
|
@ -105,6 +106,7 @@ export class CoreServiceModule {
|
|||
LanguageService,
|
||||
LockService,
|
||||
UserGuideService,
|
||||
CurrencyService,
|
||||
ConfigurationService,
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
|
|
|
@ -100,3 +100,7 @@ export interface OrganizationsFieldData extends FieldData {
|
|||
export interface DatasetIdentifierFieldData extends FieldData {
|
||||
|
||||
}
|
||||
|
||||
export interface CurrencyFieldData extends FieldData {
|
||||
|
||||
}
|
||||
|
|
|
@ -36,4 +36,5 @@ export interface DmpModel {
|
|||
dynamicFields: Array<DmpDynamicField>;
|
||||
modified: Date;
|
||||
extraProperties: Map<String, any>;
|
||||
language: String;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
export class LocalFetchModel {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
|
||||
import { UserInfoListingModel } from '../user/user-info-listing';
|
||||
|
||||
export class RecentActivityModel {
|
||||
id: String;
|
||||
title: String;
|
||||
|
@ -12,5 +15,8 @@ export class RecentActivityModel {
|
|||
finalizedAt: Date;
|
||||
publishedAt: Date;
|
||||
profile: String;
|
||||
type: RecentActivityType;
|
||||
users: UserInfoListingModel[];
|
||||
public: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ import { UserInfoListingModel } from '../user/user-info-listing';
|
|||
export class RecentDmpModel extends RecentActivityModel {
|
||||
doi: String;
|
||||
extraProperties: Map<String, any>;
|
||||
datasets: RecentDatasetModel[];
|
||||
datasets: any[];
|
||||
associatedProfiles: DmpAssociatedProfileModel[];
|
||||
organisations: String;
|
||||
groupId: string;
|
||||
users: UserInfoListingModel[];
|
||||
isPublic: boolean;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { BaseCriteria } from "../base-criteria";
|
||||
|
||||
export class LicenseCriteria extends BaseCriteria {
|
||||
public type: string;
|
||||
}
|
|
@ -14,6 +14,7 @@ import { environment } from 'environments/environment';
|
|||
import { Observable, of as observableOf, throwError as observableThrowError } from 'rxjs';
|
||||
import { catchError, map, takeUntil } from 'rxjs/operators';
|
||||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { CookieService } from 'ngx-cookie-service';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService extends BaseService {
|
||||
|
@ -26,7 +27,8 @@ export class AuthService extends BaseService {
|
|||
private language: TranslateService,
|
||||
private router: Router,
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private configurationService: ConfigurationService
|
||||
private configurationService: ConfigurationService,
|
||||
private cookieService: CookieService
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -73,6 +75,7 @@ export class AuthService extends BaseService {
|
|||
return this.http.post(url, loginInfo, { headers: this.headers }).pipe(
|
||||
map((res: any) => {
|
||||
const principal = this.current(res.payload);
|
||||
this.cookieService.set('cookiesConsent', 'true', 356);
|
||||
//this.loginContextSubject.next(true);
|
||||
return principal;
|
||||
}),
|
||||
|
@ -89,6 +92,7 @@ export class AuthService extends BaseService {
|
|||
return this.http.post(url, credentials, { headers: this.headers }).pipe(
|
||||
map((res: any) => {
|
||||
const principal = this.current(res.payload);
|
||||
this.cookieService.set('cookiesConsent', 'true', 356);
|
||||
//this.loginContextSubject.next(true);
|
||||
return principal;
|
||||
}),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { BaseHttpParams } from '@common/http/base-http-params';
|
||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||
import { BaseHttpService } from '@common/base/base-http.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { catchError, takeUntil } from 'rxjs/operators';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { LocalFetchModel } from '@app/core/model/local-fetch/local-fetch.model';
|
||||
import { BaseHttpService } from '../http/base-http.service';
|
||||
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class CurrencyService {
|
||||
|
||||
private actionUrl: string;
|
||||
constructor(private http: BaseHttpService, private configurationService: ConfigurationService) {
|
||||
this.actionUrl = configurationService.server + 'currency';
|
||||
}
|
||||
|
||||
get(query: string): Observable<LocalFetchModel[]> {
|
||||
return this.http.get<LocalFetchModel[]>(`${this.actionUrl}?query=${query}`);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import { BaseHttpService } from '../http/base-http.service';
|
|||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { RecentActivityModel } from '@app/core/model/recent-activity/recent-activity.model';
|
||||
import { RecentActivityCriteria } from '@app/core/query/recent-activity/recent-activity-criteria';
|
||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
||||
|
||||
@Injectable()
|
||||
export class DashboardService {
|
||||
|
@ -27,7 +28,7 @@ export class DashboardService {
|
|||
return this.http.get<DashboardStatisticsModel>(this.actionUrl + 'me/getStatistics', { headers: this.headers });
|
||||
}
|
||||
|
||||
getRecentAcitvity(criteria: RecentActivityCriteria): Observable<RecentActivityModel[]> {
|
||||
return this.http.post<RecentActivityModel[]>(this.actionUrl + 'recentActivity', criteria, {headers: this.headers});
|
||||
getRecentActivity(request: DataTableRequest<RecentActivityCriteria>): Observable<RecentActivityModel[]> {
|
||||
return this.http.post<RecentActivityModel[]>(this.actionUrl + 'recentActivity', request, {headers: this.headers});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import { ConfigurationService } from '../../configuration/configuration.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { LocalFetchModel } from '@app/core/model/local-fetch/local-fetch.model';
|
||||
import { BaseHttpService } from '../../http/base-http.service';
|
||||
|
||||
@Injectable()
|
||||
export class CurrencyService {
|
||||
|
||||
private actionUrl: string;
|
||||
constructor(private http: BaseHttpService, private configurationService: ConfigurationService) {
|
||||
this.actionUrl = configurationService.server + 'currency';
|
||||
}
|
||||
|
||||
get(): Observable<LocalFetchModel[]> {
|
||||
return this.http.get<LocalFetchModel[]>(this.actionUrl);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import { ServiceCriteria } from '../../query/service/service-criteria';
|
|||
import { TagCriteria } from '../../query/tag/tag-criteria';
|
||||
import { BaseHttpService } from '../http/base-http.service';
|
||||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { LicenseCriteria } from '@app/core/query/license/license-criteria';
|
||||
|
||||
@Injectable()
|
||||
export class ExternalSourcesService {
|
||||
|
@ -40,6 +41,10 @@ export class ExternalSourcesService {
|
|||
return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + 'services' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers });
|
||||
}
|
||||
|
||||
public searchLicense(requestItem: RequestItem<LicenseCriteria>): Observable<ExternalSourceItemModel[]> {
|
||||
return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + 'licenses' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers });
|
||||
}
|
||||
|
||||
public searchDatasetTags(requestItem: RequestItem<TagCriteria>): Observable<ExternalSourceItemModel[]> {
|
||||
// return Observable.of([
|
||||
// { id: '1', name: 'Tag 1', description: '' },
|
||||
|
|
|
@ -83,6 +83,7 @@ export class EnumUtils {
|
|||
case DatasetProfileFieldViewStyle.Researchers: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RESEARCHERS');
|
||||
case DatasetProfileFieldViewStyle.Organizations: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.ORGANIZATIONS');
|
||||
case DatasetProfileFieldViewStyle.DatasetIdentifier: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATASET-IDENTIFIER');
|
||||
case DatasetProfileFieldViewStyle.Currency: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.CURRENCY');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import { FormGroup } from '@angular/forms';
|
||||
import { FieldDataEditorModel } from './field-data-editor-model';
|
||||
import { CurrencyFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
|
||||
|
||||
export class CurrencyDataEditorModel extends FieldDataEditorModel<CurrencyDataEditorModel> {
|
||||
public label: string;
|
||||
|
||||
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||
const formGroup = this.formBuilder.group({
|
||||
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('CurrencyDataEditorModel.label')) }]
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromModel(item: CurrencyFieldData): CurrencyDataEditorModel {
|
||||
this.label = item.label;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import { TagsDataEditorModel } from './field-data/tags-data-editor-models';
|
|||
import { ResearchersDataEditorModel } from './field-data/researchers-data-editor-models';
|
||||
import { OrganizationsDataEditorModel } from './field-data/organizations-data-editor-models';
|
||||
import { DatasetIdentifierDataEditorModel } from './field-data/dataset-identifier-data-editor-models';
|
||||
import { CurrencyDataEditorModel } from './field-data/currency-data-editor-models';
|
||||
|
||||
export class FieldEditorModel extends BaseFormModel {
|
||||
|
||||
|
@ -73,6 +74,7 @@ export class FieldEditorModel extends BaseFormModel {
|
|||
if (this.viewStyle.renderStyle === 'researchers') { this.data = new ResearchersDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'organizations') { this.data = new OrganizationsDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'datasetIdentifier') { this.data = new DatasetIdentifierDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'currency') { this.data = new CurrencyDataEditorModel().fromModel(item.data); }
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
|
|
@ -36,6 +36,7 @@ import { DatasetProfileEditorTagsFieldComponent } from './editor/components/fiel
|
|||
import { DatasetProfileEditorResearchersFieldComponent } from './editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component';
|
||||
import { DatasetProfileEditorOrganizationsFieldComponent } from './editor/components/field-type/organizations/dataset-profile-editor-organizations-field.component';
|
||||
import { DatasetProfileEditorDatasetIdentifierFieldComponent } from './editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component';
|
||||
import { DatasetProfileEditorCurrencyFieldComponent } from './editor/components/field-type/currency/dataset-profile-editor-currency-field.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -77,7 +78,8 @@ import { DatasetProfileEditorDatasetIdentifierFieldComponent } from './editor/co
|
|||
DatasetProfileEditorTagsFieldComponent,
|
||||
DatasetProfileEditorResearchersFieldComponent,
|
||||
DatasetProfileEditorOrganizationsFieldComponent,
|
||||
DatasetProfileEditorDatasetIdentifierFieldComponent
|
||||
DatasetProfileEditorDatasetIdentifierFieldComponent,
|
||||
DatasetProfileEditorCurrencyFieldComponent
|
||||
],
|
||||
entryComponents: [
|
||||
DialodConfirmationUploadDatasetProfiles
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<div class="row" *ngIf="form.get('data')">
|
||||
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE'
|
||||
| translate}}</h5>
|
||||
<mat-form-field class="col-12">
|
||||
<input matInput type="string"
|
||||
placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}"
|
||||
[formControl]="form.get('data').get('label')">
|
||||
</mat-form-field>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
.full-width {
|
||||
width: 100%;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { DataRepositoriesDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/data-repositories-data-editor-models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-profile-editor-currency-field-component',
|
||||
styleUrls: ['./dataset-profile-editor-currency-field.component.scss'],
|
||||
templateUrl: './dataset-profile-editor-currency-field.component.html'
|
||||
})
|
||||
export class DatasetProfileEditorCurrencyFieldComponent implements OnInit {
|
||||
|
||||
@Input() form: FormGroup;
|
||||
private data: DataRepositoriesDataEditorModel = new DataRepositoriesDataEditorModel();
|
||||
|
||||
ngOnInit() {
|
||||
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
<mat-option [value]="viewStyleEnum.Researchers">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Researchers)}}</mat-option>
|
||||
<mat-option [value]="viewStyleEnum.Organizations">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Organizations)}}</mat-option>
|
||||
<mat-option [value]="viewStyleEnum.DatasetIdentifier">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.DatasetIdentifier)}}</mat-option>
|
||||
<mat-option [value]="viewStyleEnum.Currency">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Currency)}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="this.form.get('viewStyle').get('renderStyle').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
@ -80,6 +81,7 @@
|
|||
<app-dataset-profile-editor-researchers-field-component *ngSwitchCase="viewStyleEnum.Researchers" class="col-12" [form]="form"></app-dataset-profile-editor-researchers-field-component>
|
||||
<app-dataset-profile-editor-organizations-field-component *ngSwitchCase="viewStyleEnum.Organizations" class="col-12" [form]="form"></app-dataset-profile-editor-organizations-field-component>
|
||||
<app-dataset-profile-editor-dataset-identifier-field-component *ngSwitchCase="viewStyleEnum.DatasetIdentifier" class="col-12" [form]="form"></app-dataset-profile-editor-dataset-identifier-field-component>
|
||||
<app-dataset-profile-editor-currency-field-component *ngSwitchCase="viewStyleEnum.Currency" class="col-12" [form]="form"></app-dataset-profile-editor-currency-field-component>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h4 class="col-12" style="font-weight: bold">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.RULES-TITLE' | translate}}
|
||||
|
|
|
@ -25,6 +25,7 @@ import { ResearchersDataEditorModel } from '../../../admin/field-data/researcher
|
|||
import { OrganizationsDataEditorModel } from '../../../admin/field-data/organizations-data-editor-models';
|
||||
import { DatasetIdentifierDataEditorModel } from '../../../admin/field-data/dataset-identifier-data-editor-models';
|
||||
import { ExternalDatasetsDataEditorModel } from '../../../admin/field-data/external-datasets-data-editor-models';
|
||||
import { CurrencyDataEditorModel } from '../../../admin/field-data/currency-data-editor-models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-profile-editor-field-component',
|
||||
|
@ -109,6 +110,9 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
case DatasetProfileFieldViewStyle.DatasetIdentifier:
|
||||
this.form.addControl('data', new DatasetIdentifierDataEditorModel().buildForm());
|
||||
break;
|
||||
case DatasetProfileFieldViewStyle.Currency:
|
||||
this.form.addControl('data', new CurrencyDataEditorModel().buildForm());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -133,6 +137,7 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
case DatasetProfileFieldViewStyle.Registries:
|
||||
case DatasetProfileFieldViewStyle.Organizations:
|
||||
case DatasetProfileFieldViewStyle.DatasetIdentifier:
|
||||
case DatasetProfileFieldViewStyle.Currency:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -5,21 +5,21 @@
|
|||
&& dashboardStatisticsData?.totalGrantCount === 0
|
||||
&& dashboardStatisticsData?.totalOrganisationCount === 0">
|
||||
<div class="main-content">
|
||||
<div class="col-md-8">
|
||||
<div class="col-auto">
|
||||
<div class="card" [style.display]="isVisible ? 'block' : 'none'">
|
||||
<!-- <a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a> -->
|
||||
<p class="card-title mb-0">{{'DASHBOARD.DMP-QUESTION' | translate}}</p>
|
||||
<p class="card-title mb-0 pt-3">{{'DASHBOARD.DMP-QUESTION' | translate}}</p>
|
||||
<p class="card-content mb-0">{{'DASHBOARD.INFO-DMP-TEXT' | translate}}</p>
|
||||
<p class="card-content pt-3 mb-0">
|
||||
{{'DASHBOARD.NEW-QUESTION' | translate}} <a><u>{{'DASHBOARD.OPEN-AIR-GUIDE' | translate}}</u></a> {{'DASHBOARD.LEARN-MORE' | translate}}
|
||||
</p>
|
||||
<div class="d-flex">
|
||||
<button type="button" class="col-auto align-self-center normal-btn">Start your first DMP</button>
|
||||
<img class="col-auto ml-auto" src="../../assets/img/laptop.png" width="116" height="139">
|
||||
<img class="col-auto ml-auto" src="../../../assets/splash/assets/img/laptop.png" width="116" height="139">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col pt-4 mt-3 pl-4">
|
||||
<div class="personal-usage">{{'DASHBOARD.PERSONAL-USAGE' | translate}}</div>
|
||||
<div class="counter-zero">0</div>
|
||||
<a href="#" class="link">{{'DASHBOARD.DMPS' | translate}}</a>
|
||||
|
@ -36,40 +36,48 @@
|
|||
|| dashboardStatisticsData?.totalDataSetCount !== 0
|
||||
|| dashboardStatisticsData?.totalGrantCount !== 0
|
||||
|| dashboardStatisticsData?.totalOrganisationCount !== 0">
|
||||
|
||||
<div class="main-content">
|
||||
<div class="col">
|
||||
<div class="card" [style.display]="isVisible ? 'block' : 'none'">
|
||||
<div class="card mt-0" [style.display]="isVisible ? 'block' : 'none'">
|
||||
<a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a>
|
||||
<p class="card-content mb-0 pt-0">
|
||||
{{'DASHBOARD.DMP-ABOUT-BEG' | translate}}
|
||||
<b>{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}}</b>
|
||||
{{'DASHBOARD.DMP-ABOUT-END' | translate}}</p>
|
||||
<div class="d-flex pt-4 pb-4 mt-3 mb-3">
|
||||
<button type="button" class="col-auto align-self-center yellow-btn">{{'DASHBOARD.ACTIONS.ADD-DATASET-DESCRIPTION' | translate}}</button>
|
||||
<button mat-raised-button type="button" class="col-auto align-self-center yellow-btn" [routerLink]="['/datasets/new']">{{'DASHBOARD.ACTIONS.ADD-DATASET-DESCRIPTION' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="latest-activity-title">Latest activity</div>
|
||||
<div class="latest-activity-title">{{'DASHBOARD.LATEST-ACTIVITY' | translate}}</div>
|
||||
<mat-tab-group mat-align-tabs="start" class="remove-border-bottom">
|
||||
<mat-tab label="All">
|
||||
<div class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<app-recent-edited-activity></app-recent-edited-activity>
|
||||
<mat-tab label="{{'DASHBOARD.ALL' | translate}} ({{totalRecents}})">
|
||||
<div *ngIf="totalRecents === 0" class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<app-recent-edited-activity (totalCountRecentEdited)="onCountAllRecent($event)"></app-recent-edited-activity>
|
||||
<div *ngIf="totalRecents === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{'DASHBOARD.DRAFTS' | translate}} ({{this.totalDraftDatasets}})">
|
||||
<div class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<mat-tab label="{{'DASHBOARD.DRAFTS' | translate}} ({{totalDraftDatasets}})">
|
||||
<div *ngIf="totalDraftDatasets === 0" class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<app-drafts (totalCountDraftDatasets)="onCountDraftDatasets($event)"></app-drafts>
|
||||
<div *ngIf="totalDraftDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{'DASHBOARD.DMPS' | translate}} ({{this.totalDmps}})">
|
||||
<div class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<mat-tab label="{{'DASHBOARD.DMPS' | translate}} ({{totalDmps}})">
|
||||
<div *ngIf="totalDmps === 0" class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<app-recent-edited-dmp-activity (totalCountDmps)="onCountDmps($event)"></app-recent-edited-dmp-activity>
|
||||
<div *ngIf="totalDmps === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}} ({{this.totalDatasets}})">
|
||||
<div class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<mat-tab label="{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}} ({{totalDatasets}})">
|
||||
<div *ngIf="totalDatasets === 0" class="col-auto pt-3"><input type="text" class="d-flex ml-auto" placeholder="  Search"></div>
|
||||
<app-recent-edited-dataset-activity (totalCountDatasets)="onCountDatasets($event)"></app-recent-edited-dataset-activity>
|
||||
<div *ngIf="totalDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
|
||||
<div *ngIf="totalDatasets === 0" class="col-auto d-flex justify-content-center">
|
||||
<button mat-raised-button class="add-dataset" [routerLink]="['/datasets/new']">
|
||||
<mat-icon>add</mat-icon> {{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="col-auto stats">
|
||||
<div class="personal-usage">{{'DASHBOARD.PERSONAL-USAGE' | translate}}</div>
|
||||
<div [ngClass]="{'counter': dashboardStatisticsData?.totalDataManagementPlanCount != 0, 'counter-zero': dashboardStatisticsData?.totalDataManagementPlanCount == 0}">
|
||||
{{dashboardStatisticsData?.totalDataManagementPlanCount}}</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.main-content {
|
||||
background-color: #f5f5f5;
|
||||
padding-top: 3.68rem;
|
||||
padding-top: 4.68rem;
|
||||
padding-bottom: 3rem;
|
||||
// padding-left: 3.31rem;
|
||||
padding-left: 1rem;
|
||||
|
@ -303,6 +303,33 @@ input[type="text"] {
|
|||
color: #f16868;
|
||||
}
|
||||
|
||||
.stats {
|
||||
padding: 0rem 7em 4rem 3rem;
|
||||
}
|
||||
|
||||
.empty-list {
|
||||
color: #212121;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 300;
|
||||
letter-spacing: 0px;
|
||||
color: #212121;
|
||||
opacity: 0.6;
|
||||
display: flex;
|
||||
padding-top: 4.68rem;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.add-dataset {
|
||||
width: 142px;
|
||||
height: 40px;
|
||||
background: #f7dd72 0% 0% no-repeat padding-box;
|
||||
box-shadow: 0px 3px 6px #1e202029;
|
||||
border-radius: 30px;
|
||||
opacity: 1;
|
||||
margin-top: 2.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
::ng-deep .mat-tab-group.mat-primary .mat-ink-bar,
|
||||
.mat-tab-nav-bar.mat-primary .mat-ink-bar {
|
||||
background: #129d99;
|
||||
|
|
|
@ -56,6 +56,7 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
|
|||
totalDatasets: number;
|
||||
totalDmps: number;
|
||||
totalDraftDatasets: number;
|
||||
totalRecents: number;
|
||||
|
||||
|
||||
constructor(
|
||||
|
@ -202,6 +203,10 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.totalDraftDatasets = event;
|
||||
}
|
||||
|
||||
onCountAllRecent(event): void {
|
||||
this.totalRecents = event;
|
||||
}
|
||||
|
||||
// viewAllPublicDmpsClicked() {
|
||||
// this.router.navigate(['/explore-plans']);
|
||||
// }
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div *ngIf="datasetDrafts && datasetDrafts.length > 0" class="d-flex justify-content-center">
|
||||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ export class DraftsComponent extends BaseComponent implements OnInit {
|
|||
this.datasetService.getPaged(dmpDataTableRequest).subscribe(response => {
|
||||
this.datasetDrafts = response.data;
|
||||
this.totalCount = response.totalCount;
|
||||
this.totalCountDraftDatasets.emit(this.totalCount);
|
||||
this.totalCountDraftDatasets.emit(this.pageSize);
|
||||
// this.totalCountDraftDatasets.emit(this.totalCount);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -247,5 +248,6 @@ export class DraftsComponent extends BaseComponent implements OnInit {
|
|||
this.datasetDrafts = this.datasetDrafts.concat(result.data);
|
||||
});
|
||||
this.startIndex = this.startIndex + this.pageSize;
|
||||
this.totalCountDraftDatasets.emit(this.startIndex + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<div *ngIf="dmpActivities != null">
|
||||
<div *ngFor="let activity of dmpActivities">
|
||||
<!-- if dmp -->
|
||||
<div *ngIf="allRecentActivities != null">
|
||||
<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">
|
||||
<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>
|
||||
<div class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ activity.modified | date: "longDate" }}</div>
|
||||
</div>
|
||||
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{activity.label}}</div>
|
||||
<div class="col-auto" [ngClass]="{'dmp-title': !isDraft, 'dmp-title-draft': isDraft}">{{activity.title}}</div>
|
||||
<div class="dmp-subtitle">
|
||||
<span class="col-auto">{{ roleDisplay(activity.users) }}</span>
|
||||
<span>.</span>
|
||||
|
@ -19,20 +19,20 @@
|
|||
<span>.</span>
|
||||
<span class="col">{{ 'DMP-LISTING.GRANT' | translate }}: {{activity.grant}}</span>
|
||||
</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{activity.datasets.length}})
|
||||
<div class="col-auto dmp-dataset-descriptions-title">{{'DMP-LISTING.CONTAINED-DATASETS' | translate}}: ({{ getDatasets(activity).length }})
|
||||
</div>
|
||||
<div *ngFor="let dataset of activity.datasets; let i = index; let last = last" [ngClass]="{'pb-3': i === activity.datasets.length - 1}">
|
||||
<div *ngFor="let dataset of getDatasets(activity); let i = index; let last = last" [ngClass]="{'pb-3': i === activity.datasets.length - 1}">
|
||||
<div *ngIf="i < 3">
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last">{{dataset.label}},</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last">{{dataset.label}}</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last && i !== 2">{{dataset.label}},</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
|
||||
</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>
|
||||
<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>
|
||||
<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(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" (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" (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" (click)="cloneClicked(activity)"><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,10 +56,10 @@
|
|||
</button>
|
||||
</mat-menu>
|
||||
<mat-menu #actionsMenu="matMenu" xPosition="before">
|
||||
<button *ngIf="isUserOwner(activity)" mat-menu-item (click)="newVersion(activity.id, activity.label)">
|
||||
<button *ngIf="isUserOwner(activity)" mat-menu-item (click)="newVersion(activity.id, activity.title)">
|
||||
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="viewVersions(activity.groupId, activity.label)">
|
||||
<button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title)">
|
||||
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item *ngIf="isDraftDmp(activity) && isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
|
||||
|
@ -68,39 +68,72 @@
|
|||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button type="button" class="btn-load-more">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- if dataset -->
|
||||
<!-- <div *ngIf="true" class="dataset-card">
|
||||
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset.valueOf()">
|
||||
<div class="dataset-card">
|
||||
<div>
|
||||
<!-- <div [routerLink]="['../datasets/overview/' + activity.id]"> -->
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto dataset-label">Dataset Description</div>
|
||||
<div class="col-auto ml-auto edited-date">Edited: 9 May 2020</div>
|
||||
<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>
|
||||
</div>
|
||||
<div class="col-auto dataset-title">Dataset description: Horizon 2020 for Grant DMP of
|
||||
Dataset description</div>
|
||||
<div class="col-auto dataset-title">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}: {{activity.title}}</div>
|
||||
<div class="dataset-subtitle">
|
||||
<span class="col-auto">Owner</span>
|
||||
<span class="col-auto">{{ roleDisplay(activity.users) }}</span>
|
||||
<span>.</span>
|
||||
<span class="col-auto"><span class="material-icons icon-align">done</span>Finalized</span>
|
||||
<span class="col-auto" *ngIf="activity.status === 1 && activity.public === true"><span class="material-icons icon-align">public</span>{{'DATASET-LISTING.STATES.PUBLIC' | translate}}</span>
|
||||
<span *ngIf="activity.status === 1 && activity.public === false" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
|
||||
<span *ngIf="activity.status === 0" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDmpStatusString(activity.status) }}</span>
|
||||
<span>.</span>
|
||||
<span class="col-auto">Grant: NEANIAS Project</span>
|
||||
<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">Part of</div>
|
||||
<div class="col-auto dmp-label">DMP</div>
|
||||
<div class="col-auto dmp-title">DMP for: Horizon 2020 for Grant DMP of the NEANIAS
|
||||
DMP plan</div>
|
||||
<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>
|
||||
<!-- <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>
|
||||
</div>
|
||||
<div class="dataset-card-actions">
|
||||
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">open_in_new</span>Export</a>
|
||||
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">group_add</span>Invite
|
||||
collaborators</a>
|
||||
<a href="#" class="col-auto"><span class="material-icons icon-align pl-2">more_horiz</span></a>
|
||||
<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>
|
||||
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
|
||||
<!-- <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)" 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">
|
||||
<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);">
|
||||
<mat-icon>update</mat-icon>
|
||||
{{ 'DATASET-WIZARD.ACTIONS.UPDATE-DATASET-PROFILE' | translate }}
|
||||
</button> -->
|
||||
</mat-menu>
|
||||
|
||||
<mat-menu #exportMenu="matMenu" xPosition="before">
|
||||
<button mat-menu-item (click)="downloadPDF(activity)">
|
||||
<i class="fa fa-file-pdf-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="downloadDOCX(activity)">
|
||||
<i class="fa fa-file-word-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="downloadXML(activity)">
|
||||
<i class="fa fa-file-code-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="allRecentActivities && allRecentActivities.length > 0" class="d-flex justify-content-center">
|
||||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<!-- Old version of dashboard -->
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { Router } from '@angular/router';
|
||||
import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
|
||||
|
@ -20,6 +20,15 @@ import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
|||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
||||
import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing';
|
||||
import { Role } from '@app/core/common/enum/role';
|
||||
import { RecentActivityModel } from '@app/core/model/recent-activity/recent-activity.model';
|
||||
import { DashboardService } from '@app/core/services/dashboard/dashboard.service';
|
||||
import { RecentActivityCriteria } from '@app/core/query/recent-activity/recent-activity-criteria';
|
||||
import { RecentDmpModel } from '@app/core/model/recent-activity/recent-dmp-activity.model';
|
||||
import { RecentDatasetModel } from '@app/core/model/recent-activity/recent-dataset-activity.model';
|
||||
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
|
||||
import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-recent-edited-activity',
|
||||
|
@ -27,21 +36,26 @@ import { Role } from '@app/core/common/enum/role';
|
|||
styleUrls: ['./recent-edited-activity.component.css']
|
||||
})
|
||||
export class RecentEditedActivityComponent extends BaseComponent implements OnInit {
|
||||
dmpActivities: DmpListingModel[];
|
||||
datasetActivities: DatasetListingModel[];
|
||||
// allRecentActivities: RecentActivity[] = [];
|
||||
|
||||
@Output() totalCountRecentEdited: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
allRecentActivities:RecentActivityModel[];
|
||||
recentActivityTypeEnum = RecentActivityType;
|
||||
isDraft: boolean;
|
||||
totalCount: number;
|
||||
startIndex: number = 4;
|
||||
pageSize: number = 5;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
public enumUtils: EnumUtils,
|
||||
private authentication: AuthService,
|
||||
private dmpService: DmpService,
|
||||
private datasetService: DatasetService,
|
||||
private dashboardService: DashboardService,
|
||||
private language: TranslateService,
|
||||
private dialog: MatDialog,
|
||||
private uiNotificationService: UiNotificationService
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private datasetWizardService: DatasetWizardService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -49,40 +63,42 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
ngOnInit() {
|
||||
if (this.isAuthenticated()) {
|
||||
const fields: Array<string> = ["-modified"];
|
||||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, 5, { fields: fields });
|
||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||
dmpDataTableRequest.criteria.like = "";
|
||||
this.dmpService
|
||||
.getPaged(dmpDataTableRequest, "listing")
|
||||
const allDataTableRequest: DataTableRequest<RecentActivityCriteria> = new DataTableRequest(0, 5, { fields: fields });
|
||||
allDataTableRequest.criteria = new RecentActivityCriteria();
|
||||
allDataTableRequest.criteria.like = "";
|
||||
this.dashboardService
|
||||
.getRecentActivity(allDataTableRequest)
|
||||
.subscribe(response => {
|
||||
this.dmpActivities = response.data;
|
||||
// this.dmpActivities.forEach(dmpActivity => {
|
||||
// const recentActivity: RecentActivity = {
|
||||
// activityData: dmpActivity,
|
||||
// activityType: RecentActivityType.Dmp
|
||||
// };
|
||||
// this.allRecentActivities.push(recentActivity)
|
||||
// })
|
||||
this.allRecentActivities = response;
|
||||
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// const datasetDataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, 5, { fields: fields });
|
||||
// datasetDataTableRequest.criteria = new DatasetCriteria();
|
||||
// datasetDataTableRequest.criteria.like = "";
|
||||
// this.datasetService
|
||||
// .getPaged(datasetDataTableRequest)
|
||||
// .subscribe(response => {
|
||||
// this.datasetActivities = response.data;
|
||||
// this.datasetActivities.forEach(datasetActivity => {
|
||||
// const recentActivity: RecentActivity = {
|
||||
// activityData: datasetActivity,
|
||||
// activityType: RecentActivityType.Dataset
|
||||
// };
|
||||
// this.allRecentActivities.push(recentActivity)
|
||||
// })
|
||||
// });
|
||||
getDatasets(activity: RecentDmpModel): RecentDatasetModel[] {
|
||||
return activity.datasets;
|
||||
}
|
||||
|
||||
getGroupId(activity: RecentDmpModel): string {
|
||||
return activity.groupId;
|
||||
}
|
||||
|
||||
getDmp(activity: RecentDatasetModel): String {
|
||||
return activity.dmp;
|
||||
}
|
||||
|
||||
getDmpId(activity: RecentDatasetModel): String {
|
||||
return activity.dmpId;
|
||||
}
|
||||
|
||||
// getPublic(activity: RecentDmpModel): boolean {
|
||||
// return activity.isPublic;
|
||||
// }
|
||||
|
||||
// getUsers(activity: RecentDmpModel): UserInfoListingModel[] {
|
||||
// return activity.users;
|
||||
// }
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
return !!this.authentication.current();
|
||||
}
|
||||
|
@ -278,6 +294,91 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
}
|
||||
|
||||
openDmpSearchDialogue(dataset: RecentDatasetModel) {
|
||||
const formControl = new FormControl();
|
||||
const dialogRef = this.dialog.open(DatasetCopyDialogueComponent, {
|
||||
width: '500px',
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
formControl: formControl,
|
||||
datasetId: dataset.id,
|
||||
datasetProfileId: dataset.profile,
|
||||
datasetProfileExist: false,
|
||||
confirmButton: this.language.instant('DATASET-WIZARD.DIALOGUE.COPY'),
|
||||
cancelButton: this.language.instant('DATASET-WIZARD.DIALOGUE.CANCEL')
|
||||
}
|
||||
});
|
||||
|
||||
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 } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openConfirm(id: string): void {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
maxWidth: '300px',
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
||||
isDeleteConfirmation: true
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
this.datasetWizardService.delete(id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
// error => this.onCallbackError(error)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
downloadDOCX(dataset: RecentDatasetModel): void {
|
||||
this.datasetWizardService.downloadDOCX(dataset.id as string)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(response => {
|
||||
const blob = new Blob([response.body], { type: 'application/msword' });
|
||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||
|
||||
FileSaver.saveAs(blob, filename);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
downloadXML(dataset: RecentDatasetModel): void {
|
||||
this.datasetWizardService.downloadXML(dataset.id as string)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(response => {
|
||||
const blob = new Blob([response.body], { type: 'application/xml' });
|
||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||
|
||||
FileSaver.saveAs(blob, filename);
|
||||
});
|
||||
}
|
||||
|
||||
public loadMore() {
|
||||
const fields: Array<string> = ["-modified"];
|
||||
const request = new DataTableRequest<RecentActivityCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
request.criteria = new RecentActivityCriteria();
|
||||
request.criteria.like = "";
|
||||
|
||||
this.dashboardService.getRecentActivity(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (!result) { return []; }
|
||||
this.allRecentActivities = this.allRecentActivities.concat(result);
|
||||
});
|
||||
this.startIndex = this.startIndex + this.pageSize;
|
||||
|
||||
this.totalCountRecentEdited.emit(this.startIndex + 1);
|
||||
}
|
||||
|
||||
// advancedClicked(dmp: DmpListingModel) {
|
||||
// const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
|
||||
// maxWidth: '500px',
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div *ngIf="datasetActivities && datasetActivities.length > 0" class="d-flex justify-content-center">
|
||||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -61,7 +61,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
|||
.subscribe(response => {
|
||||
this.datasetActivities = response.data;
|
||||
this.totalCount = response.totalCount;
|
||||
this.totalCountDatasets.emit(this.totalCount);
|
||||
this.totalCountDatasets.emit(this.pageSize);
|
||||
// this.totalCountDatasets.emit(this.totalCount);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +79,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
|||
this.datasetActivities = this.datasetActivities.concat(result.data);
|
||||
});
|
||||
this.startIndex = this.startIndex + this.pageSize;
|
||||
|
||||
this.totalCountDatasets.emit(this.startIndex + 1);
|
||||
}
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<div *ngIf="dmpActivities != null">
|
||||
<div *ngFor="let activity of dmpActivities">
|
||||
<!-- if dmp -->
|
||||
<div class="dmp-card">
|
||||
<div [routerLink]="['../plans/overview/' + activity.id]" class="pointer">
|
||||
<div class="d-flex flex-direction-row">
|
||||
|
@ -23,8 +22,8 @@
|
|||
</div>
|
||||
<div *ngFor="let dataset of activity.datasets; let i = index; let last = last" [ngClass]="{'pb-3': i === activity.datasets.length - 1}">
|
||||
<div *ngIf="i < 3">
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last">{{dataset.label}},</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last">{{dataset.label}}</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="!last && i !== 2">{{dataset.label}},</div>
|
||||
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{dataset.label}}</div>
|
||||
</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>
|
||||
|
@ -68,141 +67,7 @@
|
|||
</mat-menu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div *ngIf="dmpActivities && dmpActivities.length > 0" class="d-flex justify-content-center">
|
||||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- if dataset -->
|
||||
<!-- <div *ngIf="true" class="dataset-card">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto dataset-label">Dataset Description</div>
|
||||
<div class="col-auto ml-auto edited-date">Edited: 9 May 2020</div>
|
||||
</div>
|
||||
<div class="col-auto dataset-title">Dataset description: Horizon 2020 for Grant DMP of
|
||||
Dataset description</div>
|
||||
<div class="dataset-subtitle">
|
||||
<span class="col-auto">Owner</span>
|
||||
<span>.</span>
|
||||
<span class="col-auto"><span class="material-icons icon-align">done</span>Finalized</span>
|
||||
<span>.</span>
|
||||
<span class="col-auto">Grant: NEANIAS Project</span>
|
||||
</div>
|
||||
<div class="d-flex flex-direction-row pt-3 pb-3">
|
||||
<div class="col-auto dataset-subtitle">Part of</div>
|
||||
<div class="col-auto dmp-label">DMP</div>
|
||||
<div class="col-auto dmp-title">DMP for: Horizon 2020 for Grant DMP of the NEANIAS
|
||||
DMP plan</div>
|
||||
</div>
|
||||
<div class="dataset-card-actions">
|
||||
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">open_in_new</span>Export</a>
|
||||
<a href="#" class="col-auto border-right"><span class="material-icons icon-align pr-2">group_add</span>Invite
|
||||
collaborators</a>
|
||||
<a href="#" class="col-auto"><span class="material-icons icon-align pl-2">more_horiz</span></a>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
<!-- Old version of dashboard -->
|
||||
<!-- <div class="card">
|
||||
<div class="card-header card-header-plain">
|
||||
<div class="card-desc">
|
||||
<h4 class="card-title">
|
||||
{{ 'RECENT-ACTIVITY.LAST-EDITED-DMP' | translate}}
|
||||
</h4>
|
||||
</div>
|
||||
<a class="view-all" [class.clickable]="isAuthenticated()" [routerLink]="['/plans/']">
|
||||
{{ 'GENERAL.ACTIONS.VIEW-ALL' | translate}}</a>
|
||||
</div>
|
||||
<div class="card-body table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead class="text-default">
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.NAME' | translate}}</th>
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.TEMPLATE' | translate }}</th>
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.GRANT' | translate }}</th>
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}</th>
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.ORGANIZATION' | translate }}</th>
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.STATUS' | translate }}</th>
|
||||
<th>{{ 'DATASET-PROFILE-LISTING.COLUMNS.EDITED' | translate }}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody *ngIf="dmpActivities != null">
|
||||
<a *ngFor="let activity of dmpActivities" class="table-row" [routerLink]="['../plans/overview/' + activity.id]">
|
||||
<td>{{ activity.label }}</td>
|
||||
<td>
|
||||
<div *ngIf="activity.profile" matTooltip="{{ activity.profile }}" class="template-name">
|
||||
{{ activity.profile }}
|
||||
</div>
|
||||
<div *ngIf="!(activity.profile)" class="template-name">--</div>
|
||||
</td>
|
||||
<td>{{ activity.grant }}</td>
|
||||
<td>{{ roleDisplay(activity.users)}}</td>
|
||||
<td>{{ activity.organisations }}</td>
|
||||
<td *ngIf="activity.status === 1 && activity.public === true">
|
||||
<div class="is-public">
|
||||
{{'TYPES.DMP-VISIBILITY.PUBLIC' | translate}}
|
||||
</div>
|
||||
</td>
|
||||
<td *ngIf="activity.status === 1 && activity.public === false" class="text-center">
|
||||
{{ enumUtils.toDmpStatusString(activity.status) }}
|
||||
</td>
|
||||
<td *ngIf="activity.status === 0" class="text-center">
|
||||
{{ enumUtils.toDmpStatusString(activity.status) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ activity.modifiedTime | date: "shortDate" }}
|
||||
</td>
|
||||
<td>
|
||||
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon" (click)="$event.preventDefault(); $event.stopPropagation();">
|
||||
<mat-icon class="more-horiz">more_horiz</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button mat-menu-item (click)="editClicked(activity)" class="menu-item">
|
||||
<mat-icon>edit</mat-icon>{{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
|
||||
</button>
|
||||
<button mat-menu-item (click)="cloneClicked(activity)" class="menu-item">
|
||||
<mat-icon>add</mat-icon>{{ 'DMP-LISTING.ACTIONS.CLONE' | translate }}
|
||||
</button>
|
||||
<button mat-menu-item (click)="deleteClicked(activity)" class="menu-item">
|
||||
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
|
||||
</button>
|
||||
<button mat-menu-item [matMenuTriggerFor]="exportMethod" class="menu-item">
|
||||
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.EXP-AS' | translate }}
|
||||
</button>
|
||||
</mat-menu>
|
||||
<mat-menu #exportMethod>
|
||||
<button mat-menu-item (click)="downloadPDF(activity.id)">
|
||||
<i class="fa fa-file-pdf-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="downloadDocx(activity.id)">
|
||||
<i class="fa fa-file-word-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="downloadXml(activity.id)">
|
||||
<i class="fa fa-file-code-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="downloadJson(activity.id)">
|
||||
<i class="fa fa-file-o pr-2"></i>
|
||||
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</td>
|
||||
</a>
|
||||
</tbody>
|
||||
<tbody *ngIf="dmpActivities == null">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> -->
|
||||
|
|
|
@ -64,7 +64,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
|||
.subscribe(response => {
|
||||
this.dmpActivities = response.data;
|
||||
this.totalCount = response.totalCount;
|
||||
this.totalCountDmps.emit(this.totalCount);
|
||||
this.totalCountDmps.emit(this.pageSize);
|
||||
// this.totalCountDmps.emit(this.totalCount);
|
||||
// this.dmpActivities.forEach(dmpActivity => {
|
||||
// const recentActivity: RecentActivity = {
|
||||
// activityData: dmpActivity,
|
||||
|
@ -299,6 +300,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
|||
this.dmpActivities = this.dmpActivities.concat(result.data);
|
||||
});
|
||||
this.startIndex = this.startIndex + this.pageSize;
|
||||
|
||||
this.totalCountDmps.emit(this.startIndex + 1);
|
||||
}
|
||||
|
||||
// advancedClicked(dmp: DmpListingModel) {
|
||||
|
|
|
@ -61,7 +61,7 @@ export class DatasetCopyDialogueComponent {
|
|||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||
dmpDataTableRequest.criteria.like = query;
|
||||
return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete").pipe(map(x => x.data), map(x => x.filter(y => this.existsDatasetDescriptionTemplate(y.associatedProfiles))));
|
||||
return this.dmpService.getPaged(dmpDataTableRequest, "profiles").pipe(map(x => x.data), map(x => x.filter(y => this.existsDatasetDescriptionTemplate(y.associatedProfiles))));
|
||||
}
|
||||
|
||||
existsDatasetDescriptionTemplate(associatedProfiles: DmpAssociatedProfileModel[]): boolean {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" *ngIf="showUri">
|
||||
<mat-form-field class="col-sm-12 col-md-6">
|
||||
<input matInput placeholder="{{'DATASET-EDITOR.FIELDS.URI' | translate}}" type="text" name="uri" formControlName="uri">
|
||||
<mat-error *ngIf="formGroup.get('uri').hasError('backendError')">{{formGroup.get('uri').getError('backendError').message}}</mat-error>
|
||||
|
|
|
@ -11,6 +11,7 @@ import { BaseComponent } from '@common/base/base.component';
|
|||
export class DatasetEditorComponent extends BaseComponent {
|
||||
|
||||
@Input() formGroup: FormGroup = null;
|
||||
showUri: boolean = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
|
|
@ -63,7 +63,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
initialItems: (type) => this.searchDatasetExternalDataRepositories('', type),
|
||||
displayFn: (item) => item ? item.name : null,
|
||||
titleFn: (item) => item ? item.name : null,
|
||||
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
|
||||
subtitleFn: (item) => item.source ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.source : item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')
|
||||
};
|
||||
|
||||
servicesAutoCompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||
|
|
|
@ -232,17 +232,21 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
|||
const fields: Array<string> = new Array<string>();
|
||||
fields.push('asc');
|
||||
|
||||
if (this.isPublic) {
|
||||
const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
|
||||
dmpDataTableRequest.criteria = new ExploreDmpCriteriaModel();
|
||||
dmpDataTableRequest.criteria.like = value;
|
||||
return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete");
|
||||
} else {
|
||||
// if (this.isPublic) {
|
||||
// const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
|
||||
// dmpDataTableRequest.criteria = new ExploreDmpCriteriaModel();
|
||||
// dmpDataTableRequest.criteria.like = value;
|
||||
// return this.dmpService.getPublicPaged(dmpDataTableRequest, "autocomplete");
|
||||
// } else {
|
||||
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||
dmpDataTableRequest.criteria = new DmpCriteria();
|
||||
dmpDataTableRequest.criteria.like = value;
|
||||
return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete");
|
||||
if (this.isPublic) {
|
||||
dmpDataTableRequest.criteria.isPublic = true;
|
||||
dmpDataTableRequest.criteria.onlyPublic = true;
|
||||
}
|
||||
return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete");
|
||||
// }
|
||||
}
|
||||
|
||||
filterGrant(query: string) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||
import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -60,6 +61,7 @@ export class DmpCloneComponent extends BaseComponent implements OnInit {
|
|||
this.dmp.grant = new GrantTabModel();
|
||||
this.dmp.project = new ProjectFormModel();
|
||||
this.dmp.funder = new FunderFormModel();
|
||||
this.dmp.extraProperties = new ExtraPropertiesFormModel();
|
||||
this.dmp.fromModel(data);
|
||||
this.dmp.status = DmpStatus.Draft;
|
||||
this.formGroup = this.dmp.buildForm();
|
||||
|
|
|
@ -21,6 +21,7 @@ import { BackendErrorValidator } from '@common/forms/validation/custom-validator
|
|||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { ValidationContext } from '@common/forms/validation/validation-context';
|
||||
import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model';
|
||||
import { isNullOrUndefined } from 'util';
|
||||
|
||||
export class DmpEditorModel {
|
||||
public id: string;
|
||||
|
@ -71,7 +72,9 @@ export class DmpEditorModel {
|
|||
if (item.dynamicFields) { item.dynamicFields.map(x => this.dynamicFields.push(new DmpDynamicFieldEditorModel().fromModel(x))); }
|
||||
this.creator = item.creator;
|
||||
this.modified = new Date(item.modified);
|
||||
if (!isNullOrUndefined(item.extraProperties)) {
|
||||
this.extraProperties.fromModel(item.extraProperties);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,15 @@ import { BackendErrorValidator } from '@common/forms/validation/custom-validator
|
|||
|
||||
export class ExtraPropertiesFormModel {
|
||||
public language: string;
|
||||
public license: string;
|
||||
public visible: boolean;
|
||||
public publicDate: Date;
|
||||
|
||||
fromModel(item: any): ExtraPropertiesFormModel {
|
||||
this.language = item.language;
|
||||
this.license = item.license;
|
||||
this.visible = item.visible;
|
||||
this.publicDate = item.publicDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -14,7 +20,10 @@ export class ExtraPropertiesFormModel {
|
|||
if (context == null) { context = this.createValidationContext(); }
|
||||
|
||||
const formGroup = new FormBuilder().group({
|
||||
language: [{ value: this.language, disabled: disabled }, context.getValidation('language').validators]
|
||||
language: [{ value: this.language, disabled: disabled }, context.getValidation('language').validators],
|
||||
license: [{ value: this.license, disabled: disabled }, context.getValidation('license').validators],
|
||||
visible: [{ value: this.visible, disabled: disabled }, context.getValidation('visible').validators],
|
||||
publicDate: [{ value: this.publicDate, disabled: disabled }, context.getValidation('publicDate').validators]
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
@ -22,6 +31,9 @@ export class ExtraPropertiesFormModel {
|
|||
createValidationContext(): ValidationContext {
|
||||
const baseContext: ValidationContext = new ValidationContext();
|
||||
baseContext.validation.push({ key: 'language', validators: [] });
|
||||
baseContext.validation.push({ key: 'license', validators: [] });
|
||||
baseContext.validation.push({ key: 'visible', validators: [] });
|
||||
baseContext.validation.push({ key: 'publicDate', validators: [] });
|
||||
return baseContext;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<mat-form-field class="col-sm-12 col-md-8">
|
||||
<!-- <app-multiple-auto-complete [formControl]="formGroup.get('extraProperties').get('language')" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}" [configuration]="researchersAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete> -->
|
||||
<mat-select [formControl]="formGroup.get('extraProperties').get('language')">
|
||||
<mat-select [formControl]="formGroup.get('extraProperties').get('language')" placeholder="{{'DMP-EDITOR.FIELDS.LANGUAGE' | translate}}">
|
||||
<mat-option *ngFor="let lang of getLanguageInfos()" [value]="lang.code">
|
||||
{{ lang.name }}
|
||||
</mat-option>
|
||||
|
@ -81,6 +81,49 @@
|
|||
</mat-form-field>
|
||||
<!-- <h4 mat-subheader class="col-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h4> -->
|
||||
</div>
|
||||
<div class="row pt-3">
|
||||
<mat-form-field class="col-sm-12 col-md-8">
|
||||
<!-- <app-multiple-auto-complete [formControl]="formGroup.get('extraProperties').get('language')" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}" [configuration]="researchersAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete> -->
|
||||
<app-single-auto-complete [formControl]="formGroup.get('extraProperties').get('license')" placeholder="{{'DMP-EDITOR.FIELDS.LICENSE' | translate}}" [configuration]="licenseAutoCompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="formGroup.get('extraProperties').get('license').hasError('backendError')">
|
||||
{{formGroup.get('extraProperties').get('language').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('extraProperties').get('license').hasError('required')">
|
||||
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <h4 mat-subheader class="col-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h4> -->
|
||||
</div>
|
||||
<div class="row pt-3">
|
||||
<mat-form-field class="col-sm-12 col-md-8">
|
||||
<!-- <app-multiple-auto-complete [formControl]="formGroup.get('extraProperties').get('language')" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}" [configuration]="researchersAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete> -->
|
||||
<mat-select [formControl]="formGroup.get('extraProperties').get('visible')" placeholder="{{'DMP-EDITOR.FIELDS.VISIBILITY' | translate}}">
|
||||
<mat-option *ngFor="let vis of visibles" [value]="vis.value">
|
||||
{{vis.name | translate}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="formGroup.get('extraProperties').get('visible').hasError('backendError')">
|
||||
{{formGroup.get('extraProperties').get('visible').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('extraProperties').get('visible').hasError('required')">
|
||||
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <h4 mat-subheader class="col-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h4> -->
|
||||
</div>
|
||||
<div class="row pt-3" *ngIf="formGroup.get('extraProperties').get('visible').value">
|
||||
<mat-form-field class="col-sm-12 col-md-8">
|
||||
<!-- <app-multiple-auto-complete [formControl]="formGroup.get('extraProperties').get('language')" placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}" [configuration]="researchersAutoCompleteConfiguration">
|
||||
</app-multiple-auto-complete> -->
|
||||
<input matInput [matDatepicker]="picker" [formControl]="formGroup.get('extraProperties').get('publicDate')" placeholder="{{'DMP-EDITOR.FIELDS.PUBLICATION' | translate}}">
|
||||
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #picker></mat-datepicker>
|
||||
<mat-error *ngIf="formGroup.get('extraProperties').get('visible').hasError('backendError')">
|
||||
{{formGroup.get('extraProperties').get('visible').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('extraProperties').get('visible').hasError('required')">
|
||||
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <h4 mat-subheader class="col-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h4> -->
|
||||
</div>
|
||||
<div class="row pt-2">
|
||||
<mat-form-field class="col-sm-12 col-md-8">
|
||||
<app-single-auto-complete [required]="false" [formControl]="formGroup.get('profile')" placeholder="{{'DMP-EDITOR.FIELDS.TEMPLATE' | translate}}" [configuration]="dmpProfileAutoCompleteConfiguration">
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue