Jump to the sample that has a matching `request_id`.
(self, event: Input.Submitted)
| 330 | |
| 331 | @on(Input.Submitted, "#reqid-box") |
| 332 | async def on_reqid_submitted(self, event: Input.Submitted) -> None: |
| 333 | """Jump to the sample that has a matching `request_id`.""" |
| 334 | |
| 335 | req_id_raw = event.value.strip() |
| 336 | # Remove hyphens so search is tolerant to different id formats |
| 337 | req_id = req_id_raw.replace("-", "") |
| 338 | if not req_id: |
| 339 | return |
| 340 | |
| 341 | found = False |
| 342 | for step_idx, step_data in self.data.items(): |
| 343 | for sample in step_data.get("samples", []): |
| 344 | sample_id = str(sample.get("request_id", "")) |
| 345 | if sample_id.replace("-", "") == req_id: |
| 346 | # Update selected indices |
| 347 | self.selected_step_index = step_idx |
| 348 | self.step_select.value = step_idx |
| 349 | |
| 350 | # Ensure sample list is updated and select sample |
| 351 | self.update_result_options(offset=sample[INDEX_KEY]) |
| 352 | self.selected_sample_index = sample[INDEX_KEY] |
| 353 | self.sample_select.value = sample[INDEX_KEY] |
| 354 | |
| 355 | await self._clear_search() |
| 356 | await self.update_content() |
| 357 | |
| 358 | found = True |
| 359 | break |
| 360 | if found: |
| 361 | break |
| 362 | |
| 363 | if not found: |
| 364 | self.search_status.update(Text(f"request_id '{req_id_raw}' not found", style="bold red")) |
| 365 | else: |
| 366 | # Keep the typed id in the input box so users see what was searched. |
| 367 | pass |
| 368 | |
| 369 | # --------------------------------------------------------------------- |
| 370 | # Helper: add new fields to SelectionList on-the-fly |
nothing calls this directly
no test coverage detected