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

Function addMapping

js/panoramaFilters.js:502–517  ·  view source on GitHub ↗
(candidate, selected, invalid)

Source from the content-addressed store, hash-verified

500 // Keep its saved mappings so unrelated presentation changes remain editable.
501 const stale = available.has(reportId) && currentLabel !== mapping.dimensionLabel;
502 const addMapping = (candidate, selected, invalid) => {
503 const mappingRow = document.createElement('div');
504 mappingRow.className = 'panoramaFilterMappingRow';
505 if (index === 0) mappingRow.classList.add('is-report-start');
506 const report = document.createElement('span');
507 report.textContent = index === 0 ? this.reportLabel(reportId) : '';
508 const dimension = document.createElement('span');
509 dimension.textContent = candidate.dimensionLabel + (invalid ? ' — ' + t('analytics', 'Missing or changed dimension') : '');
510 const check = this.input('', 'checkbox');
511 check.checked = selected;
512 check.setAttribute('aria-label', `${this.reportLabel(reportId)}: ${candidate.dimensionLabel}`);
513 mappingRow.append(report, dimension, check);
514 mappingList.append(mappingRow);
515 mappings.push({check, mapping: candidate, stale: invalid});
516 check.addEventListener('change', updateMappingCount);
517 };
518 addMapping(mapping, original, stale);
519 if (stale && currentLabel !== undefined) addMapping({...mapping, dimensionLabel: currentLabel}, false, false);
520 }));

Callers 1

addRowFunction · 0.85

Calls 4

appendMethod · 0.80
tFunction · 0.50
addMethod · 0.45
addEventListenerMethod · 0.45

Tested by

no test coverage detected