diff --git a/client/app/components/ParameterMappingInput.jsx b/client/app/components/ParameterMappingInput.jsx index 9bf88329b8..d2b5f87d3e 100644 --- a/client/app/components/ParameterMappingInput.jsx +++ b/client/app/components/ParameterMappingInput.jsx @@ -18,16 +18,12 @@ import { ParameterValueInput } from '@/components/ParameterValueInput'; import { ParameterMappingType } from '@/services/widget'; import { clientConfig } from '@/services/auth'; import { Query, Parameter } from '@/services/query'; +import HelpTrigger from '@/services/HelpTrigger'; import './ParameterMappingInput.less'; const { Option } = Select; -const HELP_URL = [ - 'https://redash.io/help/user-guide/querying/query-parameters?source=dialog#Value-Source-Options', - 'Guide: Value Source Options', -]; - export const MappingType = { DashboardAddNew: 'dashboard-add-new', DashboardMapToExisting: 'dashboard-map-to-existing', @@ -339,18 +335,11 @@ class MappingEditor extends React.Component { renderContent() { const { mapping, inputError } = this.state; - const [helpUrl, tooltip] = HELP_URL; return (
- Edit Source and Value - {/* eslint-disable-next-line react/jsx-no-target-blank */} - - - - - + Edit Source and Value
Allow public access to this dashboard with a secret address.{' '} - - { /* eslint-disable-next-line react/jsx-no-target-blank */} - Learn more - +
); diff --git a/client/app/services/HelpTrigger.jsx b/client/app/services/HelpTrigger.jsx new file mode 100644 index 0000000000..fef0d7228b --- /dev/null +++ b/client/app/services/HelpTrigger.jsx @@ -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 ( + + {/* eslint-disable-next-line react/jsx-no-target-blank */} + + + + + ); + } +}