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