-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine columns #42021
Combine columns #42021
Conversation
This is following the original plan of using a drill for this. It's hard to combine that with the "preview" functionality. See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569) for discussion of how we might approach that issue. Fixes #39978.
This is following the original plan of using a drill for this. It's hard to combine that with the "preview" functionality. See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569) for discussion of how we might approach that issue. Fixes #39978.
* Type Section['icon'] properly, including the hack for summarize section * Add combine columns section * Add types for combine columns drill * Add combine columns drill component stub * Mock combine columns drill * Add component stub * Encapsulate typing hacks * Extract CombineColumnsDrill * Extract ColumnAndSeparatorRow * Improve naming, add button to edit separators * Translate string * Improve styling * Separator input * Handle removing columns * Rename lib.ts to utils.ts * Implement onSubmit * Add getNextColumnAndSeparator * Use form for a11y * Handle vertical overflow * Handle horizontal overflow * Extract formatSeparator * Use proper translations * Adjust min/max sizes * Fix scrollbar being unnecessarily shown * Display source column name * Avoid serializing the entire column and putting it into DOM * Use module.css extension * Format code * Improve a11y * Mock combineColumnsDrillExpression and previewExpression * Add Preview component * Move preview logic to Preview component * Style Preview * Format code * Move styles to CSS modules * Update UI to latest designs - move "Add another column" button - remove "Separated by X" button - always show separator inputs * Remove displayInfo mock * Add asReturned * Update CombineColumnsDrillThruInfo * Integrate new way of working with combine columns drill * Fix generating expression names * Integrate drill with click actions * Integrate new preview workflow * Revert "Update UI to latest designs" This reverts commit cda039d. * Use previewExpression interface correctly * Use new preview_expression API * Make sure columns are created with original query and stage index * Extract usePreview and handle preview errors * Update popover title * Move add column button * Fix outline being cut off * Style preview label as per design * Format empty separator * Make preview scrollable * Use project convention * Simplify ScrollArea usage * Use ScrollArea in CombineColumnsDrill * Update comment * Remove Lib.previewExpression * Clean up the preview after removing Lib.previewExpression * Implement getPreview * Change default column preview to 'text' * Remove usePreview hook which is no longer in use * Rename Preview to Example * Use different placeholder for separator input * Add whitespace placeholder * Add ColumnPicker boilerplate * Export Input * Use QueryColumnPicker for ColumnPicker * Pass width to AccordionList * Add sequences popover events with tippy * Remove unused ColumnOption helpers * Add testid to Example * Add e2e test for combine column in header * Select content of separator input on focus * Reduce padding on example * Add monospace variant to Text * Use monospace variant in Example * Use monospace font in textinput * Match faux-select label styles to our TextInput label styles * Add missing color * Remove !important * Use pre whitespace so consecutive spaces show up * Remove empty default * Add example for boolean * Remove !important * Use should.have text over contain --------- Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Codenotify: Notifying subscribers in CODENOTIFY files for diff 912b5e5...5dbf1af.
|
849a6e2
to
f529c5d
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline comments. I'll test the branch locally a bit later today
<Title | ||
mb="lg" | ||
order={4} | ||
>{jt`Combine “${columnInfo.displayName}” with other columns`}</Title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just t
? There are no react nodes
onChange: (column: Lib.ColumnMetadata) => void; | ||
}; | ||
|
||
const theme = getThemeOverrides(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong no. This should never be used directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed this pattern because it is already in use in the codebase.
I've change the code to use useMantineTheme
but I had to export it from metabase/ui
because it wasn't yet.
Or do you have another preferred way of reading theme properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useMantineTheme
LGTM
return; | ||
} | ||
if (!evt.currentTarget.contains(evt.relatedTarget as Node)) { | ||
setTimeout(() => setOpen(false), 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause issues with onmounts before timeout. Please use a hook (maybe from react-use) that handles that.
|
||
// Hack to prevent parent TippyPopover from closing when selecting an item | ||
// TODO: remove when TippyPopover is no longer used | ||
function Dropdown({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be handled by Popover already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romeovs please move this to metabase/ui
like for Select
metabase/frontend/src/metabase/ui/components/inputs/Select/SelectDropdown/SelectDropdown.tsx
Line 8 in 2aa3cec
export const SelectDropdown = forwardRef(function SelectDropdown( |
onRemove: (index: number) => void; | ||
} | ||
|
||
const { fontFamilyMonospace } = getThemeOverrides(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romeovs please use this to make the newly created column appear after the selected one
metabase/frontend/src/metabase/querying/utils/drills/column-extract-drill/column-extract-drill.tsx
Line 24 in 8e111ab
extra: () => ({ settingsSyncOptions: { column: clicked.column } }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romeovs last comment about moving the hack for Popover to metabase/ui
. Approving to unblock the PR
The project actually specifies to attach the column at the end. @mngr what is your preference here? |
Merges the feature branch
combine-columns
into master. (Epic here).This branch contains work from: #40082, unaltered, except for fixing merge conflicts.
Closes #39980
Adds combine column drill through to the chill mode header columns.
How to verify
Accounts
table in chill modeEmail
,First Name
orPlan
)+ Combine columns
Done
Demo
See video attached to this Slack message