rusackas commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2760237398
##########
superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.ts:
##########
@@ -213,8 +234,16 @@ function CountryMap(element, props) {
if (map) {
drawMap(map);
} else {
- const url = countries[country];
- d3.json(url, (error, mapData) => {
+ const url = (countries as Record<string, string>)[country];
+ if (!url) {
+ const countryName =
+ countryOptions.find(x => x[0] === country)?.[1] || country;
+ d3.select(element).html(
+ `<div class="alert alert-danger">No map data available for
${countryName}</div>`,
+ );
Review Comment:
Fixed in 896b19737d. Added `escapeHtml()` function that uses `textContent`
assignment to safely escape HTML entities, then applied it to both error
message locations where `countryName` is interpolated.
##########
superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.ts:
##########
@@ -16,15 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+import { ChartProps } from '@superset-ui/core';
+
+export default function transformProps(chartProps: ChartProps) {
const { height, width, formData, queriesData } = chartProps;
- const { horizonColorScale, seriesHeight } = formData;
+ const {
+ horizon_color_scale: horizonColorScale,
+ series_height: seriesHeight,
+ } = formData;
return {
- colorScale: horizonColorScale,
+ colorScale: horizonColorScale as string | undefined,
Review Comment:
Fixed in 896b19737d. Now using spread conditional: `...(horizonColorScale
!== undefined && { colorScale: horizonColorScale })` so colorScale is only
included when explicitly set, allowing defaultProps to apply otherwise.
--
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]