Skip to content

Commit 7c2469f

Browse files
Fix SQL columns action menu appearance (metabase#14154)
* try overwriting formatting action entry * add a guard and clean up some unrelated conditionals * fix click action update * flow undefined check Co-authored-by: Paul Rosenzweig <[email protected]>
1 parent c457863 commit 7c2469f

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

frontend/src/metabase/modes/components/drill/FormatAction.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default ({ question, clicked }: ClickActionProps): ClickAction[] => {
2222
return [
2323
{
2424
name: "formatting",
25+
title: "Column formatting",
2526
section: "sort",
2627
buttonType: "formatting",
2728
icon: "gear",

frontend/src/metabase/visualizations/components/ChartClickActions.jsx

+17-9
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,17 @@ export default class ChartClickActions extends Component {
175175
});
176176
delete groupedClickActions["sum"];
177177
}
178+
if (
179+
clicked.column &&
180+
clicked.column.source === "native" &&
181+
groupedClickActions["sort"]
182+
) {
183+
// restyle the Formatting action for SQL columns
184+
groupedClickActions["sort"][0] = {
185+
...groupedClickActions["sort"][0],
186+
buttonType: "horizontal",
187+
};
188+
}
178189
const sections = _.chain(groupedClickActions)
179190
.pairs()
180191
.sortBy(([key]) => (SECTIONS[key] ? SECTIONS[key].index : 99))
@@ -274,7 +285,7 @@ export const ChartClickAction = ({
274285
const className = cx("cursor-pointer no-decoration", {
275286
"text-center sort token-blue mr1 bg-brand-hover":
276287
action.buttonType === "sort",
277-
"formatting-button flex-align-right text-brand-hover":
288+
"formatting-button flex-align-right text-brand-hover text-light":
278289
action.buttonType === "formatting",
279290
"horizontal-button p1 flex flex-auto align-center bg-brand-hover text-dark text-white-hover":
280291
action.buttonType === "horizontal",
@@ -312,16 +323,14 @@ export const ChartClickAction = ({
312323
</Link>
313324
</div>
314325
);
315-
} else if (action.tooltip) {
316-
// Only the Sort and Formatting actions have tooltips.
326+
} else if (
327+
action.buttonType === "sort" ||
328+
action.buttonType === "formatting"
329+
) {
317330
return (
318331
<Tooltip tooltip={action.tooltip}>
319332
<div
320-
className={cx(className, {
321-
"flex flex-row align-center":
322-
action.buttonType === "formatting" ||
323-
action.buttonType === "sort",
324-
})}
333+
className={cx(className, "flex flex-row align-center")}
325334
onClick={() => handleClickAction(action)}
326335
>
327336
{action.icon && (
@@ -334,7 +343,6 @@ export const ChartClickAction = ({
334343
name={action.icon}
335344
/>
336345
)}
337-
{action.title && action.title}
338346
</div>
339347
</Tooltip>
340348
);

0 commit comments

Comments
 (0)