(self, search_keyword: Optional[str] = None)
| 290 | self.selected_sample_index = offset |
| 291 | |
| 292 | async def update_content(self, search_keyword: Optional[str] = None): |
| 293 | content = "" |
| 294 | try: |
| 295 | samples = self.data[self.selected_step_index].get("samples", []) |
| 296 | content_dict_full = samples[self.selected_sample_index] |
| 297 | |
| 298 | # Dynamically track any NEW keys that appear and add them to the field filter. |
| 299 | self._update_fields_select(content_dict_full.keys()) |
| 300 | |
| 301 | # Apply field selection filter (only show selected fields) |
| 302 | content_dict = {k: v for k, v in content_dict_full.items() if k in self.fields_select.selected} |
| 303 | if self.render_table: |
| 304 | content = Table("key", "value", show_lines=True) |
| 305 | for k in content_dict: |
| 306 | v = content_dict[k] |
| 307 | v = f"{v}" |
| 308 | content.add_row( |
| 309 | k, |
| 310 | self.highlighter(highlight_keyword(v, search_keyword)), |
| 311 | ) |
| 312 | else: |
| 313 | text = Text() |
| 314 | for k in content_dict: |
| 315 | v = content_dict[k] |
| 316 | s = center_word_with_equals_exactly(k, 64) + f"\n{v}\n" |
| 317 | text.append(highlight_keyword(s, search_keyword)) |
| 318 | content = self.highlighter(text) |
| 319 | except KeyError: |
| 320 | content = f"Loading data asynchronously, progress: {len(self.data)}/{self.step_num} step" |
| 321 | |
| 322 | except Exception: |
| 323 | content = self.highlighter(traceback.format_exc()) |
| 324 | |
| 325 | self.content_display.update(content) |
| 326 | |
| 327 | # --------------------------------------------------------------------- |
| 328 | # Request-ID jump logic |
no test coverage detected