diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 1855efea0..2daf1a1ff 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -39,6 +39,7 @@ import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category'; import { DmpUserType } from '@app/core/common/enum/dmp-user-type'; import { PrefillingSourceSystemTargetType } from '@app/core/common/enum/prefilling-source-system-target-type'; +import { AnnotationProtectionType } from '@app/core/common/enum/annotation-protection-type.enum'; @Injectable() export class EnumUtils { @@ -407,5 +408,12 @@ export class EnumUtils { } } + public toAnnotationProtectionTypeString(value: AnnotationProtectionType): string { + switch (value) { + case AnnotationProtectionType.Private: return this.language.instant('TYPES.ANNOTATION-PROTECTION-TYPE.PRIVATE'); + case AnnotationProtectionType.EntityAccessors: return this.language.instant('TYPES.ANNOTATION-PROTECTION-TYPE.ENTITY-ACCESSORS'); + default: return ''; + } + } } diff --git a/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html index 6edd64e75..bea547cd1 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component.html @@ -8,7 +8,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html index c0ba38570..53e4e48ef 100644 --- a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html @@ -1,30 +1,36 @@
+
+ +
+ close +
+
- + {{threadFormGroup.get('text').getError('backendError')?.message}} {{'COMMONS.VALIDATION.REQUIRED' | translate}} - + {{threadFormGroup.get('protectionType').getError('backendError')?.message}} + {{'COMMONS.VALIDATION.REQUIRED' | translate}} +
-
{{'APP.ANNOTATION.TITLE' | translate}}
+
{{'ANNOTATION-DIALOG.TITLE' | translate}}
@@ -38,15 +44,11 @@
{{thread.timeStamp | date:'EEEE, MMMM d, y, h:mm a'}}
-
{{getAnnotationProtectionType(thread)}}
-
{{getAnnotationProtectionType(thread)}}
-
{{getAnnotationProtectionType(thread)}}
+
{{getAnnotationProtectionType(thread)}}
+
{{getAnnotationProtectionType(thread)}}
{{thread.text}}
- {{'APP.ANNOTATION.THREADS.FROM-USER' | translate}} {{thread.author.name}} - - + {{'ANNOTATION-DIALOG.THREADS.FROM-USER' | translate}} {{thread.author.name}}
@@ -72,10 +74,8 @@
{{annotation.timeStamp | date:'EEEE, MMMM d, y, h:mm a'}}
{{annotation.text}}
- {{'APP.ANNOTATION.THREADS.FROM-USER' | translate}} + {{'ANNOTATION-DIALOG.THREADS.FROM-USER' | translate}} {{annotation.author.name}} -
@@ -88,11 +88,11 @@
- + {{'COMMONS.VALIDATION.REQUIRED' | translate}}
-
@@ -101,14 +101,9 @@
-
-
-
- close -
-
-
- + + +

{{ 'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.OR' | translate }}

- +
@@ -145,5 +140,5 @@ {{'GENERAL.START-NEW-DMP-DIALOG.RDA-SPECIFICATIONS' | translate }} {{'GENERAL.START-NEW-DMP-DIALOG.MACHINE-ACTIONABLE' | translate }} -
+ --> \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts index 725d65c87..d723748e9 100644 --- a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts @@ -8,6 +8,7 @@ import { AnnotationLookup } from '@annotation-service/core/query/annotation.look import { AnnotationService } from '@annotation-service/services/http/annotation.service'; import { AnnotationProtectionType } from '@app/core/common/enum/annotation-protection-type.enum'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { isNullOrUndefined } from '@app/utilities/enhancers/utils'; import { BaseComponent } from '@common/base/base.component'; import { FormService } from '@common/forms/form-service'; @@ -23,6 +24,9 @@ import { nameof } from 'ts-simple-nameof'; }) export class AnnotationDialogComponent extends BaseComponent { + annotationProtectionTypeEnumValues = this.enumUtils.getEnumValues(AnnotationProtectionType); + annotationProtectionTypeEnum = AnnotationProtectionType; + private entityId: Guid; private anchor: string; private entityType: string; @@ -43,7 +47,8 @@ export class AnnotationDialogComponent extends BaseComponent { private uiNotificationService: UiNotificationService, private language: TranslateService, private annotationService: AnnotationService, - private formService: FormService + private formService: FormService, + private enumUtils: EnumUtils ) { super(); this.entityId = data.entityId; @@ -52,57 +57,61 @@ export class AnnotationDialogComponent extends BaseComponent { } ngOnInit(): void { - // this.threadFormGroup = new UntypedFormGroup({ - // text: new FormControl(null, [Validators.required]), - // annotationProtectionType: new FormControl(AnnotationProtectionType.Public, [Validators.required]) - // }); - // if (this.entityId != null) { - // this.loadThreads(); - // } + this.threadFormGroup = new UntypedFormGroup({ + text: new FormControl(null, [Validators.required]), + protectionType: new FormControl(AnnotationProtectionType.EntityAccessors, [Validators.required]) + }); + if (this.entityId != null) { + this.loadThreads(); + } } createThread() { - // this.formService.removeAllBackEndErrors(this.threadFormGroup); - // this.formService.touchAllFormFields(this.threadFormGroup); - // if (!this.isFormValid(this.threadFormGroup)) { - // return; - // } - // const threadToCreate: AnnotationPersist = { - // payload: this.threadFormGroup.get('text').value, - // protection: this.threadFormGroup.get('annotationProtectionType').value, - // referenceId: this.referenceId - // }; - // this.annotationService.persist(threadToCreate).pipe(takeUntil(this._destroyed)) - // .subscribe( - // complete => this.onCallbackSuccess(), - // error => this.onCallbackError(error) - // ); + this.formService.removeAllBackEndErrors(this.threadFormGroup); + this.formService.touchAllFormFields(this.threadFormGroup); + if (!this.isFormValid(this.threadFormGroup)) { + return; + } + const threadToCreate: AnnotationPersist = { + payload: this.threadFormGroup.get('text').value, + protectionType: this.threadFormGroup.get('protectionType').value, + entityId: this.entityId, + entityType: this.entityType, + anchor: this.anchor + }; + this.annotationService.persist(threadToCreate).pipe(takeUntil(this._destroyed)) + .subscribe( + complete => this.onCallbackSuccess(), + error => this.onCallbackError(error) + ); } replyThread(threadId: Guid, threadProtection: AnnotationProtectionType) { - // // if (!this.threadReplyTexts[threadId.toString()] || this.threadReplyTexts[threadId.toString()].length === 0) { return; } - // this.formService.removeAllBackEndErrors(this.threadReplyTextsFG[threadId.toString()]); - // this.formService.touchAllFormFields(this.threadReplyTextsFG[threadId.toString()]); - // if (!this.isFormValid(this.threadReplyTextsFG[threadId.toString()])) { - // return; - // } - // const replyToCreate: AnnotationPersist = { - // threadId: threadId, - // text: this.threadReplyTextsFG[threadId.toString()].get('replyText').value, - // protection: threadProtection, - // referenceId: this.referenceId - // }; - // this.annotationService.persist(replyToCreate).pipe(takeUntil(this._destroyed)) - // .subscribe( - // complete => this.onCallbackSuccess(), - // error => this.onCallbackError(error) - // ); + // if (!this.threadReplyTexts[threadId.toString()] || this.threadReplyTexts[threadId.toString()].length === 0) { return; } + this.formService.removeAllBackEndErrors(this.threadReplyTextsFG[threadId.toString()]); + this.formService.touchAllFormFields(this.threadReplyTextsFG[threadId.toString()]); + if (!this.isFormValid(this.threadReplyTextsFG[threadId.toString()])) { + return; + } + const replyToCreate: AnnotationPersist = { + threadId: threadId, + payload: this.threadReplyTextsFG[threadId.toString()].get('replyText').value, + protectionType: threadProtection, + entityId: this.entityId, + entityType: this.entityType, + anchor: this.anchor + }; + this.annotationService.persist(replyToCreate).pipe(takeUntil(this._destroyed)) + .subscribe( + complete => this.onCallbackSuccess(), + error => this.onCallbackError(error) + ); } private refreshAnnotations() { - // this.threadReplyTextsFG.forEach(element => { - // element.reset(); - // }); + this.threadReplyTextsFG.forEach(element => { + element.reset(); + }); this.loadThreads(); } @@ -144,7 +153,7 @@ export class AnnotationDialogComponent extends BaseComponent { resetFormGroup() { this.threadFormGroup.reset(); - this.threadFormGroup.get('annotationProtectionType').setValue(AnnotationProtectionType.EntityAccessors); + this.threadFormGroup.get('protectionType').setValue(AnnotationProtectionType.EntityAccessors); } isValidText(text: string): boolean { @@ -166,6 +175,9 @@ export class AnnotationDialogComponent extends BaseComponent { // ); // } + public isFormValid(value: any) { + return value.valid; + } private onCallbackSuccess() { this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html index c7df370ba..9e791de12 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html @@ -129,6 +129,7 @@
- - +
+
+ +
+
+ +
+
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html index 7cd5c7b3c..45a2dfba5 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html @@ -16,6 +16,9 @@
+ {{field.id}} + {{field.data.multipleSelect}} + {{propertiesFormGroup?.get(field.id).value | json}} @@ -63,7 +66,7 @@
-
+
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html index 34b3a18fd..ff30e640b 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html @@ -10,13 +10,14 @@
-
+
- +
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts index 0db05404b..54aa1c6e8 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.ts @@ -17,6 +17,7 @@ import { ToCEntry } from '../../../table-of-contents/models/toc-entry'; import { ToCEntryType } from '../../../table-of-contents/models/toc-entry-type.enum'; import { LinkToScroll } from '../../../table-of-contents/table-of-contents.component'; import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service'; +import { Guid } from '@common/types/guid'; @Component({ @@ -31,6 +32,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On @Input() propertiesFormGroup: UntypedFormGroup; @Input() visibilityRulesService: VisibilityRulesService; @Input() path: string; + @Input() descriptionId: Guid; // @Input() datasetProfileId: String; // @Input() form: UntypedFormGroup; @@ -74,7 +76,8 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On } } - onAskedToScroll(id: string) { + onAskedToScroll(event:MouseEvent, id: string) { + event.stopPropagation(); this.panelExpanded = true; this.askedToScroll.emit(id); } diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html index 41d080c5c..bd134f9d4 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.html @@ -15,7 +15,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts index 35116709c..049df31f5 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.component.ts @@ -7,6 +7,7 @@ import { LinkToScroll } from '../table-of-contents/table-of-contents.component'; import { Rule } from './visibility-rules/models/rule'; import { VisibilityRulesService } from './visibility-rules/visibility-rules.service'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; +import { Guid } from '@common/types/guid'; @Component({ selector: 'app-description-form', @@ -18,6 +19,8 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A @Input() propertiesFormGroup: UntypedFormGroup; @Input() descriptionTemplate: DescriptionTemplate; @Input() visibilityRulesService: VisibilityRulesService; + @Input() descriptionId: Guid; + // @ViewChild('stepper', { static: false }) stepper: MatStepper; @Input() path: string; @@ -94,8 +97,8 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A } onAskedToScroll(panel: MatExpansionPanel, id?: string) { - panel.open(); - this.fieldsetFocusChange.emit(id); + // panel.open(); + // this.fieldsetFocusChange.emit(id); }