Showing
30 changed files
with
334 additions
and
257 deletions
... | ... | @@ -108,7 +108,7 @@ public class EdgeController extends BaseController { |
108 | 108 | |
109 | 109 | RuleChain defaultRootEdgeRuleChain = null; |
110 | 110 | if (created) { |
111 | - defaultRootEdgeRuleChain = ruleChainService.getDefaultRootEdgeRuleChain(tenantId); | |
111 | + defaultRootEdgeRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenantId); | |
112 | 112 | if (defaultRootEdgeRuleChain == null) { |
113 | 113 | throw new DataValidationException("Root edge rule chain is not available!"); |
114 | 114 | } | ... | ... |
... | ... | @@ -50,7 +50,6 @@ import org.thingsboard.server.common.data.id.RuleNodeId; |
50 | 50 | import org.thingsboard.server.common.data.id.TenantId; |
51 | 51 | import org.thingsboard.server.common.data.page.PageData; |
52 | 52 | import org.thingsboard.server.common.data.page.PageLink; |
53 | -import org.thingsboard.server.common.data.page.TimePageLink; | |
54 | 53 | import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; |
55 | 54 | import org.thingsboard.server.common.data.rule.DefaultRuleChainCreateRequest; |
56 | 55 | import org.thingsboard.server.common.data.rule.RuleChain; |
... | ... | @@ -556,14 +555,14 @@ public class RuleChainController extends BaseController { |
556 | 555 | } |
557 | 556 | |
558 | 557 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
559 | - @RequestMapping(value = "/ruleChain/{ruleChainId}/defaultRootEdge", method = RequestMethod.POST) | |
558 | + @RequestMapping(value = "/ruleChain/{ruleChainId}/edgeTemplateRoot", method = RequestMethod.POST) | |
560 | 559 | @ResponseBody |
561 | - public RuleChain setDefaultRootEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
560 | + public RuleChain setEdgeTemplateRootRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
562 | 561 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
563 | 562 | try { |
564 | 563 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
565 | 564 | RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); |
566 | - ruleChainService.setDefaultRootEdgeRuleChain(getTenantId(), ruleChainId); | |
565 | + ruleChainService.setEdgeTemplateRootRuleChain(getTenantId(), ruleChainId); | |
567 | 566 | return ruleChain; |
568 | 567 | } catch (Exception e) { |
569 | 568 | logEntityAction(emptyId(EntityType.RULE_CHAIN), |
... | ... | @@ -575,14 +574,14 @@ public class RuleChainController extends BaseController { |
575 | 574 | } |
576 | 575 | |
577 | 576 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
578 | - @RequestMapping(value = "/ruleChain/{ruleChainId}/defaultEdge", method = RequestMethod.POST) | |
577 | + @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.POST) | |
579 | 578 | @ResponseBody |
580 | - public RuleChain addDefaultEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
579 | + public RuleChain setAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
581 | 580 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
582 | 581 | try { |
583 | 582 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
584 | 583 | RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); |
585 | - ruleChainService.addDefaultEdgeRuleChain(getTenantId(), ruleChainId); | |
584 | + ruleChainService.setAutoAssignToEdgeRuleChain(getTenantId(), ruleChainId); | |
586 | 585 | return ruleChain; |
587 | 586 | } catch (Exception e) { |
588 | 587 | logEntityAction(emptyId(EntityType.RULE_CHAIN), |
... | ... | @@ -594,14 +593,14 @@ public class RuleChainController extends BaseController { |
594 | 593 | } |
595 | 594 | |
596 | 595 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
597 | - @RequestMapping(value = "/ruleChain/{ruleChainId}/defaultEdge", method = RequestMethod.DELETE) | |
596 | + @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.DELETE) | |
598 | 597 | @ResponseBody |
599 | - public RuleChain removeDefaultEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
598 | + public RuleChain unsetAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
600 | 599 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
601 | 600 | try { |
602 | 601 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
603 | 602 | RuleChain ruleChain = checkRuleChain(ruleChainId, Operation.WRITE); |
604 | - ruleChainService.removeDefaultEdgeRuleChain(getTenantId(), ruleChainId); | |
603 | + ruleChainService.unsetAutoAssignToEdgeRuleChain(getTenantId(), ruleChainId); | |
605 | 604 | return ruleChain; |
606 | 605 | } catch (Exception e) { |
607 | 606 | logEntityAction(emptyId(EntityType.RULE_CHAIN), |
... | ... | @@ -613,12 +612,12 @@ public class RuleChainController extends BaseController { |
613 | 612 | } |
614 | 613 | |
615 | 614 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
616 | - @RequestMapping(value = "/ruleChain/defaultEdgeRuleChains", method = RequestMethod.GET) | |
615 | + @RequestMapping(value = "/ruleChain/autoAssignToEdgeRuleChains", method = RequestMethod.GET) | |
617 | 616 | @ResponseBody |
618 | - public List<RuleChain> getDefaultEdgeRuleChains() throws ThingsboardException { | |
617 | + public List<RuleChain> getAutoAssignToEdgeRuleChains() throws ThingsboardException { | |
619 | 618 | try { |
620 | 619 | TenantId tenantId = getCurrentUser().getTenantId(); |
621 | - return checkNotNull(ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId)).get(); | |
620 | + return checkNotNull(ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId)).get(); | |
622 | 621 | } catch (Exception e) { |
623 | 622 | throw handleException(e); |
624 | 623 | } | ... | ... |
... | ... | @@ -165,10 +165,11 @@ public final class EdgeGrpcSession implements Closeable { |
165 | 165 | .build()); |
166 | 166 | if (ConnectResponseCode.ACCEPTED != responseMsg.getResponseCode()) { |
167 | 167 | outputStream.onError(new RuntimeException(responseMsg.getErrorMsg())); |
168 | + } else { | |
169 | + connected = true; | |
168 | 170 | } |
169 | 171 | } |
170 | - if (!connected && requestMsg.getMsgType().equals(RequestMsgType.SYNC_REQUEST_RPC_MESSAGE)) { | |
171 | - connected = true; | |
172 | + if (connected && requestMsg.getMsgType().equals(RequestMsgType.SYNC_REQUEST_RPC_MESSAGE)) { | |
172 | 173 | ctx.getSyncEdgeService().sync(edge); |
173 | 174 | } |
174 | 175 | if (connected) { | ... | ... |
... | ... | @@ -128,7 +128,7 @@ public class DefaultDataUpdateService implements DataUpdateService { |
128 | 128 | @Override |
129 | 129 | protected void updateEntity(Tenant tenant) { |
130 | 130 | try { |
131 | - RuleChain defaultEdgeRuleChain = ruleChainService.getDefaultRootEdgeRuleChain(tenant.getId()); | |
131 | + RuleChain defaultEdgeRuleChain = ruleChainService.getEdgeTemplateRootRuleChain(tenant.getId()); | |
132 | 132 | if (defaultEdgeRuleChain == null) { |
133 | 133 | installScripts.createDefaultEdgeRuleChains(tenant.getId()); |
134 | 134 | } | ... | ... |
... | ... | @@ -79,14 +79,14 @@ public interface RuleChainService { |
79 | 79 | |
80 | 80 | PageData<RuleChain> findRuleChainsByTenantIdAndEdgeId(TenantId tenantId, EdgeId edgeId, PageLink pageLink); |
81 | 81 | |
82 | - RuleChain getDefaultRootEdgeRuleChain(TenantId tenantId); | |
82 | + RuleChain getEdgeTemplateRootRuleChain(TenantId tenantId); | |
83 | 83 | |
84 | - boolean setDefaultRootEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); | |
84 | + boolean setEdgeTemplateRootRuleChain(TenantId tenantId, RuleChainId ruleChainId); | |
85 | 85 | |
86 | - boolean addDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); | |
86 | + boolean setAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); | |
87 | 87 | |
88 | - boolean removeDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); | |
88 | + boolean unsetAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId); | |
89 | 89 | |
90 | - ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(TenantId tenantId); | |
90 | + ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(TenantId tenantId); | |
91 | 91 | |
92 | 92 | } | ... | ... |
... | ... | @@ -373,7 +373,7 @@ public class EdgeServiceImpl extends AbstractEntityService implements EdgeServic |
373 | 373 | @Override |
374 | 374 | public void assignDefaultRuleChainsToEdge(TenantId tenantId, EdgeId edgeId) { |
375 | 375 | log.trace("Executing assignDefaultRuleChainsToEdge, tenantId [{}], edgeId [{}]", tenantId, edgeId); |
376 | - ListenableFuture<List<RuleChain>> future = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId); | |
376 | + ListenableFuture<List<RuleChain>> future = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId); | |
377 | 377 | Futures.addCallback(future, new FutureCallback<List<RuleChain>>() { |
378 | 378 | @Override |
379 | 379 | public void onSuccess(List<RuleChain> ruleChains) { | ... | ... |
... | ... | @@ -624,21 +624,21 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC |
624 | 624 | } |
625 | 625 | |
626 | 626 | @Override |
627 | - public RuleChain getDefaultRootEdgeRuleChain(TenantId tenantId) { | |
627 | + public RuleChain getEdgeTemplateRootRuleChain(TenantId tenantId) { | |
628 | 628 | return getRootRuleChainByType(tenantId, RuleChainType.EDGE); |
629 | 629 | } |
630 | 630 | |
631 | 631 | @Override |
632 | - public boolean setDefaultRootEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { | |
632 | + public boolean setEdgeTemplateRootRuleChain(TenantId tenantId, RuleChainId ruleChainId) { | |
633 | 633 | RuleChain ruleChain = ruleChainDao.findById(tenantId, ruleChainId.getId()); |
634 | - RuleChain previousDefaultRootEdgeRuleChain = getDefaultRootEdgeRuleChain(ruleChain.getTenantId()); | |
635 | - if (previousDefaultRootEdgeRuleChain == null || !previousDefaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) { | |
634 | + RuleChain previousEdgeTemplateRootRuleChain = getEdgeTemplateRootRuleChain(ruleChain.getTenantId()); | |
635 | + if (previousEdgeTemplateRootRuleChain == null || !previousEdgeTemplateRootRuleChain.getId().equals(ruleChain.getId())) { | |
636 | 636 | try { |
637 | - if (previousDefaultRootEdgeRuleChain != null) { | |
638 | - deleteRelation(tenantId, new EntityRelation(previousDefaultRootEdgeRuleChain.getTenantId(), previousDefaultRootEdgeRuleChain.getId(), | |
637 | + if (previousEdgeTemplateRootRuleChain != null) { | |
638 | + deleteRelation(tenantId, new EntityRelation(previousEdgeTemplateRootRuleChain.getTenantId(), previousEdgeTemplateRootRuleChain.getId(), | |
639 | 639 | EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN)); |
640 | - previousDefaultRootEdgeRuleChain.setRoot(false); | |
641 | - ruleChainDao.save(tenantId, previousDefaultRootEdgeRuleChain); | |
640 | + previousEdgeTemplateRootRuleChain.setRoot(false); | |
641 | + ruleChainDao.save(tenantId, previousEdgeTemplateRootRuleChain); | |
642 | 642 | } |
643 | 643 | createRelation(tenantId, new EntityRelation(ruleChain.getTenantId(), ruleChain.getId(), |
644 | 644 | EntityRelation.CONTAINS_TYPE, RelationTypeGroup.RULE_CHAIN)); |
... | ... | @@ -646,7 +646,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC |
646 | 646 | ruleChainDao.save(tenantId, ruleChain); |
647 | 647 | return true; |
648 | 648 | } catch (Exception e) { |
649 | - log.warn("Failed to set default root edge rule chain, ruleChainId: [{}]", ruleChainId, e); | |
649 | + log.warn("Failed to set edge template root rule chain, ruleChainId: [{}]", ruleChainId, e); | |
650 | 650 | throw new RuntimeException(e); |
651 | 651 | } |
652 | 652 | } |
... | ... | @@ -654,34 +654,34 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC |
654 | 654 | } |
655 | 655 | |
656 | 656 | @Override |
657 | - public boolean addDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { | |
657 | + public boolean setAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { | |
658 | 658 | try { |
659 | 659 | createRelation(tenantId, new EntityRelation(tenantId, ruleChainId, |
660 | - EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN)); | |
660 | + EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN)); | |
661 | 661 | return true; |
662 | 662 | } catch (Exception e) { |
663 | - log.warn("Failed to add default edge rule chain, ruleChainId: [{}]", ruleChainId, e); | |
663 | + log.warn("Failed to set auto assign to edge rule chain, ruleChainId: [{}]", ruleChainId, e); | |
664 | 664 | throw new RuntimeException(e); |
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | 668 | @Override |
669 | - public boolean removeDefaultEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { | |
669 | + public boolean unsetAutoAssignToEdgeRuleChain(TenantId tenantId, RuleChainId ruleChainId) { | |
670 | 670 | try { |
671 | 671 | deleteRelation(tenantId, new EntityRelation(tenantId, ruleChainId, |
672 | - EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN)); | |
672 | + EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN)); | |
673 | 673 | return true; |
674 | 674 | } catch (Exception e) { |
675 | - log.warn("Failed to remove default edge rule chain, ruleChainId: [{}]", ruleChainId, e); | |
675 | + log.warn("Failed to unset auto assign to edge rule chain, ruleChainId: [{}]", ruleChainId, e); | |
676 | 676 | throw new RuntimeException(e); |
677 | 677 | } |
678 | 678 | } |
679 | 679 | |
680 | 680 | @Override |
681 | - public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(TenantId tenantId) { | |
682 | - log.trace("Executing findDefaultEdgeRuleChainsByTenantId, tenantId [{}]", tenantId); | |
681 | + public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(TenantId tenantId) { | |
682 | + log.trace("Executing findAutoAssignToEdgeRuleChainsByTenantId, tenantId [{}]", tenantId); | |
683 | 683 | validateId(tenantId, INCORRECT_TENANT_ID + tenantId); |
684 | - return ruleChainDao.findDefaultEdgeRuleChainsByTenantId(tenantId.getId()); | |
684 | + return ruleChainDao.findAutoAssignToEdgeRuleChainsByTenantId(tenantId.getId()); | |
685 | 685 | } |
686 | 686 | |
687 | 687 | |
... | ... | @@ -749,7 +749,7 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC |
749 | 749 | } |
750 | 750 | } |
751 | 751 | if (ruleChain.isRoot() && RuleChainType.EDGE.equals(ruleChain.getType())) { |
752 | - RuleChain defaultRootEdgeRuleChain = getDefaultRootEdgeRuleChain(ruleChain.getTenantId()); | |
752 | + RuleChain defaultRootEdgeRuleChain = getEdgeTemplateRootRuleChain(ruleChain.getTenantId()); | |
753 | 753 | if (defaultRootEdgeRuleChain != null && !defaultRootEdgeRuleChain.getId().equals(ruleChain.getId())) { |
754 | 754 | throw new DataValidationException("Another default root edge rule chain is present in scope of current tenant!"); |
755 | 755 | } | ... | ... |
... | ... | @@ -61,10 +61,10 @@ public interface RuleChainDao extends Dao<RuleChain>, TenantEntityDao { |
61 | 61 | PageData<RuleChain> findRuleChainsByTenantIdAndEdgeId(UUID tenantId, UUID edgeId, PageLink pageLink); |
62 | 62 | |
63 | 63 | /** |
64 | - * Find default edge rule chains by tenantId. | |
64 | + * Find auto assign to edge rule chains by tenantId. | |
65 | 65 | * |
66 | 66 | * @param tenantId the tenantId |
67 | 67 | * @return the list of rule chain objects |
68 | 68 | */ |
69 | - ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId); | |
69 | + ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId); | |
70 | 70 | } | ... | ... |
... | ... | @@ -95,10 +95,10 @@ public class JpaRuleChainDao extends JpaAbstractSearchTextDao<RuleChainEntity, R |
95 | 95 | } |
96 | 96 | |
97 | 97 | @Override |
98 | - public ListenableFuture<List<RuleChain>> findDefaultEdgeRuleChainsByTenantId(UUID tenantId) { | |
99 | - log.debug("Try to find default edge rule chains by tenantId [{}]", tenantId); | |
98 | + public ListenableFuture<List<RuleChain>> findAutoAssignToEdgeRuleChainsByTenantId(UUID tenantId) { | |
99 | + log.debug("Try to find auto assign to edge rule chains by tenantId [{}]", tenantId); | |
100 | 100 | ListenableFuture<List<EntityRelation>> relations = |
101 | - relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_DEFAULT_RULE_CHAIN); | |
101 | + relationDao.findAllByFromAndType(new TenantId(tenantId), new TenantId(tenantId), EntityRelation.CONTAINS_TYPE, RelationTypeGroup.EDGE_AUTO_ASSIGN_RULE_CHAIN); | |
102 | 102 | return Futures.transformAsync(relations, input -> { |
103 | 103 | if (input != null && !input.isEmpty()) { |
104 | 104 | List<ListenableFuture<RuleChain>> ruleChainsFutures = new ArrayList<>(input.size()); | ... | ... |
... | ... | @@ -331,24 +331,24 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest { |
331 | 331 | |
332 | 332 | @Test |
333 | 333 | public void testGetDefaultEdgeRuleChains() throws Exception { |
334 | - RuleChainId ruleChainId = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 1"); | |
335 | - saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 2"); | |
336 | - List<RuleChain> result = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId).get(); | |
334 | + RuleChainId ruleChainId = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1"); | |
335 | + saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2"); | |
336 | + List<RuleChain> result = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId).get(); | |
337 | 337 | Assert.assertEquals(2, result.size()); |
338 | 338 | |
339 | - ruleChainService.removeDefaultEdgeRuleChain(tenantId, ruleChainId); | |
339 | + ruleChainService.unsetAutoAssignToEdgeRuleChain(tenantId, ruleChainId); | |
340 | 340 | |
341 | - result = ruleChainService.findDefaultEdgeRuleChainsByTenantId(tenantId).get(); | |
341 | + result = ruleChainService.findAutoAssignToEdgeRuleChainsByTenantId(tenantId).get(); | |
342 | 342 | Assert.assertEquals(1, result.size()); |
343 | 343 | } |
344 | 344 | |
345 | 345 | @Test |
346 | - public void setDefaultRootEdgeRuleChain() throws Exception { | |
347 | - RuleChainId ruleChainId1 = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 1"); | |
348 | - RuleChainId ruleChainId2 = saveRuleChainAndSetDefaultEdge("Default Edge Rule Chain 2"); | |
346 | + public void setEdgeTemplateRootRuleChain() throws Exception { | |
347 | + RuleChainId ruleChainId1 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 1"); | |
348 | + RuleChainId ruleChainId2 = saveRuleChainAndSetAutoAssignToEdge("Default Edge Rule Chain 2"); | |
349 | 349 | |
350 | - ruleChainService.setDefaultRootEdgeRuleChain(tenantId, ruleChainId1); | |
351 | - ruleChainService.setDefaultRootEdgeRuleChain(tenantId, ruleChainId2); | |
350 | + ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId1); | |
351 | + ruleChainService.setEdgeTemplateRootRuleChain(tenantId, ruleChainId2); | |
352 | 352 | |
353 | 353 | RuleChain ruleChainById = ruleChainService.findRuleChainById(tenantId, ruleChainId1); |
354 | 354 | Assert.assertFalse(ruleChainById.isRoot()); |
... | ... | @@ -357,13 +357,13 @@ public abstract class BaseRuleChainServiceTest extends AbstractServiceTest { |
357 | 357 | Assert.assertTrue(ruleChainById.isRoot()); |
358 | 358 | } |
359 | 359 | |
360 | - private RuleChainId saveRuleChainAndSetDefaultEdge(String name) { | |
360 | + private RuleChainId saveRuleChainAndSetAutoAssignToEdge(String name) { | |
361 | 361 | RuleChain edgeRuleChain = new RuleChain(); |
362 | 362 | edgeRuleChain.setTenantId(tenantId); |
363 | 363 | edgeRuleChain.setType(RuleChainType.EDGE); |
364 | 364 | edgeRuleChain.setName(name); |
365 | 365 | RuleChain savedEdgeRuleChain = ruleChainService.saveRuleChain(edgeRuleChain); |
366 | - ruleChainService.addDefaultEdgeRuleChain(tenantId, savedEdgeRuleChain.getId()); | |
366 | + ruleChainService.setAutoAssignToEdgeRuleChain(tenantId, savedEdgeRuleChain.getId()); | |
367 | 367 | return savedEdgeRuleChain.getId(); |
368 | 368 | } |
369 | 369 | ... | ... |
... | ... | @@ -2676,7 +2676,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
2676 | 2676 | }, params).getBody(); |
2677 | 2677 | } |
2678 | 2678 | |
2679 | - public Optional<RuleChain> addDefaultEdgeRuleChain(RuleChainId ruleChainId) { | |
2679 | + public Optional<RuleChain> setAutoAssignToEdgeRuleChain(RuleChainId ruleChainId) { | |
2680 | 2680 | try { |
2681 | 2681 | ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", null, RuleChain.class, ruleChainId.getId()); |
2682 | 2682 | return Optional.ofNullable(ruleChain.getBody()); |
... | ... | @@ -2689,7 +2689,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
2689 | 2689 | } |
2690 | 2690 | } |
2691 | 2691 | |
2692 | - public Optional<RuleChain> removeDefaultEdgeRuleChain(RuleChainId ruleChainId) { | |
2692 | + public Optional<RuleChain> unsetAutoAssignToEdgeRuleChain(RuleChainId ruleChainId) { | |
2693 | 2693 | try { |
2694 | 2694 | ResponseEntity<RuleChain> ruleChain = restTemplate.exchange(baseURL + "/api/ruleChain/{ruleChainId}/defaultEdge", HttpMethod.DELETE, HttpEntity.EMPTY, RuleChain.class, ruleChainId.getId()); |
2695 | 2695 | return Optional.ofNullable(ruleChain.getBody()); |
... | ... | @@ -2702,7 +2702,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
2702 | 2702 | } |
2703 | 2703 | } |
2704 | 2704 | |
2705 | - public List<RuleChain> getDefaultEdgeRuleChains() { | |
2705 | + public List<RuleChain> getAutoAssignToEdgeRuleChains() { | |
2706 | 2706 | return restTemplate.exchange(baseURL + "/api/ruleChain/defaultEdgeRuleChains", |
2707 | 2707 | HttpMethod.GET, |
2708 | 2708 | HttpEntity.EMPTY, |
... | ... | @@ -2710,9 +2710,9 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
2710 | 2710 | }).getBody(); |
2711 | 2711 | } |
2712 | 2712 | |
2713 | - public Optional<RuleChain> setDefaultRootEdgeRuleChain(RuleChainId ruleChainId) { | |
2713 | + public Optional<RuleChain> setRootEdgeTemplateRuleChain(RuleChainId ruleChainId) { | |
2714 | 2714 | try { |
2715 | - ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/defaultRootEdge", null, RuleChain.class, ruleChainId.getId()); | |
2715 | + ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/edgeTemplateRoot", null, RuleChain.class, ruleChainId.getId()); | |
2716 | 2716 | return Optional.ofNullable(ruleChain.getBody()); |
2717 | 2717 | } catch (HttpClientErrorException exception) { |
2718 | 2718 | if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { | ... | ... |
... | ... | @@ -565,6 +565,8 @@ export class EntityService { |
565 | 565 | return entityType === EntityType.ENTITY_VIEW; |
566 | 566 | case AliasFilterType.relationsQuery: |
567 | 567 | return true; |
568 | + case AliasFilterType.apiUsageState: | |
569 | + return true; | |
568 | 570 | case AliasFilterType.assetSearchQuery: |
569 | 571 | return entityType === EntityType.ASSET; |
570 | 572 | case AliasFilterType.deviceSearchQuery: | ... | ... |
... | ... | @@ -313,20 +313,20 @@ export class RuleChainService { |
313 | 313 | return this.http.delete(`/api/edge/${edgeId}/ruleChain/${ruleChainId}`, defaultHttpOptionsFromConfig(config)); |
314 | 314 | } |
315 | 315 | |
316 | - public setDefaultRootEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { | |
317 | - return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/defaultRootEdge`, defaultHttpOptionsFromConfig(config)); | |
316 | + public setEdgeTemplateRootRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { | |
317 | + return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/edgeTemplateRoot`, defaultHttpOptionsFromConfig(config)); | |
318 | 318 | } |
319 | 319 | |
320 | - public addDefaultEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { | |
321 | - return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/defaultEdge`, defaultHttpOptionsFromConfig(config)); | |
320 | + public setAutoAssignToEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { | |
321 | + return this.http.post<RuleChain>(`/api/ruleChain/${ruleChainId}/autoAssignToEdge`, defaultHttpOptionsFromConfig(config)); | |
322 | 322 | } |
323 | 323 | |
324 | - public removeDefaultEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { | |
325 | - return this.http.delete<RuleChain>(`/api/ruleChain/${ruleChainId}/defaultEdge`, defaultHttpOptionsFromConfig(config)); | |
324 | + public unsetAutoAssignToEdgeRuleChain(ruleChainId: string, config?: RequestConfig): Observable<RuleChain> { | |
325 | + return this.http.delete<RuleChain>(`/api/ruleChain/${ruleChainId}/autoAssignToEdge`, defaultHttpOptionsFromConfig(config)); | |
326 | 326 | } |
327 | 327 | |
328 | - public getDefaultEdgeRuleChains(config?: RequestConfig): Observable<Array<RuleChain>> { | |
329 | - return this.http.get<Array<RuleChain>>(`/api/ruleChain/defaultEdgeRuleChains`, defaultHttpOptionsFromConfig(config)); | |
328 | + public getAutoAssignToEdgeRuleChains(config?: RequestConfig): Observable<Array<RuleChain>> { | |
329 | + return this.http.get<Array<RuleChain>>(`/api/ruleChain/autoAssignToEdgeRuleChains`, defaultHttpOptionsFromConfig(config)); | |
330 | 330 | } |
331 | 331 | |
332 | 332 | public setEdgeRootRuleChain(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable<Edge> { | ... | ... |
... | ... | @@ -46,7 +46,7 @@ export interface EntityAliasesDialogData { |
46 | 46 | widgets: Array<Widget>; |
47 | 47 | isSingleEntityAlias?: boolean; |
48 | 48 | isSingleWidget?: boolean; |
49 | - allowedEntityTypes?: Array<AliasEntityType>; | |
49 | + allowedEntityTypes?: Array<EntityType | AliasEntityType>; | |
50 | 50 | disableAdd?: boolean; |
51 | 51 | singleEntityAlias?: EntityAlias; |
52 | 52 | customTitle?: string; | ... | ... |
... | ... | @@ -81,8 +81,7 @@ export abstract class EntityComponent<T extends BaseData<HasId>, |
81 | 81 | protected constructor(protected store: Store<AppState>, |
82 | 82 | protected fb: FormBuilder, |
83 | 83 | protected entityValue: T, |
84 | - protected entitiesTableConfigValue: C, | |
85 | - @Inject(WINDOW) protected window?: Window) { | |
84 | + protected entitiesTableConfigValue: C) { | |
86 | 85 | super(store); |
87 | 86 | this.entityForm = this.buildForm(this.entityValue); |
88 | 87 | } | ... | ... |
... | ... | @@ -45,7 +45,7 @@ import { |
45 | 45 | } from '@home/components/alias/entity-aliases-dialog.component'; |
46 | 46 | import { ItemBufferService, WidgetItem } from '@core/services/item-buffer.service'; |
47 | 47 | import { FileType, ImportWidgetResult, JSON_TYPE, WidgetsBundleItem, ZIP_TYPE } from './import-export.models'; |
48 | -import { EntityType } from '@shared/models/entity-type.models'; | |
48 | +import { AliasEntityType, EntityType } from '@shared/models/entity-type.models'; | |
49 | 49 | import { UtilsService } from '@core/services/utils.service'; |
50 | 50 | import { WidgetService } from '@core/http/widget.service'; |
51 | 51 | import { NULL_UUID } from '@shared/models/id/has-uuid'; |
... | ... | @@ -603,6 +603,10 @@ export class ImportExportService { |
603 | 603 | |
604 | 604 | private editMissingAliases(widgets: Array<Widget>, isSingleWidget: boolean, |
605 | 605 | customTitle: string, missingEntityAliases: EntityAliases): Observable<EntityAliases> { |
606 | + // TODO: voba - double check with Igor/Vlad regarding this approach to hide aliases | |
607 | + let allowedEntityTypes: Array<EntityType | AliasEntityType> = | |
608 | + this.entityService.prepareAllowedEntityTypesList(null, true); | |
609 | + | |
606 | 610 | return this.dialog.open<EntityAliasesDialogComponent, EntityAliasesDialogData, |
607 | 611 | EntityAliases>(EntityAliasesDialogComponent, { |
608 | 612 | disableClose: true, |
... | ... | @@ -612,7 +616,8 @@ export class ImportExportService { |
612 | 616 | widgets, |
613 | 617 | customTitle, |
614 | 618 | isSingleWidget, |
615 | - disableAdd: true | |
619 | + disableAdd: true, | |
620 | + allowedEntityTypes: allowedEntityTypes | |
616 | 621 | } |
617 | 622 | }).afterClosed().pipe( |
618 | 623 | map((updatedEntityAliases) => { | ... | ... |
... | ... | @@ -99,6 +99,7 @@ import { ImportExportService } from '@home/components/import-export/import-expor |
99 | 99 | import { AuthState } from '@app/core/auth/auth.models'; |
100 | 100 | import { FiltersDialogComponent, FiltersDialogData } from '@home/components/filter/filters-dialog.component'; |
101 | 101 | import { Filters } from '@shared/models/query/query.models'; |
102 | +import { AliasEntityType, EntityType } from "@shared/models/entity-type.models"; | |
102 | 103 | |
103 | 104 | // @dynamic |
104 | 105 | @Component({ |
... | ... | @@ -142,6 +143,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC |
142 | 143 | isToolbarOpenedAnimate = false; |
143 | 144 | isRightLayoutOpened = false; |
144 | 145 | |
146 | + allowedEntityTypes: Array<EntityType | AliasEntityType> = null; | |
147 | + | |
145 | 148 | editingWidget: Widget = null; |
146 | 149 | editingWidgetLayout: WidgetLayout = null; |
147 | 150 | editingWidgetOriginal: Widget = null; |
... | ... | @@ -309,6 +312,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC |
309 | 312 | }; |
310 | 313 | this.window.parent.postMessage(JSON.stringify(message), '*'); |
311 | 314 | } |
315 | + | |
316 | + // TODO: voba - double check with Igor/Vlad regarding this approach to hide aliases | |
317 | + this.allowedEntityTypes = this.entityService.prepareAllowedEntityTypesList(null, true); | |
312 | 318 | } |
313 | 319 | |
314 | 320 | private reset() { |
... | ... | @@ -514,7 +520,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC |
514 | 520 | data: { |
515 | 521 | entityAliases: deepClone(this.dashboard.configuration.entityAliases), |
516 | 522 | widgets: this.dashboardUtils.getWidgetsArray(this.dashboard), |
517 | - isSingleEntityAlias: false | |
523 | + isSingleEntityAlias: false, | |
524 | + allowedEntityTypes: this.allowedEntityTypes | |
518 | 525 | } |
519 | 526 | }).afterClosed().subscribe((entityAliases) => { |
520 | 527 | if (entityAliases) { | ... | ... |
... | ... | @@ -134,22 +134,24 @@ |
134 | 134 | </tb-entity-subtype-autocomplete> |
135 | 135 | <div fxLayout="row"> |
136 | 136 | <fieldset fxFlex> |
137 | + <div class="tb-hint" [innerHTML]="'edge.edge-license-key-hint' | translate"></div> | |
137 | 138 | <mat-form-field class="mat-block"> |
138 | - <mat-label translate>edge.cloud-endpoint</mat-label> | |
139 | - <input matInput formControlName="cloudEndpoint" required> | |
140 | - <mat-error *ngIf="entityForm.get('cloudEndpoint').hasError('required')"> | |
141 | - {{ 'edge.cloud-endpoint-required' | translate }} | |
139 | + <mat-label translate>edge.edge-license-key</mat-label> | |
140 | + <input matInput formControlName="edgeLicenseKey" required> | |
141 | + <mat-error *ngIf="entityForm.get('edgeLicenseKey').hasError('required')"> | |
142 | + {{ 'edge.edge-license-key-required' | translate }} | |
142 | 143 | </mat-error> |
143 | 144 | </mat-form-field> |
144 | 145 | </fieldset> |
145 | 146 | </div> |
146 | 147 | <div fxLayout="row"> |
147 | 148 | <fieldset fxFlex> |
149 | + <div translate class="tb-hint">edge.cloud-endpoint-hint</div> | |
148 | 150 | <mat-form-field class="mat-block"> |
149 | - <mat-label translate>edge.edge-license-key</mat-label> | |
150 | - <input matInput formControlName="edgeLicenseKey" required> | |
151 | - <mat-error *ngIf="entityForm.get('edgeLicenseKey').hasError('required')"> | |
152 | - {{ 'edge.edge-license-key-required' | translate }} | |
151 | + <mat-label translate>edge.cloud-endpoint</mat-label> | |
152 | + <input matInput formControlName="cloudEndpoint" required> | |
153 | + <mat-error *ngIf="entityForm.get('cloudEndpoint').hasError('required')"> | |
154 | + {{ 'edge.cloud-endpoint-required' | translate }} | |
153 | 155 | </mat-error> |
154 | 156 | </mat-form-field> |
155 | 157 | </fieldset> | ... | ... |
... | ... | @@ -44,13 +44,15 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { |
44 | 44 | @Inject('entity') protected entityValue: EdgeInfo, |
45 | 45 | @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>, |
46 | 46 | public fb: FormBuilder, |
47 | - // TODO: voba - discuss with Vlad how properly add window to subclass | |
48 | 47 | @Inject(WINDOW) protected window: Window) { |
49 | - super(store, fb, entityValue, entitiesTableConfigValue, window); | |
48 | + super(store, fb, entityValue, entitiesTableConfigValue); | |
50 | 49 | } |
51 | 50 | |
52 | 51 | ngOnInit() { |
53 | 52 | this.edgeScope = this.entitiesTableConfig.componentsData.edgeScope; |
53 | + this.entityForm.patchValue({ | |
54 | + cloudEndpoint:this.window.location.origin | |
55 | + }); | |
54 | 56 | super.ngOnInit(); |
55 | 57 | } |
56 | 58 | |
... | ... | @@ -70,9 +72,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { |
70 | 72 | return this.fb.group( |
71 | 73 | { |
72 | 74 | name: [entity ? entity.name : '', [Validators.required]], |
73 | - type: [entity ? entity.type : null, [Validators.required]], | |
75 | + type: [entity?.type ? entity.type : 'default', [Validators.required]], | |
74 | 76 | label: [entity ? entity.label : ''], |
75 | - cloudEndpoint: [this.window.location.origin, [Validators.required]], | |
77 | + cloudEndpoint: [null, [Validators.required]], | |
76 | 78 | edgeLicenseKey: ['', [Validators.required]], |
77 | 79 | routingKey: guid(), |
78 | 80 | secret: this.generateSecret(20), |
... | ... | @@ -86,14 +88,14 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { |
86 | 88 | } |
87 | 89 | |
88 | 90 | updateForm(entity: EdgeInfo) { |
89 | - this.entityForm.patchValue({name: entity.name}); | |
90 | - this.entityForm.patchValue({type: entity.type}); | |
91 | - this.entityForm.patchValue({label: entity.label}); | |
92 | - this.entityForm.patchValue({cloudEndpoint: entity.cloudEndpoint}); | |
93 | - this.entityForm.patchValue({edgeLicenseKey: entity.edgeLicenseKey}); | |
94 | - this.entityForm.patchValue({routingKey: entity.routingKey}); | |
95 | - this.entityForm.patchValue({secret: entity.secret}); | |
96 | 91 | this.entityForm.patchValue({ |
92 | + name: entity.name, | |
93 | + type: entity.type, | |
94 | + label: entity.label, | |
95 | + cloudEndpoint: entity.cloudEndpoint ? entity.cloudEndpoint : this.window.location.origin, | |
96 | + edgeLicenseKey: entity.edgeLicenseKey, | |
97 | + routingKey: entity.routingKey, | |
98 | + secret: entity.secret, | |
97 | 99 | additionalInfo: { |
98 | 100 | description: entity.additionalInfo ? entity.additionalInfo.description : '' |
99 | 101 | } | ... | ... |
... | ... | @@ -19,13 +19,13 @@ |
19 | 19 | <button mat-raised-button color="primary" |
20 | 20 | [disabled]="(isLoading$ | async)" |
21 | 21 | (click)="onEntityAction($event, 'open')" |
22 | - [fxShow]="!isEdit"> | |
22 | + [fxShow]="!isEdit && (ruleChainScope === 'tenant' || ruleChainScope === 'edges')"> | |
23 | 23 | {{'rulechain.open-rulechain' | translate }} |
24 | 24 | </button> |
25 | 25 | <button mat-raised-button color="primary" |
26 | 26 | [disabled]="(isLoading$ | async)" |
27 | 27 | (click)="onEntityAction($event, 'export')" |
28 | - [fxShow]="!isEdit"> | |
28 | + [fxShow]="!isEdit && (ruleChainScope === 'tenant' || ruleChainScope === 'edges')"> | |
29 | 29 | {{'rulechain.export' | translate }} |
30 | 30 | </button> |
31 | 31 | <button mat-raised-button color="primary" |
... | ... | @@ -36,20 +36,38 @@ |
36 | 36 | </button> |
37 | 37 | <button mat-raised-button color="primary" |
38 | 38 | [disabled]="(isLoading$ | async)" |
39 | - (click)="onEntityAction($event, 'setDefaultRoot')" | |
39 | + (click)="onEntityAction($event, 'setEdgeTemplateRoot')" | |
40 | 40 | [fxShow]="!isEdit && !entity?.root && ruleChainScope === 'edges'"> |
41 | - {{'rulechain.set-default-root-edge' | translate }} | |
41 | + {{'rulechain.set-edge-template-root-rulechain' | translate }} | |
42 | + </button> | |
43 | + <button mat-raised-button color="primary" | |
44 | + [disabled]="(isLoading$ | async)" | |
45 | + (click)="onEntityAction($event, 'setAutoAssignToEdge')" | |
46 | + [fxShow]="!isEdit && isNotAutoAssignToEdgeRuleChain() && ruleChainScope === 'edges'"> | |
47 | + {{'rulechain.set-auto-assign-to-edge' | translate }} | |
48 | + </button> | |
49 | + <button mat-raised-button color="primary" | |
50 | + [disabled]="(isLoading$ | async)" | |
51 | + (click)="onEntityAction($event, 'unsetAutoAssignToEdge')" | |
52 | + [fxShow]="!isEdit && isAutoAssignToEdgeRuleChain() && ruleChainScope === 'edges'"> | |
53 | + {{'rulechain.unset-auto-assign-to-edge' | translate }} | |
42 | 54 | </button> |
43 | 55 | <button mat-raised-button color="primary" |
44 | 56 | [disabled]="(isLoading$ | async)" |
45 | 57 | (click)="onEntityAction($event, 'setRoot')" |
46 | - [fxShow]="!isEdit && !isRootRuleChain() && ruleChainScope === 'edge'"> | |
58 | + [fxShow]="!isEdit && !isEdgeRootRuleChain() && ruleChainScope === 'edge'"> | |
47 | 59 | {{'rulechain.set-root' | translate }} |
48 | 60 | </button> |
49 | 61 | <button mat-raised-button color="primary" |
50 | 62 | [disabled]="(isLoading$ | async)" |
63 | + (click)="onEntityAction($event, 'unassignFromEdge')" | |
64 | + [fxShow]="!isEdit && !isEdgeRootRuleChain() && ruleChainScope === 'edge'"> | |
65 | + {{'edge.unassign-from-edge' | translate }} | |
66 | + </button> | |
67 | + <button mat-raised-button color="primary" | |
68 | + [disabled]="(isLoading$ | async)" | |
51 | 69 | (click)="onEntityAction($event, 'delete')" |
52 | - [fxShow]="!hideDelete() && !isEdit"> | |
70 | + [fxShow]="!hideDelete() && !isEdit && (ruleChainScope === 'tenant' || ruleChainScope === 'edges')"> | |
53 | 71 | {{'rulechain.delete' | translate }} |
54 | 72 | </button> |
55 | 73 | <div fxLayout="row"> | ... | ... |
... | ... | @@ -86,9 +86,27 @@ export class RuleChainComponent extends EntityComponent<RuleChain> { |
86 | 86 | })); |
87 | 87 | } |
88 | 88 | |
89 | - isRootRuleChain() { | |
89 | + isEdgeRootRuleChain() { | |
90 | 90 | if (this.entitiesTableConfig && this.entityValue) { |
91 | - return this.entitiesTableConfig.componentsData.rootRuleChainId == this.entityValue.id.id; | |
91 | + return this.entitiesTableConfig.componentsData.edge?.rootRuleChainId?.id == this.entityValue.id.id; | |
92 | + } else { | |
93 | + return false; | |
94 | + } | |
95 | + } | |
96 | + | |
97 | + isAutoAssignToEdgeRuleChain() { | |
98 | + if (this.entitiesTableConfig && this.entityValue) { | |
99 | + return !this.entityValue.root && | |
100 | + this.entitiesTableConfig.componentsData?.autoAssignToEdgeRuleChainIds?.includes(this.entityValue.id.id); | |
101 | + } else { | |
102 | + return false; | |
103 | + } | |
104 | + } | |
105 | + | |
106 | + isNotAutoAssignToEdgeRuleChain() { | |
107 | + if (this.entitiesTableConfig && this.entityValue) { | |
108 | + return !this.entityValue.root && | |
109 | + !this.entitiesTableConfig.componentsData?.autoAssignToEdgeRuleChainIds?.includes(this.entityValue.id.id); | |
92 | 110 | } else { |
93 | 111 | return false; |
94 | 112 | } | ... | ... |
... | ... | @@ -14,9 +14,9 @@ |
14 | 14 | /// limitations under the License. |
15 | 15 | /// |
16 | 16 | |
17 | -import {Injectable} from '@angular/core'; | |
17 | +import { Injectable } from '@angular/core'; | |
18 | 18 | |
19 | -import {ActivatedRouteSnapshot, Resolve, Router} from '@angular/router'; | |
19 | +import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router'; | |
20 | 20 | import { |
21 | 21 | CellActionDescriptor, |
22 | 22 | checkBoxCell, |
... | ... | @@ -27,27 +27,28 @@ import { |
27 | 27 | GroupActionDescriptor, |
28 | 28 | HeaderActionDescriptor |
29 | 29 | } from '@home/models/entity/entities-table-config.models'; |
30 | -import {TranslateService} from '@ngx-translate/core'; | |
31 | -import {DatePipe} from '@angular/common'; | |
32 | -import {EntityType, entityTypeResources, entityTypeTranslations} from '@shared/models/entity-type.models'; | |
33 | -import {EntityAction} from '@home/models/entity/entity-component.models'; | |
34 | -import {RuleChain, ruleChainType} from '@shared/models/rule-chain.models'; | |
35 | -import {RuleChainService} from '@core/http/rule-chain.service'; | |
36 | -import {RuleChainComponent} from '@modules/home/pages/rulechain/rulechain.component'; | |
37 | -import {DialogService} from '@core/services/dialog.service'; | |
38 | -import {RuleChainTabsComponent} from '@home/pages/rulechain/rulechain-tabs.component'; | |
39 | -import {ImportExportService} from '@home/components/import-export/import-export.service'; | |
40 | -import {ItemBufferService} from '@core/services/item-buffer.service'; | |
41 | -import {EdgeService} from "@core/http/edge.service"; | |
42 | -import {forkJoin, Observable} from "rxjs"; | |
30 | +import { TranslateService } from '@ngx-translate/core'; | |
31 | +import { DatePipe } from '@angular/common'; | |
32 | +import { EntityType, entityTypeResources, entityTypeTranslations } from '@shared/models/entity-type.models'; | |
33 | +import { EntityAction } from '@home/models/entity/entity-component.models'; | |
34 | +import { RuleChain, ruleChainType } from '@shared/models/rule-chain.models'; | |
35 | +import { RuleChainService } from '@core/http/rule-chain.service'; | |
36 | +import { RuleChainComponent } from '@modules/home/pages/rulechain/rulechain.component'; | |
37 | +import { DialogService } from '@core/services/dialog.service'; | |
38 | +import { RuleChainTabsComponent } from '@home/pages/rulechain/rulechain-tabs.component'; | |
39 | +import { ImportExportService } from '@home/components/import-export/import-export.service'; | |
40 | +import { ItemBufferService } from '@core/services/item-buffer.service'; | |
41 | +import { EdgeService } from "@core/http/edge.service"; | |
42 | +import { forkJoin, Observable } from "rxjs"; | |
43 | 43 | import { |
44 | 44 | AddEntitiesToEdgeDialogComponent, |
45 | 45 | AddEntitiesToEdgeDialogData |
46 | 46 | } from "@home/dialogs/add-entities-to-edge-dialog.component"; |
47 | -import {MatDialog} from "@angular/material/dialog"; | |
48 | -import {isUndefined} from "@core/utils"; | |
49 | -import {PageLink} from "@shared/models/page/page-link"; | |
50 | -import {Edge} from "@shared/models/edge.models"; | |
47 | +import { MatDialog } from "@angular/material/dialog"; | |
48 | +import { isUndefined } from "@core/utils"; | |
49 | +import { PageLink } from "@shared/models/page/page-link"; | |
50 | +import { Edge } from "@shared/models/edge.models"; | |
51 | +import { map, mergeMap } from "rxjs/operators"; | |
51 | 52 | |
52 | 53 | @Injectable() |
53 | 54 | export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<RuleChain>> { |
... | ... | @@ -96,12 +97,11 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
96 | 97 | this.config.entitySelectionEnabled = ruleChain => ruleChain && !ruleChain.root; |
97 | 98 | this.config.deleteEnabled = (ruleChain) => ruleChain && !ruleChain.root; |
98 | 99 | this.config.entitiesDeleteEnabled = true; |
99 | - } | |
100 | - else if (this.config.componentsData.ruleChainScope === 'edge') { | |
100 | + } else if (this.config.componentsData.ruleChainScope === 'edge') { | |
101 | 101 | this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; |
102 | 102 | this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => { |
103 | 103 | this.config.componentsData.edge = edge; |
104 | - this.config.tableTitle = edge.name + ': ' + this.translate.instant('edge.rulechain-templates'); | |
104 | + this.config.tableTitle = edge.name + ': ' + this.translate.instant('edge.rulechains'); | |
105 | 105 | }); |
106 | 106 | this.config.entitiesDeleteEnabled = false; |
107 | 107 | } |
... | ... | @@ -128,9 +128,13 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
128 | 128 | columns.push( |
129 | 129 | new DateEntityTableColumn<RuleChain>('createdTime', 'common.created-time', this.datePipe, '150px'), |
130 | 130 | new EntityTableColumn<RuleChain>('name', 'rulechain.name', '100%'), |
131 | - new EntityTableColumn<RuleChain>('root', 'rulechain.root', '60px', | |
131 | + new EntityTableColumn<RuleChain>('root', 'rulechain.edge-template-root', '60px', | |
132 | 132 | entity => { |
133 | 133 | return checkBoxCell(entity.root); |
134 | + }), | |
135 | + new EntityTableColumn<RuleChain>('assignToEdge', 'rulechain.assign-to-edge', '60px', | |
136 | + entity => { | |
137 | + return checkBoxCell(this.isAutoAssignToEdgeRuleChain(entity)); | |
134 | 138 | }) |
135 | 139 | ); |
136 | 140 | } |
... | ... | @@ -226,22 +230,22 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
226 | 230 | if (ruleChainScope === 'edges') { |
227 | 231 | actions.push( |
228 | 232 | { |
229 | - name: this.translate.instant('rulechain.set-default-root-edge'), | |
233 | + name: this.translate.instant('rulechain.set-edge-template-root-rulechain'), | |
230 | 234 | icon: 'flag', |
231 | 235 | isEnabled: (entity) => this.isNonRootRuleChain(entity), |
232 | - onAction: ($event, entity) => this.setDefaultRootEdgeRuleChain($event, entity) | |
236 | + onAction: ($event, entity) => this.setEdgeTemplateRootRuleChain($event, entity) | |
233 | 237 | }, |
234 | 238 | { |
235 | 239 | name: this.translate.instant('rulechain.set-auto-assign-to-edge'), |
236 | 240 | icon: 'bookmark_outline', |
237 | - isEnabled: (entity) => this.isNonDefaultEdgeRuleChain(entity), | |
238 | - onAction: ($event, entity) => this.setDefaultEdgeRuleChain($event, entity) | |
241 | + isEnabled: (entity) => this.isNotAutoAssignToEdgeRuleChain(entity), | |
242 | + onAction: ($event, entity) => this.setAutoAssignToEdgeRuleChain($event, entity) | |
239 | 243 | }, |
240 | 244 | { |
241 | - name: this.translate.instant('rulechain.remove-default-edge'), | |
245 | + name: this.translate.instant('rulechain.unset-auto-assign-to-edge'), | |
242 | 246 | icon: 'bookmark', |
243 | - isEnabled: (entity) => this.isDefaultEdgeRuleChain(entity), | |
244 | - onAction: ($event, entity) => this.removeDefaultEdgeRuleChain($event, entity) | |
247 | + isEnabled: (entity) => this.isAutoAssignToEdgeRuleChain(entity), | |
248 | + onAction: ($event, entity) => this.unsetAutoAssignToEdgeRuleChain($event, entity) | |
245 | 249 | } |
246 | 250 | ) |
247 | 251 | } |
... | ... | @@ -344,26 +348,35 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
344 | 348 | case 'setRoot': |
345 | 349 | this.setRootRuleChain(action.event, action.entity); |
346 | 350 | return true; |
347 | - case 'setDefaultRoot': | |
348 | - this.setDefaultRootEdgeRuleChain(action.event, action.entity); | |
351 | + case 'setEdgeTemplateRoot': | |
352 | + this.setEdgeTemplateRootRuleChain(action.event, action.entity); | |
353 | + return true; | |
354 | + case 'unassignFromEdge': | |
355 | + this.unassignFromEdge(action.event, action.entity); | |
356 | + return true; | |
357 | + case 'setAutoAssignToEdge': | |
358 | + this.setAutoAssignToEdgeRuleChain(action.event, action.entity); | |
359 | + return true; | |
360 | + case 'unsetAutoAssignToEdge': | |
361 | + this.unsetAutoAssignToEdgeRuleChain(action.event, action.entity); | |
349 | 362 | return true; |
350 | 363 | } |
351 | 364 | return false; |
352 | 365 | } |
353 | 366 | |
354 | - setDefaultRootEdgeRuleChain($event: Event, ruleChain: RuleChain) { | |
367 | + setEdgeTemplateRootRuleChain($event: Event, ruleChain: RuleChain) { | |
355 | 368 | if ($event) { |
356 | 369 | $event.stopPropagation(); |
357 | 370 | } |
358 | 371 | this.dialogService.confirm( |
359 | - this.translate.instant('rulechain.set-default-root-edge-rulechain-title', {ruleChainName: ruleChain.name}), | |
360 | - this.translate.instant('rulechain.set-default-root-edge-rulechain-text'), | |
372 | + this.translate.instant('rulechain.set-edge-template-root-rulechain-title', {ruleChainName: ruleChain.name}), | |
373 | + this.translate.instant('rulechain.set-edge-template-root-rulechain-text'), | |
361 | 374 | this.translate.instant('action.no'), |
362 | 375 | this.translate.instant('action.yes'), |
363 | 376 | true |
364 | 377 | ).subscribe((res) => { |
365 | 378 | if (res) { |
366 | - this.ruleChainService.setDefaultRootEdgeRuleChain(ruleChain.id.id).subscribe( | |
379 | + this.ruleChainService.setEdgeTemplateRootRuleChain(ruleChain.id.id).subscribe( | |
367 | 380 | () => { |
368 | 381 | this.config.table.updateData(); |
369 | 382 | } |
... | ... | @@ -444,7 +457,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
444 | 457 | ); |
445 | 458 | } |
446 | 459 | |
447 | - setDefaultEdgeRuleChain($event: Event, ruleChain: RuleChain) { | |
460 | + setAutoAssignToEdgeRuleChain($event: Event, ruleChain: RuleChain) { | |
448 | 461 | if ($event) { |
449 | 462 | $event.stopPropagation(); |
450 | 463 | } |
... | ... | @@ -456,7 +469,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
456 | 469 | true |
457 | 470 | ).subscribe((res) => { |
458 | 471 | if (res) { |
459 | - this.ruleChainService.addDefaultEdgeRuleChain(ruleChain.id.id).subscribe( | |
472 | + this.ruleChainService.setAutoAssignToEdgeRuleChain(ruleChain.id.id).subscribe( | |
460 | 473 | () => { |
461 | 474 | this.config.table.updateData(); |
462 | 475 | } |
... | ... | @@ -466,19 +479,19 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
466 | 479 | ); |
467 | 480 | } |
468 | 481 | |
469 | - removeDefaultEdgeRuleChain($event: Event, ruleChain: RuleChain) { | |
482 | + unsetAutoAssignToEdgeRuleChain($event: Event, ruleChain: RuleChain) { | |
470 | 483 | if ($event) { |
471 | 484 | $event.stopPropagation(); |
472 | 485 | } |
473 | 486 | this.dialogService.confirm( |
474 | - this.translate.instant('rulechain.remove-default-edge-title', {ruleChainName: ruleChain.name}), | |
475 | - this.translate.instant('rulechain.remove-default-edge-text'), | |
487 | + this.translate.instant('rulechain.unset-auto-assign-to-edge-title', {ruleChainName: ruleChain.name}), | |
488 | + this.translate.instant('rulechain.unset-auto-assign-to-edge-text'), | |
476 | 489 | this.translate.instant('action.no'), |
477 | 490 | this.translate.instant('action.yes'), |
478 | 491 | true |
479 | 492 | ).subscribe((res) => { |
480 | 493 | if (res) { |
481 | - this.ruleChainService.removeDefaultEdgeRuleChain(ruleChain.id.id).subscribe( | |
494 | + this.ruleChainService.unsetAutoAssignToEdgeRuleChain(ruleChain.id.id).subscribe( | |
482 | 495 | () => { |
483 | 496 | this.config.table.updateData(); |
484 | 497 | } |
... | ... | @@ -490,17 +503,18 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
490 | 503 | |
491 | 504 | isNonRootRuleChain(ruleChain: RuleChain) { |
492 | 505 | if (this.config.componentsData.ruleChainScope === 'edge') { |
493 | - return this.config.componentsData.edge.rootRuleChainId && true && this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; | |
506 | + return this.config.componentsData.edge.rootRuleChainId && | |
507 | + this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; | |
494 | 508 | } |
495 | 509 | return !ruleChain.root; |
496 | 510 | } |
497 | 511 | |
498 | - isDefaultEdgeRuleChain(ruleChain) { | |
499 | - return !ruleChain.root && this.config.componentsData.defaultEdgeRuleChainIds.includes(ruleChain.id.id); | |
512 | + isAutoAssignToEdgeRuleChain(ruleChain) { | |
513 | + return !ruleChain.root && this.config.componentsData.autoAssignToEdgeRuleChainIds.includes(ruleChain.id.id); | |
500 | 514 | } |
501 | 515 | |
502 | - isNonDefaultEdgeRuleChain(ruleChain) { | |
503 | - return !ruleChain.root && !this.config.componentsData.defaultEdgeRuleChainIds.includes(ruleChain.id.id); | |
516 | + isNotAutoAssignToEdgeRuleChain(ruleChain) { | |
517 | + return !ruleChain.root && !this.config.componentsData.autoAssignToEdgeRuleChainIds.includes(ruleChain.id.id); | |
504 | 518 | } |
505 | 519 | |
506 | 520 | fetchRuleChains(pageLink: PageLink) { |
... | ... | @@ -508,10 +522,12 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
508 | 522 | } |
509 | 523 | |
510 | 524 | fetchEdgeRuleChains(pageLink: PageLink) { |
511 | - this.config.componentsData.defaultEdgeRuleChainIds = []; | |
512 | - this.ruleChainService.getDefaultEdgeRuleChains().subscribe(ruleChains => { | |
513 | - ruleChains.map(ruleChain => this.config.componentsData.defaultEdgeRuleChainIds.push(ruleChain.id.id)); | |
514 | - }); | |
515 | - return this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge); | |
525 | + return this.ruleChainService.getAutoAssignToEdgeRuleChains().pipe( | |
526 | + mergeMap((ruleChains) => { | |
527 | + this.config.componentsData.autoAssignToEdgeRuleChainIds = []; | |
528 | + ruleChains.map(ruleChain => this.config.componentsData.autoAssignToEdgeRuleChainIds.push(ruleChain.id.id)); | |
529 | + return this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge); | |
530 | + }) | |
531 | + ); | |
516 | 532 | } |
517 | 533 | } | ... | ... |
... | ... | @@ -115,7 +115,7 @@ export const HelpLinks = { |
115 | 115 | users: helpBaseUrl + '/docs/user-guide/ui/users', |
116 | 116 | devices: helpBaseUrl + '/docs/user-guide/ui/devices', |
117 | 117 | deviceProfiles: helpBaseUrl + '/docs/user-guide/ui/device-profiles', |
118 | - edges: helpBaseUrl + 'docs/user-guide/ui/edges', | |
118 | + edges: helpBaseUrl + '/docs/user-guide/ui/edges', | |
119 | 119 | assets: helpBaseUrl + '/docs/user-guide/ui/assets', |
120 | 120 | entityViews: helpBaseUrl + '/docs/user-guide/ui/entity-views', |
121 | 121 | entitiesImport: helpBaseUrl + '/docs/user-guide/bulk-provisioning', | ... | ... |
... | ... | @@ -93,45 +93,45 @@ export enum EdgeEventStatus { |
93 | 93 | |
94 | 94 | export const edgeEventTypeTranslations = new Map<EdgeEventType, string>( |
95 | 95 | [ |
96 | - [EdgeEventType.DASHBOARD, 'edge.edge-event-type-dashboard'], | |
97 | - [EdgeEventType.ASSET, 'edge.edge-event-type-asset'], | |
98 | - [EdgeEventType.DEVICE, 'edge.edge-event-type-device'], | |
99 | - [EdgeEventType.DEVICE_PROFILE, 'edge.edge-event-type-device-profile'], | |
100 | - [EdgeEventType.ENTITY_VIEW, 'edge.edge-event-type-entity-view'], | |
101 | - [EdgeEventType.ALARM, 'edge.edge-event-type-alarm'], | |
102 | - [EdgeEventType.RULE_CHAIN, 'edge.edge-event-type-rule-chain'], | |
103 | - [EdgeEventType.RULE_CHAIN_METADATA, 'edge.edge-event-type-rule-chain-metadata'], | |
104 | - [EdgeEventType.EDGE, 'edge.edge-event-type-edge'], | |
105 | - [EdgeEventType.USER, 'edge.edge-event-type-user'], | |
106 | - [EdgeEventType.CUSTOMER, 'edge.edge-event-type-customer'], | |
107 | - [EdgeEventType.RELATION, 'edge.edge-event-type-relation'], | |
108 | - [EdgeEventType.WIDGETS_BUNDLE, 'edge.edge-event-type-widgets-bundle'], | |
109 | - [EdgeEventType.WIDGET_TYPE, 'edge.edge-event-type-widgets-type'], | |
110 | - [EdgeEventType.ADMIN_SETTINGS, 'edge.edge-event-type-admin-settings'] | |
96 | + [EdgeEventType.DASHBOARD, 'edge-event.type-dashboard'], | |
97 | + [EdgeEventType.ASSET, 'edge-event.type-asset'], | |
98 | + [EdgeEventType.DEVICE, 'edge-event.type-device'], | |
99 | + [EdgeEventType.DEVICE_PROFILE, 'edge-event.type-device-profile'], | |
100 | + [EdgeEventType.ENTITY_VIEW, 'edge-event.type-entity-view'], | |
101 | + [EdgeEventType.ALARM, 'edge-event.type-alarm'], | |
102 | + [EdgeEventType.RULE_CHAIN, 'edge-event.type-rule-chain'], | |
103 | + [EdgeEventType.RULE_CHAIN_METADATA, 'edge-event.type-rule-chain-metadata'], | |
104 | + [EdgeEventType.EDGE, 'edge-event.type-edge'], | |
105 | + [EdgeEventType.USER, 'edge-event.type-user'], | |
106 | + [EdgeEventType.CUSTOMER, 'edge-event.type-customer'], | |
107 | + [EdgeEventType.RELATION, 'edge-event.type-relation'], | |
108 | + [EdgeEventType.WIDGETS_BUNDLE, 'edge-event.type-widgets-bundle'], | |
109 | + [EdgeEventType.WIDGET_TYPE, 'edge-event.type-widgets-type'], | |
110 | + [EdgeEventType.ADMIN_SETTINGS, 'edge-event.type-admin-settings'] | |
111 | 111 | ] |
112 | 112 | ); |
113 | 113 | |
114 | 114 | export const edgeEventActionTypeTranslations = new Map<EdgeEventActionType, string>( |
115 | 115 | [ |
116 | - [EdgeEventActionType.ADDED, 'edge.edge-event-action-type-added'], | |
117 | - [EdgeEventActionType.DELETED, 'edge.edge-event-action-type-deleted'], | |
118 | - [EdgeEventActionType.UPDATED, 'edge.edge-event-action-type-updated'], | |
119 | - [EdgeEventActionType.POST_ATTRIBUTES, 'edge.edge-event-action-type-post-attributes'], | |
120 | - [EdgeEventActionType.ATTRIBUTES_UPDATED, 'edge.edge-event-action-type-attributes-updated'], | |
121 | - [EdgeEventActionType.ATTRIBUTES_DELETED, 'edge.edge-event-action-type-attributes-deleted'], | |
122 | - [EdgeEventActionType.TIMESERIES_UPDATED, 'edge.edge-event-action-type-timeseries-updated'], | |
123 | - [EdgeEventActionType.CREDENTIALS_UPDATED, 'edge.edge-event-action-type-credentials-updated'], | |
124 | - [EdgeEventActionType.ASSIGNED_TO_CUSTOMER, 'edge.edge-event-action-type-assigned-to-customer'], | |
125 | - [EdgeEventActionType.UNASSIGNED_FROM_CUSTOMER, 'edge.edge-event-action-type-unassigned-from-customer'], | |
126 | - [EdgeEventActionType.RELATION_ADD_OR_UPDATE, 'edge.edge-event-action-type-relation-add-or-update'], | |
127 | - [EdgeEventActionType.RELATION_DELETED, 'edge.edge-event-action-type-relation-deleted'], | |
128 | - [EdgeEventActionType.RPC_CALL, 'edge.edge-event-action-type-rpc-call'], | |
129 | - [EdgeEventActionType.ALARM_ACK, 'edge.edge-event-action-type-alarm-ack'], | |
130 | - [EdgeEventActionType.ALARM_CLEAR, 'edge.edge-event-action-type-alarm-clear'], | |
131 | - [EdgeEventActionType.ASSIGNED_TO_EDGE, 'edge.edge-event-action-type-assigned-to-edge'], | |
132 | - [EdgeEventActionType.UNASSIGNED_FROM_EDGE, 'edge.edge-event-action-type-unassigned-from-edge'], | |
133 | - [EdgeEventActionType.CREDENTIALS_REQUEST, 'edge.edge-event-action-type-credentials-request'], | |
134 | - [EdgeEventActionType.ENTITY_MERGE_REQUEST, 'edge.edge-event-action-type-entity-merge-request'] | |
116 | + [EdgeEventActionType.ADDED, 'edge-event.action-type-added'], | |
117 | + [EdgeEventActionType.DELETED, 'edge-event.action-type-deleted'], | |
118 | + [EdgeEventActionType.UPDATED, 'edge-event.action-type-updated'], | |
119 | + [EdgeEventActionType.POST_ATTRIBUTES, 'edge-event.action-type-post-attributes'], | |
120 | + [EdgeEventActionType.ATTRIBUTES_UPDATED, 'edge-event.action-type-attributes-updated'], | |
121 | + [EdgeEventActionType.ATTRIBUTES_DELETED, 'edge-event.action-type-attributes-deleted'], | |
122 | + [EdgeEventActionType.TIMESERIES_UPDATED, 'edge-event.action-type-timeseries-updated'], | |
123 | + [EdgeEventActionType.CREDENTIALS_UPDATED, 'edge-event.action-type-credentials-updated'], | |
124 | + [EdgeEventActionType.ASSIGNED_TO_CUSTOMER, 'edge-event.action-type-assigned-to-customer'], | |
125 | + [EdgeEventActionType.UNASSIGNED_FROM_CUSTOMER, 'edge-event.action-type-unassigned-from-customer'], | |
126 | + [EdgeEventActionType.RELATION_ADD_OR_UPDATE, 'edge-event.action-type-relation-add-or-update'], | |
127 | + [EdgeEventActionType.RELATION_DELETED, 'edge-event.action-type-relation-deleted'], | |
128 | + [EdgeEventActionType.RPC_CALL, 'edge-event.action-type-rpc-call'], | |
129 | + [EdgeEventActionType.ALARM_ACK, 'edge-event.action-type-alarm-ack'], | |
130 | + [EdgeEventActionType.ALARM_CLEAR, 'edge-event.action-type-alarm-clear'], | |
131 | + [EdgeEventActionType.ASSIGNED_TO_EDGE, 'edge-event.action-type-assigned-to-edge'], | |
132 | + [EdgeEventActionType.UNASSIGNED_FROM_EDGE, 'edge-event.action-type-unassigned-from-edge'], | |
133 | + [EdgeEventActionType.CREDENTIALS_REQUEST, 'edge-event.action-type-credentials-request'], | |
134 | + [EdgeEventActionType.ENTITY_MERGE_REQUEST, 'edge-event.action-type-entity-merge-request'] | |
135 | 135 | ] |
136 | 136 | ); |
137 | 137 | ... | ... |
... | ... | @@ -1395,16 +1395,16 @@ |
1395 | 1395 | "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.", |
1396 | 1396 | "assign-rulechain-to-edge-title": "Regelkette(n) dem Rand zuordnen", |
1397 | 1397 | "assign-rulechain-to-edge-text": "Bitte wählen Sie die Regelketten aus, die Sie dem Rand zuordnen möchten", |
1398 | - "set-default-root-edge": "Machen Sie Randregelkette zur Wurzel Standard", | |
1399 | - "set-default-root-edge-rulechain-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' zur Wurzel machen Standard?", | |
1400 | - "set-default-root-edge-rulechain-text": "Nach der Bestätigung wird die Randregelkette zur Wurzel Standard und behandelt alle eingehenden Transportnachrichten.", | |
1398 | + "set-edge-template-root-rulechain": "Erstellen Sie den Stamm der Regelkettenkantenvorlage", | |
1399 | + "set-edge-template-root-rulechain-title": "Möchten Sie die Kantenvorlage der Regelkette '{{ruleChainName}}' wirklich als Root festlegen?", | |
1400 | + "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.", | |
1401 | 1401 | "invalid-rulechain-type-error": "Regelkette konnte nicht importiert werden: Ungültige Regelkettentyp. Erwarteter Typ ist {{expectedRuleChainType}}.", |
1402 | - "set-auto-assign-to-edge": "Ordnen Sie die Regelkette bei der Erstellung automatisch den Kanten zu", | |
1402 | + "set-auto-assign-to-edge": "Weisen Sie bei der Erstellung den Kanten die Regelkette zu", | |
1403 | 1403 | "set-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung automatisch den Kanten zuweisen?", |
1404 | 1404 | "set-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung automatisch den Kanten zugewiesen.", |
1405 | - "remove-default-edge": "Randregelkette Standard entfernen", | |
1406 | - "remove-default-edge-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' aus der Standardliste entfernen?", | |
1407 | - "remove-default-edge-text": "Nach der Bestätigung wird die Randregelkette nicht für neu erstellte Rand vergeben." | |
1405 | + "unset-auto-assign-to-edge": "Deaktiviert die Zuordnung der Regelkette zu Kanten bei der Erstellung", | |
1406 | + "unset-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung unbedingt den Kanten zuweisen?", | |
1407 | + "unset-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung nicht mehr automatisch den Kanten zugewiesen." | |
1408 | 1408 | }, |
1409 | 1409 | "rulenode": { |
1410 | 1410 | "details": "Details", | ... | ... |
... | ... | @@ -1117,6 +1117,8 @@ |
1117 | 1117 | "management": "Edge management", |
1118 | 1118 | "no-edges-matching": "No edges matching '{{entity}}' were found.", |
1119 | 1119 | "rulechain-templates": "Rule chain templates", |
1120 | + "rulechains": "Rule chains", | |
1121 | + "edge-rulechains": "Edge Rule chains", | |
1120 | 1122 | "add": "Add Edge", |
1121 | 1123 | "view": "View Edge", |
1122 | 1124 | "no-edges-text": "No edges found", |
... | ... | @@ -1133,8 +1135,10 @@ |
1133 | 1135 | "name-required": "Name is required.", |
1134 | 1136 | "edge-license-key": "Edge License Key", |
1135 | 1137 | "edge-license-key-required": "Edge License Key is required.", |
1138 | + "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.", | |
1136 | 1139 | "cloud-endpoint": "Cloud Endpoint", |
1137 | 1140 | "cloud-endpoint-required": "Cloud Endpoint is required.", |
1141 | + "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.", | |
1138 | 1142 | "description": "Description", |
1139 | 1143 | "entity-info": "Entity info", |
1140 | 1144 | "details": "Details", |
... | ... | @@ -1206,42 +1210,44 @@ |
1206 | 1210 | "pending": "Pending", |
1207 | 1211 | "downlinks": "Downlinks", |
1208 | 1212 | "no-downlinks-prompt": "No downlinks found", |
1209 | - "edge-event-type-dashboard": "Dashboard", | |
1210 | - "edge-event-type-asset": "Asset", | |
1211 | - "edge-event-type-device": "Device", | |
1212 | - "edge-event-type-device-profile": "Device Profile", | |
1213 | - "edge-event-type-entity-view": "Entity View", | |
1214 | - "edge-event-type-alarm": "Alar", | |
1215 | - "edge-event-type-rule-chain": "Rule Chain", | |
1216 | - "edge-event-type-rule-chain-metadata": "Rule Chain Metadata", | |
1217 | - "edge-event-type-edge": "Edge", | |
1218 | - "edge-event-type-user": "User", | |
1219 | - "edge-event-type-customer": "Customer", | |
1220 | - "edge-event-type-relation": "Relation", | |
1221 | - "edge-event-type-widgets-bundle": "Widgets Bundle", | |
1222 | - "edge-event-type-widgets-type": "Widgets Type", | |
1223 | - "edge-event-type-admin-settings": "Admin Settings", | |
1224 | - "edge-event-action-type-added": "Added", | |
1225 | - "edge-event-action-type-deleted": "Deleted", | |
1226 | - "edge-event-action-type-updated": "Updated", | |
1227 | - "edge-event-action-type-post-attributes": "Post Attributes", | |
1228 | - "edge-event-action-type-attributes-updated": "Attributes Updated", | |
1229 | - "edge-event-action-type-attributes-deleted": "Attributes Deleted", | |
1230 | - "edge-event-action-type-timeseries-updated": "Timeseries Updated", | |
1231 | - "edge-event-action-type-credentials-updated": "Credentials Updated", | |
1232 | - "edge-event-action-type-assigned-to-customer": "Assigned to Customer", | |
1233 | - "edge-event-action-type-unassigned-from-customer": "Unassigned from Customer", | |
1234 | - "edge-event-action-type-relation-add-or-update": "Relation Add or Update", | |
1235 | - "edge-event-action-type-relation-deleted": "Relation Deleted", | |
1236 | - "edge-event-action-type-rpc-call": "RPC Call", | |
1237 | - "edge-event-action-type-alarm-ack": "Alarm Ack", | |
1238 | - "edge-event-action-type-alarm-clear": "Alarm Clear", | |
1239 | - "edge-event-action-type-assigned-to-edge": "Assigned to Edge", | |
1240 | - "edge-event-action-type-unassigned-from-edge": "Unassigned from Edge", | |
1241 | - "edge-event-action-type-credentials-request": "Credentials Request", | |
1242 | - "edge-event-action-type-entity-merge-request": "Entity Merge Request", | |
1243 | 1213 | "sync-process-started-successfully": "Sync process started successfully!" |
1244 | 1214 | }, |
1215 | + "edge-event": { | |
1216 | + "type-dashboard": "Dashboard", | |
1217 | + "type-asset": "Asset", | |
1218 | + "type-device": "Device", | |
1219 | + "type-device-profile": "Device Profile", | |
1220 | + "type-entity-view": "Entity View", | |
1221 | + "type-alarm": "Alar", | |
1222 | + "type-rule-chain": "Rule Chain", | |
1223 | + "type-rule-chain-metadata": "Rule Chain Metadata", | |
1224 | + "type-edge": "Edge", | |
1225 | + "type-user": "User", | |
1226 | + "type-customer": "Customer", | |
1227 | + "type-relation": "Relation", | |
1228 | + "type-widgets-bundle": "Widgets Bundle", | |
1229 | + "type-widgets-type": "Widgets Type", | |
1230 | + "type-admin-settings": "Admin Settings", | |
1231 | + "action-type-added": "Added", | |
1232 | + "action-type-deleted": "Deleted", | |
1233 | + "action-type-updated": "Updated", | |
1234 | + "action-type-post-attributes": "Post Attributes", | |
1235 | + "action-type-attributes-updated": "Attributes Updated", | |
1236 | + "action-type-attributes-deleted": "Attributes Deleted", | |
1237 | + "action-type-timeseries-updated": "Timeseries Updated", | |
1238 | + "action-type-credentials-updated": "Credentials Updated", | |
1239 | + "action-type-assigned-to-customer": "Assigned to Customer", | |
1240 | + "action-type-unassigned-from-customer": "Unassigned from Customer", | |
1241 | + "action-type-relation-add-or-update": "Relation Add or Update", | |
1242 | + "action-type-relation-deleted": "Relation Deleted", | |
1243 | + "action-type-rpc-call": "RPC Call", | |
1244 | + "action-type-alarm-ack": "Alarm Ack", | |
1245 | + "action-type-alarm-clear": "Alarm Clear", | |
1246 | + "action-type-assigned-to-edge": "Assigned to Edge", | |
1247 | + "action-type-unassigned-from-edge": "Unassigned from Edge", | |
1248 | + "action-type-credentials-request": "Credentials Request", | |
1249 | + "action-type-entity-merge-request": "Entity Merge Request" | |
1250 | + }, | |
1245 | 1251 | "error": { |
1246 | 1252 | "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", |
1247 | 1253 | "unhandled-error-code": "Unhandled error code: {{errorCode}}", |
... | ... | @@ -2073,22 +2079,24 @@ |
2073 | 2079 | "selected-rulechains": "{ count, plural, 1 {1 rule chain} other {# rule chains} } selected", |
2074 | 2080 | "open-rulechain": "Open rule chain", |
2075 | 2081 | "assign-new-rulechain": "Assign new rulechain", |
2082 | + "edge-template-root": "Template Root", | |
2083 | + "assign-to-edge": "Assign to Edge", | |
2076 | 2084 | "edge-rulechain": "Edge Rule chain", |
2077 | 2085 | "unassign-rulechain-from-edge-text": "After the confirmation the rulechain will be unassigned and won't be accessible by the edge.", |
2078 | 2086 | "unassign-rulechains-from-edge-title": "Are you sure you want to unassign { count, plural, 1 {1 rulechain} other {# rulechains} }?", |
2079 | 2087 | "unassign-rulechains-from-edge-text": "After the confirmation all selected rulechains will be unassigned and won't be accessible by the edge.", |
2080 | 2088 | "assign-rulechain-to-edge-title": "Assign Rule Chain(s) To Edge", |
2081 | 2089 | "assign-rulechain-to-edge-text": "Please select the rulechains to assign to the edge", |
2082 | - "set-default-root-edge": "Make rule chain default root", | |
2083 | - "set-default-root-edge-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' default edge root?", | |
2084 | - "set-default-root-edge-rulechain-text": "After the confirmation the rule chain will become default edge root and will handle all incoming transport messages.", | |
2090 | + "set-edge-template-root-rulechain": "Make rule chain edge template root", | |
2091 | + "set-edge-template-root-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' edge template root?", | |
2092 | + "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.", | |
2085 | 2093 | "invalid-rulechain-type-error": "Unable to import rule chain: Invalid rule chain type. Expected type is {{expectedRuleChainType}}.", |
2086 | - "set-auto-assign-to-edge": "Auto-assign rule chain to edge(s) on creation", | |
2087 | - "set-auto-assign-to-edge-title": "Are you sure you want to auto-assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", | |
2094 | + "set-auto-assign-to-edge": "Assign rule chain to edge(s) on creation", | |
2095 | + "set-auto-assign-to-edge-title": "Are you sure you want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", | |
2088 | 2096 | "set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.", |
2089 | - "remove-default-edge": "Remove rule chain from defaults", | |
2090 | - "remove-default-edge-title": "Are you sure you want to remove the edge rule chain '{{ruleChainName}}' from default list?", | |
2091 | - "remove-default-edge-text": "After the confirmation the edge rule chain will not be assigned for a newly created edges.", | |
2097 | + "unset-auto-assign-to-edge": "Unset assign rule chain to edge(s) on creation", | |
2098 | + "unset-auto-assign-to-edge-title": "Are you sure you want to unset assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", | |
2099 | + "unset-auto-assign-to-edge-text": "After the confirmation the edge rule chain will no longer be automatically assigned to edge(s) on creation.", | |
2092 | 2100 | "unassign-rulechain-title": "Are you sure you want to unassign the rulechain '{{ruleChainName}}'?", |
2093 | 2101 | "unassign-rulechains": "Unassign rulechains" |
2094 | 2102 | }, | ... | ... |
... | ... | @@ -1566,16 +1566,16 @@ |
1566 | 1566 | "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", |
1567 | 1567 | "assign-rulechain-to-edge-title": "Asignar cadena (s) de reglas a borde", |
1568 | 1568 | "assign-rulechain-to-edge-text": "Seleccione las cadenas de reglas para asignar al borde", |
1569 | - "set-default-root-edge": "Hacer que la cadena de reglas sea la raíz predeterminada", | |
1570 | - "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?", | |
1571 | - "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", | |
1569 | + "set-edge-template-root-rulechain": "Hacer raíz de plantilla de borde de cadena de reglas", | |
1570 | + "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?", | |
1571 | + "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.", | |
1572 | 1572 | "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}}", |
1573 | - "set-auto-assign-to-edge": "Asignar automáticamente la cadena de reglas a los bordes en la creación", | |
1573 | + "set-auto-assign-to-edge": "Asignar cadena de reglas a los bordes en la creación", | |
1574 | 1574 | "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?", |
1575 | 1575 | "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.", |
1576 | - "remove-default-edge": "Eliminar la cadena de regla de borde de los valores predeterminados", | |
1577 | - "remove-default-edge-title": "¿Está seguro de que desea eliminar la cadena de reglas de borde '{{ruleChainName}}' de la lista predeterminada?", | |
1578 | - "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" | |
1576 | + "unset-auto-assign-to-edge": "Desmarcar asignar cadena de reglas a los bordes en la creación", | |
1577 | + "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?", | |
1578 | + "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." | |
1579 | 1579 | }, |
1580 | 1580 | "rulenode": { |
1581 | 1581 | "details": "Detalles", | ... | ... |
... | ... | @@ -1440,16 +1440,16 @@ |
1440 | 1440 | "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.", |
1441 | 1441 | "assign-rulechain-to-edge-title": "Attribuer les chaînes de règles a la bordure", |
1442 | 1442 | "assign-rulechain-to-edge-text": "Veuillez sélectionner la bordure pour attribuer le ou les chaînes de règles", |
1443 | - "set-default-root-edge": "Définir la racine par défaut de la chaîne de règles", | |
1444 | - "set-default-root-edge-rulechain-title": "AVoulez-vous vraiment créer de chaînes de règles par défaut '{{ruleChainName}}'?", | |
1445 | - "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.", | |
1443 | + "set-edge-template-root-rulechain": "Rendre le modèle de bord de chaîne de règles racine", | |
1444 | + "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}}'?", | |
1445 | + "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.", | |
1446 | 1446 | "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}}.", |
1447 | - "set-auto-assign-to-edge": "Assigner automatiquement la chaîne de règles aux arêtes lors de la création", | |
1447 | + "set-auto-assign-to-edge": "Attribuer une chaîne de règles aux arêtes lors de la création", | |
1448 | 1448 | "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?", |
1449 | 1449 | "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.", |
1450 | - "remove-default-edge": "Supprimer la chaîne de règles de la bordure des valeurs par défaut", | |
1451 | - "remove-default-edge-title": "Voulez-vous vraiment supprimer la chaîne de règles de la bordure '{{ruleChainName}}' de la liste par défaut", | |
1452 | - "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." | |
1450 | + "unset-auto-assign-to-edge": "Non défini, attribuer une chaîne de règles aux arêtes lors de la création", | |
1451 | + "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?", | |
1452 | + "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." | |
1453 | 1453 | }, |
1454 | 1454 | "rulenode": { |
1455 | 1455 | "add": "Ajouter un noeud de règle", | ... | ... |