Skip to content

Commit

Permalink
Merge branch 'master' into uptime_port-func-tests-to-7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jan 31, 2019
2 parents 90752cb + f46a8d6 commit 41e0529
Show file tree
Hide file tree
Showing 533 changed files with 9,950 additions and 3,434 deletions.
2 changes: 2 additions & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"common.ui": "src/ui",
"server": "src/server",
"console": "src/legacy/core_plugins/console",
"core": "src/core",
"inputControl": "src/legacy/core_plugins/input_control_vis",
"inspectorViews": "src/legacy/core_plugins/inspector_views",
"interpreter": "src/legacy/core_plugins/interpreter",
Expand Down Expand Up @@ -45,6 +46,7 @@
"xpack.watcher": "x-pack/plugins/watcher"
},
"exclude": [
"src/core/public/fatal_errors/get_error_info.ts",
"src/ui/ui_render/bootstrap/app_bootstrap.js",
"src/ui/ui_render/ui_render_mixin.js",
"x-pack/plugins/infra/public/graphql/types.ts",
Expand Down
3 changes: 3 additions & 0 deletions docs/api/saved-objects/bulk_create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ contains the following properties:
`attributes` (required)::
(object) The data to persist

`references` (optional)::
(array) An array of objects with `name`, `id`, and `type` properties that describe the other saved objects this object references. The `name` can be used in the attributes to refer to the other saved object, but never the `id`, which may be updated automatically in the future during migrations or import/export.

`version` (optional)::
(number) Enables specifying a version

Expand Down
2 changes: 2 additions & 0 deletions docs/api/saved-objects/create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Note: You cannot access this endpoint via the Console in Kibana.
`attributes` (required)::
(object) The data to persist

`references` (optional)::
(array) An array of objects with `name`, `id`, and `type` properties that describe the other saved objects this object references. The `name` can be used in the attributes to refer to the other saved object, but never the `id`, which may be updated automatically in the future during migrations or import/export.

==== Examples

Expand Down
2 changes: 2 additions & 0 deletions docs/api/saved-objects/find.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Note: You cannot access this endpoint via the Console in Kibana.
(array|string) The fields to return in the response
`sort_field` (optional)::
(string) The field on which the response will be sorted
`has_reference` (optional)::
(object) Filters to objects having a relationship with the type and id combination

[NOTE]
==============================================
Expand Down
2 changes: 2 additions & 0 deletions docs/api/saved-objects/update.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Note: You cannot access this endpoint via the Console in Kibana.
`attributes` (required)::
(object) The data to persist

`references` (optional)::
(array) An array of objects with `name`, `id`, and `type` properties that describe the other saved objects this object references. The `name` can be used in the attributes to refer to the other saved object, but never the `id`, which may be updated automatically in the future during migrations or import/export.

==== Examples

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"dependencies": {
"@elastic/datemath": "5.0.2",
"@elastic/eui": "6.7.2",
"@elastic/eui": "6.7.4",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.3.2",
Expand Down Expand Up @@ -411,4 +411,4 @@
"node": "10.14.1",
"yarn": "^1.10.1"
}
}
}
43 changes: 34 additions & 9 deletions packages/kbn-es/src/install/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
const execa = require('execa');
const path = require('path');
const fs = require('fs');
const os = require('os');
const readline = require('readline');
const chalk = require('chalk');
const crypto = require('crypto');
const simpleGit = require('simple-git/promise');
const { installArchive } = require('./archive');
const { createCliError } = require('../errors');
const { findMostRecentlyChanged, log: defaultLog, cache } = require('../utils');
const { GRADLE_BIN, ES_ARCHIVE_PATTERN, ES_OSS_ARCHIVE_PATTERN, BASE_PATH } = require('../paths');
const { GRADLE_BIN, BASE_PATH } = require('../paths');

const onceEvent = (emitter, event) => new Promise(resolve => emitter.once(event, resolve));

Expand Down Expand Up @@ -89,6 +90,7 @@ async function sourceInfo(cwd, license, log = defaultLog) {

const git = simpleGit(cwd);

const { task, ext } = archiveForPlatform(os.platform(), license);
const status = await git.status();
const branch = status.current;
const sha = (await git.revparse(['HEAD'])).trim();
Expand All @@ -110,8 +112,8 @@ async function sourceInfo(cwd, license, log = defaultLog) {
.digest('hex')
.substr(0, 8);

const basename = `${branch}${license === 'oss' ? '-oss-' : '-'}${cwdHash}`;
const filename = `${basename}.tar.gz`;
const basename = `${branch}-${task}-${cwdHash}`;
const filename = `${basename}.${ext}`;

return {
etag: etag.digest('hex'),
Expand All @@ -129,10 +131,18 @@ async function sourceInfo(cwd, license, log = defaultLog) {
* @property {String} options.sourcePath
* @property {ToolingLog} options.log
* @returns {Object} containing archive and optional plugins
*
* Gradle tasks:
* :distribution:archives:darwin-tar:assemble
* :distribution:archives:linux-tar:assemble
* :distribution:archives:windows-zip:assemble
* :distribution:archives:oss-darwin-tar:assemble
* :distribution:archives:oss-linux-tar:assemble
* :distribution:archives:oss-windows-zip:assemble
*/
async function createSnapshot({ license, sourcePath, log = defaultLog }) {
const tarTask = license === 'oss' ? 'oss-tar' : 'tar';
const buildArgs = [`:distribution:archives:${tarTask}:assemble`];
const { task, ext } = archiveForPlatform(os.platform(), license);
const buildArgs = [`:distribution:archives:${task}:assemble`];

log.info('%s %s', GRADLE_BIN, buildArgs.join(' '));

Expand All @@ -157,12 +167,27 @@ async function createSnapshot({ license, sourcePath, log = defaultLog }) {
throw createCliError('unable to build ES');
}

const archivePattern = license === 'oss' ? ES_OSS_ARCHIVE_PATTERN : ES_ARCHIVE_PATTERN;
const esTarballPath = findMostRecentlyChanged(path.resolve(sourcePath, archivePattern));
const archivePattern = `distribution/archives/${task}/build/distributions/elasticsearch-*.${ext}`;
const esArchivePath = findMostRecentlyChanged(path.resolve(sourcePath, archivePattern));

if (!esTarballPath) {
if (!esArchivePath) {
throw createCliError('could not locate ES distribution');
}

return esTarballPath;
return esArchivePath;
}

function archiveForPlatform(platform, license) {
const taskPrefix = license === 'oss' ? 'oss-' : '';

switch (platform) {
case 'darwin':
return { format: 'tar', ext: 'tar.gz', task: `${taskPrefix}darwin-tar`, platform: 'darwin' };
case 'win32':
return { format: 'zip', ext: 'zip', task: `${taskPrefix}windows-zip`, platform: 'windows' };
case 'linux':
return { format: 'tar', ext: 'tar.gz', task: `${taskPrefix}linux-tar`, platform: 'linux' };
default:
throw new Error(`unknown platform: ${platform}`);
}
}
5 changes: 0 additions & 5 deletions packages/kbn-es/src/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,3 @@ exports.ES_BIN = useBat('bin/elasticsearch');
exports.ES_CONFIG = 'config/elasticsearch.yml';

exports.ES_KEYSTORE_BIN = useBat('./bin/elasticsearch-keystore');

exports.ES_ARCHIVE_PATTERN =
'distribution/archives/tar/build/distributions/elasticsearch-*-SNAPSHOT.tar.gz';
exports.ES_OSS_ARCHIVE_PATTERN =
'distribution/archives/oss-tar/build/distributions/elasticsearch-*-SNAPSHOT.tar.gz';
18 changes: 9 additions & 9 deletions packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
"kbn:watch": "node scripts/build --watch --source-maps"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@kbn/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
"@types/react-intl": "^2.3.11",
"@types/react-intl": "^2.3.15",
"del": "^3.0.0",
"getopts": "^2.2.3",
"supports-color": "^5.5.0",
"supports-color": "^6.1.0",
"typescript": "^3.0.3"
},
"dependencies": {
"intl-format-cache": "^2.1.0",
"intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.1.0",
"prop-types": "^15.6.2",
"react": "^16.3.0",
"react-intl": "^2.7.0"
"react": "^16.6.0",
"react-intl": "^2.8.0"
}
}
2 changes: 1 addition & 1 deletion packages/kbn-interpreter/src/public/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function createSocket(basePath, functionsRegistry) {
return new Promise((resolve, reject) => {
const socket = io({
path: `${basePath}/socket.io`,
transports: ['polling', 'websocket'],
transports: ['polling'],
transportOptions: {
polling: {
extraHeaders: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ exports[`rendering render matches snapshot 1`] = `
onClick={[Function]}
type="button"
>
Clear your session
<FormattedMessage
defaultMessage="Clear your session"
id="core.fatalErrors.clearYourSessionButtonLabel"
values={Object {}}
/>
</EuiButton>,
<EuiButtonEmpty
color="primary"
Expand All @@ -37,20 +41,33 @@ exports[`rendering render matches snapshot 1`] = `
onClick={[Function]}
type="button"
>
Go back
<FormattedMessage
defaultMessage="Go back"
id="core.fatalErrors.goBackButtonLabel"
values={Object {}}
/>
</EuiButtonEmpty>,
]
}
body={
<p>
Try refreshing the page. If that doesn't work, go back to the previous page or clear your session data.
<FormattedMessage
defaultMessage="Try refreshing the page. If that doesn't work, go back to the previous page or
clear your session data."
id="core.fatalErrors.tryRefreshingPageDescription"
values={Object {}}
/>
</p>
}
iconColor="danger"
iconType="alert"
title={
<h2>
Something went wrong
<FormattedMessage
defaultMessage="Something went wrong"
id="core.fatalErrors.somethingWentWrongTitle"
values={Object {}}
/>
</h2>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
exports[`#add() deletes all children of rootDomElement and renders <FatalErrorScreen /> into it: fatal error screen component 1`] = `
Array [
Array [
<FatalErrorsScreen
buildNumber="kibanaBuildNumber"
errorInfo$={Rx.Observable}
kibanaVersion="kibanaVersion"
/>,
<I18nProvider>
<FatalErrorsScreen
buildNumber="kibanaBuildNumber"
errorInfo$={Rx.Observable}
kibanaVersion="kibanaVersion"
/>
</I18nProvider>,
<div />,
],
]
Expand Down
12 changes: 6 additions & 6 deletions src/core/public/fatal_errors/fatal_errors_screen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import { EuiCallOut } from '@elastic/eui';
import testSubjSelector from '@kbn/test-subj-selector';
import { mount, shallow } from 'enzyme';
import React from 'react';
import * as Rx from 'rxjs';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';

import { FatalErrorsScreen } from './fatal_errors_screen';

Expand Down Expand Up @@ -54,7 +54,7 @@ describe('reloading', () => {

const locationReloadSpy = jest.spyOn(window.location, 'reload').mockImplementation(noop);

shallow(<FatalErrorsScreen {...defaultProps} />);
shallowWithIntl(<FatalErrorsScreen {...defaultProps} />);
expect(addEventListenerSpy).toHaveBeenCalledTimes(1);
expect(addEventListenerSpy).toHaveBeenCalledWith('hashchange', expect.any(Function), undefined);

Expand All @@ -67,13 +67,13 @@ describe('reloading', () => {

describe('rendering', () => {
it('render matches snapshot', () => {
expect(shallow(<FatalErrorsScreen {...defaultProps} />)).toMatchSnapshot();
expect(shallowWithIntl(<FatalErrorsScreen {...defaultProps} />)).toMatchSnapshot();
});

it('rerenders when errorInfo$ emits more errors', () => {
const errorInfo$ = new Rx.ReplaySubject<typeof errorInfoFoo>();

const el = shallow(<FatalErrorsScreen {...defaultProps} errorInfo$={errorInfo$} />);
const el = shallowWithIntl(<FatalErrorsScreen {...defaultProps} errorInfo$={errorInfo$} />);

expect(el.find(EuiCallOut)).toHaveLength(0);

Expand Down Expand Up @@ -111,7 +111,7 @@ describe('buttons', () => {
window.location.hash = '/foo/bar';
jest.spyOn(window.location, 'reload').mockImplementation(noop);

const el = mount(<FatalErrorsScreen {...defaultProps} />);
const el = mountWithIntl(<FatalErrorsScreen {...defaultProps} />);
const button = el.find('button').find(testSubjSelector('clearSession'));
button.simulate('click');

Expand All @@ -126,7 +126,7 @@ describe('buttons', () => {
it('calls window.history.back()', () => {
jest.spyOn(window.history, 'back').mockImplementation(noop);

const el = mount(<FatalErrorsScreen {...defaultProps} />);
const el = mountWithIntl(<FatalErrorsScreen {...defaultProps} />);
const button = el.find('button').find(testSubjSelector('goBack'));
button.simulate('click');

Expand Down
28 changes: 23 additions & 5 deletions src/core/public/fatal_errors/fatal_errors_screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import React from 'react';
import * as Rx from 'rxjs';
import { tap } from 'rxjs/operators';

import { FormattedMessage } from '@kbn/i18n/react';

import { ErrorInfo } from './get_error_info';

interface Props {
Expand Down Expand Up @@ -91,11 +93,21 @@ export class FatalErrorsScreen extends React.Component<Props, State> {
<EuiEmptyPrompt
iconType="alert"
iconColor="danger"
title={<h2>Something went wrong</h2>}
title={
<h2>
<FormattedMessage
id="core.fatalErrors.somethingWentWrongTitle"
defaultMessage="Something went wrong"
/>
</h2>
}
body={
<p>
Try refreshing the page. If that doesn't work, go back to the previous page or
clear your session data.
<FormattedMessage
id="core.fatalErrors.tryRefreshingPageDescription"
defaultMessage="Try refreshing the page. If that doesn't work, go back to the previous page or
clear your session data."
/>
</p>
}
actions={[
Expand All @@ -105,10 +117,16 @@ export class FatalErrorsScreen extends React.Component<Props, State> {
onClick={this.onClickClearSession}
data-test-subj="clearSession"
>
Clear your session
<FormattedMessage
id="core.fatalErrors.clearYourSessionButtonLabel"
defaultMessage="Clear your session"
/>
</EuiButton>,
<EuiButtonEmpty onClick={this.onClickGoBack} data-test-subj="goBack">
Go back
<FormattedMessage
id="core.fatalErrors.goBackButtonLabel"
defaultMessage="Go back"
/>
</EuiButtonEmpty>,
]}
/>
Expand Down
Loading

0 comments on commit 41e0529

Please sign in to comment.