From 791f2fee61704c59ef61fadc722c29ba81653a39 Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Thu, 25 Jun 2020 13:00:29 +0300 Subject: [PATCH 1/4] Add currency field type for dataset templates --- .../java/eu/eudat/cache/ResponsesCache.java | 1 + .../eudat/controllers/CurrencyController.java | 31 + .../logic/managers/LocalFetchManager.java | 28 + .../logic/proxy/fetching/LocalFetcher.java | 99 + .../logic/proxy/fetching/entities/Config.java | 21 + .../proxy/fetching/entities/ConfigSingle.java | 71 + .../fetching/entities/CurrencyModel.java | 21 + .../entities/CurrencySingleModel.java | 53 + .../utilities/builders/ModelBuilder.java | 2 + .../commons/datafield/CurrencyData.java | 42 + .../models/data/local/LocalFetchModel.java | 27 + .../main/resources/internal/fetchConfig.xml | 13 + .../src/main/resources/internal/iso-4217.xml | 1949 +++++++++++++++++ .../enum/dataset-profile-field-view-style.ts | 3 +- .../src/app/core/core-service.module.ts | 2 + .../field-data/field-data.ts | 4 + .../model/local-fetch/local-fetch.model.ts | 4 + .../services/currency/currency.service.ts | 21 + .../currency/currency.service.ts | 19 + .../services/utilities/enum-utils.service.ts | 1 + .../field-data/currency-data-editor-models.ts | 19 + .../admin/field-editor-model.ts | 2 + .../dataset-profile/dataset-profile.module.ts | 4 +- ...ofile-editor-currency-field.component.html | 9 + ...ofile-editor-currency-field.component.scss | 3 + ...profile-editor-currency-field.component.ts | 18 + ...ataset-profile-editor-field.component.html | 2 + .../dataset-profile-editor-field.component.ts | 5 + .../form-field/form-field.component.html | 12 + .../form-field/form-field.component.ts | 19 +- dmp-frontend/src/assets/i18n/en.json | 3 +- dmp-frontend/src/assets/i18n/es.json | 3 +- dmp-frontend/src/assets/i18n/gr.json | 5 +- 33 files changed, 2509 insertions(+), 7 deletions(-) create mode 100644 dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/LocalFetcher.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/Config.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/ConfigSingle.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencyModel.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencySingleModel.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CurrencyData.java create mode 100644 dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java create mode 100644 dmp-backend/web/src/main/resources/internal/fetchConfig.xml create mode 100644 dmp-backend/web/src/main/resources/internal/iso-4217.xml create mode 100644 dmp-frontend/src/app/core/model/local-fetch/local-fetch.model.ts create mode 100644 dmp-frontend/src/app/core/services/currency/currency.service.ts create mode 100644 dmp-frontend/src/app/core/services/external-sources/currency/currency.service.ts create mode 100644 dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/currency-data-editor-models.ts create mode 100644 dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.html create mode 100644 dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.scss create mode 100644 dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.ts diff --git a/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java b/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java index c87d616ab..4a5858bde 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java +++ b/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java @@ -40,6 +40,7 @@ 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())); simpleCacheManager.setCaches(caches); logger.info("OK"); return simpleCacheManager; diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java new file mode 100644 index 000000000..e562eadfb --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/CurrencyController.java @@ -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>> getCurrencies( @RequestParam(value = "query", required = false) String query) throws Exception { + List currencies = localFetchManager.getCurrency(query); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(currencies)); + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java new file mode 100644 index 000000000..fa135debe --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/LocalFetchManager.java @@ -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 getCurrency(String query) throws Exception { + List> data = localFetcher.retrieveCurrency(); + List 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; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/LocalFetcher.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/LocalFetcher.java new file mode 100644 index 000000000..5562f1f89 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/LocalFetcher.java @@ -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> 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> retrieveData(ConfigSingle configSingle) throws Exception { + List> 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> 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 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"); + } + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/Config.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/Config.java new file mode 100644 index 000000000..1f9e8494d --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/Config.java @@ -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 configs; + + @XmlElementWrapper + @XmlElement(name = "config") + public List getConfigs() { + return configs; + } + public void setConfigs(List configs) { + this.configs = configs; + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/ConfigSingle.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/ConfigSingle.java new file mode 100644 index 000000000..022cfec23 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/ConfigSingle.java @@ -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; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencyModel.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencyModel.java new file mode 100644 index 000000000..af8c02d8b --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencyModel.java @@ -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 currencies; + + @XmlElementWrapper(name = "CcyTbl") + @XmlElement(name = "CcyNtry") + public List getCurrencies() { + return currencies; + } + public void setCurrencies(List currencies) { + this.currencies = currencies; + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencySingleModel.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencySingleModel.java new file mode 100644 index 000000000..2259c902c --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/entities/CurrencySingleModel.java @@ -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; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java index fe0ede1e3..5b8bea223 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java @@ -93,6 +93,7 @@ public class ModelBuilder { if (type.equals("researchers")) return (FieldData) new ResearcherData().fromData(data); if (type.equals("organizations")) return (FieldData) new OrganizationsData().fromData(data); if (type.equals("datasetIdentifier")) return (FieldData) new DatasetIdentifierData().fromData(data); + if (type.equals("currency")) return (FieldData) new CurrencyData().fromData(data); return null; } @@ -130,6 +131,7 @@ public class ModelBuilder { if (type.equals("researchers")) return (FieldData) new ResearcherData().fromData(data); if (type.equals("organizations")) return (FieldData) new OrganizationsData().fromData(data); if (type.equals("datasetIdentifier")) return (FieldData) new DatasetIdentifierData().fromData(data); + if (type.equals("currency")) return (FieldData) new CurrencyData().fromData(data); return null; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CurrencyData.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CurrencyData.java new file mode 100644 index 000000000..2bf7ca475 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/CurrencyData.java @@ -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 { + @Override + public CurrencyData fromData(Object data) { + if (data != null) { + this.setLabel((String) ((Map) 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 toMap(Element item) { + HashMap dataMap = new HashMap(); + dataMap.put("label", item != null ? item.getAttribute("label") : ""); + return dataMap; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java new file mode 100644 index 000000000..279971632 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/local/LocalFetchModel.java @@ -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; + } +} diff --git a/dmp-backend/web/src/main/resources/internal/fetchConfig.xml b/dmp-backend/web/src/main/resources/internal/fetchConfig.xml new file mode 100644 index 000000000..523058553 --- /dev/null +++ b/dmp-backend/web/src/main/resources/internal/fetchConfig.xml @@ -0,0 +1,13 @@ + + + + currency + xml + internal/iso-4217.xml + eu.eudat.logic.proxy.fetching.entities.CurrencyModel + currencies + currency + code + + + \ No newline at end of file diff --git a/dmp-backend/web/src/main/resources/internal/iso-4217.xml b/dmp-backend/web/src/main/resources/internal/iso-4217.xml new file mode 100644 index 000000000..5ba6f6bfb --- /dev/null +++ b/dmp-backend/web/src/main/resources/internal/iso-4217.xml @@ -0,0 +1,1949 @@ + + + + + AFGHANISTAN + Afghani + AFN + 971 + 2 + + + ÅLAND ISLANDS + Euro + EUR + 978 + 2 + + + ALBANIA + Lek + ALL + 008 + 2 + + + ALGERIA + Algerian Dinar + DZD + 012 + 2 + + + AMERICAN SAMOA + US Dollar + USD + 840 + 2 + + + ANDORRA + Euro + EUR + 978 + 2 + + + ANGOLA + Kwanza + AOA + 973 + 2 + + + ANGUILLA + East Caribbean Dollar + XCD + 951 + 2 + + + ANTARCTICA + No universal currency + + + ANTIGUA AND BARBUDA + East Caribbean Dollar + XCD + 951 + 2 + + + ARGENTINA + Argentine Peso + ARS + 032 + 2 + + + ARMENIA + Armenian Dram + AMD + 051 + 2 + + + ARUBA + Aruban Florin + AWG + 533 + 2 + + + AUSTRALIA + Australian Dollar + AUD + 036 + 2 + + + AUSTRIA + Euro + EUR + 978 + 2 + + + AZERBAIJAN + Azerbaijan Manat + AZN + 944 + 2 + + + BAHAMAS (THE) + Bahamian Dollar + BSD + 044 + 2 + + + BAHRAIN + Bahraini Dinar + BHD + 048 + 3 + + + BANGLADESH + Taka + BDT + 050 + 2 + + + BARBADOS + Barbados Dollar + BBD + 052 + 2 + + + BELARUS + Belarusian Ruble + BYN + 933 + 2 + + + BELGIUM + Euro + EUR + 978 + 2 + + + BELIZE + Belize Dollar + BZD + 084 + 2 + + + BENIN + CFA Franc BCEAO + XOF + 952 + 0 + + + BERMUDA + Bermudian Dollar + BMD + 060 + 2 + + + BHUTAN + Indian Rupee + INR + 356 + 2 + + + BHUTAN + Ngultrum + BTN + 064 + 2 + + + BOLIVIA (PLURINATIONAL STATE OF) + Boliviano + BOB + 068 + 2 + + + BOLIVIA (PLURINATIONAL STATE OF) + Mvdol + BOV + 984 + 2 + + + BONAIRE, SINT EUSTATIUS AND SABA + US Dollar + USD + 840 + 2 + + + BOSNIA AND HERZEGOVINA + Convertible Mark + BAM + 977 + 2 + + + BOTSWANA + Pula + BWP + 072 + 2 + + + BOUVET ISLAND + Norwegian Krone + NOK + 578 + 2 + + + BRAZIL + Brazilian Real + BRL + 986 + 2 + + + BRITISH INDIAN OCEAN TERRITORY (THE) + US Dollar + USD + 840 + 2 + + + BRUNEI DARUSSALAM + Brunei Dollar + BND + 096 + 2 + + + BULGARIA + Bulgarian Lev + BGN + 975 + 2 + + + BURKINA FASO + CFA Franc BCEAO + XOF + 952 + 0 + + + BURUNDI + Burundi Franc + BIF + 108 + 0 + + + CABO VERDE + Cabo Verde Escudo + CVE + 132 + 2 + + + CAMBODIA + Riel + KHR + 116 + 2 + + + CAMEROON + CFA Franc BEAC + XAF + 950 + 0 + + + CANADA + Canadian Dollar + CAD + 124 + 2 + + + CAYMAN ISLANDS (THE) + Cayman Islands Dollar + KYD + 136 + 2 + + + CENTRAL AFRICAN REPUBLIC (THE) + CFA Franc BEAC + XAF + 950 + 0 + + + CHAD + CFA Franc BEAC + XAF + 950 + 0 + + + CHILE + Chilean Peso + CLP + 152 + 0 + + + CHILE + Unidad de Fomento + CLF + 990 + 4 + + + CHINA + Yuan Renminbi + CNY + 156 + 2 + + + CHRISTMAS ISLAND + Australian Dollar + AUD + 036 + 2 + + + COCOS (KEELING) ISLANDS (THE) + Australian Dollar + AUD + 036 + 2 + + + COLOMBIA + Colombian Peso + COP + 170 + 2 + + + COLOMBIA + Unidad de Valor Real + COU + 970 + 2 + + + COMOROS (THE) + Comorian Franc + KMF + 174 + 0 + + + CONGO (THE DEMOCRATIC REPUBLIC OF THE) + Congolese Franc + CDF + 976 + 2 + + + CONGO (THE) + CFA Franc BEAC + XAF + 950 + 0 + + + COOK ISLANDS (THE) + New Zealand Dollar + NZD + 554 + 2 + + + COSTA RICA + Costa Rican Colon + CRC + 188 + 2 + + + CÔTE D'IVOIRE + CFA Franc BCEAO + XOF + 952 + 0 + + + CROATIA + Kuna + HRK + 191 + 2 + + + CUBA + Cuban Peso + CUP + 192 + 2 + + + CUBA + Peso Convertible + CUC + 931 + 2 + + + CURAÇAO + Netherlands Antillean Guilder + ANG + 532 + 2 + + + CYPRUS + Euro + EUR + 978 + 2 + + + CZECHIA + Czech Koruna + CZK + 203 + 2 + + + DENMARK + Danish Krone + DKK + 208 + 2 + + + DJIBOUTI + Djibouti Franc + DJF + 262 + 0 + + + DOMINICA + East Caribbean Dollar + XCD + 951 + 2 + + + DOMINICAN REPUBLIC (THE) + Dominican Peso + DOP + 214 + 2 + + + ECUADOR + US Dollar + USD + 840 + 2 + + + EGYPT + Egyptian Pound + EGP + 818 + 2 + + + EL SALVADOR + El Salvador Colon + SVC + 222 + 2 + + + EL SALVADOR + US Dollar + USD + 840 + 2 + + + EQUATORIAL GUINEA + CFA Franc BEAC + XAF + 950 + 0 + + + ERITREA + Nakfa + ERN + 232 + 2 + + + ESTONIA + Euro + EUR + 978 + 2 + + + ESWATINI + Lilangeni + SZL + 748 + 2 + + + ETHIOPIA + Ethiopian Birr + ETB + 230 + 2 + + + EUROPEAN UNION + Euro + EUR + 978 + 2 + + + FALKLAND ISLANDS (THE) [MALVINAS] + Falkland Islands Pound + FKP + 238 + 2 + + + FAROE ISLANDS (THE) + Danish Krone + DKK + 208 + 2 + + + FIJI + Fiji Dollar + FJD + 242 + 2 + + + FINLAND + Euro + EUR + 978 + 2 + + + FRANCE + Euro + EUR + 978 + 2 + + + FRENCH GUIANA + Euro + EUR + 978 + 2 + + + FRENCH POLYNESIA + CFP Franc + XPF + 953 + 0 + + + FRENCH SOUTHERN TERRITORIES (THE) + Euro + EUR + 978 + 2 + + + GABON + CFA Franc BEAC + XAF + 950 + 0 + + + GAMBIA (THE) + Dalasi + GMD + 270 + 2 + + + GEORGIA + Lari + GEL + 981 + 2 + + + GERMANY + Euro + EUR + 978 + 2 + + + GHANA + Ghana Cedi + GHS + 936 + 2 + + + GIBRALTAR + Gibraltar Pound + GIP + 292 + 2 + + + GREECE + Euro + EUR + 978 + 2 + + + GREENLAND + Danish Krone + DKK + 208 + 2 + + + GRENADA + East Caribbean Dollar + XCD + 951 + 2 + + + GUADELOUPE + Euro + EUR + 978 + 2 + + + GUAM + US Dollar + USD + 840 + 2 + + + GUATEMALA + Quetzal + GTQ + 320 + 2 + + + GUERNSEY + Pound Sterling + GBP + 826 + 2 + + + GUINEA + Guinean Franc + GNF + 324 + 0 + + + GUINEA-BISSAU + CFA Franc BCEAO + XOF + 952 + 0 + + + GUYANA + Guyana Dollar + GYD + 328 + 2 + + + HAITI + Gourde + HTG + 332 + 2 + + + HAITI + US Dollar + USD + 840 + 2 + + + HEARD ISLAND AND McDONALD ISLANDS + Australian Dollar + AUD + 036 + 2 + + + HOLY SEE (THE) + Euro + EUR + 978 + 2 + + + HONDURAS + Lempira + HNL + 340 + 2 + + + HONG KONG + Hong Kong Dollar + HKD + 344 + 2 + + + HUNGARY + Forint + HUF + 348 + 2 + + + ICELAND + Iceland Krona + ISK + 352 + 0 + + + INDIA + Indian Rupee + INR + 356 + 2 + + + INDONESIA + Rupiah + IDR + 360 + 2 + + + INTERNATIONAL MONETARY FUND (IMF)  + SDR (Special Drawing Right) + XDR + 960 + N.A. + + + IRAN (ISLAMIC REPUBLIC OF) + Iranian Rial + IRR + 364 + 2 + + + IRAQ + Iraqi Dinar + IQD + 368 + 3 + + + IRELAND + Euro + EUR + 978 + 2 + + + ISLE OF MAN + Pound Sterling + GBP + 826 + 2 + + + ISRAEL + New Israeli Sheqel + ILS + 376 + 2 + + + ITALY + Euro + EUR + 978 + 2 + + + JAMAICA + Jamaican Dollar + JMD + 388 + 2 + + + JAPAN + Yen + JPY + 392 + 0 + + + JERSEY + Pound Sterling + GBP + 826 + 2 + + + JORDAN + Jordanian Dinar + JOD + 400 + 3 + + + KAZAKHSTAN + Tenge + KZT + 398 + 2 + + + KENYA + Kenyan Shilling + KES + 404 + 2 + + + KIRIBATI + Australian Dollar + AUD + 036 + 2 + + + KOREA (THE DEMOCRATIC PEOPLE’S REPUBLIC OF) + North Korean Won + KPW + 408 + 2 + + + KOREA (THE REPUBLIC OF) + Won + KRW + 410 + 0 + + + KUWAIT + Kuwaiti Dinar + KWD + 414 + 3 + + + KYRGYZSTAN + Som + KGS + 417 + 2 + + + LAO PEOPLE’S DEMOCRATIC REPUBLIC (THE) + Lao Kip + LAK + 418 + 2 + + + LATVIA + Euro + EUR + 978 + 2 + + + LEBANON + Lebanese Pound + LBP + 422 + 2 + + + LESOTHO + Loti + LSL + 426 + 2 + + + LESOTHO + Rand + ZAR + 710 + 2 + + + LIBERIA + Liberian Dollar + LRD + 430 + 2 + + + LIBYA + Libyan Dinar + LYD + 434 + 3 + + + LIECHTENSTEIN + Swiss Franc + CHF + 756 + 2 + + + LITHUANIA + Euro + EUR + 978 + 2 + + + LUXEMBOURG + Euro + EUR + 978 + 2 + + + MACAO + Pataca + MOP + 446 + 2 + + + MACEDONIA (THE FORMER YUGOSLAV REPUBLIC OF) + Denar + MKD + 807 + 2 + + + MADAGASCAR + Malagasy Ariary + MGA + 969 + 2 + + + MALAWI + Malawi Kwacha + MWK + 454 + 2 + + + MALAYSIA + Malaysian Ringgit + MYR + 458 + 2 + + + MALDIVES + Rufiyaa + MVR + 462 + 2 + + + MALI + CFA Franc BCEAO + XOF + 952 + 0 + + + MALTA + Euro + EUR + 978 + 2 + + + MARSHALL ISLANDS (THE) + US Dollar + USD + 840 + 2 + + + MARTINIQUE + Euro + EUR + 978 + 2 + + + MAURITANIA + Ouguiya + MRU + 929 + 2 + + + MAURITIUS + Mauritius Rupee + MUR + 480 + 2 + + + MAYOTTE + Euro + EUR + 978 + 2 + + + MEMBER COUNTRIES OF THE AFRICAN DEVELOPMENT BANK GROUP + ADB Unit of Account + XUA + 965 + N.A. + + + MEXICO + Mexican Peso + MXN + 484 + 2 + + + MEXICO + Mexican Unidad de Inversion (UDI) + MXV + 979 + 2 + + + MICRONESIA (FEDERATED STATES OF) + US Dollar + USD + 840 + 2 + + + MOLDOVA (THE REPUBLIC OF) + Moldovan Leu + MDL + 498 + 2 + + + MONACO + Euro + EUR + 978 + 2 + + + MONGOLIA + Tugrik + MNT + 496 + 2 + + + MONTENEGRO + Euro + EUR + 978 + 2 + + + MONTSERRAT + East Caribbean Dollar + XCD + 951 + 2 + + + MOROCCO + Moroccan Dirham + MAD + 504 + 2 + + + MOZAMBIQUE + Mozambique Metical + MZN + 943 + 2 + + + MYANMAR + Kyat + MMK + 104 + 2 + + + NAMIBIA + Namibia Dollar + NAD + 516 + 2 + + + NAMIBIA + Rand + ZAR + 710 + 2 + + + NAURU + Australian Dollar + AUD + 036 + 2 + + + NEPAL + Nepalese Rupee + NPR + 524 + 2 + + + NETHERLANDS (THE) + Euro + EUR + 978 + 2 + + + NEW CALEDONIA + CFP Franc + XPF + 953 + 0 + + + NEW ZEALAND + New Zealand Dollar + NZD + 554 + 2 + + + NICARAGUA + Cordoba Oro + NIO + 558 + 2 + + + NIGER (THE) + CFA Franc BCEAO + XOF + 952 + 0 + + + NIGERIA + Naira + NGN + 566 + 2 + + + NIUE + New Zealand Dollar + NZD + 554 + 2 + + + NORFOLK ISLAND + Australian Dollar + AUD + 036 + 2 + + + NORTHERN MARIANA ISLANDS (THE) + US Dollar + USD + 840 + 2 + + + NORWAY + Norwegian Krone + NOK + 578 + 2 + + + OMAN + Rial Omani + OMR + 512 + 3 + + + PAKISTAN + Pakistan Rupee + PKR + 586 + 2 + + + PALAU + US Dollar + USD + 840 + 2 + + + PALESTINE, STATE OF + No universal currency + + + PANAMA + Balboa + PAB + 590 + 2 + + + PANAMA + US Dollar + USD + 840 + 2 + + + PAPUA NEW GUINEA + Kina + PGK + 598 + 2 + + + PARAGUAY + Guarani + PYG + 600 + 0 + + + PERU + Sol + PEN + 604 + 2 + + + PHILIPPINES (THE) + Philippine Peso + PHP + 608 + 2 + + + PITCAIRN + New Zealand Dollar + NZD + 554 + 2 + + + POLAND + Zloty + PLN + 985 + 2 + + + PORTUGAL + Euro + EUR + 978 + 2 + + + PUERTO RICO + US Dollar + USD + 840 + 2 + + + QATAR + Qatari Rial + QAR + 634 + 2 + + + RÉUNION + Euro + EUR + 978 + 2 + + + ROMANIA + Romanian Leu + RON + 946 + 2 + + + RUSSIAN FEDERATION (THE) + Russian Ruble + RUB + 643 + 2 + + + RWANDA + Rwanda Franc + RWF + 646 + 0 + + + SAINT BARTHÉLEMY + Euro + EUR + 978 + 2 + + + SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA + Saint Helena Pound + SHP + 654 + 2 + + + SAINT KITTS AND NEVIS + East Caribbean Dollar + XCD + 951 + 2 + + + SAINT LUCIA + East Caribbean Dollar + XCD + 951 + 2 + + + SAINT MARTIN (FRENCH PART) + Euro + EUR + 978 + 2 + + + SAINT PIERRE AND MIQUELON + Euro + EUR + 978 + 2 + + + SAINT VINCENT AND THE GRENADINES + East Caribbean Dollar + XCD + 951 + 2 + + + SAMOA + Tala + WST + 882 + 2 + + + SAN MARINO + Euro + EUR + 978 + 2 + + + SAO TOME AND PRINCIPE + Dobra + STN + 930 + 2 + + + SAUDI ARABIA + Saudi Riyal + SAR + 682 + 2 + + + SENEGAL + CFA Franc BCEAO + XOF + 952 + 0 + + + SERBIA + Serbian Dinar + RSD + 941 + 2 + + + SEYCHELLES + Seychelles Rupee + SCR + 690 + 2 + + + SIERRA LEONE + Leone + SLL + 694 + 2 + + + SINGAPORE + Singapore Dollar + SGD + 702 + 2 + + + SINT MAARTEN (DUTCH PART) + Netherlands Antillean Guilder + ANG + 532 + 2 + + + SISTEMA UNITARIO DE COMPENSACION REGIONAL DE PAGOS "SUCRE" + Sucre + XSU + 994 + N.A. + + + SLOVAKIA + Euro + EUR + 978 + 2 + + + SLOVENIA + Euro + EUR + 978 + 2 + + + SOLOMON ISLANDS + Solomon Islands Dollar + SBD + 090 + 2 + + + SOMALIA + Somali Shilling + SOS + 706 + 2 + + + SOUTH AFRICA + Rand + ZAR + 710 + 2 + + + SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS + No universal currency + + + SOUTH SUDAN + South Sudanese Pound + SSP + 728 + 2 + + + SPAIN + Euro + EUR + 978 + 2 + + + SRI LANKA + Sri Lanka Rupee + LKR + 144 + 2 + + + SUDAN (THE) + Sudanese Pound + SDG + 938 + 2 + + + SURINAME + Surinam Dollar + SRD + 968 + 2 + + + SVALBARD AND JAN MAYEN + Norwegian Krone + NOK + 578 + 2 + + + SWEDEN + Swedish Krona + SEK + 752 + 2 + + + SWITZERLAND + Swiss Franc + CHF + 756 + 2 + + + SWITZERLAND + WIR Euro + CHE + 947 + 2 + + + SWITZERLAND + WIR Franc + CHW + 948 + 2 + + + SYRIAN ARAB REPUBLIC + Syrian Pound + SYP + 760 + 2 + + + TAIWAN (PROVINCE OF CHINA) + New Taiwan Dollar + TWD + 901 + 2 + + + TAJIKISTAN + Somoni + TJS + 972 + 2 + + + TANZANIA, UNITED REPUBLIC OF + Tanzanian Shilling + TZS + 834 + 2 + + + THAILAND + Baht + THB + 764 + 2 + + + TIMOR-LESTE + US Dollar + USD + 840 + 2 + + + TOGO + CFA Franc BCEAO + XOF + 952 + 0 + + + TOKELAU + New Zealand Dollar + NZD + 554 + 2 + + + TONGA + Pa’anga + TOP + 776 + 2 + + + TRINIDAD AND TOBAGO + Trinidad and Tobago Dollar + TTD + 780 + 2 + + + TUNISIA + Tunisian Dinar + TND + 788 + 3 + + + TURKEY + Turkish Lira + TRY + 949 + 2 + + + TURKMENISTAN + Turkmenistan New Manat + TMT + 934 + 2 + + + TURKS AND CAICOS ISLANDS (THE) + US Dollar + USD + 840 + 2 + + + TUVALU + Australian Dollar + AUD + 036 + 2 + + + UGANDA + Uganda Shilling + UGX + 800 + 0 + + + UKRAINE + Hryvnia + UAH + 980 + 2 + + + UNITED ARAB EMIRATES (THE) + UAE Dirham + AED + 784 + 2 + + + UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE) + Pound Sterling + GBP + 826 + 2 + + + UNITED STATES MINOR OUTLYING ISLANDS (THE) + US Dollar + USD + 840 + 2 + + + UNITED STATES OF AMERICA (THE) + US Dollar + USD + 840 + 2 + + + UNITED STATES OF AMERICA (THE) + US Dollar (Next day) + USN + 997 + 2 + + + URUGUAY + Peso Uruguayo + UYU + 858 + 2 + + + URUGUAY + Uruguay Peso en Unidades Indexadas (UI) + UYI + 940 + 0 + + + URUGUAY + Unidad Previsional + UYW + 927 + 4 + + + UZBEKISTAN + Uzbekistan Sum + UZS + 860 + 2 + + + VANUATU + Vatu + VUV + 548 + 0 + + + VENEZUELA (BOLIVARIAN REPUBLIC OF) + Bolívar Soberano + VES + 928 + 2 + + + VIET NAM + Dong + VND + 704 + 0 + + + VIRGIN ISLANDS (BRITISH) + US Dollar + USD + 840 + 2 + + + VIRGIN ISLANDS (U.S.) + US Dollar + USD + 840 + 2 + + + WALLIS AND FUTUNA + CFP Franc + XPF + 953 + 0 + + + WESTERN SAHARA + Moroccan Dirham + MAD + 504 + 2 + + + YEMEN + Yemeni Rial + YER + 886 + 2 + + + ZAMBIA + Zambian Kwacha + ZMW + 967 + 2 + + + ZIMBABWE + Zimbabwe Dollar + ZWL + 932 + 2 + + + ZZ01_Bond Markets Unit European_EURCO + Bond Markets Unit European Composite Unit (EURCO) + XBA + 955 + N.A. + + + ZZ02_Bond Markets Unit European_EMU-6 + Bond Markets Unit European Monetary Unit (E.M.U.-6) + XBB + 956 + N.A. + + + ZZ03_Bond Markets Unit European_EUA-9 + Bond Markets Unit European Unit of Account 9 (E.U.A.-9) + XBC + 957 + N.A. + + + ZZ04_Bond Markets Unit European_EUA-17 + Bond Markets Unit European Unit of Account 17 (E.U.A.-17) + XBD + 958 + N.A. + + + ZZ06_Testing_Code + Codes specifically reserved for testing purposes + XTS + 963 + N.A. + + + ZZ07_No_Currency + The codes assigned for transactions where no currency is involved + XXX + 999 + N.A. + + + ZZ08_Gold + Gold + XAU + 959 + N.A. + + + ZZ09_Palladium + Palladium + XPD + 964 + N.A. + + + ZZ10_Platinum + Platinum + XPT + 962 + N.A. + + + ZZ11_Silver + Silver + XAG + 961 + N.A. + + + \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts b/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts index 98716cbe5..c656787e3 100644 --- a/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts +++ b/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts @@ -14,5 +14,6 @@ export enum DatasetProfileFieldViewStyle { Tags = "tags", Researchers = "researchers", Organizations = "organizations", - DatasetIdentifier = "datasetIdentifier" + DatasetIdentifier = "datasetIdentifier", + Currency = "currency" } diff --git a/dmp-frontend/src/app/core/core-service.module.ts b/dmp-frontend/src/app/core/core-service.module.ts index f4b1ebf49..3082ad593 100644 --- a/dmp-frontend/src/app/core/core-service.module.ts +++ b/dmp-frontend/src/app/core/core-service.module.ts @@ -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, diff --git a/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts b/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts index 2ab0b4ea1..6a953e120 100644 --- a/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts +++ b/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts @@ -100,3 +100,7 @@ export interface OrganizationsFieldData extends FieldData { export interface DatasetIdentifierFieldData extends FieldData { } + +export interface CurrencyFieldData extends FieldData { + +} diff --git a/dmp-frontend/src/app/core/model/local-fetch/local-fetch.model.ts b/dmp-frontend/src/app/core/model/local-fetch/local-fetch.model.ts new file mode 100644 index 000000000..4ca43879a --- /dev/null +++ b/dmp-frontend/src/app/core/model/local-fetch/local-fetch.model.ts @@ -0,0 +1,4 @@ +export class LocalFetchModel { + name: string; + value: string; +} diff --git a/dmp-frontend/src/app/core/services/currency/currency.service.ts b/dmp-frontend/src/app/core/services/currency/currency.service.ts new file mode 100644 index 000000000..77fcf084c --- /dev/null +++ b/dmp-frontend/src/app/core/services/currency/currency.service.ts @@ -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 { + return this.http.get(`${this.actionUrl}?query=${query}`); + } + +} diff --git a/dmp-frontend/src/app/core/services/external-sources/currency/currency.service.ts b/dmp-frontend/src/app/core/services/external-sources/currency/currency.service.ts new file mode 100644 index 000000000..3ab66a2ec --- /dev/null +++ b/dmp-frontend/src/app/core/services/external-sources/currency/currency.service.ts @@ -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 { + return this.http.get(this.actionUrl); + } + +} diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index d1e9c91e7..0697372e7 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -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'); } } diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/currency-data-editor-models.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/currency-data-editor-models.ts new file mode 100644 index 000000000..07b1c67c0 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/currency-data-editor-models.ts @@ -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 { + public label: string; + + buildForm(disabled: boolean = false, skipDisable: Array = []): 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; + } +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts index 08b0eb514..fcaf00324 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts @@ -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; diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts index 20626451c..538f26e0b 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts @@ -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 diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.html new file mode 100644 index 000000000..aeb72f4ed --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.html @@ -0,0 +1,9 @@ +
+
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-DATE-PICKER-TITLE' + | translate}}
+ + + +
\ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.scss b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.scss new file mode 100644 index 000000000..3db0dee74 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.scss @@ -0,0 +1,3 @@ +.full-width { + width: 100%; +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.ts new file mode 100644 index 000000000..899757bdf --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field-type/currency/dataset-profile-editor-currency-field.component.ts @@ -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()); } + } +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html index 0151c79a6..820ba4dd6 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html @@ -25,6 +25,7 @@ {{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Researchers)}} {{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Organizations)}} {{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.DatasetIdentifier)}} + {{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Currency)}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -80,6 +81,7 @@ +

{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.RULES-TITLE' | translate}} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.ts index f32b09f49..c2added6f 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.ts @@ -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; diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html index 0e064a31e..d811889f2 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.html @@ -244,4 +244,16 @@

+ +
+
+ + + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + +
+
diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts index 20fbfec3f..1327691d5 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts @@ -32,6 +32,8 @@ import { ExternalTagEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-w import { MatChipInputEvent } from '@angular/material'; import { ENTER, COMMA } from '@angular/cdk/keycodes'; import { DatasetIdModel } from '@app/core/model/dataset/dataset-id.model'; +import { LocalFetchModel } from '@app/core/model/local-fetch/local-fetch.model'; +import { CurrencyService } from '@app/core/services/currency/currency.service'; @Component({ selector: 'app-form-field', @@ -60,6 +62,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit { tagsAutoCompleteConfiguration: SingleAutoCompleteConfiguration; researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; + currencyAutoCompleteConfiguration: SingleAutoCompleteConfiguration; readonly separatorKeysCodes: number[] = [ENTER, COMMA]; @@ -81,7 +84,8 @@ export class FormFieldComponent extends BaseComponent implements OnInit { private externalSourcesService: ExternalSourcesService, private language: TranslateService, private datasetService: DatasetService, - private dmpService: DmpService + private dmpService: DmpService, + private currencyService: CurrencyService ) { super(); } ngOnInit() { @@ -183,6 +187,15 @@ export class FormFieldComponent extends BaseComponent implements OnInit { this.form.addControl('value', new DatasetIdModel(value).buildForm()); this.datasetIdInitialized = true; break; + case DatasetProfileFieldViewStyle.Currency: + this.currencyAutoCompleteConfiguration = { + filterFn: this.searchCurrency.bind(this), + initialItems: () => this.searchCurrency(''), + displayFn: (item) => typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name, + titleFn: (item) => typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name, + valueAssign: (item) => typeof (item) == 'string' ? item : JSON.stringify(item) + }; + break; } if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.InternalDmpEntities) { @@ -347,4 +360,8 @@ export class FormFieldComponent extends BaseComponent implements OnInit { getDatasetIdControl(name: string): FormControl { return this.form.get('value').get(name) as FormControl; } + + searchCurrency(query: string): Observable { + return this.currencyService.get(query); + } } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index e73477672..f408a394a 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -942,7 +942,8 @@ "TAGS": "Tags", "RESEARCHERS": "Researchers", "ORGANIZATIONS": "Organizations", - "DATASET-IDENTIFIER": "Dataset Identifier" + "DATASET-IDENTIFIER": "Dataset Identifier", + "CURRENCY": "Currency" }, "DATASET-PROFILE-COMBO-BOX-TYPE": { "WORD-LIST": "Word List", diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index eb1574916..2e1d8c0f1 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -942,7 +942,8 @@ "TAGS": "Tags", "RESEARCHERS": "Researchers", "ORGANIZATIONS": "Organizations", - "DATASET-IDENTIFIER": "Dataset Identifier" + "DATASET-IDENTIFIER": "Dataset Identifier", + "CURRENCY": "Currency" }, "DATASET-PROFILE-COMBO-BOX-TYPE": { "WORD-LIST": "Lista de palabras", diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index 6e1877f71..80c841ff7 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -62,7 +62,7 @@ "DELETE": "Διαγραφή", "REMOVE": "Αφαίρεση", "CANCEL": "Ακύρωση", - "LEAVE": "Αναχώρηση", + "LEAVE": "Αποχώρηση", "POLICY-AGREE": "Κάντε τα ονόματα ορατά στο κοινό.", "REQUIRED": "Απαιτείται να κάνετε κλικ στο πλαίσιο ελέγχου." } @@ -942,7 +942,8 @@ "TAGS": "Tags", "RESEARCHERS": "Researchers", "ORGANIZATIONS": "Organizations", - "DATASET-IDENTIFIER": "Dataset Identifier" + "DATASET-IDENTIFIER": "Dataset Identifier", + "CURRENCY": "Currency" }, "DATASET-PROFILE-COMBO-BOX-TYPE": { "WORD-LIST": "Λίστα Λέξεων", From 55d3feb4e32b141ae4eb21c8fc42ee9e2a7ba69d Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Thu, 25 Jun 2020 13:30:47 +0300 Subject: [PATCH 2/4] Fixed minor issues with RDA Mapping --- .../managers/DataManagementPlanManager.java | 4 ++- .../eu/eudat/logic/managers/RDAManager.java | 28 +++---------------- .../eudat/logic/mapper/elastic/DmpMapper.java | 2 +- .../models/rda/mapper/DatasetRDAMapper.java | 28 ++++++++++--------- .../eudat/models/rda/mapper/DmpRDAMapper.java | 4 ++- 5 files changed, 26 insertions(+), 40 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index f9a8499ca..acb51508e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -1404,7 +1404,9 @@ public class DataManagementPlanManager { } databaseRepository.getDmpDao().createOrUpdate(dmp); assignUser(dmp, me); - this.updateIndex(dmp); + 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()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java index 4145a094f..242a365c9 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/RDAManager.java @@ -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; - } - } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DmpMapper.java b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DmpMapper.java index 5a25990f1..956af3b5b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DmpMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/elastic/DmpMapper.java @@ -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 tags = null; try { Dataset dataset1 = apiContext.getOperationsContext().getElasticRepository().getDatasetRepository().findDocument(dataset.getId().toString()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java index e235de3ba..082a67fbe 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DatasetRDAMapper.java @@ -217,20 +217,22 @@ public class DatasetRDAMapper { properties.putAll(DistributionRDAMapper.toProperties(rda.getDistribution().get(0), datasetDescriptionObj)); } - List 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()) { - takeAll = true; - } - for (int i = 0; i < keywordIds.size(); i++) { - if (takeAll) { - List tags = new ArrayList<>(); - for (String keyword: rda.getKeyword()) { - tags.add(mapper.writeValueAsString(toTagEntity(keyword))); + if (rda.getKeyword() != null) { + List 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()) { + takeAll = true; + } + for (int i = 0; i < keywordIds.size(); i++) { + if (takeAll) { + List tags = new ArrayList<>(); + for (String keyword : rda.getKeyword()) { + tags.add(mapper.writeValueAsString(toTagEntity(keyword))); + } + properties.put(keywordIds.get(i), tags); + } else { + properties.put(keywordIds.get(i), mapper.writeValueAsString(toTagEntity(rda.getKeyword().get(i)))); } - properties.put(keywordIds.get(i), tags); - } else { - properties.put(keywordIds.get(i), mapper.writeValueAsString(toTagEntity(rda.getKeyword().get(i)))); } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java index a4350b53a..a64649c86 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/rda/mapper/DmpRDAMapper.java @@ -42,7 +42,9 @@ public class DmpRDAMapper { rda.setTitle(dmp.getLabel()); Map extraProperties = new org.json.JSONObject(dmp.getExtraProperties()).toMap(); - rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(extraProperties.get("language").toString())); + if (!extraProperties.isEmpty()) { + rda.setLanguage(LanguageRDAMapper.mapLanguageIsoToRDAIso(extraProperties.get("language").toString())); + } UserInfo creator; if (dmp.getCreator() != null) { From 92fe11b18b839881629feaafddfab758e783e4e9 Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Thu, 25 Jun 2020 13:35:17 +0300 Subject: [PATCH 3/4] When logging in remove the cookie consent popup --- dmp-frontend/src/app/core/services/auth/auth.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/core/services/auth/auth.service.ts b/dmp-frontend/src/app/core/services/auth/auth.service.ts index 9b61514c4..af4604994 100644 --- a/dmp-frontend/src/app/core/services/auth/auth.service.ts +++ b/dmp-frontend/src/app/core/services/auth/auth.service.ts @@ -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; }), From 2e5faf5c0580b2d5944167b39f2722889582790d Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Thu, 25 Jun 2020 14:05:19 +0300 Subject: [PATCH 4/4] Hide Uri field on Dataset Editor (ref #275) --- .../dataset-wizard/dataset-editor/dataset-editor.component.html | 2 +- .../dataset-wizard/dataset-editor/dataset-editor.component.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.html index 299133f87..b698833ae 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.html @@ -8,7 +8,7 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} -
+
{{formGroup.get('uri').getError('backendError').message}} diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts index d2cad6024..725fda5c7 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts @@ -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,