Browse Source

Merge branch 'rc'

pull/13882/head
Igor Kulikov 1 year ago
parent
commit
97978c7461
  1. 5
      application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SingleValueArgumentEntry.java
  2. 24
      application/src/test/java/org/thingsboard/server/service/cf/ctx/state/ScriptCalculatedFieldStateTest.java
  3. 6
      ui-ngx/src/app/modules/home/components/ai-model/ai-model-dialog.component.html
  4. 4
      ui-ngx/src/app/modules/home/components/rule-node/common/credentials-config.component.html
  5. 2
      ui-ngx/src/app/modules/home/components/rule-node/external/rabbit-mq-config.component.html
  6. 2
      ui-ngx/src/app/modules/home/components/rule-node/external/send-email-config.component.html
  7. 2
      ui-ngx/src/app/modules/home/components/sms/aws-sns-provider-configuration.component.html
  8. 2
      ui-ngx/src/app/modules/home/pages/admin/mail-server.component.html
  9. 2
      ui-ngx/src/assets/locale/locale.constant-da_DK.json

5
application/src/main/java/org/thingsboard/server/service/cf/ctx/state/SingleValueArgumentEntry.java

@ -101,6 +101,11 @@ public class SingleValueArgumentEntry implements ArgumentEntry {
} catch (Exception e) {
}
}
if (value instanceof Long longValue) {
if (longValue >= Integer.MIN_VALUE && longValue <= Integer.MAX_VALUE) {
value = longValue.intValue();
}
}
return new TbelCfSingleValueArg(ts, value);
}

24
application/src/test/java/org/thingsboard/server/service/cf/ctx/state/ScriptCalculatedFieldStateTest.java

@ -20,7 +20,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.script.api.tbel.DefaultTbelInvokeService;
import org.thingsboard.script.api.tbel.TbelInvokeService;
@ -60,7 +60,7 @@ public class ScriptCalculatedFieldStateTest {
private final DeviceId DEVICE_ID = new DeviceId(UUID.fromString("5512071d-5abc-411d-a907-4cdb6539c2eb"));
private final AssetId ASSET_ID = new AssetId(UUID.fromString("5bc010ae-bcfd-46c8-98b9-8ee8c8955a76"));
private final SingleValueArgumentEntry assetHumidityArgEntry = new SingleValueArgumentEntry(System.currentTimeMillis() - 10, new DoubleDataEntry("assetHumidity", 43.0), 122L);
private final SingleValueArgumentEntry assetHumidityArgEntry = new SingleValueArgumentEntry(System.currentTimeMillis() - 10, new DoubleDataEntry("assetHumidity", 86.0), 122L);
private final TsRollingArgumentEntry deviceTemperatureArgEntry = createRollingArgEntry();
private final long ts = System.currentTimeMillis();
@ -71,7 +71,7 @@ public class ScriptCalculatedFieldStateTest {
@Autowired
private TbelInvokeService tbelInvokeService;
@MockBean
@MockitoBean
private ApiLimitService apiLimitService;
@BeforeEach
@ -133,6 +133,22 @@ public class ScriptCalculatedFieldStateTest {
assertThat(result.getResult()).isEqualTo(JacksonUtil.valueToTree(Map.of("maxDeviceTemperature", 17.0, "assetHumidity", 43.0)));
}
@Test
void testPerformCalculationWithLongEntry() throws ExecutionException, InterruptedException {
state.arguments = new HashMap<>(Map.of(
"deviceTemperature", deviceTemperatureArgEntry,
"assetHumidity", new SingleValueArgumentEntry(System.currentTimeMillis() - 10, new LongDataEntry("a", 45L), 10L)
));
CalculatedFieldResult result = state.performCalculation(ctx).get();
assertThat(result).isNotNull();
Output output = getCalculatedFieldConfig().getOutput();
assertThat(result.getType()).isEqualTo(output.getType());
assertThat(result.getScope()).isEqualTo(output.getScope());
assertThat(result.getResult()).isEqualTo(JacksonUtil.valueToTree(Map.of("maxDeviceTemperature", 17.0, "assetHumidity", 22.5)));
}
@Test
void testIsReadyWhenNotAllArgPresent() {
assertThat(state.isReady()).isFalse();
@ -193,7 +209,7 @@ public class ScriptCalculatedFieldStateTest {
config.setArguments(Map.of("deviceTemperature", argument1, "assetHumidity", argument2));
config.setExpression("return {\"maxDeviceTemperature\": deviceTemperature.max(), \"assetHumidity\": assetHumidity}");
config.setExpression("return {\"maxDeviceTemperature\": deviceTemperature.max(), \"assetHumidity\": assetHumidity / 2 }");
Output output = new Output();
output.setType(OutputType.ATTRIBUTES);

6
ui-ngx/src/app/modules/home/components/ai-model/ai-model-dialog.component.html

@ -59,7 +59,7 @@
@if (providerFieldsList.includes('personalAccessToken')) {
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label translate>ai-models.personal-access-token</mat-label>
<input type="password" required matInput formControlName="personalAccessToken">
<input type="password" required matInput formControlName="personalAccessToken" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
<mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('personalAccessToken').hasError('required')">
{{ 'ai-models.personal-access-token-required' | translate }}
@ -115,7 +115,7 @@
@if (providerFieldsList.includes('apiKey')) {
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label translate>ai-models.api-key</mat-label>
<input type="password" required matInput formControlName="apiKey">
<input type="password" required matInput formControlName="apiKey" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
<mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('apiKey').hasError('required')">
{{ 'ai-models.api-key-required' | translate }}
@ -143,7 +143,7 @@
@if (providerFieldsList.includes('secretAccessKey')) {
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label translate>ai-models.secret-access-key</mat-label>
<input type="password" required matInput formControlName="secretAccessKey">
<input type="password" required matInput formControlName="secretAccessKey" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
<mat-error *ngIf="aiModelForms.get('configuration').get('providerConfig').get('secretAccessKey').hasError('required')">
{{ 'ai-models.secret-access-key-required' | translate }}

4
ui-ngx/src/app/modules/home/components/rule-node/common/credentials-config.component.html

@ -49,7 +49,7 @@
</mat-form-field>
<mat-form-field class="mat-block">
<mat-label translate>rule-node-config.password</mat-label>
<input type="password" [required]="passwordFieldRequired" matInput formControlName="password">
<input type="password" [required]="passwordFieldRequired" matInput formControlName="password" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
<mat-error *ngIf="credentialsConfigFormGroup.get('password').hasError('required')">
{{ 'rule-node-config.password-required' | translate }}
@ -85,7 +85,7 @@
</tb-file-input>
<mat-form-field class="mat-block">
<mat-label translate>rule-node-config.private-key-password</mat-label>
<input type="password" matInput formControlName="password">
<input type="password" matInput formControlName="password" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
</mat-form-field>
</ng-template>

2
ui-ngx/src/app/modules/home/components/rule-node/external/rabbit-mq-config.component.html

@ -64,7 +64,7 @@
</mat-form-field>
<mat-form-field class="mat-block">
<mat-label translate>rule-node-config.password</mat-label>
<input type="password" matInput formControlName="password">
<input type="password" matInput formControlName="password" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
</mat-form-field>
<mat-checkbox formControlName="automaticRecoveryEnabled">

2
ui-ngx/src/app/modules/home/components/rule-node/external/send-email-config.component.html

@ -109,7 +109,7 @@
</mat-form-field>
<mat-form-field class="mat-block" floatLabel="always">
<mat-label translate>rule-node-config.password</mat-label>
<input matInput type="password" placeholder="{{ 'rule-node-config.enter-password' | translate }}" formControlName="password">
<input matInput type="password" placeholder="{{ 'rule-node-config.enter-password' | translate }}" formControlName="password" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
</mat-form-field>
</section>

2
ui-ngx/src/app/modules/home/components/sms/aws-sns-provider-configuration.component.html

@ -25,7 +25,7 @@
</mat-form-field>
<mat-form-field class="mat-block">
<mat-label translate>admin.aws-secret-access-key</mat-label>
<input required type="password" matInput formControlName="secretAccessKey">
<input required type="password" matInput formControlName="secretAccessKey" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
<mat-error *ngIf="awsSnsProviderConfigurationFormGroup.get('secretAccessKey').hasError('required')">
{{ 'admin.aws-secret-access-key-required' | translate }}

2
ui-ngx/src/app/modules/home/pages/admin/mail-server.component.html

@ -136,7 +136,7 @@
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-label translate>admin.proxy-password</mat-label>
<input matInput type="password" formControlName="proxyPassword" autocomplete="new-proxy-password">
<input matInput type="password" formControlName="proxyPassword" autocomplete="new-password">
<tb-toggle-password matSuffix></tb-toggle-password>
</mat-form-field>
</div>

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

@ -5276,7 +5276,7 @@
"add-originator-attributes-to": "Tilføj afsenders attributter til",
"originator-attributes": "Afsenders attributter",
"fetch-latest-telemetry-with-timestamp": "Hent seneste telemetry med tidsstempel",
"fetch-latest-telemetry-with-timestamp-tooltip": "Inkluderer tidsstempel i metadata, f.eks.: \"{{latestTsKeyName}}\": \"{ts:1574329385897, value:42}\"",
"fetch-latest-telemetry-with-timestamp-tooltip": "Inkluderer tidsstempel i metadata, f.eks.: \"{{latestTsKeyName}}\": \"{\"ts\":1574329385897, \"value\":42}\"",
"tell-failure": "Rapportér fejl hvis attribut mangler",
"tell-failure-tooltip": "Rapporterer fejl hvis mindst én valgt nøgle mangler.",
"created-time": "Oprettelsestid",

Loading…
Cancel
Save