...
|
...
|
@@ -74,11 +74,11 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
74
|
74
|
new EntityTableColumn<RuleChain>('name', 'rulechain.name', '100%'),
|
75
|
75
|
new EntityTableColumn<RuleChain>('root', 'rulechain.root', '60px',
|
76
|
76
|
entity => {
|
77
|
|
- if (this.config.componentsData.edgeId) {
|
78
|
|
- return checkBoxCell((this.edge.rootRuleChainId.id == entity.id.id));
|
79
|
|
- } else {
|
80
|
|
- return checkBoxCell(entity.root);
|
81
|
|
- }
|
|
77
|
+ if (isDefined(this.config.componentsData.edgeId)) {
|
|
78
|
+ return checkBoxCell((this.config.componentsData.edge.rootRuleChainId.id == entity.id.id));
|
|
79
|
+ } else {
|
|
80
|
+ return checkBoxCell(entity.root);
|
|
81
|
+ }
|
82
|
82
|
})
|
83
|
83
|
);
|
84
|
84
|
this.config.deleteEntityTitle = ruleChain => this.translate.instant('rulechain.delete-rulechain-title',
|
...
|
...
|
@@ -99,13 +99,14 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
99
|
99
|
edgeId: routeParams.edgeId
|
100
|
100
|
};
|
101
|
101
|
if (this.config.componentsData.edgeId) {
|
102
|
|
- this.config.entitySelectionEnabled = ruleChain => this.edge.rootRuleChainId.id != ruleChain.id.id;
|
|
102
|
+ this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id;
|
103
|
103
|
this.config.deleteEnabled = () => false;
|
104
|
104
|
this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => {
|
105
|
|
- this.edge = edge;
|
106
|
|
- this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains')
|
|
105
|
+ this.config.componentsData.edge = edge;
|
|
106
|
+ this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains');
|
107
|
107
|
});
|
108
|
|
- } else {
|
|
108
|
+ }
|
|
109
|
+ else {
|
109
|
110
|
this.config.entitySelectionEnabled = ruleChain => ruleChain && !ruleChain.root;
|
110
|
111
|
this.config.deleteEnabled = (ruleChain) => ruleChain && !ruleChain.root;
|
111
|
112
|
}
|
...
|
...
|
@@ -235,7 +236,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
235
|
236
|
{
|
236
|
237
|
name: this.translate.instant('edge.unassign-from-edge'),
|
237
|
238
|
icon: 'portable_wifi_off',
|
238
|
|
- isEnabled: (entity) => entity.id.id != this.edge.rootRuleChainId.id,
|
|
239
|
+ isEnabled: (entity) => entity.id.id != this.config.componentsData.edge.rootRuleChainId.id,
|
239
|
240
|
onAction: ($event, entity) => this.unassignFromEdge($event, entity)
|
240
|
241
|
}
|
241
|
242
|
)
|
...
|
...
|
@@ -295,7 +296,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
295
|
296
|
if (this.config.componentsData.edgeId) {
|
296
|
297
|
this.edgeService.setRootRuleChain(this.config.componentsData.edgeId, ruleChain.id.id).subscribe(
|
297
|
298
|
(edge) => {
|
298
|
|
- this.edge = edge;
|
|
299
|
+ this.config.componentsData.edge = edge;
|
299
|
300
|
this.config.table.updateData();
|
300
|
301
|
}
|
301
|
302
|
)
|
...
|
...
|
@@ -465,7 +466,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
465
|
466
|
|
466
|
467
|
isNonRootRuleChain(ruleChain: RuleChain) {
|
467
|
468
|
if (this.config.componentsData.edgeId) {
|
468
|
|
- return (isDefined(this.edge.rootRuleChainId) && this.edge.rootRuleChainId != null && this.edge.rootRuleChainId.id != ruleChain.id.id);
|
|
469
|
+ return (isDefined(this.config.componentsData.edge.rootRuleChainId) && this.config.componentsData.edge.rootRuleChainId != null && this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id);
|
469
|
470
|
}
|
470
|
471
|
return (isDefined(ruleChain)) && !ruleChain.root;
|
471
|
472
|
}
|
...
|
...
|
|