From 47f0d2488efd990fe1afe961a359c8be4d435304 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 13 Dec 2024 12:15:51 +0200 Subject: [PATCH 01/15] UI: Fixed background settings popover --- .../settings/common/background-settings-panel.component.scss | 2 ++ .../widget/lib/settings/common/background-settings.component.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings-panel.component.scss index 6bc83fe967..d907e20f64 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings-panel.component.scss @@ -17,6 +17,8 @@ .tb-background-settings-panel { width: 620px; + min-height: 300px; + max-height: 90vh; display: flex; flex-direction: column; gap: 16px; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts index 66dd774a21..828f424b51 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts @@ -110,7 +110,7 @@ export class BackgroundSettingsComponent implements OnInit, ControlValueAccessor backgroundSettings: this.modelValue }; const backgroundSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, BackgroundSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, BackgroundSettingsPanelComponent, ['left'], true, null, ctx, {}, {}, {}, true); From 01e6ae3709deef8ac9578e03add78563563632a4 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Tue, 17 Dec 2024 18:13:03 +0200 Subject: [PATCH 02/15] Fix widget type sync up --- .../server/service/edge/rpc/EdgeGrpcSession.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index 42a6a60c2d..7c37b0ac54 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -135,7 +135,7 @@ public abstract class EdgeGrpcSession implements Closeable { private StreamObserver inputStream; private StreamObserver outputStream; - private boolean connected; + private volatile boolean connected; private volatile boolean syncCompleted; private EdgeVersion edgeVersion; @@ -536,13 +536,15 @@ public abstract class EdgeGrpcSession implements Closeable { public void processHighPriorityEvents() { try { - List highPriorityEvents = new ArrayList<>(); - EdgeEvent event; - while ((event = highPriorityQueue.poll()) != null) { - highPriorityEvents.add(event); + if (isConnected() && isSyncCompleted()) { + List highPriorityEvents = new ArrayList<>(); + EdgeEvent event; + while ((event = highPriorityQueue.poll()) != null) { + highPriorityEvents.add(event); + } + List downlinkMsgsPack = convertToDownlinkMsgsPack(highPriorityEvents); + sendDownlinkMsgsPack(downlinkMsgsPack).get(); } - List downlinkMsgsPack = convertToDownlinkMsgsPack(highPriorityEvents); - sendDownlinkMsgsPack(downlinkMsgsPack).get(); } catch (Exception e) { log.error("[{}] Failed to process high priority events", sessionId, e); } From e6ee4c76792277fcabbdfeec0bc15a8200696c07 Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Tue, 17 Dec 2024 18:22:28 +0100 Subject: [PATCH 03/15] added git-commit-id-maven-plugin for the application to expose the git information under actuator/info --- application/pom.xml | 4 ++++ pom.xml | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/application/pom.xml b/application/pom.xml index ef57037448..c2d80d62ac 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -390,6 +390,10 @@ + + io.github.git-commit-id + git-commit-id-maven-plugin + org.apache.maven.plugins maven-compiler-plugin diff --git a/pom.xml b/pom.xml index 9ea372e47b..4de31c1c19 100755 --- a/pom.xml +++ b/pom.xml @@ -869,6 +869,29 @@ + + io.github.git-commit-id + git-commit-id-maven-plugin + 5.0.0 + + + get-the-git-infos + + revision + + initialize + + + + true + ${project.build.outputDirectory}/git.properties + + + + + full + + From 8672ff656491d2189e497ef06ab8d449a808e342 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 18 Dec 2024 13:21:19 +0200 Subject: [PATCH 04/15] Add userActivated to user info --- .../java/org/thingsboard/server/controller/BaseController.java | 1 + .../org/thingsboard/server/controller/AuthControllerTest.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/controller/BaseController.java b/application/src/main/java/org/thingsboard/server/controller/BaseController.java index 2d868a1135..dbe430ba18 100644 --- a/application/src/main/java/org/thingsboard/server/controller/BaseController.java +++ b/application/src/main/java/org/thingsboard/server/controller/BaseController.java @@ -923,6 +923,7 @@ public abstract class BaseController { UserCredentials userCredentials = userService.findUserCredentialsByUserId(user.getTenantId(), user.getId()); info.put("userCredentialsEnabled", userCredentials.isEnabled()); + info.put("userActivated", userCredentials.getActivateToken() == null); info.put("lastLoginTs", userCredentials.getLastLoginTs()); } diff --git a/application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java index 73182587fb..dac48a1c06 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AuthControllerTest.java @@ -83,6 +83,7 @@ public class AuthControllerTest extends AbstractControllerTest { assertThat(user.getEmail()).isEqualTo(CUSTOMER_USER_EMAIL); user = getUser(customerUserId); assertThat(user.getAdditionalInfo().get("userCredentialsEnabled").asBoolean()).isTrue(); + assertThat(user.getAdditionalInfo().get("userActivated").asBoolean()).isTrue(); assertThat(user.getAdditionalInfo().get("lastLoginTs").asLong()).isCloseTo(System.currentTimeMillis(), within(10000L)); } @@ -243,6 +244,7 @@ public class AuthControllerTest extends AbstractControllerTest { user.setAuthority(Authority.TENANT_ADMIN); user.setEmail("tenant-admin-2@thingsboard.org"); user = doPost("/api/user", user, User.class); + assertThat(getUser(user.getId()).getAdditionalInfo().get("userActivated").asBoolean()).isFalse(); UserCredentials userCredentials = userCredentialsDao.findByUserId(tenantId, user.getUuidId()); assertThat(userCredentials.getActivateTokenExpTime()).isCloseTo(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(ttl), Offset.offset(120000L)); @@ -289,6 +291,7 @@ public class AuthControllerTest extends AbstractControllerTest { doPost("/api/noauth/activate", JacksonUtil.newObjectNode() .put("activateToken", newActivationToken) .put("password", "wefewe")).andExpect(status().isOk()); + assertThat(getUser(user.getId()).getAdditionalInfo().get("userActivated").asBoolean()).isTrue(); } @Test From a21c0c881fe313a37191ec4d5fb0013d9423210d Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Wed, 18 Dec 2024 13:30:37 +0200 Subject: [PATCH 05/15] Increase default parameters Changed default values: - EDGES_SCHEDULER_POOL_SIZE - EDGES_SEND_SCHEDULER_POOL_SIZE - EDGES_GRPC_CALLBACK_POOL_SIZE --- application/src/main/resources/thingsboard.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 4d69afedb2..794e0fa19e 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1446,11 +1446,11 @@ edges: # Max number of high priority edge events per edge session. No persistence - stored in memory max_high_priority_queue_size_per_session: "${EDGES_MAX_HIGH_PRIORITY_QUEUE_SIZE_PER_SESSION:10000}" # Number of threads that are used to check DB for edge events - scheduler_pool_size: "${EDGES_SCHEDULER_POOL_SIZE:1}" + scheduler_pool_size: "${EDGES_SCHEDULER_POOL_SIZE:4}" # Number of threads that are used to send downlink messages to edge over gRPC - send_scheduler_pool_size: "${EDGES_SEND_SCHEDULER_POOL_SIZE:1}" + send_scheduler_pool_size: "${EDGES_SEND_SCHEDULER_POOL_SIZE:4}" # Number of threads that are used to convert edge events from DB into downlink messages and send them for delivery - grpc_callback_thread_pool_size: "${EDGES_GRPC_CALLBACK_POOL_SIZE:1}" + grpc_callback_thread_pool_size: "${EDGES_GRPC_CALLBACK_POOL_SIZE:4}" state: # Persist state of edge (active, last connect, last disconnect) into timeseries or attributes tables. 'false' means to store edge state into attributes table persistToTelemetry: "${EDGES_PERSIST_STATE_TO_TELEMETRY:false}" From 3bdd7524b9d1792dad624dea768cbee75c844d63 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 18 Dec 2024 13:35:58 +0200 Subject: [PATCH 06/15] UI: Fixed show user action --- .../modules/home/pages/user/user.component.html | 8 ++++---- .../app/modules/home/pages/user/user.component.ts | 6 +++--- ui-ngx/src/app/shared/models/user.model.ts | 14 +++++++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/user/user.component.html b/ui-ngx/src/app/modules/home/pages/user/user.component.html index 933e244290..3c52d89fc6 100644 --- a/ui-ngx/src/app/modules/home/pages/user/user.component.html +++ b/ui-ngx/src/app/modules/home/pages/user/user.component.html @@ -25,25 +25,25 @@