Skip to content
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

Add help to code snippets widget #2867

Closed
wants to merge 10 commits into from
17 changes: 17 additions & 0 deletions resources/web/docs_js/components/console_widget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ export const ConsoleForm = connect((state, props) =>
// ConsoleWidget isn't quite the right name for this any more....
export const ConsoleWidget = props => {
const modalAction = () => props.openModal(ConsoleForm, {setting: props.setting, url_label: props.url_label});

// Simple function to display a modal/tooltip
const showHelp = () => {
alert('1. To change the client language, use the dropdown.\n\n' +
'2. To copy the code in curl format:\n' +
' - Use gear icon (⚙) to set Elasticsearch URL + username.\n' +
' - Click "Copy as curl".\n\n' +
'3. To open the example in Kibana Console:\n'+
' - Use gear icon (⚙) to set Kibana Console URL.\n' +
' - Click "View in Console".')
};

return <div className="u-space-between">
<AlternativePicker langs={props.langs} />
<div className="u-space-between">
Expand All @@ -91,6 +103,11 @@ export const ConsoleWidget = props => {
title={props.langStrings(props.view_in_text)}
href={`${props[props.setting + "_url"]}?load_from=${props.baseUrl}${props.snippet}`}>{props.langStrings(props.view_in_text)}</a>
}

<a className="help_info" onClick={showHelp} style={{ textDecoration: 'none'}}>
ℹ️
</a>

<a className="console_settings" onClick={modalAction} title={props.langStrings(props.configure_text)}>&nbsp;</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/web/style/console_widget.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
background: #343741;
padding: 7px 15px 7px 0;
}
.view_in_link, .copy_as_curl {
.view_in_link, .copy_as_curl, .help_info {
color: #ffffff;
cursor: pointer;
font-weight: 500;
Expand Down