From f1dd70373093d69f06e1212e7fceae120624e093 Mon Sep 17 00:00:00 2001 From: Florent POITTEVIN <poittevin.florent@gmail.com> Date: Thu, 17 Jun 2021 17:54:35 +0200 Subject: [PATCH 1/4] feat(deposit file): [AOU-592] add icons along to file version --- src/app/data-table-component-solidify.ts | 15 ++ src/app/enums/index.ts | 202 ++++++++++++++++++ .../deposit-document-file.container.ts | 13 ++ .../deposit-document-file-upload.dialog.html | 43 ++-- .../deposit-document-file-upload.dialog.scss | 1 + .../deposit-document-file-upload.dialog.ts | 11 + src/app/icons.ts | 15 ++ src/app/models/index.ts | 3 +- .../shared-file-version.presentational.html | 5 + .../shared-file-version.presentational.scss | 3 + .../shared-file-version.presentational.ts | 64 ++++++ .../shared/enums/data-table-component.enum.ts | 1 + src/app/shared/enums/icon-name.enum.ts | 3 + src/app/shared/shared.module.ts | 2 + src/assets/images/file-version-accepted.svg | 35 +++ src/assets/images/file-version-published.svg | 44 ++++ src/assets/images/file-version-submitted.svg | 52 +++++ 17 files changed, 492 insertions(+), 20 deletions(-) create mode 100644 src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.html create mode 100644 src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.scss create mode 100644 src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts create mode 100644 src/assets/images/file-version-accepted.svg create mode 100644 src/assets/images/file-version-published.svg create mode 100644 src/assets/images/file-version-submitted.svg diff --git a/src/app/data-table-component-solidify.ts b/src/app/data-table-component-solidify.ts index 24378b9ef..623f63aee 100644 --- a/src/app/data-table-component-solidify.ts +++ b/src/app/data-table-component-solidify.ts @@ -2,6 +2,7 @@ import {SharedLogoWrapperContainer} from "@shared/components/containers/shared-l import {SharedAccessLevelWithEmbargoPresentational} from "@shared/components/presentationals/shared-access-level-with-embargo/shared-access-level-with-embargo.presentational"; import {SharedAccessLevelPresentational} from "@shared/components/presentationals/shared-access-level/shared-access-level.presentational"; import {SharedDocumentFileQuickStatusPresentational} from "@shared/components/presentationals/shared-document-file-quick-status/shared-document-file-quick-status.presentational"; +import {SharedFileVersionPresentational} from "@shared/components/presentationals/shared-file-version/shared-file-version.presentational"; import {SharedLabelPresentational} from "@shared/components/presentationals/shared-label/shared-label.presentational"; import {DataTableComponentEnum} from "@shared/enums/data-table-component.enum"; import {DataTableComponentHelper} from "@shared/helpers/data-table-component.helper"; @@ -77,6 +78,20 @@ export const dataTableComponentSolidify: MappingObject<DataTableComponent> = { }, ], }, + [DataTableComponentEnum.fileVersion]: { + componentType: SharedFileVersionPresentational, + inputs: [ + { + key: "fileVersion", + valueType: ValueType.isColData, + }, + { + key: "withTooltip", + valueType: ValueType.isStatic, + staticValue: true, + }, + ], + }, [DataTableComponentEnum.accessLevelWithEmbargo]: { componentType: SharedAccessLevelWithEmbargoPresentational, inputs: [ diff --git a/src/app/enums/index.ts b/src/app/enums/index.ts index e4a927206..cfe48711d 100644 --- a/src/app/enums/index.ts +++ b/src/app/enums/index.ts @@ -469,6 +469,202 @@ export namespace Enums { }, ]; + export enum FileTypeStringEnum { + ARTICLE_PUBLISHED_VERSION = "Article (Published version)", + ARTICLE_ACCEPTED_VERSION = "Article (Accepted version)", + ARTICLE_SUBMITTED_VERSION = "Article (Submitted version)", + ISSUE_PUBLISHED_VERSION = "Issue (Published version)", + BOOK_PUBLISHED_VERSION = "Book (Published version)", + BOOK_ACCEPTED_VERSION = "Book (Accepted version)", + BOOK_SUBMITTED_VERSION = "Book (Submitted version)", + BOOK_CHAPTER_PUBLISHED_VERSION = "Book chapter (Published version)", + BOOK_CHAPTER_ACCEPTED_VERSION = "Book chapter (Accepted version)", + BOOK_CHAPTER_SUBMITTED_VERSION = "Book chapter (Submitted version)", + ENCYCLOPEDIA_ENTRY_PUBLISHED_VERSION = "Encyclopedia entry (Published version)", + ENCYCLOPEDIA_ENTRY_ACCEPTED_VERSION = "Encyclopedia entry (Accepted version)", + ENCYCLOPEDIA_ENTRY_SUBMITTED_VERSION = "Encyclopedia entry (Submitted version)", + PROCEEDINGS_PUBLISHED_VERSION = "Proceedings (Published version)", + PROCEEDINGS_ACCEPTED_VERSION = "Proceedings (Accepted version)", + PROCEEDINGS_SUBMITTED_VERSION = "Proceedings (Submitted version)", + PROCEEDINGS_CHAPTER_PUBLISHED_VERSION = "Proceedings chapter (Published version)", + PROCEEDINGS_CHAPTER_ACCEPTED_VERSION = "Proceedings chapter (Accepted version)", + PROCEEDINGS_CHAPTER_SUBMITTED_VERSION = "Proceedings chapter (Submitted version)", + PRESENTATION = "Presentation", + RECORDING = "Recording", + APPENDIX = "Appendix", + ADDENDUM = "Addendum", + SUPPLEMENTAL_DATA = "Supplemental data", + EXTRACT = "Extract", + SUMMARY = "Summary", + TRANSLATION = "Translation", + POSTER = "Poster", + THESIS = "Thesis", + MASTER = "Master", + PREPRINT = "Preprint", + REPORT_PUBLISHED_VERSION = "Report (Published version)", + REPORT_ACCEPTED_VERSION = "Report (Accepted version)", + REPORT_SUBMITTED_VERSION = "Report (Submitted version)", + WORKING_PAPER_PUBLISHED_VERSION = "Working paper (Published version)", + WORKING_PAPER_ACCEPTED_VERSION = "Working paper (Accepted version)", + WORKING_PAPER_SUBMITTED_VERSION = "Working paper (Submitted version)", + DOCUMENT = "Document", + } + + export const FileTypeStringEnumTranslate: KeyValue[] = [ + { + key: FileTypeStringEnum.ARTICLE_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.articlePublishedVersion"), + }, + { + key: FileTypeStringEnum.ARTICLE_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.articleAcceptedVersion"), + }, + { + key: FileTypeStringEnum.ARTICLE_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.articleSubmittedVersion"), + }, + { + key: FileTypeStringEnum.ISSUE_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.issuePublishedVersion"), + }, + { + key: FileTypeStringEnum.BOOK_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.bookPublishedVersion"), + }, + { + key: FileTypeStringEnum.BOOK_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.bookAcceptedVersion"), + }, + { + key: FileTypeStringEnum.BOOK_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.bookSubmittedVersion"), + }, + { + key: FileTypeStringEnum.BOOK_CHAPTER_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.bookChapterPublishedVersion"), + }, + { + key: FileTypeStringEnum.BOOK_CHAPTER_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.bookChapterAcceptedVersion"), + }, + { + key: FileTypeStringEnum.BOOK_CHAPTER_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.bookChapterSubmittedVersion"), + }, + { + key: FileTypeStringEnum.ENCYCLOPEDIA_ENTRY_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.encyclopediaEntryPublishedVersion"), + }, + { + key: FileTypeStringEnum.ENCYCLOPEDIA_ENTRY_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.encyclopediaEntryAcceptedVersion"), + }, + { + key: FileTypeStringEnum.ENCYCLOPEDIA_ENTRY_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.encyclopediaEntrySubmittedVersion"), + }, + { + key: FileTypeStringEnum.PROCEEDINGS_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.proceedingsPublishedVersion"), + }, + { + key: FileTypeStringEnum.PROCEEDINGS_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.proceedingsAcceptedVersion"), + }, + { + key: FileTypeStringEnum.PROCEEDINGS_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.proceedingsSubmittedVersion"), + }, + { + key: FileTypeStringEnum.PROCEEDINGS_CHAPTER_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.proceedingsChapterPublishedVersion"), + }, + { + key: FileTypeStringEnum.PROCEEDINGS_CHAPTER_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.proceedingsChapterAcceptedVersion"), + }, + { + key: FileTypeStringEnum.PROCEEDINGS_CHAPTER_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.proceedingsChapterSubmittedVersion"), + }, + { + key: FileTypeStringEnum.PRESENTATION, + value: MARK_AS_TRANSLATABLE("enum.fileType.presentation"), + }, + { + key: FileTypeStringEnum.RECORDING, + value: MARK_AS_TRANSLATABLE("enum.fileType.recording"), + }, + { + key: FileTypeStringEnum.APPENDIX, + value: MARK_AS_TRANSLATABLE("enum.fileType.appendix"), + }, + { + key: FileTypeStringEnum.ADDENDUM, + value: MARK_AS_TRANSLATABLE("enum.fileType.addendum"), + }, + { + key: FileTypeStringEnum.SUPPLEMENTAL_DATA, + value: MARK_AS_TRANSLATABLE("enum.fileType.supplementalData"), + }, + { + key: FileTypeStringEnum.EXTRACT, + value: MARK_AS_TRANSLATABLE("enum.fileType.extract"), + }, + { + key: FileTypeStringEnum.SUMMARY, + value: MARK_AS_TRANSLATABLE("enum.fileType.summary"), + }, + { + key: FileTypeStringEnum.TRANSLATION, + value: MARK_AS_TRANSLATABLE("enum.fileType.translation"), + }, + { + key: FileTypeStringEnum.POSTER, + value: MARK_AS_TRANSLATABLE("enum.fileType.poster"), + }, + { + key: FileTypeStringEnum.THESIS, + value: MARK_AS_TRANSLATABLE("enum.fileType.thesis"), + }, + { + key: FileTypeStringEnum.MASTER, + value: MARK_AS_TRANSLATABLE("enum.fileType.master"), + }, + { + key: FileTypeStringEnum.PREPRINT, + value: MARK_AS_TRANSLATABLE("enum.fileType.preprint"), + }, + { + key: FileTypeStringEnum.REPORT_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.reportPublishedVersion"), + }, + { + key: FileTypeStringEnum.REPORT_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.reportAcceptedVersion"), + }, + { + key: FileTypeStringEnum.REPORT_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.reportSubmittedVersion"), + }, + { + key: FileTypeStringEnum.WORKING_PAPER_PUBLISHED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.workingPaperPublishedVersion"), + }, + { + key: FileTypeStringEnum.WORKING_PAPER_ACCEPTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.workingPaperAcceptedVersion"), + }, + { + key: FileTypeStringEnum.WORKING_PAPER_SUBMITTED_VERSION, + value: MARK_AS_TRANSLATABLE("enum.fileType.workingPaperSubmittedVersion"), + }, + { + key: FileTypeStringEnum.DOCUMENT, + value: MARK_AS_TRANSLATABLE("enum.fileType.document"), + }, + ]; + export type FileTypeEnum = "ARTICLE_PUBLISHED_VERSION" | "ARTICLE_ACCEPTED_VERSION" @@ -492,6 +688,7 @@ export namespace Enums { | "PRESENTATION" | "RECORDING" | "APPENDIX" + | "ADDENDUM" | "SUPPLEMENTAL_DATA" | "EXTRACT" | "SUMMARY" @@ -530,6 +727,7 @@ export namespace Enums { PRESENTATION: "PRESENTATION" as FileTypeEnum, RECORDING: "RECORDING" as FileTypeEnum, APPENDIX: "APPENDIX" as FileTypeEnum, + ADDENDUM: "ADDENDUM" as FileTypeEnum, SUPPLEMENTAL_DATA: "SUPPLEMENTAL_DATA" as FileTypeEnum, EXTRACT: "EXTRACT" as FileTypeEnum, SUMMARY: "SUMMARY" as FileTypeEnum, @@ -636,6 +834,10 @@ export namespace Enums { key: FileTypeEnum.APPENDIX, value: MARK_AS_TRANSLATABLE("enum.fileType.appendix"), }, + { + key: FileTypeEnum.ADDENDUM, + value: MARK_AS_TRANSLATABLE("enum.fileType.addendum"), + }, { key: FileTypeEnum.SUPPLEMENTAL_DATA, value: MARK_AS_TRANSLATABLE("enum.fileType.supplementalData"), diff --git a/src/app/features/deposit/components/containers/deposit-document-file/deposit-document-file.container.ts b/src/app/features/deposit/components/containers/deposit-document-file/deposit-document-file.container.ts index 50e5e0433..7138993d0 100644 --- a/src/app/features/deposit/components/containers/deposit-document-file/deposit-document-file.container.ts +++ b/src/app/features/deposit/components/containers/deposit-document-file/deposit-document-file.container.ts @@ -346,6 +346,19 @@ export class DepositDocumentFileContainer extends SharedAbstractRoutable impleme isSortable: false, isFilterable: false, }, + { + field: "documentFileType.value", + header: LabelTranslateEnum.version, + type: DataTableFieldTypeEnum.singleSelect, + order: OrderEnum.none, + filterableField: "documentFileType.value" as any, + sortableField: "documentFileType.value" as any, + isSortable: false, + isFilterable: false, + translate: true, + filterEnum: Enums.Deposit.FileTypeStringEnumTranslate, + component: DataTableComponentHelper.get(DataTableComponentEnum.fileVersion), + }, { field: "label" as any, header: LabelTranslateEnum.additionalDescription, diff --git a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html index ac183dbea..a0b2aa906 100644 --- a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html +++ b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html @@ -36,28 +36,33 @@ <form [formGroup]="form" class="form" > - <mat-form-field *ngIf="getFormControl(formDefinition.documentFileTypeId) as fd" - [appearance]="appearanceInputMaterial" - [floatLabel]="positionLabelInputMaterial" - solidifyTooltipOnEllipsis - > - <mat-label>{{labelTranslateEnum.description | translate}}</mat-label> - <mat-select [formControl]="fd" - [required]="formValidationHelper.hasRequiredField(fd)" - [solidifyValidation]="errors" + <div class="file-version-wrapper"> + <aou-shared-file-version [fileVersion]="getFormControl(formDefinition.documentFileTypeValue)?.value" + class="icon" + ></aou-shared-file-version> + <mat-form-field *ngIf="getFormControl(formDefinition.documentFileTypeId) as fd" + [appearance]="appearanceInputMaterial" + [floatLabel]="positionLabelInputMaterial" + solidifyTooltipOnEllipsis > - <mat-optgroup *ngFor="let document of listPublicationSubtypeDocFileObs | async" - [label]="enumUtil.getLabel(documentFileTypeEnumValues, document.level) | translate" + <mat-label>{{labelTranslateEnum.description | translate}}</mat-label> + <mat-select [formControl]="fd" + [required]="formValidationHelper.hasRequiredField(fd)" + [solidifyValidation]="errors" > - <mat-option *ngFor="let docFileType of document.publicationSubtypeDocumentFileTypes" - [value]="docFileType.documentFileTypeId" + <mat-optgroup *ngFor="let document of listPublicationSubtypeDocFileObs | async" + [label]="enumUtil.getLabel(documentFileTypeEnumValues, document.level) | translate" > - {{docFileType.labels | backtranslate}} - </mat-option> - </mat-optgroup> - </mat-select> - <mat-error #errors></mat-error> - </mat-form-field> + <mat-option *ngFor="let docFileType of document.publicationSubtypeDocumentFileTypes" + [value]="docFileType.documentFileTypeId" + > + {{docFileType.labels | backtranslate}} + </mat-option> + </mat-optgroup> + </mat-select> + <mat-error #errors></mat-error> + </mat-form-field> + </div> <mat-form-field *ngIf="getFormControl(formDefinition.label) as fd" [appearance]="appearanceInputMaterial" diff --git a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.scss b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.scss index f1b2a5891..12dd56c1f 100644 --- a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.scss +++ b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.scss @@ -47,6 +47,7 @@ width: 100%; } + .file-version-wrapper, .access-level-wrapper { display: grid; grid-template-columns: min-content 1fr; diff --git a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts index 33fca2590..46faa3f56 100644 --- a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts +++ b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts @@ -164,6 +164,7 @@ export class DepositDocumentFileUploadDialog extends SharedAbstractContainer imp this.form = this._fb.group({ [this.formDefinition.documentFileTypeId]: [undefined, [Validators.required]], + [this.formDefinition.documentFileTypeValue]: [undefined, []], [this.formDefinition.label]: ["", []], [this.formDefinition.licenseId]: [undefined, []], [this.formDefinition.accessLevel]: [Enums.DocumentFile.AccessLevelEnum.PUBLIC, [Validators.required]], @@ -175,6 +176,7 @@ export class DepositDocumentFileUploadDialog extends SharedAbstractContainer imp if (this.isDetailOrEdit) { this.form.get(this.formDefinition.documentFileTypeId).setValue(this.data.documentFile.documentFileType.resId); + this.form.get(this.formDefinition.documentFileTypeValue).setValue(this.data.documentFile.documentFileType.value); this.form.get(this.formDefinition.label).setValue(this.data.documentFile.label); this.form.get(this.formDefinition.licenseId).setValue(this.data.documentFile.license?.resId); this.form.get(this.formDefinition.accessLevel).setValue(this.data.documentFile.accessLevel); @@ -207,6 +209,14 @@ export class DepositDocumentFileUploadDialog extends SharedAbstractContainer imp )); } + this.subscribe(this.form.get(this.formDefinition.documentFileTypeId).valueChanges.pipe( + tap(documentFileTypeId => { + const listDocumentFileType = MemoizedUtil.listSnapshot(this._store, SharedDocumentFileTypeState); + const documentFileTypeValue = listDocumentFileType.find(d => d.documentFileTypeId === documentFileTypeId); + this.form.get(this.formDefinition.documentFileTypeValue).setValue(documentFileTypeValue?.value); + }), + )); + this.validationEmbargo(); if (this.isDetail) { @@ -316,6 +326,7 @@ export class DepositDocumentFileUploadDialog extends SharedAbstractContainer imp class FormComponentFormDefinition extends BaseFormDefinition { @PropertyName() documentFileTypeId: string; + @PropertyName() documentFileTypeValue: string; @PropertyName() label: string; @PropertyName() licenseId: string; @PropertyName() accessLevel: string; diff --git a/src/app/icons.ts b/src/app/icons.ts index d117407ec..1d58eae06 100644 --- a/src/app/icons.ts +++ b/src/app/icons.ts @@ -930,6 +930,21 @@ export const icons: IconInfos[] = [ lib: IconLibEnum.materialIcon, icon: "drafts", }, + { + name: IconNameEnum.fileVersionAccepted, + lib: IconLibEnum.image, + icon: "file-version-accepted.svg", + }, + { + name: IconNameEnum.fileVersionPublished, + lib: IconLibEnum.image, + icon: "file-version-published.svg", + }, + { + name: IconNameEnum.fileVersionSubmitted, + lib: IconLibEnum.image, + icon: "file-version-submitted.svg", + }, { name: IconNameEnum.question, lib: IconLibEnum.materialIcon, diff --git a/src/app/models/index.ts b/src/app/models/index.ts index 3124fe85a..ac3446feb 100644 --- a/src/app/models/index.ts +++ b/src/app/models/index.ts @@ -199,7 +199,8 @@ export interface DocumentFile extends BaseResource { } export interface DocumentFileType extends BaseResource { - value?: Enums.DocumentFileType.FileTypeLevelEnum; + level?: Enums.DocumentFileType.FileTypeLevelEnum; + value?: string; creation?: ChangeInfo; lastUpdate?: ChangeInfo; } diff --git a/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.html b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.html new file mode 100644 index 000000000..ceaf8615a --- /dev/null +++ b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.html @@ -0,0 +1,5 @@ +<solidify-icon [iconName]="fileVersionIconName" + [class]="size" + [matTooltip]="labelToTranslate | translate" + [matTooltipDisabled]="!withTooltip" +></solidify-icon> diff --git a/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.scss b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.scss new file mode 100644 index 000000000..970d947cd --- /dev/null +++ b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.scss @@ -0,0 +1,3 @@ +:host { + display: flex; +} \ No newline at end of file diff --git a/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts new file mode 100644 index 000000000..619c90144 --- /dev/null +++ b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts @@ -0,0 +1,64 @@ +import { + ChangeDetectionStrategy, + ChangeDetectorRef, + Component, + Input, +} from "@angular/core"; +import {Enums} from "@enums"; +import {SharedAbstractPresentational} from "@shared/components/presentationals/shared-abstract/shared-abstract.presentational"; +import {IconNameEnum} from "@shared/enums/icon-name.enum"; +import {EnumUtil} from "solidify-frontend"; + +@Component({ + selector: "aou-shared-file-version", + templateUrl: "./shared-file-version.presentational.html", + styleUrls: ["./shared-file-version.presentational.scss"], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class SharedFileVersionPresentational extends SharedAbstractPresentational { + _fileVersion: Enums.Deposit.FileTypeStringEnum; + fileVersionIconName: IconNameEnum; + labelToTranslate: string; + + @Input() + set fileVersion(fileVersion: Enums.Deposit.FileTypeStringEnum) { + this._fileVersion = fileVersion; + this._computeFileVersionIcon(fileVersion); + this._computeLabel(fileVersion); + } + + get fileVersion(): Enums.Deposit.FileTypeStringEnum { + return this._fileVersion; + } + + @Input() + size: string = "size-24"; + + @Input() + withTooltip: boolean = false; + + constructor(private readonly _changeDetector: ChangeDetectorRef) { + super(); + } + + private _computeFileVersionIcon(fileVersion: Enums.Deposit.FileTypeStringEnum): void { + const fileVersionLower = fileVersion.toLowerCase(); + if (fileVersionLower.indexOf("(published version)") !== -1) { + this.fileVersionIconName = IconNameEnum.fileVersionPublished; + return; + } + if (fileVersionLower.indexOf("(accepted version)") !== -1) { + this.fileVersionIconName = IconNameEnum.fileVersionAccepted; + return; + } + if (fileVersionLower.indexOf("(submitted version)") !== -1) { + this.fileVersionIconName = IconNameEnum.fileVersionSubmitted; + return; + } + this.fileVersionIconName = undefined; + } + + private _computeLabel(fileVersion: Enums.Deposit.FileTypeStringEnum): void { + this.labelToTranslate = EnumUtil.getLabel(Enums.Deposit.FileTypeEnumTranslate, fileVersion); + } +} diff --git a/src/app/shared/enums/data-table-component.enum.ts b/src/app/shared/enums/data-table-component.enum.ts index 7a3b3f5ae..ee94b7e57 100644 --- a/src/app/shared/enums/data-table-component.enum.ts +++ b/src/app/shared/enums/data-table-component.enum.ts @@ -3,6 +3,7 @@ import {DataTableComponentPartialEnum} from "solidify-frontend"; enum DataTableComponentExtendEnum { status = "status", logo = "logo", + fileVersion = "fileVersion", accessLevel = "accessLevel", accessLevelWithEmbargo = "accessLevelWithEmbargo", documentFileQuickStatus = "documentFileQuickStatus", diff --git a/src/app/shared/enums/icon-name.enum.ts b/src/app/shared/enums/icon-name.enum.ts index 37a816055..73c7c1bcb 100644 --- a/src/app/shared/enums/icon-name.enum.ts +++ b/src/app/shared/enums/icon-name.enum.ts @@ -181,6 +181,9 @@ export class IconNameEnum extends IconNamePartialEnum { @PropertyName() static events: string; @PropertyName() static file: string; @PropertyName() static markAsRead: string; + @PropertyName() static fileVersionAccepted: string; + @PropertyName() static fileVersionPublished: string; + @PropertyName() static fileVersionSubmitted: string; @PropertyName() static question: string; @PropertyName() static authorized: string; @PropertyName() static notAuthorized: string; diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 427af5f9e..c2051c2fe 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -37,6 +37,7 @@ import {SharedAccessLevelPresentational} from "@shared/components/presentational import {SharedAvatarPresentational} from "@shared/components/presentationals/shared-avatar/shared-avatar.presentational"; import {SharedDocumentFileQuickStatusPresentational} from "@shared/components/presentationals/shared-document-file-quick-status/shared-document-file-quick-status.presentational"; import {SharedDoiMenuPresentational} from "@shared/components/presentationals/shared-doi-menu/shared-doi-menu.presentational"; +import {SharedFileVersionPresentational} from "@shared/components/presentationals/shared-file-version/shared-file-version.presentational"; import {SharedFolderTreePresentational} from "@shared/components/presentationals/shared-folder-tree/shared-folder-tree.presentational"; import {SharedImageDisplayPresentational} from "@shared/components/presentationals/shared-image-display/shared-image-display.presentational"; import {SharedLabelPresentational} from "@shared/components/presentationals/shared-label/shared-label.presentational"; @@ -102,6 +103,7 @@ const presentationals = [ SharedDocumentFileQuickStatusPresentational, SharedStepperPresentational, SharedLabelPresentational, + SharedFileVersionPresentational, ]; const directives = [ SharedAutocompleteInfiniteScrollDirective, diff --git a/src/assets/images/file-version-accepted.svg b/src/assets/images/file-version-accepted.svg new file mode 100644 index 000000000..7db4f804e --- /dev/null +++ b/src/assets/images/file-version-accepted.svg @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 23.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#FFFFFF;stroke:#000000;stroke-width:5;stroke-miterlimit:10;} + .st1{fill:#FFFFFF;} +</style> +<circle class="st0" cx="100.1" cy="100.5" r="94.9"/> +<circle cx="165.7" cy="166" r="29.3"/> +<g> + <path class="st1" d="M172.5,180.5l-1.6-5.1h-9.8l-1.6,5.1H151l10.1-31.4h10.4l10.6,31.4H172.5z M167.1,162.7 + c-0.5-1.6-0.8-3.1-1.1-4.4h-0.2c-0.3,1.4-0.6,3-1.1,4.5l-1.7,5.8h5.8L167.1,162.7z"/> +</g> +<g> + <g> + <g> + <g> + <g> + <g> + <g> + <path d="M121,155.1H59.4c-1.7,0-3.1-1.4-3.1-3.1V49c0-1.7,1.4-3.1,3.1-3.1h81.7c1.7,0,3.1,1.4,3.1,3.1v82.2 + c0,0.8-0.3,1.6-0.9,2.2l-19.9,21C122.7,154.8,121.9,155.1,121,155.1z M62.5,148.9h57.3l18.2-19V52.1H62.5V148.9z"/> + <path d="M120.2,155.1c-1.7,0-3.1-1.4-3.1-3.1v-22.4c0-1.7,1.4-3.1,3.1-3.1h20.9c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1 + h-17.7V152C123.3,153.7,121.9,155.1,120.2,155.1z"/> + </g> + </g> + </g> + </g> + </g> + </g> + <path d="M94.2,119.9c-0.8,0-1.6-0.3-2.2-0.9l-15.4-15.4c-1.2-1.2-1.2-3.1,0-4.4c1.2-1.2,3.1-1.2,4.4,0l13.2,13.2L122.7,84 + c1.2-1.2,3.1-1.2,4.4,0c1.2,1.2,1.2,3.1,0,4.4L96.4,119C95.8,119.6,95,119.9,94.2,119.9z"/> +</g> +</svg> diff --git a/src/assets/images/file-version-published.svg b/src/assets/images/file-version-published.svg new file mode 100644 index 000000000..5ff0add91 --- /dev/null +++ b/src/assets/images/file-version-published.svg @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 23.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#FFFFFF;stroke:#000000;stroke-width:5;stroke-miterlimit:10;} + .st1{fill:#FFFFFF;} +</style> +<circle class="st0" cx="100.4" cy="100.1" r="95.2"/> +<circle cx="166.2" cy="165.9" r="29.3"/> +<g> + <path class="st1" d="M166.2,171c-0.6,0-1.2,0-1.2,0v9.4h-8.7v-31.5c0,0,4.7-0.3,10.1-0.3c8.4,0,13.1,3.4,13.1,10.5 + C179.4,165.5,175.2,171,166.2,171z M166.2,155.6c-0.5,0-1.2,0-1.2,0v8c0,0,0.6,0.2,1.6,0.2c2.5,0,3.9-1.4,3.9-4.1 + C170.5,157.3,169.3,155.6,166.2,155.6z"/> +</g> +<g> + <g> + <g> + <g> + <g> + <path d="M121.3,154.9h-62c-1.7,0-3.1-1.4-3.1-3.1V48.5c0-1.7,1.4-3.1,3.1-3.1h82c1.7,0,3.1,1.4,3.1,3.1v82.4 + c0,0.8-0.3,1.6-0.9,2.2l-20,21.1C123.1,154.6,122.3,154.9,121.3,154.9z M62.5,148.7h57.5l18.3-19V51.6H62.5V148.7z"/> + <path d="M120.6,154.9c-1.7,0-3.1-1.4-3.1-3.1v-22.5c0-1.7,1.4-3.1,3.1-3.1h20.9c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1 + h-17.8v19.4C123.7,153.5,122.3,154.9,120.6,154.9z"/> + </g> + </g> + </g> + </g> + <g> + <path d="M94.5,94.7H74.2c-1.7,0-3.1-1.4-3.1-3.1V66.3c0-1.7,1.4-3.1,3.1-3.1h20.1c1.7,0,3.1,1.4,3.1,3.1v25.3 + C97.6,93.3,96.2,94.7,94.5,94.7z M77.3,88.4h13.9v-19H77.3V88.4z"/> + </g> + <path d="M126.8,69.4h-22.5c-1.7,0-3.1-1.4-3.1-3.1s1.4-3.1,3.1-3.1h22.5c1.7,0,3.1,1.4,3.1,3.1S128.5,69.4,126.8,69.4z"/> + <path d="M115.6,82h-11.2c-1.7,0-3.1-1.4-3.1-3.1s1.4-3.1,3.1-3.1h11.2c1.7,0,3.1,1.4,3.1,3.1S117.3,82,115.6,82z"/> + <path d="M126.8,94.7h-22.5c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h22.5c1.7,0,3.1,1.4,3.1,3.1 + C129.9,93.3,128.5,94.7,126.8,94.7z"/> + <path d="M126.8,107.3H74.2c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h52.6c1.7,0,3.1,1.4,3.1,3.1 + C129.9,105.9,128.5,107.3,126.8,107.3z"/> + <path d="M126.8,120H74.2c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h52.6c1.7,0,3.1,1.4,3.1,3.1 + C129.9,118.6,128.5,120,126.8,120z"/> + <path d="M106.4,132.6H74.2c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h32.2c1.7,0,3.1,1.4,3.1,3.1 + C109.5,131.2,108.1,132.6,106.4,132.6z"/> +</g> +</svg> diff --git a/src/assets/images/file-version-submitted.svg b/src/assets/images/file-version-submitted.svg new file mode 100644 index 000000000..38455439b --- /dev/null +++ b/src/assets/images/file-version-submitted.svg @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 23.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#FFFFFF;stroke:#000000;stroke-width:5;stroke-miterlimit:10;} + .st1{fill:#FFFFFF;} +</style> +<circle class="st0" cx="99.9" cy="99.9" r="95"/> +<g> + <g> + <g> + <g> + <g> + <path d="M120.8,154.5H59.1c-1.7,0-3.1-1.4-3.1-3.1V48.3c0-1.7,1.4-3.1,3.1-3.1h81.7c1.7,0,3.1,1.4,3.1,3.1 + c0,1.7-1.4,3.1-3.1,3.1H62.3v96.8h57.3l18.2-19v-9.2c0-1.7,1.4-3.1,3.1-3.1s3.1,1.4,3.1,3.1v10.4c0,0.8-0.3,1.6-0.9,2.2 + l-19.9,21C122.5,154.2,121.7,154.5,120.8,154.5z"/> + <path d="M120,154.5c-1.7,0-3.1-1.4-3.1-3.1V129c0-1.7,1.4-3.1,3.1-3.1h20.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1h-17.7v19.3 + C123.1,153.1,121.7,154.5,120,154.5z"/> + </g> + </g> + </g> + </g> + <path d="M103.8,81.3H74.4c-1.7,0-3.1-1.4-3.1-3.1s1.4-3.1,3.1-3.1h29.4c1.7,0,3.1,1.4,3.1,3.1S105.5,81.3,103.8,81.3z"/> + <path d="M94.8,96H74.4c-1.7,0-3.1-1.4-3.1-3.1c0-1.7,1.4-3.1,3.1-3.1h20.4c1.7,0,3.1,1.4,3.1,3.1C97.9,94.6,96.5,96,94.8,96z"/> + <g> + <g> + <g> + <g> + <g> + <path d="M113.5,123.2c-1.6,0-3.1-0.5-4.2-1.6l-0.3-0.3c-1.7-1.6-2.6-4.4-2-6.5l10.7-36.4c0.5-2,2.3-4,4.4-4.8l17.3-6.4 + l3.3-6.2c0.8-1.4,2-2.5,3.6-2.6c1.6-0.3,3.1,0.2,4.4,1.2l14.6,12.9c1.2,1.1,1.9,2.6,1.7,4c-0.2,1.6-0.9,3-2.3,3.9l-6.1,4 + l-3.6,17.4c-0.5,2.2-2.2,4.2-4.2,5.1l-34.4,15.7C115.3,123.1,114.4,123.2,113.5,123.2z M113,116.5c0,0,0,0.2,0.2,0.2l0.3,0.2 + c0,0,0,0,0.2,0c0,0,0,0,0.2,0l34.4-15.7c0.3-0.2,0.6-0.5,0.6-0.6l3.7-18.2c0-0.2,0-0.3,0-0.3c0.2-0.8,0.6-1.4,1.2-1.9l5.9-3.9 + l-12.5-10.9l-3.1,6.1c-0.5,0.9-1.2,1.6-2.2,1.7l0,0h-0.2l-17.6,6.4c-0.2,0-0.5,0.5-0.5,0.6L113,116.5L113,116.5z M160.9,77.1 + L160.9,77.1L160.9,77.1L160.9,77.1z M142.1,72.8L142.1,72.8L142.1,72.8z"/> + <path d="M113.5,123.2H93.1c-1.7,0-3.1-1.4-3.1-3.1s1.4-3.1,3.1-3.1h20.5c1.7,0,3.1,1.4,3.1,3.1S115.2,123.2,113.5,123.2z"/> + <path d="M123.9,107.5c-0.8,0-1.4-0.3-2-0.8c-1.2-1.1-1.4-3.1-0.3-4.4l14.9-17.3c1.1-1.2,3.1-1.4,4.4-0.3s1.4,3.1,0.3,4.4 + l-14.9,17.3C125.6,107,124.8,107.5,123.9,107.5z"/> + </g> + </g> + </g> + </g> + </g> +</g> +<circle cx="165.5" cy="165.4" r="29.3"/> +<g> + <path class="st1" d="M164.2,180.5c-3.1,0-5.4-0.2-7.8-0.8l0.8-8.3c2,0.9,4.5,1.6,7.2,1.6c1.7,0,3.1-0.8,3.1-2.2 + c0-4.5-11.8-1.9-11.8-12.6c0-6.2,4.8-10.3,13.1-10.3c1.6,0,3.9,0.2,5.8,0.6l-0.8,7.5c-1.7-0.6-3.4-0.9-5.4-0.9 + c-2.5,0-3.4,0.9-3.4,2.2c0,3.9,12.1,2.5,12.1,12.5C177.1,175.7,171.8,180.5,164.2,180.5z"/> +</g> +</svg> -- GitLab From d7dcdaefb614edff15a170c5429d987d4c33e4b2 Mon Sep 17 00:00:00 2001 From: Florent POITTEVIN <poittevin.florent@gmail.com> Date: Fri, 18 Jun 2021 14:29:40 +0200 Subject: [PATCH 2/4] fix: MR --- src/app/data-table-component-solidify.ts | 5 +++++ .../shared-file-version.presentational.ts | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/data-table-component-solidify.ts b/src/app/data-table-component-solidify.ts index 623f63aee..66d9db52d 100644 --- a/src/app/data-table-component-solidify.ts +++ b/src/app/data-table-component-solidify.ts @@ -90,6 +90,11 @@ export const dataTableComponentSolidify: MappingObject<DataTableComponent> = { valueType: ValueType.isStatic, staticValue: true, }, + { + key: "size", + valueType: ValueType.isStatic, + staticValue: "size-30", + }, ], }, [DataTableComponentEnum.accessLevelWithEmbargo]: { diff --git a/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts index 619c90144..582e98c70 100644 --- a/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts +++ b/src/app/shared/components/presentationals/shared-file-version/shared-file-version.presentational.ts @@ -16,6 +16,10 @@ import {EnumUtil} from "solidify-frontend"; changeDetection: ChangeDetectionStrategy.OnPush, }) export class SharedFileVersionPresentational extends SharedAbstractPresentational { + private readonly VALUE_PUBLISHED_VERSION: string = "(published version)"; + private readonly VALUE_ACCEPTED_VERSION: string = "(accepted version)"; + private readonly VALUE_SUBMITTED_VERSION: string = "(submitted version)"; + _fileVersion: Enums.Deposit.FileTypeStringEnum; fileVersionIconName: IconNameEnum; labelToTranslate: string; @@ -43,15 +47,15 @@ export class SharedFileVersionPresentational extends SharedAbstractPresentationa private _computeFileVersionIcon(fileVersion: Enums.Deposit.FileTypeStringEnum): void { const fileVersionLower = fileVersion.toLowerCase(); - if (fileVersionLower.indexOf("(published version)") !== -1) { + if (fileVersionLower.indexOf(this.VALUE_PUBLISHED_VERSION) !== -1) { this.fileVersionIconName = IconNameEnum.fileVersionPublished; return; } - if (fileVersionLower.indexOf("(accepted version)") !== -1) { + if (fileVersionLower.indexOf(this.VALUE_ACCEPTED_VERSION) !== -1) { this.fileVersionIconName = IconNameEnum.fileVersionAccepted; return; } - if (fileVersionLower.indexOf("(submitted version)") !== -1) { + if (fileVersionLower.indexOf(this.VALUE_SUBMITTED_VERSION) !== -1) { this.fileVersionIconName = IconNameEnum.fileVersionSubmitted; return; } -- GitLab From 116bf6714da985d475d1bae3fb60f90c19b4d669 Mon Sep 17 00:00:00 2001 From: Florent POITTEVIN <poittevin.florent@gmail.com> Date: Mon, 28 Jun 2021 10:53:26 +0200 Subject: [PATCH 3/4] fix: MR size on dialog --- .../deposit-document-file-upload.dialog.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html index a0b2aa906..066caa939 100644 --- a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html +++ b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.html @@ -39,6 +39,7 @@ <div class="file-version-wrapper"> <aou-shared-file-version [fileVersion]="getFormControl(formDefinition.documentFileTypeValue)?.value" class="icon" + [size]="'size-30'" ></aou-shared-file-version> <mat-form-field *ngIf="getFormControl(formDefinition.documentFileTypeId) as fd" [appearance]="appearanceInputMaterial" @@ -81,6 +82,7 @@ <div class="access-level-wrapper"> <aou-shared-access-level [accessLevel]="getFormControl(formDefinition.accessLevel)?.value" class="icon" + [size]="'size-30'" ></aou-shared-access-level> <mat-form-field *ngIf="getFormControl(formDefinition.accessLevel) as fd" [appearance]="appearanceInputMaterial" -- GitLab From e4387e7f2b615c0259b419466f8fc38d764104ab Mon Sep 17 00:00:00 2001 From: Florent POITTEVIN <poittevin.florent@gmail.com> Date: Mon, 28 Jun 2021 10:53:39 +0200 Subject: [PATCH 4/4] fix: javascript errors --- .../deposit-document-file-upload.dialog.ts | 7 +++++-- src/app/features/notification/stores/notification.state.ts | 2 +- src/app/stores/notification/app-notification.state.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts index 46faa3f56..13d7ea54b 100644 --- a/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts +++ b/src/app/features/deposit/components/dialogs/deposit-document-file-upload/deposit-document-file-upload.dialog.ts @@ -45,6 +45,7 @@ import { EnumUtil, FormValidationHelper, isEmptyString, + isNonEmptyArray, isNonEmptyString, isNotNullNorUndefined, isNumberReal, @@ -212,8 +213,10 @@ export class DepositDocumentFileUploadDialog extends SharedAbstractContainer imp this.subscribe(this.form.get(this.formDefinition.documentFileTypeId).valueChanges.pipe( tap(documentFileTypeId => { const listDocumentFileType = MemoizedUtil.listSnapshot(this._store, SharedDocumentFileTypeState); - const documentFileTypeValue = listDocumentFileType.find(d => d.documentFileTypeId === documentFileTypeId); - this.form.get(this.formDefinition.documentFileTypeValue).setValue(documentFileTypeValue?.value); + if (isNonEmptyArray(listDocumentFileType)) { + const documentFileTypeValue = listDocumentFileType.find(d => d.documentFileTypeId === documentFileTypeId); + this.form.get(this.formDefinition.documentFileTypeValue).setValue(documentFileTypeValue?.value); + } }), )); diff --git a/src/app/features/notification/stores/notification.state.ts b/src/app/features/notification/stores/notification.state.ts index 42b6830dc..39508f935 100644 --- a/src/app/features/notification/stores/notification.state.ts +++ b/src/app/features/notification/stores/notification.state.ts @@ -67,7 +67,7 @@ export class NotificationState extends ResourceState<NotificationStateModel, Not protected get _urlResource(): string { const currentPerson = MemoizedUtil.currentSnapshot(this.store, AppPersonState); - return ApiEnum.adminPeople + urlSeparator + currentPerson.resId + urlSeparator + ApiResourceNameEnum.NOTIFICATIONS; + return ApiEnum.adminPeople + urlSeparator + currentPerson?.resId + urlSeparator + ApiResourceNameEnum.NOTIFICATIONS; } @Selector() diff --git a/src/app/stores/notification/app-notification.state.ts b/src/app/stores/notification/app-notification.state.ts index 6ad60032f..c5ec741fe 100644 --- a/src/app/stores/notification/app-notification.state.ts +++ b/src/app/stores/notification/app-notification.state.ts @@ -47,6 +47,6 @@ export class AppNotificationState extends ResourceState<AppNotificationStateMode protected get _urlResource(): string { const currentPerson = MemoizedUtil.currentSnapshot(this.store, AppPersonState); - return ApiEnum.adminPeople + urlSeparator + currentPerson.resId + urlSeparator + ApiResourceNameEnum.NOTIFICATIONS; + return ApiEnum.adminPeople + urlSeparator + currentPerson?.resId + urlSeparator + ApiResourceNameEnum.NOTIFICATIONS; } } -- GitLab