From 61e7ba46fcbcdc288343c1193a0bffc90ebdfcda Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 29 Aug 2024 15:25:20 +0300 Subject: [PATCH] Adjusted typing --- .../entity-conflict-dialog.component.ts | 7 ++++--- .../src/app/shared/import-export/import-export.service.ts | 7 +++---- ui-ngx/src/app/shared/models/entity.models.ts | 5 ----- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/shared/components/dialog/entity-conflict-dialog/entity-conflict-dialog.component.ts b/ui-ngx/src/app/shared/components/dialog/entity-conflict-dialog/entity-conflict-dialog.component.ts index c0879d8ac2..b4f34ed232 100644 --- a/ui-ngx/src/app/shared/components/dialog/entity-conflict-dialog/entity-conflict-dialog.component.ts +++ b/ui-ngx/src/app/shared/components/dialog/entity-conflict-dialog/entity-conflict-dialog.component.ts @@ -20,12 +20,13 @@ import { SharedModule } from '@shared/shared.module'; import { ImportExportService } from '@shared/import-export/import-export.service'; import { CommonModule } from '@angular/common'; import { entityTypeTranslations } from '@shared/models/entity-type.models'; -import { EntityDTOInfoData, EntityInfoData } from '@shared/models/entity.models'; +import { EntityInfoData } from '@shared/models/entity.models'; import { EntityId } from '@shared/models/id/entity-id'; +import { RuleChainMetaData } from '@shared/models/rule-chain.models'; interface EntityConflictDialogData { message: string; - entity: EntityInfoData | EntityDTOInfoData; + entity: EntityInfoData | RuleChainMetaData; } @Component({ @@ -49,7 +50,7 @@ export class EntityConflictDialogComponent { private dialogRef: MatDialogRef, private importExportService: ImportExportService, ) { - this.entityId = (data.entity as EntityInfoData).id ?? (data.entity as EntityDTOInfoData).ruleChainId; + this.entityId = (data.entity as EntityInfoData).id ?? (data.entity as RuleChainMetaData).ruleChainId; } onCancel(): void { diff --git a/ui-ngx/src/app/shared/import-export/import-export.service.ts b/ui-ngx/src/app/shared/import-export/import-export.service.ts index be25786d5d..5f246873d7 100644 --- a/ui-ngx/src/app/shared/import-export/import-export.service.ts +++ b/ui-ngx/src/app/shared/import-export/import-export.service.ts @@ -56,7 +56,6 @@ import { UtilsService } from '@core/services/utils.service'; import { WidgetService } from '@core/http/widget.service'; import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; import { - EntityDTOInfoData, EntityInfoData, ImportEntitiesResultInfo, ImportEntityData @@ -365,8 +364,8 @@ export class ImportExportService { }); } - public exportEntity(entityData: EntityInfoData | EntityDTOInfoData): void { - const id = (entityData as EntityInfoData).id ?? (entityData as EntityDTOInfoData).ruleChainId; + public exportEntity(entityData: EntityInfoData | RuleChainMetaData): void { + const id = (entityData as EntityInfoData).id ?? (entityData as RuleChainMetaData).ruleChainId; let preparedData; switch (id.entityType) { case EntityType.DEVICE_PROFILE: @@ -395,7 +394,7 @@ export class ImportExportService { default: preparedData = this.prepareExport(entityData); } - this.exportToPc(preparedData, entityData.name); + this.exportToPc(preparedData, (entityData as EntityInfoData).name); } private exportSelectedWidgetsBundle(widgetsBundle: WidgetsBundle): void { diff --git a/ui-ngx/src/app/shared/models/entity.models.ts b/ui-ngx/src/app/shared/models/entity.models.ts index 5d9a3f6f04..40ec570b13 100644 --- a/ui-ngx/src/app/shared/models/entity.models.ts +++ b/ui-ngx/src/app/shared/models/entity.models.ts @@ -34,11 +34,6 @@ export interface EntityInfoData { name: string; } -export interface EntityDTOInfoData { - ruleChainId: EntityId; - name: string; -} - export interface ImportEntityData { lineNumber: number; name: string;