(msg)
| 700 | } |
| 701 | |
| 702 | function createMessageRow(msg) { |
| 703 | const row = document.createElement('div'); |
| 704 | const time = formatTime(msg.timestamp); |
| 705 | const hasSearch = state.searchQuery.length > 0; |
| 706 | const isPinned = isMessagePinned(state.selectedConnectionId, msg.id); |
| 707 | |
| 708 | const isSelected = state.selectedMessageId === msg.id; |
| 709 | |
| 710 | row.className = `message-row ${hasSearch ? 'search-highlight' : ''} ${isPinned ? 'pinned' : ''} ${isSelected ? 'selected' : ''}`; |
| 711 | row.dataset.id = msg.id; |
| 712 | |
| 713 | const idCell = document.createElement('div'); |
| 714 | idCell.className = 'message-cell col-id'; |
| 715 | idCell.textContent = `${isPinned ? '📌' : ''}${msg.id}`; |
| 716 | |
| 717 | const typeCell = document.createElement('div'); |
| 718 | typeCell.className = 'message-cell col-type'; |
| 719 | typeCell.innerHTML = hasSearch ? highlightSearchMatches(msg.eventType || '', state.searchQuery) : escapeHtml(msg.eventType || ''); |
| 720 | |
| 721 | const dataCell = document.createElement('div'); |
| 722 | dataCell.className = 'message-cell col-data'; |
| 723 | const displayData = getMessageDisplayData(msg); |
| 724 | dataCell.title = displayData.title; |
| 725 | dataCell.classList.toggle('field-empty', displayData.isEmpty); |
| 726 | dataCell.innerHTML = hasSearch |
| 727 | ? highlightSearchMatches(displayData.text, state.searchQuery) |
| 728 | : escapeHtml(displayData.text); |
| 729 | |
| 730 | const timeCell = document.createElement('div'); |
| 731 | timeCell.className = 'message-cell col-time'; |
| 732 | timeCell.textContent = time; |
| 733 | |
| 734 | row.appendChild(idCell); |
| 735 | row.appendChild(typeCell); |
| 736 | row.appendChild(dataCell); |
| 737 | row.appendChild(timeCell); |
| 738 | |
| 739 | return row; |
| 740 | } |
| 741 | |
| 742 | function setupMessageListEventDelegation() { |
| 743 | elements$6.messageTbody.addEventListener('click', (e) => { |
no test coverage detected