Skip to content

Commit

Permalink
Merge branch 'master' into moar-migration-ts-projects
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Feb 16, 2021
2 parents 8a39b2d + e8fea28 commit e20e416
Show file tree
Hide file tree
Showing 325 changed files with 6,718 additions and 4,244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export declare class SearchInterceptor
| --- | --- | --- |
| [getTimeoutMode()](./kibana-plugin-plugins-data-public.searchinterceptor.gettimeoutmode.md) | | |
| [handleSearchError(e, timeoutSignal, options)](./kibana-plugin-plugins-data-public.searchinterceptor.handlesearcherror.md) | | |
| [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given <code>search</code> method. Overrides the <code>AbortSignal</code> with one that will abort either when <code>cancelPending</code> is called, when the request times out, or when the original <code>AbortSignal</code> is aborted. Updates <code>pendingCount$</code> when the request is started/finalized. |
| [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given <code>search</code> method. Overrides the <code>AbortSignal</code> with one that will abort either when the request times out, or when the original <code>AbortSignal</code> is aborted. Updates <code>pendingCount$</code> when the request is started/finalized. |
| [showError(e)](./kibana-plugin-plugins-data-public.searchinterceptor.showerror.md) | | |

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

## SearchInterceptor.search() method

Searches using the given `search` method. Overrides the `AbortSignal` with one that will abort either when `cancelPending` is called, when the request times out, or when the original `AbortSignal` is aborted. Updates `pendingCount$` when the request is started/finalized.
Searches using the given `search` method. Overrides the `AbortSignal` with one that will abort either when the request times out, or when the original `AbortSignal` is aborted. Updates `pendingCount$` when the request is started/finalized.

<b>Signature:</b>

Expand Down
1 change: 1 addition & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -684,3 +684,4 @@ include::secure-settings.asciidoc[]
include::{kib-repo-dir}/settings/security-settings.asciidoc[]
include::{kib-repo-dir}/settings/spaces-settings.asciidoc[]
include::{kib-repo-dir}/settings/telemetry-settings.asciidoc[]
include::{kib-repo-dir}/settings/task-manager-settings.asciidoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Because by default tasks are polled at 3 second intervals and only 10 tasks can
* Many alerts or actions must be *run at once*. In this case pending tasks will queue in {es}, and be pulled 10 at a time from the queue at 3 second intervals.
* *Long running tasks* occupy slots for an extended time, leaving fewer slots for other tasks.
For details on the settings that can influence the performance and throughput of Task Manager, see {task-manager-settings}.
For details on the settings that can influence the performance and throughput of Task Manager, see <<task-manager-settings,`Task Manager Settings`>>.
==============================================

Expand Down
6 changes: 3 additions & 3 deletions docs/user/dashboard/url-drilldown.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ internal {kib} navigations with carrying over current filters.
| Current query string.

|
| context.panel.query.lang
| context.panel.query.language
| Current query language.

|
Expand All @@ -200,8 +200,8 @@ context.panel.timeRange.to
Tip: Use in combination with <<helpers, date>> helper to format date.

|
| context.panel.timeRange.indexPatternId +
context.panel.timeRange.indexPatternIds
| context.panel.indexPatternId +
context.panel.indexPatternIds
|Index pattern ids used by a panel.

|
Expand Down
26 changes: 17 additions & 9 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48005,6 +48005,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBazelRepositoryCacheFolder", function() { return _get_cache_folders__WEBPACK_IMPORTED_MODULE_0__["getBazelRepositoryCacheFolder"]; });

/* harmony import */ var _install_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(373);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBazelBinAvailable", function() { return _install_tools__WEBPACK_IMPORTED_MODULE_1__["isBazelBinAvailable"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "installBazelTools", function() { return _install_tools__WEBPACK_IMPORTED_MODULE_1__["installBazelTools"]; });

/* harmony import */ var _run__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(374);
Expand Down Expand Up @@ -48064,6 +48066,7 @@ async function getBazelRepositoryCacheFolder() {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBazelBinAvailable", function() { return isBazelBinAvailable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "installBazelTools", function() { return installBazelTools; });
/* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var dedent__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dedent__WEBPACK_IMPORTED_MODULE_0__);
Expand Down Expand Up @@ -54434,8 +54437,10 @@ const CleanCommand = {
} // Runs Bazel soft clean


await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["runBazel"])(['clean']);
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Soft cleaned bazel');
if (await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["isBazelBinAvailable"])()) {
await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["runBazel"])(['clean']);
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Soft cleaned bazel');
}

if (toDelete.length === 0) {
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Nothing to delete');
Expand Down Expand Up @@ -59124,16 +59129,19 @@ const ResetCommand = {
pattern: extraPatterns
});
}
} // Runs Bazel hard clean
} // Runs Bazel hard clean and deletes Bazel Cache Folders


await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["runBazel"])(['clean', '--expunge']);
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Hard cleaned bazel'); // Deletes Bazel Cache Folders
if (await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["isBazelBinAvailable"])()) {
// Hard cleaning bazel
await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["runBazel"])(['clean', '--expunge']);
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Hard cleaned bazel'); // Deletes Bazel Cache Folders

await del__WEBPACK_IMPORTED_MODULE_1___default()([await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["getBazelDiskCacheFolder"])(), await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["getBazelRepositoryCacheFolder"])()], {
force: true
});
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Removed disk caches');
await del__WEBPACK_IMPORTED_MODULE_1___default()([await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["getBazelDiskCacheFolder"])(), await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_4__["getBazelRepositoryCacheFolder"])()], {
force: true
});
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].success('Removed disk caches');
}

if (toDelete.length === 0) {
return;
Expand Down
8 changes: 5 additions & 3 deletions packages/kbn-pm/src/commands/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import del from 'del';
import ora from 'ora';
import { join, relative } from 'path';

import { runBazel } from '../utils/bazel';
import { isBazelBinAvailable, runBazel } from '../utils/bazel';
import { isDirectory } from '../utils/fs';
import { log } from '../utils/log';
import { ICommand } from './';
Expand Down Expand Up @@ -53,8 +53,10 @@ export const CleanCommand: ICommand = {
}

// Runs Bazel soft clean
await runBazel(['clean']);
log.success('Soft cleaned bazel');
if (await isBazelBinAvailable()) {
await runBazel(['clean']);
log.success('Soft cleaned bazel');
}

if (toDelete.length === 0) {
log.success('Nothing to delete');
Expand Down
26 changes: 17 additions & 9 deletions packages/kbn-pm/src/commands/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import del from 'del';
import ora from 'ora';
import { join, relative } from 'path';

import { getBazelDiskCacheFolder, getBazelRepositoryCacheFolder, runBazel } from '../utils/bazel';
import {
getBazelDiskCacheFolder,
getBazelRepositoryCacheFolder,
isBazelBinAvailable,
runBazel,
} from '../utils/bazel';
import { isDirectory } from '../utils/fs';
import { log } from '../utils/log';
import { ICommand } from './';
Expand Down Expand Up @@ -52,15 +57,18 @@ export const ResetCommand: ICommand = {
}
}

// Runs Bazel hard clean
await runBazel(['clean', '--expunge']);
log.success('Hard cleaned bazel');
// Runs Bazel hard clean and deletes Bazel Cache Folders
if (await isBazelBinAvailable()) {
// Hard cleaning bazel
await runBazel(['clean', '--expunge']);
log.success('Hard cleaned bazel');

// Deletes Bazel Cache Folders
await del([await getBazelDiskCacheFolder(), await getBazelRepositoryCacheFolder()], {
force: true,
});
log.success('Removed disk caches');
// Deletes Bazel Cache Folders
await del([await getBazelDiskCacheFolder(), await getBazelRepositoryCacheFolder()], {
force: true,
});
log.success('Removed disk caches');
}

if (toDelete.length === 0) {
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/src/utils/bazel/install_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function readBazelToolsVersionFile(repoRootPath: string, versionFilename:
return version;
}

async function isBazelBinAvailable() {
export async function isBazelBinAvailable() {
try {
await spawn('bazel', ['--version'], { stdio: 'pipe' });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ test('parses fully specified config', () => {
"apiVersion": "v7.0.0",
"hosts": Array [
Object {
"auth": "elastic:changeme",
"headers": Object {
"x-elastic-product-origin": "kibana",
"xsrf": "something",
Expand All @@ -111,7 +110,6 @@ test('parses fully specified config', () => {
"query": null,
},
Object {
"auth": "elastic:changeme",
"headers": Object {
"x-elastic-product-origin": "kibana",
"xsrf": "something",
Expand All @@ -123,7 +121,6 @@ test('parses fully specified config', () => {
"query": null,
},
Object {
"auth": "elastic:changeme",
"headers": Object {
"x-elastic-product-origin": "kibana",
"xsrf": "something",
Expand All @@ -135,6 +132,7 @@ test('parses fully specified config', () => {
"query": null,
},
],
"httpAuth": "elastic:changeme",
"keepAlive": true,
"log": [Function],
"pingTimeout": 12345,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ export function parseElasticsearchClientConfig(
esClientConfig.sniffInterval = getDurationAsMs(config.sniffInterval);
}

const needsAuth = auth !== false && config.username && config.password;
if (needsAuth) {
esClientConfig.httpAuth = `${config.username}:${config.password}`;
}

if (Array.isArray(config.hosts)) {
const needsAuth = auth !== false && config.username && config.password;
esClientConfig.hosts = config.hosts.map((nodeUrl: string) => {
const uri = url.parse(nodeUrl);

const httpsURI = uri.protocol === 'https:';
const httpURI = uri.protocol === 'http:';

Expand All @@ -126,10 +129,6 @@ export function parseElasticsearchClientConfig(
},
};

if (needsAuth) {
host.auth = `${config.username}:${config.password}`;
}

return host;
});
}
Expand Down
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const storybookAliases = {
apm: 'x-pack/plugins/apm/.storybook',
canvas: 'x-pack/plugins/canvas/storybook',
codeeditor: 'src/plugins/kibana_react/public/code_editor/.storybook',
url_template_editor: 'src/plugins/kibana_react/public/url_template_editor/.storybook',
dashboard: 'src/plugins/dashboard/.storybook',
dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/.storybook',
data_enhanced: 'x-pack/plugins/data_enhanced/.storybook',
Expand Down
12 changes: 11 additions & 1 deletion src/plugins/console/public/lib/es/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import $ from 'jquery';
import { stringify } from 'query-string';

interface SendOptions {
asSystemRequest?: boolean;
}

const esVersion: string[] = [];

export function getVersion() {
Expand All @@ -20,13 +24,19 @@ export function getContentType(body: any) {
return 'application/json';
}

export function send(method: string, path: string, data: any) {
export function send(
method: string,
path: string,
data: any,
{ asSystemRequest }: SendOptions = {}
) {
const wrappedDfd = $.Deferred();

const options: JQuery.AjaxSettings = {
url: '../api/console/proxy?' + stringify({ path, method }, { sort: false }),
headers: {
'kbn-xsrf': 'kibana',
...(asSystemRequest && { 'kbn-system-request': 'true' }),
},
data,
contentType: getContentType(data),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console/public/lib/mappings/mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function retrieveSettings(settingsKey, settingsToRetrieve) {

// Fetch autocomplete info if setting is set to true, and if user has made changes.
if (settingsToRetrieve[settingsKey] === true) {
return es.send('GET', settingKeyToPathMap[settingsKey], null);
return es.send('GET', settingKeyToPathMap[settingsKey], null, true);
} else {
const settingsPromise = new $.Deferred();
if (settingsToRetrieve[settingsKey] === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import moment from 'moment-timezone';
import { i18n } from '@kbn/i18n';

import { KBN_FIELD_TYPES, TimeRange, TimeRangeBounds, UI_SETTINGS } from '../../../../common';
import { IFieldType } from '../../../index_patterns';

import { intervalOptions, autoInterval, isAutoInterval } from './_interval_options';
import { createFilterDateHistogram } from './create_filter/date_histogram';
Expand Down Expand Up @@ -58,7 +59,7 @@ export function isDateHistogramBucketAggConfig(agg: any): agg is IBucketDateHist
}

export interface AggParamsDateHistogram extends BaseAggParams {
field?: string;
field?: IFieldType | string;
timeRange?: TimeRange;
useNormalizedEsInterval?: boolean;
scaleMetricValues?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jest.mock('moment', () => {
return moment;
});

import { IndexPattern } from '../../../index_patterns';
import { IndexPattern, IndexPatternField } from '../../../index_patterns';
import { AggParamsDateHistogram } from '../buckets';
import { inferTimeZone } from './infer_time_zone';

Expand Down Expand Up @@ -51,6 +51,31 @@ describe('inferTimeZone', () => {
).toEqual('UTC');
});

it('reads time zone from index pattern type meta if available when the field is not a string', () => {
expect(
inferTimeZone(
{
field: {
name: 'mydatefield',
} as IndexPatternField,
},
({
typeMeta: {
aggs: {
date_histogram: {
mydatefield: {
time_zone: 'UTC',
},
},
},
},
} as unknown) as IndexPattern,
() => false,
jest.fn()
)
).toEqual('UTC');
});

it('reads time zone from moment if set to default', () => {
expect(inferTimeZone({}, {} as IndexPattern, () => true, jest.fn())).toEqual('CET');
});
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/data/common/search/aggs/utils/infer_time_zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export function inferTimeZone(
if (!tz && params.field) {
// If a field has been configured check the index pattern's typeMeta if a date_histogram on that
// field requires a specific time_zone
tz = indexPattern.typeMeta?.aggs?.date_histogram?.[params.field]?.time_zone;
const fieldName = typeof params.field === 'string' ? params.field : params.field.name;
tz = indexPattern.typeMeta?.aggs?.date_histogram?.[fieldName]?.time_zone;
}
if (!tz) {
// If the index pattern typeMeta data, didn't had a time zone assigned for the selected field use the configured tz
Expand Down
Loading

0 comments on commit e20e416

Please sign in to comment.