diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java index ad7297163..374fb5681 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/dao/entities/ResearcherDaoImpl.java @@ -24,11 +24,11 @@ public class ResearcherDaoImpl extends DatabaseAccess implements Res public QueryableList getWithCriteria(ResearcherCriteria criteria) { QueryableList query = asQueryable(); if (criteria.getLike() != null && !criteria.getLike().isEmpty()) - query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("reference")), "%" + criteria.getLike().toUpperCase() + "%"))); + query.where((builder, root) ->builder.or(builder.like(builder.lower(root.get("reference")), "%" + criteria.getLike().toLowerCase() + "%"))); if (criteria.getName() != null && !criteria.getName().isEmpty()) - query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("label")), "%" + criteria.getName().toUpperCase() + "%"))); + query.where((builder, root) ->builder.or(builder.like(builder.lower(root.get("label")), "%" + criteria.getName().toLowerCase() + "%"))); if (criteria.getReference() != null && !criteria.getReference().isEmpty()) - query.where((builder, root) ->builder.or(builder.like(builder.upper(root.get("reference")), criteria.getReference().toUpperCase()))); + query.where((builder, root) ->builder.or(builder.like(root.get("reference"), criteria.getReference()))); return query; } diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java index cd3bb937e..bb08a574e 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/Content.java @@ -13,7 +13,7 @@ import java.util.UUID; */ @Entity @Table(name = "\"Content\"") -public class Content implements DataEntity { +public class Content implements DataEntity { //IGNORE ME public enum ParentType { GRANT(0); 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 a53facf81..dbf63563c 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 @@ -673,7 +673,7 @@ public class DataManagementPlanManager { if (newDmp.getResearchers() != null && !newDmp.getResearchers().isEmpty()) { for (eu.eudat.data.entities.Researcher researcher : newDmp.getResearchers()) { ResearcherCriteria criteria = new ResearcherCriteria(); - criteria.setLike(researcher.getReference()); + criteria.setReference(researcher.getReference()); List entries = researcherRepository.getWithCriteria(criteria).toList(); if (entries != null && !entries.isEmpty()) researcher.setId(entries.get(0).getId()); else { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java index e164b9092..65809a4e7 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java @@ -673,9 +673,18 @@ public class DatasetManager { datasetProfileValidators.add(node.getNodeValue()); } + JSONObject obj = new JSONObject(dataset.getProperties()); + VisibilityRuleService visibilityRuleService = this.apiContext.getUtilitiesService().getVisibilityRuleService(); + visibilityRuleService.setProperties(obj.toMap()); + + dataset.setProfile(profile); + PagedDatasetProfile pagedDatasetProfile = this.getPagedProfile(new DatasetWizardModel(), dataset); + visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules()); + + for (String validator : datasetProfileValidators) { - if (obj.getString(validator) == null || obj.getString(validator).trim().isEmpty()) { + if ((obj.getString(validator) == null || obj.getString(validator).trim().isEmpty()) && visibilityRuleService.isElementVisible(validator)) { throw new Exception("Field value of " + validator + " must be filled."); } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/InvitationsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/InvitationsManager.java index 21d131df3..25a660855 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/InvitationsManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/InvitationsManager.java @@ -83,7 +83,7 @@ public class InvitationsManager { eu.eudat.data.entities.Invitation invitation = apiContext.getOperationsContext().getDatabaseRepository().getInvitationDao().find(invitationID); if (invitation == null) throw new UnauthorisedException("There is no Data Management Plan assigned to this Link"); - if (invitation.getAcceptedInvitation()) throw new UnauthorisedException("This Url Has Expired"); + if (invitation.getAcceptedInvitation()) return invitation.getDmp().getId(); //throw new UnauthorisedException("This Url Has Expired"); JAXBContext context = JAXBContext.newInstance(Properties.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Properties properties = (Properties) unmarshaller.unmarshal(new StringReader(invitation.getProperties())); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java index c8c28cfbd..353171093 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/MetricsManager.java @@ -110,7 +110,7 @@ public class MetricsManager { calculateValue("argos_managed_dataset_descriptions", (int) datasetManager.countAllPublic(), "published"); calculateValue("argos_managed_dataset_descriptions", (int) datasetManager.countAllWithDoi(), "doied"); - calculateValue("argos_dataset_templates", (int) datasetProfileManager.countAlldraft(), "total"); + calculateValue("argos_dataset_templates", (int) datasetProfileManager.countAlldraft(), "draft"); calculateValue("argos_dataset_templates", (int) datasetProfileManager.countAllFinalized(), "active"); calculateValue("argos_dataset_templates", (int) datasetProfileManager.countAllUsed(), "used"); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java index 0d9104056..3a7a13568 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ResearcherManager.java @@ -49,6 +49,7 @@ public class ResearcherManager { QueryableList items = apiContext.getOperationsContext().getDatabaseRepository().getResearcherDao().getWithCriteria(researcherCriteriaRequest.getCriteria()); items.where((builder, root) -> builder.equal(root.get("creationUser").get("id"), principal.getId())); List researchers = items.select(item -> new eu.eudat.models.data.dmp.Researcher().fromDataModel(item)); + researchers = researchers.stream().filter(item -> item.getKey().equals("Internal")).collect(Collectors.toList()); Map keyToSourceMap = configLoader.getKeyToSourceMap(); for (eu.eudat.models.data.dmp.Researcher item : researchers) { if (item.getKey().equals("Internal")) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java index f13da5c5d..41675e624 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java @@ -135,34 +135,35 @@ public class WordBuilder { private void createPages(List datasetProfilePages, XWPFDocument mainDocumentPart, Boolean createListing, VisibilityRuleService visibilityRuleService) { datasetProfilePages.forEach(item -> { try { - createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService); + createSections(item.getSections(), mainDocumentPart, ParagraphStyle.HEADER4, 0, createListing, visibilityRuleService, item.getOrdinal() + 1, null); } catch (Exception e) { logger.error(e.getMessage(), e); } }); } - private void createSections(List
sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) { + private void createSections(List
sections, XWPFDocument mainDocumentPart, ParagraphStyle style, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String sectionString) { if (createListing) this.addListing(mainDocumentPart, indent, false, true); sections.forEach(section -> { + String tempSectionString = sectionString != null ? sectionString + "." + (section.getOrdinal() + 1) : "" + (section.getOrdinal() + 1); if (visibilityRuleService.isElementVisible(section.getId())) { if (!createListing) { - XWPFParagraph paragraph = addParagraphContent(section.getNumbering() + " " + section.getTitle(), mainDocumentPart, style, numId); + XWPFParagraph paragraph = addParagraphContent(page + "." + tempSectionString + " " + section.getTitle(), mainDocumentPart, style, numId); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); number.setVal(BigInteger.valueOf(indent)); } - createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 1, createListing, visibilityRuleService); - createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService); + createSections(section.getSections(), mainDocumentPart, ParagraphStyle.HEADER5, 1, createListing, visibilityRuleService, page, tempSectionString); + createCompositeFields(section.getCompositeFields(), mainDocumentPart, 2, createListing, visibilityRuleService, page, tempSectionString); } }); } - private void createCompositeFields(List
compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) { + private void createCompositeFields(List
compositeFields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService, Integer page, String section) { if (createListing) this.addListing(mainDocumentPart, indent, true, true); compositeFields.forEach(compositeField -> { if (visibilityRuleService.isElementVisible(compositeField.getId()) && hasVisibleFields(compositeField, visibilityRuleService)) { if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty() && !createListing) { - XWPFParagraph paragraph = addParagraphContent(compositeField.getNumbering() + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId); + XWPFParagraph paragraph = addParagraphContent(page + "." + section + "." + (compositeField.getOrdinal() +1) + " " + compositeField.getTitle(), mainDocumentPart, ParagraphStyle.HEADER6, numId); CTDecimalNumber number = paragraph.getCTP().getPPr().getNumPr().addNewIlvl(); number.setVal(BigInteger.valueOf(indent)); } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/Section.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/Section.java index 3d3457fb4..7d29c6e7d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/Section.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/datasetProfileModel/Section.java @@ -3,6 +3,8 @@ package eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileM import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import java.util.LinkedList; +import java.util.List; @XmlRootElement(name = "section") public class Section { @@ -15,6 +17,7 @@ public class Section { private String description; private String extendedDescription; private String title; + private List
section; @XmlAttribute(name = "id") public String getId() { @@ -99,6 +102,13 @@ public class Section { public eu.eudat.models.data.admin.components.datasetprofile.Section toAdminCompositeModelSection() { eu.eudat.models.data.admin.components.datasetprofile.Section sectionEntity = new eu.eudat.models.data.admin.components.datasetprofile.Section(); + List sectionsListEntity = new LinkedList<>(); + + if (this.section != null) { + for (Section xmlsection : this.section) { + sectionsListEntity.add(xmlsection.toAdminCompositeModelSection()); + } + } sectionEntity.setId(this.id); sectionEntity.setOrdinal(this.ordinal); sectionEntity.setTitle(this.title); @@ -110,7 +120,18 @@ public class Section { // fieldSetsEntity.add(xmpFieldSets.toAdminCompositeModelSection()); // } sectionEntity.setFieldSets(this.fieldSets.toAdminCompositeModelSection()); + + sectionEntity.setSections(sectionsListEntity); sectionEntity.setDefaultVisibility(this.defaultVisibility); return sectionEntity; } + + @XmlElement(name = "section") + public List
getSection() { + return section; + } + + public void setSection(List
section) { + this.section = section; + } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java index d8c205c77..c3991eb32 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/dmp/Researcher.java @@ -94,10 +94,12 @@ public class Researcher implements DataModel; - // To revert: "We set the items observable on focus to avoid the request being executed on component load." - forceFocus?: boolean; + // // To revert: "We set the items observable on focus to avoid the request being executed on component load." + // forceFocus?: boolean; autoSelectFirstOptionOnBlur?: boolean; } diff --git a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts index bbcd65fa8..4c40f4748 100644 --- a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts +++ b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts @@ -219,8 +219,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple } _onInputFocus() { - // We set the items observable on focus to avoid the request being executed on component load. - if (!this._items || this.forceFocus) { + if (!this._items) { this._items = this._inputSubject.pipe( startWith(null), debounceTime(this.requestDelay), @@ -258,6 +257,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple if (value != null) { this.getSelectedItems(value); } else { if (this.autocompleteInput && this.autocompleteInput.nativeElement && this.autocompleteInput.nativeElement.value) { this.autocompleteInput.nativeElement.value = ''; } this.inputValue = null; + this._items = null; } } pushChanges(value: any) { this.onChange(value); } @@ -328,7 +328,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple return this.configuration.autoSelectFirstOptionOnBlur != null ? this.configuration.autoSelectFirstOptionOnBlur : false; } - get forceFocus(): boolean { - return this.configuration.forceFocus != null ? this.configuration.forceFocus : false; - } + // get forceFocus(): boolean { + // return this.configuration.forceFocus != null ? this.configuration.forceFocus : false; + // } } diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html index 687a3b1ad..2f205b4ef 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html @@ -76,7 +76,7 @@ -
+
@@ -116,9 +116,6 @@
- - -
@@ -128,7 +125,7 @@
-
+
@@ -183,15 +180,15 @@ -
-
- {{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}} +
+
+ {{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}} - Preview updated! + {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.STATUS.PREVIEW-UPDATED' | translate}} - ... caculating preview + {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.STATUS.CALCULATING-PREVIEW' | translate}}
@@ -208,6 +205,8 @@
+
+

@@ -222,8 +221,11 @@
  • - Add Input icon + + 'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ADD-INPUT' | translate + {{'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ADD-INPUT' | translate}} + diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss index 94cebbcc9..bae52298c 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss @@ -91,8 +91,29 @@ $blue-color-light: #5cf7f2; color: #212121; transform: translateY(3px); } + .mat-checkbox-frame{ + border: 1px solid $blue-color ; + } } +.fieldset-new-input-action { + font-size: 0.8em; + font-weight: 400; + color: #212121; + display: inline-block; + transform: translateY(1px); +} +.inputMenuTrigger { + margin-bottom: 0.3rem; + display: inline-block; +} + +.previewer{ + background-color: #129d9811; + padding: 2em; + border: 1px solid #70707015; + border-radius: 4px; +} .input_icon{ width: 14px; 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 8d5a351b8..0e73c87e1 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 @@ -1,19 +1,19 @@ -
    -
    +
    +
    • {{'GENERAL.VALIDATION.REQUIRED' | translate}}
    • -
    • + +
    • + delete
    @@ -29,7 +29,7 @@ {{'GENERAL.VALIDATION.PATTERN-_' | translate}} --> - + - + {{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.RDA-COMMON-STANDARDS' | translate}} -- @@ -196,13 +196,33 @@ - +
    +
    +
    + 'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.ADD-VISIBILITY-RULE' | translate + {{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.ADD-VISIBILITY-RULE' | translate}} +
    +
    +
    + +

    {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.RULES-TITLE' | translate}} +

    + + +
    +
    @@ -226,27 +246,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.scss b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.scss index 1c94581a8..5f5900f93 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.scss +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.scss @@ -29,10 +29,38 @@ li.list-inline-item{ .mat-slide-toggle.mat-checked .mat-slide-toggle-thumb { background-color:#129D99 ; } + .mat-slide-toggle.mat-checked .mat-slide-toggle-bar { + background-color:rgba(0,178,159,0.34); + } + .mat-slide-toggle-bar{ + height: 11.93px; + width: 26.42px; + } + .mat-slide-toggle-thumb-container{ + top: -3px; + } + .mat-slide-toggle-thumb{ + width: 16px; + height: 16px; + } } .input_icon{ width: 14px; margin-right: 0.5em; +} +.visibility-icon{ + width: 20px; + margin-right: 0.5em; +} +.add-visibility-button{ + // display: flex; + // align-items: center; + width: auto; + cursor: pointer; + span{ + font-weight: 400; + font-size: 0.8em; + } } \ No newline at end of file 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 6ff1de711..1c0ff6614 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 @@ -1,47 +1,20 @@  -import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; -import { AbstractControl, AbstractControlOptions, FormArray, FormControl, FormGroup, FormGroupDirective, NgForm, ValidationErrors, ValidatorFn } from '@angular/forms'; +import { Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; +import {FormArray, FormControl, FormGroup, FormGroupDirective, NgForm,} from '@angular/forms'; import { DatasetProfileFieldViewStyle } from '@app/core/common/enum/dataset-profile-field-view-style'; import { ValidationType } from '@app/core/common/enum/validation-type'; import { DatasetProfileService } from '@app/core/services/dataset-profile/dataset-profile.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { BooleanDecisionFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/boolean-decision-field-data-editor-model'; -import { CheckBoxFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/check-box-field-data-editor-model'; -import { DatePickerDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/date-picker-data-editor-models'; -import { FreeTextFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/free-text-field-data-editor-model'; -import { RadioBoxFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/radio-box-field-data-editor-model'; -import { ResearchersAutoCompleteFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/researchers-auto-complete-field-data-editor-model'; -import { TextAreaFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/text-area-field-data-editor-model'; -import { WordListFieldDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/word-list-field-data-editor-model'; import { RuleEditorModel } from '@app/ui/admin/dataset-profile/admin/rule-editor-model'; import { BaseComponent } from '@common/base/base.component'; -import { debounce, debounceTime, takeUntil } from 'rxjs/operators'; -import { ExternalDatasetEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; -import { DataRepositoriesDataEditorModel } from '../../../admin/field-data/data-repositories-data-editor-models'; -import { RegistriesDataEditorModel } from '../../../admin/field-data/registries-data-editor-models'; -import { ServicesDataEditorModel } from '../../../admin/field-data/services-data-editor-models'; -import { TagsDataEditorModel } from '../../../admin/field-data/tags-data-editor-models'; -import { ResearchersDataEditorModel } from '../../../admin/field-data/researchers-data-editor-models'; -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'; -import { ValidationDataEditorModel } from '../../../admin/field-data/validation-data-editor-models'; -import { DatasetDescriptionFieldEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; -import { Subject, Subscription } from 'rxjs'; +import { Subscription } from 'rxjs'; import { ViewStyleType } from './view-style-enum'; -import { AutoCompleteFieldDataEditorModel } from '../../../admin/field-data/auto-complete-field-data-editor-model'; -import { DatasetsAutoCompleteFieldDataEditorModel } from '../../../admin/field-data/datasets-autocomplete-field-data-editor-mode'; import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profile-combo-box-type'; -import { Guid } from '@common/types/guid'; import { ErrorStateMatcher, MatDialog, MatSlideToggleChange } from '@angular/material'; -import { DefaultValueEditorModel } from '../../../admin/default-value-editor-model'; -import { EditorCustomValidators } from '../../custom-validators/editor-custom-validators'; import { Field } from '@app/core/model/admin/dataset-profile/dataset-profile'; import { DatasetProfileInternalDmpEntitiesType } from '@app/core/common/enum/dataset-profile-internal-dmp-entities-type'; import { FieldEditorModel } from '../../../admin/field-editor-model'; import { AutoCompleteFieldData, BooleanDecisionFieldData, CheckBoxFieldData, CurrencyFieldData, DataRepositoriesFieldData, DatasetIdentifierFieldData, DatePickerFieldData, DmpsAutoCompleteFieldData, ExternalDatasetsFieldData, FieldDataOption, FreeTextFieldData, OrganizationsFieldData, RadioBoxFieldData, RegistriesFieldData, ResearchersAutoCompleteFieldData, ServicesFieldData, TagsFieldData, TextAreaFieldData, ValidationFieldData, WordListFieldData } from '@app/core/model/dataset-profile-definition/field-data/field-data'; -import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; @Component({ selector: 'app-dataset-profile-editor-field-component', diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.html index ee9cacacd..6815d282e 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.html @@ -3,17 +3,25 @@
    -
    +
    - - - - - - +
    + + + + + + +
    +
    + Add Question icon + {{'DATASET-PROFILE-EDITOR.STEPS.TOOLKIT.NEW-INPUT-SET' | translate}} +
    +
    +
    @@ -38,8 +46,8 @@
    -
    - - - - - - drag_indicator - - - - - +
    +
    +
    + + + + + drag_indicator + + + + + +
    -
    +
    +
    +
    +
    + Add Question icon + {{'DATASET-PROFILE-EDITOR.STEPS.TOOLKIT.NEW-INPUT-SET' | translate}} +
    +
    +
    diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.scss b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.scss index bb5162e77..c10761262 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.scss +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.scss @@ -9,9 +9,28 @@ $blue-color-light: #5cf7f2; .fieldset-actions-list li{ cursor: pointer; } - - - +.fieldset{ + .add-question{ + cursor: pointer; + visibility: hidden; + transition-property: visibility; + transition-delay: 20ms; + transition-timing-function: ease; + transition-duration: 200ms; + } +} +.fieldset:hover{ + .add-question{ + visibility: visible; + } +} +.question-icon{ + width: 20px; +} +.stick-list{ + position: sticky; + top: 7em; +} .actions-list{ // border: 1px solid $blue-color; // box-shadow: 0px 3px 12px #129D9999; @@ -20,6 +39,7 @@ $blue-color-light: #5cf7f2; padding: 1em 0.9em; padding-bottom: 3em; min-width: 166px; + box-shadow: 0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%); .mat-list-item-content{ padding: 0px; diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.ts index 153305388..ccc0a0380 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component.ts @@ -1,15 +1,11 @@ -import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; -import { ChangeDetectorRef, Inject, OnDestroy } from '@angular/core'; +import { OnDestroy } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { FormArray, FormGroup } from '@angular/forms'; -import { FieldEditorModel } from '@app/ui/admin/dataset-profile/admin/field-editor-model'; -import { FieldSetEditorModel } from '@app/ui/admin/dataset-profile/admin/field-set-editor-model'; -import { SectionEditorModel } from '@app/ui/admin/dataset-profile/admin/section-editor-model'; -import { BaseComponent } from '@common/base/base.component'; import { Guid } from '@common/types/guid'; import { DragulaService } from 'ng2-dragula'; import { Subscription } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; +import { FieldEditorModel } from '../../../admin/field-editor-model'; +import { FieldSetEditorModel } from '../../../admin/field-set-editor-model'; import { ToCEntry, ToCEntryType } from '../../../table-of-contents/table-of-contents-entry'; @Component({ @@ -37,6 +33,7 @@ export class DatasetProfileEditorSectionFieldSetComponent implements OnInit, OnC // @Output() fieldsetAdded = new EventEmitter(); //returns the id of the fieldset added idprefix = "id"; + readonly dragula_prefix = "dragulaid"; private subs = new Subscription(); private FIELDSETS = 'FIELDSETS'; constructor( @@ -52,7 +49,7 @@ export class DatasetProfileEditorSectionFieldSetComponent implements OnInit, OnC this.dragulaService.createGroup(this.FIELDSETS,{ moves:(el, container, handle)=>{ // if(this.viewOnly) return false; //uncomment if want to unable drag n drop in viewonly mode - if(el.id != (this.idprefix+this.tocentry.id)) return false; + if(el.id != (this.dragula_prefix+this.tocentry.id)) return false; if(handle.className && handle.classList.contains('handle')) return true; return false; } @@ -152,7 +149,7 @@ export class DatasetProfileEditorSectionFieldSetComponent implements OnInit, OnC setTimeout(() => { const el = this.myElement.nativeElement.querySelector("#"+this.idprefix+id); if(el){ - el.scrollIntoView({behavior: "smooth", block:'end'}); + el.scrollIntoView({behavior: "smooth", block:'start'}); } }, 700); } @@ -162,10 +159,9 @@ export class DatasetProfileEditorSectionFieldSetComponent implements OnInit, OnC setTimeout(() => { const el = this.myElement.nativeElement.querySelector('#topofcontainer'); if(el){ - el.scrollIntoView({behavior:'smooth'}) + el.scrollIntoView({behavior:'smooth', block:'end'}) } },200); - } ngOnInit() { @@ -182,6 +178,38 @@ export class DatasetProfileEditorSectionFieldSetComponent implements OnInit, OnC this.addNewFieldSet.emit(this.form); } + addFieldSetAfter(afterOrdinal: number, afterIndex: number):void{ + const field: FieldEditorModel = new FieldEditorModel(); + field.id = Guid.create().toString(); + field.ordinal = 0;//first filed in the fields list + const fieldForm = field.buildForm(); + + //give fieldset id and ordinal + const fieldSet: FieldSetEditorModel = new FieldSetEditorModel(); + const fieldSetId = Guid.create().toString(); + fieldSet.id = fieldSetId; + fieldSet.ordinal = afterOrdinal < 0? 0 :afterOrdinal; + + const parentArray = this.form.get('fieldSets') as FormArray; + + parentArray.controls.forEach(fieldset=>{ + const ordinalControl = fieldset.get('ordinal'); + const ordinalValue = ordinalControl.value; + if(ordinalValue > afterOrdinal){ + ordinalControl.setValue(ordinalValue +1); + } + }); + const fieldsetForm = fieldSet.buildForm(); + (fieldsetForm.get('fields') as FormArray).push(fieldForm); + + const index = afterOrdinal < 0 ? 0: afterIndex +1; + parentArray.insert(index, fieldsetForm); + this.dataNeedsRefresh.emit(); + setTimeout(() => { + this.selectedFieldSetId = fieldSetId; + }, 200); + } + private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry{ if(!tocentries){ return null; diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts index 026434205..e5dcc8875 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.ts @@ -1,13 +1,13 @@ import { of as observableOf, Observable, combineLatest, BehaviorSubject,of } from 'rxjs'; import { HttpClient, HttpErrorResponse } from '@angular/common/http'; -import { AfterViewInit, Component, ElementRef, OnChanges, OnInit, QueryList, SimpleChanges, ViewChild } from '@angular/core'; -import { AbstractControl, Form, FormArray, FormBuilder, FormControl, FormGroup, ValidationErrors, ValidatorFn, Validators } from '@angular/forms'; +import { Component, OnInit, QueryList, ViewChild } from '@angular/core'; +import { AbstractControl, FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; -import { MatHorizontalStepper, MatStep } from '@angular/material/stepper'; +import { MatHorizontalStepper} from '@angular/material/stepper'; import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; -import { debounce, debounceTime, filter, map, mergeMap, takeUntil, tap } from 'rxjs/operators'; +import { debounceTime, filter, map, mergeMap, takeUntil, tap } from 'rxjs/operators'; import * as FileSaver from 'file-saver'; import { BaseComponent } from '@common/base/base.component'; import { DatasetProfileEditorModel } from '@app/ui/admin/dataset-profile/editor/dataset-profile-editor-model'; @@ -26,7 +26,6 @@ import { LanguageInfo } from '@app/core/model/language-info'; import { LanguageInfoService } from '@app/core/services/culture/language-info-service'; import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component'; import { MatomoService } from '@app/core/services/matomo/matomo-service'; -import { Link, LinkToScroll } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents'; import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service'; import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; import { NewEntryType, ToCEntry, ToCEntryType } from '../table-of-contents/table-of-contents-entry'; @@ -36,20 +35,13 @@ import { Guid } from '@common/types/guid'; import { FieldEditorModel } from '../admin/field-editor-model'; import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service'; import { CdkStep, StepperSelectionEvent } from '@angular/cdk/stepper'; -import { DatasetDescriptionCompositeFieldEditorModel, DatasetDescriptionFieldEditorModel, DatasetDescriptionFormEditorModel, DatasetDescriptionPageEditorModel, DatasetDescriptionSectionEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; +import { DatasetDescriptionCompositeFieldEditorModel, DatasetDescriptionFieldEditorModel, DatasetDescriptionSectionEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; import { Rule } from '@app/core/model/dataset-profile-definition/rule'; import { DatasetProfileFieldViewStyle } from '@app/core/common/enum/dataset-profile-field-view-style'; -import { invalid } from '@angular/compiler/src/render3/view/util'; import { SideNavService } from '@app/core/services/sidenav/side-nav.sevice'; import { EditorCustomValidators, EditorCustomValidatorsEnum } from './custom-validators/editor-custom-validators'; -import { CustomErrorValidator } from '@common/forms/validation/custom-validator'; import { GENERAL_ANIMATIONS, STEPPER_ANIMATIONS } from './animations/animations'; import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profile-combo-box-type'; -import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; -import { DmpInvitationUser } from '@app/core/model/dmp/invitation/dmp-invitation-user'; -import { RequestItem } from '@app/core/query/request-item'; -import { DmpInvitationUserCriteria } from '@app/core/query/dmp/dmp-invitation-user-criteria'; -import { DmpInvitationService } from '@app/core/services/dmp/dmp-invitation.service'; import { UserService } from '@app/core/services/user/user.service'; import { MatInput } from '@angular/material'; diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.html b/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.html index 72a3d7179..f31a10a89 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.html @@ -135,7 +135,7 @@ - + - - +
    diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.scss b/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.scss index 03cd37891..66b54ece1 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.scss +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section.scss @@ -111,3 +111,6 @@ $yellow: #f7dd72; font-weight: bold; // color: red; } +.add-input-icon{ + width: 20px; +} \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html index c420ad23c..ca513b5b7 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html @@ -37,6 +37,7 @@ +
    diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index 5c4fdb256..711414023 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -409,6 +409,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr .pipe(takeUntil(this._destroyed)) .subscribe(x => { if (x) { + this.showtocentriesErrors = false; this.datasetProfileValueChanged(x.id); this.formChanged(); } @@ -1177,6 +1178,10 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr printFormValue(){ console.log(this.formGroup.value); } + touchForm(){ + this.formGroup.markAllAsTouched(); + this.showtocentriesErrors = true; + } // tocentries; // this.tocentries = this.getTocEntries(this.formGroup.get('datasetProfileDefinition')); //TODO diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index 7c979743a..177145027 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -79,7 +79,7 @@
    - +
    diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts index b01094924..9d5773803 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.ts @@ -33,7 +33,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid import { TranslateService } from '@ngx-translate/core'; import * as FileSaver from 'file-saver'; import { Observable, of as observableOf, interval } from 'rxjs'; -import { delay, map, takeUntil } from 'rxjs/operators'; +import { catchError, delay, map, takeUntil } from 'rxjs/operators'; import { Principal } from "@app/core/model/auth/principal"; import { Role } from "@app/core/common/enum/role"; import { LockService } from '@app/core/services/lock/lock.service'; @@ -54,6 +54,7 @@ import { DmpToDatasetDialogComponent } from '../dmp-to-dataset/dmp-to-dataset-di import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model'; import { MatomoService } from '@app/core/services/matomo/matomo-service'; import { HttpClient } from '@angular/common/http'; +import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; @Component({ selector: 'app-dmp-editor-component', @@ -185,6 +186,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.setIsUserOwner(); if (!this.isUserOwner) { + + if(this.isUserMember()){ + this.router.navigate(['plans', 'overview', itemId]); + return; + } this.isFinalized = true; this.formGroup.disable(); } @@ -230,6 +236,12 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC .subscribe(x => { this.formChanged(); }); + if(this.lockStatus){ + this.dialog.open(PopupNotificationDialogComponent,{data:{ + title:this.language.instant('DMP-EDITOR.LOCKED.TITLE'), + message:this.language.instant('DMP-EDITOR.LOCKED.MESSAGE') + }, maxWidth:'30em'}); + } }) }); } else if (publicId != null) { @@ -365,7 +377,15 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC setIsUserOwner() { if (this.dmp) { const principal: Principal = this.authentication.current(); - this.isUserOwner = principal.id === this.dmp.users.find(x => x.role === Role.Owner).id; + this.isUserOwner = !!this.dmp.users.find(x => (x.role === Role.Owner) && (x.id === principal.id) ); + } + } + isUserMember(): boolean{ + try{ + const principal: Principal = this.authentication.current(); + return !!this.dmp.users.find(x => (x.role === Role.Member) && (x.id === principal.id) ); + }catch{ + return false; } } diff --git a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts index 588bc2c0a..72ba47c11 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts @@ -1,5 +1,5 @@ import { BaseComponent } from '@common/base/base.component'; -import { OnInit, Component, Input, EventEmitter, Output } from '@angular/core'; +import { OnInit, Component, Input, EventEmitter, Output, ViewChild } from '@angular/core'; import { AbstractControl, FormGroup, Validators } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; import { GrantTabModel } from '../grant-tab/grant-tab-model'; @@ -12,7 +12,6 @@ import { GrantCriteria } from '@app/core/query/grant/grant-criteria'; import { ProjectCriteria } from '@app/core/query/project/project-criteria'; import { FunderCriteria } from '@app/core/query/funder/funder-criteria'; import { debounceTime, filter, map, switchMap, takeUntil, tap } from 'rxjs/operators'; -import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model'; import { isNullOrUndefined } from '@swimlane/ngx-datatable'; @Component({ @@ -39,7 +38,7 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { isCreateNewProject = false; isCreateNewFunder = false; grant: GrantTabModel; - forceFocus = false; + // forceFocus = false; grantAutoCompleteConfiguration: SingleAutoCompleteConfiguration; projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration; @@ -219,7 +218,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { displayFn: (item) => item['label'] + this.getGrantIdText(item), titleFn: (item) => item['label'] + this.getGrantIdText(item), subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')), - forceFocus: this.forceFocus, } // this.forceFocus = false; @@ -236,7 +234,8 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { const grantRequestItem: RequestItem = new RequestItem(); grantRequestItem.criteria = new GrantCriteria(); grantRequestItem.criteria.like = query; - if (this.funderFormGroup.get('existFunder').value) { + const existFunderValue = this.funderFormGroup.get('existFunder').value; + if (existFunderValue && !this.isCreateNewFunder && (existFunderValue.key != this._KEY)) { grantRequestItem.criteria.funderReference = this.funderFormGroup.controls['existFunder'].value.reference; } return this.grantService.getWithExternal(grantRequestItem); @@ -414,11 +413,10 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { } funderValueChanged(funder: any) { - if ((funder.label !== "" && funder.label !== null && funder.label !== undefined) + if ((funder.label !== "" && funder.label !== null && funder.label !== undefined && !isNullOrUndefined(funder.reference) && funder.reference.length ) || (funder.existFunder !== null && funder.existFunder !== undefined && funder.existFunder.id !== undefined)) { this.grantformGroup.reset(); this.grantformGroup.enable(); - this.forceFocus = true; this.setGrantValidators(); } else { this.grantformGroup.reset(); @@ -435,121 +433,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit { return (!this.isFinalized && this.isUserOwner) || this.isClone; } - // private grantUniqueIdentifier(): AsyncValidatorFn{ - // return (control: AbstractControl) :Observable =>{ - // return control.valueChanges.pipe( - // debounceTime(600), - // distinctUntilChanged(), - // mergeMap(value=>{ - // const requestItem = new RequestItem(); - // requestItem.criteria = new GrantCriteria(); - // requestItem.criteria.exactReference = value; - // return this.grantService.getWithExternal(requestItem); - // }), - // takeUntil(this._destroyed), - // map((response)=>{ - // if(response && response.length){ - // const internalGrants = (response as Array).filter(grant=> grant.key === "Internal"); - // if(internalGrants && internalGrants.length){ - // return {grantIdentifierExists:true}; - // } - // } - // return null; - // // return response && response.length? {grantIdentifierExists:true} : null; - // }) - - // ).pipe(first()) - // } - // } - // private funderUniqueIdentifier(): AsyncValidatorFn{ - // return (control: AbstractControl) :Observable =>{ - - // if(!control.valueChanges){ - // return of(null); - // } - - // return control.valueChanges.pipe( - // debounceTime(600), - // // distinctUntilChanged(), - // switchMap(value=>{ - // const requestItem = new RequestItem(); - // requestItem.criteria = new FunderCriteria(); - // requestItem.criteria.exactReference = value; - // console.log('perasame mia fora'); - // return this.funderService.getWithExternal(requestItem); - // }), - // takeUntil(this._destroyed), - // map((response)=>{ - - // console.log('pername map'); - // //got response - // if(response && response.length){ - // const internalFunders = (response as Array).filter(funder=> funder.key === 'Internal'); - - // if(internalFunders && internalFunders.length){ - // return {funderIdentifierExists:true}; - // } - // return null; - // } - - // return null; - // } - // ), - // first() - - // ) - - // // const requestItem = new RequestItem(); - // // requestItem.criteria = new FunderCriteria(); - // // requestItem.criteria.exactReference = control.value; - // // return this.funderService.getWithExternal(requestItem).pipe( - // // takeUntil(this._destroyed), - // // map((response)=>{ - // // if(response && response.length){ - // // const internalFunders = (response as Array).filter(funder=> funder.key === 'Internal'); - - // // if(internalFunders && internalFunders.length){ - // // return {funderIdentifierExists:true}; - // // } - // // return null; - // // } - - // // return null; - // // }) - // // ) - - // } - // } - - - // private grantProjectIdentifier(): AsyncValidatorFn{ - // return (control: AbstractControl) :Observable =>{ - // return control.valueChanges.pipe( - // debounceTime(600), - // distinctUntilChanged(), - // mergeMap(value=>{ - // const requestItem = new RequestItem(); - // requestItem.criteria = new ProjectCriteria(); - // requestItem.criteria.exactReference = value; - // // return this.grantService.getWithExternal(requestItem); - // return this.projectService.getWithExternal(requestItem); - // }), - // takeUntil(this._destroyed), - // map((response)=>{ - // if(response && response.length){ - // const internalProjects = (response as Array).filter(grant=> grant.key === "Internal"); - // if(internalProjects && internalProjects.length){ - // return {projectIdentifierExists:true}; - // } - // } - // return null; - // // return response && response.length? {grantIdentifierExists:true} : null; - // }) - - // ).pipe(first()) - // } - // } - private consoleForm(){ console.log(this.formGroup); 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 80f2dbe8f..e574948cc 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 @@ -10,29 +10,29 @@ {{this.form.get('extendedDescription').value}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
    -
    - + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    - + {{opt.label}} @@ -45,48 +45,48 @@
    -
    - + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    -
    - + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    -
    - + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    @@ -99,7 +99,7 @@ + placeholder="{{ (form.get('data').value.label | translate) + (form.get('validationRequired').value? ' *': '') }}">
    {{option.label}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} *
    - @@ -138,18 +140,18 @@
    -
    - + + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    @@ -158,18 +160,18 @@
    -
    - + + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    @@ -178,18 +180,18 @@
    -
    - + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    @@ -198,18 +200,18 @@
    -
    - + -
    -
    - + + - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
    + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    @@ -218,7 +220,7 @@
    - +
    @@ -231,19 +233,17 @@ --> - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }}
    @@ -258,12 +258,12 @@ {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} --> - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -278,12 +278,12 @@
    - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{ type.name }} @@ -297,7 +297,7 @@
    - {{'GENERAL.VALIDATION.REQUIRED' | translate}} @@ -309,12 +309,12 @@
    - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{ type.name }} 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 a76cfcae8..07be0c4c8 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 @@ -106,7 +106,9 @@ export class FormFieldComponent extends BaseComponent implements OnInit { if (this.form.get('data').value.multiList) { const originalValue = this.form.get('value').value; if (originalValue !== null && typeof originalValue === 'string') { - let values = (this.form.get('value').value).slice(1, -1).split(', '); + let values = (this.form.get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"')); + let specialValue = (this.form.get('value').value).split('"').filter((value) => !value.startsWith('[') && !value.endsWith(']') && !values.includes(value) && value !== ', '); + specialValue.forEach(value => values.push(value)); if (!originalValue.startsWith('[') && !originalValue.endsWith(']')) { values = undefined; values = [originalValue]; @@ -385,8 +387,8 @@ export class FormFieldComponent extends BaseComponent implements OnInit { parseTags() { try{ - - + + let stringValue = this.form.get('value').value; if (typeof stringValue === 'string') { stringValue = (stringValue).replace(new RegExp('{', 'g'), '{"').replace(new RegExp('=', 'g'), '":"').replace(new RegExp(',', 'g'), '",').replace(new RegExp(', ', 'g'), ', "').replace(new RegExp('}', 'g'), '"}'); diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html index cb4d8ee58..f78625aa2 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.html @@ -10,13 +10,13 @@ [ngStyle]="calculateStyle(entry)" [ngClass]="calculateClass(entry)" > - + {{entry.numbering}}. {{entry.label}} - priority_high - + -->