-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat(chart-explore): add select all functionality to table viz type #19979
Conversation
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.
Thanks for the contribution! Added a couple of style suggestions.
For non-DnD mode, have you considered adding a "Select all" option like the old select control has?
} | ||
onClick={onSelectAll} | ||
> | ||
{deselectEnabled && !selectMode()? t('Deselect All'): t('Select All')} |
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.
{deselectEnabled && !selectMode()? t('Deselect All'): t('Select All')} | |
{deselectEnabled && !selectMode()? t('Deselect all'): t('Select all')} |
We use sentence case for control buttons. Although in this case it doesn't matter since it's all capitalized by CSS.
@@ -118,6 +118,7 @@ const all_columns: typeof sharedControls.groupby = { | |||
}), | |||
visibility: isRawMode, | |||
resetOnHide: false, | |||
showSelectAllButton: true, |
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.
showSelectAllButton: true, | |
showSelectAll: true, |
I think it's okay to call this prop showSelectAll
in case we want to change how the "select all" trigger looks like.
css={(theme: SupersetTheme) => | ||
css` | ||
padding: 0; | ||
` | ||
} |
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.
css={(theme: SupersetTheme) => | |
css` | |
padding: 0; | |
` | |
} | |
css={{ padding: 0 }} |
Since theme
is not used, this should be good enough.
handleSelectAll() { | ||
/** | ||
* Function to handle select all button. | ||
* Adds all options to the selected values. | ||
*/ |
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.
handleSelectAll() { | |
/** | |
* Function to handle select all button. | |
* Adds all options to the selected values. | |
*/ | |
/** | |
* Function to handle select all button. | |
* Adds all options to the selected values. | |
*/ | |
handleSelectAll() { |
Nit: normally we put function doc string above the function name.
* Adds a select all button next to the header, allowing the user to | ||
* select all options in one click. Can only be a SelectAllButton or null. | ||
*/ | ||
selectAllButton?: ReactNode; |
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.
selectAllButton?: ReactNode; | |
headerAfter?: ReactNode; |
I think it's okay to make this node more generic. You never know if you want to add a different type of control here. For example, in non-DnD mode adhoc metrics control, this is a plus button.
@@ -229,6 +271,7 @@ export function DndColumnSelect(props: DndColumnSelectProps) { | |||
? openPopover | |||
: undefined | |||
} | |||
selectAllButton={showSelectAllButton ? <SelectAllButton {...selectAllButtonProps} /> : null} |
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.
selectAllButton={showSelectAllButton ? <SelectAllButton {...selectAllButtonProps} /> : null} | |
selectAllButton={ | |
showSelectAllButton ? ( | |
<Button | |
buttonStyle="link" | |
disabled={hasSelectedAll} | |
onClick={ | |
hasSelectedAll | |
? undefined | |
: () => hasSelectedSome ? deselectAll() : selectAll() | |
} | |
> | |
{hasSelectedSome ? t('Deselect all') : t('Select all')} | |
</Button> | |
) : null | |
} |
I think it's possible to directly render the button without all the "mode" conversion. This should make things easier to understand.
Hi @cccs-RyanK! Wanted to let you know that we are currently working on adding "select all" feature to all of the multiple choice select fields (besides dnd) which should be available soon (probably 2-3 weeks). Drag&drop select all is something that I hope we will tackle in the upcoming weeks so there will be a better solution provided from our side. Thank you for helping an developing this solution 🙏 |
Hi @kasiazjc! Thanks for the info! Is there anywhere we can track what features are being actively worked on from your end? We'd like to avoid duplicating effort if we can! |
Unfortunately there is no way to track it right now 😢 we're trying to find a way to sort it out, but it may not happen anytime soon. I will try my best to keep you updated for now about this one 🤞 |
Was this ever added back? |
SUMMARY
The select all functionality was removed previously, but our users rely on this useful feature in the chart explorer, so this PR is for bringing back that feature.
With the way things currently are, the user must manually select columns one by one by clicking or dragging and dropping into the columns field when building a query in the explore view. When the user is initially creating a chart, it is often the case that they want to query all the possible fields to identify what is relevant and narrow it down. This becomes tedious when dealing with data-sets that have many columns (100+).
We have had to create a temporary solution in our fork just to allow our users who rely on it to use the chart explorer. This design aims to reintroduce the select all functionality in a non disruptive way while keeping the UX clean. It is only shown in the columns select when in the raw records query mode in the explore view on the 'table plugin', since this is the place where it is needed by our users.
Thoughts and feedback are appreciated!
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Drag and Drop Feature Enabled:
SELECT ALL
![image](https://user-images.githubusercontent.com/102618419/167172650-8bca2bde-a248-4d9d-806d-79ce72075538.png)
When the columns field is empty, the select all button can be clicked to populate the columns field with all available options.
DESELECT ALL
![image](https://user-images.githubusercontent.com/102618419/167172736-867516b4-9338-49ec-b09e-e8dc8f405466.png)
Once any option(s) have been selected, the button text changes to deselect all. If it is clicked in this state, it empties the columns field (and the button text changes back to 'SELECT ALL').
Drag and Drop Feature Disabled:
* the columns field is "full" when all options are currently selected (list of selected values equals list of options)
![image](https://user-images.githubusercontent.com/102618419/167187482-38a6a3ed-359f-4a85-96af-db521af1a280.png)
SELECT ALL
When the columns field is not full*, the select all button can be clicked to add all remaining options. Since there is already a 'clear' button built in to select control when the Drag and Drop Feature is disabled, the select all button does not turn into a deselect all button when an item is added. This allows a user to select all options without first clearing the values and then selecting all. The user can still clear the values at any time with the 'clear' button.
SELECT ALL Disabled
![image](https://user-images.githubusercontent.com/102618419/167187631-b9998843-5c24-4d91-8d4b-403f018470dd.png)
When the columns field is full*, the select all button is disabled because all options are currently selected.
TESTING INSTRUCTIONS
Drag and Drop Feature enabled
Drag and Drop Feature disabled
ADDITIONAL INFORMATION