Skip to content

Commit

Permalink
Merge branch 'master' into single-version-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Oct 1, 2020
2 parents a4dd0b8 + 5f18730 commit 608c1c9
Show file tree
Hide file tree
Showing 366 changed files with 6,932 additions and 3,460 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
"@types/hjson": "^2.4.2",
"@types/hoek": "^4.1.3",
"@types/inert": "^5.1.2",
"@types/jest": "^25.2.3",
"@types/jest": "^26.0.14",
"@types/jest-when": "^2.7.1",
"@types/joi": "^13.4.2",
"@types/jquery": "^3.3.31",
Expand Down Expand Up @@ -337,7 +337,7 @@
"@types/supertest-as-promised": "^2.0.38",
"@types/tapable": "^1.0.6",
"@types/tar": "^4.0.3",
"@types/testing-library__jest-dom": "^5.9.2",
"@types/testing-library__jest-dom": "^5.9.3",
"@types/testing-library__react-hooks": "^3.4.0",
"@types/type-detect": "^4.0.1",
"@types/uuid": "^3.4.4",
Expand All @@ -356,7 +356,7 @@
"archiver": "^3.1.1",
"axe-core": "^4.0.2",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.5.1",
"babel-jest": "^26.3.0",
"babel-plugin-istanbul": "^6.0.0",
"backport": "5.6.0",
"brace": "0.11.1",
Expand All @@ -382,7 +382,7 @@
"eslint-plugin-cypress": "^2.8.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jest": "^23.10.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-no-unsanitized": "^3.0.2",
Expand Down Expand Up @@ -411,10 +411,10 @@
"iedriver": "^3.14.2",
"immer": "^1.5.0",
"intl-messageformat-parser": "^1.4.0",
"jest": "^25.5.4",
"jest": "^26.4.2",
"jest-canvas-mock": "^2.2.0",
"jest-circus": "^25.5.4",
"jest-cli": "^25.5.4",
"jest-circus": "^26.4.2",
"jest-cli": "^26.4.2",
"jest-environment-jsdom-thirteen": "^1.0.1",
"jest-raw-loader": "^1.0.1",
"jest-when": "^2.7.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/elastic-eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jest": "^23.10.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
Expand Down
18 changes: 0 additions & 18 deletions packages/kbn-babel-preset/node_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,6 @@
*/

module.exports = (_, options = {}) => {
const overrides = [];
if (!process.env.ALLOW_PERFORMANCE_HOOKS_IN_TASK_MANAGER) {
overrides.push({
test: [/x-pack[\/\\]legacy[\/\\]plugins[\/\\]task_manager/],
plugins: [
[
require.resolve('babel-plugin-filter-imports'),
{
imports: {
perf_hooks: ['performance'],
},
},
],
],
});
}

return {
presets: [
[
Expand Down Expand Up @@ -74,6 +57,5 @@ module.exports = (_, options = {}) => {
},
],
],
overrides,
};
};
4 changes: 1 addition & 3 deletions packages/kbn-babel-preset/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kbn/babel-preset",
"private": true,
"version": "1.0.0",
"private": true,
"license": "Apache-2.0",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.10.4",
Expand All @@ -13,10 +13,8 @@
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.10.4",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-filter-imports": "^3.0.0",
"babel-plugin-styled-components": "^1.10.7",
"babel-plugin-transform-define": "^1.3.1",
"babel-plugin-transform-imports": "^2.0.0",
"react-is": "^16.8.0",
"styled-components": "^5.1.0"
}
Expand Down
19 changes: 0 additions & 19 deletions packages/kbn-babel-preset/webpack_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,5 @@ module.exports = () => {
},
],
],
// NOTE: we can enable this by default for everything as soon as we only have one instance
// of lodash across the entire project. For now we are just enabling it for siem
// as they are extensively using the lodash v4
overrides: [
{
test: [/x-pack[\/\\]legacy[\/\\]plugins[\/\\]siem[\/\\]public/],
plugins: [
[
require.resolve('babel-plugin-transform-imports'),
{
'lodash/?(((\\w*)?/?)*)': {
transform: 'lodash/${1}/${member}',
preventFullImport: false,
},
},
],
],
},
],
};
};
2 changes: 1 addition & 1 deletion packages/kbn-es/src/integration_tests/cluster.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function ensureResolve(promise) {

function mockEsBin({ exitCode, start }) {
execa.mockImplementationOnce((cmd, args, options) =>
require.requireActual('execa')(
jest.requireActual('execa')(
process.execPath,
[
require.resolve('./__fixtures__/es_bin.js'),
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/src/core/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('I18n engine', () => {
let i18n: typeof i18nModule;

beforeEach(() => {
i18n = require.requireActual('./i18n');
i18n = jest.requireActual('./i18n');
});

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"execa": "^4.0.2",
"file-loader": "^4.2.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jest-diff": "^25.5.0",
"jest-diff": "^26.4.2",
"json-stable-stringify": "^1.0.1",
"loader-utils": "^1.2.3",
"node-sass": "^4.13.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-spec-to-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/jbudz/spec-to-console#readme",
"devDependencies": {
"jest": "^25.5.4",
"jest": "^26.4.2",
"prettier": "^2.1.1"
},
"dependencies": {
Expand Down
6 changes: 2 additions & 4 deletions src/legacy/server/logging/rotate/log_rotator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import fs, { existsSync, mkdirSync, statSync, writeFileSync } from 'fs';
import { LogRotator } from './log_rotator';
import { tmpdir } from 'os';
import { dirname, join } from 'path';
import lodash from 'lodash';

const mockOn = jest.fn();
jest.mock('chokidar', () => ({
Expand All @@ -31,10 +32,7 @@ jest.mock('chokidar', () => ({
})),
}));

jest.mock('lodash', () => ({
...require.requireActual('lodash'),
throttle: (fn: any) => fn,
}));
lodash.throttle = (fn: any) => fn;

const tempDir = join(tmpdir(), 'kbn_log_rotator_test');
const testFilePath = join(tempDir, 'log_rotator_test_log_file.log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
jest.mock(
'lodash',
() => ({
...require.requireActual('lodash'),
...jest.requireActual('lodash'),
// mock debounce to fire immediately with no internal timer
debounce: (func) => {
function debounced(...args) {
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/data/public/search/errors/timeout_error.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ describe('SearchTimeoutError', () => {

expect(component.find('EuiButton').length).toBe(1);
component.find('EuiButton').simulate('click');
expect(startMock.application.navigateToApp).toHaveBeenCalledWith('management', {
path: '/kibana/indexPatterns',
});
expect(startMock.application.navigateToUrl).toHaveBeenCalledWith(
'https://www.elastic.co/subscriptions'
);
});

it('Should create contact admin message', () => {
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/data/public/search/errors/timeout_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ export class SearchTimeoutError extends KbnError {
private onClick(application: ApplicationStart) {
switch (this.mode) {
case TimeoutErrorMode.UPGRADE:
application.navigateToApp('management', {
path: `/kibana/indexPatterns`,
});
application.navigateToUrl('https://www.elastic.co/subscriptions');
break;
case TimeoutErrorMode.CHANGE:
application.navigateToApp('management', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class SuggestionsComponent extends Component<Props> {
const StyledSuggestionsListDiv = styled.div`
${(props: { queryBarRect: DOMRect; verticalListPosition: string }) => `
position: absolute;
z-index: 999;
z-index: 4001;
left: ${props.queryBarRect.left}px;
width: ${props.queryBarRect.width}px;
${props.verticalListPosition}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ function renderTooltip(description: string) {
);
}

const VISUALIZE_EMBEDDABLE_TYPE = 'visualization';
type VisualizeEmbeddable = any;
type EmbeddableWithDescription = IEmbeddable & { getDescription: () => string };

function getViewDescription(embeddable: IEmbeddable | VisualizeEmbeddable) {
if (embeddable.type === VISUALIZE_EMBEDDABLE_TYPE) {
const description = embeddable.getVisualizationDescription();
function getViewDescription(embeddable: IEmbeddable | EmbeddableWithDescription) {
if ('getDescription' in embeddable) {
const description = embeddable.getDescription();

if (description) {
return description;
Expand All @@ -137,7 +136,7 @@ export function PanelHeader({
}: PanelHeaderProps) {
const viewDescription = getViewDescription(embeddable);
const showTitle = !hidePanelTitle && (!isViewMode || title || viewDescription !== '');
const showPanelBar = badges.length > 0 || notifications.length > 0 || showTitle;
const showPanelBar = !isViewMode || badges.length > 0 || notifications.length > 0 || showTitle;
const classes = classNames('embPanel__header', {
// eslint-disable-next-line @typescript-eslint/naming-convention
'embPanel__header--floater': !showPanelBar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jest.mock('./components/time_field', () => ({ TimeField: 'TimeField' }));
jest.mock('./components/advanced_options', () => ({ AdvancedOptions: 'AdvancedOptions' }));
jest.mock('./components/action_buttons', () => ({ ActionButtons: 'ActionButtons' }));
jest.mock('./../../lib', () => ({
extractTimeFields: require.requireActual('./../../lib').extractTimeFields,
extractTimeFields: jest.requireActual('./../../lib').extractTimeFields,
ensureMinimumTime: async (fields: IFieldType) => Promise.resolve(fields),
}));

Expand Down
37 changes: 27 additions & 10 deletions src/plugins/kibana_react/public/field_button/field_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

import './field_button.scss';
import classNames from 'classnames';
import React, { ReactNode, HTMLAttributes } from 'react';
import React, { ReactNode, HTMLAttributes, ButtonHTMLAttributes } from 'react';
import { CommonProps } from '@elastic/eui';

export interface FieldButtonProps extends HTMLAttributes<HTMLDivElement> {
/**
Expand Down Expand Up @@ -56,7 +57,14 @@ export interface FieldButtonProps extends HTMLAttributes<HTMLDivElement> {
* The component will render a `<button>` when provided an `onClick`
*/
onClick?: () => void;
/**
* Applies to the inner `<button>` or `<div>`
*/
dataTestSubj?: string;
/**
* Pass more button props to the `<button>` element
*/
buttonProps?: ButtonHTMLAttributes<HTMLButtonElement> & CommonProps;
}

const sizeToClassNameMap = {
Expand All @@ -79,6 +87,8 @@ export function FieldButton({
isDraggable = false,
onClick,
dataTestSubj,
buttonProps,
...rest
}: FieldButtonProps) {
const classes = classNames(
'kbnFieldButton',
Expand All @@ -88,8 +98,18 @@ export function FieldButton({
className
);

const contentClasses = classNames('kbn-resetFocusState', 'kbnFieldButton__button');

const innerContent = (
<>
{fieldIcon && <span className="kbnFieldButton__fieldIcon">{fieldIcon}</span>}
{fieldName && <span className="kbnFieldButton__name">{fieldName}</span>}
{fieldInfoIcon && <div className="kbnFieldButton__infoIcon">{fieldInfoIcon}</div>}
</>
);

return (
<div className={classes}>
<div className={classes} {...rest}>
{onClick ? (
<button
onClick={(e) => {
Expand All @@ -99,17 +119,14 @@ export function FieldButton({
onClick();
}}
data-test-subj={dataTestSubj}
className={'kbn-resetFocusState kbnFieldButton__button'}
className={contentClasses}
{...buttonProps}
>
{fieldIcon && <span className="kbnFieldButton__fieldIcon">{fieldIcon}</span>}
{fieldName && <span className="kbnFieldButton__name">{fieldName}</span>}
{fieldInfoIcon && <div className="kbnFieldButton__infoIcon">{fieldInfoIcon}</div>}
{innerContent}
</button>
) : (
<div className={'kbn-resetFocusState kbnFieldButton__button'} data-test-subj={dataTestSubj}>
{fieldIcon && <span className="kbnFieldButton__fieldIcon">{fieldIcon}</span>}
{fieldName && <span className="kbnFieldButton__name">{fieldName}</span>}
{fieldInfoIcon && <div className="kbnFieldButton__infoIcon">{fieldInfoIcon}</div>}
<div className={contentClasses} data-test-subj={dataTestSubj}>
{innerContent}
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jest.mock('@elastic/eui', () => ({
let counter = 1;
return () => `12${counter++}`;
}),
EuiSpacer: require.requireActual('@elastic/eui').EuiSpacer,
EuiFlexItem: require.requireActual('@elastic/eui').EuiFlexItem,
EuiButtonEmpty: require.requireActual('@elastic/eui').EuiButtonEmpty,
EuiFormErrorText: require.requireActual('@elastic/eui').EuiFormErrorText,
EuiSpacer: jest.requireActual('@elastic/eui').EuiSpacer,
EuiFlexItem: jest.requireActual('@elastic/eui').EuiFlexItem,
EuiButtonEmpty: jest.requireActual('@elastic/eui').EuiButtonEmpty,
EuiFormErrorText: jest.requireActual('@elastic/eui').EuiFormErrorText,
}));

describe('NumberList', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import { SplitByTermsUI } from './terms';

jest.mock('@elastic/eui', () => ({
htmlIdGenerator: jest.fn(() => () => '42'),
EuiFlexGroup: require.requireActual('@elastic/eui').EuiFlexGroup,
EuiFlexItem: require.requireActual('@elastic/eui').EuiFlexItem,
EuiFormRow: require.requireActual('@elastic/eui').EuiFormRow,
EuiFieldNumber: require.requireActual('@elastic/eui').EuiFieldNumber,
EuiComboBox: require.requireActual('@elastic/eui').EuiComboBox,
EuiFieldText: require.requireActual('@elastic/eui').EuiFieldText,
EuiFlexGroup: jest.requireActual('@elastic/eui').EuiFlexGroup,
EuiFlexItem: jest.requireActual('@elastic/eui').EuiFlexItem,
EuiFormRow: jest.requireActual('@elastic/eui').EuiFormRow,
EuiFieldNumber: jest.requireActual('@elastic/eui').EuiFieldNumber,
EuiComboBox: jest.requireActual('@elastic/eui').EuiComboBox,
EuiFieldText: jest.requireActual('@elastic/eui').EuiFieldText,
}));

describe('src/legacy/core_plugins/metrics/public/components/splits/terms.test.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class VisualizeEmbeddable
typeof inspectorAdapters === 'function' ? inspectorAdapters() : inspectorAdapters;
}
}
public getVisualizationDescription() {
public getDescription() {
return this.vis.description;
}

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/dashboard_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.checkHideTitle();
await retry.try(async () => {
const titles = await PageObjects.dashboard.getPanelTitles();
expect(titles[0]).to.eql(undefined);
expect(titles[0]).to.eql('');
});
});

Expand Down
Loading

0 comments on commit 608c1c9

Please sign in to comment.