Browse Source

Merge pull request #15894 from thingsboard/master-rc-merge

Merge rc into master
pull/15900/head
Vladyslav Prykhodko 4 weeks ago
committed by GitHub
parent
commit
dfe65d5abc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.ts
  2. 11
      ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts
  3. 2
      ui-ngx/src/app/modules/home/components/widget/lib/cards/label-value-card-widget.component.html
  4. 25
      ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts
  5. 11
      ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts

2
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.ts

@ -132,7 +132,7 @@ export class CalculatedFieldComponent extends EntityComponent<CalculatedFieldsTa
onTestScript(expression?: string): Observable<string> { onTestScript(expression?: string): Observable<string> {
return this.cfFormService.testScript( return this.cfFormService.testScript(
this.entity?.id?.id, this.entity?.id?.id,
this.entityValue, this.entityFormValue(),
this.entitiesTableConfig.getTestScriptDialog.bind(this.entitiesTableConfig), this.entitiesTableConfig.getTestScriptDialog.bind(this.entitiesTableConfig),
this.destroyRef, this.destroyRef,
expression expression

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

@ -30,7 +30,7 @@ import {
getTimewindowConfig, getTimewindowConfig,
setTimewindowConfig setTimewindowConfig
} from '@home/components/widget/config/timewindow-config-panel.component'; } from '@home/components/widget/config/timewindow-config-panel.component';
import { formatValue, isDefined, isUndefined } from '@core/utils'; import { formatValue, isDefined, isDefinedAndNotNull, isNumeric, isUndefined } from '@core/utils';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { import {
convertLevelColorsSettingsToColorProcessor, convertLevelColorsSettingsToColorProcessor,
@ -189,11 +189,10 @@ export class DigitalSimpleGaugeBasicConfigComponent extends BasicWidgetConfigCom
private maxValueValidation(): ValidatorFn { private maxValueValidation(): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => { return (control: AbstractControl): ValidationErrors | null => {
const value: string = control.value; const value: number = control.value;
if (value) { const minValue = control.parent?.get('minValue').value;
if (value < control.parent?.get('minValue').value) { if (isNumeric(value) && isDefinedAndNotNull(minValue) && value < minValue) {
return {maxValue: true}; return {maxValue: true};
}
} }
return null; return null;
}; };

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

@ -34,7 +34,7 @@
} }
</div> </div>
} }
<div class="tb-label-value-card-value" [style]="valueStyle" [style.color]="valueColor.color">{{ valueText }}</div> <div class="tb-label-value-card-value" [style]="valueStyle" [style.color]="valueColor.color">{{ valueText | customTranslate }}</div>
</div> </div>
</div> </div>
</div> </div>

25
ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts

@ -1093,15 +1093,29 @@ export class TbTimeSeriesChart {
} }
} }
private maxTickLabelHalfHeight(): number {
const axes = this.yAxisList.filter(a => a.settings.show && a.settings.showTickLabels);
if (!axes.length) {
return 0;
}
const defaultSize = defaultTimeSeriesChartYAxisSettings.tickLabelFont.size;
const maxFontSize = Math.max(...axes.map(a => a.settings.tickLabelFont?.size || defaultSize));
return Math.ceil(maxFontSize / 2);
}
private minTopOffset(): number { private minTopOffset(): number {
const showTickLabels = if (this.topPointLabels) {
!!this.yAxisList.find(yAxis => yAxis.settings.show && yAxis.settings.showTickLabels); return 25;
return (this.topPointLabels) ? 25 : }
(showTickLabels ? 10 : 5); const half = this.maxTickLabelHalfHeight();
return half ? Math.max(10, half) : 5;
} }
private minBottomOffset(): number { private minBottomOffset(): number {
return this.settings.dataZoom ? 45 : 5; const half = this.maxTickLabelHalfHeight();
const minOffset = half ? Math.max(5, half) : 5;
return this.settings.dataZoom ? Math.max(45, minOffset) : minOffset;
} }
private _onParentScroll() { private _onParentScroll() {
@ -1130,6 +1144,7 @@ export class TbTimeSeriesChart {
this.updateBarsAnimation(barItems, false); this.updateBarsAnimation(barItems, false);
} }
this.timeSeriesChart.resize(); this.timeSeriesChart.resize();
this.updateAxes();
if (this.animationEnabled()) { if (this.animationEnabled()) {
this.updateBarsAnimation(barItems, true); this.updateBarsAnimation(barItems, true);
} }

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

@ -37,7 +37,7 @@ import {
digitalGaugeLayoutTranslations, digitalGaugeLayoutTranslations,
DigitalGaugeType DigitalGaugeType
} from '@home/components/widget/lib/digital-gauge.models'; } from '@home/components/widget/lib/digital-gauge.models';
import { formatValue, isDefined } from '@core/utils'; import { formatValue, isDefined, isDefinedAndNotNull, isNumeric } from '@core/utils';
import { import {
ColorSettings, ColorSettings,
ColorType, ColorType,
@ -218,11 +218,10 @@ export class DigitalGaugeWidgetSettingsComponent extends WidgetSettingsComponent
private maxValueValidation(): ValidatorFn { private maxValueValidation(): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => { return (control: AbstractControl): ValidationErrors | null => {
const value: string = control.value; const value: number = control.value;
if (value) { const minValue = control.parent?.get('minValue').value;
if (value < control.parent?.get('minValue').value) { if (isNumeric(value) && isDefinedAndNotNull(minValue) && value < minValue) {
return {maxValue: true}; return {maxValue: true};
}
} }
return null; return null;
}; };

Loading…
Cancel
Save