Skip to content

Commit

Permalink
Merge branch 'master' into reporting/csv_deprecations_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Jul 6, 2021
2 parents 41b4aea + cf9e88c commit 68133c3
Show file tree
Hide file tree
Showing 268 changed files with 16,596 additions and 2,135 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-core
/src/plugins/security_oss/ @elastic/kibana-security
/src/plugins/spaces_oss/ @elastic/kibana-security
/src/plugins/user_setup/ @elastic/kibana-security
/test/security_functional/ @elastic/kibana-security
/x-pack/plugins/spaces/ @elastic/kibana-security
/x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ In general this plugin provides:
|The Usage Collection Service defines a set of APIs for other plugins to report the usage of their features. At the same time, it provides necessary the APIs for other services (i.e.: telemetry, monitoring, ...) to consume that usage data.
|{kib-repo}blob/{branch}/src/plugins/user_setup/README.md[userSetup]
|The plugin provides UI and APIs for the interactive setup mode.
|{kib-repo}blob/{branch}/src/plugins/vis_default_editor/README.md[visDefaultEditor]
|The default editor is used in most primary visualizations, e.x. Area, Data table, Pie, etc.
It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in public/components/sidebar/data_tab.tsx.
Expand Down
3 changes: 3 additions & 0 deletions docs/getting-started/quick-start-guide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ If you are you ready to add your own data, refer to <<connect-to-elasticsearch,A
If you want to ingest your data, refer to {fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].

If you want to secure access to your data, refer to our guide on <<tutorial-secure-access-to-kibana, securing {kib}>>

If you want to try out {ml-features} with the sample data sets, refer to
{ml-docs}/ml-getting-started.html[Getting started with {ml}].
2 changes: 1 addition & 1 deletion docs/user/ml/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ browser so that it does not block pop-up windows or create an exception for your

For more information about the {anomaly-detect} feature, see
https://www.elastic.co/what-is/elastic-stack-machine-learning[{ml-cap} in the {stack}]
and {ml-docs}/xpack-ml.html[{ml-cap} {anomaly-detect}].
and {ml-docs}/ml-ad-overview.html[{ml-cap} {anomaly-detect}].

[[xpack-ml-dfanalytics]]
== {dfanalytics-cap}
Expand Down
4 changes: 4 additions & 0 deletions docs/user/security/authentication/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ image::user/security/images/kibana-login.png["Login Selector UI"]

For more information, refer to <<authentication-security-settings, authentication security settings>>.

TIP: If you have multiple authentication providers configured, you can use the `auth_provider_hint` URL query parameter to create a deep
link to any provider and bypass the Login Selector UI. Using the `kibana.yml` above as an example, you can add `?auth_provider_hint=basic1`
to the login page URL, which will take you directly to the basic login page.

[[basic-authentication]]
==== Basic authentication

Expand Down
21 changes: 20 additions & 1 deletion examples/locator_explorer/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EuiFieldText } from '@elastic/eui';
import { EuiPageHeader } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
import { AppMountParameters } from '../../../src/core/public';
import { SharePluginSetup } from '../../../src/plugins/share/public';
import { formatSearchParams, SharePluginSetup } from '../../../src/plugins/share/public';
import {
HelloLocatorV1Params,
HelloLocatorV2Params,
Expand All @@ -34,6 +34,7 @@ interface MigratedLink {
linkText: string;
link: string;
version: string;
params: HelloLocatorV1Params | HelloLocatorV2Params;
}

const ActionsExplorer = ({ share }: Props) => {
Expand Down Expand Up @@ -93,6 +94,7 @@ const ActionsExplorer = ({ share }: Props) => {
linkText: savedLink.linkText,
link,
version: savedLink.version,
params: savedLink.params,
} as MigratedLink;
})
);
Expand Down Expand Up @@ -157,7 +159,24 @@ const ActionsExplorer = ({ share }: Props) => {
target="_blank"
>
{link.linkText}
</EuiLink>{' '}
(
<EuiLink
color={link.version !== '0.0.2' ? 'danger' : 'primary'}
data-test-subj="linkToHelloPage"
href={
'/app/r?' +
formatSearchParams({
id: 'HELLO_LOCATOR',
version: link.version,
params: link.params,
}).toString()
}
target="_blank"
>
through redirect app
</EuiLink>
)
<br />
</React.Fragment>
))
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/src/certs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { resolve } from 'path';

export const CA_CERT_PATH = resolve(__dirname, '../certs/ca.crt');
export const CA_CERT_PATH = process.env.TEST_CA_CERT_PATH || resolve(__dirname, '../certs/ca.crt');
export const ES_KEY_PATH = resolve(__dirname, '../certs/elasticsearch.key');
export const ES_CERT_PATH = resolve(__dirname, '../certs/elasticsearch.crt');
export const ES_P12_PATH = resolve(__dirname, '../certs/elasticsearch.p12');
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ pageLoadAssetSize:
visTypePie: 35583
expressionRevealImage: 25675
cases: 144442
userSetup: 18532
4 changes: 2 additions & 2 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class DocLinksService {
ml: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/index.html`,
aggregations: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-aggregation.html`,
anomalyDetection: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/xpack-ml.html`,
anomalyDetection: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-overview.html`,
anomalyDetectionJobs: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-jobs.html`,
anomalyDetectionConfiguringCategories: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-categories.html`,
anomalyDetectionBucketSpan: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/create-jobs.html#bucket-span`,
Expand All @@ -249,7 +249,7 @@ export class DocLinksService {
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-dfanalytics-evaluate.html#ml-dfanalytics-roc`,
outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-finding-outliers.html#ml-dfanalytics-roc`,
regressionEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-regression-evaluation`,
classificationAucRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-class-aucroc`,
},
Expand Down
3 changes: 2 additions & 1 deletion src/core/public/http/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface Params {

const JSON_CONTENT = /^(application\/(json|x-javascript)|text\/(x-)?javascript|x-json)(;.*)?$/;
const NDJSON_CONTENT = /^(application\/ndjson)(;.*)?$/;
const ZIP_CONTENT = /^(application\/zip)(;.*)?$/;

const removedUndefined = (obj: Record<string, any> | undefined) => {
return omitBy(obj, (v) => v === undefined);
Expand Down Expand Up @@ -153,7 +154,7 @@ export class Fetch {
const contentType = response.headers.get('Content-Type') || '';

try {
if (NDJSON_CONTENT.test(contentType)) {
if (NDJSON_CONTENT.test(contentType) || ZIP_CONTENT.test(contentType)) {
body = await response.blob();
} else if (JSON_CONTENT.test(contentType)) {
body = await response.json();
Expand Down
48 changes: 48 additions & 0 deletions src/plugins/data/server/autocomplete/terms_agg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const mockResponse = {
},
} as ApiResponse<SearchResponse<any>>;

jest.mock('../index_patterns');

describe('terms agg suggestions', () => {
beforeEach(() => {
const requestHandlerContext = coreMock.createRequestHandlerContext();
Expand Down Expand Up @@ -86,4 +88,50 @@ describe('terms agg suggestions', () => {
]
`);
});

it('calls the _search API with a terms agg and fallback to fieldName when field is null', async () => {
const result = await termsAggSuggestions(
configMock,
savedObjectsClientMock,
esClientMock,
'index',
'fieldName',
'query',
[]
);

const [[args]] = esClientMock.search.mock.calls;

expect(args).toMatchInlineSnapshot(`
Object {
"body": Object {
"aggs": Object {
"suggestions": Object {
"terms": Object {
"execution_hint": "map",
"field": "fieldName",
"include": "query.*",
"shard_size": 10,
},
},
},
"query": Object {
"bool": Object {
"filter": Array [],
},
},
"size": 0,
"terminate_after": 98430,
"timeout": "4513ms",
},
"index": "index",
}
`);
expect(result).toMatchInlineSnapshot(`
Array [
"whoa",
"amazing",
]
`);
});
});
43 changes: 43 additions & 0 deletions src/plugins/data/server/autocomplete/terms_enum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const mockResponse = {
body: { terms: ['whoa', 'amazing'] },
};

jest.mock('../index_patterns');

describe('_terms_enum suggestions', () => {
beforeEach(() => {
const requestHandlerContext = coreMock.createRequestHandlerContext();
Expand Down Expand Up @@ -71,4 +73,45 @@ describe('_terms_enum suggestions', () => {
`);
expect(result).toEqual(mockResponse.body.terms);
});

it('calls the _terms_enum API and fallback to fieldName when field is null', async () => {
const result = await termsEnumSuggestions(
configMock,
savedObjectsClientMock,
esClientMock,
'index',
'fieldName',
'query',
[]
);

const [[args]] = esClientMock.transport.request.mock.calls;

expect(args).toMatchInlineSnapshot(`
Object {
"body": Object {
"field": "fieldName",
"index_filter": Object {
"bool": Object {
"must": Array [
Object {
"terms": Object {
"_tier": Array [
"data_hot",
"data_warm",
"data_content",
],
},
},
],
},
},
"string": "query",
},
"method": "POST",
"path": "/index/_terms_enum",
}
`);
expect(result).toEqual(mockResponse.body.terms);
});
});
2 changes: 1 addition & 1 deletion src/plugins/data/server/autocomplete/terms_enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function termsEnumSuggestions(
method: 'POST',
path: encodeURI(`/${index}/_terms_enum`),
body: {
field: field?.name ?? field,
field: field?.name ?? fieldName,
string: query,
index_filter: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const applicationUsageSchema = {
error: commonSchema,
status: commonSchema,
kibanaOverview: commonSchema,
r: commonSchema,

// X-Pack
apm: commonSchema,
Expand Down
86 changes: 2 additions & 84 deletions src/plugins/kibana_utils/common/persistable_state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,87 +6,5 @@
* Side Public License, v 1.
*/

import { SavedObjectReference } from '../../../../core/types';

export type SerializableValue = string | number | boolean | null | undefined | SerializableState;
export type Serializable = SerializableValue | SerializableValue[];

export type SerializableState = {
[key: string]: Serializable;
};

export type MigrateFunction<
FromVersion extends SerializableState = SerializableState,
ToVersion extends SerializableState = SerializableState
> = (state: FromVersion) => ToVersion;

export type MigrateFunctionsObject = {
[key: string]: MigrateFunction;
};

export interface PersistableStateService<P extends SerializableState = SerializableState> {
/**
* function to extract telemetry information
* @param state
* @param collector
*/
telemetry: (state: P, collector: Record<string, any>) => Record<string, any>;
/**
* inject function receives state and a list of references and should return state with references injected
* default is identity function
* @param state
* @param references
*/
inject: (state: P, references: SavedObjectReference[]) => P;
/**
* extract function receives state and should return state with references extracted and array of references
* default returns same state with empty reference array
* @param state
*/
extract: (state: P) => { state: P; references: SavedObjectReference[] };

/**
* migrateToLatest function receives state of older version and should migrate to the latest version
* @param state
* @param version
*/
migrateToLatest?: (state: SerializableState, version: string) => P;

/**
* migrate function runs the specified migration
* @param state
* @param version
*/
migrate: (state: SerializableState, version: string) => SerializableState;
}

export interface PersistableState<P extends SerializableState = SerializableState> {
/**
* function to extract telemetry information
* @param state
* @param collector
*/
telemetry: (state: P, collector: Record<string, any>) => Record<string, any>;
/**
* inject function receives state and a list of references and should return state with references injected
* default is identity function
* @param state
* @param references
*/
inject: (state: P, references: SavedObjectReference[]) => P;
/**
* extract function receives state and should return state with references extracted and array of references
* default returns same state with empty reference array
* @param state
*/
extract: (state: P) => { state: P; references: SavedObjectReference[] };

/**
* list of all migrations per semver
*/
migrations: MigrateFunctionsObject;
}

export type PersistableStateDefinition<P extends SerializableState = SerializableState> = Partial<
PersistableState<P>
>;
export * from './types';
export { migrateToLatest } from './migrate_to_latest';
Loading

0 comments on commit 68133c3

Please sign in to comment.