Skip to content

Commit

Permalink
Merge branch 'master' into eui/24.1
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Jun 9, 2020
2 parents d186e7a + f4cfa49 commit 701f42b
Show file tree
Hide file tree
Showing 124 changed files with 3,735 additions and 1,688 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ module.exports = {
{
files: ['x-pack/plugins/canvas/**/*.{js,ts,tsx}'],
rules: {
'react-hooks/exhaustive-deps': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [getSearchParamsFromRequest](./kibana-plugin-plugins-data-public.getsearchparamsfromrequest.md)

## getSearchParamsFromRequest() function

<b>Signature:</b>

```typescript
export declare function getSearchParamsFromRequest(searchRequest: SearchRequest, dependencies: {
injectedMetadata: CoreStart['injectedMetadata'];
uiSettings: IUiSettingsClient;
}): {
rest_total_hits_as_int: boolean;
ignore_unavailable: boolean;
ignore_throttled: boolean;
max_concurrent_shard_requests: any;
preference: any;
timeout: string | undefined;
index: any;
body: any;
};
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| searchRequest | <code>SearchRequest</code> | |
| dependencies | <code>{</code><br/><code> injectedMetadata: CoreStart['injectedMetadata'];</code><br/><code> uiSettings: IUiSettingsClient;</code><br/><code>}</code> | |

<b>Returns:</b>

`{
rest_total_hits_as_int: boolean;
ignore_unavailable: boolean;
ignore_throttled: boolean;
max_concurrent_shard_requests: any;
preference: any;
timeout: string | undefined;
index: any;
body: any;
}`

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
| [getEsPreference(uiSettings, sessionId)](./kibana-plugin-plugins-data-public.getespreference.md) | |
| [getQueryLog(uiSettings, storage, appName, language)](./kibana-plugin-plugins-data-public.getquerylog.md) | |
| [getSearchErrorType({ message })](./kibana-plugin-plugins-data-public.getsearcherrortype.md) | |
| [getSearchParamsFromRequest(searchRequest, dependencies)](./kibana-plugin-plugins-data-public.getsearchparamsfromrequest.md) | |
| [getTime(indexPattern, timeRange, options)](./kibana-plugin-plugins-data-public.gettime.md) | |
| [plugin(initializerContext)](./kibana-plugin-plugins-data-public.plugin.md) | |

Expand Down
9 changes: 5 additions & 4 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55242,6 +55242,7 @@ __webpack_require__.r(__webpack_exports__);
* under the License.
*/

const YARN_EXEC = process.env.npm_execpath || 'yarn';

/**
* Install all dependencies in the given directory
Expand All @@ -55250,7 +55251,7 @@ async function installInDir(directory, extraArgs = []) {
const options = ['install', '--non-interactive', ...extraArgs]; // We pass the mutex flag to ensure only one instance of yarn runs at any
// given time (e.g. to avoid conflicts).

await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])('yarn', options, {
await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, options, {
cwd: directory
});
}
Expand All @@ -55262,7 +55263,7 @@ async function runScriptInPackage(script, args, pkg) {
const execOpts = {
cwd: pkg.path
};
await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])('yarn', ['run', script, ...args], execOpts);
await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, ['run', script, ...args], execOpts);
}
/**
* Run script in the given directory
Expand All @@ -55277,15 +55278,15 @@ function runScriptInPackageStreaming({
const execOpts = {
cwd: pkg.path
};
return Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawnStreaming"])('yarn', ['run', script, ...args], execOpts, {
return Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawnStreaming"])(YARN_EXEC, ['run', script, ...args], execOpts, {
prefix: pkg.name,
debug
});
}
async function yarnWorkspacesInfo(directory) {
const {
stdout
} = await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])('yarn', ['--json', 'workspaces', 'info'], {
} = await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])(YARN_EXEC, ['--json', 'workspaces', 'info'], {
cwd: directory,
stdio: 'pipe'
});
Expand Down
10 changes: 6 additions & 4 deletions packages/kbn-pm/src/utils/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import { spawn, spawnStreaming } from './child_process';
import { Project } from './project';

const YARN_EXEC = process.env.npm_execpath || 'yarn';

interface WorkspaceInfo {
location: string;
workspaceDependencies: string[];
Expand All @@ -37,7 +39,7 @@ export async function installInDir(directory: string, extraArgs: string[] = [])

// We pass the mutex flag to ensure only one instance of yarn runs at any
// given time (e.g. to avoid conflicts).
await spawn('yarn', options, {
await spawn(YARN_EXEC, options, {
cwd: directory,
});
}
Expand All @@ -50,7 +52,7 @@ export async function runScriptInPackage(script: string, args: string[], pkg: Pr
cwd: pkg.path,
};

await spawn('yarn', ['run', script, ...args], execOpts);
await spawn(YARN_EXEC, ['run', script, ...args], execOpts);
}

/**
Expand All @@ -71,14 +73,14 @@ export function runScriptInPackageStreaming({
cwd: pkg.path,
};

return spawnStreaming('yarn', ['run', script, ...args], execOpts, {
return spawnStreaming(YARN_EXEC, ['run', script, ...args], execOpts, {
prefix: pkg.name,
debug,
});
}

export async function yarnWorkspacesInfo(directory: string): Promise<WorkspacesInfo> {
const { stdout } = await spawn('yarn', ['--json', 'workspaces', 'info'], {
const { stdout } = await spawn(YARN_EXEC, ['--json', 'workspaces', 'info'], {
cwd: directory,
stdio: 'pipe',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import vegaMapImage256 from './vega_map_image_256.png';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { VegaParser } from '../../../../../../plugins/vis_type_vega/public/data_model/vega_parser';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { SearchCache } from '../../../../../../plugins/vis_type_vega/public/data_model/search_cache';
import { SearchAPI } from '../../../../../../plugins/vis_type_vega/public/data_model/search_api';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createVegaTypeDefinition } from '../../../../../../plugins/vis_type_vega/public/vega_type';
Expand Down Expand Up @@ -205,7 +205,14 @@ describe('VegaVisualizations', () => {
try {
vegaVis = new VegaVisualization(domNode, vis);

const vegaParser = new VegaParser(vegaliteGraph, new SearchCache());
const vegaParser = new VegaParser(
vegaliteGraph,
new SearchAPI({
search: npStart.plugins.data.search,
uiSettings: npStart.core.uiSettings,
injectedMetadata: npStart.core.injectedMetadata,
})
);
await vegaParser.parseAsync();

await vegaVis.render(vegaParser, vis.params, { data: true });
Expand All @@ -227,7 +234,14 @@ describe('VegaVisualizations', () => {
let vegaVis;
try {
vegaVis = new VegaVisualization(domNode, vis);
const vegaParser = new VegaParser(vegaGraph, new SearchCache());
const vegaParser = new VegaParser(
vegaGraph,
new SearchAPI({
search: npStart.plugins.data.search,
uiSettings: npStart.core.uiSettings,
injectedMetadata: npStart.core.injectedMetadata,
})
);
await vegaParser.parseAsync();

await vegaVis.render(vegaParser, vis.params, { data: true });
Expand All @@ -243,7 +257,14 @@ describe('VegaVisualizations', () => {
let vegaVis;
try {
vegaVis = new VegaVisualization(domNode, vis);
const vegaParser = new VegaParser(vegaTooltipGraph, new SearchCache());
const vegaParser = new VegaParser(
vegaTooltipGraph,
new SearchAPI({
search: npStart.plugins.data.search,
uiSettings: npStart.core.uiSettings,
injectedMetadata: npStart.core.injectedMetadata,
})
);
await vegaParser.parseAsync();
await vegaVis.render(vegaParser, vis.params, { data: true });

Expand Down Expand Up @@ -285,7 +306,14 @@ describe('VegaVisualizations', () => {
let vegaVis;
try {
vegaVis = new VegaVisualization(domNode, vis);
const vegaParser = new VegaParser(vegaMapGraph, new SearchCache());
const vegaParser = new VegaParser(
vegaMapGraph,
new SearchAPI({
search: npStart.plugins.data.search,
uiSettings: npStart.core.uiSettings,
injectedMetadata: npStart.core.injectedMetadata,
})
);
await vegaParser.parseAsync();

domNode.style.width = '256px';
Expand Down Expand Up @@ -324,7 +352,11 @@ describe('VegaVisualizations', () => {
}
]
}`,
new SearchCache()
new SearchAPI({
search: npStart.plugins.data.search,
uiSettings: npStart.core.uiSettings,
injectedMetadata: npStart.core.injectedMetadata,
})
);
await vegaParser.parseAsync();

Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ export {
ISearchSource,
parseSearchSourceJSON,
injectSearchSourceReferences,
getSearchParamsFromRequest,
extractSearchSourceReferences,
SearchSourceFields,
EsQuerySortValue,
Expand Down
46 changes: 32 additions & 14 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { IconType } from '@elastic/eui';
import { InjectedIntl } from '@kbn/i18n/react';
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
import { IUiSettingsClient } from 'src/core/public';
import { IUiSettingsClient as IUiSettingsClient_3 } from 'kibana/public';
import { Location } from 'history';
import { LocationDescriptorObject } from 'history';
import { MaybePromise } from '@kbn/utility-types';
Expand Down Expand Up @@ -641,6 +642,23 @@ export function getQueryLog(uiSettings: IUiSettingsClient, storage: IStorageWrap
// @public (undocumented)
export function getSearchErrorType({ message }: Pick<SearchError, 'message'>): "UNSUPPORTED_QUERY" | undefined;

// Warning: (ae-missing-release-tag) "getSearchParamsFromRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function getSearchParamsFromRequest(searchRequest: SearchRequest, dependencies: {
injectedMetadata: CoreStart['injectedMetadata'];
uiSettings: IUiSettingsClient_3;
}): {
rest_total_hits_as_int: boolean;
ignore_unavailable: boolean;
ignore_throttled: boolean;
max_concurrent_shard_requests: any;
preference: any;
timeout: string | undefined;
index: any;
body: any;
};

// Warning: (ae-missing-release-tag) "getTime" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -1851,20 +1869,20 @@ export const UI_SETTINGS: {
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:377:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:378:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:387:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:378:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts
Expand Down
18 changes: 17 additions & 1 deletion src/plugins/data/public/search/fetch/get_search_params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
* under the License.
*/

import { IUiSettingsClient } from 'kibana/public';
import { IUiSettingsClient, CoreStart } from 'kibana/public';
import { UI_SETTINGS } from '../../../common';
import { SearchRequest } from './types';

const sessionId = Date.now();

Expand Down Expand Up @@ -53,3 +54,18 @@ export function getPreference(config: IUiSettingsClient) {
export function getTimeout(esShardTimeout: number) {
return esShardTimeout > 0 ? `${esShardTimeout}ms` : undefined;
}

export function getSearchParamsFromRequest(
searchRequest: SearchRequest,
dependencies: { injectedMetadata: CoreStart['injectedMetadata']; uiSettings: IUiSettingsClient }
) {
const { injectedMetadata, uiSettings } = dependencies;
const esShardTimeout = injectedMetadata.getInjectedVar('esShardTimeout') as number;
const searchParams = getSearchParams(uiSettings, esShardTimeout);

return {
index: searchRequest.index.title || searchRequest.index,
body: searchRequest.body,
...searchParams,
};
}
1 change: 1 addition & 0 deletions src/plugins/data/public/search/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
export * from './types';
export {
getSearchParams,
getSearchParamsFromRequest,
getPreference,
getTimeout,
getIgnoreThrottled,
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export {
SearchRequest,
SearchResponse,
getSearchErrorType,
getSearchParamsFromRequest,
} from './fetch';

export {
Expand Down
15 changes: 7 additions & 8 deletions src/plugins/data/public/search/search_source/search_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { filterDocvalueFields } from './filter_docvalue_fields';
import { fieldWildcardFilter } from '../../../../kibana_utils/public';
import { IIndexPattern, ISearchGeneric, SearchRequest } from '../..';
import { SearchSourceOptions, SearchSourceFields } from './types';
import { FetchOptions, RequestFailure, getSearchParams, handleResponse } from '../fetch';
import { FetchOptions, RequestFailure, handleResponse, getSearchParamsFromRequest } from '../fetch';

import { getEsQueryConfig, buildEsQuery, Filter, UI_SETTINGS } from '../../../common';
import { getHighlightRequest } from '../../../common/field_formats';
Expand Down Expand Up @@ -204,13 +204,12 @@ export class SearchSource {
*/
private fetch$(searchRequest: SearchRequest, signal?: AbortSignal) {
const { search, injectedMetadata, uiSettings } = this.dependencies;
const esShardTimeout = injectedMetadata.getInjectedVar('esShardTimeout') as number;
const searchParams = getSearchParams(uiSettings, esShardTimeout);
const params = {
index: searchRequest.index.title || searchRequest.index,
body: searchRequest.body,
...searchParams,
};

const params = getSearchParamsFromRequest(searchRequest, {
injectedMetadata,
uiSettings,
});

return search({ params, indexType: searchRequest.indexType }, { signal }).pipe(
map(({ rawResponse }) => handleResponse(searchRequest, rawResponse))
);
Expand Down
Loading

0 comments on commit 701f42b

Please sign in to comment.