The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
use container padding to provide space between items in entity picker lists (#62883)
Nick Fitzpatrickbba0093d3841
diff --git a/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts b/e2e/test/scenarios/question/notebook-data-source.cy.spec.tsindex a51a9a024b2..c9cc4f4a3a8 100644--- a/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts+++ b/e2e/test/scenarios/question/notebook-data-source.cy.spec.ts@@ -436,7 +436,7 @@ describe("issue 28106", () => {.findByTestId("scroll-container").as("schemasList");- scrollAllTheWayDown();+ cy.get("@schemasList").scrollTo("bottom");// assert scrolling worked and the last item is visibleH.entityPickerModalItem(1, "Schema Z").should("be.visible");@@ -455,23 +455,6 @@ describe("issue 28106", () => {});},);-- // The list is virtualized and the scrollbar height changes during scrolling (metabase#44966)- // that's why we need to scroll and wait multiple times.- function scrollAllTheWayDown() {- cy.get("@schemasList").realMouseWheel({ deltaY: 100 });- cy.wait(100);-- cy.get("@schemasList").then(($element) => {- const list = $element[0];- const isScrolledAllTheWayDown =- list.scrollHeight - list.scrollTop === list.clientHeight;-- if (!isScrolledAllTheWayDown) {- scrollAllTheWayDown();- }- });- }});// Needs to be OSS because EE will always have models due to instance analyticsdiff --git a/frontend/src/metabase/common/components/EntityPicker/components/ItemList/ItemList.tsx b/frontend/src/metabase/common/components/EntityPicker/components/ItemList/ItemList.tsxindex 2598f3338fd..f19a167556e 100644--- a/frontend/src/metabase/common/components/EntityPicker/components/ItemList/ItemList.tsx+++ b/frontend/src/metabase/common/components/EntityPicker/components/ItemList/ItemList.tsx@@ -7,6 +7,7 @@ import { PLUGIN_MODERATION } from "metabase/plugins";import { LoadingAndErrorWrapper } from "metabase/public/containers/PublicAction/PublicAction.styled";import {Box,+ type BoxProps,Center,Flex,Icon,@@ -35,6 +36,7 @@ interface ItemListProps<shouldDisableItem?: (item: Item) => boolean;shouldShowItem?: (item: Item) => boolean;navLinkProps?: (isSelected?: boolean) => NavLinkProps;+ containerProps?: BoxProps;}export const ItemList = <@@ -52,6 +54,7 @@ export const ItemList = <shouldDisableItem,shouldShowItem,navLinkProps,+ containerProps = { pb: "xs" },}: ItemListProps<Id, Model, Item>) => {const filteredItems =items && shouldShowItem ? items.filter(shouldShowItem) : items;@@ -84,19 +87,28 @@ export const ItemList = <}return (- <VirtualizedList Wrapper={PickerColumn} scrollTo={activeItemIndex}>+ <VirtualizedList+ Wrapper={PickerColumn}+ scrollTo={activeItemIndex}+ estimatedItemSize={37}+ >{filteredItems.map((item: Item) => {const isSelected = isSelectedItem(item, selectedItem);const icon = getEntityPickerIcon(item, isSelected && isCurrentLevel);return (- <div data-testid="picker-item" key={`${item.model}-${item.id}`}>+ <Box+ data-testid="picker-item"+ key={`${item.model}-${item.id}`}+ {...containerProps}+ ><NavLinkw={"auto"}disabled={shouldDisableItem?.(item)}rightSection={isFolder(item) ? <Icon name="chevronright" size={10} /> : null}+ mb={0}label={<Flex align="center">{item.name}{" "}@@ -116,10 +128,9 @@ export const ItemList = <onClick(item);}}variant={isCurrentLevel ? "default" : "mb-light"}- mb="xs"{...navLinkProps?.(isSelected)}/>- </div>+ </Box>);})}</VirtualizedList>diff --git a/frontend/src/metabase/common/components/Pickers/DataPicker/components/DatabaseList.tsx b/frontend/src/metabase/common/components/Pickers/DataPicker/components/DatabaseList.tsxindex 2a1fba9ded4..bc54311f9da 100644--- a/frontend/src/metabase/common/components/Pickers/DataPicker/components/DatabaseList.tsx+++ b/frontend/src/metabase/common/components/Pickers/DataPicker/components/DatabaseList.tsx@@ -52,10 +52,12 @@ export const DatabaseList = ({selectedItem={selectedItem}onClick={onClick}shouldDisableItem={(item) => shouldDisableItem?.(item) || false}+ containerProps={{+ pb: "1rem",+ }}navLinkProps={(isSelected) => ({px: "1.5rem",py: "1.25rem",- mb: "1rem",rightSection: null,style: {border: isSelected ? undefined : "1px solid var(--mb-color-border)",