UI: refactored check for value card widget

This commit is contained in:
Dmitriymush 2023-12-07 17:28:29 +02:00
parent 0a9b21ce15
commit c1262bd3a8

View File

@ -27,7 +27,7 @@ import {
ViewChild
} from '@angular/core';
import { WidgetContext } from '@home/models/widget-component.models';
import { formatValue, isDefinedAndNotNull, isNotEmptyStr, isString } from '@core/utils';
import { formatValue, isDefinedAndNotNull } from '@core/utils';
import {
backgroundStyle,
ColorProcessor,
@ -183,10 +183,7 @@ export class ValueCardWidgetComponent implements OnInit, AfterViewInit, OnDestro
const tsValue = getSingleTsValue(this.ctx.data);
let ts;
let value;
if (
tsValue && isDefinedAndNotNull(tsValue[1]) &&
(!isString(tsValue[1]) || isNotEmptyStr(tsValue[1]))
) {
if (tsValue && isDefinedAndNotNull(tsValue[1]) && tsValue[0] !== 0) {
ts = tsValue[0];
value = tsValue[1];
this.valueText = formatValue(value, this.decimals, this.units, false);