Browse Source

UI: Improve widgets value formatting.

pull/9469/head
Igor Kulikov 3 years ago
parent
commit
a47ceaafed
  1. 2
      ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts
  2. 2
      ui-ngx/src/app/modules/home/components/widget/lib/cards/value-card-widget.component.ts
  3. 2
      ui-ngx/src/app/modules/home/components/widget/lib/cards/value-chart-card-widget.component.ts
  4. 2
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/battery-level-widget.component.ts
  5. 2
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/signal-strength-widget.component.ts
  6. 4
      ui-ngx/src/app/modules/home/components/widget/lib/weather/wind-speed-direction-widget.component.ts

2
ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts

@ -174,7 +174,7 @@ export class ProgressBarWidgetComponent implements OnInit, OnDestroy, AfterViewI
this.value = 0;
if (tsValue && isDefinedAndNotNull(tsValue[1]) && isNumeric(tsValue[1])) {
this.value = tsValue[1];
this.valueText = formatValue(this.value, this.decimals, this.units, true);
this.valueText = formatValue(this.value, this.decimals, this.units, false);
} else {
this.valueText = 'N/A';
}

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

@ -182,7 +182,7 @@ export class ValueCardWidgetComponent implements OnInit, AfterViewInit, OnDestro
if (tsValue) {
ts = tsValue[0];
value = tsValue[1];
this.valueText = formatValue(value, this.decimals, this.units, true);
this.valueText = formatValue(value, this.decimals, this.units, false);
} else {
this.valueText = 'N/A';
}

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

@ -194,7 +194,7 @@ export class ValueChartCardWidgetComponent implements OnInit, AfterViewInit, OnD
let value;
if (tsValue) {
value = tsValue[1];
this.valueText = formatValue(value, this.decimals, this.units, true);
this.valueText = formatValue(value, this.decimals, this.units, false);
} else {
this.valueText = 'N/A';
}

2
ui-ngx/src/app/modules/home/components/widget/lib/indicator/battery-level-widget.component.ts

@ -224,7 +224,7 @@ export class BatteryLevelWidgetComponent implements OnInit, OnDestroy, AfterView
this.value = 0;
if (tsValue && isDefinedAndNotNull(tsValue[1]) && isNumeric(tsValue[1])) {
this.value = tsValue[1];
this.valueText = formatValue(this.value, this.decimals, this.units, true);
this.valueText = formatValue(this.value, this.decimals, this.units, false);
} else {
this.valueText = 'N/A';
}

2
ui-ngx/src/app/modules/home/components/widget/lib/indicator/signal-strength-widget.component.ts

@ -232,7 +232,7 @@ export class SignalStrengthWidgetComponent implements OnInit, OnDestroy, AfterVi
if (!this.noData) {
this.rssi = Number(value);
if (this.showTooltipValue) {
this.tooltipValueText = formatValue(value, this.decimals, this.units, true);
this.tooltipValueText = formatValue(value, this.decimals, this.units, false);
}
} else {
this.rssi = -100;

4
ui-ngx/src/app/modules/home/components/widget/lib/weather/wind-speed-direction-widget.component.ts

@ -174,7 +174,7 @@ export class WindSpeedDirectionWidgetComponent implements OnInit, OnDestroy, Aft
this.windDirection = windDirectionTsValue[1];
if (!this.centerValueDataKey) {
value = this.windDirection;
this.centerValueText = formatValue(value, 0, '') + '°';
this.centerValueText = formatValue(value, 0, '', false) + '°';
}
}
}
@ -182,7 +182,7 @@ export class WindSpeedDirectionWidgetComponent implements OnInit, OnDestroy, Aft
const centerValueTsValue = getSingleTsValueByDataKey(this.ctx.data, this.centerValueDataKey);
if (centerValueTsValue && isDefinedAndNotNull(centerValueTsValue[1]) && isNumeric(centerValueTsValue[1])) {
value = centerValueTsValue[1];
this.centerValueText = formatValue(value, this.decimals, '', true);
this.centerValueText = formatValue(value, this.decimals, '', false);
}
}
this.centerValueColor.update(value);

Loading…
Cancel
Save