diff --git a/dmp-frontend/src/app/core/model/configuration-models/extended-internal-status.model.ts b/dmp-frontend/src/app/core/model/configuration-models/extended-internal-status.model.ts new file mode 100644 index 000000000..674b419c2 --- /dev/null +++ b/dmp-frontend/src/app/core/model/configuration-models/extended-internal-status.model.ts @@ -0,0 +1,46 @@ +import { InternalStatus } from "@annotation-service/core/enum/internal-status.enum"; + +export class ExtendedInternalStatus { + + private _extendedInternalStatustems: ExtendedInternalStatusItem[]; + get extendedInternalStatustems(): ExtendedInternalStatusItem[] { + return this._extendedInternalStatustems; + } + + public static parseValue(value: any): ExtendedInternalStatus { + const extendedInternalStatusObj: ExtendedInternalStatus = new ExtendedInternalStatus(); + + extendedInternalStatusObj._extendedInternalStatustems = []; + for (let item of value) { + const extendedInternalStatusItemObj: ExtendedInternalStatusItem = ExtendedInternalStatusItem.parseValue(item); + extendedInternalStatusObj._extendedInternalStatustems.push(extendedInternalStatusItemObj); + } + + return extendedInternalStatusObj; + } + + getIcon(status?: InternalStatus): string { + const extendedInternalStatus = this.extendedInternalStatustems?.find(s => s.InternalStatus == status); + + return extendedInternalStatus?.icon == null || extendedInternalStatus?.icon == '' ? 'animation' : extendedInternalStatus?.icon; + } +} + +export class ExtendedInternalStatusItem { + private _internalStatus: InternalStatus; + get InternalStatus(): InternalStatus { + return this._internalStatus; + } + + private _icon: string; + get icon(): string { + return this._icon; + } + + public static parseValue(value: any): ExtendedInternalStatusItem { + const obj: ExtendedInternalStatusItem = new ExtendedInternalStatusItem(); + obj._internalStatus = value.internalStatus; + obj._icon = value.icon; + return obj; + } +} diff --git a/dmp-frontend/src/app/core/services/configuration/configuration.service.ts b/dmp-frontend/src/app/core/services/configuration/configuration.service.ts index d1dc26236..19a0e8689 100644 --- a/dmp-frontend/src/app/core/services/configuration/configuration.service.ts +++ b/dmp-frontend/src/app/core/services/configuration/configuration.service.ts @@ -13,6 +13,7 @@ import { AuthProviders } from '@app/core/model/configuration-models/auth-provide import { AnalyticsProviders } from '@app/core/model/configuration-models/analytics-providers.model'; import { CssColorsTenantConfiguration } from '@app/core/model/tenant-configuaration/tenant-configuration'; import { Sidebar } from '@app/core/model/configuration-models/sidebar.model'; +import { ExtendedInternalStatus } from '@app/core/model/configuration-models/extended-internal-status.model'; @Injectable({ providedIn: 'root', @@ -121,6 +122,11 @@ export class ConfigurationService extends BaseComponent { get notificationServiceEnabled(): boolean { return this._notificationServiceEnabled; } + + private _extendedInternalStatus: ExtendedInternalStatus; + get extendedInternalStatus(): ExtendedInternalStatus { + return this._extendedInternalStatus; + } private _annotationServiceAddress: string; get annotationServiceAddress(): string { @@ -263,6 +269,7 @@ export class ConfigurationService extends BaseComponent { if (config.annotation_service) { this._annotationServiceEnabled = config.annotation_service.enabled; this._annotationServiceAddress = config.annotation_service.address; + this._extendedInternalStatus = ExtendedInternalStatus.parseValue(config.annotation_service.extendedInternalStatus); } this._inAppNotificationsCountInterval = config.inAppNotificationsCountInterval; this._newReleaseNotificationExpires = config.newReleaseNotification?.expires; 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 f81bd6022..7a69df663 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 @@ -81,7 +81,7 @@
-
+
@@ -90,31 +90,37 @@
-
- {{getParentAnnotation(thread).author.name}} -
{{getParentAnnotation(thread).timeStamp | dateTimeFormatter: "d MMMM, y 'at' h:mm a"}}
-
-
{{getParentAnnotation(thread).payload}}
-
-
-
- +
+
+ {{getParentAnnotation(thread).author.name}} +
{{getParentAnnotation(thread).timeStamp | dateTimeFormatter: "d MMMM, y 'at' h:mm a"}}
+
{{getParentAnnotation(thread).payload}}
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
-
- - {{'ANNOTATION-DIALOG.ANNOTATION-STATUS.TITLE' | translate}} - - {{status.label}} - - {{getAnnotationStatusFormControl(annotationStatusFormGroup.get('annotationsStatusArray'), getParentAnnotation(thread).id).get('statusId').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - +
@@ -134,7 +140,7 @@
-
+
@@ -162,27 +168,27 @@
- -
-
-
-
- - {{'ANNOTATION-DIALOG.THREADS.REPLY' | translate}} - - - -
-
- -
+ +
+
+
+
+ + {{'ANNOTATION-DIALOG.THREADS.REPLY' | translate}} + + + +
+
+
+
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 b19fd404b..85522c335 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 @@ -108,3 +108,7 @@ $mat-card-header-size: 40px !default; color: #129D99; } } + +.selected { + background-color: #18488f3d; +} \ 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 967e691d7..d2c46d433 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 @@ -1,4 +1,4 @@ -import { Component, Inject } from '@angular/core'; +import { Component, Inject, ViewChild } from '@angular/core'; import { FormBuilder, FormControl, UntypedFormArray, UntypedFormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; @@ -23,6 +23,8 @@ import { nameof } from 'ts-simple-nameof'; import { AnnotationStatusArrayEditorModel } from './annotation-status-editor.model'; import { StatusService } from '@annotation-service/services/http/status.service'; import { InternalStatus } from '@annotation-service/core/enum/internal-status.enum'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; +import { MatSelectionList } from '@angular/material/list'; @Component({ selector: 'app-annotation-dialog', @@ -54,6 +56,8 @@ export class AnnotationDialogComponent extends BaseComponent { public listingStatuses: Status[] = []; public dmpUsersMentionNames: string[] = []; + @ViewChild('annotationStatus') annotationStatus: MatSelectionList; + constructor( public dialogRef: MatDialogRef, @@ -67,6 +71,7 @@ export class AnnotationDialogComponent extends BaseComponent { public enumUtils: EnumUtils, private statusService: StatusService, protected routerUtils: RouterUtilsService, + private configurationService: ConfigurationService, ) { super(); this.entityId = data.entityId; @@ -200,6 +205,10 @@ export class AnnotationDialogComponent extends BaseComponent { return !isNullOrUndefined(text) && text.length !== 0 && text !== ''; } + getStatusIcon(status?: InternalStatus): string { + return this.configurationService.extendedInternalStatus?.getIcon(status); + } + public isFormValid(value: any) { return value.valid; } @@ -306,17 +315,11 @@ export class AnnotationDialogComponent extends BaseComponent { } } - changeIcon(formArray: UntypedFormArray, annotationId: Guid){ - const control = this.getAnnotationStatusControl(formArray, annotationId); - if (control == null) return; - const status = this.listingStatuses.find(x => x.id === control.get('statusId').value) || null; - if (status && status.internalStatus != null && status.internalStatus == InternalStatus.Resolved){ - control.get('isCheckIcon').patchValue(true); - } else { - control.get('isCheckIcon').patchValue(false); - } + setAnnotationStatus(formArray: UntypedFormArray, annotationId: Guid, selectedStatusId: Guid) { + const annotationForm = this.getAnnotationStatusFormControl(formArray, annotationId); + annotationForm.get('statusId').setValue(selectedStatusId); } - + canSaveAnnotationStatus(formArray: UntypedFormArray, annotationId: Guid): boolean{ const control = this.getAnnotationStatusControl(formArray, annotationId); if (control == null) return false; diff --git a/dmp-frontend/src/assets/config/config.json b/dmp-frontend/src/assets/config/config.json index 80b02a114..9ad7ce281 100644 --- a/dmp-frontend/src/assets/config/config.json +++ b/dmp-frontend/src/assets/config/config.json @@ -26,7 +26,13 @@ }, "annotation_service": { "enabled": true, - "address": "http://localhost:8087/api/" + "address": "http://localhost:8087/api/", + "extendedInternalStatus": [ + { + "internalStatus": "0", + "icon": "check" + } + ] }, "logging": { "enabled": true,