Skip to content

Commit

Permalink
Merge branch 'main' into eui/60.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jul 11, 2022
2 parents 4522f83 + 000f39b commit 9e3bd84
Show file tree
Hide file tree
Showing 96 changed files with 951 additions and 1,217 deletions.
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"@elastic/apm-rum": "^5.12.0",
"@elastic/apm-rum-react": "^1.4.2",
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/charts": "46.11.2",
"@elastic/charts": "46.12.0",
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.3.0-canary.1",
"@elastic/ems-client": "8.3.3",
Expand Down Expand Up @@ -959,7 +959,6 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^8.8.0",
"callsites": "^3.1.0",
"chai": "3.5.0",
"chance": "1.0.18",
"chokidar": "^3.4.3",
"chromedriver": "^103.0.0",
Expand Down Expand Up @@ -1069,7 +1068,7 @@
"mutation-observer": "^1.0.3",
"ncp": "^2.0.0",
"nock": "12.0.3",
"node-sass": "6.0.1",
"node-sass": "7.0.1",
"null-loader": "^3.0.0",
"nyc": "^15.1.0",
"oboe": "^2.1.4",
Expand All @@ -1091,14 +1090,12 @@
"regenerate": "^1.4.0",
"resolve": "^1.22.0",
"rxjs-marbles": "^5.0.6",
"sass-loader": "^10.2.0",
"sass-loader": "^10.3.1",
"selenium-webdriver": "^4.3.0",
"shelljs": "^0.8.4",
"simple-git": "1.116.0",
"sinon": "^7.4.2",
"sort-package-json": "^1.53.1",
"source-map": "^0.7.3",
"spawn-sync": "^1.0.15",
"string-replace-loader": "^2.2.0",
"strong-log-transformer": "^2.1.0",
"style-loader": "^1.1.3",
Expand Down
16 changes: 0 additions & 16 deletions packages/kbn-pm/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,6 @@ module.exports = {
],
exclude: /node_modules/,
},
// Removing an unnecessary require from
// https://github.com/ForbesLindesay/spawn-sync/blob/8ba6d1bd032917ff5f0cf68508b91bb628d16336/index.js#L3
//
// This require would cause warnings when building with Webpack, and it's
// only required for Node <= 0.12.
{
test: /spawn-sync\/index\.js$/,
use: {
loader: 'string-replace-loader',
options: {
search: ` || require('./lib/spawn-sync')`,
replace: '',
strict: true,
},
},
},
// In order to make it work with Node 10 we had the need to upgrade
// the package cpy to a version >= 7.0.0. In this version cpy is
// using the new globby that relies in the fast-glob which relies
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-test/jest_integration_node/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ module.exports = {
testEnvironment: 'node',
snapshotSerializers: [],
setupFiles: ['<rootDir>/node_modules/@kbn/test/target_node/jest/setup/babel_polyfill.js'],
haste: {
...preset.haste,
throwOnModuleCollision: true,
},
};
4 changes: 4 additions & 0 deletions packages/kbn-test/jest_node/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ module.exports = {
testEnvironment: 'node',
snapshotSerializers: [],
setupFiles: ['<rootDir>/node_modules/@kbn/test/target_node/jest/setup/babel_polyfill.js'],
haste: {
...preset.haste,
throwOnModuleCollision: true,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { resolve } from 'path';
import execa from 'execa';
import shell from 'shelljs';
import del from 'del';

const ROOT_DIR = resolve(__dirname, '../../../../..');
const MOCKS_DIR = resolve(__dirname, './mocks');
Expand All @@ -31,7 +31,7 @@ describe('Team Assignment', () => {
});

afterAll(() => {
shell.rm(teamAssignmentsPath);
del.sync(teamAssignmentsPath);
});

describe(`when the codeowners file contains #CC#`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,24 +313,21 @@ describe('MetricVisComponent', function () {
.find(Metric)
.props().data![0][0]!;

expect(getConfig(undefined)).not.toHaveProperty('domain');
expect(getConfig(undefined)).not.toHaveProperty('domainMax');
expect(getConfig(undefined)).not.toHaveProperty('progressBarDirection');

expect(getConfig('foobar')).not.toHaveProperty('domain');
expect(getConfig('foobar')).not.toHaveProperty('domainMax');
expect(getConfig('foobar')).not.toHaveProperty('progressBarDirection');

const configWithProgress = getConfig(basePriceColumnId) as MetricWProgress;

expect(configWithProgress.domain).toEqual({ min: 0, max: table.rows[0][basePriceColumnId] });
expect(configWithProgress.domainMax).toEqual(table.rows[0][basePriceColumnId]);
expect(configWithProgress.progressBarDirection).toBe('vertical');

expect(configWithProgress).toMatchInlineSnapshot(`
Object {
"color": "#343741",
"domain": Object {
"max": 28.984375,
"min": 0,
},
"domainMax": 28.984375,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": undefined,
Expand Down Expand Up @@ -661,10 +658,7 @@ describe('MetricVisComponent', function () {
Array [
Object {
"color": "#343741",
"domain": Object {
"max": 28.984375,
"min": 0,
},
"domainMax": 28.984375,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": "Median products.base_price",
Expand All @@ -674,10 +668,7 @@ describe('MetricVisComponent', function () {
},
Object {
"color": "#343741",
"domain": Object {
"max": 28.984375,
"min": 0,
},
"domainMax": 28.984375,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": "Median products.base_price",
Expand All @@ -687,10 +678,7 @@ describe('MetricVisComponent', function () {
},
Object {
"color": "#343741",
"domain": Object {
"max": 25.984375,
"min": 0,
},
"domainMax": 25.984375,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": "Median products.base_price",
Expand All @@ -700,10 +688,7 @@ describe('MetricVisComponent', function () {
},
Object {
"color": "#343741",
"domain": Object {
"max": 25.784375,
"min": 0,
},
"domainMax": 25.784375,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": "Median products.base_price",
Expand All @@ -713,10 +698,7 @@ describe('MetricVisComponent', function () {
},
Object {
"color": "#343741",
"domain": Object {
"max": 25.348011363636363,
"min": 0,
},
"domainMax": 25.348011363636363,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": "Median products.base_price",
Expand All @@ -728,10 +710,7 @@ describe('MetricVisComponent', function () {
Array [
Object {
"color": "#343741",
"domain": Object {
"max": 24.984375,
"min": 0,
},
"domainMax": 24.984375,
"extra": <span />,
"progressBarDirection": "vertical",
"subtitle": "Median products.base_price",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import React, { useCallback } from 'react';

import numeral from '@elastic/numeral';
import { i18n } from '@kbn/i18n';
import { Chart, Metric, MetricSpec, RenderChangeListener, Settings } from '@elastic/charts';
import {
Chart,
Metric,
MetricSpec,
RenderChangeListener,
Settings,
MetricWProgress,
} from '@elastic/charts';
import { getColumnByAccessor, getFormatByAccessor } from '@kbn/visualizations-plugin/common/utils';
import { ExpressionValueVisDimension } from '@kbn/visualizations-plugin/common';
import {
Expand Down Expand Up @@ -162,16 +169,13 @@ const MetricVisComponent = ({ data, config, renderComplete }: MetricVisComponent
? getColumnByAccessor(config.dimensions.breakdownBy, data.columns)
: undefined;

let getProgressBarConfig = (_row: DatatableRow) => ({});
let getProgressBarConfig = (_row: DatatableRow): Partial<MetricWProgress> => ({});

if (config.dimensions.progressMax) {
const maxColId = getColumnByAccessor(config.dimensions.progressMax, data.columns)?.id;
if (maxColId) {
getProgressBarConfig = (_row: DatatableRow) => ({
domain: {
min: 0,
max: _row[maxColId],
},
getProgressBarConfig = (_row: DatatableRow): Partial<MetricWProgress> => ({
domainMax: _row[maxColId],
progressBarDirection: config.metric.progressDirection,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import fn from './average';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import _ from 'lodash';

describe('average.js', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import fn from './carry';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import _ from 'lodash';

describe('carry.js', function () {
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('carry.js', function () {
fn(data, target);
expect.fail('Success. Doh.');
} catch (e) {
expect(e).to.be.an('error');
expect(e).to.be.an(Error);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const parseSheet = require('./parse_sheet');

const expect = require('chai').expect;
import expect from '@kbn/expect';

describe('timelion parse_sheet function', function () {
it(`doesn't split expressions on whitespace`, async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const fn = require('./load_functions');

const expect = require('chai').expect;
import expect from '@kbn/expect';

describe('load_functions.js', () => {
it('exports a function', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './abs';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
const seriesList = require('./fixtures/series_list')();
import invoke from './helpers/invoke_series_fn';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from '.';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from '../helpers/invoke_series_fn';

describe('aggregate', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './bars';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('bars.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './color';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('color.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import fn from './condition';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
import getSeriesList from './helpers/get_single_series_list';
import _ from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './cusum';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('cusum.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './derivative';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('derivative.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './divide';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('divide.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import fn from './first';

const expect = require('chai').expect;
import expect from '@kbn/expect';
const seriesList = require('./fixtures/series_list')();
import invoke from './helpers/invoke_series_fn';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const fn = require('./fit');
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
import getSeriesList from './helpers/get_single_series_list';
import _ from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './hide';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('hide.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fn from './label';

import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('label.js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import fn from './legend';

const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';

describe('legend.js', () => {
Expand Down
Loading

0 comments on commit 9e3bd84

Please sign in to comment.