From 54114d3dd284af2919e9370862f9f44cc854efe6 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 12 Jan 2022 19:28:42 +0200 Subject: [PATCH] UI: Fix cycle dependency --- ui-ngx/src/app/core/utils.ts | 8 ------- .../home/pages/admin/admin-routing.module.ts | 2 +- .../home/pages/asset/asset-routing.module.ts | 2 +- .../pages/customer/customer-routing.module.ts | 2 +- .../device-profile-routing.module.ts | 2 +- .../pages/device/device-routing.module.ts | 2 +- .../home/pages/edge/edge-routing.module.ts | 2 +- .../entity-view/entity-view-routing.module.ts | 2 +- .../modules/home/pages/home-pages.models.ts | 24 +++++++++++++++++++ .../ota-update/ota-update-routing.module.ts | 2 +- .../tenant-profile-routing.module.ts | 2 +- .../pages/tenant/tenant-routing.module.ts | 2 +- .../home/pages/user/user-routing.module.ts | 2 +- 13 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/pages/home-pages.models.ts diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 5d5c534cd4..3620c10118 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -20,8 +20,6 @@ import { finalize, share } from 'rxjs/operators'; import { Datasource } from '@app/shared/models/widget.models'; import { EntityId } from '@shared/models/id/entity-id'; import { NULL_UUID } from '@shared/models/id/has-uuid'; -import { BreadCrumbLabelFunction } from '@shared/components/breadcrumb'; -import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { EntityType, baseDetailsPageByEntityType } from '@shared/models/entity-type.models'; const varsRegex = /\${([^}]*)}/g; @@ -464,12 +462,6 @@ export function randomAlphanumeric(length: number): string { return result; } -export const entityDetailsPageBreadcrumbLabelFunction: BreadCrumbLabelFunction - = ((route, translate, component) => { - return component.entity?.name || component.headerSubtitle; -}); - - export function getEntityDetailsPageURL(id: string, entityType: EntityType): string { return `${baseDetailsPageByEntityType.get(entityType)}/${id}`; } diff --git a/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts b/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts index 7d3a04d4ec..568db8645e 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/admin-routing.module.ts @@ -30,7 +30,7 @@ import { HomeSettingsComponent } from '@home/pages/admin/home-settings.component import { EntitiesTableComponent } from '@home/components/entity/entities-table.component'; import { ResourcesLibraryTableConfigResolver } from '@home/pages/admin/resource/resources-library-table-config.resolve'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; @Injectable() diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset-routing.module.ts b/ui-ngx/src/app/modules/home/pages/asset/asset-routing.module.ts index 0da51c2d8c..5bee627936 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/asset/asset-routing.module.ts @@ -23,7 +23,7 @@ import { AssetsTableConfigResolver } from './assets-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; const routes: Routes = [ { diff --git a/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts b/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts index f4f640e892..cb81c94e34 100644 --- a/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts @@ -30,7 +30,7 @@ import { dashboardBreadcumbLabelFunction, DashboardResolver } from '@home/pages/ import { EdgesTableConfigResolver } from '@home/pages/edge/edges-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; const routes: Routes = [ { diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-routing.module.ts b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-routing.module.ts index 20f097ec9c..0fe57b3745 100644 --- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-routing.module.ts @@ -22,7 +22,7 @@ import { Authority } from '@shared/models/authority.enum'; import { DeviceProfilesTableConfigResolver } from './device-profiles-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [ diff --git a/ui-ngx/src/app/modules/home/pages/device/device-routing.module.ts b/ui-ngx/src/app/modules/home/pages/device/device-routing.module.ts index 2a300096e5..7ecf85d2f8 100644 --- a/ui-ngx/src/app/modules/home/pages/device/device-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/device/device-routing.module.ts @@ -22,7 +22,7 @@ import { Authority } from '@shared/models/authority.enum'; import { DevicesTableConfigResolver } from '@modules/home/pages/device/devices-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [ diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts index f3bacc9e0c..f36738b574 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts @@ -40,7 +40,7 @@ import { TooltipsterResolver } from '@home/pages/rulechain/rulechain-routing.module'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; const routes: Routes = [ { diff --git a/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-routing.module.ts b/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-routing.module.ts index b3c7ef7067..c6dd767697 100644 --- a/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/entity-view/entity-view-routing.module.ts @@ -22,7 +22,7 @@ import { Authority } from '@shared/models/authority.enum'; import { EntityViewsTableConfigResolver } from '@modules/home/pages/entity-view/entity-views-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [ 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 new file mode 100644 index 0000000000..e856bb7a1d --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-pages.models.ts @@ -0,0 +1,24 @@ +/// +/// Copyright © 2016-2021 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { BreadCrumbLabelFunction } from '@shared/components/breadcrumb'; +import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; + +export const entityDetailsPageBreadcrumbLabelFunction: BreadCrumbLabelFunction + = ((route, translate, component) => { + return component.entity?.name || component.headerSubtitle; +}); + diff --git a/ui-ngx/src/app/modules/home/pages/ota-update/ota-update-routing.module.ts b/ui-ngx/src/app/modules/home/pages/ota-update/ota-update-routing.module.ts index 0877d3c50b..94b621723c 100644 --- a/ui-ngx/src/app/modules/home/pages/ota-update/ota-update-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/ota-update/ota-update-routing.module.ts @@ -21,7 +21,7 @@ import { NgModule } from '@angular/core'; import { OtaUpdateTableConfigResolve } from '@home/pages/ota-update/ota-update-table-config.resolve'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [ diff --git a/ui-ngx/src/app/modules/home/pages/tenant-profile/tenant-profile-routing.module.ts b/ui-ngx/src/app/modules/home/pages/tenant-profile/tenant-profile-routing.module.ts index 850709c8fd..2f483c410a 100644 --- a/ui-ngx/src/app/modules/home/pages/tenant-profile/tenant-profile-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/tenant-profile/tenant-profile-routing.module.ts @@ -22,7 +22,7 @@ import { Authority } from '@shared/models/authority.enum'; import { TenantProfilesTableConfigResolver } from './tenant-profiles-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [ diff --git a/ui-ngx/src/app/modules/home/pages/tenant/tenant-routing.module.ts b/ui-ngx/src/app/modules/home/pages/tenant/tenant-routing.module.ts index 6469a1f3b7..330c45887a 100644 --- a/ui-ngx/src/app/modules/home/pages/tenant/tenant-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/tenant/tenant-routing.module.ts @@ -23,7 +23,7 @@ import { TenantsTableConfigResolver } from '@modules/home/pages/tenant/tenants-t import { UsersTableConfigResolver } from '../user/users-table-config.resolver'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [ diff --git a/ui-ngx/src/app/modules/home/pages/user/user-routing.module.ts b/ui-ngx/src/app/modules/home/pages/user/user-routing.module.ts index 62504098b2..472420fa34 100644 --- a/ui-ngx/src/app/modules/home/pages/user/user-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/user/user-routing.module.ts @@ -20,7 +20,7 @@ import { UsersTableConfigResolver } from '@modules/home/pages/user/users-table-c import { Authority } from '@shared/models/authority.enum'; import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; -import { entityDetailsPageBreadcrumbLabelFunction } from '@core/utils'; +import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; const routes: Routes = [