-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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: Added Rows Returned #13190
feat: Added Rows Returned #13190
Conversation
0de21e7
to
26bc3ba
Compare
rowsReturned() { | ||
return ( | ||
<div className="ReturnedRows"> | ||
{this.state.data && this.state.data.length >= 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.
you can use optional chaining here. Can the length ever be less than 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.
I think I could actually just remove the conditions, since a tighter version of it happens in the render.
<div className="ReturnedRows"> | ||
{this.state.data && this.state.data.length >= 0 && ( | ||
<span> | ||
{t(`%s rows returned`, this.props.query.results.data.length)} |
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.
it feels like this length should be referencing the same length 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.
Also, the query has a rows prop which may be easier than totaling.
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 originally had this as a drawing from the query function, but when I did that I got an error that said that Query has no property called rows, which is what is being passed into props.query.
However, when I render with this.props.query.rows, it renders perfectly fine, and is responsive to how many lines the SQL result is. I changed it to this because I was tired of my terminal yelling at me.
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.
26bc3ba
to
4a35213
Compare
80a7e7e
to
3383694
Compare
e599a9c
to
8c9c3e4
Compare
8c9c3e4
to
f995d78
Compare
Codecov Report
@@ Coverage Diff @@
## master #13190 +/- ##
==========================================
- Coverage 77.05% 72.93% -4.13%
==========================================
Files 897 597 -300
Lines 45710 21275 -24435
Branches 5497 5498 +1
==========================================
- Hits 35224 15517 -19707
+ Misses 10362 5631 -4731
- Partials 124 127 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
looking good! just a few small comments.
} | ||
return ( | ||
<div className="ReturnedRows"> | ||
{limitWarning} |
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.
a bit of a nit, but instead of making limitWarning
a react component or null and using it as a boolean, it would be better to use displayLimitReached
as the boolean in both cases and have limitWarning always be the icon.
It would read {displayLimitReached && limitWarning}
for example and the reader would know that it only shows the limitWarning if the displayLimit is reached, rather than always showing the warning, which will be null if the display limit isn't reached. It's a small nuance, but will help.
} | ||
.LimitMessage{ | ||
color: #8E94B0; | ||
} |
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.
we're going clean out these less files soon. I'd suggest using the emotion styles instead.
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.
@eschutho changed it to emotion, and also used your updated logic.
eb8a3cc
to
a9e293d
Compare
a9e293d
to
4cc675d
Compare
@@ -481,6 +497,27 @@ export default class ResultSet extends React.PureComponent< | |||
return <div className="noControls" />; | |||
} | |||
|
|||
rowsReturned() { |
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, but I would rename this renderRowsReturned
since it's a function, so thus the verb prefix. Also to be consistent with renderControls
<ReturnedRows> | ||
{query.results?.displayLimitReached && limitWarning} | ||
<span>{t(`%s rows returned`, query.rows)}</span> | ||
{query.results?.displayLimitReached && ( |
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.
lets see if we can put this value into a variable since you're using it twice. You can also declare it in the destructuring on line 501.
`It appears that the number of rows in the query results displayed | ||
was limited on the server side to | ||
the %s limit.`, | ||
query.rows, |
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 is cool. I didn't know that you can do string interpolation in the translate function.
{query.results?.displayLimitReached && limitWarning} | ||
<span>{t(`%s rows returned`, query.rows)}</span> | ||
{query.results?.displayLimitReached && ( | ||
<span className="LimitMessage"> |
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.
we usually use camel-case (lowercase first letter) for class names.
@@ -100,6 +100,22 @@ const MonospaceDiv = styled.div` | |||
white-space: pre-wrap; | |||
`; | |||
|
|||
const ReturnedRows = styled.div` | |||
margin-top: 48px; | |||
margin-bottom: -32px; |
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.
there's some weirdness going on with the position: fixed styling of the controls, which is causing these weird margins. Let's see if can remove the position:fixed on the controls. I don't think they are supposed to scroll at all, so we may need to look for a container that has a scroll attribute on the overflow and remove it.
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.
@eschutho been playing around with this a bit. I got rid of position fixed on the controls, and if do overflow:hidden on the overall container then it replicates the behavior that we want without there being negative margins (I kind of had a theory that you might not like negative margin :) )
What I am currently doing is looking at how to target the overall container.
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.
ok, I think I fixed all of it with the last commit! This was a good dive into the various components in the South Pane.
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.
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, that looks great! also, correct on the negative margins. :)
} | ||
.limitMessage { | ||
color: #8e94b0; | ||
margin-left: 8px; |
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 try to use the themeProvider here for the spacings and colors?
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.
Done! I couldn't find the right orange color though, should I add it in?
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.
Let's ask @Steejay if the existing orange works: FF7F44
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.
@@ -481,6 +495,28 @@ export default class ResultSet extends React.PureComponent< | |||
return <div className="noControls" />; | |||
} | |||
|
|||
renderRowsReturned() { | |||
const { results, rows } = this.props.query; |
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.
will this.props.query
always have a 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.
yup! It will only render if query.results exists.
just so I don't forget, let's follow up on the display alert in this ticket.. does this PR include #10330 too? |
Portions of it, the portions that are not included are the admin portions and the part that requires a migration. |
ff73170
to
e5ed831
Compare
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.
Looked at this with @AAfghahi today, it was looking good to me 👍 |
SUMMARY
SQL Lab shows how many rows have been returned.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
These show if you have no Limit, if you have a Limit, or if your results are less than the max limit.
TEST PLAN
ADDITIONAL INFORMATION