MCPcopy
hub / github.com/chartbrew/chartbrew / _onAddFilter

Function _onAddFilter

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

Source from the content-addressed store, hash-verified

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];

Callers

nothing calls this directly

Calls 3

runQueryWithFiltersFunction · 0.90
dispatchFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected