-
+
-
+
@@ -28,7 +28,7 @@
-
+
@@ -63,17 +63,17 @@
-
+
{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}
  1. {{'DMP-EDITOR.STEPPER.MAIN-INFO' | translate}} (4)
  2. {{'DMP-EDITOR.STEPPER.FUNDING-INFO' | translate}} (3)
  3. {{'DMP-EDITOR.STEPPER.DATASET-INFO' | translate}}
  4. -
  5. +
  6. {{'DMP-EDITOR.STEPPER.DATASET' | translate}}
      -
    • {{ dataset.get('label').value }} (8)
    • +
    • {{ dataset.get('label').value }} (8)
@@ -83,7 +83,7 @@ chevron_left
{{'DMP-EDITOR.STEPPER.PREVIOUS' | translate}}
-
+
chevron_right
{{'DMP-EDITOR.STEPPER.NEXT' | translate}}
@@ -93,7 +93,7 @@ -
+
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 1f0247692..21814e149 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 @@ -219,7 +219,7 @@ a:hover { color: #000000; } -.stepper { +.dataset-stepper { position: fixed; // height: 100%; display: flex; @@ -228,6 +228,15 @@ a:hover { overflow-y: auto; } +.dmp-stepper { + position: fixed; + // height: 100%; + display: flex; + flex-direction: column; + height: calc(100vh - 190px); + overflow-y: auto; +} + .stepper-title { text-align: left; font-weight: 300; 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 041a301a3..ffaaa8608 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 @@ -41,6 +41,7 @@ import { LockModel } from '@app/core/model/lock/lock.model'; import { Guid } from '@common/types/guid'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model'; +import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; @Component({ selector: 'app-dmp-editor-component', @@ -71,6 +72,9 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC isUserOwner: boolean = true; lock: LockModel; lockStatus: Boolean; + datasets: FormArray; + datasetId: string = null; + stepsBeforeDatasets: number = 3; step: number = 0; maxStep: number = 3; @@ -99,6 +103,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC const publicId = params['publicId']; const queryParams = this.route.snapshot.queryParams; const tabToNav = queryParams['tab']; + this.datasetId = queryParams['dataset']; + // if (queryParams['step']) { this.step = queryParams['step']; } const grantRequestItem: RequestItem = new RequestItem(); grantRequestItem.criteria = new GrantCriteria(); @@ -111,6 +117,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC // displayFn: (item) => item['label'], // titleFn: (item) => item['label'] // }; + switch (tabToNav) { case 'general': this.selectedTab = 0; @@ -139,6 +146,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.extraProperties = new ExtraPropertiesFormModel(); this.dmp.fromModel(data); this.formGroup = this.dmp.buildForm(); + this.datasets = new FormArray([]); + // this.formGroup.get('datasets')['controls'].forEach(element => { + // this.datasets.push(element); + // }); + 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; @@ -148,6 +160,10 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.formGroup.disable(); } + if (this.datasetId) { + this.step = this.formGroup.get('datasets')['controls'].findIndex((dataset) => { return this.datasetId === dataset.get('id').value; }) + this.stepsBeforeDatasets; + } + //this.registerFormEventsForDmpProfile(this.dmp.definition); if (!this.editMode || this.dmp.status === DmpStatus.Finalized || lockStatus) { this.isFinalized = true; @@ -200,6 +216,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.fromModel(data); this.formGroup = this.dmp.buildForm(); + this.datasets = new FormArray([]); + this.formGroup.get('datasets')['controls'].forEach(element => { + this.datasets.push(element); + }); + 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; @@ -240,6 +261,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.dmp.extraProperties.contact = this.authService.current().id; this.formGroup = this.dmp.buildForm(); + this.datasets = new FormArray([]); + this.formGroup.get('datasets')['controls'].forEach(element => { + this.datasets.push(element); + }); + 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; @@ -374,7 +400,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC if (showAddDatasetDialog) { this.addDatasetOpenDialog(complete); } - else { this.onCallbackSuccess(complete) } + else if (this.step < this.stepsBeforeDatasets) { this.onCallbackSuccess(complete) } + else { this.onCallbackSuccess(complete, this.datasetId) } }, error => { this.formGroup.get('status').setValue(DmpStatus.Draft); @@ -398,9 +425,13 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC } - onCallbackSuccess(id?: String): void { + onCallbackSuccess(id?: String, datasetId?: string): void { this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); - id != null ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', id]); }) : this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans']); }); + if (id != null) { + datasetId ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', id], { queryParams: { dataset: datasetId } }); }) : this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', id]); }) + } else { + this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans']); }); + } } onCallbackError(error: any) { @@ -629,16 +660,23 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => this.lock.id = Guid.parse(result)); } - public changeStep(index: number) { + public changeStep(index: number, dataset?: FormControl) { this.step = index; + if (dataset) { this.datasetId = dataset.get('id').value }; } public nextStep() { this.step = this.step < this.maxStep ? this.step + 1 : this.step; + if (this.step >= this.stepsBeforeDatasets) { + this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value; + } } public previousStep() { this.step = this.step !== 0 ? this.step - 1 : this.step; + if (this.step >= this.stepsBeforeDatasets) { + this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value; + } } public isDirty(): boolean {