|
|
|
@ -409,6 +409,31 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
private checkMissingToRelatedRuleChains() { |
|
|
|
this.edgeService.findMissingToRelatedRuleChains(this.config.componentsData.edgeId).subscribe( |
|
|
|
(missingRuleChains) => { |
|
|
|
if (missingRuleChains && Object.keys(missingRuleChains).length > 0) { |
|
|
|
const formattedMissingRuleChains: Array<string> = new Array<string>(); |
|
|
|
for (const missingRuleChain of Object.keys(missingRuleChains)) { |
|
|
|
const arrayOfMissingRuleChains = missingRuleChains[missingRuleChain]; |
|
|
|
const tmp = '- \'' + missingRuleChain + '\': \'' + arrayOfMissingRuleChains.join('\', ') + '\''; |
|
|
|
formattedMissingRuleChains.push(tmp); |
|
|
|
} |
|
|
|
const message = this.translate.instant('edge.missing-related-rule-chains-text', |
|
|
|
{missingRuleChains: formattedMissingRuleChains.join('<br>')}); |
|
|
|
this.dialogService.alert(this.translate.instant('edge.missing-related-rule-chains-title'), |
|
|
|
message, this.translate.instant('action.close'), true).subscribe( |
|
|
|
() => { |
|
|
|
this.config.updateData(); |
|
|
|
} |
|
|
|
); |
|
|
|
} else { |
|
|
|
this.config.updateData(); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
addRuleChainsToEdge($event: Event) { |
|
|
|
if ($event) { |
|
|
|
$event.stopPropagation(); |
|
|
|
@ -424,28 +449,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
|
|
|
}).afterClosed() |
|
|
|
.subscribe((res) => { |
|
|
|
if (res) { |
|
|
|
this.edgeService.findMissingToRelatedRuleChains(this.config.componentsData.edgeId).subscribe( |
|
|
|
(missingRuleChains) => { |
|
|
|
if (missingRuleChains && Object.keys(missingRuleChains).length > 0) { |
|
|
|
const formattedMissingRuleChains: Array<string> = new Array<string>(); |
|
|
|
for (const missingRuleChain of Object.keys(missingRuleChains)) { |
|
|
|
const arrayOfMissingRuleChains = missingRuleChains[missingRuleChain]; |
|
|
|
const tmp = '- \'' + missingRuleChain + '\': \'' + arrayOfMissingRuleChains.join('\', ') + '\''; |
|
|
|
formattedMissingRuleChains.push(tmp); |
|
|
|
} |
|
|
|
const message = this.translate.instant('edge.missing-related-rule-chains-text', |
|
|
|
{missingRuleChains: formattedMissingRuleChains.join('<br>')}); |
|
|
|
this.dialogService.alert(this.translate.instant('edge.missing-related-rule-chains-title'), |
|
|
|
message, this.translate.instant('action.close'), true).subscribe( |
|
|
|
() => { |
|
|
|
this.config.updateData(); |
|
|
|
} |
|
|
|
); |
|
|
|
} else { |
|
|
|
this.config.updateData(); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
this.checkMissingToRelatedRuleChains(); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
@ -465,7 +469,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
|
|
|
if (res) { |
|
|
|
this.ruleChainService.unassignRuleChainFromEdge(this.config.componentsData.edgeId, ruleChain.id.id).subscribe( |
|
|
|
() => { |
|
|
|
this.config.updateData(this.config.componentsData.ruleChainScope !== 'tenant'); |
|
|
|
this.checkMissingToRelatedRuleChains(); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
@ -493,7 +497,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
|
|
|
); |
|
|
|
forkJoin(tasks).subscribe( |
|
|
|
() => { |
|
|
|
this.config.updateData(); |
|
|
|
this.checkMissingToRelatedRuleChains(); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
|