Skip to content

Commit

Permalink
add config.docs.logstash and fix vertical spacing between Content com…
Browse files Browse the repository at this point in the history
…ponent and commands
  • Loading branch information
nreese committed Nov 27, 2017
1 parent 75c0257 commit 90fdb09
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import MarkdownIt from 'markdown-it';
Expand All @@ -7,15 +8,17 @@ const markdownIt = new MarkdownIt('zero', { html: false, linkify: true });
// list of rules can be found at https://github.com/markdown-it/markdown-it/issues/361
markdownIt.enable(['backticks', 'emphasis', 'link', 'list']);

export function Content({ text }) {
export function Content({ className, text }) {
const classes = classNames('kuiText kuiSubduedText tutorialContent', className);
return (
<p
className="kuiText kuiSubduedText kuiVerticalRhythm kuiVerticalRhythmSmall"
<div
className={classes}
dangerouslySetInnerHTML={{ __html: markdownIt.render(replaceTemplateStrings(text)) }}
/>
);
}

Content.propTypes = {
className: PropTypes.string,
text: PropTypes.string.isRequired
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { replaceTemplateStrings } from './replace_template_strings';
export function Instruction({ commands, paramValues, textPost, textPre }) {
let pre;
if (textPre) {
pre = <Content text={textPre}/>;
pre = <Content className="kuiVerticalRhythm" text={textPre}/>;
}

let post;
if (textPost) {
post = <Content text={textPost}/>;
post = <Content className="kuiVerticalRhythm" text={textPost}/>;
}

const aceOptions = {
Expand All @@ -29,15 +29,16 @@ export function Instruction({ commands, paramValues, textPost, textPre }) {

{pre}

<KuiCodeEditor
className="kuiVerticalRhythm"
mode="sh"
theme="github"
width="100%"
value={commands.map(cmd => { return replaceTemplateStrings(cmd, paramValues); }).join('\n')}
setOptions={aceOptions}
isReadOnly
/>
<div className="kuiVerticalRhythm">
<KuiCodeEditor
mode="sh"
theme="github"
width="100%"
value={commands.map(cmd => { return replaceTemplateStrings(cmd, paramValues); }).join('\n')}
setOptions={aceOptions}
isReadOnly
/>
</div>

{post}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export function Introduction({ description, previewUrl, title }) {
<div className="kuiFlexGroup kuiFlexGroup--gutterLarge">

<div className="kuiFlexItem">
<h1 className="kuiTitle">
<h1 className="kuiTitle kuiVerticalRhythm">
{title}
</h1>
<Content text={description}/>
<Content className="kuiVerticalRhythm" text={description}/>
</div>

<div className="kuiFlexItem kuiFlexItem--flexGrowZero">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function replaceTemplateStrings(text, params = {}) {
filebeat: documentationLinks.filebeat.base,
metricbeat: documentationLinks.metricbeat.base
},
logstash: documentationLinks.logstash.base,
version: DOC_LINK_VERSION
},
kibana: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './tutorial.less';
import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.tutorialContent {
/*
* 1. remove bottom margin placed on p element by bootstrap
*/
p {
margin-bottom: 0; /* 1 */
}
}
3 changes: 3 additions & 0 deletions src/ui/public/documentation_links/documentation_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const documentationLinks = {
metricbeat: {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}`
},
logstash: {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/logstash/${DOC_LINK_VERSION}`
},
scriptedFields: {
scriptFields: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/search-request-script-fields.html`,
scriptAggs: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/search-aggregations.html#_values_source`,
Expand Down

0 comments on commit 90fdb09

Please sign in to comment.