MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / normalizeDashboardFilter

Function normalizeDashboardFilter

client/src/modules/chartRuntimeFilters.js:58–92  ·  view source on GitHub ↗
(filter, chartId)

Source from the content-addressed store, hash-verified

56}
57
58function normalizeDashboardFilter(filter, chartId) {
59 if (!filter) return null;
60
61 if (filter.type === "variable") {
62 return null;
63 }
64
65 if (filter.type === "date") {
66 if (!filter.startDate || !filter.endDate) return null;
67 if (Array.isArray(filter.charts) && filter.charts.length > 0 && !filter.charts.includes(chartId)) {
68 return null;
69 }
70
71 return {
72 type: "date",
73 startDate: filter.startDate,
74 endDate: filter.endDate,
75 origin: "dashboard",
76 scope: "chart",
77 clientOnly: false,
78 };
79 }
80
81 if (!hasConditionValue(filter)) return null;
82
83 return {
84 type: filter.type || "field",
85 field: filter.field,
86 operator: filter.operator,
87 value: filter.value,
88 origin: "dashboard",
89 scope: "chart",
90 clientOnly: Boolean(filter.clientOnly) || CLIENT_ONLY_FILTER_TYPES.has(filter.type || "field"),
91 };
92}
93
94function normalizeChartFilter(filter, { includeId = false } = {}) {
95 if (!filter || !hasConditionValue(filter)) return null;

Callers 1

buildChartRuntimeRequestFunction · 0.85

Calls 1

hasConditionValueFunction · 0.85

Tested by

no test coverage detected