-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
fix: Create dataset polish/bug fix #22262
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6aa68d7
optimized setDatasets call
lyndsiWilliams 9968e6c
Remove console.log
lyndsiWilliams 88b089e
Create dataset polish/bug fix
lyndsiWilliams 50ef62a
Fix dataset tests
lyndsiWilliams 8d11c74
Fix rebase issue
lyndsiWilliams 17d3779
Implement Eric's table height fix
lyndsiWilliams 924f67e
Implement Antonio's review comments
lyndsiWilliams 985f6a9
Make defaultPageSize a const and move emptyStateComponent into src/co…
lyndsiWilliams File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,8 @@ const HALF = 0.5; | |
const MARGIN_MULTIPLIER = 3; | ||
|
||
const StyledHeader = styled.div<StyledHeaderProps>` | ||
${({ theme }) => ` | ||
position: ${(props: StyledHeaderProps) => props.position}; | ||
${({ theme, position }) => ` | ||
position: ${position}; | ||
margin: ${theme.gridUnit * (MARGIN_MULTIPLIER + 1)}px | ||
${theme.gridUnit * MARGIN_MULTIPLIER}px | ||
${theme.gridUnit * MARGIN_MULTIPLIER}px | ||
|
@@ -124,17 +124,27 @@ const StyledLoader = styled.div` | |
`} | ||
`; | ||
|
||
const TableContainer = styled.div` | ||
const TableContainerWithBanner = styled.div` | ||
${({ theme }) => ` | ||
position: relative; | ||
margin: ${theme.gridUnit * MARGIN_MULTIPLIER}px; | ||
margin-left: ${theme.gridUnit * (MARGIN_MULTIPLIER + 3)}px; | ||
height: calc(100% - ${theme.gridUnit * 60}px); | ||
overflow: auto; | ||
`} | ||
`; | ||
|
||
const TableContainerWithoutBanner = styled.div` | ||
${({ theme }) => ` | ||
position: relative; | ||
margin: ${theme.gridUnit * MARGIN_MULTIPLIER}px; | ||
margin-left: ${theme.gridUnit * (MARGIN_MULTIPLIER + 3)}px; | ||
overflow: scroll; | ||
height: calc(100% - ${theme.gridUnit * 36}px); | ||
height: calc(100% - ${theme.gridUnit * 30}px); | ||
overflow: auto; | ||
`} | ||
`; | ||
|
||
const StyledTable = styled(Table)` | ||
const TableScrollContainer = styled.div` | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
|
@@ -253,6 +263,9 @@ const DatasetPanel = ({ | |
const theme = useTheme(); | ||
const hasColumns = columnList?.length > 0 ?? false; | ||
const datasetNames = datasets?.map(dataset => dataset.table_name); | ||
const tableWithDataset = datasets?.find( | ||
dataset => dataset.table_name === tableName, | ||
); | ||
|
||
let component; | ||
let loader; | ||
|
@@ -271,16 +284,33 @@ const DatasetPanel = ({ | |
component = ( | ||
<> | ||
<StyledTitle>{COLUMN_TITLE}</StyledTitle> | ||
<TableContainer> | ||
<StyledTable | ||
loading={loading} | ||
size={TableSize.SMALL} | ||
columns={tableColumnDefinition} | ||
data={columnList} | ||
pageSizeOptions={pageSizeOptions} | ||
defaultPageSize={10} | ||
/> | ||
</TableContainer> | ||
{tableWithDataset ? ( | ||
<TableContainerWithBanner> | ||
<TableScrollContainer> | ||
<Table | ||
loading={loading} | ||
size={TableSize.SMALL} | ||
columns={tableColumnDefinition} | ||
data={columnList} | ||
pageSizeOptions={pageSizeOptions} | ||
defaultPageSize={25} | ||
/> | ||
</TableScrollContainer> | ||
</TableContainerWithBanner> | ||
) : ( | ||
<TableContainerWithoutBanner> | ||
<TableScrollContainer> | ||
<Table | ||
loading={loading} | ||
size={TableSize.SMALL} | ||
columns={tableColumnDefinition} | ||
data={columnList} | ||
pageSizeOptions={pageSizeOptions} | ||
defaultPageSize={25} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we make this a constant at the top? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can do! Done in |
||
/> | ||
</TableScrollContainer> | ||
</TableContainerWithoutBanner> | ||
)} | ||
</> | ||
); | ||
} else { | ||
|
@@ -299,9 +329,7 @@ const DatasetPanel = ({ | |
{tableName && ( | ||
<> | ||
{datasetNames?.includes(tableName) && | ||
renderExistingDatasetAlert( | ||
datasets?.find(dataset => dataset.table_name === tableName), | ||
)} | ||
renderExistingDatasetAlert(tableWithDataset)} | ||
<StyledHeader | ||
position={ | ||
!loading && hasColumns ? EPosition.RELATIVE : EPosition.ABSOLUTE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If this is going to be exported, I think that we should move it out of the SQlEditorLeftBar? Where are the other empty state components stored? THat's where it should be.
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.
Good thinking! Done in
this commit
.