()
| 134 | } |
| 135 | |
| 136 | export function addFilterCondition() { |
| 137 | const availableFields = getAvailableFields(); |
| 138 | if (availableFields.length === 0) { |
| 139 | alert('当前没有可用的字段,请先选择连接并等待消息数据。'); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | state.pendingFilters.push({ |
| 144 | field: '', |
| 145 | mode: 'equals', |
| 146 | value: '' |
| 147 | }); |
| 148 | |
| 149 | elements.messageFilterContainer.style.display = 'block'; |
| 150 | elements.btnToggleFilter.classList.add('expanded'); |
| 151 | renderFilterConditions(); |
| 152 | |
| 153 | const lastInput = elements.filterConditions.querySelector( |
| 154 | `.filter-field-input[data-index="${state.pendingFilters.length - 1}"]` |
| 155 | ); |
| 156 | if (lastInput) { |
| 157 | lastInput.focus(); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | export function removeFilterCondition(index) { |
| 162 | state.pendingFilters.splice(index, 1); |
nothing calls this directly
no test coverage detected