From b767098c011ed9bb066febcdaf01522cffd76334 Mon Sep 17 00:00:00 2001 From: Maksym Dudnik Date: Fri, 30 Jun 2023 13:30:17 +0300 Subject: [PATCH] move components from shared to widget lib --- ui-ngx/src/app/modules/common/modules-map.ts | 12 ---------- .../widget/dialog/custom-dialog.service.ts | 5 +++-- .../device-gateway-command.component.html | 0 .../device-gateway-command.component.ts | 0 .../gateway-configuration.component.html | 0 .../gateway-configuration.component.scss | 0 .../device/gateway-configuration.component.ts | 0 .../device/gateway-connectors.component.html | 0 .../device/gateway-connectors.component.scss | 2 +- .../device/gateway-connectors.component.ts | 4 ++-- .../lib}/device/gateway-logs.component.html | 0 .../lib}/device/gateway-logs.component.scss | 0 .../lib}/device/gateway-logs.component.ts | 4 ++-- .../device/gateway-service-rpc.component.html | 0 .../device/gateway-service-rpc.component.scss | 0 .../device/gateway-service-rpc.component.ts | 2 +- .../device/gateway-statistics.component.html | 0 .../device/gateway-statistics.component.scss | 0 .../device/gateway-statistics.component.ts | 2 +- .../widget/widget-components.module.ts | 22 +++++++++++++++++-- .../home/pages/device/device.component.html | 11 ++++------ ui-ngx/src/app/shared/shared.module.ts | 18 --------------- 22 files changed, 34 insertions(+), 48 deletions(-) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/device-gateway-command.component.html (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/device-gateway-command.component.ts (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-configuration.component.html (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-configuration.component.scss (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-configuration.component.ts (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-connectors.component.html (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-connectors.component.scss (97%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-connectors.component.ts (98%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-logs.component.html (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-logs.component.scss (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-logs.component.ts (97%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-service-rpc.component.html (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-service-rpc.component.scss (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-service-rpc.component.ts (98%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-statistics.component.html (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-statistics.component.scss (100%) rename ui-ngx/src/app/{shared/components => modules/home/components/widget/lib}/device/gateway-statistics.component.ts (99%) diff --git a/ui-ngx/src/app/modules/common/modules-map.ts b/ui-ngx/src/app/modules/common/modules-map.ts index 2ff9dab6fc..e51ecc0e31 100644 --- a/ui-ngx/src/app/modules/common/modules-map.ts +++ b/ui-ngx/src/app/modules/common/modules-map.ts @@ -300,13 +300,7 @@ import * as QueueFormComponent from '@home/components/queue/queue-form.component import * as AssetProfileComponent from '@home/components/profile/asset-profile.component'; import * as AssetProfileDialogComponent from '@home/components/profile/asset-profile-dialog.component'; import * as AssetProfileAutocompleteComponent from '@home/components/profile/asset-profile-autocomplete.component'; -import * as DeviceGatewayCommandComponent from '@shared/components/device/device-gateway-command.component'; import * as GatewayRemoteConfigurationDialogComponent from '@shared/components/dialog/gateway-remote-configuration-dialog'; -import * as GatewayConfigurationComponent from '@shared/components/device/gateway-configuration.component'; -import * as GatewayConnectorComponent from '@shared/components/device/gateway-connectors.component'; -import * as GatewayLogsComponent from '@shared/components/device/gateway-logs.component'; -import * as GatewayStatisticsComponent from '@shared/components/device/gateway-statistics.component'; -import * as GatewayServiceRPCComponent from '@shared/components/device/gateway-service-rpc.component'; import * as RuleChainSelectComponent from '@shared/components/rule-chain/rule-chain-select.component'; import { IModulesMap } from '@modules/common/modules-map.models'; @@ -414,12 +408,6 @@ class ModulesMap implements IModulesMap { '@shared/components/help.component': HelpComponent, '@shared/components/help-markdown.component': HelpMarkdownComponent, '@shared/components/help-popup.component': HelpPopupComponent, - '@shared/components/device/device-gateway-command.component': DeviceGatewayCommandComponent, - '@shared/components/device/gateway-configuration.component': GatewayConfigurationComponent, - '@shared/components/device/gateway-connectors.component': GatewayConnectorComponent, - '@shared/components/device/gateway-logs.component': GatewayLogsComponent, - '@shared/components/device/gateway-statistics.component': GatewayStatisticsComponent, - '@shared/components/device/gateway-service-rpc.component': GatewayServiceRPCComponent, '@shared/components/device/gateway-remote-configuration-dialog': GatewayRemoteConfigurationDialogComponent, '@shared/components/tb-checkbox.component': TbCheckboxComponent, '@shared/components/toast.directive': TbToast, diff --git a/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts b/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts index c18367d864..461d8feeeb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts +++ b/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts @@ -28,7 +28,7 @@ import { CustomDialogContainerData } from '@home/components/widget/dialog/custom-dialog-container.component'; import { SHARED_MODULE_TOKEN } from '@shared/components/tokens'; -import { HOME_COMPONENTS_MODULE_TOKEN, SHARED_HOME_COMPONENTS_MODULE_TOKEN } from '@home/components/tokens'; +import { HOME_COMPONENTS_MODULE_TOKEN, SHARED_HOME_COMPONENTS_MODULE_TOKEN, WIDGET_COMPONENTS_MODULE_TOKEN } from '@home/components/tokens'; @Injectable() export class CustomDialogService { @@ -42,6 +42,7 @@ export class CustomDialogService { @Inject(SHARED_MODULE_TOKEN) private sharedModule: Type, @Inject(SHARED_HOME_COMPONENTS_MODULE_TOKEN) private sharedHomeComponentsModule: Type, @Inject(HOME_COMPONENTS_MODULE_TOKEN) private homeComponentsModule: Type, + @Inject(WIDGET_COMPONENTS_MODULE_TOKEN) private widgetComponentsModule: Type, public dialog: MatDialog ) { } @@ -52,7 +53,7 @@ export class CustomDialogService { customDialog(template: string, controller: (instance: CustomDialogComponent) => void, data?: any, config?: MatDialogConfig): Observable { - const modules = [this.sharedModule, CommonModule, this.sharedHomeComponentsModule, this.homeComponentsModule]; + const modules = [this.sharedModule, CommonModule, this.sharedHomeComponentsModule, this.homeComponentsModule, this.widgetComponentsModule]; if (Array.isArray(this.customModules)) { modules.push(...this.customModules); } diff --git a/ui-ngx/src/app/shared/components/device/device-gateway-command.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/device/device-gateway-command.component.html similarity index 100% rename from ui-ngx/src/app/shared/components/device/device-gateway-command.component.html rename to ui-ngx/src/app/modules/home/components/widget/lib/device/device-gateway-command.component.html diff --git a/ui-ngx/src/app/shared/components/device/device-gateway-command.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/device/device-gateway-command.component.ts similarity index 100% rename from ui-ngx/src/app/shared/components/device/device-gateway-command.component.ts rename to ui-ngx/src/app/modules/home/components/widget/lib/device/device-gateway-command.component.ts diff --git a/ui-ngx/src/app/shared/components/device/gateway-configuration.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-configuration.component.html similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-configuration.component.html rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-configuration.component.html diff --git a/ui-ngx/src/app/shared/components/device/gateway-configuration.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-configuration.component.scss similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-configuration.component.scss rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-configuration.component.scss diff --git a/ui-ngx/src/app/shared/components/device/gateway-configuration.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-configuration.component.ts similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-configuration.component.ts rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-configuration.component.ts diff --git a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.html similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-connectors.component.html rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.html diff --git a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.scss similarity index 97% rename from ui-ngx/src/app/shared/components/device/gateway-connectors.component.scss rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.scss index 626f40672f..a39a83d166 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.scss @@ -24,7 +24,7 @@ width: 100%; &>mat-card, &>div { - min-width: 50%; + min-width: calc(50% - 15px); } mat-card { diff --git a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.ts similarity index 98% rename from ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.ts index d51633488a..778af21db8 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-connectors.component.ts @@ -34,9 +34,9 @@ import { MatSort } from '@angular/material/sort'; import { tap } from 'rxjs/operators'; import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service'; import { MatTableDataSource } from '@angular/material/table'; -import { GatewayLogLevel } from '@shared/components/device/gateway-configuration.component'; +import { GatewayLogLevel } from '@home/components/widget/lib/device/gateway-configuration.component'; import { ActionNotificationShow } from '@core/notification/notification.actions'; -import { DialogService } from '@app/core/services/dialog.service'; +import { DialogService } from '@core/services/dialog.service'; import { WidgetContext } from '@home/models/widget-component.models'; import { deepClone } from '@core/utils'; import { NULL_UUID } from '@shared/models/id/has-uuid'; diff --git a/ui-ngx/src/app/shared/components/device/gateway-logs.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.html similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-logs.component.html rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.html diff --git a/ui-ngx/src/app/shared/components/device/gateway-logs.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.scss similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-logs.component.scss rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.scss diff --git a/ui-ngx/src/app/shared/components/device/gateway-logs.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.ts similarity index 97% rename from ui-ngx/src/app/shared/components/device/gateway-logs.component.ts rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.ts index eff5e67f19..d05bc53eaa 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-logs.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-logs.component.ts @@ -30,8 +30,8 @@ import { AttributeDatasource } from "@home/models/datasource/attribute-datasourc import { Direction, SortOrder } from "@shared/models/page/sort-order"; import { MatSort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; -import { GatewayLogLevel } from '@shared/components/device/gateway-configuration.component'; -import { DialogService } from '@app/core/services/dialog.service'; +import { GatewayLogLevel } from '@home/components/widget/lib/device/gateway-configuration.component'; +import { DialogService } from '@core/services/dialog.service'; import { WidgetContext } from '@home/models/widget-component.models'; diff --git a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.html similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.html rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.html diff --git a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.scss similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.scss rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.scss diff --git a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.ts similarity index 98% rename from ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.ts index ab29766fd0..8468b483df 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-service-rpc.component.ts @@ -24,7 +24,7 @@ import { AttributeService } from '@core/http/attribute.service'; import { DeviceService } from '@core/http/device.service'; import { TranslateService } from '@ngx-translate/core'; import { PageComponent } from "@shared/components/page.component"; -import { DialogService } from '@app/core/services/dialog.service'; +import { DialogService } from '@core/services/dialog.service'; import { WidgetContext } from '@home/models/widget-component.models'; import { ContentType } from '@shared/models/constants'; import { diff --git a/ui-ngx/src/app/shared/components/device/gateway-statistics.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.html similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-statistics.component.html rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.html diff --git a/ui-ngx/src/app/shared/components/device/gateway-statistics.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.scss similarity index 100% rename from ui-ngx/src/app/shared/components/device/gateway-statistics.component.scss rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.scss diff --git a/ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.ts similarity index 99% rename from ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts rename to ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.ts index 32956fb759..90e5541217 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/device/gateway-statistics.component.ts @@ -25,7 +25,7 @@ import { DeviceService } from '@core/http/device.service'; import { TranslateService } from '@ngx-translate/core'; import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetry.models'; import { PageComponent } from '@shared/components/page.component'; -import { DialogService } from '@app/core/services/dialog.service'; +import { DialogService } from '@core/services/dialog.service'; import { WidgetContext } from '@home/models/widget-component.models'; import { TbFlot } from '@home/components/widget/lib/flot-widget'; import { ResizeObserver } from '@juggle/resize-observer'; diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts index ce2e7055cc..cad3d0b038 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts @@ -43,6 +43,12 @@ import { HomePageWidgetsModule } from '@home/components/widget/lib/home-page/hom import { WIDGET_COMPONENTS_MODULE_TOKEN } from '@home/components/tokens'; import { FlotWidgetComponent } from '@home/components/widget/lib/flot-widget.component'; import { LegendComponent } from '@home/components/widget/lib/legend.component'; +import { GatewayConnectorComponent } from '@home/components/widget/lib/device/gateway-connectors.component'; +import { GatewayLogsComponent } from '@home/components/widget/lib/device/gateway-logs.component'; +import { GatewayStatisticsComponent } from '@home/components/widget/lib/device/gateway-statistics.component'; +import { GatewayServiceRPCComponent } from '@home/components/widget/lib/device/gateway-service-rpc.component'; +import { DeviceGatewayCommandComponent } from '@home/components/widget/lib/device/device-gateway-command.component'; +import { GatewayConfigurationComponent } from '@home/components/widget/lib/device/gateway-configuration.component'; @NgModule({ declarations: @@ -66,7 +72,13 @@ import { LegendComponent } from '@home/components/widget/lib/legend.component'; MarkdownWidgetComponent, SelectEntityDialogComponent, LegendComponent, - FlotWidgetComponent + FlotWidgetComponent, + GatewayConnectorComponent, + GatewayLogsComponent, + GatewayStatisticsComponent, + GatewayServiceRPCComponent, + DeviceGatewayCommandComponent, + GatewayConfigurationComponent ], imports: [ CommonModule, @@ -94,7 +106,13 @@ import { LegendComponent } from '@home/components/widget/lib/legend.component'; QrCodeWidgetComponent, MarkdownWidgetComponent, LegendComponent, - FlotWidgetComponent + FlotWidgetComponent, + GatewayConnectorComponent, + GatewayLogsComponent, + GatewayStatisticsComponent, + GatewayServiceRPCComponent, + DeviceGatewayCommandComponent, + GatewayConfigurationComponent ], providers: [ {provide: WIDGET_COMPONENTS_MODULE_TOKEN, useValue: WidgetComponentsModule } diff --git a/ui-ngx/src/app/modules/home/pages/device/device.component.html b/ui-ngx/src/app/modules/home/pages/device/device.component.html index ce18e6ee16..e619fa9561 100644 --- a/ui-ngx/src/app/modules/home/pages/device/device.component.html +++ b/ui-ngx/src/app/modules/home/pages/device/device.component.html @@ -142,14 +142,11 @@ {{ 'device.overwrite-activity-time' | translate }} + + device.description + + - -
- - device.description - - -
diff --git a/ui-ngx/src/app/shared/shared.module.ts b/ui-ngx/src/app/shared/shared.module.ts index 3cd8e37a50..4de39b89b5 100644 --- a/ui-ngx/src/app/shared/shared.module.ts +++ b/ui-ngx/src/app/shared/shared.module.ts @@ -177,13 +177,7 @@ import { NotificationComponent } from '@shared/components/notification/notificat import { TemplateAutocompleteComponent } from '@shared/components/notification/template-autocomplete.component'; import { SlackConversationAutocompleteComponent } from '@shared/components/slack-conversation-autocomplete.component'; import { DateAgoPipe } from '@shared/pipe/date-ago.pipe'; -import { DeviceGatewayCommandComponent } from '@shared/components/device/device-gateway-command.component'; -import { GatewayConfigurationComponent } from '@shared/components/device/gateway-configuration.component'; import { GatewayRemoteConfigurationDialogComponent } from '@shared/components/dialog/gateway-remote-configuration-dialog'; -import { GatewayConnectorComponent } from '@shared/components/device/gateway-connectors.component'; -import { GatewayLogsComponent } from '@shared/components/device/gateway-logs.component'; -import { GatewayStatisticsComponent } from '@shared/components/device/gateway-statistics.component'; -import { GatewayServiceRPCComponent } from '@shared/components/device/gateway-service-rpc.component'; import { TbBreakPointsProvider, MdLgLayoutDirective, @@ -270,12 +264,6 @@ export const MarkedOptionsFactory = (markedOptionsService: MarkedOptionsService) HelpComponent, HelpMarkdownComponent, HelpPopupComponent, - DeviceGatewayCommandComponent, - GatewayConfigurationComponent, - GatewayConnectorComponent, - GatewayLogsComponent, - GatewayStatisticsComponent, - GatewayServiceRPCComponent, GatewayRemoteConfigurationDialogComponent, TbCheckboxComponent, TbSnackBarComponent, @@ -455,12 +443,6 @@ export const MarkedOptionsFactory = (markedOptionsService: MarkedOptionsService) HelpComponent, HelpMarkdownComponent, HelpPopupComponent, - DeviceGatewayCommandComponent, - GatewayConfigurationComponent, - GatewayConnectorComponent, - GatewayLogsComponent, - GatewayStatisticsComponent, - GatewayServiceRPCComponent, GatewayRemoteConfigurationDialogComponent, TbCheckboxComponent, TbErrorComponent,