diff --git a/TEST_FAST.md b/TEST_FAST.md index fbea72db9c..11f8969fca 100644 --- a/TEST_FAST.md +++ b/TEST_FAST.md @@ -42,10 +42,12 @@ Use `-Dpkg.skip=true` to skip all packaging at once (equivalent to all four flag |----------------------------|-------------------------------------------|--------------------------------------------------------------| | `-Dpkg.skip=true` | All of the below (bootjar + deb + rpm + zip) | Yes | | `-Dpkg.skip.bootjar=true` | `spring-boot:repackage` (`*-boot.jar`) | Yes — tests use the regular `.jar`, not the fat boot jar | -| `-Dpkg.skip.deb=true` | Gradle `buildDeb` + Maven `attach-artifact` | Yes — MSA docker modules copy the DEB from `target/` directly | +| `-Dpkg.skip.deb=true` | Gradle `buildDeb` | Yes — MSA docker modules copy the DEB from `target/` directly | | `-Dpkg.skip.rpm=true` | Gradle `buildRpm` | Yes — no test depends on the RPM | | `-Dpkg.skip.zip=true` | `maven-assembly-plugin` Windows ZIP | Yes — no test depends on the ZIP | +`-Dskip.yarn=true` and `-Dskip.ui.build=true` imply `-Dpkg.skip=true`: packages built without the UI are incomplete. + ## Testcontainers compatibility with the Docker API workaround In case your tests failed to run testcontainers due to unsupported Docker API version diff --git a/application/pom.xml b/application/pom.xml index ee2b77b4e4..b6a59dba10 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard application 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 a479c0157c..0c9a4fa21d 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 @@ -24,6 +24,7 @@ import org.thingsboard.common.util.ThingsBoardExecutors; import org.thingsboard.rule.engine.api.AttributesSaveRequest; import org.thingsboard.rule.engine.api.TimeseriesSaveRequest; import org.thingsboard.server.cache.TbTransactionalCache; +import org.thingsboard.server.cache.TbCacheValueWrapper; import org.thingsboard.server.cluster.TbClusterService; import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.DataConstants; @@ -45,11 +46,13 @@ import org.thingsboard.server.common.msg.edge.EdgeHighPriorityMsg; import org.thingsboard.server.common.msg.edge.EdgeSessionMsg; import org.thingsboard.server.common.msg.edge.FromEdgeSyncResponse; import org.thingsboard.server.common.msg.edge.ToEdgeSyncRequest; +import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.gen.edge.v1.EdgeRpcServiceGrpc; import org.thingsboard.server.gen.edge.v1.RequestMsg; import org.thingsboard.server.gen.edge.v1.ResponseMsg; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.TopicService; +import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.kafka.KafkaAdmin; import org.thingsboard.server.queue.provider.TbCoreQueueFactory; import org.thingsboard.server.queue.util.AfterStartUp; @@ -139,6 +142,9 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i @Autowired private TbTransactionalCache edgeIdServiceIdCache; + @Autowired + private PartitionService partitionService; + @Autowired private TopicService topicService; @@ -369,10 +375,13 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i } finally { newEventLock.unlock(); } + // Claim ownership before writing the active state, not after: onEdgeDisconnect on the node this edge + // just left reads the cache to decide whether to clear the flag, so publishing the claim first keeps + // it from seeing a stale owner and clearing a state we have already set. + edgeIdServiceIdCache.put(edgeId, serviceInfoProvider.getServiceId()); save(tenantId, edgeId, ACTIVITY_STATE, true); long lastConnectTs = System.currentTimeMillis(); save(tenantId, edgeId, LAST_CONNECT_TIME, lastConnectTs); - edgeIdServiceIdCache.put(edgeId, serviceInfoProvider.getServiceId()); pushRuleEngineMessage(tenantId, edge, lastConnectTs, TbMsgType.CONNECT_EVENT); cancelScheduleEdgeEventsCheck(edgeId); edgeEventsMigrationProcessed.putIfAbsent(edgeId, Boolean.FALSE); @@ -520,8 +529,12 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i EdgeId edgeId = edge.getId(); log.info("[{}][{}] edge disconnected!", edgeId, sessionId); EdgeGrpcSession current = sessions.get(edgeId); - if (current != null && current.getSessionId().equals(sessionId)) { - EdgeGrpcSession toRemove = sessions.remove(edgeId); + // Claim-once removal: get() and remove() are not atomic, so a session that was replaced between the + // two would otherwise be dropped from the map, torn down and marked inactive by this stale callback + // even though it is the live one. Losing the race means this callback owns nothing - fall through to + // the stale-session branch below. + if (current != null && current.getSessionId().equals(sessionId) && sessions.remove(edgeId, current)) { + EdgeGrpcSession toRemove = current; final Lock newEventLock = sessionNewEventsLocks.computeIfAbsent(edgeId, id -> new ReentrantLock()); newEventLock.lock(); try { @@ -532,7 +545,13 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i destroySession(toRemove); sessionsById.remove(sessionId); TenantId tenantId = toRemove.getEdge().getTenantId(); - save(tenantId, edgeId, ACTIVITY_STATE, false); + // A newer session on another node may have already claimed this edge and set active=true. + // Clearing the flag here would leave the edge marked inactive while it is in fact connected, + // which silently drops every downlink event that is not queued for offline edges. + // When ownership is unknown (no cache entry) fall through and persist the inactive state. + if (!isOwnedByAnotherNode(edgeId)) { + save(tenantId, edgeId, ACTIVITY_STATE, false); + } long lastDisconnectTs = System.currentTimeMillis(); save(tenantId, edgeId, LAST_DISCONNECT_TIME, lastDisconnectTs); pushRuleEngineMessage(toRemove.getEdge().getTenantId(), edge, lastDisconnectTs, TbMsgType.DISCONNECT_EVENT); @@ -551,7 +570,37 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i log.debug("[{}] No session found by sessionId [{}] to destroy", edgeId, sessionId); } } - edgeIdServiceIdCache.evict(edgeId); + // Only evict if the cache still points at this node. If the edge already reconnected to another + // TB-Core node, that node has overwritten the entry and owns it - evicting here would wipe the live + // owner's claim and defeat the activity-state guard above. + if (isOwnedByThisNode(edgeId)) { + edgeIdServiceIdCache.evict(edgeId); + } + } + + // The edge's service-id cache entry points at a different node that is still a live TB-Core service. + // Two cases deliberately do NOT count as "owned by another node", so that the caller falls through and + // persists the inactive state: + // - no cache entry: ownership is unknown, not claimed by someone else; + // - entry naming a node that is no longer in the cluster: the edge sessions cache has no TTL by default + // (CACHE_SPECS_EDGE_SESSIONS_TTL=0) and is only ever evicted by the owning node, so a node that died + // without evicting would otherwise keep the edge marked active forever, with no reconciler to correct it. + private boolean isOwnedByAnotherNode(EdgeId edgeId) { + TbCacheValueWrapper wrapper = edgeIdServiceIdCache.get(edgeId); + if (wrapper == null) { + return false; + } + String ownerServiceId = wrapper.get(); + if (ownerServiceId == null || serviceInfoProvider.getServiceId().equals(ownerServiceId)) { + return false; + } + return partitionService.getAllServiceIds(ServiceType.TB_CORE).contains(ownerServiceId); + } + + // The edge's service-id cache entry still points at this node, i.e. this node is the recorded owner. + private boolean isOwnedByThisNode(EdgeId edgeId) { + TbCacheValueWrapper wrapper = edgeIdServiceIdCache.get(edgeId); + return wrapper != null && serviceInfoProvider.getServiceId().equals(wrapper.get()); } private void destroySession(EdgeGrpcSession session) { diff --git a/application/src/test/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcServiceTest.java b/application/src/test/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcServiceTest.java new file mode 100644 index 0000000000..7b71c65c9f --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcServiceTest.java @@ -0,0 +1,221 @@ +/** + * Copyright © 2016-2026 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.service.edge.rpc; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentMatcher; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.rule.engine.api.AttributesSaveRequest; +import org.thingsboard.server.cache.SimpleTbCacheValueWrapper; +import org.thingsboard.server.cache.TbTransactionalCache; +import org.thingsboard.server.cluster.TbClusterService; +import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.id.EdgeId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.msg.queue.ServiceType; +import org.thingsboard.server.queue.discovery.PartitionService; +import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; +import org.thingsboard.server.service.edge.EdgeContextComponent; +import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; + +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentMap; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.thingsboard.server.service.state.DefaultDeviceStateService.ACTIVITY_STATE; + +@ExtendWith(MockitoExtension.class) +public class EdgeGrpcServiceTest { + + private static final String THIS_NODE = "tb-core-1"; + private static final String OTHER_NODE = "tb-core-2"; + + @Mock + private TbTransactionalCache edgeIdServiceIdCache; + + @Mock + private TbServiceInfoProvider serviceInfoProvider; + + @Mock + private PartitionService partitionService; + + @Mock + private TelemetrySubscriptionService tsSubService; + + @Mock + private TbClusterService clusterService; + + @Mock + private EdgeContextComponent ctx; + + @InjectMocks + private EdgeGrpcService edgeGrpcService; + + private EdgeId edgeId; + private Edge edge; + + @BeforeEach + public void setUp() { + edgeId = new EdgeId(UUID.randomUUID()); + edge = new Edge(edgeId); + edge.setTenantId(TenantId.fromUUID(UUID.randomUUID())); + edge.setName("test-edge"); + } + + // --- activity-state write guard on disconnect --- + + @Test + public void givenEdgeReconnectedToAnotherNode_whenDisconnect_thenInactiveStateNotPersisted() { + // A newer session on another node already set active=true. This stale session's disconnect must not + // clobber it - otherwise the edge stays marked inactive while connected, and the server silently + // drops every assignment event for it. + UUID sessionId = UUID.randomUUID(); + sessions().put(edgeId, sessionFor(sessionId)); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(OTHER_NODE)); + when(partitionService.getAllServiceIds(ServiceType.TB_CORE)).thenReturn(Set.of(THIS_NODE, OTHER_NODE)); + + onEdgeDisconnect(sessionId); + + verify(tsSubService, never()).saveAttributes(argThat(inactiveStateWrite())); + } + + @Test + public void givenEdgeOwnedByThisNode_whenDisconnect_thenInactiveStateIsPersisted() { + UUID sessionId = UUID.randomUUID(); + sessions().put(edgeId, sessionFor(sessionId)); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(THIS_NODE)); + + onEdgeDisconnect(sessionId); + + verify(tsSubService, times(1)).saveAttributes(argThat(inactiveStateWrite())); + } + + @Test + public void givenNoCacheEntry_whenDisconnect_thenInactiveStateIsPersisted() { + // Ownership unknown (entry absent or expired): keep the pre-guard behaviour, otherwise a genuinely + // disconnected edge would stay marked active forever. + UUID sessionId = UUID.randomUUID(); + sessions().put(edgeId, sessionFor(sessionId)); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(null); + + onEdgeDisconnect(sessionId); + + verify(tsSubService, times(1)).saveAttributes(argThat(inactiveStateWrite())); + } + + @Test + public void givenOwnerNodeNoLongerInCluster_whenDisconnect_thenInactiveStateIsPersisted() { + // The recorded owner died without evicting its claim. The edge sessions cache has no TTL by default + // and only the owner ever evicts, so honouring a dead claim would leave the edge active forever. + UUID sessionId = UUID.randomUUID(); + sessions().put(edgeId, sessionFor(sessionId)); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(OTHER_NODE)); + when(partitionService.getAllServiceIds(ServiceType.TB_CORE)).thenReturn(Set.of(THIS_NODE)); + + onEdgeDisconnect(sessionId); + + verify(tsSubService, times(1)).saveAttributes(argThat(inactiveStateWrite())); + } + + @Test + public void givenSessionReplacedDuringDisconnect_whenStaleCallbackRuns_thenLiveSessionKept() { + // Reproduces the get()/remove() interleaving on a single node: onEdgeConnect swaps in a new session + // right after the stale callback's id check passes. The stale callback must not evict or tear down + // the live session, nor clear the activity state. + UUID staleSessionId = UUID.randomUUID(); + EdgeGrpcSession live = mock(EdgeGrpcSession.class); + EdgeGrpcSession stale = mock(EdgeGrpcSession.class); + when(stale.getSessionId()).thenAnswer(invocation -> { + sessions().put(edgeId, live); + return staleSessionId; + }); + sessions().put(edgeId, stale); + + onEdgeDisconnect(staleSessionId); + + assertThat(sessions().get(edgeId)).isSameAs(live); + verify(tsSubService, never()).saveAttributes(argThat(inactiveStateWrite())); + } + + // --- service-id cache eviction guard --- + + @Test + public void givenCacheOwnedByThisNode_whenDisconnect_thenEntryIsEvicted() { + UUID sessionId = UUID.randomUUID(); + sessions().put(edgeId, sessionFor(sessionId)); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(THIS_NODE)); + + onEdgeDisconnect(sessionId); + + verify(edgeIdServiceIdCache, times(1)).evict(edgeId); + } + + @Test + public void givenCacheOwnedByAnotherNode_whenDisconnect_thenEntryIsKept() { + // The edge already reconnected elsewhere: wiping the live owner's claim would defeat the + // activity-state guard for any later disconnect callback. + UUID sessionId = UUID.randomUUID(); + sessions().put(edgeId, sessionFor(sessionId)); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(OTHER_NODE)); + when(partitionService.getAllServiceIds(ServiceType.TB_CORE)).thenReturn(Set.of(THIS_NODE, OTHER_NODE)); + + onEdgeDisconnect(sessionId); + + verify(edgeIdServiceIdCache, never()).evict(edgeId); + } + + private void onEdgeDisconnect(UUID sessionId) { + ReflectionTestUtils.invokeMethod(edgeGrpcService, "onEdgeDisconnect", edge, sessionId); + } + + private EdgeGrpcSession sessionFor(UUID sessionId) { + EdgeGrpcSession session = mock(EdgeGrpcSession.class); + when(session.getSessionId()).thenReturn(sessionId); + when(session.getEdge()).thenReturn(edge); + return session; + } + + @SuppressWarnings("unchecked") + private ConcurrentMap sessions() { + return (ConcurrentMap) ReflectionTestUtils.getField(edgeGrpcService, "sessions"); + } + + private ArgumentMatcher inactiveStateWrite() { + return request -> request != null + && edgeId.equals(request.getEntityId()) + && request.getEntries().stream().anyMatch(entry -> + ACTIVITY_STATE.equals(entry.getKey()) + && Boolean.FALSE.equals(entry.getBooleanValue().orElse(null))); + } + +} diff --git a/common/actor/pom.xml b/common/actor/pom.xml index d715a42ac0..7e6bbe85ff 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/cache/pom.xml b/common/cache/pom.xml index a4c580b5cc..cbfe90440b 100644 --- a/common/cache/pom.xml +++ b/common/cache/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/cluster-api/pom.xml b/common/cluster-api/pom.xml index 7210e5810f..06552c67ae 100644 --- a/common/cluster-api/pom.xml +++ b/common/cluster-api/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/coap-server/pom.xml b/common/coap-server/pom.xml index 1a4d7b3856..74e2777c4e 100644 --- a/common/coap-server/pom.xml +++ b/common/coap-server/pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 225fc7230f..e91cb60df1 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index 2801f94153..5b9a8cc97c 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/discovery-api/pom.xml b/common/discovery-api/pom.xml index 451833d3fa..6b12557443 100644 --- a/common/discovery-api/pom.xml +++ b/common/discovery-api/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/edge-api/pom.xml b/common/edge-api/pom.xml index e8df15a854..51c96c6f37 100644 --- a/common/edge-api/pom.xml +++ b/common/edge-api/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/edge-api/src/main/proto/edge.proto b/common/edge-api/src/main/proto/edge.proto index c6ec7d43ee..d4495e609b 100644 --- a/common/edge-api/src/main/proto/edge.proto +++ b/common/edge-api/src/main/proto/edge.proto @@ -38,6 +38,7 @@ enum EdgeVersion { V_4_2_2_3 = 4223; V_4_2_2_4 = 4224; V_4_2_2_5 = 4225; + V_4_2_2_6 = 4226; V_LATEST = 99999; } diff --git a/common/edqs/pom.xml b/common/edqs/pom.xml index dd78323862..e61a27a8a8 100644 --- a/common/edqs/pom.xml +++ b/common/edqs/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index e1fe0a464c..417916e518 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index 0c3a5ba927..c533e1554a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard common diff --git a/common/proto/pom.xml b/common/proto/pom.xml index ed8713b624..7e835835fc 100644 --- a/common/proto/pom.xml +++ b/common/proto/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index 6a682ac6d9..4a340a96ec 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/script/pom.xml b/common/script/pom.xml index c6121aac6c..475151e2a9 100644 --- a/common/script/pom.xml +++ b/common/script/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/script/remote-js-client/pom.xml b/common/script/remote-js-client/pom.xml index d840887124..eac7a8561d 100644 --- a/common/script/remote-js-client/pom.xml +++ b/common/script/remote-js-client/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT script org.thingsboard.common.script diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index 9a8da08633..573f4b7ff4 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT script org.thingsboard.common.script diff --git a/common/stats/pom.xml b/common/stats/pom.xml index a3ae0e3723..771d46eaaf 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 890cc19a7b..6c05a559b8 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index 2ec04ce75f..cb27c74bfa 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index f9987105d5..271bd9dbc0 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 768e8c9b9e..da1fab79aa 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 1a6bbb9c97..949f5da4ba 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/snmp/pom.xml b/common/transport/snmp/pom.xml index 337e707a7e..b372d17b11 100644 --- a/common/transport/snmp/pom.xml +++ b/common/transport/snmp/pom.xml @@ -10,7 +10,7 @@ org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 7623b2af19..021ef4ee16 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.common - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index a75a5124b6..eaa4edfaf8 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml index 0d815961c1..17bf85d869 100644 --- a/common/version-control/pom.xml +++ b/common/version-control/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index 31101398f1..b67f222401 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard dao diff --git a/edqs/pom.xml b/edqs/pom.xml index 77c6cd7cb1..5efc955e57 100644 --- a/edqs/pom.xml +++ b/edqs/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard edqs diff --git a/monitoring/pom.xml b/monitoring/pom.xml index 06090c273b..26758d0170 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -10,7 +10,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index 66b22cbb35..270921ed5e 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -10,7 +10,7 @@ org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/edqs/pom.xml b/msa/edqs/pom.xml index 93ac979d13..6129e3b9ab 100644 --- a/msa/edqs/pom.xml +++ b/msa/edqs/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index e88f5da2eb..fbadae3920 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-js-executor", "private": true, - "version": "4.2.2.5", + "version": "4.2.2.6", "description": "ThingsBoard JavaScript Executor Microservice", "main": "server.ts", "bin": "server.js", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 5d28be03f8..82128b0e0e 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa @@ -30,6 +30,13 @@ package ${project.build.directory}/package/linux ${project.build.directory}/package/windows + + ${skip.yarn} pre-integration-test @@ -112,7 +119,7 @@ test - ${maven.test.skip} + ${yarn.test.skip} --mutex network run test @@ -206,6 +213,18 @@ + + skip-yarn-test + + + maven.test.skip + true + + + + true + + yarn-start diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index 1d7d16dec5..9566e83d71 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa diff --git a/msa/pom.xml b/msa/pom.xml index 3ffd8ed28b..0e169b1da8 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard msa @@ -55,10 +55,7 @@ - + skip-deb @@ -71,9 +68,9 @@ none - + skip-pkg @@ -86,6 +83,31 @@ none + + + skip-pkg-without-yarn + + + skip.yarn + true + + + + none + + + + skip-pkg-without-ui-build + + + skip.ui.build + true + + + + none + + black-box-tests diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index 6bb28e833f..b70e55c691 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index 41e8b5517d..26061eb43e 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index a7caa361bc..7e04147081 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.msa - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index 680b38df3e..ca0ee89f86 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.msa - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index 86d79c322f..6a052bb5de 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.msa - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 15a2f8a3d5..ef9b03e5d1 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard.msa - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 21be0a04b2..650a011502 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index 8e154ec5a6..4e3aec5733 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -10,7 +10,7 @@ org.thingsboard.msa transport - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT org.thingsboard.msa.transport diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index e8143ac7c1..7176dc6f8f 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index ed5aa3662a..ebe5da9d4c 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -10,7 +10,7 @@ org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index 4b1e489783..e0099bbdc5 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-web-ui", "private": true, - "version": "4.2.2.5", + "version": "4.2.2.6", "description": "ThingsBoard Web UI Microservice", "main": "server.ts", "bin": "server.js", diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index b2d148d5b2..311b4b976b 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT msa org.thingsboard.msa @@ -60,6 +60,9 @@ target ${basedir} + + ${skip.ui.build} diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index 18bab00e7d..15e2315aeb 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -8,11 +8,11 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard netty-mqtt - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index 6ecad4cd2c..a1136afd0f 100755 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT pom Thingsboard @@ -28,20 +28,27 @@ 17 17 ${basedir} + + ${skip.yarn} none none false - + false @@ -50,11 +57,6 @@ module depends on the ZIP artifact, so this flag can be toggled freely without breaking downstream modules. --> false - - ${pkg.package.phase} thingsboard ${project.name} /var/log/${pkg.name} @@ -215,31 +217,46 @@ - + - skip-deb + skip-pkg - pkg.skip.deb + pkg.skip true - none + true + true + true + true - + - skip-pkg + skip-pkg-without-yarn - pkg.skip + skip.yarn + true + + + + true + true + true + true + + + + skip-pkg-without-ui-build + + + skip.ui.build true @@ -248,7 +265,6 @@ true true true - none @@ -538,21 +554,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - **/logback.xml - - - - ${pkg.implementationTitle} - ${project.version} - - - - org.springframework.boot spring-boot-maven-plugin @@ -565,6 +566,8 @@ ${pkg.skip.bootjar} ${pkg.mainClass} boot + + false ZIP true true @@ -579,7 +582,6 @@ repackage - build-info @@ -641,28 +643,9 @@ ${pkg.skip.zip} - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-deb - ${pkg.deb.phase} - - attach-artifact - - - - - ${project.build.directory}/${pkg.name}.deb - deb - deb - - + + false @@ -718,6 +701,18 @@ org.apache.maven.plugins maven-jar-plugin ${jar-plugin.version} + + + + **/logback.xml + + + + ${pkg.implementationTitle} + ${project.version} + + + org.apache.maven.plugins @@ -728,6 +723,20 @@ org.springframework.boot spring-boot-maven-plugin ${spring-boot.version} + + + + build-info + + build-info + + + + false + + + org.thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index d897b1fe27..7477e9bc37 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index b6a3a43513..644d72831b 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index fab00e3cb8..faf8b26dac 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 615767fe63..40e1455aa3 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index fe46969c90..4025cf2b26 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index d104dcf2b9..4cf89f99e0 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index f7d7d2b472..397c242314 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index ca1ec8c822..b87170e421 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index c26fb8b997..10df97f0b2 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index 66e962b674..cb177df37f 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard transport diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index 8375236ee4..77e05aa684 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -10,7 +10,7 @@ org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT transport diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 5358528a6b..c830027a3c 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -1,6 +1,6 @@ { "name": "thingsboard", - "version": "4.2.2.5", + "version": "4.2.2.6", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --configuration development --host 0.0.0.0 --open", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index 164ce0d056..c577e62fdc 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -9,7 +9,7 @@ 4.0.0 org.thingsboard - 4.2.2.5-SNAPSHOT + 4.2.2.6-SNAPSHOT thingsboard org.thingsboard @@ -37,6 +37,9 @@ target ${basedir} + + ${skip.ui.build} @@ -71,6 +74,14 @@ + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts index 676ad706b1..7f991316ee 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts @@ -95,6 +95,12 @@ export class TbDeviceInstallDialogComponent extends DialogComponent = {}; @@ -357,7 +363,7 @@ export class TbDeviceInstallDialogComponent extends DialogComponent(); + /** + * Fired whenever an install, update or delete changed what this tenant has installed, so a host + * page showing its own installed-items counter can refresh it instead of waiting for a reload. + */ + @Output() installedItemsChanged = new EventEmitter(); @Input() set activeType(value: ItemType) { if (value && value !== this._activeType) { const wasInit = !!this._activeType; @@ -627,7 +632,11 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy }); } - private reloadInstalledItems(): void { + /** + * Re-reads what is installed for the active type and announces the change. Public so a host page + * that opens the item detail dialog itself can refresh this grid through the same path. + */ + reloadInstalledItems(): void { const config = {ignoreLoading: true}; const pageLink = new PageLink(10000, 0); if (this.activeType === ItemType.WIDGET) { @@ -643,6 +652,7 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy this.installedItemCounts = counts; }); } + this.installedItemsChanged.emit(); } private loadFilterInfo(): void { diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-markdown.component.scss b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-markdown.component.scss index 2a946348ad..c25c67e729 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-markdown.component.scss +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-markdown.component.scss @@ -3,6 +3,10 @@ $text-color: rgba(0,0,0,0.76); $link-color: #2a7dec; $copy-button-color: #2a7dec; +// Geometry of the copy icon chip, shared by the chip itself and by the space table +// cells reserve for it, so the two cannot drift apart. +$copy-icon-width: 38px; +$copy-icon-offset: 3px; $code-block-border-color: rgba(42, 125, 236, .2); $code-default-color: #212529; @@ -169,10 +173,10 @@ $gallery-border-hover-color: #2a7dec; div { background-color: #fff; position: absolute; - width: 38px; + width: $copy-icon-width; height: 28px; - top: 3px; - right: 3px; + top: $copy-icon-offset; + right: $copy-icon-offset; padding: 8px 10px 0; img { @@ -204,9 +208,30 @@ $gallery-border-hover-color: #2a7dec; } th, td { + // Long unbreakable tokens (logins, e-mails, passwords) must never overflow their + // own column. `anywhere` also drops the cell min-content width down to a single + // character, so auto layout can always squeeze the table into the available + // width instead of overflowing (and getting clipped by `overflow: hidden`). + overflow-wrap: break-word; // fallback for engines without `anywhere` + overflow-wrap: anywhere; + + // Text is not the only thing that can outgrow a column: a preformatted block keeps + // its whole line as min-content width, which auto layout cannot shrink, so the table + // would push past its container and get cut off by a host that hides horizontal + // overflow (iot-hub-item-detail-dialog's .dlg-body). Wrap it inside the cell instead. + // Prism sets `white-space: pre` on both the block and the code inside it, so both + // have to be relaxed for the cell to shrink. + pre, pre > code { + white-space: pre-wrap; + } + div.code-wrapper { display: inline-block; width: 100%; + // Reserve room for the absolutely positioned copy icon, plus the same gap on its + // far side, so the cell text does not run underneath it and the reservation + // follows the chip if its geometry ever changes. + padding-right: $copy-icon-width + 2 * $copy-icon-offset; button.clipboard-btn { top: -6px; @@ -275,11 +300,10 @@ $gallery-border-hover-color: #2a7dec; margin-top: 20px; margin-bottom: 20px; overflow: hidden; - table-layout: fixed; - - &.auto { - table-layout: auto; - } + // Columns are sized to their content: with fixed layout every column got the + // same width, so cells with long values (e-mails, logins, tokens) had to wrap + // mid-word while short columns kept a lot of unused space. + table-layout: auto; > thead { background-color: $table-header-background-color; diff --git a/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.html b/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.html index 59a42eab29..5787b5ecf0 100644 --- a/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.html +++ b/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.html @@ -35,7 +35,8 @@ + [hideTabs]="true" + (installedItemsChanged)="loadInstalledCount()"> diff --git a/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts b/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts index b89448be3c..07beff5559 100644 --- a/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts +++ b/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts @@ -1,12 +1,13 @@ // SPDX-FileCopyrightText: Copyright The Thingsboard Authors // SPDX-License-Identifier: Apache-2.0 -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { map } from 'rxjs/operators'; import { Observable } from 'rxjs'; import { ItemType } from '@shared/models/iot-hub/iot-hub-item.models'; import { IotHubApiService } from '@core/http/iot-hub-api.service'; import { IotHubActionsService } from '@home/components/iot-hub/iot-hub-actions.service'; +import { TbIotHubBrowseComponent } from '@home/components/iot-hub/iot-hub-browse.component'; import { IotHubInstalledItem } from '@shared/models/iot-hub/iot-hub-installed-item.models'; import { MpItemVersionView } from '@shared/models/iot-hub/iot-hub-version.models'; import { PageLink } from '@shared/models/page/page-link'; @@ -83,6 +84,8 @@ export class TbIotHubItemsPageComponent implements OnInit { config: ItemTypePageConfig; installedItemsCount = 0; + @ViewChild(TbIotHubBrowseComponent) private browse: TbIotHubBrowseComponent; + constructor( private route: ActivatedRoute, private router: Router, @@ -109,7 +112,7 @@ export class TbIotHubItemsPageComponent implements OnInit { window.open(this.iotHubApiService.baseUrl + '/signup', '_blank'); } - private loadInstalledCount(): void { + loadInstalledCount(): void { this.iotHubApiService.getInstalledItemsCount(this.config.type, { ignoreLoading: true }).subscribe(count => { this.installedItemsCount = count; }); @@ -147,7 +150,13 @@ export class TbIotHubItemsPageComponent implements OnInit { 'default', true, openItem.preview - ).subscribe(); + ).subscribe(result => { + // The deep-linked dialog is opened by this page rather than by the grid, so its outcome + // has to be fed back in by hand — the grid then refreshes and announces the new count. + if (result === 'installed' || result === 'updated' || result === 'deleted') { + this.browse?.reloadInstalledItems(); + } + }); }); }