MCPcopy
hub / github.com/chartbrew/chartbrew / _onClearFilter

Function _onClearFilter

client/src/containers/SharedChart.jsx:189–215  ·  view source on GitHub ↗
(condition)

Source from the content-addressed store, hash-verified

187 };
188
189 const _onClearFilter = (condition) => {
190 const newConditions = [...conditions];
191 let clearIndex;
192 for (let i = 0; i < conditions.length; i++) {
193 if (conditions[i].id === condition.id) {
194 clearIndex = i;
195 break;
196 }
197 }
198 if (clearIndex > -1) newConditions.splice(clearIndex, 1);
199
200 setConditions(newConditions);
201
202 setDataLoading(true);
203 dispatch(runQueryWithFilters({
204 project_id: chart.project_id,
205 chart_id: chart.id,
206 filters: newConditions,
207 shareToken: searchParams.get("token"),
208 }))
209 .then((data) => {
210 if (data.payload) {
211 setChart(data.payload);
212 }
213 setDataLoading(false);
214 });
215 };
216
217 const _checkIfFilters = () => {
218 return getExposedChartFilters(chart).length > 0;

Callers

nothing calls this directly

Calls 3

runQueryWithFiltersFunction · 0.90
dispatchFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected