diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.ts index 70c9fe6b9..6d7ed3ce9 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.ts @@ -7,6 +7,9 @@ import { ValidationType } from '@app/core/common/enum/validation-type'; import { MatCheckboxChange } from '@angular/material/checkbox'; import { DatasetDescriptionCompositeFieldEditorModel, DatasetDescriptionFieldEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model'; import { DatasetProfileFieldViewStyle } from '@app/core/common/enum/dataset-profile-field-view-style'; +import { MatDialog } from '@angular/material'; +import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-dataset-profile-editor-composite-field-component', @@ -27,7 +30,10 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnCh isMultiplicityEnabled = false; viewStyleEnum = DatasetProfileFieldViewStyle; - constructor() { } + constructor( + private dialog: MatDialog, + private language: TranslateService, + ) { } ngOnChanges(){ this.setTargetField(null); @@ -170,6 +176,26 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnCh deleteTargetField(){ + + const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + restoreFocus: false, + data: { + message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'), + confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'), + cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), + isDeleteConfirmation: true + } + }); + dialogRef.afterClosed().subscribe(result => { + if (result) { + this._deleteTargetField(); + } + }); + + } + + + private _deleteTargetField(){ if(!this.targetField) return; let index = -1; 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 53031ca86..8be447be9 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 @@ -224,7 +224,8 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements cssClass: null }; - fieldEditorModel.data = this.form.get('data').value; + + fieldEditorModel.data = (this.form.get('data') as FormGroup).getRawValue(); fieldEditorModel.value = this.form.get('defaultValue').get('value').value; fieldEditorModel.validationRequired = (this.form.get('validations').value as Array).includes(ValidationType.Required); diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html index 5ea009c1b..9dedb01f7 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/dataset-profile-editor.component.html @@ -25,21 +25,11 @@
-
+
-
- - {{'DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.TITLE' | translate}} - -
-
- - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.TITLE' | translate}} - -
-
- - Preview and Finalize +
+ + {{step.label}}
@@ -56,10 +46,11 @@
- - - {{'DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.TITLE' | translate}} - + + + +
1.1 {{'DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-NAME'| translate}} *
@@ -119,8 +110,8 @@
--> - - {{'DATASET-PROFILE-EDITOR.STEPS.FORM.TITLE' | translate}} + +
@@ -251,12 +242,15 @@
-->
+ + Preview and finalize + - +
@@ -296,10 +290,10 @@ - +
\ No newline at end of file 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 4e3f295a8..606f45bd4 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 @@ -44,7 +44,7 @@ const skipDisable: any[] = require('../../../../../assets/resources/skipDisable. templateUrl: './dataset-profile-editor.component.html', styleUrls: ['./dataset-profile-editor.component.scss'] }) -export class DatasetProfileEditorComponent extends BaseComponent implements OnInit, AfterViewInit { +export class DatasetProfileEditorComponent extends BaseComponent implements OnInit { isNew = true; isNewVersion = false; @@ -88,12 +88,6 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn // this.profileID = route.snapshot.params['id']; // this.cloneId = route.snapshot.params['cloneid']; } - ngAfterViewInit(): void { - // setTimeout(() => { - // this.barPercentage = (1 / (this.stepper.steps.length+1)) * 110 - 110; - // }, 0); - } - ngOnInit() { this.matomoService.trackPageView('Admin: Dataset Profile Edit'); @@ -732,9 +726,27 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn + onRemoveEntry(tce: ToCEntry){ + + const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + restoreFocus: false, + data: { + message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'), + confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'), + cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), + isDeleteConfirmation: true + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + this._deleteEntry(tce); + } + }); + + } - onRemoveEntry(tce: ToCEntry) { + private _deleteEntry(tce: ToCEntry) { //define entry type switch (tce.type) { case ToCEntryType.Page: @@ -949,22 +961,19 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn console.log(this.form.value); } - - - barPercentage = -100; - onStepperSelectionChange(selectionChange: StepperSelectionEvent){ - - this.barPercentage = ((selectionChange.selectedIndex+1) / (this.stepper.steps.length+1)) * 110- 110; - } - - get barPercentageA(){ + get barPercentage(){ if(!this.stepper){ return -110; } - const selectedIndex = this.stepper.selectedIndex + 1; - return (selectedIndex / (this.stepper.steps.length+1)) * 110- 110; + return (selectedIndex / this.stepper.steps.length) * 110- 110; } - + get steps(){ + if(!this.stepper){ + return []; + } + + return this.stepper.steps; + } } \ No newline at end of file