Browse Source

Naming conventions update

pull/3811/head
Volodymyr Babak 6 years ago
parent
commit
c5d93d17f4
  1. 2
      application/src/main/java/org/thingsboard/server/controller/EdgeController.java
  2. 25
      application/src/main/java/org/thingsboard/server/controller/RuleChainController.java
  3. 5
      application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java
  4. 2
      application/src/main/java/org/thingsboard/server/service/install/update/DefaultDataUpdateService.java
  5. 10
      common/dao-api/src/main/java/org/thingsboard/server/dao/rule/RuleChainService.java
  6. 2
      common/data/src/main/java/org/thingsboard/server/common/data/relation/RelationTypeGroup.java
  7. 2
      dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java
  8. 38
      dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java
  9. 4
      dao/src/main/java/org/thingsboard/server/dao/rule/RuleChainDao.java
  10. 6
      dao/src/main/java/org/thingsboard/server/dao/sql/rule/JpaRuleChainDao.java
  11. 24
      dao/src/test/java/org/thingsboard/server/dao/service/BaseRuleChainServiceTest.java
  12. 10
      rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java
  13. 2
      ui-ngx/src/app/core/http/entity.service.ts
  14. 16
      ui-ngx/src/app/core/http/rule-chain.service.ts
  15. 2
      ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.ts
  16. 3
      ui-ngx/src/app/modules/home/components/entity/entity.component.ts
  17. 9
      ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts
  18. 9
      ui-ngx/src/app/modules/home/pages/dashboard/dashboard-page.component.ts
  19. 2
      ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts
  20. 18
      ui-ngx/src/app/modules/home/pages/edge/edge.component.html
  21. 24
      ui-ngx/src/app/modules/home/pages/edge/edge.component.ts
  22. 30
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html
  23. 22
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.ts
  24. 120
      ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts
  25. 2
      ui-ngx/src/app/shared/models/constants.ts
  26. 68
      ui-ngx/src/app/shared/models/edge.models.ts
  27. 14
      ui-ngx/src/assets/locale/locale.constant-de_DE.json
  28. 92
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  29. 14
      ui-ngx/src/assets/locale/locale.constant-es_ES.json
  30. 14
      ui-ngx/src/assets/locale/locale.constant-fr_FR.json

2
application/src/main/java/org/thingsboard/server/controller/EdgeController.java

@ -108,7 +108,7 @@ public class EdgeController extends BaseController {
RuleChain defaultRootEdgeRuleChain = null; RuleChain defaultRootEdgeRuleChain = null;
if (created) { if (created) {
defaultRootEdgeRuleChain = ruleChainService.getDefaultRootEdgeRuleChain(tenantId); defaultRootEdgeRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenantId);
if (defaultRootEdgeRuleChain == null) { if (defaultRootEdgeRuleChain == null) {
throw new DataValidationException("Root edge rule chain is not available!"); throw new DataValidationException("Root edge rule chain is not available!");
} }

25
application/src/main/java/org/thingsboard/server/controller/RuleChainController.java

@ -50,7 +50,6 @@ import org.thingsboard.server.common.data.id.RuleNodeId;
import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageData;
import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.page.PageLink;
import org.thingsboard.server.common.data.page.TimePageLink;
import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent;
import org.thingsboard.server.common.data.rule.DefaultRuleChainCreateRequest; import org.thingsboard.server.common.data.rule.DefaultRuleChainCreateRequest;
import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChain;
@ -556,14 +555,14 @@ public class RuleChainController extends BaseController {
} }
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/ruleChain/{ruleChainId}/defaultRootEdge", method = RequestMethod.POST) @RequestMapping(value = "/ruleChain/{ruleChainId}/edgeTemplateRoot", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public RuleChain setDefaultRootEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { public RuleChain setEdgeTemplateRootRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException {
checkParameter(RULE_CHAIN_ID, strRuleChainId); checkParameter(RULE_CHAIN_ID, strRuleChainId);
try { try {
RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId));
RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE);
ruleChainService.setDefaultRootEdgeRuleChain(getTenantId(), ruleChainId); ruleChainService.setEdgeTemplateRootRuleChain(getTenantId(), ruleChainId);
return ruleChain; return ruleChain;
} catch (Exception e) { } catch (Exception e) {
logEntityAction(emptyId(EntityType.RULE_CHAIN), logEntityAction(emptyId(EntityType.RULE_CHAIN),
@ -575,14 +574,14 @@ public class RuleChainController extends BaseController {
} }
@PreAuthorize("hasAuthority('TENANT_ADMIN')") @PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/ruleChain/{ruleChainId}/defaultEdge", method = RequestMethod.POST) @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public RuleChain addDefaultEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { public RuleChain setAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException {
checkParameter(RULE_CHAIN_ID, strRuleChainId); checkParameter(RULE_CHAIN_ID, strRuleChainId);
try { try {
RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId));
RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE);
ruleChainService.addDefaultEdgeRuleChain(getTenantId(), ruleChainId); ruleChainService.setAutoAssignToEdgeRuleChain(getTenantId(), ruleChainId);
return ruleChain; return ruleChain;
} catch (Exception e) { } catch (Exception e) {
logEntityAction(emptyId(EntityType.RULE_CHAIN), logEntityAction(emptyId(EntityType.RULE_CHAIN),
@ -594,14 +593,14 @@ public class RuleChainController extends BaseController {
} }
@PreAuthorize("hasAuthority('TENANT_ADMIN')") @PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/ruleChain/{ruleChainId}/defaultEdge", method = RequestMethod.DELETE) @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.DELETE)
@ResponseBody @ResponseBody
public RuleChain removeDefaultEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { public RuleChain unsetAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException {
checkParameter(RULE_CHAIN_ID, strRuleChainId); checkParameter(RULE_CHAIN_ID, strRuleChainId);
try { try {
RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId));
RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE);
ruleChainService.removeDefaultEdgeRuleChain(getTenantId(), ruleChainId); ruleChainService.unsetAutoAssignToEdgeRuleChain(getTenantId(), ruleChainId);
return ruleChain; return ruleChain;
} catch (Exception e) { } catch (Exception e) {
logEntityAction(emptyId(EntityType.RULE_CHAIN), logEntityAction(emptyId(EntityType.RULE_CHAIN),
@ -613,12 +612,12 @@ public class RuleChainController extends BaseController {
} }
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/ruleChain/defaultEdgeRuleChains", method = RequestMethod.GET) @RequestMapping(value = "/ruleChain/autoAssignToEdgeRuleChains", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public List<RuleChain> getDefaultEdgeRuleChains() throws ThingsboardException { public List<RuleChain> getAutoAssignToEdgeRuleChains() throws ThingsboardException {
try { try {
TenantId tenantId = getCurrentUser().getTenantId(); TenantId tenantId = getCurrentUser().getTenantId();
return checkNotNull(ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId)).get(); return checkNotNull(ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId)).get();
} catch (Exception e) { } catch (Exception e) {
throw handleException(e); throw handleException(e);
} }

5
application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java

@ -165,10 +165,11 @@ public final class EdgeGrpcSession implements Closeable {
.build()); .build());
if (ConnectResponseCode.ACCEPTED != responseMsg.getResponseCode()) { if (ConnectResponseCode.ACCEPTED != responseMsg.getResponseCode()) {
outputStream.onError(new RuntimeException(responseMsg.getErrorMsg())); outputStream.onError(new RuntimeException(responseMsg.getErrorMsg()));
} else {
connected = true;
} }
} }
if (!connected && requestMsg.getMsgType().equals(RequestMsgType.SYNC_REQUEST_RPC_MESSAGE)) { if (connected && requestMsg.getMsgType().equals(RequestMsgType.SYNC_REQUEST_RPC_MESSAGE)) {
connected = true;
ctx.getSyncEdgeService().sync(edge); ctx.getSyncEdgeService().sync(edge);
} }
if (connected) { if (connected) {

2
application/src/main/java/org/thingsboard/server/service/install/update/DefaultDataUpdateService.java

@ -128,7 +128,7 @@ public class DefaultDataUpdateService implements DataUpdateService {
@Override @Override
protected void updateEntity(Tenant tenant) { protected void updateEntity(Tenant tenant) {
try { try {
RuleChain defaultEdgeRuleChain = ruleChainService.getDefaultRootEdgeRuleChain(tenant.getId()); RuleChain defaultEdgeRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenant.getId());
if (defaultEdgeRuleChain == null) { if (defaultEdgeRuleChain == null) {
installScripts.createDefaultEdgeRuleChains(tenant.getId()); installScripts.createDefaultEdgeRuleChains(tenant.getId());
} }

10
common/dao-api/src/main/java/org/thingsboard/server/dao/rule/RuleChainService.java

@ -79,14 +79,14 @@ public interface RuleChainService {
PageData<RuleChain> findRuleChainsByTenantIdAndEdgeId(TenantId tenantId, EdgeId edgeId, PageLink pageLink); PageData<RuleChain> findRuleChainsByTenantIdAndEdgeId(TenantId tenantId, EdgeId edgeId, PageLink pageLink);
RuleChain getDefaultRootEdgeRuleChain(TenantId tenantId); RuleChain getEdgeTemplateRootRuleChain(TenantId tenantId);
boolean setDefaultRootEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); boolean setEdgeTemplateRootRuleChain(TenantId tenantId, RuleChainId ruleChainId);
boolean addDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); boolean setAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId);
boolean removeDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); boolean unsetAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId);
ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(TenantId tenantId); ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(TenantId tenantId);
} }

2
common/data/src/main/java/org/thingsboard/server/common/data/relation/RelationTypeGroup.java

@ -23,6 +23,6 @@ public enum RelationTypeGroup {
RULE_CHAIN, RULE_CHAIN,
RULE_NODE, RULE_NODE,
EDGE, EDGE,
EDGE_DEFAULT_RULE_CHAIN EDGE_AUTO_ASSIGN_RULE_CHAIN
} }

2
dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java

@ -373,7 +373,7 @@ public class EdgeServiceImpl extends AbstractEntityService implements EdgeServic
@Override @Override
public void assignDefaultRuleChainsToEdge(TenantId tenantId, EdgeId edgeId) { public void assignDefaultRuleChainsToEdge(TenantId tenantId, EdgeId edgeId) {
log.trace("Executing assignDefaultRuleChainsToEdge, tenantId [{}], edgeId [{}]", tenantId, edgeId); log.trace("Executing assignDefaultRuleChainsToEdge, tenantId [{}], edgeId [{}]", tenantId, edgeId);
ListenableFuture<List<RuleChain>> future = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId); ListenableFuture<List<RuleChain>> future = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId);
Futures.addCallback(future, new FutureCallback<List<RuleChain>>() { Futures.addCallback(future, new FutureCallback<List<RuleChain>>() {
@Override @Override
public void onSuccess(List<RuleChain> ruleChains) { public void onSuccess(List<RuleChain> ruleChains) {

38
dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java

@ -624,21 +624,21 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
} }
@Override @Override
public RuleChain getDefaultRootEdgeRuleChain(TenantId tenantId) { public RuleChain getEdgeTemplateRootRuleChain(TenantId tenantId) {
return getRootRuleChainByType(tenantId, RuleChainType.EDGE); return getRootRuleChainByType(tenantId, RuleChainType.EDGE);
} }
@Override @Override
public boolean setDefaultRootEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { public boolean setEdgeTemplateRootRuleChain(TenantId tenantId, RuleChainId ruleChainId) {
RuleChain ruleChain = ruleChainDao.findById(tenantId, ruleChainId.getId()); RuleChain ruleChain = ruleChainDao.findById(tenantId, ruleChainId.getId());
RuleChain previousDefaultRootEdgeRuleChain = getDefaultRootEdgeRuleChain(ruleChain.getTenantId()); RuleChain previousEdgeTemplateRootRuleChain = getEdgeTemplateRootRuleChain(ruleChain.getTenantId());
if (previousDefaultRootEdgeRuleChain == null || !previousDefaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) { if (previousEdgeTemplateRootRuleChain == null || !previousEdgeTemplateRootRuleChain.getId().equals(ruleChain.getId())) {
try { try {
if (previousDefaultRootEdgeRuleChain != null) { if (previousEdgeTemplateRootRuleChain != null) {
deleteRelation(tenantId, new EntityRelation(previousDefaultRootEdgeRuleChain.getTenantId(), previousDefaultRootEdgeRuleChain.getId(), deleteRelation(tenantId, new EntityRelation(previousEdgeTemplateRootRuleChain.getTenantId(), previousEdgeTemplateRootRuleChain.getId(),
EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN)); EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
previousDefaultRootEdgeRuleChain.setRoot(false); previousEdgeTemplateRootRuleChain.setRoot(false);
ruleChainDao.save(tenantId, previousDefaultRootEdgeRuleChain); ruleChainDao.save(tenantId, previousEdgeTemplateRootRuleChain);
} }
createRelation(tenantId, new EntityRelation(ruleChain.getTenantId(), ruleChain.getId(), createRelation(tenantId, new EntityRelation(ruleChain.getTenantId(), ruleChain.getId(),
EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN)); EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN));
@ -646,7 +646,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
ruleChainDao.save(tenantId, ruleChain); ruleChainDao.save(tenantId, ruleChain);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.warn("Failed to set default root edge rule chain, ruleChainId: [{}]", ruleChainId, e); log.warn("Failed to set edge template root rule chain, ruleChainId: [{}]", ruleChainId, e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -654,34 +654,34 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
} }
@Override @Override
public boolean addDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { public boolean setAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) {
try { try {
createRelation(tenantId, new EntityRelation(tenantId, ruleChainId, createRelation(tenantId, new EntityRelation(tenantId, ruleChainId,
EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN)); EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN));
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.warn("Failed to add default edge rule chain, ruleChainId: [{}]", ruleChainId, e); log.warn("Failed to set auto assign to edge rule chain, ruleChainId: [{}]", ruleChainId, e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@Override @Override
public boolean removeDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { public boolean unsetAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) {
try { try {
deleteRelation(tenantId, new EntityRelation(tenantId, ruleChainId, deleteRelation(tenantId, new EntityRelation(tenantId, ruleChainId,
EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN)); EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN));
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.warn("Failed to remove default edge rule chain, ruleChainId: [{}]", ruleChainId, e); log.warn("Failed to unset auto assign to edge rule chain, ruleChainId: [{}]", ruleChainId, e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@Override @Override
public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(TenantId tenantId) { public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(TenantId tenantId) {
log.trace("Executing findDefaultEdgeRuleChainsByTenantId, tenantId [{}]", tenantId); log.trace("Executing findAutoAssignToEdgeRuleChainsByTenantId, tenantId [{}]", tenantId);
validateId(tenantId, INCORRECT_TENANT_ID + tenantId); validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
return ruleChainDao.findDefaultEdgeRuleChainsByTenantId(tenantId.getId()); return ruleChainDao.findAutoAssignToEdgeRuleChainsByTenantId(tenantId.getId());
} }
@ -749,7 +749,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
} }
} }
if (ruleChain.isRoot() && RuleChainType.EDGE.equals(ruleChain.getType())) { if (ruleChain.isRoot() && RuleChainType.EDGE.equals(ruleChain.getType())) {
RuleChain defaultRootEdgeRuleChain = getDefaultRootEdgeRuleChain(ruleChain.getTenantId()); RuleChain defaultRootEdgeRuleChain = getEdgeTemplateRootRuleChain(ruleChain.getTenantId());
if (defaultRootEdgeRuleChain != null && !defaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) { if (defaultRootEdgeRuleChain != null && !defaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) {
throw new DataValidationException("Another default root edge rule chain is present in scope of current tenant!"); throw new DataValidationException("Another default root edge rule chain is present in scope of current tenant!");
} }

4
dao/src/main/java/org/thingsboard/server/dao/rule/RuleChainDao.java

@ -61,10 +61,10 @@ public interface RuleChainDao extends Dao<RuleChain>, TenantEntityDao {
PageData<RuleChain> findRuleChainsByTenantIdAndEdgeId(UUID tenantId, UUID edgeId, PageLink pageLink); PageData<RuleChain> findRuleChainsByTenantIdAndEdgeId(UUID tenantId, UUID edgeId, PageLink pageLink);
/** /**
* Find default edge rule chains by tenantId. * Find auto assign to edge rule chains by tenantId.
* *
* @param tenantId the tenantId * @param tenantId the tenantId
* @return the list of rule chain objects * @return the list of rule chain objects
*/ */
ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId); ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId);
} }

6
dao/src/main/java/org/thingsboard/server/dao/sql/rule/JpaRuleChainDao.java

@ -95,10 +95,10 @@ public class JpaRuleChainDao extends JpaAbstractSearchTextDao<RuleChainEntity, R
} }
@Override @Override
public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId) { public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId) {
log.debug("Try to find default edge rule chains by tenantId [{}]", tenantId); log.debug("Try to find auto assign to edge rule chains by tenantId [{}]", tenantId);
ListenableFuture<List<EntityRelation>> relations = ListenableFuture<List<EntityRelation>> relations =
relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN); relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN);
return Futures.transformAsync(relations, input -> { return Futures.transformAsync(relations, input -> {
if (input != null && !input.isEmpty()) { if (input != null && !input.isEmpty()) {
List<ListenableFuture<RuleChain>> ruleChainsFutures = new ArrayList<>(input.size()); List<ListenableFuture<RuleChain>> ruleChainsFutures = new ArrayList<>(input.size());

24
dao/src/test/java/org/thingsboard/server/dao/service/BaseRuleChainServiceTest.java

@ -331,24 +331,24 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
@Test @Test
public void testGetDefaultEdgeRuleChains() throws Exception { public void testGetDefaultEdgeRuleChains() throws Exception {
RuleChainId ruleChainId = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 1"); RuleChainId ruleChainId = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1");
saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 2"); saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2");
List<RuleChain> result = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId).get(); List<RuleChain> result = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId).get();
Assert.assertEquals(2, result.size()); Assert.assertEquals(2, result.size());
ruleChainService.removeDefaultEdgeRuleChain(tenantId, ruleChainId); ruleChainService.unsetAutoAssignToEdgeRuleChain(tenantId, ruleChainId);
result = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId).get(); result = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId).get();
Assert.assertEquals(1, result.size()); Assert.assertEquals(1, result.size());
} }
@Test @Test
public void setDefaultRootEdgeRuleChain() throws Exception { public void setEdgeTemplateRootRuleChain() throws Exception {
RuleChainId ruleChainId1 = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 1"); RuleChainId ruleChainId1 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1");
RuleChainId ruleChainId2 = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 2"); RuleChainId ruleChainId2 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2");
ruleChainService.setDefaultRootEdgeRuleChain(tenantId, ruleChainId1); ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId1);
ruleChainService.setDefaultRootEdgeRuleChain(tenantId, ruleChainId2); ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId2);
RuleChain ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId1); RuleChain ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId1);
Assert.assertFalse(ruleChainById.isRoot()); Assert.assertFalse(ruleChainById.isRoot());
@ -357,13 +357,13 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest {
Assert.assertTrue(ruleChainById.isRoot()); Assert.assertTrue(ruleChainById.isRoot());
} }
private RuleChainId saveRuleChainAndSetDefaultEdge(String name) { private RuleChainId saveRuleChainAndSetAutoAssignToEdge(String name) {
RuleChain edgeRuleChain = new RuleChain(); RuleChain edgeRuleChain = new RuleChain();
edgeRuleChain.setTenantId(tenantId); edgeRuleChain.setTenantId(tenantId);
edgeRuleChain.setType(RuleChainType.EDGE); edgeRuleChain.setType(RuleChainType.EDGE);
edgeRuleChain.setName(name); edgeRuleChain.setName(name);
RuleChain savedEdgeRuleChain = ruleChainService.saveRuleChain(edgeRuleChain); RuleChain savedEdgeRuleChain = ruleChainService.saveRuleChain(edgeRuleChain);
ruleChainService.addDefaultEdgeRuleChain(tenantId, savedEdgeRuleChain.getId()); ruleChainService.setAutoAssignToEdgeRuleChain(tenantId, savedEdgeRuleChain.getId());
return savedEdgeRuleChain.getId(); return savedEdgeRuleChain.getId();
} }

10
rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java

@ -2676,7 +2676,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
}, params).getBody(); }, params).getBody();
} }
public Optional<RuleChain> addDefaultEdgeRuleChain(RuleChainId ruleChainId) { public Optional<RuleChain> setAutoAssignToEdgeRuleChain(RuleChainId ruleChainId) {
try { try {
ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", null, RuleChain.class, ruleChainId.getId()); ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", null, RuleChain.class, ruleChainId.getId());
return Optional.ofNullable(ruleChain.getBody()); return Optional.ofNullable(ruleChain.getBody());
@ -2689,7 +2689,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
} }
} }
public Optional<RuleChain> removeDefaultEdgeRuleChain(RuleChainId ruleChainId) { public Optional<RuleChain> unsetAutoAssignToEdgeRuleChain(RuleChainId ruleChainId) {
try { try {
ResponseEntity<RuleChain> ruleChain = restTemplate.exchange(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", HttpMethod.DELETE, HttpEntity.EMPTY, RuleChain.class, ruleChainId.getId()); ResponseEntity<RuleChain> ruleChain = restTemplate.exchange(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", HttpMethod.DELETE, HttpEntity.EMPTY, RuleChain.class, ruleChainId.getId());
return Optional.ofNullable(ruleChain.getBody()); return Optional.ofNullable(ruleChain.getBody());
@ -2702,7 +2702,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
} }
} }
public List<RuleChain> getDefaultEdgeRuleChains() { public List<RuleChain> getAutoAssignToEdgeRuleChains() {
return restTemplate.exchange(baseURL + "/api/ruleChain/defaultEdgeRuleChains", return restTemplate.exchange(baseURL + "/api/ruleChain/defaultEdgeRuleChains",
HttpMethod.GET, HttpMethod.GET,
HttpEntity.EMPTY, HttpEntity.EMPTY,
@ -2710,9 +2710,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
}).getBody(); }).getBody();
} }
public Optional<RuleChain> setDefaultRootEdgeRuleChain(RuleChainId ruleChainId) { public Optional<RuleChain> setRootEdgeTemplateRuleChain(RuleChainId ruleChainId) {
try { try {
ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultRootEdge", null, RuleChain.class, ruleChainId.getId()); ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/edgeTemplateRoot", null, RuleChain.class, ruleChainId.getId());
return Optional.ofNullable(ruleChain.getBody()); return Optional.ofNullable(ruleChain.getBody());
} catch (HttpClientErrorException exception) { } catch (HttpClientErrorException exception) {
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {

2
ui-ngx/src/app/core/http/entity.service.ts

@ -565,6 +565,8 @@ export class EntityService {
return entityType === EntityType.ENTITY_VIEW; return entityType === EntityType.ENTITY_VIEW;
case AliasFilterType.relationsQuery: case AliasFilterType.relationsQuery:
return true; return true;
case AliasFilterType.apiUsageState:
return true;
case AliasFilterType.assetSearchQuery: case AliasFilterType.assetSearchQuery:
return entityType === EntityType.ASSET; return entityType === EntityType.ASSET;
case AliasFilterType.deviceSearchQuery: case AliasFilterType.deviceSearchQuery:

16
ui-ngx/src/app/core/http/rule-chain.service.ts

@ -313,20 +313,20 @@ export class RuleChainService {
return this.http.delete(`/api/edge/${edgeId}/ruleChain/${ruleChainId}`, defaultHttpOptionsFromConfig(config)); return this.http.delete(`/api/edge/${edgeId}/ruleChain/${ruleChainId}`, defaultHttpOptionsFromConfig(config));
} }
public setDefaultRootEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { public setEdgeTemplateRootRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> {
return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/defaultRootEdge`, defaultHttpOptionsFromConfig(config)); return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/edgeTemplateRoot`, defaultHttpOptionsFromConfig(config));
} }
public addDefaultEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { public setAutoAssignToEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> {
return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/defaultEdge`, defaultHttpOptionsFromConfig(config)); return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/autoAssignToEdge`, defaultHttpOptionsFromConfig(config));
} }
public removeDefaultEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { public unsetAutoAssignToEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> {
return this.http.delete<RuleChain>(`/api/ruleChain/${ruleChainId}/defaultEdge`, defaultHttpOptionsFromConfig(config)); return this.http.delete<RuleChain>(`/api/ruleChain/${ruleChainId}/autoAssignToEdge`, defaultHttpOptionsFromConfig(config));
} }
public getDefaultEdgeRuleChains(config?: RequestConfig): Observable<Array<RuleChain>> { public getAutoAssignToEdgeRuleChains(config?: RequestConfig): Observable<Array<RuleChain>> {
return this.http.get<Array<RuleChain>>(`/api/ruleChain/defaultEdgeRuleChains`, defaultHttpOptionsFromConfig(config)); return this.http.get<Array<RuleChain>>(`/api/ruleChain/autoAssignToEdgeRuleChains`, defaultHttpOptionsFromConfig(config));
} }
public setEdgeRootRuleChain(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable<Edge> { public setEdgeRootRuleChain(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable<Edge> {

2
ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.ts

@ -46,7 +46,7 @@ export interface EntityAliasesDialogData {
widgets: Array<Widget>; widgets: Array<Widget>;
isSingleEntityAlias?: boolean; isSingleEntityAlias?: boolean;
isSingleWidget?: boolean; isSingleWidget?: boolean;
allowedEntityTypes?: Array<AliasEntityType>; allowedEntityTypes?: Array<EntityType | AliasEntityType>;
disableAdd?: boolean; disableAdd?: boolean;
singleEntityAlias?: EntityAlias; singleEntityAlias?: EntityAlias;
customTitle?: string; customTitle?: string;

3
ui-ngx/src/app/modules/home/components/entity/entity.component.ts

@ -81,8 +81,7 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
protected constructor(protected store: Store<AppState>, protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder, protected fb: FormBuilder,
protected entityValue: T, protected entityValue: T,
protected entitiesTableConfigValue: C, protected entitiesTableConfigValue: C) {
@Inject(WINDOW) protected window?: Window) {
super(store); super(store);
this.entityForm = this.buildForm(this.entityValue); this.entityForm = this.buildForm(this.entityValue);
} }

9
ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts

@ -45,7 +45,7 @@ import {
} from '@home/components/alias/entity-aliases-dialog.component'; } from '@home/components/alias/entity-aliases-dialog.component';
import { ItemBufferService, WidgetItem } from '@core/services/item-buffer.service'; import { ItemBufferService, WidgetItem } from '@core/services/item-buffer.service';
import { FileType, ImportWidgetResult, JSON_TYPE, WidgetsBundleItem, ZIP_TYPE } from './import-export.models'; import { FileType, ImportWidgetResult, JSON_TYPE, WidgetsBundleItem, ZIP_TYPE } from './import-export.models';
import { EntityType } from '@shared/models/entity-type.models'; import { AliasEntityType, EntityType } from '@shared/models/entity-type.models';
import { UtilsService } from '@core/services/utils.service'; import { UtilsService } from '@core/services/utils.service';
import { WidgetService } from '@core/http/widget.service'; import { WidgetService } from '@core/http/widget.service';
import { NULL_UUID } from '@shared/models/id/has-uuid'; import { NULL_UUID } from '@shared/models/id/has-uuid';
@ -603,6 +603,10 @@ export class ImportExportService {
private editMissingAliases(widgets: Array<Widget>, isSingleWidget: boolean, private editMissingAliases(widgets: Array<Widget>, isSingleWidget: boolean,
customTitle: string, missingEntityAliases: EntityAliases): Observable<EntityAliases> { customTitle: string, missingEntityAliases: EntityAliases): Observable<EntityAliases> {
// TODO: voba - double check with Igor/Vlad regarding this approach to hide aliases
let allowedEntityTypes: Array<EntityType | AliasEntityType> =
this.entityService.prepareAllowedEntityTypesList(null, true);
return this.dialog.open<EntityAliasesDialogComponent, EntityAliasesDialogData, return this.dialog.open<EntityAliasesDialogComponent, EntityAliasesDialogData,
EntityAliases>(EntityAliasesDialogComponent, { EntityAliases>(EntityAliasesDialogComponent, {
disableClose: true, disableClose: true,
@ -612,7 +616,8 @@ export class ImportExportService {
widgets, widgets,
customTitle, customTitle,
isSingleWidget, isSingleWidget,
disableAdd: true disableAdd: true,
allowedEntityTypes: allowedEntityTypes
} }
}).afterClosed().pipe( }).afterClosed().pipe(
map((updatedEntityAliases) => { map((updatedEntityAliases) => {

9
ui-ngx/src/app/modules/home/pages/dashboard/dashboard-page.component.ts

@ -99,6 +99,7 @@ import { ImportExportService } from '@home/components/import-export/import-expor
import { AuthState } from '@app/core/auth/auth.models'; import { AuthState } from '@app/core/auth/auth.models';
import { FiltersDialogComponent, FiltersDialogData } from '@home/components/filter/filters-dialog.component'; import { FiltersDialogComponent, FiltersDialogData } from '@home/components/filter/filters-dialog.component';
import { Filters } from '@shared/models/query/query.models'; import { Filters } from '@shared/models/query/query.models';
import { AliasEntityType, EntityType } from "@shared/models/entity-type.models";
// @dynamic // @dynamic
@Component({ @Component({
@ -142,6 +143,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
isToolbarOpenedAnimate = false; isToolbarOpenedAnimate = false;
isRightLayoutOpened = false; isRightLayoutOpened = false;
allowedEntityTypes: Array<EntityType | AliasEntityType> = null;
editingWidget: Widget = null; editingWidget: Widget = null;
editingWidgetLayout: WidgetLayout = null; editingWidgetLayout: WidgetLayout = null;
editingWidgetOriginal: Widget = null; editingWidgetOriginal: Widget = null;
@ -309,6 +312,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
}; };
this.window.parent.postMessage(JSON.stringify(message), '*'); this.window.parent.postMessage(JSON.stringify(message), '*');
} }
// TODO: voba - double check with Igor/Vlad regarding this approach to hide aliases
this.allowedEntityTypes = this.entityService.prepareAllowedEntityTypesList(null, true);
} }
private reset() { private reset() {
@ -514,7 +520,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
data: { data: {
entityAliases: deepClone(this.dashboard.configuration.entityAliases), entityAliases: deepClone(this.dashboard.configuration.entityAliases),
widgets: this.dashboardUtils.getWidgetsArray(this.dashboard), widgets: this.dashboardUtils.getWidgetsArray(this.dashboard),
isSingleEntityAlias: false isSingleEntityAlias: false,
allowedEntityTypes: this.allowedEntityTypes
} }
}).afterClosed().subscribe((entityAliases) => { }).afterClosed().subscribe((entityAliases) => {
if (entityAliases) { if (entityAliases) {

2
ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts

@ -65,7 +65,7 @@ const routes: Routes = [
auth: [Authority.TENANT_ADMIN], auth: [Authority.TENANT_ADMIN],
ruleChainsType: 'edge', ruleChainsType: 'edge',
breadcrumb: { breadcrumb: {
label: 'edge.rulechain-templates', label: 'edge.edge-rulechains',
icon: 'settings_ethernet' icon: 'settings_ethernet'
}, },
}, },

18
ui-ngx/src/app/modules/home/pages/edge/edge.component.html

@ -134,22 +134,24 @@
</tb-entity-subtype-autocomplete> </tb-entity-subtype-autocomplete>
<div fxLayout="row"> <div fxLayout="row">
<fieldset fxFlex> <fieldset fxFlex>
<div class="tb-hint" [innerHTML]="'edge.edge-license-key-hint' | translate"></div>
<mat-form-field class="mat-block"> <mat-form-field class="mat-block">
<mat-label translate>edge.cloud-endpoint</mat-label> <mat-label translate>edge.edge-license-key</mat-label>
<input matInput formControlName="cloudEndpoint" required> <input matInput formControlName="edgeLicenseKey" required>
<mat-error *ngIf="entityForm.get('cloudEndpoint').hasError('required')"> <mat-error *ngIf="entityForm.get('edgeLicenseKey').hasError('required')">
{{ 'edge.cloud-endpoint-required' | translate }} {{ 'edge.edge-license-key-required' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</fieldset> </fieldset>
</div> </div>
<div fxLayout="row"> <div fxLayout="row">
<fieldset fxFlex> <fieldset fxFlex>
<div translate class="tb-hint">edge.cloud-endpoint-hint</div>
<mat-form-field class="mat-block"> <mat-form-field class="mat-block">
<mat-label translate>edge.edge-license-key</mat-label> <mat-label translate>edge.cloud-endpoint</mat-label>
<input matInput formControlName="edgeLicenseKey" required> <input matInput formControlName="cloudEndpoint" required>
<mat-error *ngIf="entityForm.get('edgeLicenseKey').hasError('required')"> <mat-error *ngIf="entityForm.get('cloudEndpoint').hasError('required')">
{{ 'edge.edge-license-key-required' | translate }} {{ 'edge.cloud-endpoint-required' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</fieldset> </fieldset>

24
ui-ngx/src/app/modules/home/pages/edge/edge.component.ts

@ -44,13 +44,15 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
@Inject('entity') protected entityValue: EdgeInfo, @Inject('entity') protected entityValue: EdgeInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>, @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>,
public fb: FormBuilder, public fb: FormBuilder,
// TODO: voba - discuss with Vlad how properly add window to subclass
@Inject(WINDOW) protected window: Window) { @Inject(WINDOW) protected window: Window) {
super(store, fb, entityValue, entitiesTableConfigValue, window); super(store, fb, entityValue, entitiesTableConfigValue);
} }
ngOnInit() { ngOnInit() {
this.edgeScope = this.entitiesTableConfig.componentsData.edgeScope; this.edgeScope = this.entitiesTableConfig.componentsData.edgeScope;
this.entityForm.patchValue({
cloudEndpoint:this.window.location.origin
});
super.ngOnInit(); super.ngOnInit();
} }
@ -70,9 +72,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
return this.fb.group( return this.fb.group(
{ {
name: [entity ? entity.name : '', [Validators.required]], name: [entity ? entity.name : '', [Validators.required]],
type: [entity ? entity.type : null, [Validators.required]], type: [entity?.type ? entity.type : 'default', [Validators.required]],
label: [entity ? entity.label : ''], label: [entity ? entity.label : ''],
cloudEndpoint: [this.window.location.origin, [Validators.required]], cloudEndpoint: [null, [Validators.required]],
edgeLicenseKey: ['', [Validators.required]], edgeLicenseKey: ['', [Validators.required]],
routingKey: guid(), routingKey: guid(),
secret: this.generateSecret(20), secret: this.generateSecret(20),
@ -86,14 +88,14 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
} }
updateForm(entity: EdgeInfo) { updateForm(entity: EdgeInfo) {
this.entityForm.patchValue({name: entity.name});
this.entityForm.patchValue({type: entity.type});
this.entityForm.patchValue({label: entity.label});
this.entityForm.patchValue({cloudEndpoint: entity.cloudEndpoint});
this.entityForm.patchValue({edgeLicenseKey: entity.edgeLicenseKey});
this.entityForm.patchValue({routingKey: entity.routingKey});
this.entityForm.patchValue({secret: entity.secret});
this.entityForm.patchValue({ this.entityForm.patchValue({
name: entity.name,
type: entity.type,
label: entity.label,
cloudEndpoint: entity.cloudEndpoint ? entity.cloudEndpoint : this.window.location.origin,
edgeLicenseKey: entity.edgeLicenseKey,
routingKey: entity.routingKey,
secret: entity.secret,
additionalInfo: { additionalInfo: {
description: entity.additionalInfo ? entity.additionalInfo.description : '' description: entity.additionalInfo ? entity.additionalInfo.description : ''
} }

30
ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html

@ -19,13 +19,13 @@
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'open')" (click)="onEntityAction($event, 'open')"
[fxShow]="!isEdit"> [fxShow]="!isEdit && (ruleChainScope === 'tenant' || ruleChainScope === 'edges')">
{{'rulechain.open-rulechain' | translate }} {{'rulechain.open-rulechain' | translate }}
</button> </button>
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'export')" (click)="onEntityAction($event, 'export')"
[fxShow]="!isEdit"> [fxShow]="!isEdit && (ruleChainScope === 'tenant' || ruleChainScope === 'edges')">
{{'rulechain.export' | translate }} {{'rulechain.export' | translate }}
</button> </button>
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
@ -36,20 +36,38 @@
</button> </button>
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'setDefaultRoot')" (click)="onEntityAction($event, 'setEdgeTemplateRoot')"
[fxShow]="!isEdit && !entity?.root && ruleChainScope === 'edges'"> [fxShow]="!isEdit && !entity?.root && ruleChainScope === 'edges'">
{{'rulechain.set-default-root-edge' | translate }} {{'rulechain.set-edge-template-root-rulechain' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'setAutoAssignToEdge')"
[fxShow]="!isEdit && isNotAutoAssignToEdgeRuleChain() && ruleChainScope === 'edges'">
{{'rulechain.set-auto-assign-to-edge' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'unsetAutoAssignToEdge')"
[fxShow]="!isEdit && isAutoAssignToEdgeRuleChain() && ruleChainScope === 'edges'">
{{'rulechain.unset-auto-assign-to-edge' | translate }}
</button> </button>
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'setRoot')" (click)="onEntityAction($event, 'setRoot')"
[fxShow]="!isEdit && !isRootRuleChain() && ruleChainScope === 'edge'"> [fxShow]="!isEdit && !isEdgeRootRuleChain() && ruleChainScope === 'edge'">
{{'rulechain.set-root' | translate }} {{'rulechain.set-root' | translate }}
</button> </button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'unassignFromEdge')"
[fxShow]="!isEdit && !isEdgeRootRuleChain() && ruleChainScope === 'edge'">
{{'edge.unassign-from-edge' | translate }}
</button>
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'delete')" (click)="onEntityAction($event, 'delete')"
[fxShow]="!hideDelete() && !isEdit"> [fxShow]="!hideDelete() && !isEdit && (ruleChainScope === 'tenant' || ruleChainScope === 'edges')">
{{'rulechain.delete' | translate }} {{'rulechain.delete' | translate }}
</button> </button>
<div fxLayout="row"> <div fxLayout="row">

22
ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.ts

@ -86,9 +86,27 @@ export class RuleChainComponent extends EntityComponent<RuleChain> {
})); }));
} }
isRootRuleChain() { isEdgeRootRuleChain() {
if (this.entitiesTableConfig && this.entityValue) { if (this.entitiesTableConfig && this.entityValue) {
return this.entitiesTableConfig.componentsData.rootRuleChainId == this.entityValue.id.id; return this.entitiesTableConfig.componentsData.edge?.rootRuleChainId?.id == this.entityValue.id.id;
} else {
return false;
}
}
isAutoAssignToEdgeRuleChain() {
if (this.entitiesTableConfig && this.entityValue) {
return !this.entityValue.root &&
this.entitiesTableConfig.componentsData?.autoAssignToEdgeRuleChainIds?.includes(this.entityValue.id.id);
} else {
return false;
}
}
isNotAutoAssignToEdgeRuleChain() {
if (this.entitiesTableConfig && this.entityValue) {
return !this.entityValue.root &&
!this.entitiesTableConfig.componentsData?.autoAssignToEdgeRuleChainIds?.includes(this.entityValue.id.id);
} else { } else {
return false; return false;
} }

120
ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts

@ -14,9 +14,9 @@
/// limitations under the License. /// limitations under the License.
/// ///
import {Injectable} from '@angular/core'; import { Injectable } from '@angular/core';
import {ActivatedRouteSnapshot, Resolve, Router} from '@angular/router'; import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router';
import { import {
CellActionDescriptor, CellActionDescriptor,
checkBoxCell, checkBoxCell,
@ -27,27 +27,28 @@ import {
GroupActionDescriptor, GroupActionDescriptor,
HeaderActionDescriptor HeaderActionDescriptor
} from '@home/models/entity/entities-table-config.models'; } from '@home/models/entity/entities-table-config.models';
import {TranslateService} from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import {DatePipe} from '@angular/common'; import { DatePipe } from '@angular/common';
import {EntityType, entityTypeResources, entityTypeTranslations} from '@shared/models/entity-type.models'; import { EntityType, entityTypeResources, entityTypeTranslations } from '@shared/models/entity-type.models';
import {EntityAction} from '@home/models/entity/entity-component.models'; import { EntityAction } from '@home/models/entity/entity-component.models';
import {RuleChain, ruleChainType} from '@shared/models/rule-chain.models'; import { RuleChain, ruleChainType } from '@shared/models/rule-chain.models';
import {RuleChainService} from '@core/http/rule-chain.service'; import { RuleChainService } from '@core/http/rule-chain.service';
import {RuleChainComponent} from '@modules/home/pages/rulechain/rulechain.component'; import { RuleChainComponent } from '@modules/home/pages/rulechain/rulechain.component';
import {DialogService} from '@core/services/dialog.service'; import { DialogService } from '@core/services/dialog.service';
import {RuleChainTabsComponent} from '@home/pages/rulechain/rulechain-tabs.component'; import { RuleChainTabsComponent } from '@home/pages/rulechain/rulechain-tabs.component';
import {ImportExportService} from '@home/components/import-export/import-export.service'; import { ImportExportService } from '@home/components/import-export/import-export.service';
import {ItemBufferService} from '@core/services/item-buffer.service'; import { ItemBufferService } from '@core/services/item-buffer.service';
import {EdgeService} from "@core/http/edge.service"; import { EdgeService } from "@core/http/edge.service";
import {forkJoin, Observable} from "rxjs"; import { forkJoin, Observable } from "rxjs";
import { import {
AddEntitiesToEdgeDialogComponent, AddEntitiesToEdgeDialogComponent,
AddEntitiesToEdgeDialogData AddEntitiesToEdgeDialogData
} from "@home/dialogs/add-entities-to-edge-dialog.component"; } from "@home/dialogs/add-entities-to-edge-dialog.component";
import {MatDialog} from "@angular/material/dialog"; import { MatDialog } from "@angular/material/dialog";
import {isUndefined} from "@core/utils"; import { isUndefined } from "@core/utils";
import {PageLink} from "@shared/models/page/page-link"; import { PageLink } from "@shared/models/page/page-link";
import {Edge} from "@shared/models/edge.models"; import { Edge } from "@shared/models/edge.models";
import { map, mergeMap } from "rxjs/operators";
@Injectable() @Injectable()
export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<RuleChain>> { export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<RuleChain>> {
@ -96,12 +97,11 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
this.config.entitySelectionEnabled = ruleChain => ruleChain && !ruleChain.root; this.config.entitySelectionEnabled = ruleChain => ruleChain && !ruleChain.root;
this.config.deleteEnabled = (ruleChain) => ruleChain && !ruleChain.root; this.config.deleteEnabled = (ruleChain) => ruleChain && !ruleChain.root;
this.config.entitiesDeleteEnabled = true; this.config.entitiesDeleteEnabled = true;
} } else if (this.config.componentsData.ruleChainScope === 'edge') {
else if (this.config.componentsData.ruleChainScope === 'edge') {
this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id;
this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => { this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => {
this.config.componentsData.edge = edge; this.config.componentsData.edge = edge;
this.config.tableTitle = edge.name + ': ' + this.translate.instant('edge.rulechain-templates'); this.config.tableTitle = edge.name + ': ' + this.translate.instant('edge.rulechains');
}); });
this.config.entitiesDeleteEnabled = false; this.config.entitiesDeleteEnabled = false;
} }
@ -128,9 +128,13 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
columns.push( columns.push(
new DateEntityTableColumn<RuleChain>('createdTime', 'common.created-time', this.datePipe, '150px'), new DateEntityTableColumn<RuleChain>('createdTime', 'common.created-time', this.datePipe, '150px'),
new EntityTableColumn<RuleChain>('name', 'rulechain.name', '100%'), new EntityTableColumn<RuleChain>('name', 'rulechain.name', '100%'),
new EntityTableColumn<RuleChain>('root', 'rulechain.root', '60px', new EntityTableColumn<RuleChain>('root', 'rulechain.edge-template-root', '60px',
entity => { entity => {
return checkBoxCell(entity.root); return checkBoxCell(entity.root);
}),
new EntityTableColumn<RuleChain>('assignToEdge', 'rulechain.assign-to-edge', '60px',
entity => {
return checkBoxCell(this.isAutoAssignToEdgeRuleChain(entity));
}) })
); );
} }
@ -226,22 +230,22 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
if (ruleChainScope === 'edges') { if (ruleChainScope === 'edges') {
actions.push( actions.push(
{ {
name: this.translate.instant('rulechain.set-default-root-edge'), name: this.translate.instant('rulechain.set-edge-template-root-rulechain'),
icon: 'flag', icon: 'flag',
isEnabled: (entity) => this.isNonRootRuleChain(entity), isEnabled: (entity) => this.isNonRootRuleChain(entity),
onAction: ($event, entity) => this.setDefaultRootEdgeRuleChain($event, entity) onAction: ($event, entity) => this.setEdgeTemplateRootRuleChain($event, entity)
}, },
{ {
name: this.translate.instant('rulechain.set-auto-assign-to-edge'), name: this.translate.instant('rulechain.set-auto-assign-to-edge'),
icon: 'bookmark_outline', icon: 'bookmark_outline',
isEnabled: (entity) => this.isNonDefaultEdgeRuleChain(entity), isEnabled: (entity) => this.isNotAutoAssignToEdgeRuleChain(entity),
onAction: ($event, entity) => this.setDefaultEdgeRuleChain($event, entity) onAction: ($event, entity) => this.setAutoAssignToEdgeRuleChain($event, entity)
}, },
{ {
name: this.translate.instant('rulechain.remove-default-edge'), name: this.translate.instant('rulechain.unset-auto-assign-to-edge'),
icon: 'bookmark', icon: 'bookmark',
isEnabled: (entity) => this.isDefaultEdgeRuleChain(entity), isEnabled: (entity) => this.isAutoAssignToEdgeRuleChain(entity),
onAction: ($event, entity) => this.removeDefaultEdgeRuleChain($event, entity) onAction: ($event, entity) => this.unsetAutoAssignToEdgeRuleChain($event, entity)
} }
) )
} }
@ -344,26 +348,35 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
case 'setRoot': case 'setRoot':
this.setRootRuleChain(action.event, action.entity); this.setRootRuleChain(action.event, action.entity);
return true; return true;
case 'setDefaultRoot': case 'setEdgeTemplateRoot':
this.setDefaultRootEdgeRuleChain(action.event, action.entity); this.setEdgeTemplateRootRuleChain(action.event, action.entity);
return true;
case 'unassignFromEdge':
this.unassignFromEdge(action.event, action.entity);
return true;
case 'setAutoAssignToEdge':
this.setAutoAssignToEdgeRuleChain(action.event, action.entity);
return true;
case 'unsetAutoAssignToEdge':
this.unsetAutoAssignToEdgeRuleChain(action.event, action.entity);
return true; return true;
} }
return false; return false;
} }
setDefaultRootEdgeRuleChain($event: Event, ruleChain: RuleChain) { setEdgeTemplateRootRuleChain($event: Event, ruleChain: RuleChain) {
if ($event) { if ($event) {
$event.stopPropagation(); $event.stopPropagation();
} }
this.dialogService.confirm( this.dialogService.confirm(
this.translate.instant('rulechain.set-default-root-edge-rulechain-title', {ruleChainName: ruleChain.name}), this.translate.instant('rulechain.set-edge-template-root-rulechain-title', {ruleChainName: ruleChain.name}),
this.translate.instant('rulechain.set-default-root-edge-rulechain-text'), this.translate.instant('rulechain.set-edge-template-root-rulechain-text'),
this.translate.instant('action.no'), this.translate.instant('action.no'),
this.translate.instant('action.yes'), this.translate.instant('action.yes'),
true true
).subscribe((res) => { ).subscribe((res) => {
if (res) { if (res) {
this.ruleChainService.setDefaultRootEdgeRuleChain(ruleChain.id.id).subscribe( this.ruleChainService.setEdgeTemplateRootRuleChain(ruleChain.id.id).subscribe(
() => { () => {
this.config.table.updateData(); this.config.table.updateData();
} }
@ -444,7 +457,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
); );
} }
setDefaultEdgeRuleChain($event: Event, ruleChain: RuleChain) { setAutoAssignToEdgeRuleChain($event: Event, ruleChain: RuleChain) {
if ($event) { if ($event) {
$event.stopPropagation(); $event.stopPropagation();
} }
@ -456,7 +469,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
true true
).subscribe((res) => { ).subscribe((res) => {
if (res) { if (res) {
this.ruleChainService.addDefaultEdgeRuleChain(ruleChain.id.id).subscribe( this.ruleChainService.setAutoAssignToEdgeRuleChain(ruleChain.id.id).subscribe(
() => { () => {
this.config.table.updateData(); this.config.table.updateData();
} }
@ -466,19 +479,19 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
); );
} }
removeDefaultEdgeRuleChain($event: Event, ruleChain: RuleChain) { unsetAutoAssignToEdgeRuleChain($event: Event, ruleChain: RuleChain) {
if ($event) { if ($event) {
$event.stopPropagation(); $event.stopPropagation();
} }
this.dialogService.confirm( this.dialogService.confirm(
this.translate.instant('rulechain.remove-default-edge-title', {ruleChainName: ruleChain.name}), this.translate.instant('rulechain.unset-auto-assign-to-edge-title', {ruleChainName: ruleChain.name}),
this.translate.instant('rulechain.remove-default-edge-text'), this.translate.instant('rulechain.unset-auto-assign-to-edge-text'),
this.translate.instant('action.no'), this.translate.instant('action.no'),
this.translate.instant('action.yes'), this.translate.instant('action.yes'),
true true
).subscribe((res) => { ).subscribe((res) => {
if (res) { if (res) {
this.ruleChainService.removeDefaultEdgeRuleChain(ruleChain.id.id).subscribe( this.ruleChainService.unsetAutoAssignToEdgeRuleChain(ruleChain.id.id).subscribe(
() => { () => {
this.config.table.updateData(); this.config.table.updateData();
} }
@ -490,17 +503,18 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
isNonRootRuleChain(ruleChain: RuleChain) { isNonRootRuleChain(ruleChain: RuleChain) {
if (this.config.componentsData.ruleChainScope === 'edge') { if (this.config.componentsData.ruleChainScope === 'edge') {
return this.config.componentsData.edge.rootRuleChainId && true && this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; return this.config.componentsData.edge.rootRuleChainId &&
this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id;
} }
return !ruleChain.root; return !ruleChain.root;
} }
isDefaultEdgeRuleChain(ruleChain) { isAutoAssignToEdgeRuleChain(ruleChain) {
return !ruleChain.root && this.config.componentsData.defaultEdgeRuleChainIds.includes(ruleChain.id.id); return !ruleChain.root && this.config.componentsData.autoAssignToEdgeRuleChainIds.includes(ruleChain.id.id);
} }
isNonDefaultEdgeRuleChain(ruleChain) { isNotAutoAssignToEdgeRuleChain(ruleChain) {
return !ruleChain.root && !this.config.componentsData.defaultEdgeRuleChainIds.includes(ruleChain.id.id); return !ruleChain.root && !this.config.componentsData.autoAssignToEdgeRuleChainIds.includes(ruleChain.id.id);
} }
fetchRuleChains(pageLink: PageLink) { fetchRuleChains(pageLink: PageLink) {
@ -508,10 +522,12 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
} }
fetchEdgeRuleChains(pageLink: PageLink) { fetchEdgeRuleChains(pageLink: PageLink) {
this.config.componentsData.defaultEdgeRuleChainIds = []; return this.ruleChainService.getAutoAssignToEdgeRuleChains().pipe(
this.ruleChainService.getDefaultEdgeRuleChains().subscribe(ruleChains => { mergeMap((ruleChains) => {
ruleChains.map(ruleChain => this.config.componentsData.defaultEdgeRuleChainIds.push(ruleChain.id.id)); this.config.componentsData.autoAssignToEdgeRuleChainIds = [];
}); ruleChains.map(ruleChain => this.config.componentsData.autoAssignToEdgeRuleChainIds.push(ruleChain.id.id));
return this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge); return this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge);
})
);
} }
} }

2
ui-ngx/src/app/shared/models/constants.ts

@ -115,7 +115,7 @@ export const HelpLinks = {
users: helpBaseUrl + '/docs/user-guide/ui/users', users: helpBaseUrl + '/docs/user-guide/ui/users',
devices: helpBaseUrl + '/docs/user-guide/ui/devices', devices: helpBaseUrl + '/docs/user-guide/ui/devices',
deviceProfiles: helpBaseUrl + '/docs/user-guide/ui/device-profiles', deviceProfiles: helpBaseUrl + '/docs/user-guide/ui/device-profiles',
edges: helpBaseUrl + 'docs/user-guide/ui/edges', edges: helpBaseUrl + '/docs/user-guide/ui/edges',
assets: helpBaseUrl + '/docs/user-guide/ui/assets', assets: helpBaseUrl + '/docs/user-guide/ui/assets',
entityViews: helpBaseUrl + '/docs/user-guide/ui/entity-views', entityViews: helpBaseUrl + '/docs/user-guide/ui/entity-views',
entitiesImport: helpBaseUrl + '/docs/user-guide/bulk-provisioning', entitiesImport: helpBaseUrl + '/docs/user-guide/bulk-provisioning',

68
ui-ngx/src/app/shared/models/edge.models.ts

@ -93,45 +93,45 @@ export enum EdgeEventStatus {
export const edgeEventTypeTranslations = new Map<EdgeEventType, string>( export const edgeEventTypeTranslations = new Map<EdgeEventType, string>(
[ [
[EdgeEventType.DASHBOARD, 'edge.edge-event-type-dashboard'], [EdgeEventType.DASHBOARD, 'edge-event.type-dashboard'],
[EdgeEventType.ASSET, 'edge.edge-event-type-asset'], [EdgeEventType.ASSET, 'edge-event.type-asset'],
[EdgeEventType.DEVICE, 'edge.edge-event-type-device'], [EdgeEventType.DEVICE, 'edge-event.type-device'],
[EdgeEventType.DEVICE_PROFILE, 'edge.edge-event-type-device-profile'], [EdgeEventType.DEVICE_PROFILE, 'edge-event.type-device-profile'],
[EdgeEventType.ENTITY_VIEW, 'edge.edge-event-type-entity-view'], [EdgeEventType.ENTITY_VIEW, 'edge-event.type-entity-view'],
[EdgeEventType.ALARM, 'edge.edge-event-type-alarm'], [EdgeEventType.ALARM, 'edge-event.type-alarm'],
[EdgeEventType.RULE_CHAIN, 'edge.edge-event-type-rule-chain'], [EdgeEventType.RULE_CHAIN, 'edge-event.type-rule-chain'],
[EdgeEventType.RULE_CHAIN_METADATA, 'edge.edge-event-type-rule-chain-metadata'], [EdgeEventType.RULE_CHAIN_METADATA, 'edge-event.type-rule-chain-metadata'],
[EdgeEventType.EDGE, 'edge.edge-event-type-edge'], [EdgeEventType.EDGE, 'edge-event.type-edge'],
[EdgeEventType.USER, 'edge.edge-event-type-user'], [EdgeEventType.USER, 'edge-event.type-user'],
[EdgeEventType.CUSTOMER, 'edge.edge-event-type-customer'], [EdgeEventType.CUSTOMER, 'edge-event.type-customer'],
[EdgeEventType.RELATION, 'edge.edge-event-type-relation'], [EdgeEventType.RELATION, 'edge-event.type-relation'],
[EdgeEventType.WIDGETS_BUNDLE, 'edge.edge-event-type-widgets-bundle'], [EdgeEventType.WIDGETS_BUNDLE, 'edge-event.type-widgets-bundle'],
[EdgeEventType.WIDGET_TYPE, 'edge.edge-event-type-widgets-type'], [EdgeEventType.WIDGET_TYPE, 'edge-event.type-widgets-type'],
[EdgeEventType.ADMIN_SETTINGS, 'edge.edge-event-type-admin-settings'] [EdgeEventType.ADMIN_SETTINGS, 'edge-event.type-admin-settings']
] ]
); );
export const edgeEventActionTypeTranslations = new Map<EdgeEventActionType, string>( export const edgeEventActionTypeTranslations = new Map<EdgeEventActionType, string>(
[ [
[EdgeEventActionType.ADDED, 'edge.edge-event-action-type-added'], [EdgeEventActionType.ADDED, 'edge-event.action-type-added'],
[EdgeEventActionType.DELETED, 'edge.edge-event-action-type-deleted'], [EdgeEventActionType.DELETED, 'edge-event.action-type-deleted'],
[EdgeEventActionType.UPDATED, 'edge.edge-event-action-type-updated'], [EdgeEventActionType.UPDATED, 'edge-event.action-type-updated'],
[EdgeEventActionType.POST_ATTRIBUTES, 'edge.edge-event-action-type-post-attributes'], [EdgeEventActionType.POST_ATTRIBUTES, 'edge-event.action-type-post-attributes'],
[EdgeEventActionType.ATTRIBUTES_UPDATED, 'edge.edge-event-action-type-attributes-updated'], [EdgeEventActionType.ATTRIBUTES_UPDATED, 'edge-event.action-type-attributes-updated'],
[EdgeEventActionType.ATTRIBUTES_DELETED, 'edge.edge-event-action-type-attributes-deleted'], [EdgeEventActionType.ATTRIBUTES_DELETED, 'edge-event.action-type-attributes-deleted'],
[EdgeEventActionType.TIMESERIES_UPDATED, 'edge.edge-event-action-type-timeseries-updated'], [EdgeEventActionType.TIMESERIES_UPDATED, 'edge-event.action-type-timeseries-updated'],
[EdgeEventActionType.CREDENTIALS_UPDATED, 'edge.edge-event-action-type-credentials-updated'], [EdgeEventActionType.CREDENTIALS_UPDATED, 'edge-event.action-type-credentials-updated'],
[EdgeEventActionType.ASSIGNED_TO_CUSTOMER, 'edge.edge-event-action-type-assigned-to-customer'], [EdgeEventActionType.ASSIGNED_TO_CUSTOMER, 'edge-event.action-type-assigned-to-customer'],
[EdgeEventActionType.UNASSIGNED_FROM_CUSTOMER, 'edge.edge-event-action-type-unassigned-from-customer'], [EdgeEventActionType.UNASSIGNED_FROM_CUSTOMER, 'edge-event.action-type-unassigned-from-customer'],
[EdgeEventActionType.RELATION_ADD_OR_UPDATE, 'edge.edge-event-action-type-relation-add-or-update'], [EdgeEventActionType.RELATION_ADD_OR_UPDATE, 'edge-event.action-type-relation-add-or-update'],
[EdgeEventActionType.RELATION_DELETED, 'edge.edge-event-action-type-relation-deleted'], [EdgeEventActionType.RELATION_DELETED, 'edge-event.action-type-relation-deleted'],
[EdgeEventActionType.RPC_CALL, 'edge.edge-event-action-type-rpc-call'], [EdgeEventActionType.RPC_CALL, 'edge-event.action-type-rpc-call'],
[EdgeEventActionType.ALARM_ACK, 'edge.edge-event-action-type-alarm-ack'], [EdgeEventActionType.ALARM_ACK, 'edge-event.action-type-alarm-ack'],
[EdgeEventActionType.ALARM_CLEAR, 'edge.edge-event-action-type-alarm-clear'], [EdgeEventActionType.ALARM_CLEAR, 'edge-event.action-type-alarm-clear'],
[EdgeEventActionType.ASSIGNED_TO_EDGE, 'edge.edge-event-action-type-assigned-to-edge'], [EdgeEventActionType.ASSIGNED_TO_EDGE, 'edge-event.action-type-assigned-to-edge'],
[EdgeEventActionType.UNASSIGNED_FROM_EDGE, 'edge.edge-event-action-type-unassigned-from-edge'], [EdgeEventActionType.UNASSIGNED_FROM_EDGE, 'edge-event.action-type-unassigned-from-edge'],
[EdgeEventActionType.CREDENTIALS_REQUEST, 'edge.edge-event-action-type-credentials-request'], [EdgeEventActionType.CREDENTIALS_REQUEST, 'edge-event.action-type-credentials-request'],
[EdgeEventActionType.ENTITY_MERGE_REQUEST, 'edge.edge-event-action-type-entity-merge-request'] [EdgeEventActionType.ENTITY_MERGE_REQUEST, 'edge-event.action-type-entity-merge-request']
] ]
); );

14
ui-ngx/src/assets/locale/locale.constant-de_DE.json

@ -1395,16 +1395,16 @@
"unassign-rulechains-from-edge-text": "Nach der Bestätigung wird die Zuordnung aller ausgewählten Regelketten aufgehoben und sie sind für den Rand nicht mehr zugänglich.", "unassign-rulechains-from-edge-text": "Nach der Bestätigung wird die Zuordnung aller ausgewählten Regelketten aufgehoben und sie sind für den Rand nicht mehr zugänglich.",
"assign-rulechain-to-edge-title": "Regelkette(n) dem Rand zuordnen", "assign-rulechain-to-edge-title": "Regelkette(n) dem Rand zuordnen",
"assign-rulechain-to-edge-text": "Bitte wählen Sie die Regelketten aus, die Sie dem Rand zuordnen möchten", "assign-rulechain-to-edge-text": "Bitte wählen Sie die Regelketten aus, die Sie dem Rand zuordnen möchten",
"set-default-root-edge": "Machen Sie Randregelkette zur Wurzel Standard", "set-edge-template-root-rulechain": "Erstellen Sie den Stamm der Regelkettenkantenvorlage",
"set-default-root-edge-rulechain-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' zur Wurzel machen Standard?", "set-edge-template-root-rulechain-title": "Möchten Sie die Kantenvorlage der Regelkette '{{ruleChainName}}' wirklich als Root festlegen?",
"set-default-root-edge-rulechain-text": "Nach der Bestätigung wird die Randregelkette zur Wurzel Standard und behandelt alle eingehenden Transportnachrichten.", "set-edge-template-root-rulechain-text": "Nach der Bestätigung wird die Regelkette zum Stamm der Kantenvorlage und zur Stammregelkette für neu erstellte Kanten.",
"invalid-rulechain-type-error": "Regelkette konnte nicht importiert werden: Ungültige Regelkettentyp. Erwarteter Typ ist {{expectedRuleChainType}}.", "invalid-rulechain-type-error": "Regelkette konnte nicht importiert werden: Ungültige Regelkettentyp. Erwarteter Typ ist {{expectedRuleChainType}}.",
"set-auto-assign-to-edge": "Ordnen Sie die Regelkette bei der Erstellung automatisch den Kanten zu", "set-auto-assign-to-edge": "Weisen Sie bei der Erstellung den Kanten die Regelkette zu",
"set-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung automatisch den Kanten zuweisen?", "set-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung automatisch den Kanten zuweisen?",
"set-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung automatisch den Kanten zugewiesen.", "set-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung automatisch den Kanten zugewiesen.",
"remove-default-edge": "Randregelkette Standard entfernen", "unset-auto-assign-to-edge": "Deaktiviert die Zuordnung der Regelkette zu Kanten bei der Erstellung",
"remove-default-edge-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' aus der Standardliste entfernen?", "unset-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung unbedingt den Kanten zuweisen?",
"remove-default-edge-text": "Nach der Bestätigung wird die Randregelkette nicht für neu erstellte Rand vergeben." "unset-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung nicht mehr automatisch den Kanten zugewiesen."
}, },
"rulenode": { "rulenode": {
"details": "Details", "details": "Details",

92
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1117,6 +1117,8 @@
"management": "Edge management", "management": "Edge management",
"no-edges-matching": "No edges matching '{{entity}}' were found.", "no-edges-matching": "No edges matching '{{entity}}' were found.",
"rulechain-templates": "Rule chain templates", "rulechain-templates": "Rule chain templates",
"rulechains": "Rule chains",
"edge-rulechains": "Edge Rule chains",
"add": "Add Edge", "add": "Add Edge",
"view": "View Edge", "view": "View Edge",
"no-edges-text": "No edges found", "no-edges-text": "No edges found",
@ -1133,8 +1135,10 @@
"name-required": "Name is required.", "name-required": "Name is required.",
"edge-license-key": "Edge License Key", "edge-license-key": "Edge License Key",
"edge-license-key-required": "Edge License Key is required.", "edge-license-key-required": "Edge License Key is required.",
"edge-license-key-hint": "To obtain your license please navigate to the <a href='https://thingsboard.io/pricing/?active=thingsboard-edge' target='_blank'>pricing page</a> and select the best license option for your case.",
"cloud-endpoint": "Cloud Endpoint", "cloud-endpoint": "Cloud Endpoint",
"cloud-endpoint-required": "Cloud Endpoint is required.", "cloud-endpoint-required": "Cloud Endpoint is required.",
"cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.",
"description": "Description", "description": "Description",
"entity-info": "Entity info", "entity-info": "Entity info",
"details": "Details", "details": "Details",
@ -1206,42 +1210,44 @@
"pending": "Pending", "pending": "Pending",
"downlinks": "Downlinks", "downlinks": "Downlinks",
"no-downlinks-prompt": "No downlinks found", "no-downlinks-prompt": "No downlinks found",
"edge-event-type-dashboard": "Dashboard",
"edge-event-type-asset": "Asset",
"edge-event-type-device": "Device",
"edge-event-type-device-profile": "Device Profile",
"edge-event-type-entity-view": "Entity View",
"edge-event-type-alarm": "Alar",
"edge-event-type-rule-chain": "Rule Chain",
"edge-event-type-rule-chain-metadata": "Rule Chain Metadata",
"edge-event-type-edge": "Edge",
"edge-event-type-user": "User",
"edge-event-type-customer": "Customer",
"edge-event-type-relation": "Relation",
"edge-event-type-widgets-bundle": "Widgets Bundle",
"edge-event-type-widgets-type": "Widgets Type",
"edge-event-type-admin-settings": "Admin Settings",
"edge-event-action-type-added": "Added",
"edge-event-action-type-deleted": "Deleted",
"edge-event-action-type-updated": "Updated",
"edge-event-action-type-post-attributes": "Post Attributes",
"edge-event-action-type-attributes-updated": "Attributes Updated",
"edge-event-action-type-attributes-deleted": "Attributes Deleted",
"edge-event-action-type-timeseries-updated": "Timeseries Updated",
"edge-event-action-type-credentials-updated": "Credentials Updated",
"edge-event-action-type-assigned-to-customer": "Assigned to Customer",
"edge-event-action-type-unassigned-from-customer": "Unassigned from Customer",
"edge-event-action-type-relation-add-or-update": "Relation Add or Update",
"edge-event-action-type-relation-deleted": "Relation Deleted",
"edge-event-action-type-rpc-call": "RPC Call",
"edge-event-action-type-alarm-ack": "Alarm Ack",
"edge-event-action-type-alarm-clear": "Alarm Clear",
"edge-event-action-type-assigned-to-edge": "Assigned to Edge",
"edge-event-action-type-unassigned-from-edge": "Unassigned from Edge",
"edge-event-action-type-credentials-request": "Credentials Request",
"edge-event-action-type-entity-merge-request": "Entity Merge Request",
"sync-process-started-successfully": "Sync process started successfully!" "sync-process-started-successfully": "Sync process started successfully!"
}, },
"edge-event": {
"type-dashboard": "Dashboard",
"type-asset": "Asset",
"type-device": "Device",
"type-device-profile": "Device Profile",
"type-entity-view": "Entity View",
"type-alarm": "Alar",
"type-rule-chain": "Rule Chain",
"type-rule-chain-metadata": "Rule Chain Metadata",
"type-edge": "Edge",
"type-user": "User",
"type-customer": "Customer",
"type-relation": "Relation",
"type-widgets-bundle": "Widgets Bundle",
"type-widgets-type": "Widgets Type",
"type-admin-settings": "Admin Settings",
"action-type-added": "Added",
"action-type-deleted": "Deleted",
"action-type-updated": "Updated",
"action-type-post-attributes": "Post Attributes",
"action-type-attributes-updated": "Attributes Updated",
"action-type-attributes-deleted": "Attributes Deleted",
"action-type-timeseries-updated": "Timeseries Updated",
"action-type-credentials-updated": "Credentials Updated",
"action-type-assigned-to-customer": "Assigned to Customer",
"action-type-unassigned-from-customer": "Unassigned from Customer",
"action-type-relation-add-or-update": "Relation Add or Update",
"action-type-relation-deleted": "Relation Deleted",
"action-type-rpc-call": "RPC Call",
"action-type-alarm-ack": "Alarm Ack",
"action-type-alarm-clear": "Alarm Clear",
"action-type-assigned-to-edge": "Assigned to Edge",
"action-type-unassigned-from-edge": "Unassigned from Edge",
"action-type-credentials-request": "Credentials Request",
"action-type-entity-merge-request": "Entity Merge Request"
},
"error": { "error": {
"unable-to-connect": "Unable to connect to the server! Please check your internet connection.", "unable-to-connect": "Unable to connect to the server! Please check your internet connection.",
"unhandled-error-code": "Unhandled error code: {{errorCode}}", "unhandled-error-code": "Unhandled error code: {{errorCode}}",
@ -2073,22 +2079,24 @@
"selected-rulechains": "{ count, plural, 1 {1 rule chain} other {# rule chains} } selected", "selected-rulechains": "{ count, plural, 1 {1 rule chain} other {# rule chains} } selected",
"open-rulechain": "Open rule chain", "open-rulechain": "Open rule chain",
"assign-new-rulechain": "Assign new rulechain", "assign-new-rulechain": "Assign new rulechain",
"edge-template-root": "Template Root",
"assign-to-edge": "Assign to Edge",
"edge-rulechain": "Edge Rule chain", "edge-rulechain": "Edge Rule chain",
"unassign-rulechain-from-edge-text": "After the confirmation the rulechain will be unassigned and won't be accessible by the edge.", "unassign-rulechain-from-edge-text": "After the confirmation the rulechain will be unassigned and won't be accessible by the edge.",
"unassign-rulechains-from-edge-title": "Are you sure you want to unassign { count, plural, 1 {1 rulechain} other {# rulechains} }?", "unassign-rulechains-from-edge-title": "Are you sure you want to unassign { count, plural, 1 {1 rulechain} other {# rulechains} }?",
"unassign-rulechains-from-edge-text": "After the confirmation all selected rulechains will be unassigned and won't be accessible by the edge.", "unassign-rulechains-from-edge-text": "After the confirmation all selected rulechains will be unassigned and won't be accessible by the edge.",
"assign-rulechain-to-edge-title": "Assign Rule Chain(s) To Edge", "assign-rulechain-to-edge-title": "Assign Rule Chain(s) To Edge",
"assign-rulechain-to-edge-text": "Please select the rulechains to assign to the edge", "assign-rulechain-to-edge-text": "Please select the rulechains to assign to the edge",
"set-default-root-edge": "Make rule chain default root", "set-edge-template-root-rulechain": "Make rule chain edge template root",
"set-default-root-edge-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' default edge root?", "set-edge-template-root-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' edge template root?",
"set-default-root-edge-rulechain-text": "After the confirmation the rule chain will become default edge root and will handle all incoming transport messages.", "set-edge-template-root-rulechain-text": "After the confirmation the rule chain will become edge template root and will be root rule chain for a newly created edges.",
"invalid-rulechain-type-error": "Unable to import rule chain: Invalid rule chain type. Expected type is {{expectedRuleChainType}}.", "invalid-rulechain-type-error": "Unable to import rule chain: Invalid rule chain type. Expected type is {{expectedRuleChainType}}.",
"set-auto-assign-to-edge": "Auto-assign rule chain to edge(s) on creation", "set-auto-assign-to-edge": "Assign rule chain to edge(s) on creation",
"set-auto-assign-to-edge-title": "Are you sure you want to auto-assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", "set-auto-assign-to-edge-title": "Are you sure you want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?",
"set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.", "set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.",
"remove-default-edge": "Remove rule chain from defaults", "unset-auto-assign-to-edge": "Unset assign rule chain to edge(s) on creation",
"remove-default-edge-title": "Are you sure you want to remove the edge rule chain '{{ruleChainName}}' from default list?", "unset-auto-assign-to-edge-title": "Are you sure you want to unset assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?",
"remove-default-edge-text": "After the confirmation the edge rule chain will not be assigned for a newly created edges.", "unset-auto-assign-to-edge-text": "After the confirmation the edge rule chain will no longer be automatically assigned to edge(s) on creation.",
"unassign-rulechain-title": "Are you sure you want to unassign the rulechain '{{ruleChainName}}'?", "unassign-rulechain-title": "Are you sure you want to unassign the rulechain '{{ruleChainName}}'?",
"unassign-rulechains": "Unassign rulechains" "unassign-rulechains": "Unassign rulechains"
}, },

14
ui-ngx/src/assets/locale/locale.constant-es_ES.json

@ -1566,16 +1566,16 @@
"unassign-rulechains-from-edge-text": "Después de la confirmación, todas las cadenas de reglas seleccionadas quedarán sin asignar y el borde no podrá acceder a ellas", "unassign-rulechains-from-edge-text": "Después de la confirmación, todas las cadenas de reglas seleccionadas quedarán sin asignar y el borde no podrá acceder a ellas",
"assign-rulechain-to-edge-title": "Asignar cadena (s) de reglas a borde", "assign-rulechain-to-edge-title": "Asignar cadena (s) de reglas a borde",
"assign-rulechain-to-edge-text": "Seleccione las cadenas de reglas para asignar al borde", "assign-rulechain-to-edge-text": "Seleccione las cadenas de reglas para asignar al borde",
"set-default-root-edge": "Hacer que la cadena de reglas sea la raíz predeterminada", "set-edge-template-root-rulechain": "Hacer raíz de plantilla de borde de cadena de reglas",
"set-default-root-edge-rulechain-title": "¿Está seguro de que desea hacer que la cadena de reglas '{{ruleChainName}}' sea la raíz de borde predeterminada?", "set-edge-template-root-rulechain-title": "¿Está seguro de que desea que la cadena de reglas '{{ruleChainName}}' sea la raíz de la plantilla de borde?",
"set-default-root-edge-rulechain-text": "Después de la confirmación, la cadena de reglas se convertirá en raíz raíz predeterminada y manejará todos los mensajes de transporte entrantes", "set-edge-template-root-rulechain-text": "Después de la confirmación, la cadena de reglas se convertirá en la raíz de la plantilla de borde y será la cadena de reglas raíz para los bordes recién creados.",
"invalid-rulechain-type-error": "No se puede importar la cadena de reglas: Tipo de cadena de reglas no válido. El tipo esperado es {{expectedRuleChainType}}", "invalid-rulechain-type-error": "No se puede importar la cadena de reglas: Tipo de cadena de reglas no válido. El tipo esperado es {{expectedRuleChainType}}",
"set-auto-assign-to-edge": "Asignar automáticamente la cadena de reglas a los bordes en la creación", "set-auto-assign-to-edge": "Asignar cadena de reglas a los bordes en la creación",
"set-auto-assign-to-edge-title": "¿Está seguro de que desea asignar automáticamente la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?", "set-auto-assign-to-edge-title": "¿Está seguro de que desea asignar automáticamente la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?",
"set-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde se asignará automáticamente a los bordes en la creación.", "set-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde se asignará automáticamente a los bordes en la creación.",
"remove-default-edge": "Eliminar la cadena de regla de borde de los valores predeterminados", "unset-auto-assign-to-edge": "Desmarcar asignar cadena de reglas a los bordes en la creación",
"remove-default-edge-title": "¿Está seguro de que desea eliminar la cadena de reglas de borde '{{ruleChainName}}' de la lista predeterminada?", "unset-auto-assign-to-edge-title": "¿Está seguro de que desea anular la asignación de la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?",
"remove-default-edge-text": "Después de la confirmación, la cadena de reglas de borde no se asignará a los bordes recién creados" "unset-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde ya no se asignará automáticamente a los bordes en la creación."
}, },
"rulenode": { "rulenode": {
"details": "Detalles", "details": "Detalles",

14
ui-ngx/src/assets/locale/locale.constant-fr_FR.json

@ -1440,16 +1440,16 @@
"unassign-rulechains-from-edge-text": "Après la confirmation, tous les chaînes de règles sélectionnés ne seront pas attribués et ne seront pas accessibles a la bordure.", "unassign-rulechains-from-edge-text": "Après la confirmation, tous les chaînes de règles sélectionnés ne seront pas attribués et ne seront pas accessibles a la bordure.",
"assign-rulechain-to-edge-title": "Attribuer les chaînes de règles a la bordure", "assign-rulechain-to-edge-title": "Attribuer les chaînes de règles a la bordure",
"assign-rulechain-to-edge-text": "Veuillez sélectionner la bordure pour attribuer le ou les chaînes de règles", "assign-rulechain-to-edge-text": "Veuillez sélectionner la bordure pour attribuer le ou les chaînes de règles",
"set-default-root-edge": "Définir la racine par défaut de la chaîne de règles", "set-edge-template-root-rulechain": "Rendre le modèle de bord de chaîne de règles racine",
"set-default-root-edge-rulechain-title": "AVoulez-vous vraiment créer de chaînes de règles par défaut '{{ruleChainName}}'?", "set-edge-template-root-rulechain-title": "Voulez-vous vraiment définir la racine du modèle d'arête de la chaîne de règles '{{ruleChainName}}'?",
"set-default-root-edge-rulechain-text": "Après la confirmation, la chaîne de règles deviendra la racine de la bordure par défaut et gérera tous les messages de transport entrants.", "set-edge-template-root-rulechain-text": "Après la confirmation, la chaîne de règles deviendra la racine du modèle d'arête et sera la chaîne de règles racine pour les arêtes nouvellement créées.",
"invalid-rulechain-type-error": "Impossible d'importer la chaîne de règles: type de chaîne de règles non valide. Le type attendu est {{attenduRuleChainType}}.", "invalid-rulechain-type-error": "Impossible d'importer la chaîne de règles: type de chaîne de règles non valide. Le type attendu est {{attenduRuleChainType}}.",
"set-auto-assign-to-edge": "Assigner automatiquement la chaîne de règles aux arêtes lors de la création", "set-auto-assign-to-edge": "Attribuer une chaîne de règles aux arêtes lors de la création",
"set-auto-assign-to-edge-title": "Voulez-vous vraiment attribuer automatiquement la chaîne de règles d'arête '{{ruleChainName}}' à l'arête (s) lors de la création?", "set-auto-assign-to-edge-title": "Voulez-vous vraiment attribuer automatiquement la chaîne de règles d'arête '{{ruleChainName}}' à l'arête (s) lors de la création?",
"set-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arête sera automatiquement affectée à l'arête (s) lors de la création.", "set-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arête sera automatiquement affectée à l'arête (s) lors de la création.",
"remove-default-edge": "Supprimer la chaîne de règles de la bordure des valeurs par défaut", "unset-auto-assign-to-edge": "Non défini, attribuer une chaîne de règles aux arêtes lors de la création",
"remove-default-edge-title": "Voulez-vous vraiment supprimer la chaîne de règles de la bordure '{{ruleChainName}}' de la liste par défaut", "unset-auto-assign-to-edge-title": "Voulez-vous vraiment annuler l'attribution de la chaîne de règles d'arête \"{{ruleChainName}}\" aux arêtes lors de la création?",
"remove-default-edge-text": "Après la confirmation, la chaîne de règles d'arête ne sera pas affectée aux arêtes nouvellement créées." "unset-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arêtes ne sera plus automatiquement affectée aux arêtes lors de la création."
}, },
"rulenode": { "rulenode": {
"add": "Ajouter un noeud de règle", "add": "Ajouter un noeud de règle",

Loading…
Cancel
Save