Browse Source

UI: delete unused settings

pull/13573/head
Artem Dzhereleiko 1 year ago
parent
commit
f7bc348513
  1. 6
      ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts
  2. 6
      ui-ngx/src/app/modules/home/components/widget/lib/rpc/knob.component.ts
  3. 6
      ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts

6
ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts

@ -30,7 +30,7 @@ import {
getTimewindowConfig,
setTimewindowConfig
} from '@home/components/widget/config/timewindow-config-panel.component';
import { formatValue, isDefinedAndNotNull, isUndefined } from '@core/utils';
import { formatValue, isDefined, isUndefined } from '@core/utils';
import { Component } from '@angular/core';
import {
convertLevelColorsSettingsToColorProcessor,
@ -157,8 +157,8 @@ export class DigitalSimpleGaugeBasicConfigComponent extends BasicWidgetConfigCom
this.widgetConfig.config.settings.showValue = config.showValue;
this.widgetConfig.config.units = config.units;
this.widgetConfig.config.decimals = config.decimals;
if (isDefinedAndNotNull(this.widgetConfig.config.settings.decimals)) {
this.widgetConfig.config.settings.decimals = null;
if (isDefined(this.widgetConfig.config.settings.decimals)) {
delete this.widgetConfig.config.settings.decimals;
}
this.widgetConfig.config.settings.valueFont = config.valueFont;
this.widgetConfig.config.settings.valueFont.color = config.valueColor;

6
ui-ngx/src/app/modules/home/components/widget/lib/rpc/knob.component.ts

@ -57,6 +57,7 @@ export class KnobComponent extends BasicActionWidgetComponent implements OnInit,
maxValue: number;
newValue = 0;
private decimals: number;
private startDeg = -1;
private currentDeg = 0;
private rotation = 0;
@ -143,9 +144,10 @@ export class KnobComponent extends BasicActionWidgetComponent implements OnInit,
actionLabel: this.ctx.translate.instant('widgets.slider.on-value-change')};
this.valueSetter = this.createValueSetter(valueChangeSettings);
this.decimals = isDefined(this.ctx.decimals) ? this.ctx.decimals : 0;
this.valueFormat = ValueFormatProcessor.fromSettings(this.ctx.$injector, {
units: this.ctx.units,
decimals: this.ctx.decimals || 0,
decimals: this.decimals,
showZeroDecimals: true
});
@ -299,7 +301,7 @@ export class KnobComponent extends BasicActionWidgetComponent implements OnInit,
}
private turn(ratio: number) {
this.newValue = Number((this.minValue + (this.maxValue - this.minValue) * ratio).toFixed(this.ctx.decimals || 0));
this.newValue = Number((this.minValue + (this.maxValue - this.minValue) * ratio).toFixed(this.decimals));
if (this.canvasBar.value !== this.newValue) {
this.canvasBar.value = this.newValue;
}

6
ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts

@ -37,7 +37,7 @@ import {
digitalGaugeLayoutTranslations,
DigitalGaugeType
} from '@home/components/widget/lib/digital-gauge.models';
import { formatValue, isDefinedAndNotNull } from '@core/utils';
import { formatValue, isDefined } from '@core/utils';
import {
ColorSettings,
ColorType,
@ -247,8 +247,8 @@ export class DigitalGaugeWidgetSettingsComponent extends WidgetSettingsComponent
settings.titleFont.color = this.digitalGaugeWidgetSettingsForm.get('titleColor').value;
settings.labelFont.color = this.digitalGaugeWidgetSettingsForm.get('labelColor').value;
if (isDefinedAndNotNull(settings.decimals)) {
settings.decimals = null;
if (isDefined(settings.decimals)) {
delete settings.decimals;
}
return settings;

Loading…
Cancel
Save