(selection)
| 7 | |
| 8 | |
| 9 | function commitWarnings(selection) { |
| 10 | const issuesBySeverity = validator |
| 11 | .getIssuesBySeverity({ what: 'edited', where: 'all', includeDisabledRules: true }); |
| 12 | |
| 13 | for (const severity of ['error', 'warning']) { // no 'suggestions' here |
| 14 | let issues = issuesBySeverity[severity]; |
| 15 | |
| 16 | if (severity === 'warning') { // exclude 'fixme' and similar - iD#8603 |
| 17 | issues = issues.filter(issue => issue.type !== 'help_request'); |
| 18 | } |
| 19 | |
| 20 | const section = `${severity}-section`; |
| 21 | const issueClass = `${severity}-item`; |
| 22 | |
| 23 | let container = selection.selectAll('.' + section) |
| 24 | .data(issues.length ? [0] : []); |
| 25 | |
| 26 | container.exit() |
| 27 | .remove(); |
| 28 | |
| 29 | let containerEnter = container.enter() |
| 30 | .append('div') |
| 31 | .attr('class', 'modal-section ' + section + ' fillL2'); |
| 32 | |
| 33 | containerEnter |
| 34 | .append('h3') |
| 35 | .html(severity === 'warning' ? l10n.tHtml('commit.warnings') : l10n.tHtml('commit.errors')); |
| 36 | |
| 37 | containerEnter |
| 38 | .append('ul') |
| 39 | .attr('class', 'changeset-list'); |
| 40 | |
| 41 | container = containerEnter |
| 42 | .merge(container); |
| 43 | |
| 44 | |
| 45 | let items = container.select('ul').selectAll('li') |
| 46 | .data(issues, d => d.key); |
| 47 | |
| 48 | items.exit() |
| 49 | .remove(); |
| 50 | |
| 51 | let itemsEnter = items.enter() |
| 52 | .append('li') |
| 53 | .attr('class', issueClass); |
| 54 | |
| 55 | let buttons = itemsEnter |
| 56 | .append('button') |
| 57 | // .on('mouseover', (d3_event, d) => { |
| 58 | //// todo replace legacy surface css class .hover |
| 59 | // if (d.entityIds) { |
| 60 | // const graph = editor.staging.graph; |
| 61 | // context.surface().selectAll(utilEntityOrMemberSelector(d.entityIds, graph) ) |
| 62 | // .classed('hover', true); |
| 63 | // } |
| 64 | // }) |
| 65 | // .on('mouseout', () => { |
| 66 | //// todo replace legacy surface css class .hover |
nothing calls this directly
no test coverage detected