From 16243394c340085d8988fa65089138dc0bc0ac34 Mon Sep 17 00:00:00 2001 From: imbeacon Date: Tue, 5 Aug 2025 15:03:53 +0300 Subject: [PATCH 01/28] Updated environmental variable names in docker compose file for gateway launch command --- .../DeviceConnectivityControllerTest.java | 7 ++++--- .../server/dao/util/DeviceConnectivityUtil.java | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java index fdf54d0109..724b1c622f 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java @@ -321,9 +321,10 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { "\n" + " # Environment variables\n" + " environment:\n" + - " - host=host.docker.internal\n" + - " - port=1883\n" + - " - accessToken=" + credentials.getCredentialsId() + "\n" + + " - TB_GW_HOST=host.docker.internal\n" + + " - TB_GW_PORT=1883\n" + + " - TB_GW_SECURITY_TYPE=accessToken\n" + + " - TB_GW_ACCESS_TOKEN=" + credentials.getCredentialsId() + "\n" + "\n" + " # Volumes bind\n" + " volumes:\n" + diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java b/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java index cae2d56ae5..46a7b650f7 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java +++ b/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java @@ -117,24 +117,26 @@ public class DeviceConnectivityUtil { dockerComposeBuilder.append("\n"); dockerComposeBuilder.append(" # Environment variables\n"); dockerComposeBuilder.append(" environment:\n"); - dockerComposeBuilder.append(" - host=").append(isLocalhost(host) ? HOST_DOCKER_INTERNAL : host).append("\n"); - dockerComposeBuilder.append(" - port=1883\n"); + dockerComposeBuilder.append(" - TB_GW_HOST=").append(isLocalhost(host) ? HOST_DOCKER_INTERNAL : host).append("\n"); + dockerComposeBuilder.append(" - TB_GW_PORT=1883\n"); switch (deviceCredentials.getCredentialsType()) { case ACCESS_TOKEN: - dockerComposeBuilder.append(" - accessToken=").append(deviceCredentials.getCredentialsId()).append("\n"); + dockerComposeBuilder.append(" - TB_GW_SECURITY_TYPE=accessToken\n"); + dockerComposeBuilder.append(" - TB_GW_ACCESS_TOKEN=").append(deviceCredentials.getCredentialsId()).append("\n"); break; case MQTT_BASIC: + dockerComposeBuilder.append(" - TB_GW_SECURITY_TYPE=usernamePassword\n"); BasicMqttCredentials credentials = JacksonUtil.fromString(deviceCredentials.getCredentialsValue(), BasicMqttCredentials.class); if (credentials != null) { if (StringUtils.isNotEmpty(credentials.getClientId())) { - dockerComposeBuilder.append(" - clientId=").append(credentials.getClientId()).append("\n"); + dockerComposeBuilder.append(" - TB_GW_CLIENT_ID=").append(credentials.getClientId()).append("\n"); } if (StringUtils.isNotEmpty(credentials.getUserName())) { - dockerComposeBuilder.append(" - username=").append(credentials.getUserName()).append("\n"); + dockerComposeBuilder.append(" - TB_GW_USERNAME=").append(credentials.getUserName()).append("\n"); } if (StringUtils.isNotEmpty(credentials.getPassword())) { - dockerComposeBuilder.append(" - password=").append(credentials.getPassword()).append("\n"); + dockerComposeBuilder.append(" - TB_GW_PASSWORD=").append(credentials.getPassword()).append("\n"); } } break; From cf12ed48f0952e159c14a40d80e2458fbaf5502f Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Fri, 21 Nov 2025 16:51:47 +0200 Subject: [PATCH 02/28] fixed sync entities id select with db --- ...cipient-notification-dialog.component.html | 3 ++ .../entity/entity-autocomplete.component.ts | 41 ++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html index 95715bef87..5012fa5336 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html @@ -70,6 +70,7 @@ diff --git a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts index 8cb785c6f1..b18224e29b 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts @@ -138,6 +138,11 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit @coerceArray() additionalClasses: Array; + @Input() + @coerceBoolean() + syncIdsWithDB = false; + + @Output() entityChanged = new EventEmitter>(); @@ -360,12 +365,38 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit try { entity = await firstValueFrom(this.entityService.getEntity(targetEntityType, id, {ignoreLoading: true, ignoreErrors: true})); } catch (e) { - this.propagateChange(null); + if (this.syncIdsWithDB) { + this.modelValue = null; + this.entityURL = ''; + this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); + this.entityChanged.emit(null); + this.propagateChange(null); + this.dirty = true; + return; + } else { + this.propagateChange(null); + } + } + + if (entity !== null) { + this.modelValue = this.useFullEntityId ? entity.id : entity.id.id; + this.entityURL = getEntityDetailsPageURL(entity.id.id, targetEntityType); + this.selectEntityFormGroup.get('entity').patchValue(entity, {emitEvent: false}); + this.entityChanged.emit(entity); + } else { + if (this.syncIdsWithDB) { + this.modelValue = null; + this.entityURL = ''; + this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); + this.entityChanged.emit(null); + this.propagateChange(null); + } else { + this.modelValue = null; + this.entityURL = ''; + this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); + this.entityChanged.emit(null); + } } - this.modelValue = entity !== null ? (this.useFullEntityId ? entity.id : entity.id.id) : null; - this.entityURL = !entity ? '' : getEntityDetailsPageURL(entity.id.id, targetEntityType); - this.selectEntityFormGroup.get('entity').patchValue(entity !== null ? entity : '', {emitEvent: false}); - this.entityChanged.emit(entity); } else { this.modelValue = null; this.entityURL = ''; From dfcceb801cb4ce76a34f9d50ebfdc17eed479ee8 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Fri, 21 Nov 2025 12:40:57 +0200 Subject: [PATCH 03/28] Notification template: fix TinyMCE image source position for long link. --- .../notification-template-configuration.component.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts index ee92ec3539..84848a757c 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts @@ -95,6 +95,13 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co autofocus: false, branding: false, promotion: false, + setup: (editor) => { + editor.on('PostRender', function() { + const container = editor.getContainer().closest('.mat-mdc-dialog-container'); + const uiContainer = document.querySelector('.tox.tox-tinymce-aux'); + container.parentNode.appendChild(uiContainer); + }); + }, relative_urls: false, urlconverter_callback: (url) => url }; From 05b9aaa71c487d434e396e7da805396d8602ad8f Mon Sep 17 00:00:00 2001 From: Artem Barysh Date: Mon, 24 Nov 2025 11:52:43 +0200 Subject: [PATCH 04/28] Added Ack to connect topic --- .../mqtt/session/AbstractGatewaySessionHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java index 6542492238..a2ad982765 100644 --- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java +++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/session/AbstractGatewaySessionHandler.java @@ -105,6 +105,7 @@ public abstract class AbstractGatewaySessionHandler { ack(msg, MqttReasonCodes.PubAck.SUCCESS); log.trace("[{}][{}][{}] onDeviceConnectOk: [{}]", gateway.getTenantId(), gateway.getDeviceId(), sessionId, deviceName); }, - t -> logDeviceCreationError(t, deviceName)); + t -> processFailure(msgId, deviceName, CONNECT, ackSent, t)); } public void onDeviceUpdate(TransportProtos.SessionInfoProto sessionInfo, Device device, Optional deviceProfileOpt) { From 0750728bab278184725f45bdee197e8cd8342e1d Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 24 Nov 2025 15:51:34 +0200 Subject: [PATCH 05/28] revert changes for tb-entity-autocomplete --- ...cipient-notification-dialog.component.html | 1 - .../entity/entity-autocomplete.component.ts | 41 +++---------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html index 5012fa5336..560db89dbc 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/recipient/recipient-notification-dialog.component.html @@ -105,7 +105,6 @@ diff --git a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts index b18224e29b..8cb785c6f1 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts @@ -138,11 +138,6 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit @coerceArray() additionalClasses: Array; - @Input() - @coerceBoolean() - syncIdsWithDB = false; - - @Output() entityChanged = new EventEmitter>(); @@ -365,38 +360,12 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit try { entity = await firstValueFrom(this.entityService.getEntity(targetEntityType, id, {ignoreLoading: true, ignoreErrors: true})); } catch (e) { - if (this.syncIdsWithDB) { - this.modelValue = null; - this.entityURL = ''; - this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); - this.entityChanged.emit(null); - this.propagateChange(null); - this.dirty = true; - return; - } else { - this.propagateChange(null); - } - } - - if (entity !== null) { - this.modelValue = this.useFullEntityId ? entity.id : entity.id.id; - this.entityURL = getEntityDetailsPageURL(entity.id.id, targetEntityType); - this.selectEntityFormGroup.get('entity').patchValue(entity, {emitEvent: false}); - this.entityChanged.emit(entity); - } else { - if (this.syncIdsWithDB) { - this.modelValue = null; - this.entityURL = ''; - this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); - this.entityChanged.emit(null); - this.propagateChange(null); - } else { - this.modelValue = null; - this.entityURL = ''; - this.selectEntityFormGroup.get('entity').patchValue('', {emitEvent: false}); - this.entityChanged.emit(null); - } + this.propagateChange(null); } + this.modelValue = entity !== null ? (this.useFullEntityId ? entity.id : entity.id.id) : null; + this.entityURL = !entity ? '' : getEntityDetailsPageURL(entity.id.id, targetEntityType); + this.selectEntityFormGroup.get('entity').patchValue(entity !== null ? entity : '', {emitEvent: false}); + this.entityChanged.emit(entity); } else { this.modelValue = null; this.entityURL = ''; From e4ad8877a31f0853ca1ab207bffda50a34b917f6 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Tue, 25 Nov 2025 18:39:48 +0200 Subject: [PATCH 06/28] Edge Zombie session fix - added session by session id map to handle properly connect and disconnect edge events --- .../service/edge/rpc/EdgeGrpcService.java | 39 ++++++++++++++++--- .../edge/rpc/KafkaEdgeGrpcSession.java | 20 +++++++++- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java index ec3f839cb3..5159e17dbe 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java @@ -94,6 +94,7 @@ import static org.thingsboard.server.service.state.DefaultDeviceStateService.LAS public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase implements EdgeRpcService { private final ConcurrentMap sessions = new ConcurrentHashMap<>(); + private final ConcurrentMap sessionsById = new ConcurrentHashMap<>(); private final ConcurrentMap sessionNewEventsLocks = new ConcurrentHashMap<>(); private final Map sessionNewEvents = new HashMap<>(); private final ConcurrentMap> sessionEdgeEventChecks = new ConcurrentHashMap<>(); @@ -283,6 +284,7 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i destroySession(session); session.cleanUp(); sessions.remove(edgeId); + sessionsById.remove(session.getSessionId()); final Lock newEventLock = sessionNewEventsLocks.computeIfAbsent(edgeId, id -> new ReentrantLock()); newEventLock.lock(); try { @@ -332,9 +334,15 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i TenantId tenantId = edge.getTenantId(); log.info("[{}][{}] edge [{}] connected successfully.", tenantId, edgeGrpcSession.getSessionId(), edgeId); if (sessions.containsKey(edgeId)) { - destroySession(sessions.get(edgeId)); + EdgeGrpcSession existing = sessions.get(edgeId); + if (existing != null) { + log.info("[{}][{}] Replacing existing session [{}] for edge [{}]", tenantId, edgeGrpcSession.getSessionId(), existing.getSessionId(), edgeId); + destroySession(existing); + sessionsById.remove(existing.getSessionId()); + } } sessions.put(edgeId, edgeGrpcSession); + sessionsById.put(edgeGrpcSession.getSessionId(), edgeGrpcSession); final Lock newEventLock = sessionNewEventsLocks.computeIfAbsent(edgeId, id -> new ReentrantLock()); newEventLock.lock(); try { @@ -492,9 +500,9 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i private void onEdgeDisconnect(Edge edge, UUID sessionId) { EdgeId edgeId = edge.getId(); log.info("[{}][{}] edge disconnected!", edgeId, sessionId); - EdgeGrpcSession toRemove = sessions.get(edgeId); - if (toRemove.getSessionId().equals(sessionId)) { - toRemove = sessions.remove(edgeId); + EdgeGrpcSession current = sessions.get(edgeId); + if (current != null && current.getSessionId().equals(sessionId)) { + EdgeGrpcSession toRemove = sessions.remove(edgeId); final Lock newEventLock = sessionNewEventsLocks.computeIfAbsent(edgeId, id -> new ReentrantLock()); newEventLock.lock(); try { @@ -503,6 +511,7 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i newEventLock.unlock(); } destroySession(toRemove); + sessionsById.remove(sessionId); TenantId tenantId = toRemove.getEdge().getTenantId(); save(tenantId, edgeId, ACTIVITY_STATE, false); long lastDisconnectTs = System.currentTimeMillis(); @@ -510,7 +519,18 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i pushRuleEngineMessage(toRemove.getEdge().getTenantId(), edge, lastDisconnectTs, TbMsgType.DISCONNECT_EVENT); cancelScheduleEdgeEventsCheck(edgeId); } else { - log.debug("[{}] edge session [{}] is not available anymore, nothing to remove. most probably this session is already outdated!", edgeId, sessionId); + log.info("[{}] edge session [{}] is not current anymore. Attempting to destroy it by sessionId.", edgeId, sessionId); + EdgeGrpcSession stale = sessionsById.remove(sessionId); + if (stale != null) { + try { + destroySession(stale); + log.info("[{}][{}] Successfully destroyed stale session for edge [{}]", stale.getTenantId(), sessionId, edgeId); + } catch (Exception e) { + log.warn("[{}][{}] Failed to destroy stale session for edge [{}]", stale.getTenantId(), sessionId, edgeId, e); + } + } else { + log.debug("[{}] No session found by sessionId [{}] to destroy", edgeId, sessionId); + } } edgeIdServiceIdCache.evict(edgeId); } @@ -522,6 +542,9 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i session.getTenantId(), session.getEdge().getId(), session.getEdge().getName(), session.getSessionId()); zombieSessions.add(session); } + } catch (Exception e) { + log.warn("[{}][{}] Exception during session destroy for edge [{}] with session id [{}]", + session.getTenantId(), session.getEdge().getId(), session.getEdge().getName(), session.getSessionId(), e); } } @@ -640,6 +663,12 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i !kafkaSession.getConsumer().getConsumer().isStopped()) { toRemove.add(kafkaSession.getEdge().getId()); } + if (session instanceof KafkaEdgeGrpcSession kafkaSession) { + log.debug("[{}] kafkaSession.isConnected() = {}, kafkaSession.getConsumer().getConsumer().isStopped() = {}", + kafkaSession.getEdge().getId(), + kafkaSession.isConnected(), + kafkaSession.getConsumer() != null ? kafkaSession.getConsumer().getConsumer() != null ? kafkaSession.getConsumer().getConsumer().isStopped() : null : null); + } } for (EdgeId edgeId : toRemove) { log.info("[{}] Destroying session for edge because edge is not connected", edgeId); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java index d165be33d4..67a5bd3623 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java @@ -101,8 +101,20 @@ public class KafkaEdgeGrpcSession extends EdgeGrpcSession { @Override public ListenableFuture processEdgeEvents() { + if (!isConnected() || isSyncInProgress() || isHighPriorityProcessing) { + log.warn("[{}][{}] Session is not ready (connected={}, syncInProgress={}, highPriority={}), skip starting edge event consumer", + tenantId, edge != null ? edge.getId() : null, isConnected(), isSyncInProgress(), isHighPriorityProcessing); + return Futures.immediateFuture(Boolean.FALSE); + } if (consumer == null || (consumer.getConsumer() != null && consumer.getConsumer().isStopped())) { try { + if (this.consumerExecutor != null && !this.consumerExecutor.isShutdown()) { + try { + this.consumerExecutor.shutdown(); + } catch (Exception e) { + log.warn("[{}][{}] Failed to shutdown previous consumer executor", tenantId, edge.getId(), e); + } + } this.consumerExecutor = Executors.newSingleThreadExecutor(ThingsBoardThreadFactory.forName("edge-event-consumer")); this.consumer = QueueConsumerManager.>builder() .name("TB Edge events [" + edge.getId() + "]") @@ -133,6 +145,7 @@ public class KafkaEdgeGrpcSession extends EdgeGrpcSession { public boolean destroy() { try { if (consumer != null) { + log.info("[{}][{}] Stopping edge event consumer...", tenantId, edge != null ? edge.getId() : null); consumer.stop(); } } catch (Exception e) { @@ -143,9 +156,14 @@ public class KafkaEdgeGrpcSession extends EdgeGrpcSession { try { if (consumerExecutor != null) { consumerExecutor.shutdown(); + try { + consumerExecutor.awaitTermination(5, java.util.concurrent.TimeUnit.SECONDS); + } catch (InterruptedException ie) { + log.warn("[{}][{}] Interrupted while awaiting consumer executor termination", tenantId, edge.getId()); + } } } catch (Exception e) { - log.warn("[{}][{}] Failed to shutdown consumer executor", tenantId, edge.getId(), e); + log.warn("[{}][{}] Failed to stop edge event consumer", tenantId, edge.getId(), e); return false; } return true; From 3a0d083610a07fd3ac07ba656f90abe4f7b6e07f Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 26 Nov 2025 10:18:05 +0200 Subject: [PATCH 07/28] Copilot codereview changes --- .../service/edge/rpc/EdgeGrpcService.java | 64 +++++++++++-------- .../edge/rpc/KafkaEdgeGrpcSession.java | 23 ++++--- 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java index 5159e17dbe..c8b2c564ff 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcService.java @@ -69,6 +69,7 @@ import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -82,6 +83,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; +import java.util.function.Function; import static org.thingsboard.server.service.state.DefaultDeviceStateService.ACTIVITY_STATE; import static org.thingsboard.server.service.state.DefaultDeviceStateService.LAST_CONNECT_TIME; @@ -654,31 +656,9 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i private void cleanupZombieSessions() { try { - List toRemove = new ArrayList<>(); - for (EdgeGrpcSession session : sessions.values()) { - if (session instanceof KafkaEdgeGrpcSession kafkaSession && - !kafkaSession.isConnected() && - kafkaSession.getConsumer() != null && - kafkaSession.getConsumer().getConsumer() != null && - !kafkaSession.getConsumer().getConsumer().isStopped()) { - toRemove.add(kafkaSession.getEdge().getId()); - } - if (session instanceof KafkaEdgeGrpcSession kafkaSession) { - log.debug("[{}] kafkaSession.isConnected() = {}, kafkaSession.getConsumer().getConsumer().isStopped() = {}", - kafkaSession.getEdge().getId(), - kafkaSession.isConnected(), - kafkaSession.getConsumer() != null ? kafkaSession.getConsumer().getConsumer() != null ? kafkaSession.getConsumer().getConsumer().isStopped() : null : null); - } - } - for (EdgeId edgeId : toRemove) { - log.info("[{}] Destroying session for edge because edge is not connected", edgeId); - EdgeGrpcSession removed = sessions.get(edgeId); - if (removed instanceof KafkaEdgeGrpcSession kafkaSession) { - if (kafkaSession.destroy()) { - sessions.remove(edgeId); - } - } - } + tryToDestroyZombieSessions(getZombieSessions(sessions.values()), s -> sessions.remove(s.getEdge().getId())); + tryToDestroyZombieSessions(getZombieSessions(sessionsById.values()), s -> sessionsById.remove(s.getSessionId())); + zombieSessions.removeIf(zombie -> { if (zombie.destroy()) { log.info("[{}][{}] Successfully cleaned up zombie session [{}] for edge [{}].", @@ -695,4 +675,38 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i } } + private List getZombieSessions(Collection sessions) { + List result = new ArrayList<>(); + for (EdgeGrpcSession session : sessions) { + if (isKafkaSessionAndZombie(session)) { + result.add(session); + } + } + return result; + } + + private void tryToDestroyZombieSessions(List sessionsToRemove, Function removeFunc) { + for (EdgeGrpcSession toRemove : sessionsToRemove) { + log.info("[{}] Destroying session for edge because edge is not connected", toRemove.getEdge().getId()); + if (toRemove.destroy()) { + removeFunc.apply(toRemove); + } + } + } + + private boolean isKafkaSessionAndZombie(EdgeGrpcSession session) { + if (session instanceof KafkaEdgeGrpcSession kafkaSession) { + log.debug("[{}] kafkaSession.isConnected() = {}, kafkaSession.getConsumer().getConsumer().isStopped() = {}", + kafkaSession.getEdge().getId(), + kafkaSession.isConnected(), + kafkaSession.getConsumer() != null ? kafkaSession.getConsumer().getConsumer() != null ? kafkaSession.getConsumer().getConsumer().isStopped() : null : null); + return !kafkaSession.isConnected() && + kafkaSession.getConsumer() != null && + kafkaSession.getConsumer().getConsumer() != null && + !kafkaSession.getConsumer().getConsumer().isStopped(); + } + return false; + + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java index 67a5bd3623..63669a8e3d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java @@ -108,9 +108,10 @@ public class KafkaEdgeGrpcSession extends EdgeGrpcSession { } if (consumer == null || (consumer.getConsumer() != null && consumer.getConsumer().isStopped())) { try { - if (this.consumerExecutor != null && !this.consumerExecutor.isShutdown()) { + if (consumerExecutor != null && !consumerExecutor.isShutdown()) { try { - this.consumerExecutor.shutdown(); + consumerExecutor.shutdown(); + awaitConsumerTermination(); } catch (Exception e) { log.warn("[{}][{}] Failed to shutdown previous consumer executor", tenantId, edge.getId(), e); } @@ -154,21 +155,25 @@ public class KafkaEdgeGrpcSession extends EdgeGrpcSession { } consumer = null; try { - if (consumerExecutor != null) { + if (consumerExecutor != null && !consumerExecutor.isShutdown()) { consumerExecutor.shutdown(); - try { - consumerExecutor.awaitTermination(5, java.util.concurrent.TimeUnit.SECONDS); - } catch (InterruptedException ie) { - log.warn("[{}][{}] Interrupted while awaiting consumer executor termination", tenantId, edge.getId()); - } + awaitConsumerTermination(); } } catch (Exception e) { - log.warn("[{}][{}] Failed to stop edge event consumer", tenantId, edge.getId(), e); + log.warn("[{}][{}] Failed to shutdown edge event consumer executor", tenantId, edge.getId(), e); return false; } return true; } + private void awaitConsumerTermination() { + try { + consumerExecutor.awaitTermination(5, java.util.concurrent.TimeUnit.SECONDS); + } catch (InterruptedException ie) { + log.warn("[{}][{}] Interrupted while awaiting consumer executor termination", tenantId, edge.getId()); + } + } + @Override public void cleanUp() { String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edge.getId()).getTopic(); From 3b6708be9073fe6fceba2bd0d518928a64b5d040 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 28 Nov 2025 12:41:45 +0200 Subject: [PATCH 08/28] UI: Fixed show duration in alarm details dialog --- .../alarm/alarm-details-dialog.component.ts | 16 ++++++---------- .../src/assets/locale/locale.constant-en_US.json | 8 ++++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.ts b/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.ts index d40efe3b75..c8b23dfbd0 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, Inject, OnInit, ViewChild } from '@angular/core'; +import { Component, Inject, ViewChild } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -51,7 +51,7 @@ export interface AlarmDetailsDialogData { templateUrl: './alarm-details-dialog.component.html', styleUrls: ['./alarm-details-dialog.component.scss'] }) -export class AlarmDetailsDialogComponent extends DialogComponent implements OnInit { +export class AlarmDetailsDialogComponent extends DialogComponent { alarmId: string; alarmFormGroup: UntypedFormGroup; @@ -128,13 +128,12 @@ export class AlarmDetailsDialogComponent extends DialogComponent Date: Fri, 28 Nov 2025 14:59:06 +0200 Subject: [PATCH 09/28] Add API keys auth to swagger --- .../server/config/SwaggerConfiguration.java | 149 +++++++++++------- 1 file changed, 90 insertions(+), 59 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java b/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java index 410b05456e..42a29b8d74 100644 --- a/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java +++ b/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java @@ -86,6 +86,9 @@ public class SwaggerConfiguration { public static final String LOGIN_ENDPOINT = "/api/auth/login"; public static final String REFRESH_TOKEN_ENDPOINT = "/api/auth/token"; + private static final String LOGIN_PASSWORD_SCHEME = "HTTP login form"; + private static final String API_KEY_SCHEME = "API key form"; + private static final ApiResponses loginResponses = loginResponses(); private static final ApiResponses defaultErrorResponses = defaultErrorResponses(false); private static final ApiResponses defaultPostErrorResponses = defaultErrorResponses(true); @@ -142,14 +145,28 @@ public class SwaggerConfiguration { .license(license) .version(apiVersion); - SecurityScheme securityScheme = new SecurityScheme() + SecurityScheme loginPasswordScheme = new SecurityScheme() .type(SecurityScheme.Type.HTTP) .description("Enter Username / Password") .scheme("loginPassword") .bearerFormat("/api/auth/login|X-Authorization"); + SecurityScheme apiKeyScheme = new SecurityScheme() + .type(SecurityScheme.Type.APIKEY) + .name("X-Authorization") + .in(SecurityScheme.In.HEADER) + .description(""" + Enter the API key value with 'ApiKey' prefix in format: **ApiKey ** + + Example: **ApiKey tb_5te51SkLRYpjGrujUGwqkjFvooWBlQpVe2An2Dr3w13wjfxDW** + +
**NOTE**: Use only ONE authentication method at a time. If both are authorized, JWT auth takes the priority.
+ """); + var openApi = new OpenAPI() - .components(new Components().addSecuritySchemes("HTTP login form", securityScheme)) + .components(new Components() + .addSecuritySchemes(LOGIN_PASSWORD_SCHEME, loginPasswordScheme) + .addSecuritySchemes(API_KEY_SCHEME, apiKeyScheme)) .info(info); addDefaultSchemas(openApi); addLoginOperation(openApi); @@ -198,13 +215,14 @@ public class SwaggerConfiguration { operation.summary("Login method to get user JWT token data"); operation.description(""" Login method used to authenticate user and get JWT token data. - + Value of the response **token** field can be used as **X-Authorization** header value: - + `X-Authorization: Bearer $JWT_TOKEN_VALUE`."""); + var requestBody = new RequestBody().description("Login request") .content(new Content().addMediaType(APPLICATION_JSON_VALUE, - new MediaType().schema(new Schema().$ref("#/components/schemas/LoginRequest")))); + new MediaType().schema(new Schema().$ref("#/components/schemas/LoginRequest")))); operation.requestBody(requestBody); operation.responses(loginResponses); @@ -218,11 +236,11 @@ public class SwaggerConfiguration { var operation = new Operation(); operation.summary("Refresh user JWT token data"); operation.description(""" - Method to refresh JWT token. Provide a valid refresh token to get a new JWT token. - - The response contains a new token that can be used for authorization. - - `X-Authorization: Bearer $JWT_TOKEN_VALUE`"""); + Method to refresh JWT token. Provide a valid refresh token to get a new JWT token. + + The response contains a new token that can be used for authorization. + + `X-Authorization: Bearer $JWT_TOKEN_VALUE`"""); var requestBody = new RequestBody().description("Refresh token request") .content(new Content().addMediaType(APPLICATION_JSON_VALUE, @@ -291,8 +309,9 @@ public class SwaggerConfiguration { return (routerOperation, handlerMethod) -> { String[] pNames = localSpringDocParameterNameDiscoverer.getParameterNames(handlerMethod.getMethod()); String[] reflectionParametersNames = Arrays.stream(handlerMethod.getMethod().getParameters()).map(java.lang.reflect.Parameter::getName).toArray(String[]::new); - if (pNames == null || Arrays.stream(pNames).anyMatch(Objects::isNull)) + if (pNames == null || Arrays.stream(pNames).anyMatch(Objects::isNull)) { pNames = reflectionParametersNames; + } MethodParameter[] parameters = handlerMethod.getMethodParameters(); List requestParams = new ArrayList<>(); for (var i = 0; i < parameters.length; i++) { @@ -324,26 +343,25 @@ public class SwaggerConfiguration { } private OpenApiCustomizer customOpenApiCustomizer() { - var loginForm = new SecurityRequirement().addList("HTTP login form", Arrays.asList( - Authority.SYS_ADMIN.name(), - Authority.TENANT_ADMIN.name(), - Authority.CUSTOMER_USER.name() - )); + var loginRequirement = createSecurityRequirement(LOGIN_PASSWORD_SCHEME); + var apiKeyRequirement = createSecurityRequirement(API_KEY_SCHEME); + return openAPI -> { var paths = openAPI.getPaths(); - paths.entrySet().stream().peek(entry -> { - securityCustomization(loginForm, entry); - if (!entry.getKey().equals(LOGIN_ENDPOINT)) { - defaultErrorResponsesCustomization(entry.getValue()); - } - }).map(this::tagsCustomization).filter(Objects::nonNull).distinct().sorted(Comparator.comparing(Tag::getName)).forEach(openAPI::addTagsItem); + paths.entrySet().stream() + .peek(entry -> { + securityCustomization(entry, loginRequirement, apiKeyRequirement); + if (!entry.getKey().equals(LOGIN_ENDPOINT)) { + defaultErrorResponsesCustomization(entry.getValue()); + } + }) + .map(this::extractTagFromPath).filter(Objects::nonNull).distinct().sorted(Comparator.comparing(Tag::getName)).forEach(openAPI::addTagsItem); var pathItemsByTags = new TreeMap>(); paths.forEach((k, v) -> { var tagItem = tagItemFromPathItem(v); if (tagItem != null) { - var pathItemMap = pathItemsByTags.computeIfAbsent(tagItem, k1 -> new TreeMap<>()); - pathItemMap.put(k, v); + pathItemsByTags.computeIfAbsent(tagItem, k1 -> new TreeMap<>()).put(k, v); } }); var sortedPaths = new Paths(); @@ -357,13 +375,35 @@ public class SwaggerConfiguration { }; } + private SecurityRequirement createSecurityRequirement(String schemeName) { + return new SecurityRequirement().addList(schemeName, Arrays.asList( + Authority.SYS_ADMIN.name(), + Authority.TENANT_ADMIN.name(), + Authority.CUSTOMER_USER.name() + )); + } + + private void securityCustomization(Map.Entry entry, SecurityRequirement jwtBearerRequirement, SecurityRequirement apiKeyRequirement) { + var path = entry.getKey(); + + if (path.matches(securityPathRegex) + && !path.matches(nonSecurityPathRegex) + && !path.equals(LOGIN_ENDPOINT) + && !path.equals(REFRESH_TOKEN_ENDPOINT)) { - private Tag tagsCustomization(Map.Entry entry) { - var tagItem = tagItemFromPathItem(entry.getValue()); - if (tagItem != null) { - return tagFromTagItem(tagItem); + entry.getValue() + .readOperationsMap() + .values() + .forEach(operation -> { + operation.addSecurityItem(jwtBearerRequirement); + operation.addSecurityItem(apiKeyRequirement); + }); } - return null; + } + + private Tag extractTagFromPath(Map.Entry entry) { + var tagName = tagItemFromPathItem(entry.getValue()); + return tagName != null ? tagFromTagItem(tagName) : null; } private String tagItemFromPathItem(PathItem item) { @@ -383,40 +423,33 @@ public class SwaggerConfiguration { StringBuilder sb = new StringBuilder(); for (String word : words) { - sb.append(word.substring(0, 1).toUpperCase()); - sb.append(word.substring(1).toLowerCase()); - sb.append(" "); + if (!word.isEmpty()) { + sb.append(word.substring(0, 1).toUpperCase()); + sb.append(word.substring(1).toLowerCase()); + sb.append(" "); + } } return new Tag().name(tagItem).description(sb.toString().trim()); } private void defaultErrorResponsesCustomization(PathItem pathItem) { - pathItem.readOperationsMap().forEach(((httpMethod, operation) -> { + pathItem.readOperationsMap().forEach((httpMethod, operation) -> { var errorResponses = httpMethod.equals(PathItem.HttpMethod.POST) ? defaultPostErrorResponses : defaultErrorResponses; + var responses = operation.getResponses(); if (responses == null) { - responses = errorResponses; - } else { - ApiResponses updated = responses; - errorResponses.forEach((key, apiResponse) -> { - if (!updated.containsKey(key)) { - updated.put(key, apiResponse); - } - }); + responses = new ApiResponses(); + operation.setResponses(responses); } - operation.setResponses(responses); - })); - } - private void securityCustomization(SecurityRequirement loginForm, Map.Entry entry) { - var path = entry.getKey(); - if (path.matches(securityPathRegex) && !path.matches(nonSecurityPathRegex) && !path.equals(LOGIN_ENDPOINT)) { - entry.getValue() - .readOperationsMap() - .values() - .forEach(operation -> operation.addSecurityItem(loginForm)); - } + ApiResponses finalResponses = responses; + errorResponses.forEach((code, response) -> { + if (!finalResponses.containsKey(code)) { + finalResponses.put(code, response); + } + }); + }); } private static ApiResponses loginResponses() { @@ -430,6 +463,7 @@ public class SwaggerConfiguration { private static ApiResponses defaultErrorResponses(boolean isPost) { ApiResponses apiResponses = new ApiResponses(); + apiResponses.addApiResponse("400", errorResponse("400", "Bad Request", ThingsboardErrorResponse.of(isPost ? "Invalid request body" : "Invalid UUID string: 123", ThingsboardErrorCode.BAD_REQUEST_PARAMS, HttpStatus.BAD_REQUEST))); @@ -465,8 +499,7 @@ public class SwaggerConfiguration { ThingsboardErrorResponse.of("Authentication failed", ThingsboardErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED)) ) )); - var credentialsExpiredSchema = new Schema(); - credentialsExpiredSchema.$ref("#/components/schemas/ThingsboardCredentialsExpiredResponse"); + var credentialsExpiredSchema = new Schema().$ref("#/components/schemas/ThingsboardCredentialsExpiredResponse"); apiResponses.addApiResponse("401 ", errorResponse("Unauthorized (**Expired credentials**)", Map.of( "credentials-expired", errorExample("Expired credentials", @@ -482,15 +515,13 @@ public class SwaggerConfiguration { } private static ApiResponse errorResponse(String description, Map examples) { - var schema = new Schema(); - schema.$ref("#/components/schemas/ThingsboardErrorResponse"); + var schema = new Schema().$ref("#/components/schemas/ThingsboardErrorResponse"); return errorResponse(description, examples, schema); } private static ApiResponse errorResponse(String description, Map examples, Schema errorResponseSchema) { - MediaType mediaType = new MediaType().schema(errorResponseSchema); - mediaType.setExamples(examples); - Content content = new Content().addMediaType(org.springframework.http.MediaType.APPLICATION_JSON_VALUE, mediaType); + MediaType mediaType = new MediaType().schema(errorResponseSchema).examples(examples); + Content content = new Content().addMediaType(org.springframework.http.MediaType.APPLICATION_JSON_VALUE, mediaType); return new ApiResponse().description(description).content(content); } From 14e1a65a8bba1464ae60574fe0f2f9f5fdda38ba Mon Sep 17 00:00:00 2001 From: deaflynx Date: Fri, 28 Nov 2025 17:04:14 +0200 Subject: [PATCH 10/28] Fix TinyMCE editor image source style and issue with a shaking window on panel hover. --- .../mobile/common/editor-panel.component.ts | 30 +++++++++++++++++-- ...cation-template-configuration.component.ts | 30 +++++++++++++++++-- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/mobile/common/editor-panel.component.ts b/ui-ngx/src/app/modules/home/pages/mobile/common/editor-panel.component.ts index 0b5c93ff59..c177e8282b 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/common/editor-panel.component.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/common/editor-panel.component.ts @@ -59,9 +59,33 @@ export class EditorPanelComponent implements OnInit { resize: false, setup: (editor) => { editor.on('PostRender', function() { - const container = editor.getContainer().closest('.tb-popover-content'); - const uiContainer = document.querySelector('.tox.tox-tinymce-aux'); - container.parentNode.appendChild(uiContainer); + const container = document.querySelector('.tox.tox-tinymce-aux'); + const styleSheet = document.createElement('style'); + styleSheet.innerText = ` + .tox-tiered-menu .tox-menu { + width: fit-content; + max-width: min(80%, 440px); + @media screen and (max-width: 510px) { + max-width: calc(100% - 64px); + } + media screen and (min-width: 511px) and (max-width: 548px) { + max-width: calc(100% - 84px); + } + media screen and (min-width: 549px) and (max-width: 599px) { + max-width: calc(100% - 104px); + } + } + .tox-tiered-menu .tox-menu .tox-collection__item-label { + word-break: normal; + } + @media screen and (max-width: 890px) { + .tox-tiered-menu > .tox-collection--list:not(:first-child) { + left: auto !important; + right: 0 !important; + } + } + `; + container.prepend(styleSheet); }); }, relative_urls: false, diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts index 84848a757c..c21603b240 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts @@ -97,9 +97,33 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co promotion: false, setup: (editor) => { editor.on('PostRender', function() { - const container = editor.getContainer().closest('.mat-mdc-dialog-container'); - const uiContainer = document.querySelector('.tox.tox-tinymce-aux'); - container.parentNode.appendChild(uiContainer); + const container = document.querySelector('.tox.tox-tinymce-aux'); + const styleSheet = document.createElement('style'); + styleSheet.innerText = ` + .tox-tiered-menu .tox-menu { + width: fit-content; + max-width: min(80%, 440px); + @media screen and (max-width: 510px) { + max-width: calc(100% - 64px); + } + media screen and (min-width: 511px) and (max-width: 548px) { + max-width: calc(100% - 84px); + } + media screen and (min-width: 549px) and (max-width: 599px) { + max-width: calc(100% - 104px); + } + } + .tox-tiered-menu .tox-menu .tox-collection__item-label { + word-break: normal; + } + @media screen and (max-width: 890px) { + .tox-tiered-menu > .tox-collection--list:not(:first-child) { + left: auto !important; + right: 0 !important; + } + } + `; + container.prepend(styleSheet); }); }, relative_urls: false, From 143b8f99af9daa5ac1a77a69ab006ce46829b188 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 1 Dec 2025 12:17:22 +0200 Subject: [PATCH 11/28] Minor changes --- .../server/config/SwaggerConfiguration.java | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java b/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java index 42a29b8d74..f6851a5a71 100644 --- a/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java +++ b/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java @@ -383,24 +383,6 @@ public class SwaggerConfiguration { )); } - private void securityCustomization(Map.Entry entry, SecurityRequirement jwtBearerRequirement, SecurityRequirement apiKeyRequirement) { - var path = entry.getKey(); - - if (path.matches(securityPathRegex) - && !path.matches(nonSecurityPathRegex) - && !path.equals(LOGIN_ENDPOINT) - && !path.equals(REFRESH_TOKEN_ENDPOINT)) { - - entry.getValue() - .readOperationsMap() - .values() - .forEach(operation -> { - operation.addSecurityItem(jwtBearerRequirement); - operation.addSecurityItem(apiKeyRequirement); - }); - } - } - private Tag extractTagFromPath(Map.Entry entry) { var tagName = tagItemFromPathItem(entry.getValue()); return tagName != null ? tagFromTagItem(tagName) : null; @@ -439,19 +421,32 @@ public class SwaggerConfiguration { var responses = operation.getResponses(); if (responses == null) { - responses = new ApiResponses(); - operation.setResponses(responses); + responses = errorResponses; + } else { + ApiResponses updated = responses; + errorResponses.forEach((key, apiResponse) -> { + if (!updated.containsKey(key)) { + updated.put(key, apiResponse); + } + }); } - - ApiResponses finalResponses = responses; - errorResponses.forEach((code, response) -> { - if (!finalResponses.containsKey(code)) { - finalResponses.put(code, response); - } - }); + operation.setResponses(responses); }); } + private void securityCustomization(Map.Entry entry, SecurityRequirement jwtBearerRequirement, SecurityRequirement apiKeyRequirement) { + var path = entry.getKey(); + if (path.matches(securityPathRegex) && !path.matches(nonSecurityPathRegex) && !path.equals(LOGIN_ENDPOINT) && !path.equals(REFRESH_TOKEN_ENDPOINT)) { + entry.getValue() + .readOperationsMap() + .values() + .forEach(operation -> { + operation.addSecurityItem(jwtBearerRequirement); + operation.addSecurityItem(apiKeyRequirement); + }); + } + } + private static ApiResponses loginResponses() { ApiResponses apiResponses = new ApiResponses(); apiResponses.addApiResponse("200", new ApiResponse().description("OK") From a5256c14e7076e7b93623f57ef7f8d85ba51e0bf Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Mon, 1 Dec 2025 16:43:39 +0200 Subject: [PATCH 12/28] Fix broken rest client for `/entitiesQuery/find/keys`; refactoring --- .../controller/EntityQueryController.java | 86 ++++++------ .../query/DefaultEntityQueryService.java | 129 +++++------------- .../service/query/EntityQueryService.java | 9 +- .../dao/attributes/AttributesService.java | 2 +- .../dao/timeseries/TimeseriesService.java | 3 + .../data/query/AvailableEntityKeys.java | 67 +++++++++ .../server/dao/attributes/AttributesDao.java | 2 +- .../dao/attributes/BaseAttributesService.java | 7 +- .../attributes/CachedAttributesService.java | 6 +- .../dao/sql/attributes/JpaAttributeDao.java | 8 +- .../CachedRedisSqlTimeseriesLatestDao.java | 4 + .../dao/sqlts/SqlTimeseriesLatestDao.java | 12 +- .../dao/timeseries/BaseTimeseriesService.java | 9 +- .../CassandraBaseTimeseriesLatestDao.java | 8 +- .../dao/timeseries/TimeseriesLatestDao.java | 6 +- .../attributes/BaseAttributesServiceTest.java | 2 +- .../thingsboard/rest/client/RestClient.java | 20 ++- 17 files changed, 203 insertions(+), 177 deletions(-) create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java diff --git a/application/src/main/java/org/thingsboard/server/controller/EntityQueryController.java b/application/src/main/java/org/thingsboard/server/controller/EntityQueryController.java index 70fa3a5ed0..f471c9e7b4 100644 --- a/application/src/main/java/org/thingsboard/server/controller/EntityQueryController.java +++ b/application/src/main/java/org/thingsboard/server/controller/EntityQueryController.java @@ -17,33 +17,30 @@ package org.thingsboard.server.controller; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; +import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; +import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.edqs.EdqsState; import org.thingsboard.server.common.data.edqs.ToCoreEdqsRequest; import org.thingsboard.server.common.data.exception.ThingsboardException; -import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.query.AlarmCountQuery; import org.thingsboard.server.common.data.query.AlarmData; import org.thingsboard.server.common.data.query.AlarmDataQuery; +import org.thingsboard.server.common.data.query.AvailableEntityKeys; import org.thingsboard.server.common.data.query.EntityCountQuery; import org.thingsboard.server.common.data.query.EntityData; import org.thingsboard.server.common.data.query.EntityDataPageLink; import org.thingsboard.server.common.data.query.EntityDataQuery; import org.thingsboard.server.common.data.query.EntityFilter; -import org.thingsboard.server.common.msg.edqs.EdqsApiService; import org.thingsboard.server.common.msg.edqs.EdqsService; import org.thingsboard.server.config.annotations.ApiOperation; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -51,52 +48,46 @@ import org.thingsboard.server.service.query.EntityQueryService; import org.thingsboard.server.service.security.permission.Operation; import static org.thingsboard.server.controller.ControllerConstants.ALARM_DATA_QUERY_DESCRIPTION; -import static org.thingsboard.server.controller.ControllerConstants.ATTRIBUTES_SCOPE_DESCRIPTION; import static org.thingsboard.server.controller.ControllerConstants.ENTITY_COUNT_QUERY_DESCRIPTION; import static org.thingsboard.server.controller.ControllerConstants.ENTITY_DATA_QUERY_DESCRIPTION; +import static org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH; @RestController @TbCoreComponent @RequestMapping("/api") +@RequiredArgsConstructor public class EntityQueryController extends BaseController { - @Autowired - private EntityQueryService entityQueryService; - @Autowired - private EdqsService edqsService; - @Autowired - private EdqsApiService edqsApiService; + private final EntityQueryService entityQueryService; + private final EdqsService edqsService; private static final int MAX_PAGE_SIZE = 100; @ApiOperation(value = "Count Entities by Query", notes = ENTITY_COUNT_QUERY_DESCRIPTION) @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") - @RequestMapping(value = "/entitiesQuery/count", method = RequestMethod.POST) - @ResponseBody + @PostMapping("/entitiesQuery/count") public long countEntitiesByQuery( @Parameter(description = "A JSON value representing the entity count query. See API call notes above for more details.") @RequestBody EntityCountQuery query) throws ThingsboardException { checkNotNull(query); resolveQuery(query); - return this.entityQueryService.countEntitiesByQuery(getCurrentUser(), query); + return entityQueryService.countEntitiesByQuery(getCurrentUser(), query); } @ApiOperation(value = "Find Entity Data by Query", notes = ENTITY_DATA_QUERY_DESCRIPTION) @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") - @RequestMapping(value = "/entitiesQuery/find", method = RequestMethod.POST) - @ResponseBody + @PostMapping("/entitiesQuery/find") public PageData findEntityDataByQuery( @Parameter(description = "A JSON value representing the entity data query. See API call notes above for more details.") @RequestBody EntityDataQuery query) throws ThingsboardException { checkNotNull(query); resolveQuery(query); - return this.entityQueryService.findEntityDataByQuery(getCurrentUser(), query); + return entityQueryService.findEntityDataByQuery(getCurrentUser(), query); } @ApiOperation(value = "Find Alarms by Query", notes = ALARM_DATA_QUERY_DESCRIPTION) @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") - @RequestMapping(value = "/alarmsQuery/find", method = RequestMethod.POST) - @ResponseBody + @PostMapping("/alarmsQuery/find") public PageData findAlarmDataByQuery( @Parameter(description = "A JSON value representing the alarm data query. See API call notes above for more details.") @RequestBody AlarmDataQuery query) throws ThingsboardException { @@ -107,13 +98,12 @@ public class EntityQueryController extends BaseController { checkUserId(assigneeId, Operation.READ); } resolveQuery(query); - return this.entityQueryService.findAlarmDataByQuery(getCurrentUser(), query); + return entityQueryService.findAlarmDataByQuery(getCurrentUser(), query); } @ApiOperation(value = "Count Alarms by Query (countAlarmsByQuery)", notes = "Returns the number of alarms that match the query definition.") @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") - @RequestMapping(value = "/alarmsQuery/count", method = RequestMethod.POST) - @ResponseBody + @PostMapping("/alarmsQuery/count") public long countAlarmsByQuery(@Parameter(description = "A JSON value representing the alarm count query.") @RequestBody AlarmCountQuery query) throws ThingsboardException { checkNotNull(query); @@ -122,31 +112,47 @@ public class EntityQueryController extends BaseController { checkUserId(assigneeId, Operation.READ); } resolveQuery(query); - return this.entityQueryService.countAlarmsByQuery(getCurrentUser(), query); + return entityQueryService.countAlarmsByQuery(getCurrentUser(), query); } - @ApiOperation(value = "Find Entity Keys by Query", - notes = "Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints.") + @ApiOperation( + value = "Find Available Entity Keys by Query", + notes = """ + Returns unique time series and/or attribute key names from entities matching the query.\n + Executes the Entity Data Query to find up to 100 entities, then fetches and aggregates all distinct key names.\n + Primarily used for UI features like autocomplete suggestions.""" + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH + ) @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") - @RequestMapping(value = "/entitiesQuery/find/keys", method = RequestMethod.POST) - @ResponseBody - public DeferredResult findEntityTimeseriesAndAttributesKeysByQuery( - @Parameter(description = "A JSON value representing the entity data query. See API call notes above for more details.") + @PostMapping("/entitiesQuery/find/keys") + public DeferredResult findAvailableEntityKeysByQuery( + @Parameter(description = "Entity data query to find entities. Page size is capped at 100.") @RequestBody EntityDataQuery query, - @Parameter(description = "Include all unique time-series keys to the result.") - @RequestParam("timeseries") boolean isTimeseries, - @Parameter(description = "Include all unique attribute keys to the result.") - @RequestParam("attributes") boolean isAttributes, - @Parameter(description = ATTRIBUTES_SCOPE_DESCRIPTION, schema = @Schema(allowableValues = {"SERVER_SCOPE", "SHARED_SCOPE", "CLIENT_SCOPE"})) - @RequestParam(value = "scope", required = false) String scope) throws ThingsboardException { - TenantId tenantId = getTenantId(); - checkNotNull(query); + + // fixme: combination of timeseries = false and attributes = false is allowed, but always results in empty response, therefore does not make any sense + // such combinations should NOT be allowed, but changing this will break clients + + @Parameter(description = """ + When true, includes unique time series key names in the response. + When false, the 'timeseries' list will be empty.""") + @RequestParam("timeseries") boolean includeTimeseries, + + @Parameter(description = """ + When true, includes unique attribute key names in the response. + When false, the 'attribute' list will be empty. Use 'scope' parameter to filter by attribute scope.""") + @RequestParam("attributes") boolean includeAttributes, + + @Parameter(description = """ + Filters attribute keys by scope. Only applies when 'attributes' is true. + If not specified, returns attribute keys from all scopes.""", + schema = @Schema(allowableValues = {"SERVER_SCOPE", "SHARED_SCOPE", "CLIENT_SCOPE"})) + @RequestParam(value = "scope", required = false) AttributeScope scope + ) throws ThingsboardException { resolveQuery(query); EntityDataPageLink pageLink = query.getPageLink(); if (pageLink.getPageSize() > MAX_PAGE_SIZE) { pageLink.setPageSize(MAX_PAGE_SIZE); } - return entityQueryService.getKeysByQuery(getCurrentUser(), tenantId, query, isTimeseries, isAttributes, scope); + return wrapFuture(entityQueryService.getKeysByQuery(getCurrentUser(), getTenantId(), query, includeTimeseries, includeAttributes, scope)); } @PreAuthorize("hasAnyAuthority('SYS_ADMIN')") diff --git a/application/src/main/java/org/thingsboard/server/service/query/DefaultEntityQueryService.java b/application/src/main/java/org/thingsboard/server/service/query/DefaultEntityQueryService.java index f39769526a..6ef6b239e5 100644 --- a/application/src/main/java/org/thingsboard/server/service/query/DefaultEntityQueryService.java +++ b/application/src/main/java/org/thingsboard/server/service/query/DefaultEntityQueryService.java @@ -15,24 +15,18 @@ */ package org.thingsboard.server.service.query; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; -import org.checkerframework.checker.nullness.qual.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import org.springframework.web.context.request.async.DeferredResult; -import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.common.util.KvUtil; import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; +import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; @@ -40,6 +34,7 @@ import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.query.AlarmCountQuery; import org.thingsboard.server.common.data.query.AlarmData; import org.thingsboard.server.common.data.query.AlarmDataQuery; +import org.thingsboard.server.common.data.query.AvailableEntityKeys; import org.thingsboard.server.common.data.query.ComplexFilterPredicate; import org.thingsboard.server.common.data.query.DynamicValue; import org.thingsboard.server.common.data.query.EntityCountQuery; @@ -56,16 +51,13 @@ import org.thingsboard.server.common.data.query.SimpleKeyFilterPredicate; import org.thingsboard.server.dao.alarm.AlarmService; import org.thingsboard.server.dao.attributes.AttributesService; import org.thingsboard.server.dao.entity.EntityService; -import org.thingsboard.server.dao.model.ModelConstants; import org.thingsboard.server.dao.sql.query.EntityKeyMapping; import org.thingsboard.server.dao.timeseries.TimeseriesService; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.executors.DbCallbackExecutorService; -import org.thingsboard.server.service.security.AccessValidator; import org.thingsboard.server.service.security.model.SecurityUser; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@ -73,9 +65,10 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.ExecutionException; -import java.util.function.Consumer; import java.util.stream.Collectors; +import static com.google.common.util.concurrent.Futures.immediateFuture; + @Service @Slf4j @TbCoreComponent @@ -138,20 +131,12 @@ public class DefaultEntityQueryService implements EntityQueryService { } private void resolveDynamicValue(DynamicValue dynamicValue, SecurityUser user, FilterPredicateType predicateType) { - EntityId entityId; - switch (dynamicValue.getSourceType()) { - case CURRENT_TENANT: - entityId = user.getTenantId(); - break; - case CURRENT_CUSTOMER: - entityId = user.getCustomerId(); - break; - case CURRENT_USER: - entityId = user.getId(); - break; - default: - throw new RuntimeException("Not supported operation for source type: {" + dynamicValue.getSourceType() + "}"); - } + EntityId entityId = switch (dynamicValue.getSourceType()) { + case CURRENT_TENANT -> user.getTenantId(); + case CURRENT_CUSTOMER -> user.getCustomerId(); + case CURRENT_USER -> user.getId(); + default -> throw new RuntimeException("Not supported operation for source type: {" + dynamicValue.getSourceType() + "}"); + }; try { Optional valueOpt = attributesService.find(user.getTenantId(), entityId, @@ -242,101 +227,51 @@ public class DefaultEntityQueryService implements EntityQueryService { } @Override - public DeferredResult getKeysByQuery(SecurityUser securityUser, TenantId tenantId, EntityDataQuery query, - boolean isTimeseries, boolean isAttributes, String attributesScope) { - final DeferredResult response = new DeferredResult<>(); + public ListenableFuture getKeysByQuery(SecurityUser securityUser, TenantId tenantId, EntityDataQuery query, + boolean isTimeseries, boolean isAttributes, AttributeScope scope) { if (!isAttributes && !isTimeseries) { - replyWithEmptyResponse(response); - return response; + return immediateFuture(AvailableEntityKeys.none()); } - List ids = this.findEntityDataByQuery(securityUser, query).getData().stream() + List ids = findEntityDataByQuery(securityUser, query).getData().stream() .map(EntityData::getEntityId) - .collect(Collectors.toList()); + .toList(); if (ids.isEmpty()) { - replyWithEmptyResponse(response); - return response; + return immediateFuture(AvailableEntityKeys.none()); } Set types = ids.stream().map(EntityId::getEntityType).collect(Collectors.toSet()); - final ListenableFuture> timeseriesKeysFuture; - final ListenableFuture> attributesKeysFuture; + ListenableFuture> timeseriesKeysFuture; + ListenableFuture> attributesKeysFuture; if (isTimeseries) { - timeseriesKeysFuture = dbCallbackExecutor.submit(() -> timeseriesService.findAllKeysByEntityIds(tenantId, ids)); + timeseriesKeysFuture = timeseriesService.findAllKeysByEntityIdsAsync(tenantId, ids); } else { - timeseriesKeysFuture = null; + timeseriesKeysFuture = immediateFuture(Collections.emptyList()); } if (isAttributes) { Map> typesMap = ids.stream().collect(Collectors.groupingBy(EntityId::getEntityType)); List>> futures = new ArrayList<>(typesMap.size()); - typesMap.forEach((type, entityIds) -> futures.add(dbCallbackExecutor.submit(() -> attributesService.findAllKeysByEntityIds(tenantId, entityIds, attributesScope)))); + typesMap.forEach((type, entityIds) -> futures.add(dbCallbackExecutor.submit(() -> attributesService.findAllKeysByEntityIds(tenantId, entityIds, scope)))); attributesKeysFuture = Futures.transform(Futures.allAsList(futures), lists -> { if (CollectionUtils.isEmpty(lists)) { return Collections.emptyList(); } - return lists.stream().flatMap(List::stream).distinct().sorted().collect(Collectors.toList()); - }, dbCallbackExecutor); - } else { - attributesKeysFuture = null; - } - - if (isTimeseries && isAttributes) { - Futures.whenAllComplete(timeseriesKeysFuture, attributesKeysFuture).run(() -> { - try { - replyWithResponse(response, types, timeseriesKeysFuture.get(), attributesKeysFuture.get()); - } catch (Exception e) { - log.error("Failed to fetch timeseries and attributes keys!", e); - AccessValidator.handleError(e, response, HttpStatus.INTERNAL_SERVER_ERROR); - } + return lists.stream().flatMap(List::stream).distinct().sorted().toList(); }, dbCallbackExecutor); - } else if (isTimeseries) { - addCallback(timeseriesKeysFuture, keys -> replyWithResponse(response, types, keys, null), - error -> { - log.error("Failed to fetch timeseries keys!", error); - AccessValidator.handleError(error, response, HttpStatus.INTERNAL_SERVER_ERROR); - }); } else { - addCallback(attributesKeysFuture, keys -> replyWithResponse(response, types, null, keys), - error -> { - log.error("Failed to fetch attributes keys!", error); - AccessValidator.handleError(error, response, HttpStatus.INTERNAL_SERVER_ERROR); - }); + attributesKeysFuture = immediateFuture(Collections.emptyList()); } - return response; - } - - private void replyWithResponse(DeferredResult response, Set types, List timeseriesKeys, List attributesKeys) { - ObjectNode json = JacksonUtil.newObjectNode(); - addItemsToArrayNode(json.putArray("entityTypes"), types); - addItemsToArrayNode(json.putArray("timeseries"), timeseriesKeys); - addItemsToArrayNode(json.putArray("attribute"), attributesKeys); - response.setResult(new ResponseEntity<>(json, HttpStatus.OK)); - } - private void replyWithEmptyResponse(DeferredResult response) { - replyWithResponse(response, Collections.emptySet(), Collections.emptyList(), Collections.emptyList()); - } - - private void addItemsToArrayNode(ArrayNode arrayNode, Collection collection) { - if (!CollectionUtils.isEmpty(collection)) { - collection.forEach(item -> arrayNode.add(item.toString())); - } - } - - private void addCallback(ListenableFuture> future, Consumer> success, Consumer error) { - Futures.addCallback(future, new FutureCallback>() { - @Override - public void onSuccess(@Nullable List keys) { - success.accept(keys); - } - - @Override - public void onFailure(Throwable t) { - error.accept(t); - } - }, dbCallbackExecutor); + return Futures.whenAllComplete(timeseriesKeysFuture, attributesKeysFuture) + .call(() -> { + try { + return new AvailableEntityKeys(types, Futures.getDone(timeseriesKeysFuture), Futures.getDone(attributesKeysFuture)); + } catch (ExecutionException e) { + throw new ThingsboardException(e.getCause(), ThingsboardErrorCode.DATABASE); + } + }, dbCallbackExecutor); } } diff --git a/application/src/main/java/org/thingsboard/server/service/query/EntityQueryService.java b/application/src/main/java/org/thingsboard/server/service/query/EntityQueryService.java index 78ea2519fd..ac6553d738 100644 --- a/application/src/main/java/org/thingsboard/server/service/query/EntityQueryService.java +++ b/application/src/main/java/org/thingsboard/server/service/query/EntityQueryService.java @@ -15,13 +15,14 @@ */ package org.thingsboard.server.service.query; -import org.springframework.http.ResponseEntity; -import org.springframework.web.context.request.async.DeferredResult; +import com.google.common.util.concurrent.ListenableFuture; +import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.query.AlarmCountQuery; import org.thingsboard.server.common.data.query.AlarmData; import org.thingsboard.server.common.data.query.AlarmDataQuery; +import org.thingsboard.server.common.data.query.AvailableEntityKeys; import org.thingsboard.server.common.data.query.EntityCountQuery; import org.thingsboard.server.common.data.query.EntityData; import org.thingsboard.server.common.data.query.EntityDataQuery; @@ -37,7 +38,7 @@ public interface EntityQueryService { long countAlarmsByQuery(SecurityUser securityUser, AlarmCountQuery query); - DeferredResult getKeysByQuery(SecurityUser securityUser, TenantId tenantId, EntityDataQuery query, - boolean isTimeseries, boolean isAttributes, String attributesScope); + ListenableFuture getKeysByQuery(SecurityUser securityUser, TenantId tenantId, EntityDataQuery query, + boolean isTimeseries, boolean isAttributes, AttributeScope scope); } diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/attributes/AttributesService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/attributes/AttributesService.java index 0d5d3dcd13..2cdad499de 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/attributes/AttributesService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/attributes/AttributesService.java @@ -48,7 +48,7 @@ public interface AttributesService { List findAllKeysByEntityIds(TenantId tenantId, List entityIds); - List findAllKeysByEntityIds(TenantId tenantId, List entityIds, String scope); + List findAllKeysByEntityIds(TenantId tenantId, List entityIds, AttributeScope scope); int removeAllByEntityId(TenantId tenantId, EntityId entityId); diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesService.java index e239e22ee9..0b88ce17cc 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesService.java @@ -63,5 +63,8 @@ public interface TimeseriesService { List findAllKeysByEntityIds(TenantId tenantId, List entityIds); + ListenableFuture> findAllKeysByEntityIdsAsync(TenantId tenantId, List entityIds); + void cleanup(long systemTtl); + } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java b/common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java new file mode 100644 index 0000000000..4cac646908 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/query/AvailableEntityKeys.java @@ -0,0 +1,67 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.query; + +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Schema; +import org.thingsboard.server.common.data.EntityType; + +import java.util.List; +import java.util.Set; + +import static java.util.Collections.emptyList; +import static java.util.Collections.emptySet; +import static java.util.Objects.requireNonNullElse; + +@Schema( + description = "Contains unique time series and attribute key names discovered from entities matching a query. Used primarily for UI hints such as autocomplete suggestions." +) +public record AvailableEntityKeys( + @Schema( + description = "Set of entity types found among the matched entities.", + example = "[\"DEVICE\", \"ASSET\"]", + requiredMode = Schema.RequiredMode.REQUIRED + ) + Set entityTypes, + + @Schema(requiredMode = Schema.RequiredMode.REQUIRED) + @ArraySchema( + arraySchema = @Schema(description = "List of unique time series key names available on the matched entities."), + schema = @Schema(implementation = String.class, example = "temperature"), + uniqueItems = true + ) + List timeseries, + + @Schema(requiredMode = Schema.RequiredMode.REQUIRED) + @ArraySchema( + arraySchema = @Schema(description = "List of unique attribute key names available on the matched entities."), + schema = @Schema(implementation = String.class, example = "serialNumber"), + uniqueItems = true + ) + List attribute +) { + + public AvailableEntityKeys { + entityTypes = requireNonNullElse(entityTypes, emptySet()); + timeseries = requireNonNullElse(timeseries, emptyList()); + attribute = requireNonNullElse(attribute, emptyList()); + } + + public static AvailableEntityKeys none() { + return new AvailableEntityKeys(emptySet(), emptyList(), emptyList()); + } + +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesDao.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesDao.java index 5527d17add..a1af985887 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesDao.java @@ -53,7 +53,7 @@ public interface AttributesDao { List findAllKeysByEntityIds(TenantId tenantId, List entityIds); - List findAllKeysByEntityIdsAndAttributeType(TenantId tenantId, List entityIds, String attributeType); + List findAllKeysByEntityIdsAndScope(TenantId tenantId, List entityIds, AttributeScope scope); List> removeAllByEntityId(TenantId tenantId, EntityId entityId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java index 62b35caa7f..362aa95ee6 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java @@ -28,7 +28,6 @@ import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.ObjectType; -import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.edqs.AttributeKv; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.EntityId; @@ -93,11 +92,11 @@ public class BaseAttributesService implements AttributesService { } @Override - public List findAllKeysByEntityIds(TenantId tenantId, List entityIds, String scope) { - if (StringUtils.isEmpty(scope)) { + public List findAllKeysByEntityIds(TenantId tenantId, List entityIds, AttributeScope scope) { + if (scope == null) { return attributesDao.findAllKeysByEntityIds(tenantId, entityIds); } else { - return attributesDao.findAllKeysByEntityIdsAndAttributeType(tenantId, entityIds, scope); + return attributesDao.findAllKeysByEntityIdsAndScope(tenantId, entityIds, scope); } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java index 44b2daaf8e..11ba48773d 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java @@ -212,11 +212,11 @@ public class CachedAttributesService implements AttributesService { } @Override - public List findAllKeysByEntityIds(TenantId tenantId, List entityIds, String scope) { - if (StringUtils.isEmpty(scope)) { + public List findAllKeysByEntityIds(TenantId tenantId, List entityIds, AttributeScope scope) { + if (scope == null) { return attributesDao.findAllKeysByEntityIds(tenantId, entityIds); } else { - return attributesDao.findAllKeysByEntityIdsAndAttributeType(tenantId, entityIds, scope); + return attributesDao.findAllKeysByEntityIdsAndScope(tenantId, entityIds, scope); } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/attributes/JpaAttributeDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/attributes/JpaAttributeDao.java index 0a8b8f6399..1e58b23a1f 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/attributes/JpaAttributeDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/attributes/JpaAttributeDao.java @@ -177,10 +177,12 @@ public class JpaAttributeDao extends JpaAbstractDaoListeningExecutorService impl } @Override - public List findAllKeysByEntityIdsAndAttributeType(TenantId tenantId, List entityIds, String attributeType) { + public List findAllKeysByEntityIdsAndScope(TenantId tenantId, List entityIds, AttributeScope scope) { return attributeKvRepository - .findAllKeysByEntityIdsAndAttributeType(entityIds.stream().map(EntityId::getId).collect(Collectors.toList()), AttributeScope.valueOf(attributeType).getId()) - .stream().map(id -> keyDictionaryDao.getKey(id)).collect(Collectors.toList()); + .findAllKeysByEntityIdsAndAttributeType(entityIds.stream().map(EntityId::getId).toList(), scope.getId()) + .stream() + .map(keyDictionaryDao::getKey) + .toList(); } @Override diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java index d45182442a..bac5529249 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java @@ -167,5 +167,9 @@ public class CachedRedisSqlTimeseriesLatestDao extends BaseAbstractSqlTimeseries return sqlDao.findAllKeysByEntityIds(tenantId, entityIds); } + @Override + public ListenableFuture> findAllKeysByEntityIdsAsync(TenantId tenantId, List entityIds) { + return sqlDao.findAllKeysByEntityIdsAsync(tenantId, entityIds); + } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/SqlTimeseriesLatestDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/SqlTimeseriesLatestDao.java index c546fc21ea..27470bfe8a 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/SqlTimeseriesLatestDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/SqlTimeseriesLatestDao.java @@ -24,7 +24,6 @@ import jakarta.annotation.PreDestroy; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.domain.Page; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.EntityId; @@ -38,8 +37,6 @@ import org.thingsboard.server.common.data.kv.ReadTsKvQueryResult; import org.thingsboard.server.common.data.kv.StringDataEntry; import org.thingsboard.server.common.data.kv.TsKvEntry; import org.thingsboard.server.common.data.kv.TsKvLatestRemovingResult; -import org.thingsboard.server.common.data.page.PageData; -import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.stats.StatsFactory; import org.thingsboard.server.dao.DaoUtil; import org.thingsboard.server.dao.dictionary.KeyDictionaryDao; @@ -64,7 +61,6 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; import java.util.function.Function; -import java.util.stream.Collectors; @Slf4j @Component @@ -185,9 +181,13 @@ public class SqlTimeseriesLatestDao extends BaseAbstractSqlTimeseriesDao impleme @Override public List findAllKeysByEntityIds(TenantId tenantId, List entityIds) { - return tsKvLatestRepository.findAllKeysByEntityIds(entityIds.stream().map(EntityId::getId).collect(Collectors.toList())); + return tsKvLatestRepository.findAllKeysByEntityIds(entityIds.stream().map(EntityId::getId).toList()); } + @Override + public ListenableFuture> findAllKeysByEntityIdsAsync(TenantId tenantId, List entityIds) { + return service.submit(() -> findAllKeysByEntityIds(tenantId, entityIds)); + } private ListenableFuture getNewLatestEntryFuture(TenantId tenantId, EntityId entityId, DeleteTsKvQuery query, Long version) { ListenableFuture> future = findNewLatestEntryFuture(tenantId, entityId, query); @@ -211,7 +211,7 @@ public class SqlTimeseriesLatestDao extends BaseAbstractSqlTimeseriesDao impleme ReadTsKvQueryResult::getData, MoreExecutors.directExecutor()); } - protected TsKvEntry doFindLatestSync(EntityId entityId, String key) { + protected TsKvEntry doFindLatestSync(EntityId entityId, String key) { TsKvLatestCompositeKey compositeKey = new TsKvLatestCompositeKey( entityId.getId(), diff --git a/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java b/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java index ceb7fcf822..de197bf88f 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java @@ -156,6 +156,11 @@ public class BaseTimeseriesService implements TimeseriesService { return timeseriesLatestDao.findAllKeysByEntityIds(tenantId, entityIds); } + @Override + public ListenableFuture> findAllKeysByEntityIdsAsync(TenantId tenantId, List entityIds) { + return timeseriesLatestDao.findAllKeysByEntityIdsAsync(tenantId, entityIds); + } + @Override public void cleanup(long systemTtl) { timeseriesDao.cleanup(systemTtl); @@ -300,13 +305,13 @@ public class BaseTimeseriesService implements TimeseriesService { long interval = query.getInterval(); if (interval < 1) { throw new IncorrectParameterException("Invalid TsKvQuery: 'interval' must be greater than 0, but got " + interval + - ". Please check your query parameters and ensure 'endTs' is greater than 'startTs' or increase 'interval'."); + ". Please check your query parameters and ensure 'endTs' is greater than 'startTs' or increase 'interval'."); } long step = Math.max(interval, 1000); long intervalCounts = (query.getEndTs() - query.getStartTs()) / step; if (intervalCounts > maxTsIntervals || intervalCounts < 0) { throw new IncorrectParameterException("Incorrect TsKvQuery. Number of intervals is to high - " + intervalCounts + ". " + - "Please increase 'interval' parameter for your query or reduce the time range of the query."); + "Please increase 'interval' parameter for your query or reduce the time range of the query."); } } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/timeseries/CassandraBaseTimeseriesLatestDao.java b/dao/src/main/java/org/thingsboard/server/dao/timeseries/CassandraBaseTimeseriesLatestDao.java index 54a7e68725..dd44a62349 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/timeseries/CassandraBaseTimeseriesLatestDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/timeseries/CassandraBaseTimeseriesLatestDao.java @@ -36,17 +36,13 @@ import org.thingsboard.server.common.data.kv.ReadTsKvQuery; import org.thingsboard.server.common.data.kv.ReadTsKvQueryResult; import org.thingsboard.server.common.data.kv.TsKvEntry; import org.thingsboard.server.common.data.kv.TsKvLatestRemovingResult; -import org.thingsboard.server.common.data.page.PageData; -import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.dao.model.ModelConstants; -import org.thingsboard.server.dao.model.sqlts.latest.TsKvLatestEntity; import org.thingsboard.server.dao.nosql.TbResultSet; import org.thingsboard.server.dao.sqlts.AggregationTimeseriesDao; import org.thingsboard.server.dao.util.NoSqlTsLatestDao; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Optional; import static com.datastax.oss.driver.api.querybuilder.QueryBuilder.literal; @@ -103,6 +99,10 @@ public class CassandraBaseTimeseriesLatestDao extends AbstractCassandraBaseTimes return Collections.emptyList(); } + @Override + public ListenableFuture> findAllKeysByEntityIdsAsync(TenantId tenantId, List entityIds) { + return Futures.immediateFuture(Collections.emptyList()); + } @Override public ListenableFuture saveLatest(TenantId tenantId, EntityId entityId, TsKvEntry tsKvEntry) { diff --git a/dao/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesLatestDao.java b/dao/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesLatestDao.java index 32479301ae..74c041e4d3 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesLatestDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/timeseries/TimeseriesLatestDao.java @@ -22,12 +22,8 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.kv.DeleteTsKvQuery; import org.thingsboard.server.common.data.kv.TsKvEntry; import org.thingsboard.server.common.data.kv.TsKvLatestRemovingResult; -import org.thingsboard.server.common.data.page.PageData; -import org.thingsboard.server.common.data.page.PageLink; -import org.thingsboard.server.dao.model.sqlts.latest.TsKvLatestEntity; import java.util.List; -import java.util.Map; import java.util.Optional; public interface TimeseriesLatestDao { @@ -54,4 +50,6 @@ public interface TimeseriesLatestDao { List findAllKeysByEntityIds(TenantId tenantId, List entityIds); + ListenableFuture> findAllKeysByEntityIdsAsync(TenantId tenantId, List entityIds); + } diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/attributes/BaseAttributesServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/attributes/BaseAttributesServiceTest.java index 5978d903c7..41a013e4c9 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/attributes/BaseAttributesServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/attributes/BaseAttributesServiceTest.java @@ -223,7 +223,7 @@ public abstract class BaseAttributesServiceTest extends AbstractServiceTest { saveAttribute(tenantId, deviceId, AttributeScope.SERVER_SCOPE, "key2", "123"); Awaitility.await().atMost(30, TimeUnit.SECONDS).untilAsserted(() -> { - List keys = attributesService.findAllKeysByEntityIds(tenantId, List.of(deviceId), AttributeScope.SERVER_SCOPE.name()); + List keys = attributesService.findAllKeysByEntityIds(tenantId, List.of(deviceId), AttributeScope.SERVER_SCOPE); assertThat(keys).containsOnly("key1", "key2"); }); } diff --git a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java index 2c8e01d246..6eb61b3e13 100644 --- a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java +++ b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java @@ -39,10 +39,12 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.common.util.ThingsBoardExecutors; import org.thingsboard.rest.client.utils.RestJsonConverter; import org.thingsboard.server.common.data.AdminSettings; +import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.ClaimRequest; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.Dashboard; @@ -160,6 +162,7 @@ import org.thingsboard.server.common.data.plugin.ComponentType; import org.thingsboard.server.common.data.query.AlarmCountQuery; import org.thingsboard.server.common.data.query.AlarmData; import org.thingsboard.server.common.data.query.AlarmDataQuery; +import org.thingsboard.server.common.data.query.AvailableEntityKeys; import org.thingsboard.server.common.data.query.EntityCountQuery; import org.thingsboard.server.common.data.query.EntityData; import org.thingsboard.server.common.data.query.EntityDataQuery; @@ -592,7 +595,7 @@ public class RestClient implements Closeable { } public PageData getAllAlarmsV2(List statusList, List severityList, - List typeList, String assignedId, TimePageLink pageLink) { + List typeList, String assignedId, TimePageLink pageLink) { String urlSecondPart = "/api/v2/alarms?"; Map params = new HashMap<>(); if (!CollectionUtils.isEmpty(statusList)) { @@ -1824,12 +1827,15 @@ public class RestClient implements Closeable { }).getBody(); } - public JsonNode findEntityTimeseriesAndAttributesKeysByQuery(EntityDataQuery query) { - return restTemplate.exchange( - baseURL + "/api/entitiesQuery/find/keys", - HttpMethod.POST, new HttpEntity<>(query), - new ParameterizedTypeReference() { - }).getBody(); + public AvailableEntityKeys findAvailableEntityKeysByQuery(EntityDataQuery query, boolean includeTimeseries, boolean includeAttributes, AttributeScope scope) { + var uri = UriComponentsBuilder.fromUriString(baseURL) + .path("/api/entitiesQuery/find/keys") + .queryParam("timeseries", includeTimeseries) + .queryParam("attributes", includeAttributes) + .queryParamIfPresent("scope", Optional.ofNullable(scope)) + .build() + .toUri(); + return restTemplate.exchange(uri, HttpMethod.POST, new HttpEntity<>(query), new ParameterizedTypeReference() {}).getBody(); } public PageData findAlarmDataByQuery(AlarmDataQuery query) { From b325731ffdef1ad7ece0ffd79f620a3625103b54 Mon Sep 17 00:00:00 2001 From: Nikita Mazurenko Date: Mon, 1 Dec 2025 17:43:06 +0200 Subject: [PATCH 13/28] Fix customer unassignments in the dashboard during edge event processing --- .../dashboard/BaseDashboardProcessor.java | 8 +++---- .../dashboard/DashboardEdgeProcessor.java | 21 +++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java index 52b33e5297..42057099a8 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java @@ -65,12 +65,12 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { Dashboard savedDashboard = edgeCtx.getDashboardService().saveDashboard(dashboard, false); - updateDashboardAssignments(tenantId, dashboardById, savedDashboard, newAssignedCustomers); + updateDashboardAssignments(tenantId, customerId, dashboardById, savedDashboard, newAssignedCustomers); return created; } - private void updateDashboardAssignments(TenantId tenantId, Dashboard dashboardById, Dashboard savedDashboard, Set newAssignedCustomers) { + private void updateDashboardAssignments(TenantId tenantId, CustomerId edgeCustomerId, Dashboard dashboardById, Dashboard savedDashboard, Set newAssignedCustomers) { Set currentAssignedCustomers = new HashSet<>(); if (dashboardById != null) { if (dashboardById.getAssignedCustomers() != null) { @@ -78,7 +78,7 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { } } - newAssignedCustomers = filterNonExistingCustomers(tenantId, currentAssignedCustomers, newAssignedCustomers); + newAssignedCustomers = filterNonExistingCustomers(tenantId, edgeCustomerId, currentAssignedCustomers, newAssignedCustomers); Set addedCustomerIds = new HashSet<>(); Set removedCustomerIds = new HashSet<>(); @@ -114,6 +114,6 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { } } - protected abstract Set filterNonExistingCustomers(TenantId tenantId, Set currentAssignedCustomers, Set newAssignedCustomers); + protected abstract Set filterNonExistingCustomers(TenantId tenantId, CustomerId customerId, Set currentAssignedCustomers, Set newAssignedCustomers); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java index 522c2ba477..b38a9d618e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.ShortCustomerInfo; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; @@ -36,8 +37,10 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import java.util.HashSet; import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; @Slf4j @Component @@ -116,14 +119,24 @@ public class DashboardEdgeProcessor extends BaseDashboardProcessor implements Da } @Override - protected Set filterNonExistingCustomers(TenantId tenantId, Set currentAssignedCustomers, Set newAssignedCustomers) { - newAssignedCustomers.addAll(currentAssignedCustomers); - return newAssignedCustomers; + protected Set filterNonExistingCustomers(TenantId tenantId, CustomerId edgeCustomerId, Set currentAssignedCustomers, Set newAssignedCustomers) { + boolean edgeCustomerPresentInNewAssignments = newAssignedCustomers.stream() + .map(ShortCustomerInfo::getCustomerId) + .anyMatch(edgeCustomerId::equals); + + if (edgeCustomerPresentInNewAssignments) { + Set result = new HashSet<>(newAssignedCustomers); + result.addAll(currentAssignedCustomers); + return result; + } else { + return currentAssignedCustomers.stream() + .filter(info -> !edgeCustomerId.equals(info.getCustomerId())) + .collect(Collectors.toSet()); + } } @Override public EdgeEventType getEdgeEventType() { return EdgeEventType.DASHBOARD; } - } From d426545af86bb2e113a5e0a6903e457a63fd95d1 Mon Sep 17 00:00:00 2001 From: Nikita Mazurenko Date: Mon, 1 Dec 2025 18:08:04 +0200 Subject: [PATCH 14/28] Fix customer unassignments in the dashboard during edge event processing --- .../dashboard/BaseDashboardProcessor.java | 8 +++---- .../dashboard/DashboardEdgeProcessor.java | 21 +++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java index 56efb9157e..a1ac38138b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java @@ -63,12 +63,12 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { Dashboard savedDashboard = edgeCtx.getDashboardService().saveDashboard(dashboard, false); - updateDashboardAssignments(tenantId, dashboardById, savedDashboard, newAssignedCustomers); + updateDashboardAssignments(tenantId, customerId, dashboardById, savedDashboard, newAssignedCustomers); return created; } - private void updateDashboardAssignments(TenantId tenantId, Dashboard dashboardById, Dashboard savedDashboard, Set newAssignedCustomers) { + private void updateDashboardAssignments(TenantId tenantId, CustomerId edgeCustomerId, Dashboard dashboardById, Dashboard savedDashboard, Set newAssignedCustomers) { Set currentAssignedCustomers = new HashSet<>(); if (dashboardById != null) { if (dashboardById.getAssignedCustomers() != null) { @@ -76,7 +76,7 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { } } - newAssignedCustomers = filterNonExistingCustomers(tenantId, currentAssignedCustomers, newAssignedCustomers); + newAssignedCustomers = filterNonExistingCustomers(tenantId, edgeCustomerId, currentAssignedCustomers, newAssignedCustomers); Set addedCustomerIds = new HashSet<>(); Set removedCustomerIds = new HashSet<>(); @@ -100,6 +100,6 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { } } - protected abstract Set filterNonExistingCustomers(TenantId tenantId, Set currentAssignedCustomers, Set newAssignedCustomers); + protected abstract Set filterNonExistingCustomers(TenantId tenantId, CustomerId customerId, Set currentAssignedCustomers, Set newAssignedCustomers); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java index e1259a7e0e..d517b53303 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java @@ -26,6 +26,7 @@ import org.thingsboard.server.common.data.ShortCustomerInfo; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; @@ -38,8 +39,10 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import java.util.HashSet; import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; @Slf4j @Component @@ -127,14 +130,24 @@ public class DashboardEdgeProcessor extends BaseDashboardProcessor implements Da } @Override - protected Set filterNonExistingCustomers(TenantId tenantId, Set currentAssignedCustomers, Set newAssignedCustomers) { - newAssignedCustomers.addAll(currentAssignedCustomers); - return newAssignedCustomers; + protected Set filterNonExistingCustomers(TenantId tenantId, CustomerId edgeCustomerId, Set currentAssignedCustomers, Set newAssignedCustomers) { + boolean edgeCustomerPresentInNewAssignments = newAssignedCustomers.stream() + .map(ShortCustomerInfo::getCustomerId) + .anyMatch(edgeCustomerId::equals); + + if (edgeCustomerPresentInNewAssignments) { + Set result = new HashSet<>(newAssignedCustomers); + result.addAll(currentAssignedCustomers); + return result; + } else { + return currentAssignedCustomers.stream() + .filter(info -> !edgeCustomerId.equals(info.getCustomerId())) + .collect(Collectors.toSet()); + } } @Override public EdgeEventType getEdgeEventType() { return EdgeEventType.DASHBOARD; } - } From b953ebfca73a9ce72a2e5cda99201871cd8a09ba Mon Sep 17 00:00:00 2001 From: deaflynx Date: Tue, 2 Dec 2025 10:48:43 +0200 Subject: [PATCH 15/28] Fix TinyMCE editor style in mobile-app. --- .../home/pages/mobile/applications/mobile-app.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts index 141c274422..efae0d0b62 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts @@ -176,7 +176,7 @@ export class MobileAppComponent extends EntityComponent { context: ctx, showCloseButton: false, popoverContentStyle: {padding: '16px 24px'}, - isModal: false + isModal: true }); releaseNotesPanelPopover.tbComponentRef.instance.popover = releaseNotesPanelPopover; releaseNotesPanelPopover.tbComponentRef.instance.editorContentApplied.subscribe((releaseNotes) => { From 18307c6f001a46f98693ea22d8f1acef6a373c84 Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Tue, 2 Dec 2025 11:57:50 +0200 Subject: [PATCH 16/28] Update autocomplete options for AI models --- ui-ngx/src/app/shared/models/ai-model.models.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/models/ai-model.models.ts b/ui-ngx/src/app/shared/models/ai-model.models.ts index d3b70f9a74..410f7ad900 100644 --- a/ui-ngx/src/app/shared/models/ai-model.models.ts +++ b/ui-ngx/src/app/shared/models/ai-model.models.ts @@ -110,6 +110,7 @@ export const AiModelMap = new Map Date: Tue, 2 Dec 2025 12:45:14 +0200 Subject: [PATCH 17/28] UI: Latest design change --- .../lib/cards/api-usage-widget.component.scss | 11 +- ui-ngx/src/assets/dashboard/api_usage.json | 388 +++++++++--------- 2 files changed, 204 insertions(+), 195 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/cards/api-usage-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/cards/api-usage-widget.component.scss index fc1247c4f7..ed405fb246 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/cards/api-usage-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/cards/api-usage-widget.component.scss @@ -81,6 +81,12 @@ $warning-color: #FAA405; .mat-divider { --mat-divider-color: #{$tb-primary-color}; } + .api-item-content { + .api-item-title { + font-weight: 500; + color: $tb-primary-color; + } + } } .api-item-content { @@ -94,8 +100,9 @@ $warning-color: #FAA405; display: flex; flex: 1; font-size: 14px; - font-weight: 500; - color: $tb-primary-color; + line-height: 20px; + font-weight: 400; + color: rgba(0, 0, 0, 0.54); } .api-item-statistic { display: flex; diff --git a/ui-ngx/src/assets/dashboard/api_usage.json b/ui-ngx/src/assets/dashboard/api_usage.json index bf3fd220be..fa63f64001 100644 --- a/ui-ngx/src/assets/dashboard/api_usage.json +++ b/ui-ngx/src/assets/dashboard/api_usage.json @@ -105,7 +105,7 @@ } }, "title": "{i18n:api-usage.exceptions}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": { "fontSize": "16px", @@ -125,7 +125,8 @@ "pageSize": 1024, "noDataDisplayMessage": "", "configMode": "basic", - "borderRadius": "4px" + "borderRadius": "12px", + "titleColor": "rgba(0, 0, 0, 0.54)" }, "id": "a669cf86-e715-efa4-dd9a-b839abf499e9", "typeFullFqn": "system.cards.timeseries_table" @@ -499,7 +500,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -632,7 +633,7 @@ "tooltipLabelColor": "rgba(0, 0, 0, 0.76)" }, "title": "{i18n:api-usage.queue-stats}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -643,14 +644,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -675,7 +676,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -978,7 +979,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -1111,7 +1112,7 @@ "tooltipLabelColor": "rgba(0, 0, 0, 0.76)" }, "title": "{i18n:api-usage.processing-failures-and-timeouts}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -1122,14 +1123,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -1154,7 +1155,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -1331,7 +1332,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -1450,7 +1451,7 @@ "weight": "500", "lineHeight": "16px" }, - "legendValueColor": "rgba(0, 0, 0, 0.87)", + "legendValueColor": "rgba(0, 0, 0, 0.76)", "tooltipLabelFont": { "family": "Roboto", "size": 12, @@ -1461,10 +1462,11 @@ }, "tooltipLabelColor": "rgba(0, 0, 0, 0.76)", "tooltipHideZeroValues": null, - "padding": "12px" + "padding": "12px", + "tooltipStackedShowTotal": false }, "title": "{i18n:api-usage.transport-messages-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -1477,16 +1479,16 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", - "widgetStyle": {}, + "widgetStyle": null, "widgetCss": "", "pageSize": 1024, "units": "", @@ -1509,7 +1511,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -1685,7 +1687,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -1818,7 +1820,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.transport-data-point-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -1831,14 +1833,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -1863,7 +1865,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -2075,7 +2077,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -2208,15 +2210,20 @@ "padding": "12px" }, "title": "{i18n:api-usage.rule-engine-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, - "configMode": "basic", + "configMode": "advanced", "actions": { "headerButton": [ { "name": "{i18n:api-usage.view-statistics}", + "buttonType": "icon", "icon": "show_chart", + "buttonColor": "rgba(0, 0, 0, 0.54)", + "customButtonStyle": {}, + "useShowWidgetActionFunction": null, + "showWidgetActionFunction": "return true;", "type": "openDashboardState", "targetDashboardStateId": "rule_engine_statistics", "setEntityId": false, @@ -2232,14 +2239,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -2264,7 +2271,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -2476,7 +2483,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -2609,7 +2616,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.data-points-storage-days-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -2622,14 +2629,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -2654,7 +2661,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -2839,7 +2846,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -2972,7 +2979,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.transport-msg-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -2983,14 +2990,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -3015,7 +3022,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -3205,7 +3212,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -3338,7 +3345,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.transport-msg-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -3349,14 +3356,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -3381,7 +3388,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -3568,7 +3575,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -3701,7 +3708,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.transport-data-points-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -3712,14 +3719,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -3744,7 +3751,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -3985,7 +3992,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -4118,7 +4125,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.transport-data-points-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -4129,14 +4136,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -4161,7 +4168,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -4392,7 +4399,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -4525,7 +4532,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.rule-engine-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -4556,14 +4563,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -4588,7 +4595,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -4829,7 +4836,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -4962,7 +4969,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.rule-engine-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -4993,14 +5000,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -5025,7 +5032,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -5203,7 +5210,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -5336,7 +5343,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.javascript-function-executions-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -5347,14 +5354,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -5379,7 +5386,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -5566,7 +5573,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -5699,7 +5706,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.javascript-function-executions-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -5710,14 +5717,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -5742,7 +5749,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -5934,7 +5941,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -6067,7 +6074,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.javascript-function-executions-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -6078,14 +6085,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -6110,7 +6117,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -6288,7 +6295,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -6421,7 +6428,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.tbel-function-executions-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -6432,14 +6439,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -6464,7 +6471,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -6651,7 +6658,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -6784,7 +6791,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.tbel-function-executions-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -6795,14 +6802,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -6827,7 +6834,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -7019,7 +7026,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -7152,7 +7159,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.tbel-function-executions-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -7163,14 +7170,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -7195,7 +7202,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -7382,7 +7389,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -7515,7 +7522,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.data-points-storage-days-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -7526,14 +7533,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -7558,7 +7565,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -7755,7 +7762,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -7888,7 +7895,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.data-points-storage-days-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -7899,14 +7906,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -7931,7 +7938,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -8109,7 +8116,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -8242,7 +8249,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.alarms-created-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -8253,14 +8260,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -8285,7 +8292,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -8472,7 +8479,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -8605,7 +8612,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.alarms-created-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -8616,14 +8623,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -8648,7 +8655,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -8845,7 +8852,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -8978,7 +8985,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.alarms-created-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -8989,14 +8996,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -9021,7 +9028,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -9199,7 +9206,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -9332,7 +9339,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.emails-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -9343,14 +9350,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -9375,7 +9382,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -9562,7 +9569,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -9695,7 +9702,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.emails-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -9706,14 +9713,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -9738,7 +9745,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -9930,7 +9937,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -10063,7 +10070,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.emails-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -10074,14 +10081,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -10106,7 +10113,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -10284,7 +10291,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -10417,7 +10424,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.sms-messages-hourly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -10428,14 +10435,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -10460,7 +10467,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -10647,7 +10654,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -10780,7 +10787,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.sms-messages-daily-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -10791,14 +10798,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -10823,7 +10830,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -11015,7 +11022,7 @@ "weight": "400", "lineHeight": "16px" }, - "legendLabelColor": "rgba(0, 0, 0, 0.76)", + "legendLabelColor": "rgba(0, 0, 0, 0.54)", "legendConfig": { "direction": "column", "position": "bottom", @@ -11148,7 +11155,7 @@ "padding": "12px" }, "title": "{i18n:api-usage.sms-messages-monthly-activity}", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": true, "titleStyle": null, "configMode": "basic", @@ -11159,14 +11166,14 @@ "useDashboardTimewindow": false, "displayTimewindow": true, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": "Roboto", "weight": "500", "style": "normal", - "lineHeight": "24px" + "lineHeight": "20px" }, - "titleColor": "rgba(0, 0, 0, 0.87)", + "titleColor": "rgba(0, 0, 0, 0.54)", "titleTooltip": "", "widgetStyle": {}, "widgetCss": "", @@ -11191,7 +11198,7 @@ "displayTypePrefix": true }, "margin": "0px", - "borderRadius": "4px", + "borderRadius": "12px", "iconSize": "0px" }, "row": 0, @@ -11460,7 +11467,7 @@ "decimals": null, "showTitleIcon": false, "titleTooltip": "", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": false, "widgetStyle": {}, "widgetCss": ".tb-widget-header {\n height: 48px;\n align-items: center !important;\n padding: 5px 10px 0 10px;\n}", @@ -11490,14 +11497,15 @@ ] }, "titleFont": { - "size": 16, + "size": 14, "sizeUnit": "px", "family": null, "weight": "500", "style": null, - "lineHeight": "21px" + "lineHeight": "20px" }, - "borderRadius": "4px" + "borderRadius": "12px", + "titleColor": "rgba(0, 0, 0, 0.54)" }, "row": 0, "col": 0, @@ -12374,21 +12382,15 @@ }, "filters": {}, "timewindow": { - "hideAggregation": false, - "hideAggInterval": false, - "hideTimezone": false, "selectedTab": 0, "realtime": { "realtimeType": 0, - "timewindowMs": 86400000, - "quickInterval": "CURRENT_DAY", - "interval": 3600000 + "timewindowMs": 86400000 }, "aggregation": { "type": "NONE", "limit": 50000 - }, - "timezone": null + } }, "settings": { "stateControllerId": "entity", @@ -12404,7 +12406,7 @@ "dashboardLogoUrl": null, "hideToolbar": false, "showUpdateDashboardImage": false, - "dashboardCss": "" + "dashboardCss": ".tb-widget-actions {\n --mat-icon-color: rgba(0, 0, 0, 0.54);\n}" } }, "name": "Api Usage" From 2fe9646de8d6bfa0c851cb29dc6000441df199d0 Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 2 Dec 2025 15:21:10 +0200 Subject: [PATCH 18/28] Use org.thingsboard.langchain4j:1.8.0-TB instead of dev.langchain4j:1.1.0 --- application/pom.xml | 18 +++++++++--------- common/data/pom.xml | 2 +- pom.xml | 9 +++++++-- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index b415ee08a6..9c683cbd25 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -382,35 +382,35 @@ rocksdbjni - dev.langchain4j + org.thingsboard.langchain4j langchain4j-open-ai - dev.langchain4j + org.thingsboard.langchain4j langchain4j-azure-open-ai - dev.langchain4j + org.thingsboard.langchain4j langchain4j-google-ai-gemini - dev.langchain4j + org.thingsboard.langchain4j langchain4j-vertex-ai-gemini - dev.langchain4j + org.thingsboard.langchain4j langchain4j-mistral-ai - dev.langchain4j + org.thingsboard.langchain4j langchain4j-anthropic - dev.langchain4j + org.thingsboard.langchain4j langchain4j-bedrock - dev.langchain4j + org.thingsboard.langchain4j langchain4j-github-models @@ -420,7 +420,7 @@ - dev.langchain4j + org.thingsboard.langchain4j langchain4j-ollama diff --git a/common/data/pom.xml b/common/data/pom.xml index f27df3687f..d81566f521 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -113,7 +113,7 @@ compile - dev.langchain4j + org.thingsboard.langchain4j langchain4j-core diff --git a/pom.xml b/pom.xml index ce9d666615..16cd34ab88 100755 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ 4.0.2 1.7.5 3.8.0 - 1.1.0 + 1.8.0-TB 2.38.0 1.24 1.11.0 @@ -911,7 +911,7 @@ import - dev.langchain4j + org.thingsboard.langchain4j langchain4j-bom ${langchain4j.version} pom @@ -1908,6 +1908,11 @@ central https://repo1.maven.org/maven2/ + + thingsboard-public + ThingsBoard Public Repository + https://repo.thingsboard.io/artifactory/libs-release-public + spring-snapshots Spring Snapshots diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index 8f449a5e64..0ed5a8cdbf 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -99,7 +99,7 @@ provided - dev.langchain4j + org.thingsboard.langchain4j langchain4j diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 4fc5a55c5e..8edf9b0c8e 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -154,7 +154,7 @@ json-path - dev.langchain4j + org.thingsboard.langchain4j langchain4j From 6b04a39cb569e02bd3a5eeea199edc063536ae09 Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 2 Dec 2025 15:26:02 +0200 Subject: [PATCH 19/28] Rename maven repository for consistency with PE --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 16cd34ab88..b494be204e 100755 --- a/pom.xml +++ b/pom.xml @@ -1909,8 +1909,7 @@ https://repo1.maven.org/maven2/ - thingsboard-public - ThingsBoard Public Repository + thingsboard-repo https://repo.thingsboard.io/artifactory/libs-release-public From 0a8b261ccc72a0ac4753583637fd62c714c05339 Mon Sep 17 00:00:00 2001 From: ArtemDzhereleiko Date: Tue, 2 Dec 2025 16:09:09 +0200 Subject: [PATCH 20/28] UI: Fixed margin between widgets --- ui-ngx/src/assets/dashboard/api_usage.json | 69 +++++++++++----------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/ui-ngx/src/assets/dashboard/api_usage.json b/ui-ngx/src/assets/dashboard/api_usage.json index fa63f64001..02708d12fd 100644 --- a/ui-ngx/src/assets/dashboard/api_usage.json +++ b/ui-ngx/src/assets/dashboard/api_usage.json @@ -2213,7 +2213,7 @@ "dropShadow": false, "enableFullscreen": true, "titleStyle": null, - "configMode": "advanced", + "configMode": "basic", "actions": { "headerButton": [ { @@ -11470,7 +11470,7 @@ "dropShadow": false, "enableFullscreen": false, "widgetStyle": {}, - "widgetCss": ".tb-widget-header {\n height: 48px;\n align-items: center !important;\n padding: 5px 10px 0 10px;\n}", + "widgetCss": ".tb-widget-header {\n height: 48px;\n align-items: center !important;\n padding: 5px 10px 0 10px;\n}\n\n@media screen and (min-width: 960px) {\n .tb-widget {\n margin-right: 0px !important;\n }\n}", "titleStyle": {}, "pageSize": 1024, "noDataDisplayMessage": "", @@ -11505,7 +11505,8 @@ "lineHeight": "20px" }, "borderRadius": "12px", - "titleColor": "rgba(0, 0, 0, 0.54)" + "titleColor": "rgba(0, 0, 0, 0.54)", + "margin": "12px" }, "row": 0, "col": 0, @@ -11530,13 +11531,13 @@ "backgroundColor": "#eeeeee", "color": "rgba(0,0,0,0.870588)", "columns": 12, - "margin": 8, + "margin": 12, "backgroundSizeMode": "100%", "autoFillHeight": true, "backgroundImageUrl": null, "mobileAutoFillHeight": true, "mobileRowHeight": 100, - "outerMargin": true, + "outerMargin": false, "layoutType": "divider", "minColumns": 12, "viewFormat": "grid", @@ -11586,7 +11587,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -11636,7 +11637,7 @@ "backgroundColor": "#eeeeee", "color": "rgba(0,0,0,0.870588)", "columns": 24, - "margin": 8, + "margin": 12, "backgroundSizeMode": "100%", "autoFillHeight": true, "backgroundImageUrl": null, @@ -11670,8 +11671,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -11716,7 +11717,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -11748,8 +11749,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -11794,7 +11795,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -11826,8 +11827,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -11872,7 +11873,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -11904,8 +11905,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -11951,7 +11952,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -11983,8 +11984,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -12030,7 +12031,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -12062,8 +12063,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -12108,7 +12109,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -12140,8 +12141,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -12187,7 +12188,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -12219,8 +12220,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -12266,7 +12267,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, @@ -12298,8 +12299,8 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, - "outerMargin": true, + "margin": 12, + "outerMargin": false, "backgroundSizeMode": "100%", "minColumns": 12, "viewFormat": "grid", @@ -12345,7 +12346,7 @@ "layoutType": "divider", "backgroundColor": "#eeeeee", "columns": 12, - "margin": 8, + "margin": 12, "outerMargin": true, "backgroundSizeMode": "100%", "minColumns": 12, From de4cea7cffa5bd0d6f4690a8b7107bc6dcecda8c Mon Sep 17 00:00:00 2001 From: Ekaterina Chantsova Date: Tue, 2 Dec 2025 16:43:05 +0200 Subject: [PATCH 21/28] API Usage widget: hide aggregation option for keys --- .../lib/settings/cards/api-usage-widget-settings.component.ts | 1 + .../settings/common/key/data-key-config-dialog.component.html | 1 + .../settings/common/key/data-key-config-dialog.component.ts | 1 + .../lib/settings/common/key/data-key-config.component.html | 2 +- .../lib/settings/common/key/data-key-config.component.ts | 4 ++++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/api-usage-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/api-usage-widget-settings.component.ts index 3e909b0901..72cc725947 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/api-usage-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/api-usage-widget-settings.component.ts @@ -193,6 +193,7 @@ export class ApiUsageWidgetSettingsComponent extends WidgetSettingsComponent { hideDataKeyColor: true, hideDataKeyDecimals: true, hideDataKeyUnits: true, + hideDataKeyAggregation: true, widget: this.widget, dashboard: null, dataKeySettingsForm: null, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.html index de54ff86d4..3b753e3c39 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.html @@ -50,6 +50,7 @@ [hideDataKeyColor]="data.hideDataKeyColor" [hideDataKeyUnits]="data.hideDataKeyUnits" [hideDataKeyDecimals]="data.hideDataKeyDecimals" + [hideDataKeyAggregation]="data.hideDataKeyDecimals" [supportsUnitConversion]="data.supportsUnitConversion" formControlName="dataKey"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts index 829402a53f..e455a4aeb9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts @@ -56,6 +56,7 @@ export interface DataKeyConfigDialogData { hideDataKeyColor?: boolean; hideDataKeyUnits?: boolean; hideDataKeyDecimals?: boolean; + hideDataKeyAggregation?: boolean; supportsUnitConversion?: boolean } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html index 73c1865cc2..1d9e6dcf3d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html @@ -79,7 +79,7 @@ formControlName="funcBody"> - +
{{ 'datakey.aggregation' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts index c7b65bfc83..8d2e7b7fc5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts @@ -153,6 +153,10 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con @coerceBoolean() hideDataKeyDecimals = false; + @Input() + @coerceBoolean() + hideDataKeyAggregation = false; + @Input() @coerceBoolean() supportsUnitConversion = false; From 2e3db2b5e17b3eeb3e3f00cb3603b3ae6a2192c2 Mon Sep 17 00:00:00 2001 From: Nikita Mazurenko Date: Tue, 2 Dec 2025 16:47:49 +0200 Subject: [PATCH 22/28] Fix testSendDashboardToCloud test as the edge can only create/maintain dashboard assignments for its own customer --- .../server/edge/DashboardEdgeTest.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java index bbf3d17f0d..0730907c26 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java @@ -27,11 +27,15 @@ import org.thingsboard.server.common.data.DashboardInfo; import org.thingsboard.server.common.data.ShortCustomerInfo; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; +import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; @@ -182,6 +186,22 @@ public class DashboardEdgeTest extends AbstractEdgeTest { customer.setTitle("Edge Customer"); Customer savedCustomer = doPost("/api/customer", customer, Customer.class); + // assign edge to customer + edgeImitator.expectMessageAmount(2); + doPost("/api/customer/" + savedCustomer.getUuidId() + "/edge/" + edge.getUuidId(), Edge.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + Optional edgeConfigurationOpt = edgeImitator.findMessageByType(EdgeConfiguration.class); + Assert.assertTrue(edgeConfigurationOpt.isPresent()); + EdgeConfiguration edgeConfiguration = edgeConfigurationOpt.get(); + Assert.assertEquals(savedCustomer.getUuidId().getMostSignificantBits(), edgeConfiguration.getCustomerIdMSB()); + Assert.assertEquals(savedCustomer.getUuidId().getLeastSignificantBits(), edgeConfiguration.getCustomerIdLSB()); + Optional customerUpdateOpt = edgeImitator.findMessageByType(CustomerUpdateMsg.class); + Assert.assertTrue(customerUpdateOpt.isPresent()); + CustomerUpdateMsg customerUpdateMsg = customerUpdateOpt.get(); + Customer customerMsg = JacksonUtil.fromString(customerUpdateMsg.getEntity(), Customer.class, true); + Assert.assertEquals(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, customerUpdateMsg.getMsgType()); + Assert.assertEquals(savedCustomer, customerMsg); + Dashboard dashboard = buildDashboardForUplinkMsg(savedCustomer); // create dashboard on edge @@ -224,6 +244,23 @@ public class DashboardEdgeTest extends AbstractEdgeTest { foundDashboard = doGet("/api/dashboard/" + dashboard.getUuidId(), Dashboard.class); Assert.assertEquals(DASHBOARD_TITLE + " Updated", foundDashboard.getName()); + + // unassign edge from customer + edgeImitator.expectMessageAmount(2); + doDelete("/api/customer/edge/" + edge.getUuidId(), Edge.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + edgeConfigurationOpt = edgeImitator.findMessageByType(EdgeConfiguration.class); + Assert.assertTrue(edgeConfigurationOpt.isPresent()); + edgeConfiguration = edgeConfigurationOpt.get(); + Assert.assertEquals( + new CustomerId(EntityId.NULL_UUID), + new CustomerId(new UUID(edgeConfiguration.getCustomerIdMSB(), edgeConfiguration.getCustomerIdLSB()))); + customerUpdateOpt = edgeImitator.findMessageByType(CustomerUpdateMsg.class); + Assert.assertTrue(customerUpdateOpt.isPresent()); + customerUpdateMsg = customerUpdateOpt.get(); + Assert.assertEquals(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE, customerUpdateMsg.getMsgType()); + Assert.assertEquals(savedCustomer.getUuidId().getMostSignificantBits(), customerUpdateMsg.getIdMSB()); + Assert.assertEquals(savedCustomer.getUuidId().getLeastSignificantBits(), customerUpdateMsg.getIdLSB()); } @Test From 1ae979dc7035bbb61e95708489f382d419167597 Mon Sep 17 00:00:00 2001 From: Nikita Mazurenko Date: Tue, 2 Dec 2025 16:48:34 +0200 Subject: [PATCH 23/28] Fix testSendDashboardToCloud test as the edge can only create/maintain dashboard assignments for its own customer --- .../server/edge/DashboardEdgeTest.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java index 8150456efb..1c2aca46ec 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java @@ -27,11 +27,15 @@ import org.thingsboard.server.common.data.DashboardInfo; import org.thingsboard.server.common.data.ShortCustomerInfo; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; +import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; @@ -183,6 +187,22 @@ public class DashboardEdgeTest extends AbstractEdgeTest { customer.setTitle("Edge Customer"); Customer savedCustomer = doPost("/api/customer", customer, Customer.class); + // assign edge to customer + edgeImitator.expectMessageAmount(2); + doPost("/api/customer/" + savedCustomer.getUuidId() + "/edge/" + edge.getUuidId(), Edge.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + Optional edgeConfigurationOpt = edgeImitator.findMessageByType(EdgeConfiguration.class); + Assert.assertTrue(edgeConfigurationOpt.isPresent()); + EdgeConfiguration edgeConfiguration = edgeConfigurationOpt.get(); + Assert.assertEquals(savedCustomer.getUuidId().getMostSignificantBits(), edgeConfiguration.getCustomerIdMSB()); + Assert.assertEquals(savedCustomer.getUuidId().getLeastSignificantBits(), edgeConfiguration.getCustomerIdLSB()); + Optional customerUpdateOpt = edgeImitator.findMessageByType(CustomerUpdateMsg.class); + Assert.assertTrue(customerUpdateOpt.isPresent()); + CustomerUpdateMsg customerUpdateMsg = customerUpdateOpt.get(); + Customer customerMsg = JacksonUtil.fromString(customerUpdateMsg.getEntity(), Customer.class, true); + Assert.assertEquals(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, customerUpdateMsg.getMsgType()); + Assert.assertEquals(savedCustomer, customerMsg); + Dashboard dashboard = buildDashboardForUplinkMsg(savedCustomer); // create dashboard on edge @@ -225,6 +245,23 @@ public class DashboardEdgeTest extends AbstractEdgeTest { foundDashboard = doGet("/api/dashboard/" + dashboard.getUuidId(), Dashboard.class); Assert.assertEquals(DASHBOARD_TITLE + " Updated", foundDashboard.getName()); + + // unassign edge from customer + edgeImitator.expectMessageAmount(2); + doDelete("/api/customer/edge/" + edge.getUuidId(), Edge.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + edgeConfigurationOpt = edgeImitator.findMessageByType(EdgeConfiguration.class); + Assert.assertTrue(edgeConfigurationOpt.isPresent()); + edgeConfiguration = edgeConfigurationOpt.get(); + Assert.assertEquals( + new CustomerId(EntityId.NULL_UUID), + new CustomerId(new UUID(edgeConfiguration.getCustomerIdMSB(), edgeConfiguration.getCustomerIdLSB()))); + customerUpdateOpt = edgeImitator.findMessageByType(CustomerUpdateMsg.class); + Assert.assertTrue(customerUpdateOpt.isPresent()); + customerUpdateMsg = customerUpdateOpt.get(); + Assert.assertEquals(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE, customerUpdateMsg.getMsgType()); + Assert.assertEquals(savedCustomer.getUuidId().getMostSignificantBits(), customerUpdateMsg.getIdMSB()); + Assert.assertEquals(savedCustomer.getUuidId().getLeastSignificantBits(), customerUpdateMsg.getIdLSB()); } @Test From 448ba3b003e74aa105a48cc42966cf383ea343d3 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 3 Dec 2025 09:52:48 +0200 Subject: [PATCH 24/28] UI: Change default time window value --- ui-ngx/src/app/shared/models/time/time.models.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/models/time/time.models.ts b/ui-ngx/src/app/shared/models/time/time.models.ts index 1046feb2ca..d9cc9cb3a4 100644 --- a/ui-ngx/src/app/shared/models/time/time.models.ts +++ b/ui-ngx/src/app/shared/models/time/time.models.ts @@ -285,14 +285,14 @@ export const defaultTimewindow = (timeService: TimeService, isDashboard = false) selectedTab: TimewindowType.REALTIME, realtime: { realtimeType: RealtimeWindowType.LAST_INTERVAL, - interval: SECOND, - timewindowMs: isDashboard ? HOUR : MINUTE, + interval: MINUTE, + timewindowMs: HOUR, quickInterval: QuickTimeInterval.CURRENT_DAY, }, history: { historyType: HistoryWindowType.LAST_INTERVAL, - interval: SECOND, - timewindowMs: MINUTE, + interval: MINUTE, + timewindowMs: HOUR, fixedTimewindow: { startTimeMs: currentTime - DAY, endTimeMs: currentTime From 45ab28c1e328f2e33d0155881adc438639c9be51 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 3 Dec 2025 11:24:32 +0200 Subject: [PATCH 25/28] UI: Fixed CVE-2025-66031 --- ui-ngx/package.json | 3 ++- ui-ngx/yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui-ngx/package.json b/ui-ngx/package.json index ea7d7c80fb..b46ad2b69a 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -141,6 +141,7 @@ "rollup": "4.22.4", "@babel/core": "7.25.2", "esbuild": "0.23.0", - "jquery.terminal/coveralls-next/form-data": "4.0.4" + "jquery.terminal/coveralls-next/form-data": "4.0.4", + "node-forge": "1.3.3" } } diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index dc79929cc8..60b7dc601f 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -7493,10 +7493,10 @@ node-fetch@^3.3.2: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" -node-forge@^1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" - integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== +node-forge@1.3.3, node-forge@^1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.3.tgz#0ad80f6333b3a0045e827ac20b7f735f93716751" + integrity sha512-rLvcdSyRCyouf6jcOIPe/BgwG/d7hKjzMKOas33/pHEr6gbq18IK9zV7DiPvzsz0oBJPme6qr6H6kGZuI9/DZg== node-gyp-build-optional-packages@5.2.2: version "5.2.2" From 70c7fb0d9fd0f66a9bb0f87e25a47725bbe50b20 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 3 Dec 2025 11:43:26 +0200 Subject: [PATCH 26/28] UI: Fixed CVE-2025-64756 --- ui-ngx/package.json | 3 ++- ui-ngx/yarn.lock | 62 ++++++++------------------------------------- 2 files changed, 12 insertions(+), 53 deletions(-) diff --git a/ui-ngx/package.json b/ui-ngx/package.json index b46ad2b69a..0efab6e74d 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -142,6 +142,7 @@ "@babel/core": "7.25.2", "esbuild": "0.23.0", "jquery.terminal/coveralls-next/form-data": "4.0.4", - "node-forge": "1.3.3" + "node-forge": "1.3.3", + "glob": "10.5.0" } } diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index 60b7dc601f..16c14d0756 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -5604,11 +5604,6 @@ fs-minipass@^3.0.0: dependencies: minipass "^7.0.3" -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" @@ -5738,10 +5733,10 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@^10.2.2, glob@^10.3.10, glob@^10.3.3, glob@^10.3.7: - version "10.4.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" - integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== +glob@10.5.0, glob@^10.2.2, glob@^10.3.10, glob@^10.3.3, glob@^10.3.7, glob@^7.1.3: + version "10.5.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c" + integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg== dependencies: foreground-child "^3.1.0" jackspeak "^3.1.2" @@ -5750,18 +5745,6 @@ glob@^10.2.2, glob@^10.3.10, glob@^10.3.3, glob@^10.3.7: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -glob@^7.1.3: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - global-prefix@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-4.0.0.tgz#e9cc79aab9be1d03287e156a3f912dd0895463ed" @@ -6104,24 +6087,16 @@ indent-string@^4.0.0: resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - inherits@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== +inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + ini@4.1.3, ini@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/ini/-/ini-4.1.3.tgz#4c359675a6071a46985eb39b14e4a2c0ec98a795" @@ -7170,7 +7145,7 @@ minimatch@9.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -7711,13 +7686,6 @@ on-headers@~1.0.2: resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" @@ -7982,11 +7950,6 @@ path-exists@^5.0.0: resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -10079,11 +10042,6 @@ wrap-ansi@^9.0.0: string-width "^7.0.0" strip-ansi "^7.1.0" -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - ws@^8.16.0: version "8.18.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" From 0077c9e8b4d8e388d484cb251e67c0c0bbc4c1bc Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 3 Dec 2025 11:46:49 +0200 Subject: [PATCH 27/28] UI: Fixed CVE-2024-52798 --- ui-ngx/package.json | 3 ++- ui-ngx/yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 0efab6e74d..e993271fa8 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -143,6 +143,7 @@ "esbuild": "0.23.0", "jquery.terminal/coveralls-next/form-data": "4.0.4", "node-forge": "1.3.3", - "glob": "10.5.0" + "glob": "10.5.0", + "path-to-regexp": "0.1.12" } } diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index 16c14d0756..56dc0f47a5 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -7968,10 +7968,10 @@ path-scurry@^1.11.1: lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -path-to-regexp@0.1.10: - version "0.1.10" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b" - integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w== +path-to-regexp@0.1.10, path-to-regexp@0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" + integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== path-type@^5.0.0: version "5.0.0" From b4303dd051dc137b7e44f93113f85c2732ce7d79 Mon Sep 17 00:00:00 2001 From: ArtemDzhereleiko Date: Wed, 3 Dec 2025 12:02:55 +0200 Subject: [PATCH 28/28] UI: Fixed check connectivity request for ai models --- .../ai-model/check-connectivity-dialog.component.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/ai-model/check-connectivity-dialog.component.ts b/ui-ngx/src/app/modules/home/components/ai-model/check-connectivity-dialog.component.ts index dd2c27cb47..cd593b4291 100644 --- a/ui-ngx/src/app/modules/home/components/ai-model/check-connectivity-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai-model/check-connectivity-dialog.component.ts @@ -56,9 +56,7 @@ export class CheckConnectivityDialogComponent extends DialogComponent