MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / runQueryWithFilters

Function runQueryWithFilters

client/src/actions/chart.js:274–305  ·  view source on GitHub ↗
(projectId, chartId, filters)

Source from the content-addressed store, hash-verified

272}
273
274export function runQueryWithFilters(projectId, chartId, filters) {
275 return (dispatch) => {
276 const token = cookie.load("brewToken");
277 const url = `${API_HOST}/project/${projectId}/chart/${chartId}/filter?no_source=true`;
278 const method = "POST";
279 const body = JSON.stringify({ filters });
280 const headers = new Headers({
281 "Accept": "application/json",
282 "authorization": `Bearer ${token}`,
283 "content-type": "application/json",
284 });
285
286 dispatch({ type: FETCH_CHART, chartId });
287 return fetch(url, { method, body, headers })
288 .then((response) => {
289 if (!response.ok) {
290 dispatch(addError(response.status));
291 return new Promise((resolve, reject) => reject(response.status));
292 }
293
294 return response.json();
295 })
296 .then((chart) => {
297 dispatch({ type: FETCH_CHART_SUCCESS, chart });
298 return chart;
299 })
300 .catch((error) => {
301 dispatch({ type: FETCH_CHART_FAIL, chartId });
302 return new Promise((resolve, reject) => reject(error));
303 });
304 };
305}
306
307export function runQueryOnPublic(projectId, chartId, password, shareToken, variables) {
308 return (dispatch) => {

Callers 12

_onAddFilterFunction · 0.90
_onClearFilterFunction · 0.90
_onAddFilterFunction · 0.90
_onClearFilterFunction · 0.90
_runFilteringFunction · 0.90
_onRefreshDataFunction · 0.90
_onRefreshPreviewFunction · 0.90
_onAddFilterFunction · 0.90
_onClearFilterFunction · 0.90
_runChartRequestFunction · 0.90
_runChartRequestFunction · 0.90
_runChartRequestFunction · 0.90

Calls 2

addErrorFunction · 0.90
dispatchFunction · 0.50

Tested by

no test coverage detected