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

Function runQuery

client/src/actions/chart.js:235–272  ·  view source on GitHub ↗
(
  projectId, chartId, noSource = false, skipParsing = false, getCache, filters
)

Source from the content-addressed store, hash-verified

233}
234
235export function runQuery(
236 projectId, chartId, noSource = false, skipParsing = false, getCache, filters
237) {
238 return (dispatch) => {
239 const token = cookie.load("brewToken");
240 let url = `${API_HOST}/project/${projectId}/chart/${chartId}/query?no_source=${noSource}&skip_parsing=${skipParsing}`;
241 const method = "POST";
242 const headers = new Headers({
243 "Accept": "application/json",
244 "authorization": `Bearer ${token}`,
245 "Content-Type": "application/json",
246 });
247 const body = JSON.stringify({ filters: filters && !filters.length ? [filters] : filters });
248
249 if (getCache) {
250 url += "&getCache=true";
251 }
252
253 dispatch({ type: FETCH_CHART, chartId });
254 return fetch(url, { method, body, headers })
255 .then((response) => {
256 if (!response.ok) {
257 dispatch(addError(response.status));
258 return new Promise((resolve, reject) => reject(response.status));
259 }
260
261 return response.json();
262 })
263 .then((chart) => {
264 dispatch({ type: FETCH_CHART_SUCCESS, chart });
265 return chart;
266 })
267 .catch((error) => {
268 dispatch({ type: FETCH_CHART_FAIL, chartId });
269 return new Promise((resolve, reject) => reject(error));
270 });
271 };
272}
273
274export function runQueryWithFilters(projectId, chartId, filters) {
275 return (dispatch) => {

Callers 15

_onGetChartDataFunction · 0.90
_onCreateFromDatasetFunction · 0.90
_onRefreshDataFunction · 0.90
_onRefreshPreviewFunction · 0.90
_onCreateCdcFunction · 0.90
_refreshChartFunction · 0.90
_onRunQueryFunction · 0.90
_onRemoveCdcFunction · 0.90
DatasetBuilderFunction · 0.90
_onUpdateDatasetFunction · 0.90
_onRefreshPreviewFunction · 0.90
_persistDatasetFunction · 0.90

Calls 2

addErrorFunction · 0.90
dispatchFunction · 0.50

Tested by

no test coverage detected