Skip to content

Commit

Permalink
Merge branch 'master' into move-truncate-by-height
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaanj authored Oct 22, 2021
2 parents 09adf01 + 776ad48 commit 00a2345
Show file tree
Hide file tree
Showing 304 changed files with 6,337 additions and 2,559 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
"jsondiffpatch": "0.4.1",
"license-checker": "^16.0.0",
"listr": "^0.14.1",
"lmdb-store": "^1.6.8",
"lmdb-store": "^1.6.11",
"marge": "^1.0.1",
"micromatch": "3.1.10",
"minimist": "^1.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@
* Side Public License, v 1.
*/

const Fs = require('fs');
const Path = require('path');

const { REPO_ROOT } = require('@kbn/dev-utils');
const { REPO_ROOT: REPO_ROOT_FOLLOWING_SYMLINKS } = require('@kbn/dev-utils');
const BASE_REPO_ROOT = Path.resolve(
Fs.realpathSync(Path.resolve(REPO_ROOT_FOLLOWING_SYMLINKS, 'package.json')),
'..'
);

const transpileKbnPaths = [
'test',
'x-pack/test',
'examples',
'x-pack/examples',
// TODO: should should probably remove this link back to the source
'x-pack/plugins/task_manager/server/config.ts',
'src/core/utils/default_app_categories.ts',
].map((path) => Path.resolve(BASE_REPO_ROOT, path));

// modifies all future calls to require() to automatically
// compile the required source with babel
require('@babel/register')({
ignore: [/[\/\\](node_modules|target|dist)[\/\\]/],
only: [
Path.resolve(REPO_ROOT, 'test'),
Path.resolve(REPO_ROOT, 'x-pack/test'),
Path.resolve(REPO_ROOT, 'examples'),
Path.resolve(REPO_ROOT, 'x-pack/examples'),
// TODO: should should probably remove this link back to the source
Path.resolve(REPO_ROOT, 'x-pack/plugins/task_manager/server/config.ts'),
Path.resolve(REPO_ROOT, 'src/core/utils/default_app_categories.ts'),
],
only: transpileKbnPaths,
babelrc: false,
presets: [require.resolve('@kbn/babel-preset/node_preset')],
extensions: ['.js', '.ts', '.tsx'],
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export class DocLinksService {
netGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/net-api/${DOC_LINK_VERSION}/index.html`,
perlGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/perl-api/${DOC_LINK_VERSION}/index.html`,
phpGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/php-api/${DOC_LINK_VERSION}/index.html`,
pythonGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/net-api/${DOC_LINK_VERSION}/index.html`,
pythonGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/python-api/${DOC_LINK_VERSION}/index.html`,
rubyOverview: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/ruby-api/${DOC_LINK_VERSION}/ruby_client.html`,
rustGuide: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/client/rust-api/${DOC_LINK_VERSION}/index.html`,
},
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/data/common/query/persistable_state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@

import { extract, inject } from './persistable_state';
import { Filter } from '@kbn/es-query';
import { DATA_VIEW_SAVED_OBJECT_TYPE } from '../../common';

describe('filter manager persistable state tests', () => {
const filters: Filter[] = [
{ meta: { alias: 'test', disabled: false, negate: false, index: 'test' } },
];
describe('reference injection', () => {
test('correctly inserts reference to filter', () => {
const updatedFilters = inject(filters, [{ type: 'index_pattern', name: 'test', id: '123' }]);
const updatedFilters = inject(filters, [
{ type: DATA_VIEW_SAVED_OBJECT_TYPE, name: 'test', id: '123' },
]);
expect(updatedFilters[0]).toHaveProperty('meta.index', '123');
});

test('drops index setting if reference is missing', () => {
const updatedFilters = inject(filters, [
{ type: 'index_pattern', name: 'test123', id: '123' },
{ type: DATA_VIEW_SAVED_OBJECT_TYPE, name: 'test123', id: '123' },
]);
expect(updatedFilters[0]).toHaveProperty('meta.index', undefined);
});
Expand Down
10 changes: 8 additions & 2 deletions src/plugins/data/common/query/persistable_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@

import uuid from 'uuid';
import { Filter } from '@kbn/es-query';
import { DATA_VIEW_SAVED_OBJECT_TYPE } from '../../common';
import { SavedObjectReference } from '../../../../core/types';
import { MigrateFunctionsObject } from '../../../kibana_utils/common';

export const extract = (filters: Filter[]) => {
const references: SavedObjectReference[] = [];
const updatedFilters = filters.map((filter) => {
if (filter.meta?.index) {
const id = uuid();
references.push({
type: 'index_pattern',
type: DATA_VIEW_SAVED_OBJECT_TYPE,
name: id,
id: filter.meta.index,
});
Expand Down Expand Up @@ -54,6 +56,10 @@ export const telemetry = (filters: Filter[], collector: unknown) => {
return {};
};

export const getAllMigrations = () => {
export const migrateToLatest = (filters: Filter[], version: string) => {
return filters;
};

export const getAllMigrations = (): MigrateFunctionsObject => {
return {};
};
23 changes: 21 additions & 2 deletions src/plugins/data/common/query/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@
* Side Public License, v 1.
*/

export * from './timefilter/types';
import type { Query, Filter } from '@kbn/es-query';
import type { RefreshInterval, TimeRange } from './timefilter/types';

export { Query } from '@kbn/es-query';
export type { RefreshInterval, TimeRange, TimeRangeBounds } from './timefilter/types';
export type { Query } from '@kbn/es-query';

export type SavedQueryTimeFilter = TimeRange & {
refreshInterval: RefreshInterval;
};

export interface SavedQuery {
id: string;
attributes: SavedQueryAttributes;
}

export interface SavedQueryAttributes {
title: string;
description: string;
query: Query;
filters?: Filter[];
timefilter?: SavedQueryTimeFilter;
}
4 changes: 2 additions & 2 deletions src/plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ export class DataPublicPlugin
core: CoreStart,
{ uiActions, fieldFormats, dataViews }: DataStartDependencies
): DataPublicPluginStart {
const { uiSettings, notifications, savedObjects, overlays } = core;
const { uiSettings, notifications, overlays } = core;
setNotifications(notifications);
setOverlays(overlays);
setUiSettings(uiSettings);
setIndexPatterns(dataViews);

const query = this.queryService.start({
storage: this.storage,
savedObjectsClient: savedObjects.client,
http: core.http,
uiSettings,
});

Expand Down
10 changes: 5 additions & 5 deletions src/plugins/data/public/query/query_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/

import { share } from 'rxjs/operators';
import { IUiSettingsClient, SavedObjectsClientContract } from 'src/core/public';
import { HttpStart, IUiSettingsClient } from 'src/core/public';
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
import { buildEsQuery } from '@kbn/es-query';
import { FilterManager } from './filter_manager';
import { createAddToQueryLog } from './lib';
import { TimefilterService, TimefilterSetup } from './timefilter';
import { createSavedQueryService } from './saved_query/saved_query_service';
import { createQueryStateObservable } from './state_sync/create_global_query_observable';
import { QueryStringManager, QueryStringContract } from './query_string';
import { QueryStringContract, QueryStringManager } from './query_string';
import { getEsQueryConfig, TimeRange } from '../../common';
import { getUiSettings } from '../services';
import { NowProviderInternalContract } from '../now_provider';
Expand All @@ -33,9 +33,9 @@ interface QueryServiceSetupDependencies {
}

interface QueryServiceStartDependencies {
savedObjectsClient: SavedObjectsClientContract;
storage: IStorageWrapper;
uiSettings: IUiSettingsClient;
http: HttpStart;
}

export class QueryService {
Expand Down Expand Up @@ -70,15 +70,15 @@ export class QueryService {
};
}

public start({ savedObjectsClient, storage, uiSettings }: QueryServiceStartDependencies) {
public start({ storage, uiSettings, http }: QueryServiceStartDependencies) {
return {
addToQueryLog: createAddToQueryLog({
storage,
uiSettings,
}),
filterManager: this.filterManager,
queryString: this.queryStringManager,
savedQueries: createSavedQueryService(savedObjectsClient),
savedQueries: createSavedQueryService(http),
state$: this.state$,
timefilter: this.timefilter,
getEsQuery: (indexPattern: IndexPattern, timeRange?: TimeRange) => {
Expand Down
Loading

0 comments on commit 00a2345

Please sign in to comment.