UI: refactored check for value card widget
This commit is contained in:
parent
0a9b21ce15
commit
c1262bd3a8
@ -27,7 +27,7 @@ import {
|
|||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { WidgetContext } from '@home/models/widget-component.models';
|
import { WidgetContext } from '@home/models/widget-component.models';
|
||||||
import { formatValue, isDefinedAndNotNull, isNotEmptyStr, isString } from '@core/utils';
|
import { formatValue, isDefinedAndNotNull } from '@core/utils';
|
||||||
import {
|
import {
|
||||||
backgroundStyle,
|
backgroundStyle,
|
||||||
ColorProcessor,
|
ColorProcessor,
|
||||||
@ -183,10 +183,7 @@ export class ValueCardWidgetComponent implements OnInit, AfterViewInit, OnDestro
|
|||||||
const tsValue = getSingleTsValue(this.ctx.data);
|
const tsValue = getSingleTsValue(this.ctx.data);
|
||||||
let ts;
|
let ts;
|
||||||
let value;
|
let value;
|
||||||
if (
|
if (tsValue && isDefinedAndNotNull(tsValue[1]) && tsValue[0] !== 0) {
|
||||||
tsValue && isDefinedAndNotNull(tsValue[1]) &&
|
|
||||||
(!isString(tsValue[1]) || isNotEmptyStr(tsValue[1]))
|
|
||||||
) {
|
|
||||||
ts = tsValue[0];
|
ts = tsValue[0];
|
||||||
value = tsValue[1];
|
value = tsValue[1];
|
||||||
this.valueText = formatValue(value, this.decimals, this.units, false);
|
this.valueText = formatValue(value, this.decimals, this.units, false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user