refactoring

This commit is contained in:
mpetrov 2025-03-05 16:18:06 +02:00
parent a991719585
commit 547bb7e169
3 changed files with 4 additions and 3 deletions

View File

@ -120,11 +120,11 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
expressionColumn.sortable = false; expressionColumn.sortable = false;
expressionColumn.cellContentFunction = entity => { expressionColumn.cellContentFunction = entity => {
const expressionLabel = this.getExpressionLabel(entity); const expressionLabel = this.getExpressionLabel(entity);
return expressionLabel.length < 50 ? expressionLabel : `<span style="display: inline-block; width: 50ch">${expressionLabel.substring(0, 49)}…</span>`; return expressionLabel.length < 45 ? expressionLabel : `<span style="display: inline-block; width: 45ch">${expressionLabel.substring(0, 44)}…</span>`;
} }
expressionColumn.cellTooltipFunction = entity => { expressionColumn.cellTooltipFunction = entity => {
const expressionLabel = this.getExpressionLabel(entity); const expressionLabel = this.getExpressionLabel(entity);
return expressionLabel.length < 50 ? null : expressionLabel return expressionLabel.length < 45 ? null : expressionLabel
}; };
this.columns.push(new DateEntityTableColumn<CalculatedField>('createdTime', 'common.created-time', this.datePipe, '150px')); this.columns.push(new DateEntityTableColumn<CalculatedField>('createdTime', 'common.created-time', this.datePipe, '150px'));

View File

@ -98,6 +98,7 @@
formControlName="expressionSCRIPT" formControlName="expressionSCRIPT"
functionName="calculate" functionName="calculate"
[functionArgs]="functionArgs$ | async" [functionArgs]="functionArgs$ | async"
[disableUndefinedCheck]="true"
[scriptLanguage]="ScriptLanguage.TBEL" [scriptLanguage]="ScriptLanguage.TBEL"
[highlightRules]="argumentsHighlightRules$ | async" [highlightRules]="argumentsHighlightRules$ | async"
[editorCompleter]="argumentsEditorCompleter$ | async" [editorCompleter]="argumentsEditorCompleter$ | async"

View File

@ -608,5 +608,5 @@ const calculatedFieldTimeWindowArgumentValueHighlightRules: AceHighlightRules =
export const calculatedFieldDefaultScript = 'return {\n' + export const calculatedFieldDefaultScript = 'return {\n' +
' // Convert Fahrenheit to Celsius\n' + ' // Convert Fahrenheit to Celsius\n' +
' "temperatureC": (temperature - 32) / 1.8\n' + ' "temperatureCelsius": (temperature.value - 32) / 1.8\n' +
'};' '};'