Commit ee111c644596ddb2273d2664141183ddb162d0bc
1 parent
3f6e4054
Alert message for missingRuleChains
Showing
3 changed files
with
42 additions
and
4 deletions
... | ... | @@ -36,7 +36,8 @@ function EdgeService($http, $q, customerService) { |
36 | 36 | makeEdgePublic: makeEdgePublic, |
37 | 37 | setRootRuleChain: setRootRuleChain, |
38 | 38 | getEdgeEvents: getEdgeEvents, |
39 | - syncEdge: syncEdge | |
39 | + syncEdge: syncEdge, | |
40 | + findMissingToRelatedRuleChains: findMissingToRelatedRuleChains | |
40 | 41 | }; |
41 | 42 | |
42 | 43 | return service; |
... | ... | @@ -305,4 +306,15 @@ function EdgeService($http, $q, customerService) { |
305 | 306 | }); |
306 | 307 | return deferred.promise; |
307 | 308 | } |
309 | + | |
310 | + function findMissingToRelatedRuleChains(edgeId) { | |
311 | + var deferred = $q.defer(); | |
312 | + var url = '/api/edge/missingToRelatedRuleChains/' + edgeId; | |
313 | + $http.get(url, null).then(function success(response) { | |
314 | + deferred.resolve(response.data); | |
315 | + }, function fail(response) { | |
316 | + deferred.reject(response.data); | |
317 | + }); | |
318 | + return deferred.promise; | |
319 | + } | |
308 | 320 | } | ... | ... |
... | ... | @@ -854,7 +854,9 @@ |
854 | 854 | "edge-type-list-empty": "No edge types selected.", |
855 | 855 | "edge-types": "Edge types", |
856 | 856 | "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.", |
857 | - "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." | |
857 | + "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.", | |
858 | + "missing-related-rule-chains-title": "Edge has missing related rule chain(s)", | |
859 | + "missing-related-rule-chains-text": "Assigned to edge rule chain(s) use rule nodes that forward message(s) to rule chain(s) that are not assigned to this edge. <br><br> List of missing rule chain(s): <br> {{missingRuleChains}}" | |
858 | 860 | }, |
859 | 861 | "error": { |
860 | 862 | "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", | ... | ... |
... | ... | @@ -572,8 +572,32 @@ export default function RuleChainsController(ruleChainService, userService, impo |
572 | 572 | fullscreen: true, |
573 | 573 | targetEvent: $event |
574 | 574 | }).then(function () { |
575 | - vm.grid.refreshList(); | |
576 | - }, function () { | |
575 | + edgeService.findMissingToRelatedRuleChains(edgeId).then( | |
576 | + function success(missingRuleChains) { | |
577 | + if (missingRuleChains && Object.keys(missingRuleChains).length > 0) { | |
578 | + let formattedMissingRuleChains = []; | |
579 | + for (const missingRuleChain of Object.keys(missingRuleChains)) { | |
580 | + const arrayOfMissingRuleChains = missingRuleChains[missingRuleChain]; | |
581 | + const tmp = "- '" + missingRuleChain + "': '" + arrayOfMissingRuleChains.join("', ") + "'"; | |
582 | + formattedMissingRuleChains.push(tmp); | |
583 | + } | |
584 | + var alert = $mdDialog.alert() | |
585 | + .parent(angular.element($document[0].body)) | |
586 | + .clickOutsideToClose(true) | |
587 | + .title($translate.instant('edge.missing-related-rule-chains-title')) | |
588 | + .htmlContent($translate.instant('edge.missing-related-rule-chains-text', {missingRuleChains: formattedMissingRuleChains.join("<br>")})) | |
589 | + .ok($translate.instant('action.close')); | |
590 | + alert._options.fullscreen = true; | |
591 | + $mdDialog.show(alert).then( | |
592 | + function () { | |
593 | + vm.grid.refreshList(); | |
594 | + } | |
595 | + ); | |
596 | + } else { | |
597 | + vm.grid.refreshList(); | |
598 | + } | |
599 | + } | |
600 | + ); | |
577 | 601 | }); |
578 | 602 | }, |
579 | 603 | function fail() { | ... | ... |