(candidate, selected, invalid)
| 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 | })); |
no test coverage detected