Skip to content

Commit

Permalink
Merge branch 'master' into maps/remove_licensing
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Apr 5, 2021
2 parents 4a6f59e + a640522 commit 5b61e06
Show file tree
Hide file tree
Showing 161 changed files with 7,702 additions and 513 deletions.
8 changes: 5 additions & 3 deletions docs/setup/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ docker pull {docker-repo}:{version}
=== Run Kibana on Docker for development
Kibana can be quickly started and connected to a local Elasticsearch container for development
or testing use with the following command:
--------------------------------------------

[source,sh,subs="attributes"]
----
docker run --link YOUR_ELASTICSEARCH_CONTAINER_NAME_OR_ID:elasticsearch -p 5601:5601 {docker-repo}:{version}
--------------------------------------------
endif::[]
----

endif::[]
[float]
[[configuring-kibana-docker]]
=== Configure Kibana on Docker
Expand Down
7 changes: 7 additions & 0 deletions src/dev/build/tasks/os_packages/create_os_package_tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const CreateRpmPackage: Task = {
},
};

const dockerBuildDate = new Date().toISOString();
export const CreateDockerCentOS: Task = {
description: 'Creating Docker CentOS image',

Expand All @@ -57,11 +58,13 @@ export const CreateDockerCentOS: Task = {
architecture: 'x64',
context: false,
image: true,
dockerBuildDate,
});
await runDockerGenerator(config, log, build, {
architecture: 'aarch64',
context: false,
image: true,
dockerBuildDate,
});
},
};
Expand All @@ -76,6 +79,7 @@ export const CreateDockerUBI: Task = {
context: false,
ubi: true,
image: true,
dockerBuildDate,
});
}
},
Expand All @@ -88,18 +92,21 @@ export const CreateDockerContexts: Task = {
await runDockerGenerator(config, log, build, {
context: true,
image: false,
dockerBuildDate,
});

if (!build.isOss()) {
await runDockerGenerator(config, log, build, {
ubi: true,
context: true,
image: false,
dockerBuildDate,
});
await runDockerGenerator(config, log, build, {
ironbank: true,
context: true,
image: false,
dockerBuildDate,
});
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/dev/build/tasks/os_packages/docker_generator/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function runDockerGenerator(
image: boolean;
ubi?: boolean;
ironbank?: boolean;
dockerBuildDate?: string;
}
) {
// UBI var config
Expand All @@ -53,7 +54,7 @@ export async function runDockerGenerator(
const artifactPrefix = `kibana${artifactFlavor}-${version}-linux`;
const artifactTarball = `${artifactPrefix}-${artifactArchitecture}.tar.gz`;
const artifactsDir = config.resolveFromTarget('.');
const dockerBuildDate = new Date().toISOString();
const dockerBuildDate = flags.dockerBuildDate || new Date().toISOString();
// That would produce oss, default and default-ubi7
const dockerBuildDir = config.resolveFromRepo(
'build',
Expand Down
14 changes: 7 additions & 7 deletions src/plugins/data/common/field_formats/converters/color.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ describe('Color Format', () => {

expect(colorer.convert(99, HTML_CONTEXT_TYPE)).toBe('<span ng-non-bindable>99</span>');
expect(colorer.convert(100, HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">100</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">100</span></span>'
);
expect(colorer.convert(150, HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">150</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">150</span></span>'
);
expect(colorer.convert(151, HTML_CONTEXT_TYPE)).toBe('<span ng-non-bindable>151</span>');
});
Expand Down Expand Up @@ -74,22 +74,22 @@ describe('Color Format', () => {

expect(converter('B', HTML_CONTEXT_TYPE)).toBe('<span ng-non-bindable>B</span>');
expect(converter('AAA', HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">AAA</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">AAA</span></span>'
);
expect(converter('AB', HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">AB</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">AB</span></span>'
);
expect(converter('a', HTML_CONTEXT_TYPE)).toBe('<span ng-non-bindable>a</span>');

expect(converter('B', HTML_CONTEXT_TYPE)).toBe('<span ng-non-bindable>B</span>');
expect(converter('AAA', HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">AAA</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">AAA</span></span>'
);
expect(converter('AB', HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">AB</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">AB</span></span>'
);
expect(converter('AB <', HTML_CONTEXT_TYPE)).toBe(
'<span ng-non-bindable><span style="color: blue;background-color: yellow;">AB &lt;</span></span>'
'<span ng-non-bindable><span style="color:blue;background-color:yellow">AB &lt;</span></span>'
);
expect(converter('a', HTML_CONTEXT_TYPE)).toBe('<span ng-non-bindable>a</span>');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/

import { i18n } from '@kbn/i18n';
import { findLast, cloneDeep, template, escape } from 'lodash';
import React from 'react';
import ReactDOM from 'react-dom/server';
import { findLast, cloneDeep, escape } from 'lodash';
import { KBN_FIELD_TYPES } from '../../kbn_field_types/types';
import { FieldFormat } from '../field_format';
import { HtmlContextTypeConvert, FIELD_FORMAT_IDS } from '../types';
import { asPrettyString } from '../utils';
import { DEFAULT_CONVERTER_COLOR } from '../constants/color_default';

const convertTemplate = template('<span style="<%- style %>"><%- val %></span>');

export class ColorFormat extends FieldFormat {
static id = FIELD_FORMAT_IDS.COLOR;
static title = i18n.translate('data.fieldFormats.color.title', {
Expand Down Expand Up @@ -51,11 +51,18 @@ export class ColorFormat extends FieldFormat {

htmlConvert: HtmlContextTypeConvert = (val) => {
const color = this.findColorRuleForVal(val) as typeof DEFAULT_CONVERTER_COLOR;
if (!color) return escape(asPrettyString(val));

let style = '';
if (color.text) style += `color: ${color.text};`;
if (color.background) style += `background-color: ${color.background};`;
return convertTemplate({ val, style });
const displayVal = escape(asPrettyString(val));
if (!color) return displayVal;

return ReactDOM.renderToStaticMarkup(
<span
style={{
color: color.text,
backgroundColor: color.background,
}}
dangerouslySetInnerHTML={{ __html: displayVal }} // eslint-disable-line react/no-danger
/>
);
};
}
16 changes: 16 additions & 0 deletions src/plugins/data/common/field_formats/converters/source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { SourceFormat } from './source';
import { HtmlContextTypeConvert } from '../types';
import { HTML_CONTEXT_TYPE } from '../content_types';
import { stubIndexPatternWithFields } from '../../index_patterns/index_pattern.stub';

describe('Source Format', () => {
let convertHtml: Function;
Expand All @@ -31,4 +32,19 @@ describe('Source Format', () => {
'<span ng-non-bindable>{&quot;foo&quot;:&quot;bar&quot;,&quot;number&quot;:42,&quot;hello&quot;:&quot;&lt;h1&gt;World&lt;/h1&gt;&quot;,&quot;also&quot;:&quot;with \\&quot;quotes\\&quot; or &#39;single quotes&#39;&quot;}</span>'
);
});

test('should render a description list if a field is passed', () => {
const hit = {
foo: 'bar',
number: 42,
hello: '<h1>World</h1>',
also: 'with "quotes" or \'single quotes\'',
};

const indexPattern = { ...stubIndexPatternWithFields, formatHit: (h: string) => h };

expect(convertHtml(hit, { field: 'field', indexPattern, hit })).toMatchInlineSnapshot(
`"<span ng-non-bindable><dl class=\\"source truncate-by-height\\"><dt>foo:</dt><dd>bar</dd> <dt>number:</dt><dd>42</dd> <dt>hello:</dt><dd><h1>World</h1></dd> <dt>also:</dt><dd>with \\"quotes\\" or 'single quotes'</dd> </dl></span>"`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,34 @@
* Side Public License, v 1.
*/

import { template, escape, keys } from 'lodash';
import React, { Fragment } from 'react';
import ReactDOM from 'react-dom/server';
import { escape, keys } from 'lodash';
import { shortenDottedString } from '../../utils';
import { KBN_FIELD_TYPES } from '../../kbn_field_types/types';
import { FieldFormat } from '../field_format';
import { TextContextTypeConvert, HtmlContextTypeConvert, FIELD_FORMAT_IDS } from '../types';
import { UI_SETTINGS } from '../../constants';

/**
* Remove all of the whitespace between html tags
* so that inline elements don't have extra spaces.
*
* If you have inline elements (span, a, em, etc.) and any
* amount of whitespace around them in your markup, then the
* browser will push them apart. This is ugly in certain
* scenarios and is only fixed by removing the whitespace
* from the html in the first place (or ugly css hacks).
*
* @param {string} html - the html to modify
* @return {string} - modified html
*/
function noWhiteSpace(html: string) {
const TAGS_WITH_WS = />\s+</g;
return html.replace(TAGS_WITH_WS, '><');
interface Props {
defPairs: Array<[string, string]>;
}

const templateHtml = `
<dl class="source truncate-by-height">
<% defPairs.forEach(function (def) { %>
<dt><%- def[0] %>:</dt>
<dd><%= def[1] %></dd>
<%= ' ' %>
<% }); %>
</dl>`;
const doTemplate = template(noWhiteSpace(templateHtml));
const TemplateComponent = ({ defPairs }: Props) => {
return (
<dl className={'source truncate-by-height'}>
{defPairs.map((pair, idx) => (
<Fragment key={idx}>
<dt
dangerouslySetInnerHTML={{ __html: `${escape(pair[0])}:` }} // eslint-disable-line react/no-danger
/>
<dd
dangerouslySetInnerHTML={{ __html: `${pair[1]}` }} // eslint-disable-line react/no-danger
/>{' '}
</Fragment>
))}
</dl>
);
};

export class SourceFormat extends FieldFormat {
static id = FIELD_FORMAT_IDS._SOURCE;
Expand Down Expand Up @@ -70,6 +64,8 @@ export class SourceFormat extends FieldFormat {
pairs.push([newField, val]);
}, []);

return doTemplate({ defPairs: highlightPairs.concat(sourcePairs) });
return ReactDOM.renderToStaticMarkup(
<TemplateComponent defPairs={highlightPairs.concat(sourcePairs)} />
);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class FilterEditorUI extends Component<Props, State> {
public render() {
return (
<div>
<EuiPopoverTitle>
<EuiPopoverTitle paddingSize="m">
<EuiFlexGroup alignItems="baseline" responsive={false}>
<EuiFlexItem>
<FormattedMessage
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/ui/filter_bar/filter_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class FilterOptionsUI extends Component<Props, State> {
panelPaddingSize="none"
repositionOnScroll
>
<EuiPopoverTitle>
<EuiPopoverTitle paddingSize="m">
<FormattedMessage
id="data.filter.searchBar.changeAllFiltersTitle"
defaultMessage="Change all filters"
Expand Down
17 changes: 15 additions & 2 deletions src/plugins/data/public/ui/query_string_input/_query_bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,39 @@
// Uses the append style, but no bordering
.kqlQueryBar__languageSwitcherButton {
border-right: none !important;
border-left: $euiFormInputGroupBorder;
}

.kbnQueryBar__textareaWrap {
overflow: visible !important; // Override EUI form control
display: flex;
flex: 1 1 100%;
position: relative;

@include kbnThemeStyle('v8') {
background-color: $euiFormBackgroundColor;
}
}

.kbnQueryBar__textarea {
z-index: $euiZContentMenu;
resize: none !important; // When in the group, it will autosize
height: $euiFormControlHeight;
height: $euiFormControlHeight - 2px;
// Unlike most inputs within layout control groups, the text area still needs a border
// for multi-line content. These adjusts help it sit above the control groups
// shadow to line up correctly.
padding: $euiSizeS;
padding-top: $euiSizeS + 3px;
box-shadow: 0 0 0 1px $euiFormBorderColor;

@include kbnThemeStyle('v7') {
padding-top: $euiSizeS + 2px;
}

@include kbnThemeStyle('v8') {
border-radius: 0;
padding-bottom: $euiSizeS + 1px;
}

&:not(.kbnQueryBar__textarea--autoHeight):not(:invalid) {
@include euiYScrollWithShadows;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function QueryLanguageSwitcher({
/>
</EuiPopoverTitle>
<div style={{ width: '350px' }}>
<EuiText>
<EuiText size="s">
<p>
<FormattedMessage
id="data.query.queryBar.syntaxOptionsDescription"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,12 @@ export default class QueryStringInputUI extends Component<Props, State> {
const newQueryString = value.substr(0, start) + text + value.substr(end);

this.reportUiCounter?.(
METRIC_TYPE.LOADED,
`query_string:${type}:suggestions_select_position`,
listIndex
METRIC_TYPE.CLICK,
`query_string:${type}:suggestions_select_position_${listIndex}`
);
this.reportUiCounter?.(
METRIC_TYPE.LOADED,
`query_string:${type}:suggestions_select_q_length`,
end - start
METRIC_TYPE.CLICK,
`query_string:${type}:suggestions_select_q_length_${end - start}`
);

this.onQueryStringChange(newQueryString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export function SavedQueryManagementComponent({
className="kbnSavedQueryManagement__popover"
data-test-subj="saved-query-management-popover"
>
<EuiPopoverTitle id={'savedQueryManagementPopoverTitle'}>
<EuiPopoverTitle paddingSize="m" id={'savedQueryManagementPopoverTitle'}>
{savedQueryPopoverTitleText}
</EuiPopoverTitle>
{savedQueries.length > 0 ? (
Expand Down Expand Up @@ -234,7 +234,7 @@ export function SavedQueryManagementComponent({
<EuiSpacer size="s" />
</Fragment>
)}
<EuiPopoverFooter>
<EuiPopoverFooter paddingSize="m">
<EuiFlexGroup
direction="rowReverse"
gutterSize="s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export function Agg(props: AggProps) {
...props.style,
};

const indexPattern =
(props.series.override_index_pattern && props.series.series_index_pattern) ||
props.panel.index_pattern;
const indexPattern = props.series.override_index_pattern
? props.series.series_index_pattern
: props.panel.index_pattern;

return (
<div className={props.className} style={style}>
Expand Down
Loading

0 comments on commit 5b61e06

Please sign in to comment.