diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html index 0b64347ff..1438d3bec 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/radio-box/description-template-editor-radio-box-field.component.html @@ -2,11 +2,10 @@
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE' | translate}}
- + warning_amber {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED'| translate}} - {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED' | translate}} {{form.get('data').get('options').getError('backendError').message}}
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html index 1a3e8c5a5..466dfee8d 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field-type/select/description-template-editor-select-field.component.html @@ -3,7 +3,7 @@
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-SELECT-TITLE' | translate}}
- + warning_amber {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-SELECT-AT-LEAST-ONE-REQUIRED' | translate}} @@ -36,7 +36,6 @@ - {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-RADIO-AT-LEAST-ONE-REQUIRED' | translate}} {{form.get('data').get('options').getError('backendError').message}}
- +
+ 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 75adb93b6..78f36cf83 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 @@ -85,8 +85,8 @@
-
- profile-picture +
@@ -127,8 +127,8 @@
-
- profile-picture +
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 index 165073eaa..b19fd404b 100644 --- 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 @@ -75,11 +75,14 @@ $mat-card-header-size: 40px !default; text-align: center; } -.profile-picture { - height: $mat-card-header-size; - width: $mat-card-header-size; - border-radius: 50%; - flex-shrink: 0; +.account-icon-wrapper { + color: #d5d5d5; +} + +.account-icon { + font-size: 2.5em; + height: auto; + width: auto; } .comment-wrapper { 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 c71d7e771..8ab752844 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 @@ -4,7 +4,7 @@
-
+
@@ -25,49 +25,53 @@
-
-
- - - - -
+ + + +
- -
- -
-
- +
+
+ - - - - - + + + + + + - - - + + + +
diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index e805cfe43..0df34205e 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -165,8 +165,8 @@
-
- {{contactIndex + 1}} +
+ {{contactIndex + 1}} drag_indicator
@@ -176,7 +176,7 @@
-
+
diff --git a/dmp-frontend/src/app/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.ts b/dmp-frontend/src/app/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.ts index ee2a1a835..fff8cbe6c 100644 --- a/dmp-frontend/src/app/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.ts +++ b/dmp-frontend/src/app/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component.ts @@ -1,5 +1,6 @@ +import { fromEvent, Observable, Subscription } from "rxjs"; import { HttpErrorResponse } from '@angular/common/http'; -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { AuthService } from '@app/core/services/auth/auth.service'; @@ -19,10 +20,13 @@ import { IsActive } from '@app/core/common/enum/is-active.enum'; templateUrl: './mine-inapp-notification-listing-dialog.component.html', styleUrls: ['./mine-inapp-notification-listing-dialog.component.scss'] }) -export class MineInAppNotificationListingDialogComponent extends BaseComponent implements OnInit { +export class MineInAppNotificationListingDialogComponent extends BaseComponent implements OnInit, OnDestroy { public inappNotifications = new Array(); public notificationInAppTrackingEnum = NotificationInAppTracking; + resizeObservable: Observable; + resizeSubscription: Subscription; + constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public dialogData: any, @@ -56,6 +60,17 @@ export class MineInAppNotificationListingDialogComponent extends BaseComponent i }, error => this.onCallbackError(error), ); + + this.resizeObservable = fromEvent(window, 'resize'); + this.resizeSubscription = this.resizeObservable + .subscribe(evt =>{ + this.dialogRef.close(); + }); + + } + + ngOnDestroy(): void { + this.resizeSubscription.unsubscribe(); } private onCallbackError(errorResponse: HttpErrorResponse) { diff --git a/dmp-frontend/src/app/ui/navbar/navbar.component.html b/dmp-frontend/src/app/ui/navbar/navbar.component.html index 403d1363f..74721dea0 100644 --- a/dmp-frontend/src/app/ui/navbar/navbar.component.html +++ b/dmp-frontend/src/app/ui/navbar/navbar.component.html @@ -29,7 +29,7 @@ arrow_drop_down - +
diff --git a/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.ts b/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.ts index 0c68bc7fc..79d064214 100644 --- a/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.ts +++ b/dmp-frontend/src/app/ui/navbar/user-dialog/user-dialog.component.ts @@ -1,18 +1,22 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { UntypedFormGroup } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { AuthService } from '../../../core/services/auth/auth.service'; +import { Observable, Subscription, fromEvent } from 'rxjs'; @Component({ selector: 'app-user-dialog-component', templateUrl: 'user-dialog.component.html', styleUrls: ['user-dialog.component.scss'] }) -export class UserDialogComponent implements OnInit { +export class UserDialogComponent implements OnInit, OnDestroy { public formGroup: UntypedFormGroup; + resizeObservable: Observable; + resizeSubscription: Subscription; + constructor( private authentication: AuthService, private router: Router, @@ -21,6 +25,15 @@ export class UserDialogComponent implements OnInit { ) { } ngOnInit(): void { + this.resizeObservable = fromEvent(window, 'resize'); + this.resizeSubscription = this.resizeObservable + .subscribe(evt =>{ + this.dialogRef.close(); + }); + } + + ngOnDestroy(): void { + this.resizeSubscription.unsubscribe(); } public logout(): void { diff --git a/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.html b/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.html new file mode 100644 index 000000000..6365667ae --- /dev/null +++ b/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.html @@ -0,0 +1,38 @@ +
+
+
+ {{'REFERENCE-FIELD.REFERENCE-DIALOG-EDITOR.TITLE' | translate}} {{label}} +
+
+ close +
+
+
+
+
+ + {{field}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+ +
+
+ + {{field.label}} + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+
+ + {{formGroup.value | json}} +
+
+
+
+
+
diff --git a/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.scss b/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.scss new file mode 100644 index 000000000..b1538a730 --- /dev/null +++ b/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.scss @@ -0,0 +1,3 @@ +.close-btn { + cursor: pointer; +} diff --git a/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.ts b/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.ts new file mode 100644 index 000000000..ced2a056b --- /dev/null +++ b/dmp-frontend/src/app/ui/reference/reference-field/editor/reference-dialog-editor.component.ts @@ -0,0 +1,115 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { FormControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type'; +import { ReferenceType, ReferenceTypeDefinition, ReferenceTypeField } from '@app/core/model/reference-type/reference-type'; +import { DefinitionPersist, FieldPersist, ReferencePersist } from '@app/core/model/reference/reference'; +import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; +import { BaseComponent } from '@common/base/base.component'; +import { FormService } from '@common/forms/form-service'; +import { takeUntil } from 'rxjs/operators'; +import { nameof } from 'ts-simple-nameof'; + +@Component({ + templateUrl: 'reference-dialog-editor.component.html', + styleUrls: ['./reference-dialog-editor.component.scss'] +}) +export class ReferenceDialogEditorComponent extends BaseComponent implements OnInit { + formGroup: UntypedFormGroup; + referenceType: ReferenceType; + systemFields: string[]; + label: string = null + + constructor( + private referenceTypeService: ReferenceTypeService, + private fb: UntypedFormBuilder, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any, + private formService: FormService + ) { + super(); + this.label = data.label; + this.formGroup = this.fb.group({}); + } + + ngOnInit(): void { + this.systemFields = this.referenceTypeService.getSystemFields([]); + + this.referenceTypeService.getSingle(this.data.referenceTypeId, this.lookupFields()) + .pipe(takeUntil(this._destroyed)) + .subscribe( + referenceType => { + this.referenceType = referenceType; + this.buildForm(referenceType.definition?.fields); + } + ); + } + + buildForm(fields: ReferenceTypeField[]) { + + this.systemFields.forEach(systemField => { + this.formGroup.setControl(systemField, new FormControl({ value: null, disabled: false }, Validators.required)); + }) + + if (fields != null && fields.length >= 0){ + fields.forEach(x => { + this.formGroup.setControl(x.code, new FormControl({ value: null, disabled: false }, Validators.required)); + }) + } + + } + + send() { + this.formService.touchAllFormFields(this.formGroup); + if (!this.formGroup.valid) { return; } + + this.dialogRef.close(this.buildReferencePersist()); + + } + + buildReferencePersist() : ReferencePersist{ + return { + label: this.formGroup.get(this.systemFields[1]).value, + description: this.formGroup.get(this.systemFields[2]).value, + typeId: this.data.referenceTypeId, + reference: this.formGroup.get(this.systemFields[0]).value, + abbreviation: "", + source: "Internal", + sourceType: ReferenceSourceType.Internal, + definition: this.buildDefinitionPersist(this.referenceType.definition.fields), + } + + } + + buildDefinitionPersist(fields: ReferenceTypeField[]): DefinitionPersist{ + if(fields == null || fields.length == 0) return null; + return { + fields: fields.map(x => this.buildFieldPersist(x)) + } + } + + buildFieldPersist(field: ReferenceTypeField): FieldPersist{ + return { + code: field.code, + dataType: field.dataType, + value: this.formGroup.get(field.code).value, + } + } + + close() { + this.dialogRef.close(false); + } + + private lookupFields(): string[] { + return [ + nameof(x => x.id), + nameof(x => x.name), + nameof(x => x.code), + + [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.code)].join('.'), + [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.label)].join('.'), + [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.dataType)].join('.') + ] + } + +} diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts index b8448ccc6..99957ce50 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts @@ -1,11 +1,15 @@ import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; +import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; +import { MatDialog } from '@angular/material/dialog'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { ReferenceService } from '@app/core/services/reference/reference.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { BaseComponent } from '@common/base/base.component'; +import { takeUntil } from 'rxjs/operators'; +import { ReferenceDialogEditorComponent } from './editor/reference-dialog-editor.component'; +import { ReferencePersist } from '@app/core/model/reference/reference'; @Component({ selector: 'app-reference-field-component', @@ -28,6 +32,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { constructor( private referenceService: ReferenceService, public enumUtils: EnumUtils, + private dialog: MatDialog, ) { super(); } ngOnInit() { @@ -39,17 +44,25 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { } addReference() { - // const dialogRef = this.dialog.open(DatasetExternalDataRepositoryDialogEditorComponent, { - // width: '500px', - // restoreFocus: false, - // data: {} - // }); - // dialogRef.afterClosed() - // .pipe(takeUntil(this._destroyed)) - // .subscribe(result => { - // if (!result) { return; } - // const dataRepositoryModel = new ExternalDataRepositoryEditorModel(result.id, result.name, result.abbreviation, result.uri, result.pid, result.source); - // (this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm()); - // }); + const dialogRef = this.dialog.open(ReferenceDialogEditorComponent, { + width: '500px', + restoreFocus: false, + data: { + referenceTypeId: this.referenceType.id, + label: this.label ?? this.referenceType.name + }, + }); + dialogRef.afterClosed() + .pipe(takeUntil(this._destroyed)) + .subscribe(newResult => { + if (!newResult) { return; } + // const dataRepositoryModel = new ExternalDataRepositoryEditorModel(result.id, result.name, result.abbreviation, result.uri, result.pid, result.source); + // (this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm()); + + let results = this.form.value as ReferencePersist[]; + if (results == undefined) results = []; + results.push(newResult); + this.form.setValue(results); + }); } } diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.module.ts b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.module.ts index 96caafc21..1e06517b1 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.module.ts +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.module.ts @@ -5,6 +5,7 @@ import { DescriptionRoutingModule } from '@app/ui/description/description.routin import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { ReferenceFieldComponent } from './reference-field.component'; +import { ReferenceDialogEditorComponent } from './editor/reference-dialog-editor.component'; @NgModule({ imports: [ @@ -15,10 +16,12 @@ import { ReferenceFieldComponent } from './reference-field.component'; AutoCompleteModule ], declarations: [ - ReferenceFieldComponent + ReferenceFieldComponent, + ReferenceDialogEditorComponent ], exports: [ - ReferenceFieldComponent + ReferenceFieldComponent, + ReferenceDialogEditorComponent ] }) export class ReferenceFieldModule { } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 42c697a77..6cc4950c9 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -1352,6 +1352,9 @@ "COULD-NOT-FIND-MESSAGE": "Couldn't find it?", "ACTIONS": { "INSERT-MANUALLY": "Insert it manually" + }, + "REFERENCE-DIALOG-EDITOR": { + "TITLE": "Add a" } }, "DMP-CLONE-DIALOG": { diff --git a/dmp-frontend/src/assets/images/annotations/user-profile-2.png b/dmp-frontend/src/assets/images/annotations/user-profile-2.png deleted file mode 100644 index 619859848..000000000 Binary files a/dmp-frontend/src/assets/images/annotations/user-profile-2.png and /dev/null differ