-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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(SqlLab): Change Save Dataset Button to Split Save Query Button IV #20852
feat(SqlLab): Change Save Dataset Button to Split Save Query Button IV #20852
Conversation
@@ -275,11 +250,19 @@ export default class ResultSet extends React.PureComponent< | |||
this.props.database?.allows_virtual_table_explore && ( | |||
<ExploreResultsButton | |||
database={this.props.database} | |||
onClick={() => this.setState({ showSaveDatasetModal: 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.
add back this line
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.
Added back in this commit
.
/> | ||
// In order to use the new workflow for a query powered chart, replace the |
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.
add back these lines
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.
more of a broader question, when do we make this functionality the default behavior?
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.
Added back in this commit
.
onClick={() => { | ||
// There is currently redux / state issue where sometimes a query will have serverId | ||
// and other times it will not. We need this attribute consistently for this to work | ||
// const qid = this.props?.query?.results?.query_id; | ||
// if (qid) { | ||
// // This will open explore using the query as datasource | ||
// window.location.href = `/explore/?dataset_type=query&dataset_id=${qid}`; | ||
// } else { | ||
// this.setState({ showSaveDatasetModal: true }); | ||
// } | ||
this.setState({ showSaveDatasetModal: 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.
remove these lines
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.
Removed in this commit
.
describe('SaveDatasetModal RTL', () => { | ||
it('renders a "Save as new" field', () => { | ||
render(<SaveDatasetModal {...mockedProps} />, { useRedux: true }); | ||
const testDatasetList = { |
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.
can we put this in a separate fixture file?
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.
Yeah, once I'm done fixing this test file I'll be cleaning it up.
</ErrorBoundary> | ||
{showSaveDatasetModal && ( | ||
<SaveDatasetModal | ||
key={Math.random()} |
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.
why are we doing a Math.random()
here for the key? couldn't we just set it as specific value?
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 SaveDatasetModal can be deleted from this, we ended up invoking it in another portion of the code.
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 was removed in this commit
.
/> | ||
// In order to use the new workflow for a query powered chart, replace the |
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.
more of a broader question, when do we make this functionality the default behavior?
const toggleSave = () => { | ||
setShowSave(!showSave); | ||
}; | ||
const toggleSave = () => setShowSave(!showSave); |
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.
nit: I think that this would be better taking in a boolean value that we set. Sometimes when connections are slower, the action doesn't immediately render and users click multiple times, causing it to reverse back to original value.
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 call, I cleaned this up in this commit
.
@@ -29,19 +29,14 @@ import { | |||
SaveDatasetModal, | |||
} from 'src/SqlLab/components/SaveDatasetModal'; | |||
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; | |||
import { EXPLORE_CHART_DEFAULT } from 'src/SqlLab/types'; |
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 this was lost in a rebase potentially? Please revert this.
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.
Yeah there seems to be some weird rebase stuff on this PR, thanks for catching all these! Re-added in this commit
.
@@ -218,26 +213,6 @@ export default class ResultSet extends React.PureComponent< | |||
} | |||
} | |||
|
|||
createExploreResultsOnClick = async () => { |
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.
Also this
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.
Re-added in this commit
.
@@ -25,6 +25,7 @@ import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants'; | |||
import Loading from 'src/components/Loading'; | |||
import { EmptyStateBig } from 'src/components/EmptyState'; | |||
import ErrorBoundary from 'src/components/ErrorBoundary'; | |||
import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal'; |
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 believe that this is part of an older rebase, and is no longer in this portion of the code base.
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.
Removed in this commit
.
@@ -122,8 +123,10 @@ const MonospaceDiv = styled.div` | |||
class Chart extends React.PureComponent { | |||
constructor(props) { | |||
super(props); | |||
this.state = { showSaveDatasetModal: false }; |
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 here
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.
Removed in this commit
.
</ErrorBoundary> | ||
{showSaveDatasetModal && ( | ||
<SaveDatasetModal | ||
key={Math.random()} |
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 SaveDatasetModal can be deleted from this, we ended up invoking it in another portion of the code.
@@ -136,6 +139,12 @@ class Chart extends React.PureComponent { | |||
} | |||
} | |||
|
|||
toggleSaveDatasetModal = () => { |
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
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.
Removed in this commit
.
@@ -253,6 +262,7 @@ class Chart extends React.PureComponent { | |||
width, | |||
} = this.props; | |||
|
|||
const { showSaveDatasetModal } = this.state; |
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.
Removed in this commit
.
@@ -42,6 +42,5 @@ export const ChartErrorMessage: React.FC<Props> = ({ | |||
...error, | |||
extra: { ...error.extra, owners }, | |||
}; | |||
|
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.
nit: add this space back?
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.
Weird rebase stuff haha! Added back in this commit
.
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.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #20852 +/- ##
==========================================
+ Coverage 66.30% 66.36% +0.05%
==========================================
Files 1759 1760 +1
Lines 67088 67096 +8
Branches 7127 7129 +2
==========================================
+ Hits 44486 44528 +42
+ Misses 20770 20744 -26
+ Partials 1832 1824 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. |
/testenv up |
@lyndsiWilliams Ephemeral environment spinning up at http://52.25.149.118:8080. Credentials are |
/testenv up |
@lyndsiWilliams Ephemeral environment spinning up at http://54.202.3.230:8080. Credentials are |
2f41613
to
76375a8
Compare
/testenv up |
@lyndsiWilliams Ephemeral environment spinning up at http://54.185.46.90:8080. Credentials are |
/testenv up |
@lyndsiWilliams Ephemeral environment spinning up at http://35.165.194.84:8080. Credentials are |
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
This changes the current save query button into a split save button if the database has "Allow this database to be explored" enabled. When the user clicks the caret section of the button, they can now save the query as a dataset.
Bonus
: In order to create this button, I conveniently needed to fix the styling on the "Run" query split button. The split line now goes all the way through the button and the caret is centered.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE:
AFTER:
TESTING INSTRUCTIONS
v
section of the button, then click "Save dataset" to see the save dataset modalADDITIONAL INFORMATION