From a3c9df87df6d5a8aee7c250f6e4c2e5ddbc9c832 Mon Sep 17 00:00:00 2001 From: Kristan Ntavidi Date: Fri, 11 Jun 2021 12:16:50 +0300 Subject: [PATCH] Add validate button on Dataset Wizard. Show in red invalid fieldsets in table of contents --- .../dataset-profile-editor-field.component.ts | 33 ++------------- .../dataset-wizard.component.html | 1 + .../dataset-wizard.component.ts | 5 +++ .../form-field/form-field.component.html | 42 +++++++++---------- .../table-of-contents-internal.html | 6 +-- 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/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 +- 13 files changed, 48 insertions(+), 63 deletions(-) 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/dataset/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html index c420ad23c..912ec5bab 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 @@ -33,6 +33,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/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..d8d11022f 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 @@ -26,9 +26,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} -
+ {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -54,9 +54,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -69,9 +69,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -84,9 +84,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -113,16 +113,16 @@ {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.YES" | translate }} {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.NO" | translate }} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} +
{{option.label}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} +
@@ -167,9 +167,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -187,9 +187,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -207,9 +207,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} @@ -239,11 +239,9 @@ - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} 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..187b6cca6 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 - + -->