Commit e9d7561fd87717e01edcf35fdbe5eaeabaad649f

Authored by Igor Kulikov
1 parent 457dfc48

Fixed ActorSystemContext initialization. UI: Fix rulenode missing original icon after copy/paste.

@@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; @@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
22 import com.google.protobuf.InvalidProtocolBufferException; 22 import com.google.protobuf.InvalidProtocolBufferException;
23 import lombok.extern.slf4j.Slf4j; 23 import lombok.extern.slf4j.Slf4j;
24 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.context.annotation.Lazy;
25 import org.springframework.stereotype.Service; 26 import org.springframework.stereotype.Service;
26 import org.thingsboard.rule.engine.api.RpcError; 27 import org.thingsboard.rule.engine.api.RpcError;
27 import org.thingsboard.rule.engine.api.msg.ToDeviceActorNotificationMsg; 28 import org.thingsboard.rule.engine.api.msg.ToDeviceActorNotificationMsg;
@@ -67,6 +68,7 @@ public class DefaultDeviceRpcService implements DeviceRpcService { @@ -67,6 +68,7 @@ public class DefaultDeviceRpcService implements DeviceRpcService {
67 private ClusterRpcService rpcService; 68 private ClusterRpcService rpcService;
68 69
69 @Autowired 70 @Autowired
  71 + @Lazy
70 private ActorService actorService; 72 private ActorService actorService;
71 73
72 private ScheduledExecutorService rpcCallBackExecutor; 74 private ScheduledExecutorService rpcCallBackExecutor;
@@ -28,6 +28,7 @@ import lombok.Getter; @@ -28,6 +28,7 @@ import lombok.Getter;
28 import lombok.extern.slf4j.Slf4j; 28 import lombok.extern.slf4j.Slf4j;
29 import org.springframework.beans.factory.annotation.Autowired; 29 import org.springframework.beans.factory.annotation.Autowired;
30 import org.springframework.beans.factory.annotation.Value; 30 import org.springframework.beans.factory.annotation.Value;
  31 +import org.springframework.context.annotation.Lazy;
31 import org.springframework.stereotype.Service; 32 import org.springframework.stereotype.Service;
32 import org.thingsboard.rule.engine.api.RpcError; 33 import org.thingsboard.rule.engine.api.RpcError;
33 import org.thingsboard.server.actors.service.ActorService; 34 import org.thingsboard.server.actors.service.ActorService;
@@ -102,6 +103,7 @@ public class DefaultDeviceStateService implements DeviceStateService { @@ -102,6 +103,7 @@ public class DefaultDeviceStateService implements DeviceStateService {
102 private AttributesService attributesService; 103 private AttributesService attributesService;
103 104
104 @Autowired 105 @Autowired
  106 + @Lazy
105 private ActorService actorService; 107 private ActorService actorService;
106 108
107 @Autowired 109 @Autowired
@@ -225,7 +225,7 @@ sql: @@ -225,7 +225,7 @@ sql:
225 # Actor system parameters 225 # Actor system parameters
226 actors: 226 actors:
227 tenant: 227 tenant:
228 - create_components_on_init: true 228 + create_components_on_init: "${ACTORS_TENANT_CREATE_COMPONENTS_ON_INIT:true}"
229 session: 229 session:
230 max_concurrent_sessions_per_device: "${ACTORS_MAX_CONCURRENT_SESSION_PER_DEVICE:1}" 230 max_concurrent_sessions_per_device: "${ACTORS_MAX_CONCURRENT_SESSION_PER_DEVICE:1}"
231 sync: 231 sync:
@@ -214,10 +214,19 @@ function ItemBuffer($q, bufferStore, types, utils, dashboardUtils, ruleChainServ @@ -214,10 +214,19 @@ function ItemBuffer($q, bufferStore, types, utils, dashboardUtils, ruleChainServ
214 var node = ruleNodes.nodes[i]; 214 var node = ruleNodes.nodes[i];
215 var component = ruleChainService.getRuleNodeComponentByClazz(node.componentClazz); 215 var component = ruleChainService.getRuleNodeComponentByClazz(node.componentClazz);
216 if (component) { 216 if (component) {
  217 + var icon = types.ruleNodeType[component.type].icon;
  218 + var iconUrl = null;
  219 + if (component.configurationDescriptor.nodeDefinition.icon) {
  220 + icon = component.configurationDescriptor.nodeDefinition.icon;
  221 + }
  222 + if (component.configurationDescriptor.nodeDefinition.iconUrl) {
  223 + iconUrl = component.configurationDescriptor.nodeDefinition.iconUrl;
  224 + }
217 delete node.componentClazz; 225 delete node.componentClazz;
218 node.component = component; 226 node.component = component;
219 node.nodeClass = types.ruleNodeType[component.type].nodeClass; 227 node.nodeClass = types.ruleNodeType[component.type].nodeClass;
220 - node.icon = types.ruleNodeType[component.type].icon; 228 + node.icon = icon;
  229 + node.iconUrl = iconUrl;
221 node.connectors = []; 230 node.connectors = [];
222 node.x = Math.round(node.x + deltaX); 231 node.x = Math.round(node.x + deltaX);
223 node.y = Math.round(node.y + deltaY); 232 node.y = Math.round(node.y + deltaY);