MCPcopy Create free account
hub / github.com/Rello/analytics / sharedSelect

Function sharedSelect

js/filter.js:2712–2724  ·  view source on GitHub ↗
(rows, name, label, choices)

Source from the content-addressed store, hash-verified

2710 schedulePreview();
2711 };
2712 const sharedSelect = (rows, name, label, choices) => {
2713 const select = document.createElement('select');
2714 select.className = 'optionsInput';
2715 select.setAttribute('aria-label', label);
2716 const values = new Set(rows.map(row => row.querySelector('[name="' + name + '"]').value));
2717 if (values.size > 1) select.add(new Option(t('analytics', 'Mixed — customize'), ''));
2718 choices.forEach(([value, text]) => select.add(new Option(text, value)));
2719 select.value = values.size === 1 ? [...values][0] : '';
2720 select.addEventListener('change', () => {
2721 if (select.value) setAll(rows, name, select.value);
2722 });
2723 return select;
2724 };
2725 valueList.querySelectorAll('.chartMeasureStyle').forEach(element => element.remove());
2726 [...valueList.children].forEach((row, index) => {
2727 const id = mapping.measures[index];

Callers 1

filter.jsFile · 0.85

Calls 5

setAllFunction · 0.85
mapMethod · 0.80
tFunction · 0.50
addMethod · 0.45
addEventListenerMethod · 0.45

Tested by

no test coverage detected