-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
HelpTrigger #3431
Merged
Merged
HelpTrigger #3431
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Tooltip from 'antd/lib/tooltip'; | ||
import Icon from 'antd/lib/icon'; | ||
|
||
const BASE_URL = 'https://redash.io/help/user-guide/'; | ||
const TYPES = { | ||
VALUE_SOURCE_OPTIONS: [ | ||
'querying/query-parameters#Value-Source-Options', | ||
'Value Source Options', | ||
], | ||
SHARE_DASHBOARD: [ | ||
'dashboards/sharing-dashboards', | ||
'Sharing and Embedding Dashboards', | ||
], | ||
}; | ||
|
||
export default class HelpTrigger extends React.PureComponent { | ||
static propTypes = { | ||
type: PropTypes.oneOf(Object.keys(TYPES)).isRequired, | ||
} | ||
|
||
render() { | ||
const [path, tooltip] = TYPES[this.props.type]; | ||
const href = BASE_URL + path; | ||
return ( | ||
<Tooltip title={`Guide: ${tooltip}`}> | ||
{/* eslint-disable-next-line react/jsx-no-target-blank */} | ||
<a href={href} target="_blank" rel="noopener"> | ||
<Icon type="question-circle" /> | ||
</a> | ||
</Tooltip> | ||
); | ||
} | ||
} |
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.
Why not pass the title and URL here? I'm pretty sure we will rarely reuse the link helps, so having them in a single place and then referenced using some random string is just recipe for trouble.
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.
Not meant for reuse, but so that if help urls change, there's a single source to edit.
This is a "preparation for A/C" for when TS is integrated as it would enforce the string to be of type (I don't like unnecessary type importing..).
👍 if you're cool with it, 👎 if you'd rather go with your suggestion
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 mean that TS will enforce that the string is one of possible values?
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.
Yep
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.
TS support can't come any sooner... 😓
I wonder if we should go through the effort of introducing it now, or wait to get rid of Angular and then switch to
react-scripts
and let them take care of the plumbing...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 really dunno to tell you the amount of effort involved.
If it's truly possible to gradually adopt - let's do this now.
If not - it can wait.
The focus for the coming 4 weeks should be Angular->React migration completion.