-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
refactor: decouple DataTableControl #20226
refactor: decouple DataTableControl #20226
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20226 +/- ##
==========================================
+ Coverage 66.48% 66.51% +0.02%
==========================================
Files 1726 1726
Lines 64759 64763 +4
Branches 6828 6829 +1
==========================================
+ Hits 43058 43074 +16
+ Misses 19966 19958 -8
+ Partials 1735 1731 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -130,8 +126,8 @@ export const RowCount = ({ | |||
}) => <RowCountLabel rowcount={data?.length ?? 0} loading={loading} />; | |||
|
|||
enum FormatPickerValue { | |||
Formatted, | |||
Original, | |||
Formatted = 'formatted', |
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.
The string enum type is more readable in the debugger.
const dispatch = useDispatch(); | ||
const isTimeColumnOriginalFormatted = originalFormattedTimeColumnIndex > -1; | ||
|
||
const onChange = useCallback( |
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.
the same logic moves to parent's component.
fix lint typing
506a48f
to
4e7fc70
Compare
/testenv up |
@zhaoyongjie Ephemeral environment spinning up at http://34.222.134.57:8080. Credentials are |
superset-frontend/src/explore/components/DataTablesPane/components/DataTableControls.tsx
Outdated
Show resolved
Hide resolved
datasourceId | ||
? state?.explore?.originalFormattedTimeColumns?.[datasourceId] ?? [] | ||
: [], | ||
export const getTimeColumns = (datasourceId?: string): string[] => { |
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 think the name suggests that the function gets all time columns, not only the time columns with epoch formatting in data table
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.
The time columns
means that the column type is GenericDataType.Temporal
after Superset introduced generic data type.
return ensureIsArray(colsMap[datasourceId]); | ||
}; | ||
|
||
export const setTimeColumns = (datasourceId: string, columns: string[]) => { |
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.
Same as above
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.
Looks great! I commented on some minor nitpicks
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
The DataTableControl is a component in DataTablePane, it has an important function is to switch the format of the time columns. Currently, this toggle was implemented by Redux, and saved state in the Explore's store.
We intend to move DataPane into Dashboard(PR), the Dashboard store and the Explore store are separated store, so I have to remove the time column state from the explore state.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After
dataTableControl.mov
copy to clipboard
copy.to.clipboard.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION