Commit 21fa66c61fdf070be9b458dcc5ea25806eba9cdc
Merge branch 'master' of github.com:thingsboard/thingsboard
Showing
6 changed files
with
31 additions
and
5 deletions
... | ... | @@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit; |
58 | 58 | |
59 | 59 | @Data |
60 | 60 | @Slf4j |
61 | -class TbHttpClient { | |
61 | +public class TbHttpClient { | |
62 | 62 | |
63 | 63 | private static final String STATUS = "status"; |
64 | 64 | private static final String STATUS_CODE = "statusCode"; |
... | ... | @@ -162,7 +162,7 @@ class TbHttpClient { |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - void processMessage(TbContext ctx, TbMsg msg) { | |
165 | + public void processMessage(TbContext ctx, TbMsg msg) { | |
166 | 166 | String endpointUrl = TbNodeUtils.processPattern(config.getRestEndpointUrlPattern(), msg.getMetaData()); |
167 | 167 | HttpHeaders headers = prepareHeaders(msg.getMetaData()); |
168 | 168 | HttpMethod method = HttpMethod.valueOf(config.getRequestMethod()); | ... | ... |
... | ... | @@ -46,7 +46,7 @@ import org.thingsboard.server.common.msg.TbMsg; |
46 | 46 | public class TbRestApiCallNode implements TbNode { |
47 | 47 | |
48 | 48 | private boolean useRedisQueueForMsgPersistence; |
49 | - private TbHttpClient httpClient; | |
49 | + protected TbHttpClient httpClient; | |
50 | 50 | |
51 | 51 | @Override |
52 | 52 | public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException { | ... | ... |
... | ... | @@ -15,12 +15,14 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.rule.engine.rest; |
17 | 17 | |
18 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
18 | 19 | import lombok.Data; |
19 | 20 | import org.thingsboard.rule.engine.api.NodeConfiguration; |
20 | 21 | |
21 | 22 | import java.util.Collections; |
22 | 23 | import java.util.Map; |
23 | 24 | |
25 | +@JsonIgnoreProperties(ignoreUnknown = true) | |
24 | 26 | @Data |
25 | 27 | public class TbRestApiCallNodeConfiguration implements NodeConfiguration<TbRestApiCallNodeConfiguration> { |
26 | 28 | ... | ... |
... | ... | @@ -107,6 +107,11 @@ export class DefaultStateControllerComponent extends StateControllerComponent im |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | + public pushAndOpenState(states: Array<StateObject>, openRightLayout?: boolean): void { | |
111 | + const state = states[states.length - 1]; | |
112 | + this.openState(state.id, state.params, openRightLayout); | |
113 | + } | |
114 | + | |
110 | 115 | public updateState(id: string, params?: StateParams, openRightLayout?: boolean): void { |
111 | 116 | if (!id) { |
112 | 117 | id = this.getStateId(); | ... | ... |
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | import { Component, NgZone, OnDestroy, OnInit } from '@angular/core'; |
18 | 18 | import { StateObject, StateParams } from '@core/api/widget-api.models'; |
19 | 19 | import { ActivatedRoute, Router } from '@angular/router'; |
20 | -import { Observable, of } from 'rxjs'; | |
20 | +import { forkJoin, Observable, of } from 'rxjs'; | |
21 | 21 | import { StateControllerState } from './state-controller.models'; |
22 | 22 | import { StateControllerComponent } from './state-controller.component'; |
23 | 23 | import { StatesControllerService } from '@home/pages/dashboard/states/states-controller.service'; |
... | ... | @@ -116,6 +116,23 @@ export class EntityStateControllerComponent extends StateControllerComponent imp |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | + public pushAndOpenState(states: Array<StateObject>, openRightLayout?: boolean): void { | |
120 | + if (this.states) { | |
121 | + for (const state of states) { | |
122 | + if (!this.states[state.id]) { | |
123 | + return; | |
124 | + } | |
125 | + } | |
126 | + forkJoin(states.map(state => this.resolveEntity(state.params))).subscribe( | |
127 | + () => { | |
128 | + this.stateObject.push(...states); | |
129 | + this.selectedStateIndex = this.stateObject.length - 1; | |
130 | + this.gotoState(this.stateObject[this.stateObject.length - 1].id, true, openRightLayout); | |
131 | + } | |
132 | + ); | |
133 | + } | |
134 | + } | |
135 | + | |
119 | 136 | public updateState(id: string, params?: StateParams, openRightLayout?: boolean): void { |
120 | 137 | if (!id) { |
121 | 138 | id = this.getStateId(); | ... | ... |
... | ... | @@ -22,7 +22,7 @@ import { NgZone, OnDestroy, OnInit } from '@angular/core'; |
22 | 22 | import { ActivatedRoute, Params, Router } from '@angular/router'; |
23 | 23 | import { StatesControllerService } from '@home/pages/dashboard/states/states-controller.service'; |
24 | 24 | import { EntityId } from '@app/shared/models/id/entity-id'; |
25 | -import { StateParams } from '@app/core/api/widget-api.models'; | |
25 | +import { StateObject, StateParams } from '@app/core/api/widget-api.models'; | |
26 | 26 | |
27 | 27 | export abstract class StateControllerComponent implements IStateControllerComponent, OnInit, OnDestroy { |
28 | 28 | |
... | ... | @@ -178,6 +178,8 @@ export abstract class StateControllerComponent implements IStateControllerCompon |
178 | 178 | |
179 | 179 | public abstract openState(id: string, params?: StateParams, openRightLayout?: boolean): void; |
180 | 180 | |
181 | + public abstract pushAndOpenState(states: Array<StateObject>, openRightLayout?: boolean): void; | |
182 | + | |
181 | 183 | public abstract resetState(): void; |
182 | 184 | |
183 | 185 | public abstract updateState(id?: string, params?: StateParams, openRightLayout?: boolean): void; | ... | ... |