From 313662587d6d402f29fa25d18fe00c89cf2f3f02 Mon Sep 17 00:00:00 2001 From: "CITE\\spapacharalampous" Date: Wed, 28 Aug 2024 14:53:16 +0300 Subject: [PATCH] listing actions --- .../listing/status-listing.component.html | 4 ++-- .../status/listing/status-listing.component.ts | 9 +++++++++ .../description-status-listing.component.html | 4 ++-- .../description-status-listing.component.ts | 16 ++++++++-------- ...ription-template-type-listing.component.html | 4 ++-- ...scription-template-type-listing.component.ts | 9 +++++++++ .../entity-locks/lock-listing.component.html | 6 +++--- .../entity-locks/lock-listing.component.ts | 5 +++++ .../listing/language-listing.component.html | 6 +++--- .../listing/language-listing.component.ts | 9 +++++++++ .../listing/plan-blueprint-listing.component.ts | 2 +- .../plan-status-listing.component.html | 4 ++-- .../plan-status-listing.component.ts | 17 +++++++++-------- .../prefilling-source-listing.component.html | 4 ++-- .../prefilling-source-listing.component.ts | 10 ++++++++++ .../reference-type-listing.component.html | 4 ++-- .../listing/reference-type-listing.component.ts | 9 +++++++++ .../listing/reference-listing.component.html | 4 ++-- .../listing/reference-listing.component.ts | 9 +++++++++ .../listing/tenant-listing.component.html | 4 ++-- .../tenant/listing/tenant-listing.component.ts | 9 +++++++++ .../listing/usage-limit-listing.component.html | 4 ++-- .../listing/usage-limit-listing.component.ts | 9 +++++++++ ...notification-template-listing.component.html | 6 +++--- .../notification-template-listing.component.ts | 9 +++++++++ .../notification-listing.component.html | 4 ++-- .../notification-listing.component.ts | 5 +++++ 27 files changed, 139 insertions(+), 46 deletions(-) diff --git a/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.html b/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.html index 4c77d77f1..b34d320d6 100644 --- a/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.html +++ b/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.html @@ -80,10 +80,10 @@ more_horiz - - diff --git a/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.ts b/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.ts index 648a2967d..06c19b699 100644 --- a/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.ts +++ b/frontend/src/annotation-service/ui/admin/status/listing/status-listing.component.ts @@ -24,6 +24,7 @@ import { StatusService } from '@annotation-service/services/http/status.service' import { AnnotationServiceEnumUtils } from '@annotation-service/core/formatting/enum-utils.service'; import { InternalStatusTypePipe } from '@annotation-service/core/formatting/pipes/internal-status-type.pipe'; import { IsActiveTypePipe } from '@annotation-service/core/formatting/pipes/is-active-type.pipe'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './status-listing.component.html', @@ -73,6 +74,14 @@ export class StatusListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/description-status/listing/description-status-listing/description-status-listing.component.ts b/frontend/src/app/ui/admin/description-status/listing/description-status-listing/description-status-listing.component.ts index 976a7f0ef..14bd7cb14 100644 --- a/frontend/src/app/ui/admin/description-status/listing/description-status-listing/description-status-listing.component.ts +++ b/frontend/src/app/ui/admin/description-status/listing/description-status-listing/description-status-listing.component.ts @@ -67,6 +67,14 @@ export class DescriptionStatusListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts b/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts index 141068cf5..7802d8f5f 100644 --- a/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts +++ b/frontend/src/app/ui/admin/description-types/listing/description-template-type-listing.component.ts @@ -24,6 +24,7 @@ import { TranslateService } from '@ngx-translate/core'; import { Observable } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './description-template-type-listing.component.html', @@ -77,6 +78,14 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen super.ngOnInit(); } + protected canEdit(descriptionType: DescriptionTemplateType): boolean { + return this.authService.hasPermission(AppPermission.EditDescriptionTemplateType) && descriptionType.belongsToCurrentTenant && !this.isFinalized(descriptionType) && descriptionType.isActive === IsActive.Active; + } + + protected canDelete(descriptionType: DescriptionTemplateType): boolean { + return this.authService.hasPermission(AppPermission.DeleteDescriptionTemplateType) && descriptionType.belongsToCurrentTenant && descriptionType.isActive === IsActive.Active; + } + protected initializeLookup(): DescriptionTemplateTypeLookup { const lookup = new DescriptionTemplateTypeLookup(); lookup.metadata = { countAll: true }; diff --git a/frontend/src/app/ui/admin/entity-locks/lock-listing.component.html b/frontend/src/app/ui/admin/entity-locks/lock-listing.component.html index 4126fe7a9..461ce7f25 100644 --- a/frontend/src/app/ui/admin/entity-locks/lock-listing.component.html +++ b/frontend/src/app/ui/admin/entity-locks/lock-listing.component.html @@ -64,13 +64,13 @@ -
+
- - diff --git a/frontend/src/app/ui/admin/entity-locks/lock-listing.component.ts b/frontend/src/app/ui/admin/entity-locks/lock-listing.component.ts index 3585c89b6..6ad16e729 100644 --- a/frontend/src/app/ui/admin/entity-locks/lock-listing.component.ts +++ b/frontend/src/app/ui/admin/entity-locks/lock-listing.component.ts @@ -23,6 +23,7 @@ import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/serv import { LockTargetTypePipe } from '@common/formatting/pipes/lock-target-type.pipe'; import { User } from '@app/core/model/user/user'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './lock-listing.component.html', @@ -73,6 +74,10 @@ export class LockListingComponent extends BaseListingComponent super.ngOnInit(); } + protected canDelete(lock: Lock): boolean { + return this.authService.hasPermission(AppPermission.DeleteLock) && lock?.belongsToCurrentTenant; + } + protected initializeLookup(): LockLookup { const lookup = new LockLookup(); lookup.metadata = { countAll: true }; diff --git a/frontend/src/app/ui/admin/language/listing/language-listing.component.html b/frontend/src/app/ui/admin/language/listing/language-listing.component.html index 2a5caa8d8..7c805c560 100644 --- a/frontend/src/app/ui/admin/language/listing/language-listing.component.html +++ b/frontend/src/app/ui/admin/language/listing/language-listing.component.html @@ -75,16 +75,16 @@ -
+
- - diff --git a/frontend/src/app/ui/admin/language/listing/language-listing.component.ts b/frontend/src/app/ui/admin/language/listing/language-listing.component.ts index 9a9bc557f..6ff4dd361 100644 --- a/frontend/src/app/ui/admin/language/listing/language-listing.component.ts +++ b/frontend/src/app/ui/admin/language/listing/language-listing.component.ts @@ -23,6 +23,7 @@ import { TranslateService } from '@ngx-translate/core'; import { Observable } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './language-listing.component.html', @@ -72,6 +73,14 @@ export class LanguageListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/plan-status/listing/plan-status-listing/plan-status-listing.component.ts b/frontend/src/app/ui/admin/plan-status/listing/plan-status-listing/plan-status-listing.component.ts index 7c8328400..b3a78b0a5 100644 --- a/frontend/src/app/ui/admin/plan-status/listing/plan-status-listing/plan-status-listing.component.ts +++ b/frontend/src/app/ui/admin/plan-status/listing/plan-status-listing/plan-status-listing.component.ts @@ -25,6 +25,7 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog import { MatDialog } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import { PlanStatusEnum } from '@app/core/common/enum/plan-status'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ selector: 'app-plan-status-listing', @@ -67,6 +68,14 @@ export class PlanStatusListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/prefilling-source/listing/prefilling-source-listing.component.ts b/frontend/src/app/ui/admin/prefilling-source/listing/prefilling-source-listing.component.ts index ab89eccde..6b4cc132e 100644 --- a/frontend/src/app/ui/admin/prefilling-source/listing/prefilling-source-listing.component.ts +++ b/frontend/src/app/ui/admin/prefilling-source/listing/prefilling-source-listing.component.ts @@ -23,6 +23,7 @@ import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './prefilling-source-listing.component.html', @@ -73,6 +74,15 @@ export class PrefillingSourceListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/reference-type/listing/reference-type-listing.component.ts b/frontend/src/app/ui/admin/reference-type/listing/reference-type-listing.component.ts index eae23c267..b3ed9d8b9 100644 --- a/frontend/src/app/ui/admin/reference-type/listing/reference-type-listing.component.ts +++ b/frontend/src/app/ui/admin/reference-type/listing/reference-type-listing.component.ts @@ -23,6 +23,7 @@ import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './reference-type-listing.component.html', @@ -72,6 +73,14 @@ export class ReferenceTypeListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/reference/listing/reference-listing.component.ts b/frontend/src/app/ui/admin/reference/listing/reference-listing.component.ts index fbd3e6ef2..ed8d20bbe 100644 --- a/frontend/src/app/ui/admin/reference/listing/reference-listing.component.ts +++ b/frontend/src/app/ui/admin/reference/listing/reference-listing.component.ts @@ -25,6 +25,7 @@ import { TranslateService } from '@ngx-translate/core'; import { Observable } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './reference-listing.component.html', @@ -78,6 +79,14 @@ export class ReferenceListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/tenant/listing/tenant-listing.component.ts b/frontend/src/app/ui/admin/tenant/listing/tenant-listing.component.ts index 5e6081383..7c80ca358 100644 --- a/frontend/src/app/ui/admin/tenant/listing/tenant-listing.component.ts +++ b/frontend/src/app/ui/admin/tenant/listing/tenant-listing.component.ts @@ -23,6 +23,7 @@ import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './tenant-listing.component.html', @@ -72,6 +73,14 @@ export class TenantListingComponent extends BaseListingComponentmore_horiz - - diff --git a/frontend/src/app/ui/admin/usage-limit/listing/usage-limit-listing.component.ts b/frontend/src/app/ui/admin/usage-limit/listing/usage-limit-listing.component.ts index b04b549a4..6fcf0d5ea 100644 --- a/frontend/src/app/ui/admin/usage-limit/listing/usage-limit-listing.component.ts +++ b/frontend/src/app/ui/admin/usage-limit/listing/usage-limit-listing.component.ts @@ -25,6 +25,7 @@ import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; import { UsageLimitTargetMetricPipe } from '@common/formatting/pipes/usage-limits-target-metric.pipe'; import { UsageLimitTargetMetric } from '@app/core/common/enum/usage-limit-target-metric'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './usage-limit-listing.component.html', @@ -76,6 +77,14 @@ export class UsageLimitListingComponent extends BaseListingComponent -
+
- - diff --git a/frontend/src/notification-service/ui/admin/notification-template/listing/notification-template-listing.component.ts b/frontend/src/notification-service/ui/admin/notification-template/listing/notification-template-listing.component.ts index 4c3432a92..70e4c3eb8 100644 --- a/frontend/src/notification-service/ui/admin/notification-template/listing/notification-template-listing.component.ts +++ b/frontend/src/notification-service/ui/admin/notification-template/listing/notification-template-listing.component.ts @@ -27,6 +27,7 @@ import { Language } from '@app/core/model/language/language'; import { NotificationTypePipe } from '@common/formatting/pipes/notification-type.pipe'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { RouterUtilsService } from '@app/core/services/router/router-utils.service'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './notification-template-listing.component.html', @@ -77,6 +78,14 @@ export class NotificationTemplateListingComponent extends BaseListingComponent -
+
- diff --git a/frontend/src/notification-service/ui/admin/notification/notification-listing.component.ts b/frontend/src/notification-service/ui/admin/notification/notification-listing.component.ts index c37797ea1..535582d90 100644 --- a/frontend/src/notification-service/ui/admin/notification/notification-listing.component.ts +++ b/frontend/src/notification-service/ui/admin/notification/notification-listing.component.ts @@ -27,6 +27,7 @@ import { NotificationTrackingStatePipe } from '@common/formatting/pipes/notifica import { NotificationTrackingProcessPipe } from '@common/formatting/pipes/notification-tracking-process.pipe'; import { IsActive } from '@notification-service/core/enum/is-active.enum'; import { DataTableDateTimeFormatPipe } from '@app/core/pipes/date-time-format.pipe'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; @Component({ templateUrl: './notification-listing.component.html', @@ -83,6 +84,10 @@ export class NotificationListingComponent extends BaseListingComponent