Commit 73ef6e07983492345b1ce93dc146f6b00ad4cb06
1 parent
87601a4c
Rule chains EDGE & CORE types refactored
Showing
5 changed files
with
19 additions
and
17 deletions
@@ -311,7 +311,7 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co | @@ -311,7 +311,7 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co | ||
311 | } | 311 | } |
312 | 312 | ||
313 | function getEdgesRuleChains(pageLink, config) { | 313 | function getEdgesRuleChains(pageLink, config) { |
314 | - return getRuleChains(pageLink, config, types.edgeRuleChainType); | 314 | + return getRuleChains(pageLink, config, types.ruleChainType.edge); |
315 | } | 315 | } |
316 | 316 | ||
317 | function getEdgeRuleChains(edgeId, pageLink, config) { | 317 | function getEdgeRuleChains(edgeId, pageLink, config) { |
@@ -786,8 +786,10 @@ export default angular.module('thingsboard.types', []) | @@ -786,8 +786,10 @@ export default angular.module('thingsboard.types', []) | ||
786 | clientSide: false | 786 | clientSide: false |
787 | } | 787 | } |
788 | }, | 788 | }, |
789 | - coreRuleChainType: "CORE", | ||
790 | - edgeRuleChainType: "EDGE", | 789 | + ruleChainType: { |
790 | + core: "CORE", | ||
791 | + edge: "EDGE" | ||
792 | + }, | ||
791 | ruleNodeTypeComponentTypes: ["FILTER", "ENRICHMENT", "TRANSFORMATION", "ACTION", "EXTERNAL"], | 793 | ruleNodeTypeComponentTypes: ["FILTER", "ENRICHMENT", "TRANSFORMATION", "ACTION", "EXTERNAL"], |
792 | ruleChainNodeComponent: { | 794 | ruleChainNodeComponent: { |
793 | type: 'RULE_CHAIN', | 795 | type: 'RULE_CHAIN', |
@@ -1180,7 +1180,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time | @@ -1180,7 +1180,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time | ||
1180 | var saveRuleChainPromise; | 1180 | var saveRuleChainPromise; |
1181 | if (vm.isImport) { | 1181 | if (vm.isImport) { |
1182 | if (angular.isUndefined(vm.ruleChain.type)) { | 1182 | if (angular.isUndefined(vm.ruleChain.type)) { |
1183 | - vm.ruleChain.type = types.coreRuleChainType; | 1183 | + vm.ruleChain.type = types.ruleChainType.core; |
1184 | } | 1184 | } |
1185 | saveRuleChainPromise = ruleChainService.saveRuleChain(vm.ruleChain); | 1185 | saveRuleChainPromise = ruleChainService.saveRuleChain(vm.ruleChain); |
1186 | } else { | 1186 | } else { |
@@ -1269,7 +1269,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time | @@ -1269,7 +1269,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time | ||
1269 | vm.isDirty = false; | 1269 | vm.isDirty = false; |
1270 | vm.isImport = false; | 1270 | vm.isImport = false; |
1271 | $mdUtil.nextTick(() => { | 1271 | $mdUtil.nextTick(() => { |
1272 | - if (vm.ruleChain.type === vm.types.coreRuleChainType) { | 1272 | + if (vm.ruleChain.type === vm.types.ruleChainType.core) { |
1273 | $state.go('home.ruleChains.core.ruleChain', {ruleChainId: vm.ruleChain.id.id}); | 1273 | $state.go('home.ruleChains.core.ruleChain', {ruleChainId: vm.ruleChain.id.id}); |
1274 | } else { | 1274 | } else { |
1275 | $state.go('home.ruleChains.edge.ruleChain', {ruleChainId: vm.ruleChain.id.id}); | 1275 | $state.go('home.ruleChains.edge.ruleChain', {ruleChainId: vm.ruleChain.id.id}); |
@@ -1293,7 +1293,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time | @@ -1293,7 +1293,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time | ||
1293 | ruleNode.configuration = angular.copy(ruleNode.component.configurationDescriptor.nodeDefinition.defaultConfiguration); | 1293 | ruleNode.configuration = angular.copy(ruleNode.component.configurationDescriptor.nodeDefinition.defaultConfiguration); |
1294 | 1294 | ||
1295 | var ruleChainId = vm.ruleChain.id ? vm.ruleChain.id.id : null; | 1295 | var ruleChainId = vm.ruleChain.id ? vm.ruleChain.id.id : null; |
1296 | - var ruleChainType = vm.ruleChain.type ? vm.ruleChain.type : types.coreRuleChainType; | 1296 | + var ruleChainType = vm.ruleChain.type ? vm.ruleChain.type : types.ruleChainType.core; |
1297 | 1297 | ||
1298 | vm.enableHotKeys = false; | 1298 | vm.enableHotKeys = false; |
1299 | 1299 |
@@ -82,7 +82,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider | @@ -82,7 +82,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider | ||
82 | ruleNodeComponents: | 82 | ruleNodeComponents: |
83 | /*@ngInject*/ | 83 | /*@ngInject*/ |
84 | function($stateParams, ruleChainService) { | 84 | function($stateParams, ruleChainService) { |
85 | - return ruleChainService.getRuleNodeComponents(types.coreRuleChainType); | 85 | + return ruleChainService.getRuleNodeComponents(types.ruleChainType.core); |
86 | } | 86 | } |
87 | }, | 87 | }, |
88 | data: { | 88 | data: { |
@@ -180,7 +180,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider | @@ -180,7 +180,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider | ||
180 | ruleNodeComponents: | 180 | ruleNodeComponents: |
181 | /*@ngInject*/ | 181 | /*@ngInject*/ |
182 | function($stateParams, ruleChainService) { | 182 | function($stateParams, ruleChainService) { |
183 | - return ruleChainService.getRuleNodeComponents(types.edgeRuleChainType); | 183 | + return ruleChainService.getRuleNodeComponents(types.ruleChainType.edge); |
184 | } | 184 | } |
185 | }, | 185 | }, |
186 | data: { | 186 | data: { |
@@ -237,7 +237,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider | @@ -237,7 +237,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider | ||
237 | ruleNodeComponents: | 237 | ruleNodeComponents: |
238 | /*@ngInject*/ | 238 | /*@ngInject*/ |
239 | function($stateParams, ruleChainService) { | 239 | function($stateParams, ruleChainService) { |
240 | - return ruleChainService.getRuleNodeComponents(types.edgeRuleChainType); | 240 | + return ruleChainService.getRuleNodeComponents(types.ruleChainType.edge); |
241 | } | 241 | } |
242 | }, | 242 | }, |
243 | data: { | 243 | data: { |
@@ -114,7 +114,7 @@ export default function RuleChainsController(ruleChainService, userService, edge | @@ -114,7 +114,7 @@ export default function RuleChainsController(ruleChainService, userService, edge | ||
114 | 114 | ||
115 | if (vm.ruleChainsScope === 'tenant') { | 115 | if (vm.ruleChainsScope === 'tenant') { |
116 | fetchRuleChainsFunction = function (pageLink) { | 116 | fetchRuleChainsFunction = function (pageLink) { |
117 | - return fetchRuleChains(pageLink, types.coreRuleChainType); | 117 | + return fetchRuleChains(pageLink, types.ruleChainType.core); |
118 | }; | 118 | }; |
119 | deleteRuleChainFunction = function (ruleChainId) { | 119 | deleteRuleChainFunction = function (ruleChainId) { |
120 | return deleteRuleChain(ruleChainId); | 120 | return deleteRuleChain(ruleChainId); |
@@ -162,9 +162,9 @@ export default function RuleChainsController(ruleChainService, userService, edge | @@ -162,9 +162,9 @@ export default function RuleChainsController(ruleChainService, userService, edge | ||
162 | }); | 162 | }); |
163 | vm.ruleChainGridConfig.addItemActions.push({ | 163 | vm.ruleChainGridConfig.addItemActions.push({ |
164 | onAction: function ($event) { | 164 | onAction: function ($event) { |
165 | - importExport.importRuleChain($event, types.coreRuleChainType).then( | 165 | + importExport.importRuleChain($event, types.ruleChainType.core).then( |
166 | function(ruleChainImport) { | 166 | function(ruleChainImport) { |
167 | - $state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.coreRuleChainType}); | 167 | + $state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.core}); |
168 | } | 168 | } |
169 | ); | 169 | ); |
170 | }, | 170 | }, |
@@ -175,7 +175,7 @@ export default function RuleChainsController(ruleChainService, userService, edge | @@ -175,7 +175,7 @@ export default function RuleChainsController(ruleChainService, userService, edge | ||
175 | 175 | ||
176 | } else if (vm.ruleChainsScope === 'edges') { | 176 | } else if (vm.ruleChainsScope === 'edges') { |
177 | fetchRuleChainsFunction = function (pageLink) { | 177 | fetchRuleChainsFunction = function (pageLink) { |
178 | - return fetchRuleChains(pageLink, types.edgeRuleChainType); | 178 | + return fetchRuleChains(pageLink, types.ruleChainType.edge); |
179 | }; | 179 | }; |
180 | deleteRuleChainFunction = function (ruleChainId) { | 180 | deleteRuleChainFunction = function (ruleChainId) { |
181 | return deleteRuleChain(ruleChainId); | 181 | return deleteRuleChain(ruleChainId); |
@@ -243,9 +243,9 @@ export default function RuleChainsController(ruleChainService, userService, edge | @@ -243,9 +243,9 @@ export default function RuleChainsController(ruleChainService, userService, edge | ||
243 | }); | 243 | }); |
244 | vm.ruleChainGridConfig.addItemActions.push({ | 244 | vm.ruleChainGridConfig.addItemActions.push({ |
245 | onAction: function ($event) { | 245 | onAction: function ($event) { |
246 | - importExport.importRuleChain($event, types.edgeRuleChainType).then( | 246 | + importExport.importRuleChain($event, types.ruleChainType.edge).then( |
247 | function(ruleChainImport) { | 247 | function(ruleChainImport) { |
248 | - $state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.edgeRuleChainType}); | 248 | + $state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.edge}); |
249 | } | 249 | } |
250 | ); | 250 | ); |
251 | }, | 251 | }, |
@@ -383,9 +383,9 @@ export default function RuleChainsController(ruleChainService, userService, edge | @@ -383,9 +383,9 @@ export default function RuleChainsController(ruleChainService, userService, edge | ||
383 | function saveRuleChain(ruleChain) { | 383 | function saveRuleChain(ruleChain) { |
384 | if (angular.isUndefined(ruleChain.type)) { | 384 | if (angular.isUndefined(ruleChain.type)) { |
385 | if (vm.ruleChainsScope === 'edges') { | 385 | if (vm.ruleChainsScope === 'edges') { |
386 | - ruleChain.type = types.edgeRuleChainType; | 386 | + ruleChain.type = types.ruleChainType.edge; |
387 | } else { | 387 | } else { |
388 | - ruleChain.type = types.coreRuleChainType; | 388 | + ruleChain.type = types.ruleChainType.core; |
389 | } | 389 | } |
390 | } | 390 | } |
391 | return ruleChainService.saveRuleChain(ruleChain); | 391 | return ruleChainService.saveRuleChain(ruleChain); |