Merge branch 'master' of github.com:thingsboard/thingsboard
This commit is contained in:
		
						commit
						21fa66c61f
					
				@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@Slf4j
 | 
			
		||||
class TbHttpClient {
 | 
			
		||||
public class TbHttpClient {
 | 
			
		||||
 | 
			
		||||
    private static final String STATUS = "status";
 | 
			
		||||
    private static final String STATUS_CODE = "statusCode";
 | 
			
		||||
@ -162,7 +162,7 @@ class TbHttpClient {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void processMessage(TbContext ctx, TbMsg msg) {
 | 
			
		||||
    public void processMessage(TbContext ctx, TbMsg msg) {
 | 
			
		||||
        String endpointUrl = TbNodeUtils.processPattern(config.getRestEndpointUrlPattern(), msg.getMetaData());
 | 
			
		||||
        HttpHeaders headers = prepareHeaders(msg.getMetaData());
 | 
			
		||||
        HttpMethod method = HttpMethod.valueOf(config.getRequestMethod());
 | 
			
		||||
 | 
			
		||||
@ -46,7 +46,7 @@ import org.thingsboard.server.common.msg.TbMsg;
 | 
			
		||||
public class TbRestApiCallNode implements TbNode {
 | 
			
		||||
 | 
			
		||||
    private boolean useRedisQueueForMsgPersistence;
 | 
			
		||||
    private TbHttpClient httpClient;
 | 
			
		||||
    protected TbHttpClient httpClient;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
 | 
			
		||||
 | 
			
		||||
@ -15,12 +15,14 @@
 | 
			
		||||
 */
 | 
			
		||||
package org.thingsboard.rule.engine.rest;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import org.thingsboard.rule.engine.api.NodeConfiguration;
 | 
			
		||||
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@JsonIgnoreProperties(ignoreUnknown = true)
 | 
			
		||||
@Data
 | 
			
		||||
public class TbRestApiCallNodeConfiguration implements NodeConfiguration<TbRestApiCallNodeConfiguration> {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -107,6 +107,11 @@ export class DefaultStateControllerComponent extends StateControllerComponent im
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public pushAndOpenState(states: Array<StateObject>, openRightLayout?: boolean): void {
 | 
			
		||||
    const state = states[states.length - 1];
 | 
			
		||||
    this.openState(state.id, state.params, openRightLayout);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public updateState(id: string, params?: StateParams, openRightLayout?: boolean): void {
 | 
			
		||||
    if (!id) {
 | 
			
		||||
      id = this.getStateId();
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
import { Component, NgZone, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { StateObject, StateParams } from '@core/api/widget-api.models';
 | 
			
		||||
import { ActivatedRoute, Router } from '@angular/router';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
import { forkJoin, Observable, of } from 'rxjs';
 | 
			
		||||
import { StateControllerState } from './state-controller.models';
 | 
			
		||||
import { StateControllerComponent } from './state-controller.component';
 | 
			
		||||
import { StatesControllerService } from '@home/pages/dashboard/states/states-controller.service';
 | 
			
		||||
@ -116,6 +116,23 @@ export class EntityStateControllerComponent extends StateControllerComponent imp
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public pushAndOpenState(states: Array<StateObject>, openRightLayout?: boolean): void {
 | 
			
		||||
    if (this.states) {
 | 
			
		||||
      for (const state of states) {
 | 
			
		||||
        if (!this.states[state.id]) {
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      forkJoin(states.map(state => this.resolveEntity(state.params))).subscribe(
 | 
			
		||||
        () => {
 | 
			
		||||
          this.stateObject.push(...states);
 | 
			
		||||
          this.selectedStateIndex = this.stateObject.length - 1;
 | 
			
		||||
          this.gotoState(this.stateObject[this.stateObject.length - 1].id, true, openRightLayout);
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public updateState(id: string, params?: StateParams, openRightLayout?: boolean): void {
 | 
			
		||||
    if (!id) {
 | 
			
		||||
      id = this.getStateId();
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ import { NgZone, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { ActivatedRoute, Params, Router } from '@angular/router';
 | 
			
		||||
import { StatesControllerService } from '@home/pages/dashboard/states/states-controller.service';
 | 
			
		||||
import { EntityId } from '@app/shared/models/id/entity-id';
 | 
			
		||||
import { StateParams } from '@app/core/api/widget-api.models';
 | 
			
		||||
import { StateObject, StateParams } from '@app/core/api/widget-api.models';
 | 
			
		||||
 | 
			
		||||
export abstract class StateControllerComponent implements IStateControllerComponent, OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
@ -178,6 +178,8 @@ export abstract class StateControllerComponent implements IStateControllerCompon
 | 
			
		||||
 | 
			
		||||
  public abstract openState(id: string, params?: StateParams, openRightLayout?: boolean): void;
 | 
			
		||||
 | 
			
		||||
  public abstract pushAndOpenState(states: Array<StateObject>, openRightLayout?: boolean): void;
 | 
			
		||||
 | 
			
		||||
  public abstract resetState(): void;
 | 
			
		||||
 | 
			
		||||
  public abstract updateState(id?: string, params?: StateParams, openRightLayout?: boolean): void;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user