Browse Source

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

pull/3811/head
Volodymyr Babak 6 years ago
parent
commit
2bd819ebd4
  1. 53
      application/src/main/data/json/demo/edge_management/rule_chains/edge_root_rule_chain.json
  2. 3
      ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.html
  3. 4
      ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.ts
  4. 6
      ui-ngx/src/app/shared/components/entity/entity-list.component.ts

53
application/src/main/data/json/demo/edge_management/rule_chains/edge_root_rule_chain.json

@ -9,8 +9,22 @@
"configuration": null "configuration": null
}, },
"metadata": { "metadata": {
"firstNodeIndex": 2, "firstNodeIndex": 0,
"nodes": [ "nodes": [
{
"additionalInfo": {
"description": "Process incoming messages from devices with the alarm rules defined in the device profile. Dispatch all incoming messages with \"Success\" relation type.",
"layoutX": 203,
"layoutY": 259
},
"type": "org.thingsboard.rule.engine.profile.TbDeviceProfileNode",
"name": "Device Profile Node",
"debugMode": false,
"configuration": {
"persistAlarmRulesState": false,
"fetchAlarmRulesStateOnStart": false
}
},
{ {
"additionalInfo": { "additionalInfo": {
"layoutX": 823, "layoutX": 823,
@ -99,42 +113,47 @@
"connections": [ "connections": [
{ {
"fromIndex": 0, "fromIndex": 0,
"toIndex": 6, "toIndex": 3,
"type": "Success" "type": "Success"
}, },
{ {
"fromIndex": 1, "fromIndex": 1,
"toIndex": 6, "toIndex": 7,
"type": "Success" "type": "Success"
}, },
{ {
"fromIndex": 2, "fromIndex": 2,
"toIndex": 4, "toIndex": 7,
"type": "Success"
},
{
"fromIndex": 3,
"toIndex": 6,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 5,
"type": "Other" "type": "Other"
}, },
{ {
"fromIndex": 2, "fromIndex": 3,
"toIndex": 1, "toIndex": 2,
"type": "Post attributes" "type": "Post attributes"
}, },
{ {
"fromIndex": 2, "fromIndex": 3,
"toIndex": 0, "toIndex": 1,
"type": "Post telemetry" "type": "Post telemetry"
}, },
{ {
"fromIndex": 2, "fromIndex": 3,
"toIndex": 3, "toIndex": 4,
"type": "RPC Request from Device" "type": "RPC Request from Device"
}, },
{ {
"fromIndex": 2, "fromIndex": 4,
"toIndex": 5, "toIndex": 7,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 6,
"type": "Success" "type": "Success"
} }
], ],

3
ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.html

@ -34,7 +34,8 @@
<tb-entity-list <tb-entity-list
formControlName="entityIds" formControlName="entityIds"
required required
[entityType]="entityType"> [entityType]="entityType"
[subType]="subType">
</tb-entity-list> </tb-entity-list>
</fieldset> </fieldset>
</div> </div>

4
ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.ts

@ -30,6 +30,7 @@ import { DashboardService } from '@core/http/dashboard.service';
import { DialogComponent } from '@shared/components/dialog.component'; import { DialogComponent } from '@shared/components/dialog.component';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { RuleChainService } from "@core/http/rule-chain.service"; import { RuleChainService } from "@core/http/rule-chain.service";
import { ruleChainType } from "@shared/models/rule-chain.models";
export interface AddEntitiesToEdgeDialogData { export interface AddEntitiesToEdgeDialogData {
edgeId: string; edgeId: string;
@ -50,6 +51,7 @@ export class AddEntitiesToEdgeDialogComponent extends
submitted = false; submitted = false;
entityType: EntityType; entityType: EntityType;
subType: string;
assignToEdgeTitle: string; assignToEdgeTitle: string;
assignToEdgeText: string; assignToEdgeText: string;
@ -74,6 +76,7 @@ export class AddEntitiesToEdgeDialogComponent extends
this.addEntitiesToEdgeFormGroup = this.fb.group({ this.addEntitiesToEdgeFormGroup = this.fb.group({
entityIds: [null, [Validators.required]] entityIds: [null, [Validators.required]]
}); });
this.subType = '';
switch (this.data.entityType) { switch (this.data.entityType) {
case EntityType.DEVICE: case EntityType.DEVICE:
this.assignToEdgeTitle = 'device.assign-device-to-edge-title'; this.assignToEdgeTitle = 'device.assign-device-to-edge-title';
@ -82,6 +85,7 @@ export class AddEntitiesToEdgeDialogComponent extends
case EntityType.RULE_CHAIN: case EntityType.RULE_CHAIN:
this.assignToEdgeTitle = 'rulechain.assign-rulechain-to-edge-title'; this.assignToEdgeTitle = 'rulechain.assign-rulechain-to-edge-title';
this.assignToEdgeText = 'rulechain.assign-rulechain-to-edge-text'; this.assignToEdgeText = 'rulechain.assign-rulechain-to-edge-text';
this.subType = ruleChainType.edge;
break; break;
case EntityType.ASSET: case EntityType.ASSET:
this.assignToEdgeTitle = 'asset.assign-asset-to-edge-title'; this.assignToEdgeTitle = 'asset.assign-asset-to-edge-title';

6
ui-ngx/src/app/shared/components/entity/entity-list.component.ts

@ -60,6 +60,9 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
@Input() @Input()
entityType: EntityType; entityType: EntityType;
@Input()
subType: string;
private requiredValue: boolean; private requiredValue: boolean;
get required(): boolean { get required(): boolean {
return this.requiredValue; return this.requiredValue;
@ -216,8 +219,9 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
fetchEntities(searchText?: string): Observable<Array<BaseData<EntityId>>> { fetchEntities(searchText?: string): Observable<Array<BaseData<EntityId>>> {
this.searchText = searchText; this.searchText = searchText;
return this.entityService.getEntitiesByNameFilter(this.entityType, searchText, return this.entityService.getEntitiesByNameFilter(this.entityType, searchText,
50, '', {ignoreLoading: true}).pipe( 50, this.subType ? this.subType : '', {ignoreLoading: true}).pipe(
map((data) => data ? data : [])); map((data) => data ? data : []));
} }

Loading…
Cancel
Save