bito-code-review[bot] commented on code in PR #38405: URL: https://github.com/apache/superset/pull/38405#discussion_r2894485666
########## superset/mcp_service/chart/viz_type_names.py: ########## @@ -0,0 +1,146 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +""" +User-friendly display names for chart viz_type identifiers. + +Legacy chart names are read from ``BaseViz.verbose_name`` in +``superset/viz.py``, avoiding a duplicate hardcoded list. +Modern frontend-only chart plugins define their names in TypeScript +``ChartMetadata.name``, which is not accessible from the Python backend, +so a small overrides dict is maintained here for those. +""" + +import logging + +logger = logging.getLogger(__name__) + +# Display names for modern chart plugins that exist only in the frontend +# (TypeScript ChartMetadata.name) and have no BaseViz subclass in viz.py. +# These take precedence over viz.py verbose_name when both exist. +_FRONTEND_ONLY_NAMES: dict[str, str] = { + # ECharts time-series variants + "echarts_timeseries": "Generic Chart", + "echarts_timeseries_line": "Line Chart", + "echarts_timeseries_bar": "Bar Chart", + "echarts_timeseries_scatter": "Scatter Plot", + "echarts_timeseries_smooth": "Smooth Line", + "echarts_timeseries_step": "Stepped Line", + "echarts_area": "Area Chart", + # ECharts categorical / statistical + "pie": "Pie Chart", + "box_plot": "Box Plot", + "heatmap_v2": "Heatmap", + "histogram_v2": "Histogram", + "radar": "Radar Chart", + "funnel": "Funnel Chart", + "gauge_chart": "Gauge Chart", + "graph_chart": "Graph Chart", + "mixed_timeseries": "Mixed Chart", + "treemap_v2": "Treemap", + "tree_chart": "Tree Chart", + "sunburst_v2": "Sunburst", + "sankey_v2": "Sankey Chart", + "bubble_v2": "Bubble Chart", + "waterfall": "Waterfall Chart", + "gantt_chart": "Gantt Chart", + # Big Number + "big_number": "Big Number", + "big_number_total": "Big Number", + "pop_kpi": "Big Number Period Over Period", + # Tables + "table": "Table", + "ag-grid-table": "Table V2", + "pivot_table_v2": "Pivot Table", + # Other frontend-only plugins + "word_cloud": "Word Cloud", + "handlebars": "Handlebars", + "cartodiagram": "Cartodiagram", +} Review Comment: <!-- Bito Reply --> Your point is valid—these display names are specifically for MCP API responses to LLM agents, which are always in English. Since they're not rendered in the Superset UI, translation wrappers like lazy_gettext aren't applicable here. -- 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]
