(condition)
| 155 | }; |
| 156 | |
| 157 | const _onAddFilter = async (condition) => { |
| 158 | let found = false; |
| 159 | const newConditions = conditions.map((c) => { |
| 160 | let newCondition = c; |
| 161 | if (c.id === condition.id) { |
| 162 | newCondition = condition; |
| 163 | found = true; |
| 164 | } |
| 165 | return newCondition; |
| 166 | }); |
| 167 | if (!found) newConditions.push(condition); |
| 168 | setConditions(newConditions); |
| 169 | |
| 170 | setDataLoading(true); |
| 171 | await dispatch(runQueryWithFilters({ |
| 172 | project_id: chart.project_id, |
| 173 | chart_id: chart.id, |
| 174 | filters: newConditions, |
| 175 | shareToken: searchParams.get("token"), |
| 176 | })) |
| 177 | .then((data) => { |
| 178 | if (data.payload) { |
| 179 | setChart(data.payload); |
| 180 | } |
| 181 | |
| 182 | setDataLoading(false); |
| 183 | }) |
| 184 | .catch(() => { |
| 185 | setDataLoading(false); |
| 186 | }); |
| 187 | }; |
| 188 | |
| 189 | const _onClearFilter = (condition) => { |
| 190 | const newConditions = [...conditions]; |
nothing calls this directly
no test coverage detected