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

Function normalizeChartFilter

client/src/modules/chartRuntimeFilters.js:94–114  ·  view source on GitHub ↗
(filter, { includeId = false } = {})

Source from the content-addressed store, hash-verified

92}
93
94function normalizeChartFilter(filter, { includeId = false } = {}) {
95 if (!filter || !hasConditionValue(filter)) return null;
96
97 const normalizedFilter = {
98 type: filter.type || "field",
99 field: filter.field,
100 operator: filter.operator,
101 value: filter.value,
102 exposed: Boolean(filter.exposed),
103 cdcId: filter.cdcId ?? null,
104 origin: "chart",
105 scope: filter.cdcId ? "cdc" : "chart",
106 clientOnly: Boolean(filter.clientOnly) || CLIENT_ONLY_FILTER_TYPES.has(filter.type || "field"),
107 };
108
109 if (includeId) {
110 normalizedFilter.id = filter.id;
111 }
112
113 return normalizedFilter;
114}
115
116export function getChartRuntimeFilterState(chartFilters = {}, chartId) {
117 if (!chartId) return [];

Callers 2

buildChartRuntimeRequestFunction · 0.85

Calls 1

hasConditionValueFunction · 0.85

Tested by

no test coverage detected