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

Method updateChartData

server/controllers/ChartController.js:363–950  ·  view source on GitHub ↗
(id, user, {
    noSource,
    skipParsing,
    filters,
    isExport,
    getCache,
    cacheOnly = false,
    variables,
    skipSave,
    runtimeOnly = false,
    traceContext,
    finalizeRun = true,
  })

Source from the content-addressed store, hash-verified

361 }
362
363 updateChartData(id, user, {
364 noSource,
365 skipParsing,
366 filters,
367 isExport,
368 getCache,
369 cacheOnly = false,
370 variables,
371 skipSave,
372 runtimeOnly = false,
373 traceContext,
374 finalizeRun = true,
375 }) {
376 let gChart;
377 let gCache;
378 let gChartData;
379 let skipCache = false;
380 let project;
381 let runtimeContext;
382 let effectiveFilters = Array.isArray(filters) ? filters : [];
383 let effectiveVariables = variables || {};
384 const chartTraceContext = traceContext || null;
385 const shouldFinalizeAuditRun = Boolean(chartTraceContext) && finalizeRun !== false;
386 let chartPersistEvent;
387 let effectiveNoSource = noSource;
388 let effectiveSkipParsing = skipParsing;
389 let effectiveGetCache = getCache;
390 const requestedGetCache = Boolean(getCache);
391 const shouldReadRuntimeCache = requestedGetCache;
392 let runtimeChartCacheEntry;
393 let runtimeChartCacheParams;
394 let runtimeChartVersion;
395 let runtimeViewerScope = user ? "authenticated" : "anonymous";
396
397 return this.findById(id)
398 .then(async (chart) => {
399 gChart = chart;
400 if (!chart || !chart.ChartDatasetConfigs || chart.ChartDatasetConfigs.length === 0) {
401 return new Promise((_resolve, reject) => reject(toAuditError("The chart doesn't have any datasets")));
402 }
403
404 if (chart.project_id) {
405 project = await db.Project.findByPk(chart.project_id);
406 }
407
408 runtimeContext = buildChartRuntimeContext(chart, filters, variables, project?.timezone);
409 effectiveFilters = runtimeContext.filters;
410 effectiveVariables = runtimeContext.variables;
411
412 runtimeCache.debugLog("chart_runtime_context", {
413 chartId: id,
414 viewerScope: runtimeViewerScope,
415 getCache: requestedGetCache,
416 isExport: Boolean(isExport),
417 hasRuntimeFilters: Boolean(runtimeContext?.hasRuntimeFilters),
418 cacheable: Boolean(runtimeContext?.cacheableChartPayload?.hasRuntimeFilters),
419 needsSourceRefresh: Boolean(runtimeContext?.needsSourceRefresh),
420 sourceVariantHash: runtimeContext?.sourceVariantHash || null,

Callers 15

generateTemplateMethod · 0.95
exportChartDataMethod · 0.95
findByShareStringMethod · 0.95
findBySharePolicyMethod · 0.95
updateChartFunction · 0.95
refreshChartsForDatasetFunction · 0.95
moveChartToDashboardFunction · 0.95
triggerChartUpdatesMethod · 0.80
runUpdateFunction · 0.80
updateChartFunction · 0.80

Calls 15

findByIdMethod · 0.95
getTableDataMethod · 0.95
plotMethod · 0.95
updateMethod · 0.95
buildChartRuntimeContextFunction · 0.85
recordInstantEventFunction · 0.85
isRuntimeShortCircuitFunction · 0.85
getRuntimeDatasetKeyFunction · 0.85

Tested by

no test coverage detected