Browse Source

fixes

pull/8337/head
Maksym Dudnik 3 years ago
parent
commit
3c916454c2
  1. 6
      ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts
  2. 2
      ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts
  3. 9
      ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts

6
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();
})
}

2
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';

9
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(() => {

Loading…
Cancel
Save