aminghadersohi commented on code in PR #38410:
URL: https://github.com/apache/superset/pull/38410#discussion_r2911807331
##########
superset/mcp_service/dashboard/tool/generate_dashboard.py:
##########
@@ -138,6 +138,40 @@ def _create_dashboard_layout(chart_objects: List[Any]) ->
Dict[str, Any]:
return layout
+_MAX_TITLE_LENGTH = 150
+
+
+def _generate_title_from_charts(chart_objects: List[Any]) -> str:
+ """
+ Build a descriptive dashboard title from the included chart names.
+
+ Joins up to three chart ``slice_name`` values with " & " (two charts)
+ or ", " (three charts). When there are more than three charts the
+ remaining count is appended as "+ N more". The result is capped at
+ ``_MAX_TITLE_LENGTH`` characters.
+
+ Returns ``"Dashboard"`` when *chart_objects* is empty or no chart has
+ a usable name.
+ """
+ names = [c.slice_name for c in chart_objects if getattr(c, "slice_name",
None)]
Review Comment:
Already addressed — the query uses `.order_by(Slice.id)` (line 204) to
ensure deterministic ordering regardless of how the database returns `IN`
results. Chart names in the title will always appear in ascending ID order.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]