From f9753f40cdd9a42a89d4389946d023d908c07fd5 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 7 Sep 2023 12:12:42 +0300 Subject: [PATCH] UI: refactoring --- .../admin/resource/resources-library.component.ts | 1 - .../src/app/modules/home/pages/home-pages.models.ts | 11 ++++++++++- .../home/pages/ota-update/ota-update.component.ts | 2 -- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts b/ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts index 99d8697dc5..19e4ed03ea 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/resources-library.component.ts @@ -98,7 +98,6 @@ export class ResourcesLibraryComponent extends EntityComponent impleme } updateForm(entity: Resource) { - this.entity.name = entity.title; if (this.isEdit) { this.entityForm.get('resourceType').disable({emitEvent: false}); if (entity.resourceType !== ResourceType.JS_MODULE) { diff --git a/ui-ngx/src/app/modules/home/pages/home-pages.models.ts b/ui-ngx/src/app/modules/home/pages/home-pages.models.ts index cd6190bb00..3979730f0c 100644 --- a/ui-ngx/src/app/modules/home/pages/home-pages.models.ts +++ b/ui-ngx/src/app/modules/home/pages/home-pages.models.ts @@ -16,9 +16,18 @@ import { BreadCrumbLabelFunction } from '@shared/components/breadcrumb'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; +import { EntityType } from '@shared/models/entity-type.models'; +import { ResourceInfo } from '@shared/models/resource.models'; +import { OtaPackage } from '@shared/models/ota-package.models'; export const entityDetailsPageBreadcrumbLabelFunction: BreadCrumbLabelFunction = ((route, translate, component) => { - return component.entity?.name; + switch (component.entitiesTableConfig.entityType) { + case EntityType.TB_RESOURCE: + case EntityType.OTA_PACKAGE: + return (component.entity as ResourceInfo | OtaPackage)?.title; + default: + return component.entity?.name; + } }); diff --git a/ui-ngx/src/app/modules/home/pages/ota-update/ota-update.component.ts b/ui-ngx/src/app/modules/home/pages/ota-update/ota-update.component.ts index 2979c385ed..da479fa190 100644 --- a/ui-ngx/src/app/modules/home/pages/ota-update/ota-update.component.ts +++ b/ui-ngx/src/app/modules/home/pages/ota-update/ota-update.component.ts @@ -129,8 +129,6 @@ export class OtaUpdateComponent extends EntityComponent implements O } updateForm(entity: OtaPackage) { - this.entity.name = entity.title; - this.entityForm.patchValue({ title: entity.title, version: entity.version,