From 067e81207f9b9f632aefec197b073d3bcb007bb8 Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Wed, 28 Feb 2024 15:41:36 +0200 Subject: [PATCH] prefill popup refactor --- .../core/model/annotation.model.ts | 38 ++- .../common/enum/annotation-entity-type.ts | 4 + .../enum/annotation-protection-type.enum.ts | 4 + .../annotation-dialog.component.html | 149 +++++++++ .../annotation-dialog.component.scss | 68 ++++ .../annotation-dialog.component.ts | 197 +++++++++++ .../annotation-dialog.module.ts | 20 ++ .../editor/description-editor.component.ts | 56 +++- .../editor/description-editor.module.ts | 6 +- .../field-set-title.component.html | 2 +- .../field-set-title.component.ts | 1 - .../form-field-set.component.html | 3 + .../form-field-set.component.scss | 6 + .../form-field-set.component.ts | 25 ++ .../description-form.module.ts | 4 +- .../prefill-description.component.html | 42 +-- .../prefill-description.component.scss | 2 +- .../prefill-description.component.ts | 306 +++++++++--------- dmp-frontend/src/assets/i18n/en.json | 13 + 19 files changed, 738 insertions(+), 208 deletions(-) create mode 100644 dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts create mode 100644 dmp-frontend/src/app/core/common/enum/annotation-protection-type.enum.ts create mode 100644 dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html create mode 100644 dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.scss create mode 100644 dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts create mode 100644 dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.module.ts diff --git a/dmp-frontend/src/annotation-service/core/model/annotation.model.ts b/dmp-frontend/src/annotation-service/core/model/annotation.model.ts index 7974172e5..f61a3763a 100644 --- a/dmp-frontend/src/annotation-service/core/model/annotation.model.ts +++ b/dmp-frontend/src/annotation-service/core/model/annotation.model.ts @@ -1,21 +1,27 @@ -import { IsActive } from "@app/core/common/enum/is-active.enum"; +import { AnnotationProtectionType } from "@app/core/common/enum/annotation-protection-type.enum"; +import { User } from "@app/core/model/user/user"; +import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model"; import { Guid } from "@common/types/guid"; -export interface Annotation { - id: Guid; - entityId: Guid; - entityType: string; - anchor?: string; - payload: string; - createdAt: Date; - updatedAt: Date; - isActive: IsActive; +export interface Annotation extends BaseEntity { + entityId: Guid; + entityType: string; + anchor?: string; + payload: string; + timeStamp: Date; + author: User; + threadId: Guid; + parent: Annotation; + protection: AnnotationProtectionType; } -export interface AnnotationPersist { - subjectId: Guid; - entityId: Guid; - entityType: string; - anchor: string; - payload: string; +export interface AnnotationPersist extends BaseEntityPersist { + subjectId: Guid; + entityId: Guid; + entityType: string; + anchor: string; + payload: string; + threadId?: Guid; + parentId?: Guid; + protection: AnnotationProtectionType; } \ No newline at end of file diff --git a/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts b/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts new file mode 100644 index 000000000..ae1df923f --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/annotation-entity-type.ts @@ -0,0 +1,4 @@ +export enum AnnotationEntityType { + Description = "description", + Dmp = "dmp" +} diff --git a/dmp-frontend/src/app/core/common/enum/annotation-protection-type.enum.ts b/dmp-frontend/src/app/core/common/enum/annotation-protection-type.enum.ts new file mode 100644 index 000000000..109de1ff3 --- /dev/null +++ b/dmp-frontend/src/app/core/common/enum/annotation-protection-type.enum.ts @@ -0,0 +1,4 @@ +export enum AnnotationProtectionType { + Private = 0, + EntityAccessors = 1 +} 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 new file mode 100644 index 000000000..c0ba38570 --- /dev/null +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html @@ -0,0 +1,149 @@ +
+
+ + +
+
+ + + {{threadFormGroup.get('text').getError('backendError')?.message}} + {{'COMMONS.VALIDATION.REQUIRED' | translate}} + + +
+ +
+
+
+
{{'APP.ANNOTATION.TITLE' | translate}}
+
+
+ +
+
+
+
+
+
+
+
+
+
{{thread.timeStamp | date:'EEEE, MMMM d, y, h:mm a'}}
+
{{getAnnotationProtectionType(thread)}}
+
{{getAnnotationProtectionType(thread)}}
+
{{getAnnotationProtectionType(thread)}}
+
{{thread.text}}
+
+ {{'APP.ANNOTATION.THREADS.FROM-USER' | translate}} {{thread.author.name}} + + +
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
{{annotation.timeStamp | date:'EEEE, MMMM d, y, h:mm a'}}
+
{{annotation.text}}
+
+ {{'APP.ANNOTATION.THREADS.FROM-USER' | translate}} + {{annotation.author.name}} + +
+
+
+
+
+
+
+ + +
+
+ + + {{'COMMONS.VALIDATION.REQUIRED' | translate}} + +
+ +
+
+
+
+
+
+
+
+
+ close +
+
+
+ +
+

{{'NAV-BAR.START-NEW-DMP' | translate}}

+
+
+

{{'NAV-BAR.START-NEW-DMP-TXT' | translate}}

+
+
+
+
+ +
+
+

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

+
+
+ +
+
+
+
+
+
+ info +
+ + {{'GENERAL.START-NEW-DMP-DIALOG.IMPORT' | translate }} {{'GENERAL.START-NEW-DMP-DIALOG.FUNCTION-SUPPORTS' | translate }} + {{'GENERAL.START-NEW-DMP-DIALOG.JSON-FILES' | translate }} {{'GENERAL.START-NEW-DMP-DIALOG.PRODUCED' | translate }} + {{'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.scss b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.scss new file mode 100644 index 000000000..d59032e36 --- /dev/null +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.scss @@ -0,0 +1,68 @@ +::ng-deep .mat-dialog-container { + border-radius: 8px; +} + +.form-container { + width: 33rem; + min-height: 14rem; + padding: 0.28rem 0.34rem 0.875rem 0.625rem; +} + +.logo { + width: 8.44rem; +} + +.close-icon { + cursor: pointer; + // margin-right: 20px; + padding: .4rem; + width: auto !important; + height: auto !important; +} + +.close-icon:hover { + background-color: #ECECED !important; + border-radius: 50%; +} + +.content { + margin: 2.17rem 2.304rem 1.1875rem 3.065rem; +} + +.title, +.text { + font-size: 1.25rem; + font-weight: lighter; + color: #000000; + opacity: 0.8; +} + +.title { + font-size: 2.375rem; + margin-bottom: 1.1875rem; +} + +.text { + margin-bottom: 2.9375rem; + line-height: 1.9rem; +} + +.upload-btn { + background-color: white; + color: #212121; + font-weight: bold; + box-shadow: 0px 3px 6px #1e202029; + border: 2px solid #212121; +} + +.actions { + width: 26.667rem; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.warn { + color: #f16868; +} 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 new file mode 100644 index 000000000..725d65c87 --- /dev/null +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts @@ -0,0 +1,197 @@ +import { HttpClient } from '@angular/common/http'; +import { Component, Inject } from '@angular/core'; +import { FormBuilder, FormControl, UntypedFormGroup, Validators } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { Annotation, AnnotationPersist } from '@annotation-service/core/model/annotation.model'; +import { AnnotationLookup } from '@annotation-service/core/query/annotation.lookup'; +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 { isNullOrUndefined } from '@app/utilities/enhancers/utils'; +import { BaseComponent } from '@common/base/base.component'; +import { FormService } from '@common/forms/form-service'; +import { Guid } from '@common/types/guid'; +import { TranslateService } from '@ngx-translate/core'; +import { takeUntil } from 'rxjs/operators'; +import { nameof } from 'ts-simple-nameof'; + +@Component({ + selector: 'app-start-new-dmp', + templateUrl: './annotation-dialog.component.html', + styleUrls: ['./annotation-dialog.component.scss'] +}) +export class AnnotationDialogComponent extends BaseComponent { + + private entityId: Guid; + private anchor: string; + private entityType: string; + // public annotations: Array = []; + + public threads = new Array(); + public annotationsPerThread = {}; + threadReplyTextsFG: Array; + threadFormGroup: UntypedFormGroup; + private formBuilder: FormBuilder = new FormBuilder(); + + + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any, + private router: Router, + public dialog: MatDialog, + private uiNotificationService: UiNotificationService, + private language: TranslateService, + private annotationService: AnnotationService, + private formService: FormService + ) { + super(); + this.entityId = data.entityId; + this.anchor = data.anchor; + this.entityType = data.entityType; + } + + 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(); + // } + } + + 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) + // ); + } + + 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) + // ); + } + + private refreshAnnotations() { + // this.threadReplyTextsFG.forEach(element => { + // element.reset(); + // }); + this.loadThreads(); + } + + private loadThreads() { + const lookup: AnnotationLookup = new AnnotationLookup(); + lookup.entityIds = [this.entityId]; + // lookup.anchors = [this.anchor]; + lookup.entityTypes = [this.entityType]; + lookup.project = { + fields: [ + nameof(x => x.id), + // nameof(x => x.threadId), + // nameof(x => x.threadId), + // nameof(x => x.timeStamp), + // nameof(x => x.author.name), + nameof(x => x.payload), + // nameof(x => x.protection), + ] + }; + + this.annotationService.query(lookup) + .pipe(takeUntil(this._destroyed)) + .subscribe( + data => { + // this.annotationsPerThread = {}; + // this.threadReplyTextsFG = new Array(); + // this.resetFormGroup(); + // this.threads = data.items.filter(item => item.id === item.threadId).sort((a1, a2) => new Date(a2.timeStamp).getTime() - new Date(a1.timeStamp).getTime()); + // this.threads.forEach(element => { + // // this.threadReplyTextsFG.addControl(element.id.toString(), new FormControl(null)); + // this.threadReplyTextsFG[element.id.toString()] = this.fb.group({ replyText: new FormControl(null, [Validators.required]) }); + // this.annotationsPerThread[element.id.toString()] = data.items.filter(x => x.threadId === element.id && x.id !== element.id).sort((a1, a2) => new Date(a1.timeStamp).getTime() - new Date(a2.timeStamp).getTime()); + // }); + // // this.annotationsChanged.emit(this.threads); + }, + error => this.onCallbackError(error), + ); + } + + resetFormGroup() { + this.threadFormGroup.reset(); + this.threadFormGroup.get('annotationProtectionType').setValue(AnnotationProtectionType.EntityAccessors); + } + + isValidText(text: string): boolean { + return !isNullOrUndefined(text) && text.length !== 0 && text !== ''; + } + + // ngOnInit() { + // const lookup: AnnotationLookup = new AnnotationLookup(); + // lookup.entityIds = [this.entityId]; + // // lookup.anchors = [this.anchor]; + // lookup.entityTypes = [this.entityType]; + + // this.annotationService.query(lookup).pipe(takeUntil(this._destroyed)) + // .subscribe( + // data => { + // this.annotations = data.items; + // }, + // error => this.onCallbackError(error) + // ); + // } + + + private onCallbackSuccess() { + this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); + this.router.navigate(['/reload']).then(() => this.router.navigate(['/plans'])); + // this.router.navigate(['/reload']).then(() => this.isPublic ? this.router.navigate(['/explore-plans']) : this.router.navigate(['/plans'])); + } + + private onCallbackError(error: any) { + this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error); + } + + + cancel() { + this.dialogRef.close(); + } + + send() { + this.dialogRef.close(this.data); + } + + close() { + this.dialogRef.close(false); + } + + startWizard() { + this.router.navigate(['/plans/new']); + this.close(); + } +} diff --git a/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.module.ts b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.module.ts new file mode 100644 index 000000000..92b80ffb6 --- /dev/null +++ b/dmp-frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { FormattingModule } from '@app/core/formatting.module'; +import { CommonFormsModule } from '@common/forms/common-forms.module'; +import { CommonUiModule } from '@common/ui/common-ui.module'; +import { AnnotationDialogComponent } from './annotation-dialog.component'; + +@NgModule({ + imports: [ + CommonUiModule, + CommonFormsModule, + FormattingModule, + ], + declarations: [ + AnnotationDialogComponent, + ], + exports: [ + AnnotationDialogComponent, + ] +}) +export class AnnotationDialogModule { } diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts index ae4398e90..925f5837e 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts @@ -1,26 +1,27 @@ +import { DatePipe } from '@angular/common'; import { Component, OnInit, ViewChild } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; +import { Description, DescriptionPersist } from '@app/core/model/description/description'; import { AuthService } from '@app/core/services/auth/auth.service'; +import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; +import { DescriptionService } from '@app/core/services/description/description.service'; +import { DmpService } from '@app/core/services/dmp/dmp.service'; import { LockService } from '@app/core/services/lock/lock.service'; +import { LoggingService } from '@app/core/services/logging/logging-service'; import { MatomoService } from '@app/core/services/matomo/matomo-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; -import { FileUtils } from '@app/core/services/utilities/file-utils.service'; -import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; -import { DatePipe } from '@angular/common'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { Description, DescriptionPersist } from '@app/core/model/description/description'; -import { DescriptionService } from '@app/core/services/description/description.service'; -import { LoggingService } from '@app/core/services/logging/logging-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; +import { FileUtils } from '@app/core/services/utilities/file-utils.service'; import { QueryParamsService } from '@app/core/services/utilities/query-params.service'; +import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service'; import { isNullOrUndefined } from '@app/utilities/enhancers/utils'; import { BaseEditor } from '@common/base/base-editor'; @@ -34,12 +35,10 @@ import { map, takeUntil } from 'rxjs/operators'; import { DescriptionEditorModel, DescriptionPropertyDefinitionEditorModel } from './description-editor.model'; import { DescriptionEditorResolver } from './description-editor.resolver'; import { DescriptionEditorService } from './description-editor.service'; +import { PrefillDescriptionDialogComponent } from './prefill-description/prefill-description.component'; import { ToCEntry } from './table-of-contents/models/toc-entry'; -import { TableOfContentsComponent } from './table-of-contents/table-of-contents.component'; import { ToCEntryType } from './table-of-contents/models/toc-entry-type.enum'; -import { DmpService } from '@app/core/services/dmp/dmp.service'; -import { DescriptionTemplateSection } from '@app/core/model/description-template/description-template'; -import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; +import { TableOfContentsComponent } from './table-of-contents/table-of-contents.component'; @Component({ selector: 'app-description-editor-component', @@ -140,12 +139,18 @@ export class DescriptionEditorComponent extends BaseEditor { - const isPublicDescription = params['public']; + const itemId = params['id']; + const dmpId = params['dmpId']; + const dmpSectionId = params['dmpSectionId']; + + const isPublicDescription = params['public']; const newDmpId = params['newDmpId']; + + // const publicId = params['publicId']; // this.dmpId = params['dmpId']; // this.dmpSectionIndex = parseInt(params['dmpSectionIndex']); @@ -237,6 +242,29 @@ export class DescriptionEditorComponent extends BaseEditor { + if (result) { + // this.descriptionModel = this.descriptionModel.fromModel(result); + // this.descriptionModel.dmp = data; + // this.descriptionModel.dmpSectionIndex = this.dmpSectionIndex; + // this.formGroup = this.descriptionModel.buildForm(); + // this.formGroupRawValue = JSON.parse(JSON.stringify(this.formGroup.getRawValue())); + // this.formGroup.get('dmp').disable(); + // this.loadDescriptionProfiles(); + // this.registerFormListeners(); + } + }) } // if (this.itemId != null && this.newDmpId == null) { diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.module.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.module.ts index 350589979..23a6ecdd5 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.module.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.module.ts @@ -12,6 +12,7 @@ import { DescriptionFormProgressIndicationModule } from './form-progress-indicat import { TableOfContentsModule } from './table-of-contents/table-of-contents.module'; import { RichTextEditorModule } from '@app/library/rich-text-editor/rich-text-editor.module'; import { TagsFieldModule } from '@app/ui/tag/tags-field/tags-field.module'; +import { PrefillDescriptionDialogComponent } from './prefill-description/prefill-description.component'; @NgModule({ imports: [ @@ -28,12 +29,13 @@ import { TagsFieldModule } from '@app/ui/tag/tags-field/tags-field.module'; ], declarations: [ DescriptionEditorComponent, - DescriptionBaseFieldsEditorComponent + DescriptionBaseFieldsEditorComponent, + PrefillDescriptionDialogComponent ], exports: [ ], providers: [ - VisibilityRulesService + VisibilityRulesService, ] }) export class DescriptionEditorModule { } diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.html index a4ff6dc86..bd01cfe40 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.html @@ -21,4 +21,4 @@ {{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.VIEW-LESS' | translate}} - + \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.ts index 1efc1733a..a237e2229 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/field-set-title/field-set-title.component.ts @@ -18,5 +18,4 @@ export class DescriptionFormFieldSetTitleComponent implements OnInit { ngOnInit() { } - } diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html index 8e3faf1b5..84b84ee64 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.html @@ -1,6 +1,9 @@
+
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.scss b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.scss index 20b9e2f82..2fddd967e 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.scss +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.scss @@ -6,3 +6,9 @@ width: 110px; display: flex; } + +.annotation-icon{ + margin-top: 1.625rem; + width: auto; + height: auto; +} \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts index d3ed1c9fc..68d735d1e 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field-set/form-field-set.component.ts @@ -10,6 +10,9 @@ import { DescriptionPropertyDefinitionEditorModel, DescriptionPropertyDefinition import { FormFieldSetEditorDialogComponent } from './dialog-editor/form-fieldset-editor-dialog.component'; import { cloneAbstractControl } from '@app/utilities/enhancers/utils'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; +import { Guid } from '@common/types/guid'; +import { AnnotationDialogComponent } from '@app/ui/annotations/annotation-dialog-component/annotation-dialog.component'; +import { AnnotationEntityType } from '@app/core/common/enum/annotation-entity-type'; @Component({ selector: 'app-description-form-field-set', @@ -21,6 +24,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent { @Input() fieldSet: DescriptionTemplateFieldSet; @Input() propertiesFormGroup: UntypedFormGroup; + @Input() descriptionId: Guid; get isMultiplicityEnabled() { return this.fieldSet.multiplicity != null && this.fieldSet.multiplicity.min != 0 && this.fieldSet.multiplicity.max != 0; @@ -114,6 +118,27 @@ export class DescriptionFormFieldSetComponent extends BaseComponent { }); } + // + // + // Annotations + // + // + showAnnotations(fieldSetId: string) { + const dialogRef = this.dialog.open(AnnotationDialogComponent, { + width: '528px', + data: { + entityId: this.descriptionId, + anchor: fieldSetId, + entityType: AnnotationEntityType.Description + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result && result.success) { + //TODO refactor + } + }); + } + // deleteCompositeFieldFormGroup() { diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts index bab54aee1..a9d4deb9c 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { FormattingModule } from "@app/core/formatting.module"; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; +import { AnnotationDialogModule } from '@app/ui/annotations/annotation-dialog-component/annotation-dialog.module'; import { ReferenceFieldModule } from '@app/ui/reference/reference-field/reference-field.module'; import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; @@ -22,7 +23,8 @@ import { DescriptionFormComponent } from './description-form.component'; RichTextEditorModule, NgxDropzoneModule, FormattingModule, - ReferenceFieldModule + ReferenceFieldModule, + AnnotationDialogModule ], declarations: [ DescriptionFormComponent, diff --git a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.html b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.html index b6d159d7b..8e416f9c2 100644 --- a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.html +++ b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.html @@ -1,7 +1,7 @@
-
- {{'DATASET-CREATE-WIZARD.PREFILL-STEP.TITLE' | translate}} - + {{'PREFILL-DESCRIPTION-DIALOG.TITLE' | translate}} + close
@@ -10,48 +10,48 @@
- {{'DATASET-CREATE-WIZARD.PREFILL-STEP.HINT' | translate}} + {{'PREFILL-DESCRIPTION-DIALOG.HINT' | translate}}
-
+
-
{{'DATASET-CREATE-WIZARD.PREFILL-STEP.OR' | translate}}
+ (click)="closeDialog()">{{'PREFILL-DESCRIPTION-DIALOG.ACTIONS.MANUALLY' | translate}} +
{{'PREFILL-DESCRIPTION-DIALOG.OR' | translate}}
+ (click)="prefillSelected = true">{{'PREFILL-DESCRIPTION-DIALOG.ACTIONS.PREFILL' | translate}}
-
+
-

{{'DATASET-CREATE-WIZARD.PREFILL-STEP.PROFILE' | translate}}

+

{{'PREFILL-DESCRIPTION-DIALOG.DESCRIPTION-TEMPLATE' | translate}}

- - -
- {{profile.label}} + + +
+ {{descriptionTempalte.label}}
- {{prefillForm.get('profile').getError('backendError').message}} + {{prefillForm.get('descriptionTempalte').getError('backendError').message}}
-
+
-
+
+ (click)="next()">{{'PREFILL-DESCRIPTION-DIALOG.ACTIONS.NEXT' | translate}}
diff --git a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.scss b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.scss index 7a892e68b..db6af9d12 100644 --- a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.scss +++ b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.scss @@ -9,7 +9,7 @@ } .template-title { - margin-left: 37px; + margin-left: 1em; white-space: nowrap; width: 480px; overflow: hidden; diff --git a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts index 08bdc21d1..029f96224 100644 --- a/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/prefill-description/prefill-description.component.ts @@ -1,42 +1,46 @@ import { Component, Inject, OnInit } from "@angular/core"; import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from "@angular/material/dialog"; -import { DatasetProfileModel } from "@app/core/model/dataset/dataset-profile"; -import { Prefilling } from "@app/core/model/dataset/prefilling"; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, FieldInSection } from "@app/core/model/dmp-blueprint/dmp-blueprint"; +import { DescriptionTemplate } from "@app/core/model/description-template/description-template"; +import { Dmp } from "@app/core/model/dmp/dmp"; import { DmpBlueprintService } from "@app/core/services/dmp/dmp-blueprint.service"; import { PrefillingService } from "@app/core/services/prefilling.service"; import { ProgressIndicationService } from "@app/core/services/progress-indication/progress-indication-service"; -import { SingleAutoCompleteConfiguration } from "@app/library/auto-complete/single/single-auto-complete-configuration"; -import { PopupNotificationDialogComponent } from "@app/library/notification/popup/popup-notification.component"; import { BaseComponent } from "@common/base/base.component"; import { Guid } from "@common/types/guid"; import { TranslateService } from "@ngx-translate/core"; -import { Observable } from "rxjs"; -import { map, takeUntil } from "rxjs/operators"; -import { nameof } from "ts-simple-nameof"; +import { UUID } from "crypto"; +import { takeUntil } from "rxjs/operators"; @Component({ - selector: 'prefill-dataset-component', - templateUrl: 'prefill-dataset.component.html', - styleUrls: ['prefill-dataset.component.scss'] + selector: 'prefill-description-component', + templateUrl: 'prefill-description.component.html', + styleUrls: ['prefill-description.component.scss'] }) -export class PrefillDatasetComponent extends BaseComponent implements OnInit { +export class PrefillDescriptionDialogComponent extends BaseComponent implements OnInit { progressIndication = false; - prefillAutoCompleteConfiguration: SingleAutoCompleteConfiguration; - isPrefilled: boolean = false; + // prefillAutoCompleteConfiguration: SingleAutoCompleteConfiguration; + prefillSelected: boolean = false; prefillForm: UntypedFormGroup; - constructor(public dialogRef: MatDialogRef, - private prefillingService: PrefillingService, - private dmpBlueprintService: DmpBlueprintService, - private dialog: MatDialog, - private language: TranslateService, + dmp: Dmp; + dmpSectionId: Guid; + availableDescriptionTempaltes: DescriptionTemplate[] = []; + + constructor(public dialogRef: MatDialogRef, + // private prefillingService: PrefillingService, + // private dmpBlueprintService: DmpBlueprintService, + // private dialog: MatDialog, + // private language: TranslateService, private progressIndicationService: ProgressIndicationService, private fb: UntypedFormBuilder, @Inject(MAT_DIALOG_DATA) public data: any) { super(); + + this.dmp = data.dmp; + this.dmpSectionId = data.dmpSectionId; + this.availableDescriptionTempaltes = this.dmp.dmpDescriptionTemplates.filter(x => x.sectionId == this.dmpSectionId).map(x => x.currentDescriptionTemplate); } ngOnInit() { @@ -45,153 +49,153 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit { }); this.prefillForm = this.fb.group({ type: this.fb.control(false), - profile: this.fb.control('', Validators.required), + descriptionTempalte: this.fb.control('', Validators.required), prefill: this.fb.control(null, Validators.required) }) - if (this.data.availableProfiles && this.data.availableProfiles.length === 1) { - this.addProfileIfUsedLessThanMax(this.data.availableProfiles[0]); - } - this.prefillAutoCompleteConfiguration = { - filterFn: this.searchDatasets.bind(this), - loadDataOnStart: false, - displayFn: (item) => (item['name'].length > 60) ? (item['name'].substr(0, 60) + "...") : item['name'], - titleFn: (item) => item['name'], - subtitleFn: (item) => item['pid'] - }; + // if (this.data.availableProfiles && this.data.availableProfiles.length === 1) { + // this.addProfileIfUsedLessThanMax(this.data.availableProfiles[0]); + // } + // this.prefillAutoCompleteConfiguration = { + // filterFn: this.searchDescriptions.bind(this), + // loadDataOnStart: false, + // displayFn: (item) => (item['name'].length > 60) ? (item['name'].substr(0, 60) + "...") : item['name'], + // titleFn: (item) => item['name'], + // subtitleFn: (item) => item['pid'] + // }; } - addProfileIfUsedLessThanMax(profile: DatasetProfileModel) { - const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value; - const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id; - this.dmpBlueprintService.getSingle(blueprintId, this.getBlueprintDefinitionFields()) - .pipe(takeUntil(this._destroyed)) - .subscribe(result => { - const section = result.definition.sections[dmpSectionIndex]; - if (section.hasTemplates) { - const foundTemplate = section.descriptionTemplates.find(template => template.descriptionTemplateId === Guid.parse(profile.id)); - if (foundTemplate !== undefined) { - let count = 0; - if (this.data.datasetFormGroup.get('dmp').value.datasets != null) { - for (let dataset of this.data.datasetFormGroup.get('dmp').value.datasets) { - if (dataset.dmpSectionIndex === dmpSectionIndex && dataset.profile.id === foundTemplate.descriptionTemplateId) { - count++; - } - } - if (count < foundTemplate.maxMultiplicity) { - this.prefillForm.get('profile').patchValue(profile); - } - } - } - else { - this.prefillForm.get('profile').patchValue(profile); - } - } - else { - this.prefillForm.get('profile').patchValue(profile); - } - }); - } + // addProfileIfUsedLessThanMax(profile: DescriptionProfileModel) { + // const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value; + // const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id; + // this.dmpBlueprintService.getSingle(blueprintId, this.getBlueprintDefinitionFields()) + // .pipe(takeUntil(this._destroyed)) + // .subscribe(result => { + // const section = result.definition.sections[dmpSectionIndex]; + // if (section.hasTemplates) { + // const foundTemplate = section.descriptionTemplates.find(template => template.descriptionTemplateId === Guid.parse(profile.id)); + // if (foundTemplate !== undefined) { + // let count = 0; + // if (this.data.datasetFormGroup.get('dmp').value.datasets != null) { + // for (let dataset of this.data.datasetFormGroup.get('dmp').value.datasets) { + // if (dataset.dmpSectionIndex === dmpSectionIndex && dataset.profile.id === foundTemplate.descriptionTemplateId) { + // count++; + // } + // } + // if (count < foundTemplate.maxMultiplicity) { + // this.prefillForm.get('profile').patchValue(profile); + // } + // } + // } + // else { + // this.prefillForm.get('profile').patchValue(profile); + // } + // } + // else { + // this.prefillForm.get('profile').patchValue(profile); + // } + // }); + // } - checkMinMax(event, profile: DatasetProfileModel) { - event.stopPropagation(); - const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value; - const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id; - this.dmpBlueprintService.getSingle(blueprintId, this.getBlueprintDefinitionFields()) - .pipe(takeUntil(this._destroyed)) - .subscribe(result => { - const section = result.definition.sections[dmpSectionIndex]; - if (section.hasTemplates) { - const foundTemplate = section.descriptionTemplates.find(template => template.descriptionTemplateId === Guid.parse(profile.id)); - if (foundTemplate !== undefined) { - let count = 0; - if (this.data.datasetFormGroup.get('dmp').value.datasets != null) { - for (let dataset of this.data.datasetFormGroup.get('dmp').value.datasets) { - if (dataset.dmpSectionIndex === dmpSectionIndex && dataset.profile.id === foundTemplate.descriptionTemplateId) { - count++; - } - } - if (count === foundTemplate.maxMultiplicity) { - this.dialog.open(PopupNotificationDialogComponent, { - data: { - title: this.language.instant('DATASET-EDITOR.MAX-DESCRIPTION-DIALOG.TITLE'), - message: this.language.instant('DATASET-EDITOR.MAX-DESCRIPTION-DIALOG.MESSAGE') - }, maxWidth: '30em' - }); - } - else { - this.prefillForm.get('profile').setValue(profile); - } - } - } - else { - this.prefillForm.get('profile').setValue(profile); - } - } - else { - this.prefillForm.get('profile').setValue(profile); - } - }); - } + // checkMinMax(event, profile: DescriptionProfileModel) { + // event.stopPropagation(); + // const dmpSectionIndex = this.data.datasetFormGroup.get('dmpSectionIndex').value; + // const blueprintId = this.data.datasetFormGroup.get('dmp').value.profile.id; + // this.dmpBlueprintService.getSingle(blueprintId, this.getBlueprintDefinitionFields()) + // .pipe(takeUntil(this._destroyed)) + // .subscribe(result => { + // const section = result.definition.sections[dmpSectionIndex]; + // if (section.hasTemplates) { + // const foundTemplate = section.descriptionTemplates.find(template => template.descriptionTemplateId === Guid.parse(profile.id)); + // if (foundTemplate !== undefined) { + // let count = 0; + // if (this.data.datasetFormGroup.get('dmp').value.datasets != null) { + // for (let dataset of this.data.datasetFormGroup.get('dmp').value.datasets) { + // if (dataset.dmpSectionIndex === dmpSectionIndex && dataset.profile.id === foundTemplate.descriptionTemplateId) { + // count++; + // } + // } + // if (count === foundTemplate.maxMultiplicity) { + // this.dialog.open(PopupNotificationDialogComponent, { + // data: { + // title: this.language.instant('DATASET-EDITOR.MAX-DESCRIPTION-DIALOG.TITLE'), + // message: this.language.instant('DATASET-EDITOR.MAX-DESCRIPTION-DIALOG.MESSAGE') + // }, maxWidth: '30em' + // }); + // } + // else { + // this.prefillForm.get('profile').setValue(profile); + // } + // } + // } + // else { + // this.prefillForm.get('profile').setValue(profile); + // } + // } + // else { + // this.prefillForm.get('profile').setValue(profile); + // } + // }); + // } - private getBlueprintDefinitionFields() { - return [ - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), + // private getBlueprintDefinitionFields() { + // return [ + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.description)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.category)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.systemFieldType)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.placeholder)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.description)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.required)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.id)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.category)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.systemFieldType)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.label)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.placeholder)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.description)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.required)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.fields), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.id)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateId)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.label)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.minMultiplicity)].join('.'), - [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), - ] - } + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.id)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateId)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.label)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.minMultiplicity)].join('.'), + // [nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.maxMultiplicity)].join('.'), + // ] + // } public compareWith(object1: any, object2: any) { return object1 && object2 && object1.id === object2.id; } - searchDatasets(query: string): Observable { - return this.prefillingService.getPrefillingList(query).pipe(map(prefilling => prefilling.sort((a, b) => { - if (a.name > b.name) { - return 1; - } else if (a.name < b.name) { - return -1; - } else { - return 0; - } - }))); - } + // searchDescriptions(query: string): Observable { + // return this.prefillingService.getPrefillingList(query).pipe(map(prefilling => prefilling.sort((a, b) => { + // if (a.name > b.name) { + // return 1; + // } else if (a.name < b.name) { + // return -1; + // } else { + // return 0; + // } + // }))); + // } next() { - if (this.isPrefilled) { - if (this.prefillForm.get('prefill').value.data == null) { - this.prefillingService.getPrefillingDataset(this.prefillForm.get('prefill').value.pid, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.key).subscribe(wizard => { - wizard.profile = this.prefillForm.get('profile').value; - this.closeDialog(wizard); - }); - } - else { - this.prefillingService.getPrefillingDatasetUsingData(this.prefillForm.get('prefill').value.data, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.key).subscribe(wizard => { - wizard.profile = this.prefillForm.get('profile').value; - this.closeDialog(wizard); - }); - } - } else { - this.closeDialog(); - } + // if (this.isPrefilled) { + // if (this.prefillForm.get('prefill').value.data == null) { + // this.prefillingService.getPrefillingDescription(this.prefillForm.get('prefill').value.pid, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.key).subscribe(wizard => { + // wizard.profile = this.prefillForm.get('profile').value; + // this.closeDialog(wizard); + // }); + // } + // else { + // this.prefillingService.getPrefillingDescriptionUsingData(this.prefillForm.get('prefill').value.data, this.prefillForm.get('profile').value.id, this.prefillForm.get('prefill').value.key).subscribe(wizard => { + // wizard.profile = this.prefillForm.get('profile').value; + // this.closeDialog(wizard); + // }); + // } + // } else { + // this.closeDialog(); + // } } closeDialog(result = null): void { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index ec587ef85..7270c7fb6 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -1061,6 +1061,19 @@ "DISCARD": "Discard" } }, + "PREFILL-DESCRIPTION-DIALOG": { + "TITLE": "Initialize your Dataset", + "OR": "OR", + "HINT": "Select the dataset from Zenodo to automatically retrieve answers to some questions in your template or start by answering the questions manually.", + "DESCRIPTION-TEMPLATE": "Description Template", + "SEARCH-HEADER": "Prefilled object", + "SEARCH": "Start typing to search for an entity to use for prefilling", + "ACTIONS": { + "NEXT": "Next", + "PREFILL": "Prefill", + "MANUALLY": "Manually" + } + }, "DATASET-PUBLIC-LISTING": { "TITLE": "Published Datasets", "TOOLTIP": {