You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2024/06/13 17:59:39 UTC
[PR] feat: Improves the Drill By feature [superset]
michael-s-molina opened a new pull request, #29242:
URL: https://github.com/apache/superset/pull/29242
### SUMMARY
This PR improves the drill by feature by:
- Automatically focusing the menu search field
- Adding virtualization to the options list to handle many items
- Diminishing the request payload by selecting only the required data
- Adding an extension point to allow custom option loaders that might filter the options list depending on the chart's form data.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
https://github.com/apache/superset/assets/70410625/a7fc350d-b047-4c13-be22-47b5e8c1932d
### TESTING INSTRUCTIONS
- Check that the menu can handle many items efficiently
- Check that the loader can be overridden
- Check the improved request
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: Improves the Drill By feature [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #29242:
URL: https://github.com/apache/superset/pull/29242#discussion_r1640231905
##########
superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx:
##########
@@ -253,20 +323,23 @@ export const DrillByMenuItems = ({
) : filteredColumns.length ? (
<div
css={css`
- max-height: ${MAX_SUBMENU_HEIGHT}px;
- overflow: auto;
+ height: ${MAX_SUBMENU_HEIGHT}px;
`}
>
- {filteredColumns.map(column => (
- <MenuItemWithTruncation
- key={`drill-by-item-${column.column_name}`}
- tooltipText={column.verbose_name || column.column_name}
- {...rest}
- onClick={e => handleSelection(e, column)}
- >
- {column.verbose_name || column.column_name}
- </MenuItemWithTruncation>
- ))}
+ <AutoSizer>
+ {({ height, width }: { height: number; width: number }) => (
+ <List
+ width={width}
+ height={height}
Review Comment:
Since the height is already fixed, what do you think about locking the height value into the same variable to improve resize performance?
Additionally I would also like to avoid using the autosizer if we can set the width to a specific size, since there are numerous callback functions linked to resize events within the charts on the current dashboard.
```suggestion
{({ width }: { width: number }) => (
<List
width={width}
height={MAX_SUBMENU_HEIGHT}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: Improves the Drill By feature [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina merged PR #29242:
URL: https://github.com/apache/superset/pull/29242
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: Improves the Drill By feature [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #29242:
URL: https://github.com/apache/superset/pull/29242#discussion_r1640242346
##########
superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx:
##########
@@ -253,20 +323,23 @@ export const DrillByMenuItems = ({
) : filteredColumns.length ? (
<div
css={css`
- max-height: ${MAX_SUBMENU_HEIGHT}px;
- overflow: auto;
+ height: ${MAX_SUBMENU_HEIGHT}px;
`}
>
- {filteredColumns.map(column => (
- <MenuItemWithTruncation
- key={`drill-by-item-${column.column_name}`}
- tooltipText={column.verbose_name || column.column_name}
- {...rest}
- onClick={e => handleSelection(e, column)}
- >
- {column.verbose_name || column.column_name}
- </MenuItemWithTruncation>
- ))}
+ <AutoSizer>
+ {({ height, width }: { height: number; width: number }) => (
+ <List
+ width={width}
+ height={height}
Review Comment:
That makes total sense. Great suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat: Improves the Drill By feature [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #29242:
URL: https://github.com/apache/superset/pull/29242#discussion_r1640226231
##########
superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx:
##########
@@ -119,51 +157,59 @@ export const DrillByMenuItems = ({
const verboseMap = useVerboseMap(dataset);
useEffect(() => {
+ async function loadOptions() {
+ const datasetId = +formData.datasource.split('__')[0];
Review Comment:
While this method seems convenient, it might cause misunderstandings for those not familiar with JavaScript. Therefore, it would be better to apply a more explicit number conversion function.
```suggestion
const datasetId = Number(formData.datasource.split('__')[0]);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org