UI: change function name
This commit is contained in:
parent
004fbc1c6b
commit
1d12ce1d4b
@ -27,7 +27,7 @@ import { CanvasDigitalGauge, CanvasDigitalGaugeOptions } from '@home/components/
|
|||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { IWidgetSubscription } from '@core/api/widget-api.models';
|
import { IWidgetSubscription } from '@core/api/widget-api.models';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { ColorProcessor, createdValueSubscription, ValueSourceType } from '@shared/models/widget-settings.models';
|
import { ColorProcessor, createValueSubscription, ValueSourceType } from '@shared/models/widget-settings.models';
|
||||||
import GenericOptions = CanvasGauges.GenericOptions;
|
import GenericOptions = CanvasGauges.GenericOptions;
|
||||||
|
|
||||||
// @dynamic
|
// @dynamic
|
||||||
@ -205,7 +205,7 @@ export class TbCanvasDigitalGauge {
|
|||||||
this.localSettings.ticks = this.localSettings.ticksValue
|
this.localSettings.ticks = this.localSettings.ticksValue
|
||||||
.map(tick => tick.type === ValueSourceType.constant && isFinite(tick.value) ? tick.value : null);
|
.map(tick => tick.type === ValueSourceType.constant && isFinite(tick.value) ? tick.value : null);
|
||||||
|
|
||||||
createdValueSubscription(
|
createValueSubscription(
|
||||||
this.ctx,
|
this.ctx,
|
||||||
this.localSettings.ticksValue,
|
this.localSettings.ticksValue,
|
||||||
this.updateAttribute.bind(this)
|
this.updateAttribute.bind(this)
|
||||||
|
|||||||
@ -415,7 +415,7 @@ export abstract class AdvancedModeColorProcessor extends ColorProcessor {
|
|||||||
super(settings);
|
super(settings);
|
||||||
this.advancedMode = this.getCurrentConfig().advancedMode;
|
this.advancedMode = this.getCurrentConfig().advancedMode;
|
||||||
if (this.advancedMode) {
|
if (this.advancedMode) {
|
||||||
createdValueSubscription(
|
createValueSubscription(
|
||||||
this.ctx,
|
this.ctx,
|
||||||
this.datasourceConfigs(),
|
this.datasourceConfigs(),
|
||||||
this.onDataUpdated.bind(this)
|
this.onDataUpdated.bind(this)
|
||||||
@ -1141,9 +1141,9 @@ export const getLatestSingleTsValue = (data: Array<DatasourceData>): DataEntry =
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createdValueSubscription = (ctx: WidgetContext,
|
export const createValueSubscription = (ctx: WidgetContext,
|
||||||
datasourceConfigs: ValueSourceConfig[],
|
datasourceConfigs: ValueSourceConfig[],
|
||||||
onDataUpdated: WidgetSubscriptionCallbacks['onDataUpdated']): Observable<IWidgetSubscription> => {
|
onDataUpdated: WidgetSubscriptionCallbacks['onDataUpdated']): Observable<IWidgetSubscription> => {
|
||||||
let datasources: Datasource[] = [];
|
let datasources: Datasource[] = [];
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
@ -1165,9 +1165,9 @@ export const createdValueSubscription = (ctx: WidgetContext,
|
|||||||
};
|
};
|
||||||
|
|
||||||
const generateDatasource = (ctx: WidgetContext,
|
const generateDatasource = (ctx: WidgetContext,
|
||||||
datasources: Datasource[],
|
datasources: Datasource[],
|
||||||
valueSource: ValueSourceConfig,
|
valueSource: ValueSourceConfig,
|
||||||
index: number): Datasource[] => {
|
index: number): Datasource[] => {
|
||||||
if (valueSource.type === ValueSourceType.latestKey) {
|
if (valueSource.type === ValueSourceType.latestKey) {
|
||||||
if (ctx.datasources.length && isDefinedAndNotNull(ctx.datasources[0].aliasName)) {
|
if (ctx.datasources.length && isDefinedAndNotNull(ctx.datasources[0].aliasName)) {
|
||||||
datasources = configureDatasource(ctx, valueSource, ctx.datasources[0].aliasName, datasources, index, true);
|
datasources = configureDatasource(ctx, valueSource, ctx.datasources[0].aliasName, datasources, index, true);
|
||||||
@ -1181,11 +1181,11 @@ const generateDatasource = (ctx: WidgetContext,
|
|||||||
};
|
};
|
||||||
|
|
||||||
const configureDatasource = (ctx: WidgetContext,
|
const configureDatasource = (ctx: WidgetContext,
|
||||||
valueSource: ValueSourceConfig,
|
valueSource: ValueSourceConfig,
|
||||||
entityAlias: string,
|
entityAlias: string,
|
||||||
datasources: Datasource[],
|
datasources: Datasource[],
|
||||||
index: number,
|
index: number,
|
||||||
isLatest: boolean): Datasource[] => {
|
isLatest: boolean): Datasource[] => {
|
||||||
const indexes = [index];
|
const indexes = [index];
|
||||||
const entityAliasId = ctx.aliasController.getEntityAliasId(entityAlias);
|
const entityAliasId = ctx.aliasController.getEntityAliasId(entityAlias);
|
||||||
let datasource = datasources.find(d =>
|
let datasource = datasources.find(d =>
|
||||||
@ -1230,8 +1230,8 @@ const configureDatasource = (ctx: WidgetContext,
|
|||||||
|
|
||||||
|
|
||||||
const subscribeForDatasource = (ctx: WidgetContext,
|
const subscribeForDatasource = (ctx: WidgetContext,
|
||||||
datasource: Datasource[],
|
datasource: Datasource[],
|
||||||
onDataUpdated: WidgetSubscriptionCallbacks['onDataUpdated']): Observable<IWidgetSubscription> => {
|
onDataUpdated: WidgetSubscriptionCallbacks['onDataUpdated']): Observable<IWidgetSubscription> => {
|
||||||
if (!datasource.length) {
|
if (!datasource.length) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user