Browse Source

Merge branch 'rc' into docker-openjdk25-default

pull/14687/head
Viacheslav Klimov 7 months ago
committed by GitHub
parent
commit
1b40760db2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      application/src/main/java/org/thingsboard/server/service/cf/ctx/state/alarm/AlarmCalculatedFieldState.java
  2. 8
      application/src/main/java/org/thingsboard/server/service/cf/ctx/state/alarm/AlarmRuleState.java
  3. 9
      application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java
  4. 1
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html
  5. 1
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html
  6. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html
  7. 7
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts
  8. 6
      ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.ts
  9. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.ts
  10. 1
      ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html
  11. 7
      ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts
  12. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.html
  13. 6
      ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-panel.component.ts
  14. 1
      ui-ngx/src/app/shared/components/entity/entity-select.component.html
  15. 3
      ui-ngx/src/app/shared/components/entity/entity-select.component.ts
  16. 10
      ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts
  17. 2
      ui-ngx/src/assets/locale/locale.constant-en_US.json

3
application/src/main/java/org/thingsboard/server/service/cf/ctx/state/alarm/AlarmCalculatedFieldState.java

@ -150,7 +150,8 @@ public class AlarmCalculatedFieldState extends BaseCalculatedFieldState {
clearRuleState = null;
}
}
log.debug("Initialized create rule states {} and clear rule state {} for {}", createRuleStates, clearRuleState, configuration);
log.debug("Initialized create rule states {} and clear rule state {} for {}. Restored: {}, reeval needed: {}",
createRuleStates, clearRuleState, configuration, restored, reevalNeeded);
if (reevalNeeded.get()) {
initCurrentAlarm(ctx);

8
application/src/main/java/org/thingsboard/server/service/cf/ctx/state/alarm/AlarmRuleState.java

@ -262,6 +262,14 @@ public class AlarmRuleState {
}
}
public void setDurationCheckFuture(ScheduledFuture<?> durationCheckFuture) {
if (this.durationCheckFuture != null) {
log.warn("Setting new duration check future while previous is not null for state {}", this, new RuntimeException("stacktrace"));
this.durationCheckFuture.cancel(true);
}
this.durationCheckFuture = durationCheckFuture;
}
public boolean isEmpty() {
return eventCount == 0L && firstEventTs == 0L && lastCheckTs == 0L && durationCheckFuture == null;
}

9
application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java

@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.rule.engine.action.TbSaveToCustomCassandraTableNode;
import org.thingsboard.rule.engine.ai.TbAiNode;
import org.thingsboard.rule.engine.aws.lambda.TbAwsLambdaNode;
import org.thingsboard.rule.engine.rest.TbSendRestApiCallReplyNode;
import org.thingsboard.rule.engine.telemetry.TbCalculatedFieldsNode;
@ -167,6 +168,14 @@ public class EdgeMsgConstructorUtils {
);
public static final Map<EdgeVersion, Set<String>> EXCLUDED_NODES_BY_EDGE_VERSION = Map.of(
EdgeVersion.V_4_1_0,
Set.of(
TbAiNode.class.getName()
),
EdgeVersion.V_4_0_0,
Set.of(
TbAiNode.class.getName()
),
EdgeVersion.V_3_9_0,
Set.of(
TbCalculatedFieldsNode.class.getName()

1
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.html

@ -61,6 +61,7 @@
<tb-entity-select formControlName="entityId"
appearance="outline"
required
entityTypeLabel="{{ 'entity.entity-type' | translate }}"
[filterAllowedEntityTypes]="false"
[allowedEntityTypes]="alarmRuleEntityTypeList"
[defaultEntityType]="EntityType.DEVICE_PROFILE"

1
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.html

@ -66,6 +66,7 @@
<tb-entity-select formControlName="entityId"
appearance="outline"
required
entityTypeLabel="{{ 'entity.entity-type' | translate }}"
[filterAllowedEntityTypes]="false"
[allowedEntityTypes]="calculatedFieldsEntityTypeList"
(entityChanged)="changeEntity($event)">

1
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.html

@ -66,6 +66,7 @@
<tb-entity-select formControlName="entityId"
appearance="outline"
required
entityTypeLabel="{{ 'entity.entity-type' | translate }}"
[filterAllowedEntityTypes]="false"
[allowedEntityTypes]="calculatedFieldsEntityTypeList"
(entityChanged)="changeEntity($event)">

7
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts

@ -111,7 +111,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
this.entityTabsComponent = CalculatedFieldsTabsComponent;
this.rowPointer = true;
}
this.tableTitle = this.pageMode ? '' : this.translate.instant('entity.type-calculated-fields');
this.tableTitle = this.translate.instant('entity.type-calculated-fields');
this.detailsPanelEnabled = this.pageMode;
this.entityType = EntityType.CALCULATED_FIELD;
this.entityTranslations = entityTypeTranslations.get(EntityType.CALCULATED_FIELD);
@ -253,7 +253,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
});
}
private getCalculatedFieldDialog(value?: CalculatedFieldsTableEntity, buttonTitle = 'action.add', isDirty = false): Observable<CalculatedField> {
private getCalculatedFieldDialog(value?: CalculatedFieldsTableEntity, buttonTitle = 'action.add', isDirty = false, disabledSelectType = false): Observable<CalculatedField> {
const entityId = this.entityId || value?.entityId;
const entityName = this.entityName || (value as CalculatedFieldInfo)?.entityName;
return this.dialog.open<CalculatedFieldDialogComponent, CalculatedFieldDialogData, CalculatedField>(CalculatedFieldDialogComponent, {
@ -269,6 +269,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
additionalDebugActionConfig: this.additionalDebugActionConfig,
getTestScriptDialogFn: this.getTestScriptDialog.bind(this),
isDirty,
disabledSelectType
},
enterAnimationDuration: isDirty ? 0 : null,
})
@ -344,7 +345,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
}
return of(calculatedField);
}),
switchMap(calculatedField => this.getCalculatedFieldDialog(this.updateImportedCalculatedField(calculatedField), 'action.add', true)),
switchMap(calculatedField => this.getCalculatedFieldDialog(this.updateImportedCalculatedField(calculatedField), 'action.add', true, true)),
filter(Boolean),
switchMap(calculatedField => this.calculatedFieldsService.saveCalculatedField(calculatedField)),
filter(Boolean),

6
ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.ts

@ -259,7 +259,11 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI
};
}
if (!onInit) {
this.argumentFormGroup.get('refEntityKey').get('key').setValue('');
this.argumentFormGroup.get('refEntityKey').get('key').setValue('', {emitEvents: !this.watchKeyChange});
if (this.watchKeyChange && this.argumentFormGroup.get('argumentName').pristine) {
this.argumentFormGroup.get('argumentName').markAsUntouched({emitEvent: false});
this.argumentFormGroup.get('argumentName').setValue('', {emitEvent: false});
}
} else if (this.predefinedEntityFilter) {
entityFilter = this.predefinedEntityFilter;
}

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

@ -154,7 +154,7 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces
validate(): ValidationErrors | null {
this.updateErrorText();
return this.errorText ? { argumentsFormArray: false } : null;
return this.errorText || !this.argumentsFormArray.controls.length ? { argumentsFormArray: false } : null;
}
setDisabledState(isDisabled: boolean): void {

1
ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html

@ -59,6 +59,7 @@
<tb-entity-select formControlName="entityId"
appearance="outline"
required
entityTypeLabel="{{ 'entity.entity-type' | translate }}"
[filterAllowedEntityTypes]="false"
[allowedEntityTypes]="calculatedFieldsEntityTypeList"
[defaultEntityType]="EntityType.DEVICE_PROFILE"

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

@ -50,6 +50,7 @@ export interface CalculatedFieldDialogData {
additionalDebugActionConfig: AdditionalDebugActionConfig<(calculatedField: CalculatedField) => void>;
getTestScriptDialogFn: CalculatedFieldTestScriptFn;
isDirty?: boolean;
disabledSelectType?: boolean;
}
@Component({
@ -106,10 +107,14 @@ export class CalculatedFieldDialogComponent extends DialogComponent<CalculatedFi
}
});
}
if (this.data.disabledSelectType) {
this.fieldFormGroup.get('type').disable({emitEvent: false});
}
}
get fromGroupValue(): CalculatedField {
return deepTrim(this.fieldFormGroup.value as CalculatedField);
return deepTrim(this.fieldFormGroup.getRawValue() as CalculatedField);
}
cancel(): void {

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.html

@ -95,7 +95,9 @@
<ng-container [formGroup]="refDynamicSourceFormGroup">
<div class="tb-form-panel stroked" *ngIf="entityType === ArgumentEntityType.RelationQuery">
<mat-expansion-panel class="tb-settings" expanded>
<mat-expansion-panel-header>{{ 'calculated-fields.entity-zone-relationship' | translate }}</mat-expansion-panel-header>
<mat-expansion-panel-header>
<span class="tb-form-panel-title tb-required">{{ 'calculated-fields.entity-zone-relationship' | translate }}</span>
</mat-expansion-panel-header>
<div class="tb-form-table">
<div class="tb-form-table-header">
<div class="tb-form-table-header-cell tb-actions-header"></div>

6
ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-panel.component.ts

@ -74,7 +74,7 @@ export class CalculatedFieldMetricsPanelComponent implements OnInit {
entityFilter: EntityFilter;
readonly AggFunctions = Object.values(AggFunction) as AggFunction[];
AggFunctions = Object.values(AggFunction) as AggFunction[];
readonly AggFunctionTranslations = AggFunctionTranslations;
readonly ScriptLanguage = ScriptLanguage;
readonly AggInputType = AggInputType;
@ -103,6 +103,10 @@ export class CalculatedFieldMetricsPanelComponent implements OnInit {
this.validateInputKey();
this.functionArgs = ['ctx', ...this.arguments];
if (this.simpleMode) {
this.AggFunctions = this.AggFunctions.filter(aggFunc => aggFunc !== AggFunction.COUNT_UNIQUE);
}
}
saveMetric(): void {

1
ui-ngx/src/app/shared/components/entity/entity-select.component.html

@ -19,6 +19,7 @@
<tb-entity-type-select
*ngIf="displayEntityTypeSelect"
class="flex-1"
[label]="entityTypeLabel ?? null"
[appearance]="appearance"
[showLabel]="true"
[required]="required"

3
ui-ngx/src/app/shared/components/entity/entity-select.component.ts

@ -73,6 +73,9 @@ export class EntitySelectComponent implements ControlValueAccessor, OnInit {
@Input()
defaultEntityType: AliasEntityType | EntityType;
@Input()
entityTypeLabel: string;
@Output()
entityChanged = new EventEmitter<BaseData<EntityId>>();

10
ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts

@ -52,8 +52,16 @@ export class EntityTypeSelectComponent implements ControlValueAccessor, OnInit,
@coerceBoolean()
showLabel: boolean;
private labelValue = this.translate.instant('entity.type');
get label(): string {
return this.labelValue;
}
@Input()
label = this.translate.instant('entity.type');
set label(value: string) {
this.labelValue = value ?? this.translate.instant('entity.type');
}
@Input()
@coerceBoolean()

2
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1183,7 +1183,7 @@
"perimeter-attribute-key": "Perimeter attribute key",
"perimeter-attribute-key-required": "Perimeter attribute key is required.",
"perimeter-attribute-key-pattern": "Perimeter attribute key is invalid.",
"entity-zone-relationship": "Path from Entity to Zones *",
"entity-zone-relationship": "Path from Entity to Zones",
"direction": "Relation direction",
"direction-from": "From entity to zone",
"direction-to": "From zone to entity",

Loading…
Cancel
Save