(msg)
| 135 | } |
| 136 | |
| 137 | function createMessageRow(msg) { |
| 138 | const row = document.createElement('div'); |
| 139 | const time = formatTime(msg.timestamp); |
| 140 | const hasSearch = state.searchQuery.length > 0; |
| 141 | const isPinned = isMessagePinned(state.selectedConnectionId, msg.id); |
| 142 | |
| 143 | const isSelected = state.selectedMessageId === msg.id; |
| 144 | |
| 145 | row.className = `message-row ${hasSearch ? 'search-highlight' : ''} ${isPinned ? 'pinned' : ''} ${isSelected ? 'selected' : ''}`; |
| 146 | row.dataset.id = msg.id; |
| 147 | |
| 148 | const idCell = document.createElement('div'); |
| 149 | idCell.className = 'message-cell col-id'; |
| 150 | idCell.textContent = `${isPinned ? '📌' : ''}${msg.id}`; |
| 151 | |
| 152 | const typeCell = document.createElement('div'); |
| 153 | typeCell.className = 'message-cell col-type'; |
| 154 | typeCell.innerHTML = hasSearch ? highlightSearchMatches(msg.eventType || '', state.searchQuery) : escapeHtml(msg.eventType || ''); |
| 155 | |
| 156 | const dataCell = document.createElement('div'); |
| 157 | dataCell.className = 'message-cell col-data'; |
| 158 | const displayData = getMessageDisplayData(msg); |
| 159 | dataCell.title = displayData.title; |
| 160 | dataCell.classList.toggle('field-empty', displayData.isEmpty); |
| 161 | dataCell.innerHTML = hasSearch |
| 162 | ? highlightSearchMatches(displayData.text, state.searchQuery) |
| 163 | : escapeHtml(displayData.text); |
| 164 | |
| 165 | const timeCell = document.createElement('div'); |
| 166 | timeCell.className = 'message-cell col-time'; |
| 167 | timeCell.textContent = time; |
| 168 | |
| 169 | row.appendChild(idCell); |
| 170 | row.appendChild(typeCell); |
| 171 | row.appendChild(dataCell); |
| 172 | row.appendChild(timeCell); |
| 173 | |
| 174 | return row; |
| 175 | } |
| 176 | |
| 177 | function setupMessageListEventDelegation() { |
| 178 | elements.messageTbody.addEventListener('click', (e) => { |
no test coverage detected