Skip to content

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

Fix long snippet names overflow (#64469)

Marcosb9f16827067b
diff --git a/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionRow.jsx b/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionRow.jsx
index 7e05373d626..e5ac15436c1 100644
--- a/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionRow.jsx
+++ b/enterprise/frontend/src/metabase-enterprise/snippets/components/CollectionRow.jsx
@@ -2,6 +2,7 @@
import cx from "classnames";
import { Component } from "react";
+import { Ellipsified } from "metabase/common/components/Ellipsified";
import CS from "metabase/css/core/index.css";
import SnippetCollections from "metabase/entities/snippet-collections";
import { Icon } from "metabase/ui";
@@ -30,11 +31,20 @@ class CollectionRow extends Component {
)}
{...(collection.archived ? undefined : { onClick: onSelectCollection })}
>
- <Icon name="folder" size={ICON_SIZE} style={{ opacity: 0.25 }} />
- <span className={cx(CS.flexFull, CS.ml1, CS.textBold)}>
+ <Icon
+ name="folder"
+ size={ICON_SIZE}
+ style={{ opacity: 0.25 }}
+ className={CS.flexNoShrink}
+ />
+ <Ellipsified className={cx(CS.flexFull, CS.ml1, CS.textBold)} flex={1}>
{collection.name}
- </span>
- <CollectionOptionsButton {...this.props} collection={collection} />
+ </Ellipsified>
+ <CollectionOptionsButton
+ {...this.props}
+ collection={collection}
+ className={CS.flexNoShrink}
+ />
</div>
);
}
diff --git a/enterprise/frontend/src/metabase-enterprise/transforms/components/QueryEditor/EditorSidebar/EditorSidebar.module.css b/enterprise/frontend/src/metabase-enterprise/transforms/components/QueryEditor/EditorSidebar/EditorSidebar.module.css
index 2785ac2ec97..e24c406a1fc 100644
--- a/enterprise/frontend/src/metabase-enterprise/transforms/components/QueryEditor/EditorSidebar/EditorSidebar.module.css
+++ b/enterprise/frontend/src/metabase-enterprise/transforms/components/QueryEditor/EditorSidebar/EditorSidebar.module.css
@@ -1,3 +1,4 @@
.sidebar {
border-left: 1px solid var(--mb-color-border);
+ max-width: 400px;
}
diff --git a/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.jsx b/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.jsx
index 0d779a3f5fe..8821d1e4ed0 100644
--- a/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.jsx
+++ b/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.jsx
@@ -4,6 +4,7 @@ import { Component } from "react";
import { t } from "ttag";
import Button from "metabase/common/components/Button";
+import { Ellipsified } from "metabase/common/components/Ellipsified";
import CS from "metabase/css/core/index.css";
import Snippets from "metabase/entities/snippets";
import { Flex, Icon } from "metabase/ui";
@@ -42,6 +43,7 @@ class SnippetRowInner extends Component {
CS.hoverParent,
CS.hoverDisplay,
)}
+ style={{ minWidth: 0 }}
onClick={() => this.setState({ isOpen: !isOpen })}
>
<Flex
@@ -54,20 +56,28 @@ class SnippetRowInner extends Component {
insertSnippet(snippet);
}
}
+ miw={0}
>
<Icon
name="snippet"
- className={cx(CS.hoverChildHidden, CS.textLight)}
+ className={cx(
+ CS.hoverChildHidden,
+ CS.textLight,
+ SnippetRowS.SnippetIcon,
+ )}
/>
<Icon
name={insertSnippet ? "arrow_left_to_line" : "snippet"}
- className={CS.hoverChild}
+ className={cx(CS.hoverChild, SnippetRowS.SnippetIcon)}
/>
- <span className={cx(CS.flexFull, CS.ml1)}>{snippet.name}</span>
+ <Ellipsified className={cx(CS.ml1)}>{snippet.name}</Ellipsified>
</Flex>
<Icon
name={isOpen ? "chevronup" : "chevrondown"}
- className={cx({ [CS.hoverChild]: !isOpen })}
+ className={cx(
+ { [CS.hoverChild]: !isOpen },
+ SnippetRowS.SnippetIcon,
+ )}
/>
</div>
{isOpen && (
diff --git a/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.module.css b/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.module.css
index 2050dfaf380..621ae9b5af2 100644
--- a/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.module.css
+++ b/frontend/src/metabase/query_builder/components/template_tags/SnippetRow/SnippetRow.module.css
@@ -14,3 +14,7 @@
color: var(--mb-color-brand);
}
}
+
+.SnippetIcon {
+ flex-shrink: 0;
+}