|
|
|
@ -22,8 +22,8 @@ import addRuleChainsToEdgeTemplate from "./add-rulechains-to-edge.tpl.html"; |
|
|
|
/* eslint-enable import/no-unresolved, import/default */ |
|
|
|
|
|
|
|
/*@ngInject*/ |
|
|
|
export default function RuleChainsController(ruleChainService, userService, edgeService, importExport, $state, |
|
|
|
$stateParams, $filter, $translate, $mdDialog, $document, $q, types) { |
|
|
|
export default function RuleChainsController(ruleChainService, userService, importExport, $state, $stateParams, $filter, $translate, $mdDialog, types, |
|
|
|
$document, $q, edgeService) { |
|
|
|
|
|
|
|
var vm = this; |
|
|
|
var edgeId = $stateParams.edgeId; |
|
|
|
@ -114,7 +114,7 @@ export default function RuleChainsController(ruleChainService, userService, edge |
|
|
|
|
|
|
|
if (vm.ruleChainsScope === 'tenant') { |
|
|
|
fetchRuleChainsFunction = function (pageLink) { |
|
|
|
return fetchRuleChains(pageLink, types.coreRuleChainType); |
|
|
|
return fetchRuleChains(pageLink, types.ruleChainType.core); |
|
|
|
}; |
|
|
|
deleteRuleChainFunction = function (ruleChainId) { |
|
|
|
return deleteRuleChain(ruleChainId); |
|
|
|
@ -162,9 +162,9 @@ export default function RuleChainsController(ruleChainService, userService, edge |
|
|
|
}); |
|
|
|
vm.ruleChainGridConfig.addItemActions.push({ |
|
|
|
onAction: function ($event) { |
|
|
|
importExport.importRuleChain($event, types.coreRuleChainType).then( |
|
|
|
importExport.importRuleChain($event, types.ruleChainType.core).then( |
|
|
|
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') { |
|
|
|
fetchRuleChainsFunction = function (pageLink) { |
|
|
|
return fetchRuleChains(pageLink, types.edgeRuleChainType); |
|
|
|
return fetchRuleChains(pageLink, types.ruleChainType.edge); |
|
|
|
}; |
|
|
|
deleteRuleChainFunction = function (ruleChainId) { |
|
|
|
return deleteRuleChain(ruleChainId); |
|
|
|
@ -203,21 +203,21 @@ export default function RuleChainsController(ruleChainService, userService, edge |
|
|
|
|
|
|
|
ruleChainActionsList.push({ |
|
|
|
onAction: function ($event, item) { |
|
|
|
vm.grid.deleteItem($event, item); |
|
|
|
setDefaultRootEdgeRuleChain($event, item); |
|
|
|
}, |
|
|
|
name: function() { return $translate.instant('action.delete') }, |
|
|
|
details: function() { return $translate.instant('rulechain.delete') }, |
|
|
|
icon: "delete", |
|
|
|
name: function() { return $translate.instant('rulechain.set-default-root-edge') }, |
|
|
|
details: function() { return $translate.instant('rulechain.set-default-root-edge') }, |
|
|
|
icon: "flag", |
|
|
|
isEnabled: isNonRootRuleChain |
|
|
|
}); |
|
|
|
|
|
|
|
ruleChainActionsList.push({ |
|
|
|
onAction: function ($event, item) { |
|
|
|
setDefaultRootEdgeRuleChain($event, item); |
|
|
|
vm.grid.deleteItem($event, item); |
|
|
|
}, |
|
|
|
name: function() { return $translate.instant('rulechain.set-default-root-edge') }, |
|
|
|
details: function() { return $translate.instant('rulechain.set-default-root-edge') }, |
|
|
|
icon: "flag", |
|
|
|
name: function() { return $translate.instant('action.delete') }, |
|
|
|
details: function() { return $translate.instant('rulechain.delete') }, |
|
|
|
icon: "delete", |
|
|
|
isEnabled: isNonRootRuleChain |
|
|
|
}); |
|
|
|
|
|
|
|
@ -243,9 +243,9 @@ export default function RuleChainsController(ruleChainService, userService, edge |
|
|
|
}); |
|
|
|
vm.ruleChainGridConfig.addItemActions.push({ |
|
|
|
onAction: function ($event) { |
|
|
|
importExport.importRuleChain($event, types.edgeRuleChainType).then( |
|
|
|
importExport.importRuleChain($event, types.ruleChainType.edge).then( |
|
|
|
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) { |
|
|
|
if (angular.isUndefined(ruleChain.type)) { |
|
|
|
if (vm.ruleChainsScope === 'edges') { |
|
|
|
ruleChain.type = types.edgeRuleChainType; |
|
|
|
ruleChain.type = types.ruleChainType.edge; |
|
|
|
} else { |
|
|
|
ruleChain.type = types.coreRuleChainType; |
|
|
|
ruleChain.type = types.ruleChainType.core; |
|
|
|
} |
|
|
|
} |
|
|
|
return ruleChainService.saveRuleChain(ruleChain); |
|
|
|
@ -395,13 +395,13 @@ export default function RuleChainsController(ruleChainService, userService, edge |
|
|
|
if ($event) { |
|
|
|
$event.stopPropagation(); |
|
|
|
} |
|
|
|
|
|
|
|
var ruleChainParams = {ruleChainId: ruleChain.id.id}; |
|
|
|
if (vm.ruleChainsScope === 'edge') { |
|
|
|
$state.go('home.edges.ruleChains.ruleChain', {ruleChainId: ruleChain.id.id, edgeId: vm.edge.id.id}); |
|
|
|
$state.go('home.edges.ruleChains.ruleChain', Object.assign(ruleChainParams, edgeId = vm.edge.id.id)); |
|
|
|
} else if (vm.ruleChainsScope === 'edges') { |
|
|
|
$state.go('home.ruleChains.edge.ruleChain', {ruleChainId: ruleChain.id.id}); |
|
|
|
$state.go('home.ruleChains.edge.ruleChain', ruleChainParams); |
|
|
|
} else { |
|
|
|
$state.go('home.ruleChains.core.ruleChain', {ruleChainId: ruleChain.id.id}); |
|
|
|
$state.go('home.ruleChains.core.ruleChain', ruleChainParams); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|