From 3c916454c29c82521f2ea0ad5ba0ff5f81f42d5e Mon Sep 17 00:00:00 2001 From: Maksym Dudnik Date: Thu, 1 Jun 2023 16:40:00 +0300 Subject: [PATCH] fixes --- .../components/device/gateway-connectors.component.ts | 6 +++--- .../components/device/gateway-service-rpc.component.ts | 2 +- .../components/device/gateway-statistics.component.ts | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts b/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts index 7049f6e236..20aa4be780 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts +++ b/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts @@ -216,7 +216,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie if (attributesToDelete.length) { tasks.push(this.attributeService.deleteEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, attributesToDelete)); } - forkJoin(tasks).subscribe(resp => { + forkJoin(tasks).subscribe(_ => { this.showToast("Update Successful") this.updateData(true); }) @@ -327,7 +327,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie key: scope == AttributeScope.SHARED_SCOPE ? 'active_connectors' : 'inactive_connectors', value: scope == AttributeScope.SHARED_SCOPE ? this.activeConnectors : this.inactiveConnectors }])); - forkJoin(tasks).subscribe(resp => { + forkJoin(tasks).subscribe(_ => { if (this.initialConnector ? this.initialConnector.name === attribute.key : true) { this.clearOutConnectorForm(); this.cd.detectChanges(); @@ -381,7 +381,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie }]), this.attributeService.saveEntityAttributes(this.device, AttributeScope.SERVER_SCOPE, [{ key: 'inactive_connectors', value: this.inactiveConnectors - }]),]).subscribe(resp => { + }]),]).subscribe(_ => { this.updateData(); }) } diff --git a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts b/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts index 52e687b3a9..233304bf54 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts +++ b/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { AfterViewInit, ChangeDetectorRef, Component, Input } from '@angular/core'; +import { AfterViewInit, Component, Input } from '@angular/core'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { Router } from '@angular/router'; diff --git a/ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts b/ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts index 93945f69c9..369b88afe9 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts +++ b/ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts @@ -39,6 +39,7 @@ import { PageLink } from '@shared/models/page/page-link'; import { Direction, SortOrder } from '@shared/models/page/sort-order'; import { MatTableDataSource } from '@angular/material/table'; import { MatSort } from '@angular/material/sort'; +import { isNumber } from '@core/utils'; @Component({ @@ -243,7 +244,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi } private onDataUpdated() { - this.checkDataToBeNumeric(); + this.isDataOnlyNumbers(); if (this.isNumericData) { if (this.chartInited) { if (this.flot) { @@ -263,13 +264,13 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi this.flot.update(); } - private checkDataToBeNumeric() { + private isDataOnlyNumbers() { if (this.general) { this.isNumericData = true; return; } this.dataSource.data = this.subscription.data.length ? this.subscription.data[0].data : []; - this.isNumericData = this.dataSource.data.every(data => isNaN(data[1]) === false); + this.isNumericData = this.dataSource.data.every(data => isNumber(data[1])); } @@ -280,7 +281,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi if (this.ctx.datasources[0].entity) { this.ctx.subscriptionApi.createSubscriptionFromInfo(widgetType.timeseries, subscriptionInfo, this.subscriptionOptions, false, true).subscribe(subscription => { this.subscription = subscription; - this.checkDataToBeNumeric(); + this.isDataOnlyNumbers(); this.legendData = this.subscription.legendData; this.flotCtx.defaultSubscription = subscription; this.resize$ = new ResizeObserver(() => {