= stepsBeforeDatasets}">
{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}
- - {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (4)
- - {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}}
-
- - {{'DMP-EDITOR.STEPPER.FUNDING-INFO' | translate}} (3)
-
- - {{'DMP-EDITOR.STEPPER.LICENSE-INFO' | translate}} (5)
-
- - {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
- - {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
+ - {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (4)
+ - {{'DMP-EDITOR.STEPPER.FUNDING-INFO' | translate}} (3)
+ - {{'DMP-EDITOR.STEPPER.LICENSE-INFO' | translate}} (5)
+ - {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
- -
+
-
{{'DMP-EDITOR.STEPPER.DATASET' | translate}}: {{ dataset.get('label').value }}
-
close
+
close
check
-
-
+
chevron_left
{{'DMP-EDITOR.STEPPER.PREVIOUS' | translate}}
-
= stepsBeforeDatasets }" (click)="nextStep()">
+
= stepsBeforeDatasets }" (click)="nextStep()">
chevron_right
{{'DMP-EDITOR.STEPPER.NEXT' | translate}}
-
-
chevron_right
-
{{'DMP-EDITOR.STEPPER.NEXT' | translate}}
-
-
= 3 && hasProfile() && !isFinalized" mat-raised-button type="button" class="col-auto stepper-btn add-dataset-btn ml-auto" (click)="addDataset()" target="_blank">
-
add
-
{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}
+
+
= 3 && !isFinalized" mat-raised-button type="button" class="col-auto stepper-btn add-dataset-btn ml-auto" (click)="addDataset()" target="_blank">
+
+
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}} & {{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss
index 67566b300..7126fa67e 100644
--- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss
+++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.scss
@@ -351,6 +351,12 @@ mat-icon.size-16 {
cursor: pointer;
}
+.add-dataset-action {
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+}
+
.next {
background: #129d99 0% 0% no-repeat padding-box;
color: white;
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 74e29e842..ee934b36f 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
@@ -67,7 +67,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
isFinalized = false;
hasChanges = false;
isDiscarded = false;
- isNewDataset = false;
hasDmpId = false;
isUserOwner: boolean = true;
@@ -115,11 +114,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
}
ngOnInit() {
- if (this.router.url.toString().includes('/new/dataset')) {
- this.isNewDataset = true;
- this.stepsBeforeDatasets = 2;
- this.maxStep = 2;
- };
+ // if (this.router.url.toString().includes('/new/dataset')) {
+ // this.isNewDataset = true;
+ // this.stepsBeforeDatasets = 2;
+ // this.maxStep = 2;
+ // };
this.route.params
.pipe(takeUntil(this._destroyed))
.subscribe((params: Params) => {
@@ -222,6 +221,10 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
}
this.associatedUsers = data.associatedUsers;
this.people = data.users;
+ this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
+ .subscribe(x => {
+ this.formChanged();
+ });
})
});
} else if (publicId != null) {
@@ -276,46 +279,57 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// });
// }
// })
- });
- } else if (this.isNewDataset) {
- this.dmp = new DmpEditorModel();
- this.dmp.grant = new GrantTabModel();
- this.dmp.project = new ProjectFormModel();
- this.dmp.funder = new FunderFormModel();
- this.dmp.extraProperties = new ExtraPropertiesFormModel();
- this.dmp.extraProperties.visible = false;
- this.dmp.extraProperties.contact = this.authService.current().id;
- this.datasetWizardEditorModel = new DatasetWizardEditorModel();
-
- if (dmpId) {
- this.hasDmpId = true;
- this.dmpService.getSingle(dmpId).pipe(map(data => data as DmpModel))
- .pipe(takeUntil(this._destroyed))
- .subscribe(data => {
- setTimeout(() => {
- this.dmpModel = data;
- this.datasetWizardEditorModel.dmp = data;
- this.dmp.datasets.push(this.datasetWizardEditorModel);
- this.formGroup = this.dmp.buildForm();
- this.formGroup.get('datasets')['controls'][0].get('dmp').disable();
- this.datasets = this.formGroup.get('datasets') as FormArray;
- this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
- this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
- // this.loadDatasetProfiles();
- // this.registerFormListeners();
+ this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
+ .subscribe(x => {
+ this.formChanged();
});
- });
+ });
+ }
+ // else if (this.isNewDataset) {
+ // this.dmp = new DmpEditorModel();
+ // this.dmp.grant = new GrantTabModel();
+ // this.dmp.project = new ProjectFormModel();
+ // this.dmp.funder = new FunderFormModel();
+ // this.dmp.extraProperties = new ExtraPropertiesFormModel();
+ // this.dmp.extraProperties.visible = false;
+ // this.dmp.extraProperties.contact = this.authService.current().id;
+ // this.datasetWizardEditorModel = new DatasetWizardEditorModel();
- } else {
- this.dmp.datasets.push(this.datasetWizardEditorModel);
- this.formGroup = this.dmp.buildForm();
- this.datasets = this.formGroup.get('datasets') as FormArray;
- this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
- this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
- }
+ // if (dmpId) {
+ // this.hasDmpId = true;
+ // this.dmpService.getSingle(dmpId).pipe(map(data => data as DmpModel))
+ // .pipe(takeUntil(this._destroyed))
+ // .subscribe(data => {
+ // setTimeout(() => {
+ // this.dmpModel = data;
+ // this.datasetWizardEditorModel.dmp = data;
+ // this.dmp.datasets.push(this.datasetWizardEditorModel);
+ // this.formGroup = this.dmp.buildForm();
+ // this.formGroup.get('datasets')['controls'][0].get('dmp').disable();
+ // this.datasets = this.formGroup.get('datasets') as FormArray;
+ // this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
+ // this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
+ // // this.loadDatasetProfiles();
+ // // this.registerFormListeners();
+ // });
+ // });
- this.registerFormEventsForNewItem();
- } else {
+ // } else {
+ // this.dmp.datasets.push(this.datasetWizardEditorModel);
+ // this.formGroup = this.dmp.buildForm();
+ // this.datasets = this.formGroup.get('datasets') as FormArray;
+ // this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue()));
+ // this.maxStep = this.formGroup.get('datasets') ? this.maxStep + this.formGroup.get('datasets').value.length - 1 : this.maxStep;
+ // this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
+ // .subscribe(x => {
+ // console.log(x);
+ // this.formChanged();
+ // });
+ // }
+
+ // this.registerFormEventsForNewItem();
+ // }
+ else {
this.dmp = new DmpEditorModel();
this.dmp.grant = new GrantTabModel();
this.dmp.project = new ProjectFormModel();
@@ -345,6 +359,10 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
]);
})
}
+ this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
+ .subscribe(x => {
+ this.formChanged();
+ });
}
});
@@ -424,20 +442,20 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
formSubmit(addNew?: boolean, showAddDatasetDialog?: boolean): void {
this.formService.touchAllFormFields(this.formGroup);
- if (this.isNewDataset) {
- if (!this.isDatasetFormValid) {
- this.showValidationErrorsDialog();
- return;
- }
- this.onDatasetSubmit();
- }
- else {
+ // if (this.isNewDataset) {
+ // if (!this.isDatasetFormValid) {
+ // this.showValidationErrorsDialog();
+ // return;
+ // }
+ // this.onDatasetSubmit();
+ // }
+ // else {
if (!this.isFormValid()) {
this.showValidationErrorsDialog();
return;
}
this.onSubmit(addNew, showAddDatasetDialog);
- }
+ // }
}
public isFormValid() {
@@ -823,22 +841,13 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
public discardChanges() {
this.isDiscarded = true;
this.hasChanges = false;
- if (this.isNewDataset && !this.hasDmpId) {
- this.formGroup.get('datasets')['controls'].forEach(element => {
- element.removeControl('datasetProfileDefinition');
- });
- this.formGroup.reset();
- } else if (this.hasDmpId) {
- Object.keys(this.formGroup.get('datasets')['controls'][0].controls).forEach((key: string) => {
- if (key === 'datasetProfileDefinition') {
- this.formGroup.get('datasets')['controls'][0].removeControl(key);
- }
- if (key !== 'dmp' && key !== 'datasetProfileDefinition') {
- this.formGroup.get('datasets')['controls'][0].get(key).reset();
- }
- });
- } else {
+ if (!this.isNew) {
this.formGroup.patchValue(JSON.parse(JSON.stringify(this.formGroupRawValue)));
+ } else {
+ this.formGroup.reset();
+ this.formGroup.get('extraProperties').get('visible').setValue(false);
+ this.formGroup.get('extraProperties').get('contact').setValue(this.authService.current().id);
+ this.formGroup.get('associatedUsers').setValue([]);
}
this.isDiscarded = 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 11a74f5a2..aa0e6f215 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
@@ -81,7 +81,7 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => {
this.configureAutoCompletes();
- this.onFormChanged.emit();
+ // this.onFormChanged.emit();
});
}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/license-info/license-info.component.html b/dmp-frontend/src/app/ui/dmp/editor/license-info/license-info.component.html
index 4c3527542..ed02d2bfa 100644
--- a/dmp-frontend/src/app/ui/dmp/editor/license-info/license-info.component.html
+++ b/dmp-frontend/src/app/ui/dmp/editor/license-info/license-info.component.html
@@ -9,7 +9,7 @@
4.1 {{'DMP-EDITOR.FIELDS.LANGUAGE' | translate}}
-
+
{{ lang.name }}
@@ -24,7 +24,7 @@