bito-code-review[bot] commented on code in PR #36933:
URL: https://github.com/apache/superset/pull/36933#discussion_r2932184282


##########
superset-frontend/src/pages/EmbeddedChartsList/index.tsx:
##########
@@ -0,0 +1,254 @@
+/**
+ * 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.
+ */
+
+import { useCallback, useEffect, useMemo, useState } from 'react';
+import { Link } from 'react-router-dom';
+import { SupersetClient } from '@superset-ui/core';
+import { styled, css } from '@apache-superset/core/theme';
+import { t } from '@apache-superset/core/translation';
+import { DeleteModal, Tooltip } from '@superset-ui/core/components';
+import { Icons } from '@superset-ui/core/components/Icons';
+import withToasts from 'src/components/MessageToasts/withToasts';
+import { ListView } from 'src/components';
+import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu';
+
+const PAGE_SIZE = 25;
+
+interface EmbeddedChart {
+  uuid: string;
+  chart_id: number;
+  chart_name: string | null;
+  allowed_domains: string[];
+  changed_on: string | null;
+}
+
+interface EmbeddedChartsListProps {
+  addDangerToast: (msg: string) => void;
+  addSuccessToast: (msg: string) => void;
+}
+
+const ActionsWrapper = styled.div`
+  display: flex;
+  gap: 8px;
+`;
+
+const ActionButton = styled.button`
+  ${({ theme }) => css`
+    background: none;
+    border: none;
+    cursor: pointer;
+    padding: 4px;
+    color: ${theme.colorTextSecondary};
+    &:hover {
+      color: ${theme.colorPrimary};
+    }
+  `}
+`;
+
+function EmbeddedChartsList({
+  addDangerToast,
+  addSuccessToast,
+}: EmbeddedChartsListProps) {
+  const [embeddedCharts, setEmbeddedCharts] = useState<EmbeddedChart[]>([]);
+  const [loading, setLoading] = useState(true);
+  const [chartToDelete, setChartToDelete] = useState<EmbeddedChart | null>(
+    null,
+  );
+
+  const fetchEmbeddedCharts = useCallback(async () => {
+    setLoading(true);
+    try {
+      const response = await SupersetClient.get({
+        endpoint: '/api/v1/chart/embedded',
+      });
+      setEmbeddedCharts(response.json.result || []);
+    } catch (error) {
+      addDangerToast(t('Error loading embedded charts'));
+    } finally {
+      setLoading(false);
+    }
+  }, [addDangerToast]);
+
+  useEffect(() => {
+    fetchEmbeddedCharts();
+  }, [fetchEmbeddedCharts]);
+
+  const handleDelete = useCallback(
+    async (chart: EmbeddedChart) => {
+      try {
+        await SupersetClient.delete({
+          endpoint: `/api/v1/chart/${chart.chart_id}/embedded`,
+        });
+        addSuccessToast(t('Embedding disabled for %s', chart.chart_name));
+        fetchEmbeddedCharts();
+      } catch (error) {
+        addDangerToast(t('Error disabling embedding for %s', 
chart.chart_name));

Review Comment:
   <!-- Bito Reply -->
   The diff shows the change adds `|| t('Untitled')` to the toasts in 
`handleDelete` (lines 1224, 1227), which lacked it before. Other uses like the 
chart name column (line 1262) and delete modal (line 1368) already have the 
fallback. The `EmbeddedChart` interface correctly types `chart_name` as `string 
| null`. Your statement is mostly accurate, but the toasts needed this fix.
   
   **superset-frontend/src/pages/EmbeddedChartsList/index.tsx**
   ```
   interface EmbeddedChart {
     uuid: string;
     chart_id: number;
     chart_name: string | null;
     allowed_domains: string[];
     changed_on: string | null;
   }
   ```
   
   **superset-frontend/src/pages/EmbeddedChartsList/index.tsx**
   ```
   addSuccessToast(t('Embedding disabled for %s', chart.chart_name || 
t('Untitled')));
   addDangerToast(t('Error disabling embedding for %s', chart.chart_name || 
t('Untitled')));
   ```



-- 
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]

Reply via email to