From e4567b8b75c199a05f0341f9dead3af8eafadee7 Mon Sep 17 00:00:00 2001 From: "CITE\\amentis" Date: Fri, 20 Sep 2024 18:13:13 +0300 Subject: [PATCH] ui fixes --- .../recent-edited-activity.component.ts | 10 ++++++---- .../listing/description-listing.component.ts | 6 ++++-- .../description-listing-item.component.html | 2 +- .../listing-item/description-listing-item.component.ts | 5 +++++ .../listing-item/plan-listing-item.component.ts | 4 +++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index b19b69bcd..6f3024af5 100644 --- a/frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -28,8 +28,8 @@ import { BehaviorSubject } from 'rxjs'; import { debounceTime, map, takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ActivityListingType } from '../dashboard.component'; -import { DescriptionStatus } from '@app/core/model/description-status/description-status'; -import { PlanStatus } from '@app/core/model/plan-status/plan-status'; +import { DescriptionStatus, DescriptionStatusDefinition } from '@app/core/model/description-status/description-status'; +import { PlanStatus, PlanStatusDefinition } from '@app/core/model/plan-status/plan-status'; @Component({ selector: 'app-recent-edited-activity', @@ -274,7 +274,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn [nameof(x => x.plan), nameof(x => x.description)].join('.'), [nameof(x => x.plan), nameof(x => x.status), nameof(x => x.id)].join('.'), [nameof(x => x.plan), nameof(x => x.status), nameof(x => x.name)].join('.'), - [nameof(x => x.plan), nameof(x => x.status), nameof(x => x.internalStatus)].join('.'), + [nameof(x => x.plan), nameof(x => x.status), nameof(x => x.internalStatus)].join('.'), + [nameof(x => x.plan), nameof(x => x.status), nameof(x => x.definition), nameof(x => x.availableActions)].join('.'), [nameof(x => x.plan), nameof(x => x.accessType)].join('.'), [nameof(x => x.plan), nameof(x => x.version)].join('.'), [nameof(x => x.plan), nameof(x => x.versionStatus)].join('.'), @@ -326,7 +327,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn [nameof(x => x.description), nameof(x => x.label)].join('.'), [nameof(x => x.description), nameof(x => x.status), nameof(x => x.id)].join('.'), [nameof(x => x.description), nameof(x => x.status), nameof(x => x.name)].join('.'), - [nameof(x => x.description), nameof(x => x.status), nameof(x => x.internalStatus)].join('.'), + [nameof(x => x.description), nameof(x => x.status), nameof(x => x.internalStatus)].join('.'), + [nameof(x => x.description), nameof(x => x.status), nameof(x => x.definition), nameof(x => x.availableActions)].join('.'), [nameof(x => x.description), nameof(x => x.updatedAt)].join('.'), [nameof(x => x.description), nameof(x => x.isActive)].join('.'), [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), diff --git a/frontend/src/app/ui/description/listing/description-listing.component.ts b/frontend/src/app/ui/description/listing/description-listing.component.ts index 2b9af85a4..998f20aaf 100644 --- a/frontend/src/app/ui/description/listing/description-listing.component.ts +++ b/frontend/src/app/ui/description/listing/description-listing.component.ts @@ -43,7 +43,7 @@ import { InterceptorType } from '@common/http/interceptors/interceptor-type'; import { PrincipalService } from '@app/core/services/http/principal.service'; import { DescriptionListingFilters } from './filtering/description-filter.component'; import { MatSelectChange } from '@angular/material/select'; -import { DescriptionStatus } from '@app/core/model/description-status/description-status'; +import { DescriptionStatus, DescriptionStatusDefinition } from '@app/core/model/description-status/description-status'; import { PlanStatus } from '@app/core/model/plan-status/plan-status'; @Component({ @@ -494,7 +494,9 @@ export class DescriptionListingComponent extends BaseListingComponent(x => x.label), [nameof(x => x.status), nameof(x => x.id)].join('.'), [nameof(x => x.status), nameof(x => x.name)].join('.'), - [nameof(x => x.status), nameof(x => x.internalStatus)].join('.'), + [nameof(x => x.status), nameof(x => x.internalStatus)].join('.'), + [nameof(x => x.status), nameof(x => x.definition), nameof(x => x.availableActions)].join('.'), + nameof(x => x.updatedAt), nameof(x => x.belongsToCurrentTenant), nameof(x => x.finalizedAt), diff --git a/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html b/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html index 2a4f80689..4c933e0c3 100644 --- a/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html +++ b/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.html @@ -36,7 +36,7 @@
- open_in_new{{'DESCRIPTION-LISTING.ACTIONS.EXPORT' | translate}} + open_in_new{{'DESCRIPTION-LISTING.ACTIONS.EXPORT' | translate}} group_add{{'DESCRIPTION-LISTING.ACTIONS.INVITE-SHORT' | translate}} file_copy{{'DESCRIPTION-LISTING.ACTIONS.COPY-DESCRIPTION' | translate}} delete{{ 'DESCRIPTION-LISTING.ACTIONS.DELETE' | translate }} diff --git a/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts b/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts index 0b71f7c9a..25e3878e7 100644 --- a/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts +++ b/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts @@ -30,6 +30,7 @@ import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; import { Tenant } from '@app/core/model/tenant/tenant'; +import { DescriptionStatusAvailableActionType } from '@app/core/common/enum/description-status-available-action-type'; @Component({ selector: 'app-description-listing-item-component', @@ -53,6 +54,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On canDelete: boolean = false; canEdit: boolean = false; canInvitePlanUsers: boolean = false; + canExport: boolean = false; constructor( public routerUtils: RouterUtilsService, @@ -98,6 +100,9 @@ export class DescriptionListingItemComponent extends BaseComponent implements On this.canInvitePlanUsers = !this.isPublic && (this.authService.hasPermission(AppPermission.InvitePlanUsers) || this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false; + + this.canExport = this.description.authorizationFlags?.some(x => x === AppPermission.ExportDescription) || this.authentication.hasPermission(AppPermission.ExportDescription) && + this.description.status?.definition?.availableActions?.filter(x => x === DescriptionStatusAvailableActionType.Export).length > 0; } public getTenantName(id: Guid): string { diff --git a/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts b/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts index e630abdfa..939f27dd7 100644 --- a/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts +++ b/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts @@ -29,6 +29,7 @@ import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; import { Tenant } from '@app/core/model/tenant/tenant'; +import { PlanStatusAvailableActionType } from '@app/core/common/enum/plan-status-available-action-type'; @Component({ selector: 'app-plan-listing-item-component', @@ -71,7 +72,8 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit { } get canExportPlan(): boolean { - return this.plan.authorizationFlags?.some(x => x === AppPermission.ExportPlan) || this.authentication.hasPermission(AppPermission.ExportPlan); + return this.plan.authorizationFlags?.some(x => x === AppPermission.ExportPlan) || this.authentication.hasPermission(AppPermission.ExportPlan) && + this.plan.status?.definition?.availableActions?.filter(x => x === PlanStatusAvailableActionType.Export).length > 0;; } get canInvitePlanUsers(): boolean {