diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx index 957de4fbc..9bca4d0aa 100644 --- a/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx +++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx @@ -873,7 +873,9 @@ const SqlEditor: FC = ({ dropdownRender={() => renderDropdown()} trigger={['click']} > - + diff --git a/superset-frontend/src/SqlLab/components/TablePreview/index.tsx b/superset-frontend/src/SqlLab/components/TablePreview/index.tsx index 31714607c..a52f5a71d 100644 --- a/superset-frontend/src/SqlLab/components/TablePreview/index.tsx +++ b/superset-frontend/src/SqlLab/components/TablePreview/index.tsx @@ -30,7 +30,7 @@ import { import AutoSizer from 'react-virtualized-auto-sizer'; import Icons from 'src/components/Icons'; import type { SqlLabRootState } from 'src/SqlLab/types'; -import { Skeleton, AntdBreadcrumb as Breadcrumb } from 'src/components'; +import { Skeleton, AntdBreadcrumb as Breadcrumb, Button } from 'src/components'; import { Dropdown } from 'src/components/Dropdown'; import FilterableTable from 'src/components/FilterableTable'; import Tabs from 'src/components/Tabs'; @@ -324,11 +324,13 @@ const TablePreview: FC = ({ dbId, catalog, schema, tableName }) => { )} trigger={['click']} > - + {isMetadataRefreshing ? ( diff --git a/superset-frontend/src/features/charts/ChartCard.tsx b/superset-frontend/src/features/charts/ChartCard.tsx index 76554c00b..894ddf223 100644 --- a/superset-frontend/src/features/charts/ChartCard.tsx +++ b/superset-frontend/src/features/charts/ChartCard.tsx @@ -29,6 +29,7 @@ import { Menu } from 'src/components/Menu'; import FaveStar from 'src/components/FaveStar'; import FacePile from 'src/components/FacePile'; import { handleChartDelete, CardStyles } from 'src/views/CRUD/utils'; +import Button from 'src/components/Button'; interface ChartCardProps { chart: Chart; @@ -172,8 +173,10 @@ export default function ChartCard({ isStarred={favoriteStatus} /> )} - menu}> - + menu} trigger={['click', 'hover']}> + } diff --git a/superset-frontend/src/features/dashboards/DashboardCard.tsx b/superset-frontend/src/features/dashboards/DashboardCard.tsx index dff8b638b..5a4c991ec 100644 --- a/superset-frontend/src/features/dashboards/DashboardCard.tsx +++ b/superset-frontend/src/features/dashboards/DashboardCard.tsx @@ -34,6 +34,7 @@ import { PublishedLabel } from 'src/components/Label'; import FacePile from 'src/components/FacePile'; import FaveStar from 'src/components/FaveStar'; import { Dashboard } from 'src/views/CRUD/types'; +import { Button } from 'src/components'; interface DashboardCardProps { isChart?: boolean; @@ -179,8 +180,10 @@ function DashboardCard({ isStarred={favoriteStatus} /> )} - menu}> - + menu} trigger={['hover', 'click']}> + } diff --git a/superset-frontend/src/features/home/SavedQueries.test.tsx b/superset-frontend/src/features/home/SavedQueries.test.tsx index c48e26e09..cf4286927 100644 --- a/superset-frontend/src/features/home/SavedQueries.test.tsx +++ b/superset-frontend/src/features/home/SavedQueries.test.tsx @@ -104,7 +104,7 @@ describe('SavedQueries', () => { it('renders a submenu with clickable tables and buttons', async () => { expect(wrapper.find(SubMenu)).toExist(); expect(wrapper.find('[role="tab"]')).toHaveLength(1); - expect(wrapper.find('button')).toHaveLength(2); + expect(wrapper.find('button')).toHaveLength(5); clickTab(0); await waitForComponentToPaint(wrapper); expect(fetchMock.calls(/saved_query\/\?q/)).toHaveLength(2); diff --git a/superset-frontend/src/features/home/SavedQueries.tsx b/superset-frontend/src/features/home/SavedQueries.tsx index 12683f581..ef1d20c23 100644 --- a/superset-frontend/src/features/home/SavedQueries.tsx +++ b/superset-frontend/src/features/home/SavedQueries.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { useState } from 'react'; +import { useCallback, useState } from 'react'; import { Link } from 'react-router-dom'; import { styled, SupersetClient, t, useTheme } from '@superset-ui/core'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; @@ -39,6 +39,7 @@ import { PAGE_SIZE, shortenSQL, } from 'src/views/CRUD/utils'; +import { Button } from 'src/components'; import SubMenu from './SubMenu'; import EmptyState from './EmptyState'; import { WelcomeTable } from './types'; @@ -191,33 +192,36 @@ const SavedQueries = ({ filters: getFilterValues(tab, WelcomeTable.SavedQueries, user), }); - const renderMenu = (query: Query) => ( - - {canEdit && ( - - {t('Edit')} - - )} - { - if (query.id) { - copyQueryLink(query.id, addDangerToast, addSuccessToast); - } - }} - > - {t('Share')} - - {canDelete && ( + const renderMenu = useCallback( + (query: Query) => ( + + {canEdit && ( + + {t('Edit')} + + )} { - setQueryDeleteModal(true); - setCurrentlyEdited(query); + if (query.id) { + copyQueryLink(query.id, addDangerToast, addSuccessToast); + } }} > - {t('Delete')} + {t('Share')} - )} - + {canDelete && ( + { + setQueryDeleteModal(true); + setCurrentlyEdited(query); + }} + > + {t('Delete')} + + )} + + ), + [], ); if (loading) return ; @@ -315,10 +319,15 @@ const SavedQueries = ({ e.preventDefault(); }} > - renderMenu(q)}> - + renderMenu(q)} + trigger={['click', 'hover']} + > + diff --git a/superset-frontend/src/features/tags/TagCard.tsx b/superset-frontend/src/features/tags/TagCard.tsx index 092ba90f1..ca6260df9 100644 --- a/superset-frontend/src/features/tags/TagCard.tsx +++ b/superset-frontend/src/features/tags/TagCard.tsx @@ -26,6 +26,7 @@ import ListViewCard from 'src/components/ListViewCard'; import Icons from 'src/components/Icons'; import { Tag } from 'src/views/CRUD/types'; import { deleteTags } from 'src/features/tags/tags'; +import { Button } from 'src/components'; interface TagCardProps { tag: Tag; @@ -108,8 +109,10 @@ function TagCard({ e.preventDefault(); }} > - menu}> - + menu} trigger={['click', 'hover']}> + }