Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Allow field identifiers to grow in Data Studio Table page (#76287)

Nick Fitzpatrickd53658dc3b6b
diff --git a/frontend/src/metabase/metadata/components/FieldSection/DataSection/DataSection.tsx b/frontend/src/metabase/metadata/components/FieldSection/DataSection/DataSection.tsx
index a523e42caab..07efc1f6a4b 100644
--- a/frontend/src/metabase/metadata/components/FieldSection/DataSection/DataSection.tsx
+++ b/frontend/src/metabase/metadata/components/FieldSection/DataSection/DataSection.tsx
@@ -9,7 +9,7 @@ import {
getFieldRawName,
getRawTableFieldId,
} from "metabase/metadata/utils/field";
-import { Box, Flex, Group, Stack, Switch, rem } from "metabase/ui";
+import { Box, Flex, Stack, Switch, rem } from "metabase/ui";
import type { Field } from "metabase-types/api";
import { CoercionStrategyPicker } from "../../CoercionStrategyPicker";
@@ -111,7 +111,7 @@ const DataSectionBase = ({
return (
<TitledSection>
- <Group align="start">
+ <Stack align="start">
<Box flex={1}>
<LabeledValue label={t`Field name`}>
{getFieldRawName(field)}
@@ -131,34 +131,35 @@ const DataSectionBase = ({
<SubInputIllustration />
)}
- <Switch
- checked={isCasting}
- classNames={{
- body: S.switchBody,
- }}
- flex="1"
- label={t`Cast to a specific data type`}
- mt="md"
- size="xs"
- onChange={handleCastingChange}
- />
+ <Stack>
+ <Switch
+ checked={isCasting}
+ classNames={{
+ body: S.switchBody,
+ }}
+ flex="1"
+ label={t`Cast to a specific data type`}
+ mt="md"
+ size="xs"
+ onChange={handleCastingChange}
+ />
+ {isCasting && (
+ <CoercionStrategyPicker
+ autoFocus={autoFocusCoercionPicker}
+ baseType={field.base_type}
+ dropdownOpened={isCoercionPickerOpen}
+ value={field.coercion_strategy ?? undefined}
+ onChange={handleCoercionStrategyChange}
+ onDropdownClose={() => setIsCoercionPickerOpen(false)}
+ onDropdownOpen={() => setIsCoercionPickerOpen(true)}
+ />
+ )}
+ </Stack>
</Flex>
-
- {isCasting && (
- <CoercionStrategyPicker
- autoFocus={autoFocusCoercionPicker}
- baseType={field.base_type}
- dropdownOpened={isCoercionPickerOpen}
- value={field.coercion_strategy ?? undefined}
- onChange={handleCoercionStrategyChange}
- onDropdownClose={() => setIsCoercionPickerOpen(false)}
- onDropdownOpen={() => setIsCoercionPickerOpen(true)}
- />
- )}
</>
)}
</Stack>
- </Group>
+ </Stack>
</TitledSection>
);
};
diff --git a/frontend/src/metabase/metadata/components/FieldSection/DataSection/illustrations/sub-input-follow.svg b/frontend/src/metabase/metadata/components/FieldSection/DataSection/illustrations/sub-input-follow.svg
index 0300843da1a..645678ce088 100644
--- a/frontend/src/metabase/metadata/components/FieldSection/DataSection/illustrations/sub-input-follow.svg
+++ b/frontend/src/metabase/metadata/components/FieldSection/DataSection/illustrations/sub-input-follow.svg
@@ -1,4 +1,5 @@
-<svg width="9" height="48" viewBox="0 0 9 48" fill="none" xmlns="http://www.w3.org/2000/svg">
- <path d="M1 0V48" stroke="#DCDFE0" />
+<svg width="9" height="69" viewBox="0 0 9 69" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M1 0V68" stroke="#DCDFE0" />
<path d="M1 24H9" stroke="#DCDFE0" />
+ <path d="M1 68H9" stroke="#DCDFE0" />
</svg>
diff --git a/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.module.css b/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.module.css
new file mode 100644
index 00000000000..db74f186021
--- /dev/null
+++ b/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.module.css
@@ -0,0 +1,11 @@
+.badge {
+ height: auto;
+ min-height: 2rem;
+}
+
+/* override Badge's single-line ellipsis truncation */
+.badgeLabel {
+ white-space: normal;
+ overflow-wrap: anywhere;
+ text-align: start;
+}
diff --git a/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.tsx b/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.tsx
index d3873325ee7..8e9339ca42d 100644
--- a/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.tsx
+++ b/frontend/src/metabase/metadata/components/LabeledValue/LabeledValue.tsx
@@ -2,6 +2,8 @@ import { type ReactNode, useId } from "react";
import { Badge, Stack, Text } from "metabase/ui";
+import S from "./LabeledValue.module.css";
+
interface Props {
children?: ReactNode;
label: string;
@@ -20,13 +22,14 @@ export const LabeledValue = ({ children, label }: Props) => {
aria-labelledby={id}
bg="accent-gray-light"
c="text-primary"
+ classNames={{ root: S.badge, label: S.badgeLabel }}
fw="normal"
- h={32}
p="sm"
radius="md"
size="lg"
tt="none"
variant="default"
+ lh="sm"
>
{children}
</Badge>