Skip to content

Commit

Permalink
Merge branch 'master' into 95557-emotion
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Jul 9, 2021
2 parents b464828 + efa4ce2 commit 447e80e
Show file tree
Hide file tree
Showing 332 changed files with 8,430 additions and 1,550 deletions.
3 changes: 0 additions & 3 deletions docs/user/dashboard/lens-advanced.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@ image::images/lens_advanced_5_2.png[Line chart with cumulative sum of orders mad
*Lens* allows you to compare the currently selected time range with historical data using the *Time shift* option. To calculate the percent
change, use *Formula*.

Time shifts can be used on any metric. The special shift *previous* will show the time window preceding the currently selected one, spanning the same duration.
For example, if *Last 7 days* is selected in the time filter, *previous* will show data from 14 days ago to 7 days ago.

If multiple time shifts are used in a single chart, a multiple of the date histogram interval should be chosen - otherwise data points might not line up in the chart and empty spots can occur.
For example, if a daily interval is used, shifting one series by *36h*, and another one by *1d*, is not recommended. In this scenario, either reduce the interval to *12h*, or create two separate charts.

Expand Down
4 changes: 3 additions & 1 deletion examples/expressions_explorer/public/render_expressions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ interface Props {
}

export function RenderExpressionsExample({ expressions, inspector }: Props) {
const [expression, updateExpression] = useState('markdown "## expressions explorer rendering"');
const [expression, updateExpression] = useState(
'markdownVis "## expressions explorer rendering"'
);

const expressionChanged = (value: string) => {
updateExpression(value);
Expand Down
2 changes: 1 addition & 1 deletion examples/expressions_explorer/public/run_expressions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface Props {
}

export function RunExpressionsExample({ expressions, inspector }: Props) {
const [expression, updateExpression] = useState('markdown "## expressions explorer"');
const [expression, updateExpression] = useState('markdownVis "## expressions explorer"');
const [result, updateResult] = useState<unknown>({});

const expressionChanged = (value: string) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
"react-moment-proptypes": "^1.7.0",
"react-monaco-editor": "^0.41.2",
"react-popper-tooltip": "^2.10.1",
"react-query": "^3.13.10",
"react-query": "^3.18.1",
"react-redux": "^7.2.0",
"react-resizable": "^1.7.5",
"react-resize-detector": "^4.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-rule-data-utils/src/technical_field_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const RULE_NAME = 'rule.name' as const;
const RULE_CATEGORY = 'rule.category' as const;
const TAGS = 'tags' as const;
const PRODUCER = `${ALERT_NAMESPACE}.producer` as const;
const OWNER = `${ALERT_NAMESPACE}.owner` as const;
const ALERT_ID = `${ALERT_NAMESPACE}.id` as const;
const ALERT_UUID = `${ALERT_NAMESPACE}.uuid` as const;
const ALERT_START = `${ALERT_NAMESPACE}.start` as const;
Expand All @@ -40,6 +41,7 @@ const fields = {
RULE_CATEGORY,
TAGS,
PRODUCER,
OWNER,
ALERT_ID,
ALERT_UUID,
ALERT_START,
Expand All @@ -62,6 +64,7 @@ export {
RULE_CATEGORY,
TAGS,
PRODUCER,
OWNER,
ALERT_ID,
ALERT_UUID,
ALERT_START,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// Similar to the src/core/server/saved_objects/version/decode_version.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-securitysolution-es-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

export * from './bad_request_error';
export * from './create_boostrap_index';
export * from './decode_version';
export * from './delete_all_index';
export * from './delete_policy';
export * from './delete_template';
export * from './elasticsearch_client';
export * from './encode_hit_version';
export * from './get_index_aliases';
export * from './get_index_count';
export * from './get_index_exists';
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-utils/src/path/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const CONFIG_PATHS = [
process.env.KIBANA_PATH_CONF && join(process.env.KIBANA_PATH_CONF, 'kibana.yml'),
process.env.CONFIG_PATH, // deprecated
join(REPO_ROOT, 'config/kibana.yml'),
'/etc/kibana/kibana.yml',
].filter(isString);

const CONFIG_DIRECTORIES = [
Expand Down
6 changes: 3 additions & 3 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ export class DocLinksService {
anomalyDetectionJobTips: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/create-jobs.html#job-tips`,
anomalyDetectionModelMemoryLimits: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/create-jobs.html#model-memory-limits`,
calendars: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-calendars.html`,
classificationEvaluation: `${ELASTICSEARCH_DOCS}evaluate-dfanalytics.html`,
classificationEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-classification.html#ml-dfanalytics-classification-evaluation`,
customRules: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-rules.html`,
customUrls: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-url.html`,
dataFrameAnalytics: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics.html`,
featureImportance: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-feature-importance.html`,
outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-finding-outliers.html#ml-dfanalytics-roc`,
regressionEvaluation: `${ELASTICSEARCH_DOCS}evaluate-dfanalytics.html`,
classificationAucRoc: `${ELASTICSEARCH_DOCS}evaluate-dfanalytics.html`,
regressionEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-regression.html#ml-dfanalytics-regression-evaluation`,
classificationAucRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-classification.html#ml-dfanalytics-class-aucroc`,
},
transforms: {
guide: `${ELASTICSEARCH_DOCS}transforms.html`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const REMOVED_TYPES: string[] = [
'fleet-agent-events',
// Was removed in 7.12
'ml-telemetry',
'server',
// https://github.com/elastic/kibana/issues/95617
'tsvb-validation-telemetry',
].sort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const previouslyRegisteredTypes = [
'search-telemetry',
'security-rule',
'security-solution-signals-migration',
'server',
'siem-detection-engine-rule-actions',
'siem-detection-engine-rule-status',
'siem-ui-timeline',
Expand Down
1 change: 0 additions & 1 deletion src/dev/build/tasks/install_chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const InstallChromium = {
log.info(`Installing Chromium for ${platform.getName()}-${platform.getArchitecture()}`);

const { binaryPath$ } = installBrowser(
// TODO: https://github.com/elastic/kibana/issues/72496
log,
build.resolvePathForPlatform(platform, 'x-pack/plugins/reporting/chromium'),
platform.getName(),
Expand Down
17 changes: 13 additions & 4 deletions src/plugins/kibana_react/common/eui_styled_components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
* Side Public License, v 1.
*/

import type { DecoratorFn } from '@storybook/react';
import React from 'react';
import * as styledComponents from 'styled-components';
import { ThemedStyledComponentsModule, ThemeProvider, ThemeProviderProps } from 'styled-components';

import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import euiLightVars from '@elastic/eui/dist/eui_theme_light.json';
import { euiThemeVars, euiLightVars, euiDarkVars } from '@kbn/ui-shared-deps/theme';

export interface EuiTheme {
eui: typeof euiLightVars | typeof euiDarkVars;
eui: typeof euiThemeVars;
darkMode: boolean;
}

Expand All @@ -36,6 +35,16 @@ const EuiThemeProvider = <
/>
);

/**
* Storybook decorator using the EUI theme provider. Uses the value from
* `globals` provided by the Storybook theme switcher.
*/
export const EuiThemeProviderDecorator: DecoratorFn = (storyFn, { globals }) => {
const darkMode = globals.euiTheme === 'v8.dark' || globals.euiTheme === 'v7.dark';

return <EuiThemeProvider darkMode={darkMode}>{storyFn()}</EuiThemeProvider>;
};

const {
default: euiStyled,
css,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
EuiFormRow,
EuiSpacer,
} from '@elastic/eui';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

export function CumulativeSumAgg(props) {
const { model, siblings, fields, indexPattern } = props;
Expand Down Expand Up @@ -70,7 +71,7 @@ export function CumulativeSumAgg(props) {
onChange={handleSelectChange('field')}
metrics={siblings}
metric={model}
fields={fields[indexPattern]}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
EuiSpacer,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

export const DerivativeAgg = (props) => {
const { siblings, fields, indexPattern } = props;
Expand Down Expand Up @@ -80,7 +81,7 @@ export const DerivativeAgg = (props) => {
onChange={handleSelectChange('field')}
metrics={siblings}
metric={model}
fields={fields[indexPattern]}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
fullWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
EuiFieldNumber,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

const DEFAULTS = {
model_type: MODEL_TYPES.UNWEIGHTED,
Expand Down Expand Up @@ -141,7 +142,7 @@ export const MovingAverageAgg = (props) => {
onChange={handleSelectChange('field')}
metrics={siblings}
metric={model}
fields={fields[indexPattern]}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
EuiSpacer,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

export const PositiveOnlyAgg = (props) => {
const { siblings, fields, indexPattern } = props;
Expand Down Expand Up @@ -74,7 +75,7 @@ export const PositiveOnlyAgg = (props) => {
onChange={handleSelectChange('field')}
metrics={siblings}
metric={model}
fields={fields[indexPattern]}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
EuiSpacer,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

export const SerialDiffAgg = (props) => {
const { siblings, fields, indexPattern, model } = props;
Expand Down Expand Up @@ -74,7 +75,7 @@ export const SerialDiffAgg = (props) => {
onChange={handleSelectChange('field')}
metrics={siblings}
metric={model}
fields={fields[indexPattern]}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
EuiSpacer,
} from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

const StandardSiblingAggUi = (props) => {
const { siblings, intl, fields, indexPattern } = props;
Expand Down Expand Up @@ -147,7 +148,7 @@ const StandardSiblingAggUi = (props) => {
onChange={handleSelectChange('field')}
exclude={[METRIC_TYPES.PERCENTILE, METRIC_TYPES.TOP_HIT]}
metrics={siblings}
fields={fields[indexPattern]}
fields={fields[getIndexPatternKey(indexPattern)]}
metric={model}
value={model.field}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AddDeleteButtons } from '../add_delete_buttons';
import { collectionActions } from '../lib/collection_actions';
import { MetricSelect } from './metric_select';
import { EuiFlexGroup, EuiFlexItem, EuiFieldText } from '@elastic/eui';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

export const newVariable = (opts) => ({ id: uuid.v1(), name: '', field: '', ...opts });

Expand Down Expand Up @@ -59,7 +60,7 @@ export class CalculationVars extends Component {
metrics={this.props.metrics}
metric={this.props.model}
value={row.field}
fields={this.props.fields[this.props.indexPattern]}
fields={this.props.fields[getIndexPatternKey(this.props.indexPattern)]}
includeSiblings={this.props.includeSiblings}
exclude={this.props.exclude}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export class TablePanelConfig extends Component<
<EuiFieldText
onChange={this.handleTextChange('drilldown_url')}
value={model.drilldown_url ?? ''}
data-test-subj="drilldownUrl"
/>
</EuiFormRow>

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../data/public';
import { STACKED_OPTIONS } from '../../visualizations/constants';
import { getIndexPatternKey } from '../../../../common/index_patterns_utils';

const DEFAULTS = { terms_direction: 'desc', terms_size: 10, terms_order_by: '_count' };

Expand Down Expand Up @@ -75,10 +76,11 @@ export const SplitByTermsUI = ({
}),
},
];
const fieldsSelector = getIndexPatternKey(indexPattern);
const selectedDirectionOption = dirOptions.find((option) => {
return model.terms_direction === option.value;
});
const selectedField = find(fields[indexPattern], ({ name }) => name === model.terms_field);
const selectedField = find(fields[fieldsSelector], ({ name }) => name === model.terms_field);
const selectedFieldType = get(selectedField, 'type');

if (
Expand Down Expand Up @@ -144,6 +146,7 @@ export const SplitByTermsUI = ({
<EuiFieldText
value={model.terms_include}
onChange={handleTextChange('terms_include')}
data-test-subj="groupByInclude"
/>
</EuiFormRow>
</EuiFlexItem>
Expand All @@ -160,6 +163,7 @@ export const SplitByTermsUI = ({
<EuiFieldText
value={model.terms_exclude}
onChange={handleTextChange('terms_exclude')}
data-test-subj="groupByExclude"
/>
</EuiFormRow>
</EuiFlexItem>
Expand Down Expand Up @@ -198,7 +202,7 @@ export const SplitByTermsUI = ({
metrics={metrics}
clearable={false}
additionalOptions={[defaultCount, terms]}
fields={fields[indexPattern]}
fields={fields[fieldsSelector]}
onChange={handleSelectChange('terms_order_by')}
restrict="basic"
value={model.terms_order_by}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ class TableVis extends Component {

renderRow = (row) => {
const { model } = this.props;
let rowDisplay = model.pivot_type === 'date' ? this.dateFormatter.convert(row.key) : row.key;

let rowDisplay = getValueOrEmpty(
model.pivot_type === 'date' ? this.dateFormatter.convert(row.key) : row.key
);

if (model.drilldown_url) {
const url = replaceVars(model.drilldown_url, {}, { key: row.key });
rowDisplay = <a href={sanitizeUrl(url)}>{rowDisplay}</a>;
Expand Down Expand Up @@ -98,7 +102,7 @@ class TableVis extends Component {
});
return (
<tr key={row.key}>
<td>{getValueOrEmpty(rowDisplay)}</td>
<td>{rowDisplay}</td>
{columns}
</tr>
);
Expand Down
Loading

0 comments on commit 447e80e

Please sign in to comment.