Skip to content

Commit

Permalink
Merge branch 'master' into logs-ui-add-event-original-message-fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Jun 15, 2021
2 parents 1683e13 + c151426 commit da12846
Show file tree
Hide file tree
Showing 109 changed files with 3,089 additions and 1,629 deletions.
13 changes: 10 additions & 3 deletions docs/user/dashboard/aggregation-reference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This reference can help simplify the comparison if you need a specific feature.

| Table with summary row
^| X
|
^| X
|
|
|
Expand Down Expand Up @@ -65,7 +65,7 @@ This reference can help simplify the comparison if you need a specific feature.

| Heat map
^| X
|
^| X
|
|
^| X
Expand Down Expand Up @@ -333,7 +333,7 @@ build their advanced visualization.

| Math on aggregated data
|
|
^| X
^| X
^| X
^| X
Expand All @@ -352,6 +352,13 @@ build their advanced visualization.
^| X
^| X

| Time shifts
|
^| X
^| X
^| X
^| X

| Fully custom {es} queries
|
|
Expand Down
5 changes: 4 additions & 1 deletion docs/user/dashboard/create-panels-with-editors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@
[[lens-editor]]
=== Lens

*Lens* is the drag and drop editor that creates visualizations of your data.
*Lens* is the drag and drop editor that creates visualizations of your data, recommended for most
users.

With *Lens*, you can:

* Use the automatically generated suggestions to change the visualization type.
* Create visualizations with multiple layers and indices.
* Change the aggregation and labels to customize the data.
* Perform math on aggregations using *Formula*.
* Use time shifts to compare data at two times, such as month over month.

[role="screenshot"]
image:dashboard/images/lens_advanced_1_1.png[Lens]
Expand Down
4 changes: 3 additions & 1 deletion docs/user/dashboard/lens.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ image::images/lens_missing_values_strategy.png[Lens Missing values strategies me
[[is-it-possible-to-change-the-scale-of-Y-axis]]
===== Is it possible to statically define the scale of the y-axis in a visualization?

The ability to start the y-axis from another value than 0, or use a logarithmic scale, is unsupported in *Lens*.
Yes, you can set the bounds on bar, line and area chart types in Lens, unless using percentage mode. Bar
and area charts must have 0 in the bounds. Logarithmic scales are unsupported in *Lens*.
To set the y-axis bounds, click the icon representing the axis you want to customize.

[float]
[[is-it-possible-to-have-pagination-for-datatable]]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@
"callsites": "^3.1.0",
"chai": "3.5.0",
"chance": "1.0.18",
"chromedriver": "^90.0.0",
"chromedriver": "^91.0.1",
"clean-webpack-plugin": "^3.0.0",
"cmd-shim": "^2.1.0",
"compression-webpack-plugin": "^4.0.0",
Expand Down Expand Up @@ -838,4 +838,4 @@
"yargs": "^15.4.1",
"zlib": "^1.0.5"
}
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,37 @@ import { Root } from '../../../root';

const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.version;

const logFilePath = Path.join(__dirname, 'migration_test_kibana.log');
const logFilePath = Path.join(__dirname, 'migration_test_kibana_from_v1.log');

const asyncUnlink = Util.promisify(Fs.unlink);
async function removeLogFile() {
// ignore errors if it doesn't exist
await asyncUnlink(logFilePath).catch(() => void 0);
}
const assertMigratedDocuments = (arr: any[], target: any[]) => target.every((v) => arr.includes(v));

function sortByTypeAndId(a: { type: string; id: string }, b: { type: string; id: string }) {
return a.type.localeCompare(b.type) || a.id.localeCompare(b.id);
}

async function fetchDocuments(esClient: ElasticsearchClient, index: string) {
const { body } = await esClient.search<any>({
index,
body: {
query: {
match_all: {},
},
_source: ['type', 'id'],
},
});

return body.hits.hits
.map((h) => ({
...h._source,
id: h._id,
}))
.sort(sortByTypeAndId);
}

describe('migration v2', () => {
let esServer: kbnTestServer.TestElasticsearchUtils;
Expand All @@ -40,7 +64,7 @@ describe('migration v2', () => {
adjustTimeout: (t: number) => jest.setTimeout(t),
settings: {
es: {
license: 'trial',
license: 'basic',
dataArchive,
},
},
Expand All @@ -51,8 +75,8 @@ describe('migration v2', () => {
migrations: {
skip: false,
enableV2: true,
// There are 53 docs in fixtures. Batch size configured to enforce 3 migration steps.
batchSize: 20,
// There are 40 docs in fixtures. Batch size configured to enforce 3 migration steps.
batchSize: 15,
},
logging: {
appenders: {
Expand Down Expand Up @@ -85,8 +109,7 @@ describe('migration v2', () => {
coreStart = start;
esClient = coreStart.elasticsearch.client.asInternalUser;
});

await Promise.all([startEsPromise, startKibanaPromise]);
return await Promise.all([startEsPromise, startKibanaPromise]);
};

const getExpectedVersionPerType = () =>
Expand Down Expand Up @@ -192,15 +215,19 @@ describe('migration v2', () => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/91107
describe.skip('migrating from the same Kibana version', () => {
describe('migrating from the same Kibana version that used v1 migrations', () => {
const originalIndex = `.kibana_1`; // v1 migrations index
const migratedIndex = `.kibana_${kibanaVersion}_001`;

beforeAll(async () => {
await removeLogFile();
await startServers({
oss: true,
dataArchive: Path.join(__dirname, 'archives', '8.0.0_oss_sample_saved_objects.zip'),
oss: false,
dataArchive: Path.join(
__dirname,
'archives',
'8.0.0_v1_migrations_sample_data_saved_objects.zip'
),
});
});

Expand All @@ -215,7 +242,6 @@ describe('migration v2', () => {
},
{ ignore: [404] }
);

const response = body[migratedIndex];

expect(response).toBeDefined();
Expand All @@ -225,17 +251,23 @@ describe('migration v2', () => {
]);
});

it('copies all the document of the previous index to the new one', async () => {
it('copies the documents from the previous index to the new one', async () => {
// original assertion on document count comparison (how atteched are we to this assertion?)
const migratedIndexResponse = await esClient.count({
index: migratedIndex,
});
const oldIndexResponse = await esClient.count({
index: '.kibana_1',
index: originalIndex,
});

// Use a >= comparison since once Kibana has started it might create new
// documents like telemetry tasks
expect(migratedIndexResponse.body.count).toBeGreaterThanOrEqual(oldIndexResponse.body.count);

// new assertion against a document array comparison
const originalDocs = await fetchDocuments(esClient, originalIndex);
const migratedDocs = await fetchDocuments(esClient, migratedIndex);
expect(assertMigratedDocuments(migratedDocs, originalDocs));
});

it('migrates the documents to the highest version', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import React, { createContext, useContext } from 'react';

import { useRequest } from '../../../public';

import { Error as CustomError } from './section_error';

import { Privileges } from '../types';
import { Privileges, Error as CustomError } from '../types';

interface Authorization {
isLoading: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ export { WithPrivileges } from './with_privileges';

export { NotAuthorizedSection } from './not_authorized_section';

export { Error, SectionError } from './section_error';
export { SectionError } from './section_error';

export { PageError } from './page_error';
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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 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.
*/

import { EuiSpacer, EuiEmptyPrompt, EuiPageContent } from '@elastic/eui';
import React from 'react';
import { APP_WRAPPER_CLASS } from '../../../../../../src/core/public';
import { Error } from '../types';

interface Props {
title: React.ReactNode;
error: Error;
actions?: JSX.Element;
isCentered?: boolean;
}

/*
* A reusable component to handle full page errors.
* This is based on Kibana design guidelines related
* to the new management navigation structure.
* In some scenarios, it replaces the usage of <SectionError />.
*/

export const PageError: React.FunctionComponent<Props> = ({
title,
error,
actions,
isCentered,
...rest
}) => {
const {
error: errorString,
cause, // wrapEsError() on the server adds a "cause" array
message,
} = error;

const errorContent = (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="danger">
<EuiEmptyPrompt
title={<h2>{title}</h2>}
body={
<>
{cause ? message || errorString : <p>{message || errorString}</p>}
{cause && (
<>
<EuiSpacer size="s" />
<ul>
{cause.map((causeMsg, i) => (
<li key={i}>{causeMsg}</li>
))}
</ul>
</>
)}
</>
}
iconType="alert"
actions={actions}
{...rest}
/>
</EuiPageContent>
);

if (isCentered) {
return <div className={APP_WRAPPER_CLASS}>{errorContent}</div>;
}

return errorContent;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@

import { EuiCallOut, EuiSpacer } from '@elastic/eui';
import React, { Fragment } from 'react';

export interface Error {
error: string;
cause?: string[];
message?: string;
}
import { Error } from '../types';

interface Props {
title: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export {
AuthorizationProvider,
AuthorizationContext,
SectionError,
Error,
PageError,
useAuthorizationContext,
} from './components';

export { Privileges, MissingPrivileges } from './types';
export { Privileges, MissingPrivileges, Error } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ export interface Privileges {
hasAllPrivileges: boolean;
missingPrivileges: MissingPrivileges;
}

export interface Error {
error: string;
cause?: string[];
message?: string;
}
1 change: 1 addition & 0 deletions src/plugins/es_ui_shared/public/authorization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export {
NotAuthorizedSection,
Privileges,
SectionError,
PageError,
useAuthorizationContext,
WithPrivileges,
} from '../../__packages_do_not_import__/authorization';
1 change: 1 addition & 0 deletions src/plugins/es_ui_shared/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export {
Privileges,
MissingPrivileges,
SectionError,
PageError,
Error,
useAuthorizationContext,
} from './authorization';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DEFAULT_OPTIONS = {
stripEmptyFields: true,
};

interface UseFormReturn<T extends FormData, I extends FormData> {
export interface UseFormReturn<T extends FormData, I extends FormData> {
form: FormHook<T, I>;
}

Expand Down
26 changes: 26 additions & 0 deletions src/plugins/presentation_util/public/mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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 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.
*/

import { CoreStart } from 'kibana/public';
import { PresentationUtilPluginStart } from './types';
import { pluginServices } from './services';
import { registry } from './services/kibana';

const createStartContract = (coreStart: CoreStart): PresentationUtilPluginStart => {
pluginServices.setRegistry(registry.start({ coreStart, startPlugins: {} as any }));

const startContract: PresentationUtilPluginStart = {
ContextProvider: pluginServices.getContextProvider(),
labsService: pluginServices.getServices().labs,
};
return startContract;
};

export const presentationUtilPluginMock = {
createStartContract,
};
Loading

0 comments on commit da12846

Please sign in to comment.