From 3b1c5681e3d06332ace96baf9f5400a9526f479a Mon Sep 17 00:00:00 2001 From: "CITE\\spapacharalampous" Date: Tue, 13 Aug 2024 14:57:47 +0300 Subject: [PATCH] 1. refactor description 2. translations --- .../description-overview.component.html | 2 +- .../description-overview.component.ts | 88 ++++++++++--------- .../overview/plan-overview.component.html | 2 +- .../plan/overview/plan-overview.component.ts | 2 +- frontend/src/assets/i18n/baq.json | 2 + frontend/src/assets/i18n/de.json | 2 + frontend/src/assets/i18n/en.json | 2 +- frontend/src/assets/i18n/es.json | 2 + frontend/src/assets/i18n/gr.json | 2 + frontend/src/assets/i18n/hr.json | 2 + frontend/src/assets/i18n/pl.json | 2 + frontend/src/assets/i18n/pt.json | 2 + frontend/src/assets/i18n/sk.json | 2 + frontend/src/assets/i18n/sr.json | 2 + frontend/src/assets/i18n/tr.json | 2 + 15 files changed, 69 insertions(+), 47 deletions(-) diff --git a/frontend/src/app/ui/description/overview/description-overview.component.html b/frontend/src/app/ui/description/overview/description-overview.component.html index a805dd776..0e3eb9fe3 100644 --- a/frontend/src/app/ui/description/overview/description-overview.component.html +++ b/frontend/src/app/ui/description/overview/description-overview.component.html @@ -34,7 +34,7 @@
.
- {{isActive ? 'DESCRIPTION-OVERVIEW.EDITED' : 'DESCRIPTION-OVERVIEW.DELETED' | translate}} : + {{(isActive ? 'DESCRIPTION-OVERVIEW.EDITED' : 'DESCRIPTION-OVERVIEW.DELETED') | translate}} : {{description.updatedAt | dateTimeFormatter: "d MMMM y"}}
diff --git a/frontend/src/app/ui/description/overview/description-overview.component.ts b/frontend/src/app/ui/description/overview/description-overview.component.ts index efee87901..e17f6254b 100644 --- a/frontend/src/app/ui/description/overview/description-overview.component.ts +++ b/frontend/src/app/ui/description/overview/description-overview.component.ts @@ -53,7 +53,7 @@ import { RouterUtilsService } from '@app/core/services/router/router-utils.servi }) export class DescriptionOverviewComponent extends BaseComponent implements OnInit { - description: any | Description | PublicDescription; + description: Description | PublicDescription; researchers: PlanReference[] = []; isNew = true; isFinalized = false; @@ -125,43 +125,43 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.descriptionService.getSingle(itemId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe( - { - next: (data) => { - this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); - - this.description = data; - this.description.plan.planUsers = data.plan.planUsers.filter(x => x.isActive === IsActive.Active); - this.researchers = this.referenceService.getReferencesForTypes(this.description?.plan?.planReferences, [this.referenceTypeService.getResearcherReferenceType()]); - this.checkLockStatus(this.description.id); - this.canDelete = this.isActive && (this.authService.hasPermission(AppPermission.DeleteDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false; - - this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; - - this.canCopy = this.canEdit || (this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView); - - this.canAnnotate = (this.authService.hasPermission(AppPermission.AnnotateDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.AnnotateDescription)) && this.description.belongsToCurrentTenant != false; - - this.canFinalize = this.isActive && (this.authService.hasPermission(AppPermission.FinalizeDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false; - - this.canInvitePlanUsers = this.isActive && (this.authService.hasPermission(AppPermission.InvitePlanUsers) || - this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false; - - }, - error: (error: any) => { - this.httpErrorHandlingService.handleBackedRequestError(error); - - if (error.status === 404) { - return this.onFetchingDeletedCallbackError('/descriptions/'); - } - if (error.status === 403) { - return this.onFetchingForbiddenCallbackError('/descriptions/'); - } - } - }); + { + next: (data) => { + this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); + + this.description = data; + this.description.plan.planUsers = data.plan.planUsers.filter(x => x.isActive === IsActive.Active); + this.researchers = this.referenceService.getReferencesForTypes(this.description?.plan?.planReferences, [this.referenceTypeService.getResearcherReferenceType()]); + this.checkLockStatus(this.description.id); + this.canDelete = this.isActive && (this.authService.hasPermission(AppPermission.DeleteDescription) || + this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false; + + this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) || + this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; + + this.canCopy = this.canEdit || (this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView); + + this.canAnnotate = (this.authService.hasPermission(AppPermission.AnnotateDescription) || + this.description.authorizationFlags?.some(x => x === AppPermission.AnnotateDescription)) && this.description.belongsToCurrentTenant != false; + + this.canFinalize = this.isActive && (this.authService.hasPermission(AppPermission.FinalizeDescription) || + this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false; + + this.canInvitePlanUsers = this.isActive && (this.authService.hasPermission(AppPermission.InvitePlanUsers) || + this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false; + + }, + error: (error: any) => { + this.httpErrorHandlingService.handleBackedRequestError(error); + + if (error.status === 404) { + return this.onFetchingDeletedCallbackError('/descriptions/'); + } + if (error.status === 403) { + return this.onFetchingForbiddenCallbackError('/descriptions/'); + } + } + }); } else if (publicId != null) { this.isNew = false; @@ -203,9 +203,9 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni } } - get isActive(): boolean { - return this.description && this.description.isActive === IsActive.Active; - } + get isActive(): boolean { + return this.description && this.description.isActive != IsActive.Inactive; + } get unauthorizedTootipText(): string { return this.language.instant('DESCRIPTION-OVERVIEW.INFOS.UNAUTHORIZED-ORCID'); @@ -276,7 +276,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni data: { planId: this.description.plan.id, planName: this.description.plan.label, - blueprint: this.description.plan.blueprint + blueprint: this.isPublicView ? null : (this.description?.plan as Plan)?.blueprint, } }); } @@ -362,7 +362,9 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni getSectionNameById(sectionId: Guid): string { if (sectionId == null) return ''; - let sections: PlanBlueprintDefinitionSection[] = this.description?.plan?.blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id); + const blueprint = this.isPublicView ? null : (this.description?.plan as Plan)?.blueprint; + + let sections: PlanBlueprintDefinitionSection[] = blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id); return sections == null ? '' : sections[0].label; } diff --git a/frontend/src/app/ui/plan/overview/plan-overview.component.html b/frontend/src/app/ui/plan/overview/plan-overview.component.html index e4491d64c..a056258a5 100644 --- a/frontend/src/app/ui/plan/overview/plan-overview.component.html +++ b/frontend/src/app/ui/plan/overview/plan-overview.component.html @@ -47,7 +47,7 @@ {{'PLAN-OVERVIEW.LOCKED' | translate}}
- {{(isActive ? 'PLAN-OVERVIEW.EDITED' : 'PLAN-OVERVIEW.DELETED') | translate}} : + {{(isActive ? 'PLAN-OVERVIEW.EDITED' : 'PLAN-OVERVIEW.DELETED') | translate}} : {{plan.updatedAt | dateTimeFormatter: "d MMMM y"}}
diff --git a/frontend/src/app/ui/plan/overview/plan-overview.component.ts b/frontend/src/app/ui/plan/overview/plan-overview.component.ts index f5978a639..3264e9723 100644 --- a/frontend/src/app/ui/plan/overview/plan-overview.component.ts +++ b/frontend/src/app/ui/plan/overview/plan-overview.component.ts @@ -603,7 +603,7 @@ export class PlanOverviewComponent extends BaseComponent implements OnInit { getSectionNameById(sectionId: Guid): string { if (sectionId == null) return ''; - const blueprint = this.isPublicView ? null : (this.plan as Plan)?.blueprint; + const blueprint = this.isPublicView ? null : (this.plan as Plan)?.blueprint; let sections: PlanBlueprintDefinitionSection[] = blueprint?.definition?.sections?.filter((section: PlanBlueprintDefinitionSection) => sectionId === section.id); return sections == null ? '' : sections[0].label; diff --git a/frontend/src/assets/i18n/baq.json b/frontend/src/assets/i18n/baq.json index c0f58d9ed..d6215d098 100644 --- a/frontend/src/assets/i18n/baq.json +++ b/frontend/src/assets/i18n/baq.json @@ -782,6 +782,7 @@ "LOCKED": "Blokeatuta", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Diru-laguntza", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/de.json b/frontend/src/assets/i18n/de.json index 3b179ede6..67aefd8f6 100644 --- a/frontend/src/assets/i18n/de.json +++ b/frontend/src/assets/i18n/de.json @@ -782,6 +782,7 @@ "LOCKED": "Locked", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Förderung", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/en.json b/frontend/src/assets/i18n/en.json index 5908b000d..7fa605a57 100644 --- a/frontend/src/assets/i18n/en.json +++ b/frontend/src/assets/i18n/en.json @@ -834,7 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", - "DELETED": "Deleted", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/es.json b/frontend/src/assets/i18n/es.json index 2a0486135..24aa774ee 100644 --- a/frontend/src/assets/i18n/es.json +++ b/frontend/src/assets/i18n/es.json @@ -782,6 +782,7 @@ "LOCKED": "Bloqueado", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Subvención", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/gr.json b/frontend/src/assets/i18n/gr.json index ec3ebe0c7..eae2342dd 100644 --- a/frontend/src/assets/i18n/gr.json +++ b/frontend/src/assets/i18n/gr.json @@ -782,6 +782,7 @@ "LOCKED": "Κλειδωμένο", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Επιχορήγηση", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/hr.json b/frontend/src/assets/i18n/hr.json index 8cfbbdb7d..f19a86d2e 100644 --- a/frontend/src/assets/i18n/hr.json +++ b/frontend/src/assets/i18n/hr.json @@ -782,6 +782,7 @@ "LOCKED": "Zaključano", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Potpora", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/pl.json b/frontend/src/assets/i18n/pl.json index bcbd9decf..c6e7b27db 100644 --- a/frontend/src/assets/i18n/pl.json +++ b/frontend/src/assets/i18n/pl.json @@ -782,6 +782,7 @@ "LOCKED": "Zablokowany", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Dotacja", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/pt.json b/frontend/src/assets/i18n/pt.json index 9c6cc03f0..f1b6abb8a 100644 --- a/frontend/src/assets/i18n/pt.json +++ b/frontend/src/assets/i18n/pt.json @@ -782,6 +782,7 @@ "LOCKED": "Bloqueado", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Grant", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/sk.json b/frontend/src/assets/i18n/sk.json index 48f4e10a4..36ec3ba9c 100644 --- a/frontend/src/assets/i18n/sk.json +++ b/frontend/src/assets/i18n/sk.json @@ -782,6 +782,7 @@ "LOCKED": "Zamknuté", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Grant", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/sr.json b/frontend/src/assets/i18n/sr.json index 7b7bc894c..f9a1bc641 100644 --- a/frontend/src/assets/i18n/sr.json +++ b/frontend/src/assets/i18n/sr.json @@ -782,6 +782,7 @@ "LOCKED": "Zaključano", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Grant", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant", diff --git a/frontend/src/assets/i18n/tr.json b/frontend/src/assets/i18n/tr.json index af2f70249..c6e8ee96f 100644 --- a/frontend/src/assets/i18n/tr.json +++ b/frontend/src/assets/i18n/tr.json @@ -782,6 +782,7 @@ "LOCKED": "Kilitli", "VERSION": "Version", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "GRANT": "Hibe", "DESCRIPTION": "Description", @@ -833,6 +834,7 @@ "PUBLIC": "Public", "LOCKED": "Locked", "EDITED": "Edited", + "DELETED": "Deleted", "FINALISED": "Finalized", "PART-OF": "Part of", "GRANT": "Grant",