diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java index ad8bcda51..dd5c82499 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/listingmodels/DataManagementPlanListingModel.java @@ -25,7 +25,7 @@ public class DataManagementPlanListingModel implements DataModel new AssociatedProfile().fromData(item)).collect(Collectors.toList()); return this; } @@ -196,7 +196,7 @@ public class DataManagementPlanListingModel implements DataModel new Organisation().fromDataModel(item)).collect(Collectors.toList())); this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList()); diff --git a/dmp-frontend/src/app/library/deactivate/can-deactivate.guard.ts b/dmp-frontend/src/app/library/deactivate/can-deactivate.guard.ts index 75d89ac2d..8e6df7ff9 100644 --- a/dmp-frontend/src/app/library/deactivate/can-deactivate.guard.ts +++ b/dmp-frontend/src/app/library/deactivate/can-deactivate.guard.ts @@ -30,7 +30,7 @@ export class CanDeactivateGuard extends BaseComponent implements CanDeactivate x ? true : false)); diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.routing.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.routing.ts index 4fb6f9404..1bf042f25 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.routing.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.routing.ts @@ -5,6 +5,7 @@ import { DatasetProfileListingComponent } from './listing/dataset-profile-listin import { AdminAuthGuard } from '@app/core/admin-auth-guard.service'; import { AppRole } from '@app/core/common/enum/app-role'; import { SpecialAuthGuard } from '@app/core/special-auth-guard.service'; +import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard'; const routes: Routes = [ { @@ -16,7 +17,8 @@ const routes: Routes = [ permissions: [AppRole.Admin, AppRole.DatasetTemplateEditor] } }, - canActivate: [SpecialAuthGuard] + canActivate: [SpecialAuthGuard], + canDeactivate:[CanDeactivateGuard] }, { path: ':id', @@ -27,7 +29,8 @@ const routes: Routes = [ permissions: [AppRole.Admin, AppRole.DatasetTemplateEditor] } }, - canActivate: [SpecialAuthGuard] + canActivate: [SpecialAuthGuard], + canDeactivate:[CanDeactivateGuard] }, { path: 'clone/:cloneid', @@ -38,7 +41,8 @@ const routes: Routes = [ permissions: [AppRole.Admin, AppRole.DatasetTemplateEditor] } }, - canActivate: [SpecialAuthGuard] + canActivate: [SpecialAuthGuard], + canDeactivate:[CanDeactivateGuard] }, { path: 'newversion/:newversionid', @@ -49,7 +53,8 @@ const routes: Routes = [ permissions: [AppRole.Admin, AppRole.DatasetTemplateEditor] } }, - canActivate: [SpecialAuthGuard] + canActivate: [SpecialAuthGuard], + canDeactivate:[CanDeactivateGuard] }, { path: 'versions/:groupId', diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/animations/animations.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/animations/animations.ts index c65851e63..5b4cd484a 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/animations/animations.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/animations/animations.ts @@ -78,6 +78,13 @@ export const GENERAL_ANIMATIONS = [ trigger('action-btn',[ transition(":enter", [style({opacity:0, transform:'scale(0)'}), animate('400ms ease', style({'opacity':1, transform:'scale(1)'}))]), transition(":leave", [style({opacity:1,transform:'scale(1)'}), animate('400ms ease', style({'opacity':0, transform:'scale(0)'}))]) - ]) + ]), + trigger('fade-in',[ + transition(":enter", [style({opacity:0}), animate('1000ms 800ms ease', style({'opacity':1}))]), + ]), + trigger('fade-in-fast',[ + transition(":enter", [style({opacity:0}), animate('800ms 100ms ease', style({'opacity':1}))]), + ]), + ] \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html index 2f205b4ef..9ddfe63e7 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html @@ -76,46 +76,40 @@ -
- - - - -
- - - -
-
- - - -
-
- - - -
- -
- - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - -
-
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + +
@@ -123,66 +117,63 @@
-
+
-
- -
- - - - - - - - -
-
-
- + + + + + + + +
+
+ + - -
+ +
+ +
+ +
+
+ +
+
-->
- {{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}} + {{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}} {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.STATUS.PREVIEW-UPDATED' | translate}} @@ -193,7 +184,7 @@
-
+
diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss index bae52298c..9b73377a3 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.scss @@ -129,6 +129,11 @@ $blue-color-light: #5cf7f2; padding-bottom: 0px; } +.previewer-text{ + font-weight: bold; + font-style: italic; +} + // ::ng-deep .underline-line-field .mat-form-field-appearance-legacy .mat-form-field-wapper{ // padding-bottom: 1.25em !important; // } \ No newline at end of file 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 4e3762bec..d6ac1fcfe 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 @@ -21,8 +21,9 @@ import { AutoCompleteFieldData, BooleanDecisionFieldData, CheckBoxFieldData, Cur import { CompositeField } from '@app/core/model/dataset-profile-definition/composite-field'; import {Field as FieldDefinition} from '@app/core/model/dataset-profile-definition/field'; import { Subject } from 'rxjs'; -import { debounceTime } from 'rxjs/operators'; +import { debounceTime, delay, map, takeUntil, tap } from 'rxjs/operators'; import { GENERAL_ANIMATIONS } from '../../animations/animations'; +import { BaseComponent } from '@common/base/base.component'; @Component({ selector: 'app-dataset-profile-editor-composite-field-component', @@ -30,7 +31,7 @@ import { GENERAL_ANIMATIONS } from '../../animations/animations'; styleUrls: ['./dataset-profile-editor-composite-field.component.scss'], animations:[GENERAL_ANIMATIONS] }) -export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnChanges { +export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent implements OnInit, OnChanges { @Input() form: FormGroup; @Input() indexPath: string; @@ -61,7 +62,9 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnCh private language: TranslateService, public enumUtils: EnumUtils, public datasetProfileService: DatasetProfileService - ) { } + ) { + super(); + } ngOnChanges(){ // this.setTargetField(null); @@ -112,16 +115,52 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnCh this.showExtendedDescription = !!this.form.get('extendedDescription').value; this.showAdditionalInfo = !!this.form.get('additionalInformation').value; - this.form.valueChanges.subscribe(changes=>{ + this.form.valueChanges.pipe(takeUntil(this._destroyed)).subscribe(changes=>{ // this.previewForm = null; this.previewDirty = true; this.generatePreviewForm(); }); - this.previewSubject$.pipe(debounceTime(600)).subscribe(model=>{ - const updatedForm = model.buildForm(); - this.reloadPreview(updatedForm) - }) + this.previewSubject$ + .pipe(debounceTime(600)) + .pipe( + takeUntil(this._destroyed), + map(model => model.buildForm()), + map(updatedForm =>{ + const previewContainer = document.getElementById('preview_container'+ this.form.get('id').value); + // let clientHeight = -1; + if(previewContainer){ + // console.log(previewContainer); + const clientHeight = previewContainer.clientHeight; + // console.log(clientHeight); + + if(clientHeight){ + previewContainer.style.height = clientHeight.toString() + 'px'; + + // console.log('height:' ,previewContainer.style.height); + } + } + this.showPreview = false; + this.previewDirty = true; + this.previewForm = updatedForm; + return previewContainer; + }), + delay(100), + tap( previewContainer =>{ + this.showPreview = true; + this.previewDirty = false; + }), + delay(100) + ) + .subscribe(previewContainer=>{ + + if(previewContainer){ + previewContainer.style.height = 'auto'; + } + + // const updatedForm = model.buildForm(); + // this.reloadPreview(updatedForm) + }); this.generatePreviewForm(); @@ -325,7 +364,8 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnCh fieldsForm.controls.forEach((field, idx)=>{ field.get('ordinal').setValue(idx); field.updateValueAndValidity(); - }) + }); + this.form.markAsDirty();//deactivate guard } getFieldTile(formGroup: FormGroup, index: number) { diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html index 0e73c87e1..610d39d31 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component.html @@ -15,12 +15,10 @@
  • delete
  • -
    - - +
    - +
    -
    +
    @@ -181,58 +181,61 @@
    - -
    - - + +
    + + -
    +
    @@ -318,7 +321,7 @@ (addNewFieldSet)="addNewEntry({childType: tocEntryEnumValues.FieldSet,parent: {form: $event}})" (removeFieldSet)="onRemoveEntry(_findTocEntryById($event, toCEntries))" (cloneFieldSet)="cloneFieldSet($event)" - (selectedEntryId)="displayItem(_findTocEntryById($event, getTocEntries()))" + (selectedEntryId)="displayItem(_findTocEntryById($event, toCEntries))" (dataNeedsRefresh)="onDataNeedsRefresh()" > @@ -388,11 +391,10 @@ - +
    @@ -411,7 +413,6 @@ translate}}
    -
    @@ -424,7 +425,6 @@ translate}}
    -
    - + -->