The current query is passed as a prop called actuate
in the actuator components. It takes in the sensor along with the operator and customQuery spec.
We will revamp the data query format to be sensor specific. Each sensor defines its own query format via the customQuery
and executeQuery
props.
Example Usage:
<SingleList
..
customQuery={this.customQuery}
executeQuery={true}
/>
customQuery
is an optional prop for overriding the default query that the component comes with. It takes a function with one argument value
that contains the sensor's current input state.
executeQuery
is a boolean prop that is set by default to true
. When set to false
, the query is not executed when the sensor value updates.
In the actuator component, we will have a react
prop which takes a dependency Object
of all the sensors it depends on.
The dependency object is formed by boolean clauses: and
, or
, not
as key values which can either have component(s) or a nested boolean clause as their value.
Example#1:
react={{
"and": "citySensor"
}}
Example#2:
react={{
"and": ["citySensor", "searchSensor"]
}}
Example#3:
react={{
"and": {
"or": "geoBoundsSensor",
"and": "citySensor"
}
}}
Example#4:
react={{
"or": {
"and": ["citySensor", "dataSensor"],
"not": "searchSensor"
}
}}
In theory, we can allow any level of nesting using conjunctions. This tree when parsed, should match cleanly to the boolean query in Elasticsearch Query DSL except the filter clause.