MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / buildFilters

Function buildFilters

telemetry-dashboard/public/app.js:101–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99// ---------------------------------------------------------------------------
100
101function buildFilters() {
102 const bar = document.getElementById('filters');
103 const presets = $(bar, 'presets');
104
105 for (const preset of RANGE_PRESETS) {
106 const button = el('button', 'range', preset.label);
107 button.type = 'button';
108 button.dataset.days = String(preset.days);
109 button.addEventListener('click', () => {
110 state.preset = preset.days;
111 syncFilters();
112 render();
113 });
114 presets.append(button);
115 }
116
117 const from = $(bar, 'custom-from');
118 const to = $(bar, 'custom-to');
119 const apply = $(bar, 'custom-apply');
120 apply.addEventListener('click', () => {
121 if (!isDay(from.value) || !isDay(to.value)) {
122 setRangeSummary('Enter both dates as YYYY-MM-DD.');
123 return;
124 }
125 if (from.value > to.value) {
126 setRangeSummary('The start date must come before the end date.');
127 return;
128 }
129 state.preset = 'custom';
130 state.custom = { from: from.value, to: to.value };
131 syncFilters();
132 render();
133 });
134
135 $(bar, 'refresh').addEventListener('click', () => {
136 refreshMeta().finally(render);
137 });
138}
139
140function syncFilters() {
141 const bar = document.getElementById('filters');

Callers 1

app.jsFile · 0.85

Calls 7

$Function · 0.85
elFunction · 0.85
syncFiltersFunction · 0.85
isDayFunction · 0.85
setRangeSummaryFunction · 0.85
refreshMetaFunction · 0.85
renderFunction · 0.70

Tested by

no test coverage detected