Skip to content

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

UXW-4935 Fix long metric names overflow in browse/metrics table (#78958)

Denis Berezin130d93223db8
diff --git a/e2e/test/scenarios/metrics/browse.cy.spec.ts b/e2e/test/scenarios/metrics/browse.cy.spec.ts
index e35ebefb82a..07695e1eddf 100644
--- a/e2e/test/scenarios/metrics/browse.cy.spec.ts
+++ b/e2e/test/scenarios/metrics/browse.cy.spec.ts
@@ -209,19 +209,27 @@ describe("scenarios > browse > metrics", () => {
cy.location("pathname").should("eq", "/browse/metrics");
});
- it("should render truncated markdown in the table", () => {
+ it("should render truncated name and markdown in the table", () => {
+ const name =
+ "A very long metric name that should be truncated by the metrics table because it does not fit within the name column";
const description =
"This is a _very_ **long description** that should be truncated by the metrics table because it is really very long.";
createMetrics([
{
...ORDERS_SCALAR_METRIC,
+ name,
description,
},
]);
cy.visit("/browse/metrics");
+ metricsTable()
+ .findByText(name)
+ .should("be.visible")
+ .then((el) => H.assertIsEllipsified(el[0]));
+
metricsTable()
.findByText(/This is a/)
.should("be.visible")
diff --git a/frontend/src/metabase/browse/metrics/MetricsTable.tsx b/frontend/src/metabase/browse/metrics/MetricsTable.tsx
index 78931cce378..955647c4ed8 100644
--- a/frontend/src/metabase/browse/metrics/MetricsTable.tsx
+++ b/frontend/src/metabase/browse/metrics/MetricsTable.tsx
@@ -22,6 +22,7 @@ import { Columns } from "metabase/common/components/ItemsTable/Columns";
import type { ResponsiveProps } from "metabase/common/components/ItemsTable/utils";
import { Link } from "metabase/common/components/Link";
import { MarkdownPreview } from "metabase/common/components/MarkdownPreview";
+import CS from "metabase/css/core/index.css";
import { useDispatch } from "metabase/redux";
import { push } from "metabase/router";
import {
@@ -237,6 +238,7 @@ function NameCell({ metric }: { metric?: MetricResult }) {
<Flex align="center" gap="0.5rem" ps="1.4rem" pe="0.5rem">
{metric ? (
<Link
+ className={CS.overflowHidden}
to={Urls.metric({
id: metric.id,
name: metric.name,