d
This commit is contained in:
@@ -2008,10 +2008,12 @@ class ItemDetailView(ResultTable):
|
||||
self,
|
||||
title: str = "",
|
||||
item_metadata: Optional[Dict[str, Any]] = None,
|
||||
detail_title: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
super().__init__(title, **kwargs)
|
||||
self.item_metadata = item_metadata or {}
|
||||
self.detail_title = detail_title
|
||||
|
||||
def to_rich(self):
|
||||
"""Render the item details panel above the standard results table."""
|
||||
@@ -2097,9 +2099,10 @@ class ItemDetailView(ResultTable):
|
||||
elements = []
|
||||
|
||||
if has_details:
|
||||
detail_title = str(self.detail_title or "Item Details").strip() or "Item Details"
|
||||
elements.append(Panel(
|
||||
details_table,
|
||||
title="[bold green]Item Details[/bold green]",
|
||||
details_table,
|
||||
title=f"[bold green]{detail_title}[/bold green]",
|
||||
border_style="green",
|
||||
padding=(1, 2)
|
||||
))
|
||||
|
||||
@@ -261,7 +261,7 @@ def render_image_to_console(image_path: str | Path, max_width: int | None = None
|
||||
pass
|
||||
|
||||
|
||||
def render_item_details_panel(item: Dict[str, Any]) -> None:
|
||||
def render_item_details_panel(item: Dict[str, Any], *, title: Optional[str] = None) -> None:
|
||||
"""Render a comprehensive details panel for a result item using unified ItemDetailView."""
|
||||
from SYS.result_table import ItemDetailView, extract_item_metadata
|
||||
|
||||
@@ -269,7 +269,7 @@ def render_item_details_panel(item: Dict[str, Any]) -> None:
|
||||
|
||||
# Create a specialized view with no results rows (only the metadata panel)
|
||||
# We set no_choice=True to hide the "#" column (not that there are any rows).
|
||||
view = ItemDetailView(item_metadata=metadata).set_no_choice(True)
|
||||
view = ItemDetailView(item_metadata=metadata, detail_title=title).set_no_choice(True)
|
||||
# Ensure no title leaks in (prevents an empty "No results" table from rendering).
|
||||
try:
|
||||
view.title = ""
|
||||
|
||||
Reference in New Issue
Block a user