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

Function buildChartRuntimeContext

server/modules/chartRuntimeFilters.js:257–281  ·  view source on GitHub ↗
(chart, filters = [], variables = {}, timezone = "")

Source from the content-addressed store, hash-verified

255}
256
257function buildChartRuntimeContext(chart, filters = [], variables = {}, timezone = "") {
258 const classifiedPayload = classifyRuntimePayload(filters, variables);
259 const normalizedFilters = classifiedPayload.normalizedPayload.filters;
260 const normalizedVariables = classifiedPayload.normalizedPayload.variables;
261 const configuredDateRange = resolveChartConfiguredDateRange(chart, timezone);
262 const dashboardDateRange = resolveDashboardDateRange(normalizedFilters, timezone);
263 const effectiveDateRange = intersectDateRanges(configuredDateRange, dashboardDateRange);
264
265 return {
266 filters: normalizedFilters,
267 variables: normalizedVariables,
268 configuredDateRange,
269 dashboardDateRange,
270 effectiveDateRange,
271 hasRuntimeFilters: normalizedFilters.length > 0 || Object.keys(normalizedVariables).length > 0,
272 needsSourceRefresh: Boolean(dashboardDateRange) || Object.keys(normalizedVariables).length > 0,
273 classifiedPayload,
274 sourceAffecting: classifiedPayload.sourceAffecting,
275 serverParseAffecting: classifiedPayload.serverParseAffecting,
276 clientOnly: classifiedPayload.clientOnly,
277 cacheableChartPayload: classifiedPayload.cacheableChartPayload,
278 sourceVariantHash: createPayloadHash(classifiedPayload.sourceAffecting),
279 chartVariantHash: createPayloadHash(classifiedPayload.cacheableChartPayload),
280 };
281}
282
283function getDatasetRuntimeFilters(runtimeContext, datasetOptions = {}) {
284 const datasetId = `${datasetOptions.cdc_id || datasetOptions.id || ""}`;

Callers 6

updateChartDataMethod · 0.85
runDataRequestFunction · 0.85
plotMethod · 0.85
DataExtractor.jsFile · 0.85

Calls 5

classifyRuntimePayloadFunction · 0.85
intersectDateRangesFunction · 0.85
createPayloadHashFunction · 0.85

Tested by

no test coverage detected