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
},
"metadata": {
"firstNodeIndex": 2,
"firstNodeIndex": 0,
"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": {
"layoutX": 823,
@ -99,42 +113,47 @@
"connections": [
{
"fromIndex": 0,
"toIndex": 6,
"toIndex": 3,
"type": "Success"
},
{
"fromIndex": 1,
"toIndex": 6,
"toIndex": 7,
"type": "Success"
},
{
"fromIndex": 2,
"toIndex": 4,
"toIndex": 7,
"type": "Success"
},
{
"fromIndex": 3,
"toIndex": 6,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 5,
"type": "Other"
},
{
"fromIndex": 2,
"toIndex": 1,
"fromIndex": 3,
"toIndex": 2,
"type": "Post attributes"
},
{
"fromIndex": 2,
"toIndex": 0,
"fromIndex": 3,
"toIndex": 1,
"type": "Post telemetry"
},
{
"fromIndex": 2,
"toIndex": 3,
"fromIndex": 3,
"toIndex": 4,
"type": "RPC Request from Device"
},
{
"fromIndex": 2,
"toIndex": 5,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 6,
"fromIndex": 4,
"toIndex": 7,
"type": "Success"
}
],

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

@ -34,7 +34,8 @@
<tb-entity-list
formControlName="entityIds"
required
[entityType]="entityType">
[entityType]="entityType"
[subType]="subType">
</tb-entity-list>
</fieldset>
</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 { Router } from '@angular/router';
import { RuleChainService } from "@core/http/rule-chain.service";
import { ruleChainType } from "@shared/models/rule-chain.models";
export interface AddEntitiesToEdgeDialogData {
edgeId: string;
@ -50,6 +51,7 @@ export class AddEntitiesToEdgeDialogComponent extends
submitted = false;
entityType: EntityType;
subType: string;
assignToEdgeTitle: string;
assignToEdgeText: string;
@ -74,6 +76,7 @@ export class AddEntitiesToEdgeDialogComponent extends
this.addEntitiesToEdgeFormGroup = this.fb.group({
entityIds: [null, [Validators.required]]
});
this.subType = '';
switch (this.data.entityType) {
case EntityType.DEVICE:
this.assignToEdgeTitle = 'device.assign-device-to-edge-title';
@ -82,6 +85,7 @@ export class AddEntitiesToEdgeDialogComponent extends
case EntityType.RULE_CHAIN:
this.assignToEdgeTitle = 'rulechain.assign-rulechain-to-edge-title';
this.assignToEdgeText = 'rulechain.assign-rulechain-to-edge-text';
this.subType = ruleChainType.edge;
break;
case EntityType.ASSET:
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()
entityType: EntityType;
@Input()
subType: string;
private requiredValue: boolean;
get required(): boolean {
return this.requiredValue;
@ -216,8 +219,9 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
fetchEntities(searchText?: string): Observable<Array<BaseData<EntityId>>> {
this.searchText = searchText;
return this.entityService.getEntitiesByNameFilter(this.entityType, searchText,
50, '', {ignoreLoading: true}).pipe(
50, this.subType ? this.subType : '', {ignoreLoading: true}).pipe(
map((data) => data ? data : []));
}

Loading…
Cancel
Save