-
Notifications
You must be signed in to change notification settings - Fork 13.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
Added url shortner for sharing query link #1314
Conversation
build doesn't go through... |
onMouseOut() { | ||
// delay to avoid flash of text change on tooltip | ||
setTimeout(this.resetTooltipText, 200); | ||
} | ||
|
||
getShortUrl() { |
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.
Seems like CopyToClipboard
should be more generic, isn't it used in other places that have nothing to do with shortening URLs?
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.
Moved the shortner outside CopyToClipboard to components separately in new commit
if (qe.autorun) params.push('autorun=' + qe.autorun); | ||
if (qe.sql) params.push('sql=' + qe.sql); | ||
|
||
return getLink(this.state.cleanUri, params); |
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'm trying to understand the new logic and I don't see where the url gets crafted before sending to the backend for shortening.
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.
Sorry this was moved to CopyQueryTabUrl in the previous PR, But I forgot to remove it in this component. It's not used in this component anymore.
0e83f7c
to
cafc580
Compare
Thanks for reviewing! I moved shortUrl out of CopyToClipboard and the ajax call to common.js. @mistercrunch |
cafc580
to
ad662cc
Compare
bad52ba
to
b0bac1e
Compare
@@ -29,7 +29,7 @@ class TabbedSqlEditors extends React.Component { | |||
const queryEditorProps = { | |||
id: shortid.generate(), | |||
title: getParamFromQuery(this.state.query, 'title'), | |||
dbId: getParamFromQuery(this.state.query, 'dbid'), | |||
dbId: parseInt(getParamFromQuery(this.state.query, 'dbid'), 10), |
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.
Previously the database was not set in DatabaseSelect when loading the shared url because the passed string failed the prop as integer. Fixed it here
|
||
return queryLink; | ||
onShortUrlSuccess(data) { |
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 like you are not handling error case here, what setting the state directly in the componentWillMount ?
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.
for the error case the state won't get updated, so the shortUrl stays as empty string.
|
||
return queryLink; | ||
onShortUrlSuccess(data) { |
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'm a big fan of more, smaller methods, rather than putting everything in line. this seems cleaner than putting in directly in componentWillMount
, imo.
generally lgtm. i would use git's rebase functionality for syncing your branch, which will avoid having many merge commits here.
|
09c9ecb
to
b0bac1e
Compare
Addressing comments from today's meeting
Done:
needs-review @ascott @bkyryliuk @mistercrunch