Commit 2bd819ebd4eb3a0e83b1feed248370b4a6fd592b

Authored by Volodymyr Babak
1 parent c07fcf7b

Added rule chain type to edge dialog. Update default edge root rule chain

... ... @@ -9,10 +9,24 @@
9 9 "configuration": null
10 10 },
11 11 "metadata": {
12   - "firstNodeIndex": 2,
  12 + "firstNodeIndex": 0,
13 13 "nodes": [
14 14 {
15 15 "additionalInfo": {
  16 + "description": "Process incoming messages from devices with the alarm rules defined in the device profile. Dispatch all incoming messages with \"Success\" relation type.",
  17 + "layoutX": 203,
  18 + "layoutY": 259
  19 + },
  20 + "type": "org.thingsboard.rule.engine.profile.TbDeviceProfileNode",
  21 + "name": "Device Profile Node",
  22 + "debugMode": false,
  23 + "configuration": {
  24 + "persistAlarmRulesState": false,
  25 + "fetchAlarmRulesStateOnStart": false
  26 + }
  27 + },
  28 + {
  29 + "additionalInfo": {
16 30 "layoutX": 823,
17 31 "layoutY": 157
18 32 },
... ... @@ -99,42 +113,47 @@
99 113 "connections": [
100 114 {
101 115 "fromIndex": 0,
102   - "toIndex": 6,
  116 + "toIndex": 3,
103 117 "type": "Success"
104 118 },
105 119 {
106 120 "fromIndex": 1,
107   - "toIndex": 6,
  121 + "toIndex": 7,
108 122 "type": "Success"
109 123 },
110 124 {
111 125 "fromIndex": 2,
112   - "toIndex": 4,
  126 + "toIndex": 7,
  127 + "type": "Success"
  128 + },
  129 + {
  130 + "fromIndex": 3,
  131 + "toIndex": 6,
  132 + "type": "RPC Request to Device"
  133 + },
  134 + {
  135 + "fromIndex": 3,
  136 + "toIndex": 5,
113 137 "type": "Other"
114 138 },
115 139 {
116   - "fromIndex": 2,
117   - "toIndex": 1,
  140 + "fromIndex": 3,
  141 + "toIndex": 2,
118 142 "type": "Post attributes"
119 143 },
120 144 {
121   - "fromIndex": 2,
122   - "toIndex": 0,
  145 + "fromIndex": 3,
  146 + "toIndex": 1,
123 147 "type": "Post telemetry"
124 148 },
125 149 {
126   - "fromIndex": 2,
127   - "toIndex": 3,
  150 + "fromIndex": 3,
  151 + "toIndex": 4,
128 152 "type": "RPC Request from Device"
129 153 },
130 154 {
131   - "fromIndex": 2,
132   - "toIndex": 5,
133   - "type": "RPC Request to Device"
134   - },
135   - {
136   - "fromIndex": 3,
137   - "toIndex": 6,
  155 + "fromIndex": 4,
  156 + "toIndex": 7,
138 157 "type": "Success"
139 158 }
140 159 ],
... ...
... ... @@ -34,7 +34,8 @@
34 34 <tb-entity-list
35 35 formControlName="entityIds"
36 36 required
37   - [entityType]="entityType">
  37 + [entityType]="entityType"
  38 + [subType]="subType">
38 39 </tb-entity-list>
39 40 </fieldset>
40 41 </div>
... ...
... ... @@ -30,6 +30,7 @@ import { DashboardService } from '@core/http/dashboard.service';
30 30 import { DialogComponent } from '@shared/components/dialog.component';
31 31 import { Router } from '@angular/router';
32 32 import { RuleChainService } from "@core/http/rule-chain.service";
  33 +import { ruleChainType } from "@shared/models/rule-chain.models";
33 34
34 35 export interface AddEntitiesToEdgeDialogData {
35 36 edgeId: string;
... ... @@ -50,6 +51,7 @@ export class AddEntitiesToEdgeDialogComponent extends
50 51 submitted = false;
51 52
52 53 entityType: EntityType;
  54 + subType: string;
53 55
54 56 assignToEdgeTitle: string;
55 57 assignToEdgeText: string;
... ... @@ -74,6 +76,7 @@ export class AddEntitiesToEdgeDialogComponent extends
74 76 this.addEntitiesToEdgeFormGroup = this.fb.group({
75 77 entityIds: [null, [Validators.required]]
76 78 });
  79 + this.subType = '';
77 80 switch (this.data.entityType) {
78 81 case EntityType.DEVICE:
79 82 this.assignToEdgeTitle = 'device.assign-device-to-edge-title';
... ... @@ -82,6 +85,7 @@ export class AddEntitiesToEdgeDialogComponent extends
82 85 case EntityType.RULE_CHAIN:
83 86 this.assignToEdgeTitle = 'rulechain.assign-rulechain-to-edge-title';
84 87 this.assignToEdgeText = 'rulechain.assign-rulechain-to-edge-text';
  88 + this.subType = ruleChainType.edge;
85 89 break;
86 90 case EntityType.ASSET:
87 91 this.assignToEdgeTitle = 'asset.assign-asset-to-edge-title';
... ...
... ... @@ -60,6 +60,9 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
60 60 @Input()
61 61 entityType: EntityType;
62 62
  63 + @Input()
  64 + subType: string;
  65 +
63 66 private requiredValue: boolean;
64 67 get required(): boolean {
65 68 return this.requiredValue;
... ... @@ -216,8 +219,9 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
216 219
217 220 fetchEntities(searchText?: string): Observable<Array<BaseData<EntityId>>> {
218 221 this.searchText = searchText;
  222 +
219 223 return this.entityService.getEntitiesByNameFilter(this.entityType, searchText,
220   - 50, '', {ignoreLoading: true}).pipe(
  224 + 50, this.subType ? this.subType : '', {ignoreLoading: true}).pipe(
221 225 map((data) => data ? data : []));
222 226 }
223 227
... ...