Browse Source

UI: added additional check for string and empty string in value card widget

pull/9795/head
Dmitriymush 3 years ago
parent
commit
0a9b21ce15
  1. 7
      ui-ngx/src/app/modules/home/components/widget/lib/cards/value-card-widget.component.ts

7
ui-ngx/src/app/modules/home/components/widget/lib/cards/value-card-widget.component.ts

@ -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 } from '@core/utils'; import { formatValue, isDefinedAndNotNull, isNotEmptyStr, isString } from '@core/utils';
import { import {
backgroundStyle, backgroundStyle,
ColorProcessor, ColorProcessor,
@ -183,7 +183,10 @@ 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 (tsValue && isDefinedAndNotNull(tsValue[1])) { if (
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…
Cancel
Save