diff --git a/application/src/test/java/org/thingsboard/server/controller/DevelopmentNoticeCaptureStampTest.java b/application/src/test/java/org/thingsboard/server/controller/DevelopmentNoticeCaptureStampTest.java index 6a0631fd98..bf401d10fe 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DevelopmentNoticeCaptureStampTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/DevelopmentNoticeCaptureStampTest.java @@ -62,7 +62,7 @@ public class DevelopmentNoticeCaptureStampTest { .as("no subscribing call to %s in the capture path to order against", STAMP_METHOD) .isTrue(); - int captured = capture.indexOf("html2canvas("); + int captured = capture.indexOf("domToCanvas("); int serialised = capture.indexOf("toDataURL"); assertThat(captured).as("no capture call found to order against").isNotNegative(); assertThat(serialised).as("no serialisation call found to order against").isNotNegative(); diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 0364996e3c..bd9ce3d1b1 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -63,7 +63,6 @@ "flot": "https://github.com/thingsboard/flot.git#0.9-work", "flot.curvedlines": "https://github.com/MichaelZinsmaier/CurvedLines.git#master", "font-awesome": "^4.7.0", - "html2canvas": "^1.4.1", "hugerte": "~1.0.14", "jquery": "^3.7.1", "jquery-sparkline": "^2.4.0", @@ -82,6 +81,7 @@ "libphonenumber-js": "^1.13.15", "maplibre-gl": "6.15.0", "marked": "~16.4.2", + "modern-screenshot": "^4.7.0", "moment": "^2.31.0", "moment-timezone": "^0.6.5", "ngx-captcha": "^14.0.0", diff --git a/ui-ngx/src/app/core/http/widget.service.ts b/ui-ngx/src/app/core/http/widget.service.ts index 0f25a0b2f0..47f7923b9b 100644 --- a/ui-ngx/src/app/core/http/widget.service.ts +++ b/ui-ngx/src/app/core/http/widget.service.ts @@ -26,10 +26,7 @@ import { filter, map, mergeMap, tap } from 'rxjs/operators'; import { WidgetTypeId } from '@shared/models/id/widget-type-id'; import { NULL_UUID } from '@shared/models/id/has-uuid'; import { ActivationEnd, Router } from '@angular/router'; -import { - BasicWidgetConfigComponent, - IBasicWidgetConfigComponent -} from '@home/components/widget/config/widget-config.component.models'; +import type { BasicWidgetConfigComponent, IBasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models'; import { ResourcesService } from '@core/services/resources.service'; import { UserPermissionsService } from '@core/http/user-permissions.service'; import { Operation, Resource } from '@shared/models/security.models'; @@ -301,8 +298,8 @@ export class WidgetService { this.widgetsInfoInMemoryCache.set(widgetInfo.fullFqn, widgetInfo); } - public registerBasicWidgetConfigComponents(module: any) { - Object.assign(this.basicWidgetSettingsComponentsMap, this.resourcesService.extractComponentsFromModule(module, BasicWidgetConfigComponent)); + public registerBasicWidgetConfigComponents(module: any, baseType: typeof BasicWidgetConfigComponent) { + Object.assign(this.basicWidgetSettingsComponentsMap, this.resourcesService.extractComponentsFromModule(module, baseType)); } public getBasicWidgetSettingsComponentBySelector(selector: string): Type { diff --git a/ui-ngx/src/app/core/services/dashboard-utils.service.ts b/ui-ngx/src/app/core/services/dashboard-utils.service.ts index a121cddf28..ffa249754c 100644 --- a/ui-ngx/src/app/core/services/dashboard-utils.service.ts +++ b/ui-ngx/src/app/core/services/dashboard-utils.service.ts @@ -65,7 +65,7 @@ import { BackgroundType, colorBackground, isBackgroundSettings } from '@shared/m import { MediaBreakpoints } from '@shared/models/constants'; import { TranslateService } from '@ngx-translate/core'; import { DashboardPageLayout } from '@home/components/dashboard-page/dashboard-page.models'; -import { maxGridsterCol, maxGridsterRow } from '@home/models/dashboard-component.models'; +import { maxGridsterCol, maxGridsterRow } from '@shared/models/dashboard.models'; import { findWidgetModelDefinition, widgetHasTimewindow, diff --git a/ui-ngx/src/app/core/services/home.service.ts b/ui-ngx/src/app/core/services/home.service.ts index f90ee379df..82a35e4fca 100644 --- a/ui-ngx/src/app/core/services/home.service.ts +++ b/ui-ngx/src/app/core/services/home.service.ts @@ -1,10 +1,11 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { EventEmitter, Injectable } from '@angular/core'; import { ActiveComponentService } from '@core/services/active-component.service'; import { BehaviorSubject, Observable, shareReplay, Subject } from 'rxjs'; import { distinctUntilChanged } from 'rxjs/operators'; -import { RouterTabsComponent } from '@home/components/router-tabs.component'; +import type { RouterTabsComponent } from '@home/components/router-tabs.component'; import { isDefinedAndNotNull } from '@core/utils'; import { PageComponent } from '@shared/components/page.component'; @@ -43,7 +44,7 @@ export class HomeService { private activeComponentChanged(activeComponent: any) { this.hideMainToolbarSubject.next(false); let hideLoadingBar = false; - if (activeComponent && activeComponent instanceof RouterTabsComponent + if (activeComponent && (activeComponent as RouterTabsComponent).isRouterTabsComponent && isDefinedAndNotNull(activeComponent.activatedRoute?.snapshot?.data?.showMainLoadingBar)) { hideLoadingBar = !activeComponent.activatedRoute.snapshot.data.showMainLoadingBar; } else if (activeComponent && activeComponent instanceof PageComponent diff --git a/ui-ngx/src/app/modules/common/lazy-modules-map.ts b/ui-ngx/src/app/modules/common/lazy-modules-map.ts new file mode 100644 index 0000000000..ce46d971b3 --- /dev/null +++ b/ui-ngx/src/app/modules/common/lazy-modules-map.ts @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { defer, map, Observable, shareReplay, switchMap } from 'rxjs'; +import { IModulesMap } from '@modules/common/modules-map.models'; + +class LazyModulesMap implements IModulesMap { + + private modulesMap$: Observable = defer(() => import('@modules/common/modules-map')).pipe( + switchMap(module => module.modulesMap.init().pipe(map(() => module.modulesMap))), + shareReplay(1) + ); + + init(): Observable { + return this.modulesMap$; + } +} + +export const lazyModulesMap = new LazyModulesMap(); diff --git a/ui-ngx/src/app/modules/home/components/blob-entity/blob-entities.component.html b/ui-ngx/src/app/modules/home/components/blob-entity/blob-entities.component.html index 7d170239bc..3352070adf 100644 --- a/ui-ngx/src/app/modules/home/components/blob-entity/blob-entities.component.html +++ b/ui-ngx/src/app/modules/home/components/blob-entity/blob-entities.component.html @@ -20,7 +20,7 @@ asButton historyOnly> @if (widgetMode) { - + } @else {