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