From a5061759b812fc8d99d35bcbc35584490ea6bb33 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 20 Apr 2022 18:25:55 +0300 Subject: [PATCH 1/5] #7665: Save and Previous buttons updated on the Dataset Template (Admin). 1. dmp-editor.component.html & dmp-clone.component.html & dataset-wizard.component.html: On next button, moved chevron_right icon to the right side of the text. 2. dataset-profile-editor.component.scss: a. Removed margin-top from .dataset-profile-editor. b. Updated position and styling of .scroll-on-top. c. Added .floating-btn and .progress-min-height. 3. dataset-profile-editor.component.ts: a. Set showScrollOnTopButton default value to true and comment intersection stepperNavigationObserver (because title is sticky now and always visible). b. In method "onSubmit()" added parameter close:boolean=false, to check if the router will navigate to "/dataset-profiles" or not (button "save and continue" added). 4. dataset-profile-editor.component.html: a. Renamed "Back" button to "Close" and use DATASET-WIZARD.ACTIONS.CLOSE. b. Moved "Close", "Save"/"Update" and "Finalize" buttons aligned with title on the top right. c. Made title with aligned buttons sticky to top with stepper. d. Moved buttons "Previous"/"Next" on the down right of viewport (floating buttons). e. Moved scroll button and update it. f. Updated alignment of main content when there is no sidebar on the left. 5. i18n/: In language files added "DATASET-WIZARD.ACTIONS.CLOSE" and updated "USER-PROFILE.MERGING-EMAILS-DIALOG.TITLE" (#7662). --- .../dataset-profile-editor.component.html | 273 +++++++++--------- .../dataset-profile-editor.component.scss | 28 +- .../dataset-profile-editor.component.ts | 74 ++--- .../dataset-wizard.component.html | 4 +- .../app/ui/dmp/clone/dmp-clone.component.html | 2 +- .../ui/dmp/editor/dmp-editor.component.html | 2 +- dmp-frontend/src/assets/i18n/de.json | 3 +- dmp-frontend/src/assets/i18n/en.json | 3 +- dmp-frontend/src/assets/i18n/es.json | 3 +- dmp-frontend/src/assets/i18n/gr.json | 3 +- dmp-frontend/src/assets/i18n/hr.json | 3 +- dmp-frontend/src/assets/i18n/pt.json | 3 +- dmp-frontend/src/assets/i18n/sk.json | 3 +- dmp-frontend/src/assets/i18n/sr.json | 3 +- dmp-frontend/src/assets/i18n/tr.json | 3 +- 15 files changed, 227 insertions(+), 183 deletions(-) diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html index ce01fa401..fb1665453 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html @@ -7,122 +7,98 @@ +
+
+
-
-
+
+

{{'DATASET-PROFILE-EDITOR.TITLE.NEW-PROFILE' | translate}}

+

+ {{'DATASET-PROFILE-EDITOR.TITLE.NEW-PROFILE-CLONE' | translate}} + {{form.get('label').value}} +

+

+ {{'DATASET-PROFILE-EDITOR.TITLE.NEW-PROFILE-VERSION' | translate}} + {{form.get('label').value}} +

-
-

{{'DATASET-PROFILE-EDITOR.TITLE.NEW-PROFILE' | translate}}

-

- {{'DATASET-PROFILE-EDITOR.TITLE.NEW-PROFILE-CLONE' | translate}} - {{form.get('label').value}} -

-

- {{'DATASET-PROFILE-EDITOR.TITLE.NEW-PROFILE-VERSION' | translate}} - {{form.get('label').value}} -

+

{{form.get('label').value}}

+
+ -

{{form.get('label').value}}

+ +
- -
-
-
+
- -
-
-
-
-
-
- - - done - - - {{idx+1}} - - {{step.label}} - + +
+
+ + + + + + +
+
+
+
+ + + done + + + {{idx+1}} + + {{step.label}} + +
+
+ + + + + + + +
- -
- - - - - - - - - -
-
-
- -
@@ -134,12 +110,7 @@ -
-
- - - -
+
1.1 {{'DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-NAME'| translate}} *
@@ -267,10 +238,6 @@ (dataNeedsRefresh)="onDataNeedsRefresh($event)" [colorizeInvalid]="colorizeInvalid"> - - - -
@@ -281,7 +248,7 @@
-
+
@@ -370,17 +337,13 @@ -
-
- - - - -
+
+
+
@@ -441,13 +404,37 @@ --> -
- -
+ + + + + + + + + + + arrow_upward + +
SCROLL
+
+ + +
+ + +
+
+ +
+
+
3.2 {{'DMP-EDITOR.FIELDS.VISIBILITY' | translate}}
+
{{'DMP-EDITOR.FIELDS.VISIBILITY-HINT' | translate}}
+
+ + + + {{vis.name | translate}} + + + + {{formGroup.get('extraProperties').get('visible').getError('backendError').message}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+
+ +
+
+
3.3 {{'DMP-EDITOR.FIELDS.PUBLICATION' | translate}}*
+ +
+ + + + + + {{formGroup.get('extraProperties').get('publicDate').getError('backendError').message}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+
-
-
-
1.3 {{'DMP-EDITOR.FIELDS.LANGUAGE' | translate}}*
-
{{'DMP-EDITOR.FIELDS.LANGUAGE-HINT' | translate}}
-
- - - - {{ lang.name }} - - - - {{formGroup.get('extraProperties').get('language').getError('backendError').message}} - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
-
- -
-
-
1.4 {{'DMP-EDITOR.FIELDS.VISIBILITY' | translate}}
-
{{'DMP-EDITOR.FIELDS.VISIBILITY-HINT' | translate}}
-
- - - - {{vis.name | translate}} - - - - {{formGroup.get('extraProperties').get('visible').getError('backendError').message}} - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
-
-
1.5 {{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}
+
1.3 {{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}
{{'DMP-EDITOR.FIELDS.RESEARCHERS-HINT' | translate}}
info {{'DMP-EDITOR.MAIN-INFO.TYPING' | translate}}
@@ -102,7 +62,7 @@
-
1.6 {{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}
+
1.4 {{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}
{{'DMP-EDITOR.FIELDS.ORGANISATIONS-HINT' | translate}}
info {{'DMP-EDITOR.MAIN-INFO.TYPING' | translate}}
@@ -126,10 +86,30 @@
+ +
+
+
1.5 {{'DMP-EDITOR.FIELDS.LANGUAGE' | translate}}*
+
{{'DMP-EDITOR.FIELDS.LANGUAGE-HINT' | translate}}
+
+ + + + {{ lang.name }} + + + + {{formGroup.get('extraProperties').get('language').getError('backendError').message}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+
-
1.7 {{'DMP-EDITOR.FIELDS.CONTACT' | translate}}*
+
1.6 {{'DMP-EDITOR.FIELDS.CONTACT' | translate}}*
@@ -146,23 +126,5 @@
- -
-
-
1.8 {{'DMP-EDITOR.FIELDS.PUBLICATION' | translate}}*
- -
- - - - - - {{formGroup.get('extraProperties').get('publicDate').getError('backendError').message}} - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
-
diff --git a/dmp-frontend/src/app/ui/dmp/editor/main-info/main-info.component.ts b/dmp-frontend/src/app/ui/dmp/editor/main-info/main-info.component.ts index 56fedce6f..1beaec367 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/main-info/main-info.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/main-info/main-info.component.ts @@ -25,11 +25,6 @@ import { AuthService } from '@app/core/services/auth/auth.service'; import { Principal } from '@app/core/model/auth/principal'; import { OrganisationService } from '@app/core/services/organisation/organisation.service'; -interface Visible { - value: boolean; - name: string; -} - @Component({ selector: 'main-info', templateUrl: './main-info.component.html', @@ -45,10 +40,6 @@ export class MainInfoComponent extends BaseComponent implements OnInit { @Output() onFormChanged: EventEmitter = new EventEmitter(); public formControl = new FormControl(); - visibles: Visible[] = [ - { value: true, name: 'DMP-EDITOR.VISIBILITY.PUBLIC' }, - { value: false, name: 'DMP-EDITOR.VISIBILITY.RESTRICTED' } - ] private associates: UserModel[] = []; diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 75a060cd2..9030a30c2 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -1033,8 +1033,8 @@ "LANGUAGE": "Language", "LANGUAGE-HINT": "Select the language of your DMP", "LICENSE": "License", - "VISIBILITY": "Visibility", - "VISIBILITY-HINT": "Choose how the DMP is displayed in Argos. By choosing Public, the DMP is automatically made available to all users from the “Public DMPs” collection.", + "VISIBILITY": "Access Rights", + "VISIBILITY-HINT": "Choose how the DMP is displayed after is published on Zenodo. By choosing Open Access, the DMP will be open on Zenodo after the Publication Date. By choosing Restricted Access, the DMP will be restricted after the publication is made.", "PUBLICATION": "Publication Date", "CONTACT": "Contact", "COST": "Costs", @@ -1072,16 +1072,16 @@ "OK": "OK" }, "VISIBILITY": { - "PUBLIC": "Public", - "RESTRICTED": "Restricted" + "PUBLIC": "Open Access", + "RESTRICTED": "Restricted Access" }, "STEPPER": { "USER-GUIDE": "Guide steps", "MAIN-INFO": "Main info", - "FUNDING-INFO": "Funding info", + "FUNDING-INFO": "Funding", "DATASET-SELECTION": "Dataset selection", "DATASET-INFO": "Dataset info", - "LICENSE-INFO": "License info", + "LICENSE-INFO": "License", "DATASET": "Dataset", "PREVIOUS": "Previous", "NEXT": "Next" From cfd0707f2a387d24069ef8d23dcb53601cf44268 Mon Sep 17 00:00:00 2001 From: Aldo Mihasi Date: Wed, 4 May 2022 11:11:25 +0300 Subject: [PATCH 5/5] bug fix: license api-fields didnt get prefilled --- .../logic/managers/PrefillingManager.java | 6 +++-- .../mapper/prefilling/PrefillingMapper.java | 23 +++++++++++++++---- .../resources/externalUrls/ExternalUrls.xml | 3 --- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java index f80e40064..81d5fe3e0 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PrefillingManager.java @@ -28,13 +28,15 @@ public class PrefillingManager { private final ConfigLoader configLoader; private final ObjectMapper objectMapper; private final DatasetManager datasetManager; + private final LicenseManager licenseManager; @Autowired - public PrefillingManager(ApiContext apiContext, ConfigLoader configLoader, DatasetManager datasetManager) { + public PrefillingManager(ApiContext apiContext, ConfigLoader configLoader, DatasetManager datasetManager, LicenseManager licenseManager) { this.apiContext = apiContext; this.configLoader = configLoader; this.objectMapper = new ObjectMapper(); this.datasetManager = datasetManager; + this.licenseManager = licenseManager; } public List getPrefillings(String like, String configId) { @@ -50,7 +52,7 @@ public class PrefillingManager { PrefillingGet prefillingGet = prefillingConfig.getPrefillingGet(); Map prefillingEntity = getSingle(prefillingGet.getUrl(), prefillId); DatasetProfile datasetProfile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(profileId); - return PrefillingMapper.mapPrefilledEntityToDatasetWizard(prefillingEntity, prefillingGet, prefillingConfig.getType(), datasetProfile, datasetManager); + return PrefillingMapper.mapPrefilledEntityToDatasetWizard(prefillingEntity, prefillingGet, prefillingConfig.getType(), datasetProfile, datasetManager, licenseManager); } private Map getSingle(String url, String id) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java index b869320e9..4dc311f74 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/mapper/prefilling/PrefillingMapper.java @@ -9,10 +9,13 @@ import eu.eudat.data.entities.DatasetProfile; import eu.eudat.elastic.entities.Tag; import eu.eudat.logic.managers.DatasetManager; import eu.eudat.logic.managers.DatasetProfileManager; +import eu.eudat.logic.managers.LicenseManager; import eu.eudat.logic.proxy.config.entities.DefaultPrefillingMapping; import eu.eudat.logic.proxy.config.entities.PrefillingFixedMapping; import eu.eudat.logic.proxy.config.entities.PrefillingGet; import eu.eudat.logic.proxy.config.entities.PrefillingMapping; +import eu.eudat.logic.proxy.config.exceptions.HugeResultSet; +import eu.eudat.logic.proxy.config.exceptions.NoURLFound; import eu.eudat.logic.utilities.helpers.StreamDistinctBy; import eu.eudat.logic.utilities.json.JsonSearcher; import eu.eudat.models.data.components.commons.datafield.AutoCompleteData; @@ -20,6 +23,7 @@ import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel; import eu.eudat.models.data.datasetprofile.RenderStyle; import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel; +import eu.eudat.models.data.license.LicenseModel; import org.json.JSONObject; import java.lang.reflect.InvocationTargetException; @@ -33,7 +37,7 @@ public class PrefillingMapper { private static final ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); public static DatasetWizardModel mapPrefilledEntityToDatasetWizard(Map prefilledEntity, PrefillingGet prefillingGet, String type, - DatasetProfile profile, DatasetManager datasetManager) throws Exception { + DatasetProfile profile, DatasetManager datasetManager, LicenseManager licenseManager) throws Exception { DatasetWizardModel datasetWizardModel = new DatasetWizardModel(); datasetWizardModel.setProfile(new DatasetProfileOverviewModel().fromDataModel(profile)); Dataset dataset = new Dataset(); @@ -50,17 +54,17 @@ public class PrefillingMapper { sourceValue = ((Map)sourceValue).get(sourceKey); } } - setValue(prefillingMapping, mapper.writeValueAsString(sourceValue), datasetWizardModel, parentNode, properties, type); + setValue(prefillingMapping, mapper.writeValueAsString(sourceValue), datasetWizardModel, parentNode, properties, type, licenseManager); } for (PrefillingFixedMapping fixedMapping: prefillingGet.getFixedMappings()) { - setValue(fixedMapping, fixedMapping.getValue(), datasetWizardModel, parentNode, properties, type); + setValue(fixedMapping, fixedMapping.getValue(), datasetWizardModel, parentNode, properties, type, licenseManager); } dataset.setProperties(mapper.writeValueAsString(properties)); datasetWizardModel.setDatasetProfileDefinition(datasetManager.getPagedProfile(datasetWizardModel, dataset)); return datasetWizardModel; } - private static void setValue(PrefillingMapping prefillingMapping, String value, DatasetWizardModel datasetWizardModel, JsonNode parentNode, Map properties, String type) throws InvocationTargetException, IllegalAccessException, JsonProcessingException { + private static void setValue(PrefillingMapping prefillingMapping, String value, DatasetWizardModel datasetWizardModel, JsonNode parentNode, Map properties, String type, LicenseManager licenseManager) throws InvocationTargetException, IllegalAccessException, JsonProcessingException { String trimRegex = prefillingMapping.getTrimRegex() != null ? prefillingMapping.getTrimRegex() : ""; if (!value.startsWith("\"") && !value.startsWith("[") && !value.equals("null")) { value = "\"" + value + "\""; @@ -158,6 +162,17 @@ public class PrefillingMapper { } properties.put(id, datasetID.toString()); break; + case LICENSES: + try { + List licenses = licenseManager.getLicenses("", ""); + String finalParsedValue = parsedValue; + licenses = licenses.stream().filter(license -> license.getPid().equals(finalParsedValue)).collect(Collectors.toList()); + properties.put(id, licenses); + } + catch (NoURLFound | HugeResultSet e){ + properties.put(id, parsedValue); + } + break; default: if (!parsedValues.isEmpty()) properties.put(id, String.join(", ", parsedValues)); diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml index 6a9a9c6be..b8917c5ab 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml @@ -1214,9 +1214,6 @@ but not - - -