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 b880f7ae2..71db4b830 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
@@ -50,7 +50,8 @@
{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}
-
0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (5)
+
0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (2)
+
0. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (done)
@@ -74,6 +75,9 @@
{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-ADD' | translate }}
+
diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-progress-indication/form-progress-indication.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-progress-indication/form-progress-indication.component.ts
index fc9fa6b3d..6a48092e5 100644
--- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-progress-indication/form-progress-indication.component.ts
+++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-progress-indication/form-progress-indication.component.ts
@@ -11,7 +11,8 @@ import { takeUntil } from 'rxjs/operators';
})
export class FormProgressIndicationComponent extends BaseComponent implements OnInit {
@Input() formGroup: FormGroup;
- @Input() isEditor: boolean;
+ @Input() isDmpEditor: boolean;
+ @Input() isDatasetEditor: boolean;
@Input() public progressValueAccuracy = 2;
determinateProgressValue: number;
progressSoFar: number;
@@ -32,9 +33,12 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
}
calculateValueForProgressbar() {
- if (this.isEditor) {
+ if (this.isDmpEditor) {
this.progressSoFar = this.countFormControlsValidForProgress(this.formGroup);
this.total = this.countFormControlsRequiredFieldsForTotal(this.formGroup);
+ } else if (this.isDatasetEditor) {
+ this.progressSoFar = this.countFormControlsValidForProgress(this.formGroup) + this.countFormControlsWithValueForProgress(this.formGroup);
+ this.total = this.countFormControlsRequiredFieldsForTotal(this.formGroup) + this.CountFormControlDepthLengthFotTotal(this.formGroup);
} else {
this.progressSoFar = this.countFormControlsWithValueForProgress(this.formGroup);
this.total = this.CountFormControlDepthLengthFotTotal(this.formGroup);
@@ -46,11 +50,11 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
countFormControlsWithValueForProgress(formControl: AbstractControl): number {
let valueCurent = 0;
if (formControl instanceof FormGroup) {
- if (this.checkFormsIfIsFieldsAndVisible(formControl)) {
+ if (this.checkFormsIfIsFieldsAndVisible(formControl) && this.checkIfIsRequired((formControl as FormGroup))) {
if (this.haseValue(formControl))
valueCurent++;
}
- if (this.chechFieldIfIsFieldSetAndVisible((formControl as FormGroup))) {
+ if (this.chechFieldIfIsFieldSetAndVisible((formControl as FormGroup)) && this.checkIfIsRequired((formControl as FormGroup))) {
valueCurent = valueCurent + this.compositeFieldsGetChildsForProgress(formControl);
} else {
Object.keys(formControl.controls).forEach(item => {
@@ -86,7 +90,12 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
return valueCurent;
}
-
+ private checkIfIsRequired(formControl: FormGroup): boolean {
+ if (formControl.get('validationRequired') && formControl.get('validationRequired').value) {
+ return true;
+ }
+ return false;
+ }
private checkFormsIfIsFieldsAndVisible(formControl: FormGroup): boolean {
if (formControl.contains('id') && formControl.contains('value')) {
@@ -108,7 +117,7 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
valueCurent = valueCurent + this.CountFormControlDepthLengthFotTotal(item);
});
} else if (formControl instanceof FormGroup) {
- if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('value') && (this.visibilityRulesService.checkElementVisibility((formControl as FormGroup).get('id').value))) {
+ if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('value') && (this.visibilityRulesService.checkElementVisibility((formControl as FormGroup).get('id').value)) && this.checkIfIsRequired((formControl as FormGroup))) {
valueCurent++;
} else if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('fields')) {
valueCurent = valueCurent + this.compositeFieldsGetChildsForTotal(formControl);
@@ -188,4 +197,8 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
return true;
} else { return false }
}
+
+ isEditor(): boolean {
+ return this.isDmpEditor || this.isDatasetEditor;
+ }
}