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