Check related rulechain during unassing from edge
This commit is contained in:
parent
880ee028ab
commit
ffc18489c4
@ -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) {
|
addRuleChainsToEdge($event: Event) {
|
||||||
if ($event) {
|
if ($event) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
@ -424,28 +449,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
|
|||||||
}).afterClosed()
|
}).afterClosed()
|
||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.edgeService.findMissingToRelatedRuleChains(this.config.componentsData.edgeId).subscribe(
|
this.checkMissingToRelatedRuleChains();
|
||||||
(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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -465,7 +469,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
|
|||||||
if (res) {
|
if (res) {
|
||||||
this.ruleChainService.unassignRuleChainFromEdge(this.config.componentsData.edgeId, ruleChain.id.id).subscribe(
|
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(
|
forkJoin(tasks).subscribe(
|
||||||
() => {
|
() => {
|
||||||
this.config.updateData();
|
this.checkMissingToRelatedRuleChains();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user