Rule chains EDGE & CORE types refactored
This commit is contained in:
parent
87601a4c63
commit
73ef6e0798
@ -311,7 +311,7 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEdgesRuleChains(pageLink, config) {
|
function getEdgesRuleChains(pageLink, config) {
|
||||||
return getRuleChains(pageLink, config, types.edgeRuleChainType);
|
return getRuleChains(pageLink, config, types.ruleChainType.edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEdgeRuleChains(edgeId, pageLink, config) {
|
function getEdgeRuleChains(edgeId, pageLink, config) {
|
||||||
|
|||||||
@ -786,8 +786,10 @@ export default angular.module('thingsboard.types', [])
|
|||||||
clientSide: false
|
clientSide: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
coreRuleChainType: "CORE",
|
ruleChainType: {
|
||||||
edgeRuleChainType: "EDGE",
|
core: "CORE",
|
||||||
|
edge: "EDGE"
|
||||||
|
},
|
||||||
ruleNodeTypeComponentTypes: ["FILTER", "ENRICHMENT", "TRANSFORMATION", "ACTION", "EXTERNAL"],
|
ruleNodeTypeComponentTypes: ["FILTER", "ENRICHMENT", "TRANSFORMATION", "ACTION", "EXTERNAL"],
|
||||||
ruleChainNodeComponent: {
|
ruleChainNodeComponent: {
|
||||||
type: 'RULE_CHAIN',
|
type: 'RULE_CHAIN',
|
||||||
|
|||||||
@ -1180,7 +1180,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time
|
|||||||
var saveRuleChainPromise;
|
var saveRuleChainPromise;
|
||||||
if (vm.isImport) {
|
if (vm.isImport) {
|
||||||
if (angular.isUndefined(vm.ruleChain.type)) {
|
if (angular.isUndefined(vm.ruleChain.type)) {
|
||||||
vm.ruleChain.type = types.coreRuleChainType;
|
vm.ruleChain.type = types.ruleChainType.core;
|
||||||
}
|
}
|
||||||
saveRuleChainPromise = ruleChainService.saveRuleChain(vm.ruleChain);
|
saveRuleChainPromise = ruleChainService.saveRuleChain(vm.ruleChain);
|
||||||
} else {
|
} else {
|
||||||
@ -1269,7 +1269,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time
|
|||||||
vm.isDirty = false;
|
vm.isDirty = false;
|
||||||
vm.isImport = false;
|
vm.isImport = false;
|
||||||
$mdUtil.nextTick(() => {
|
$mdUtil.nextTick(() => {
|
||||||
if (vm.ruleChain.type === vm.types.coreRuleChainType) {
|
if (vm.ruleChain.type === vm.types.ruleChainType.core) {
|
||||||
$state.go('home.ruleChains.core.ruleChain', {ruleChainId: vm.ruleChain.id.id});
|
$state.go('home.ruleChains.core.ruleChain', {ruleChainId: vm.ruleChain.id.id});
|
||||||
} else {
|
} else {
|
||||||
$state.go('home.ruleChains.edge.ruleChain', {ruleChainId: vm.ruleChain.id.id});
|
$state.go('home.ruleChains.edge.ruleChain', {ruleChainId: vm.ruleChain.id.id});
|
||||||
@ -1293,7 +1293,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time
|
|||||||
ruleNode.configuration = angular.copy(ruleNode.component.configurationDescriptor.nodeDefinition.defaultConfiguration);
|
ruleNode.configuration = angular.copy(ruleNode.component.configurationDescriptor.nodeDefinition.defaultConfiguration);
|
||||||
|
|
||||||
var ruleChainId = vm.ruleChain.id ? vm.ruleChain.id.id : null;
|
var ruleChainId = vm.ruleChain.id ? vm.ruleChain.id.id : null;
|
||||||
var ruleChainType = vm.ruleChain.type ? vm.ruleChain.type : types.coreRuleChainType;
|
var ruleChainType = vm.ruleChain.type ? vm.ruleChain.type : types.ruleChainType.core;
|
||||||
|
|
||||||
vm.enableHotKeys = false;
|
vm.enableHotKeys = false;
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider
|
|||||||
ruleNodeComponents:
|
ruleNodeComponents:
|
||||||
/*@ngInject*/
|
/*@ngInject*/
|
||||||
function($stateParams, ruleChainService) {
|
function($stateParams, ruleChainService) {
|
||||||
return ruleChainService.getRuleNodeComponents(types.coreRuleChainType);
|
return ruleChainService.getRuleNodeComponents(types.ruleChainType.core);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
@ -180,7 +180,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider
|
|||||||
ruleNodeComponents:
|
ruleNodeComponents:
|
||||||
/*@ngInject*/
|
/*@ngInject*/
|
||||||
function($stateParams, ruleChainService) {
|
function($stateParams, ruleChainService) {
|
||||||
return ruleChainService.getRuleNodeComponents(types.edgeRuleChainType);
|
return ruleChainService.getRuleNodeComponents(types.ruleChainType.edge);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
@ -237,7 +237,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider
|
|||||||
ruleNodeComponents:
|
ruleNodeComponents:
|
||||||
/*@ngInject*/
|
/*@ngInject*/
|
||||||
function($stateParams, ruleChainService) {
|
function($stateParams, ruleChainService) {
|
||||||
return ruleChainService.getRuleNodeComponents(types.edgeRuleChainType);
|
return ruleChainService.getRuleNodeComponents(types.ruleChainType.edge);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@ -114,7 +114,7 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
|
|
||||||
if (vm.ruleChainsScope === 'tenant') {
|
if (vm.ruleChainsScope === 'tenant') {
|
||||||
fetchRuleChainsFunction = function (pageLink) {
|
fetchRuleChainsFunction = function (pageLink) {
|
||||||
return fetchRuleChains(pageLink, types.coreRuleChainType);
|
return fetchRuleChains(pageLink, types.ruleChainType.core);
|
||||||
};
|
};
|
||||||
deleteRuleChainFunction = function (ruleChainId) {
|
deleteRuleChainFunction = function (ruleChainId) {
|
||||||
return deleteRuleChain(ruleChainId);
|
return deleteRuleChain(ruleChainId);
|
||||||
@ -162,9 +162,9 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
});
|
});
|
||||||
vm.ruleChainGridConfig.addItemActions.push({
|
vm.ruleChainGridConfig.addItemActions.push({
|
||||||
onAction: function ($event) {
|
onAction: function ($event) {
|
||||||
importExport.importRuleChain($event, types.coreRuleChainType).then(
|
importExport.importRuleChain($event, types.ruleChainType.core).then(
|
||||||
function(ruleChainImport) {
|
function(ruleChainImport) {
|
||||||
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.coreRuleChainType});
|
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.core});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -175,7 +175,7 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
|
|
||||||
} else if (vm.ruleChainsScope === 'edges') {
|
} else if (vm.ruleChainsScope === 'edges') {
|
||||||
fetchRuleChainsFunction = function (pageLink) {
|
fetchRuleChainsFunction = function (pageLink) {
|
||||||
return fetchRuleChains(pageLink, types.edgeRuleChainType);
|
return fetchRuleChains(pageLink, types.ruleChainType.edge);
|
||||||
};
|
};
|
||||||
deleteRuleChainFunction = function (ruleChainId) {
|
deleteRuleChainFunction = function (ruleChainId) {
|
||||||
return deleteRuleChain(ruleChainId);
|
return deleteRuleChain(ruleChainId);
|
||||||
@ -243,9 +243,9 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
});
|
});
|
||||||
vm.ruleChainGridConfig.addItemActions.push({
|
vm.ruleChainGridConfig.addItemActions.push({
|
||||||
onAction: function ($event) {
|
onAction: function ($event) {
|
||||||
importExport.importRuleChain($event, types.edgeRuleChainType).then(
|
importExport.importRuleChain($event, types.ruleChainType.edge).then(
|
||||||
function(ruleChainImport) {
|
function(ruleChainImport) {
|
||||||
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.edgeRuleChainType});
|
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.edge});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -383,9 +383,9 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
function saveRuleChain(ruleChain) {
|
function saveRuleChain(ruleChain) {
|
||||||
if (angular.isUndefined(ruleChain.type)) {
|
if (angular.isUndefined(ruleChain.type)) {
|
||||||
if (vm.ruleChainsScope === 'edges') {
|
if (vm.ruleChainsScope === 'edges') {
|
||||||
ruleChain.type = types.edgeRuleChainType;
|
ruleChain.type = types.ruleChainType.edge;
|
||||||
} else {
|
} else {
|
||||||
ruleChain.type = types.coreRuleChainType;
|
ruleChain.type = types.ruleChainType.core;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ruleChainService.saveRuleChain(ruleChain);
|
return ruleChainService.saveRuleChain(ruleChain);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user