Skip to content

Commit

Permalink
Merge branch 'master' into chore/management-consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Mar 1, 2021
2 parents f1a1cd5 + 1fa774c commit bd093f7
Show file tree
Hide file tree
Showing 509 changed files with 8,800 additions and 4,148,184 deletions.
2 changes: 1 addition & 1 deletion .bazeliskversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.3
1.7.5
4 changes: 2 additions & 2 deletions docs/user/dashboard/drilldowns.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ that shows a single data center or server.
[[url-drilldowns]]
==== URL drilldowns

beta[] URL drilldowns enable you to navigate from a dashboard to internal or external URLs.
URL drilldowns enable you to navigate from a dashboard to internal or external URLs.
Destination URLs can be dynamic, depending on the dashboard context or user interaction with a panel.
For example, if you have a dashboard that shows data from a Github repository, you can create a URL drilldown
that opens Github from the dashboard.
Expand Down Expand Up @@ -226,7 +226,7 @@ and date range are carried over.
[[create-a-url-drilldown]]
=== Try it: Create a URL drilldown

beta[] To create URL drilldowns, you add <<variables,variables>> to a URL template, which configures the bahavior of the drilldown.
To create URL drilldowns, you add <<variables,variables>> to a URL template, which configures the behavior of the drilldown.

image:images/url_drilldown_go_to_github.gif[Drilldown on pie chart that navigates to Github]

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@
"fetch-mock": "^7.3.9",
"file-loader": "^4.2.0",
"file-saver": "^1.3.8",
"form-data": "^4.0.0",
"formsy-react": "^1.1.5",
"geckodriver": "^1.21.0",
"glob-watcher": "5.0.3",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-dev-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export {
KBN_P12_PATH,
KBN_P12_PASSWORD,
} from './certs';
export * from './kbn_client';
export * from './run';
export * from './axios';
export * from './stdio';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export function buildApiDeclaration(
name?: string
): ApiDeclaration {
const apiName = name ? name : isNamedNode(node) ? node.getName() : 'Unnamed';
log.debug(`Building API Declaration for ${apiName} of kind ${node.getKindName()}`);
const apiId = parentApiId ? parentApiId + '.' + apiName : apiName;
const anchorLink: AnchorLink = { scope, pluginName, apiName: apiId };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ export function getArrowFunctionDec(
anchorLink: AnchorLink,
log: ToolingLog
) {
log.debug(
`Getting Arrow Function doc def for node ${node.getName()} of kind ${node.getKindName()}`
);
return {
id: getApiSectionId(anchorLink),
type: TypeKind.FunctionKind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function buildFunctionDec(
const label = Node.isConstructorDeclaration(node)
? 'Constructor'
: node.getName() || '(WARN: Missing name)';
log.debug(`Getting function doc def for node ${label} of kind ${node.getKindName()}`);
return {
id: getApiSectionId(anchorLink),
type: TypeKind.FunctionKind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export function buildVariableDec(
anchorLink: AnchorLink,
log: ToolingLog
): ApiDeclaration {
log.debug('buildVariableDec for ' + node.getName());
const initializer = node.getInitializer();
// Recusively list object properties as children.
if (initializer && Node.isObjectLiteralExpression(initializer)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

import { REPO_ROOT } from '@kbn/utils';
import { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils';
import { getPluginApiDocId } from '../utils';
import { extractImportReferences } from './extract_import_refs';
Expand Down Expand Up @@ -82,7 +83,43 @@ it('test extractImportReference with unknown imports', () => {
expect(results.length).toBe(3);
expect(results[0]).toBe('<I extends ');
expect(results[1]).toBe('FooFoo');
expect(results[2]).toBe('>');
});

it('test full file imports with no matching plugin', () => {
const refs = extractImportReferences(
`typeof import("${REPO_ROOT}/src/plugins/data/common/es_query/kuery/node_types/function")`,
plugins,
log
);
expect(refs).toMatchInlineSnapshot(`
Array [
"typeof ",
"src/plugins/data/common/es_query/kuery/node_types/function",
]
`);
expect(refs.length).toBe(2);
});

it('test full file imports with a matching plugin', () => {
const refs = extractImportReferences(
`typeof import("${plugin.directory}/public/foo/index") something`,
plugins,
log
);
expect(refs).toMatchInlineSnapshot(`
Array [
"typeof ",
Object {
"docId": "kibPluginAPluginApi",
"pluginId": "pluginA",
"scope": "public",
"section": undefined,
"text": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index",
},
" something",
]
`);
expect(refs.length).toBe(3);
});

it('test single link', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils';
import { getApiSectionId, getPluginApiDocId, getPluginForPath } from '../utils';
import { ApiScope, TextWithLinks } from '../types';
import { getRelativePath } from './utils';

/**
*
Expand Down Expand Up @@ -54,6 +55,9 @@ export function extractImportReferences(
const str = textSegment.substr(index + length - name.length, name.length);
if (str && str !== '') {
texts.push(str);
} else {
// If there is no ".Name" then use the full path. You can see things like "typeof import("file")"
texts.push(getRelativePath(path));
}
} else {
const section = getApiSectionId({
Expand All @@ -69,10 +73,12 @@ export function extractImportReferences(
apiPath: path,
directory: plugin.directory,
}),
section,
text: name,
section: name && name !== '' ? section : undefined,
text: name && name !== '' ? name : getRelativePath(path),
});
}

// Prep textSegment to skip past the `import`, then check for more.
textSegment = textSegment.substr(index + length);
} else {
if (textSegment && textSegment !== '') {
Expand All @@ -87,10 +93,10 @@ export function extractImportReferences(
function extractImportRef(
str: string
): { path: string; name: string; index: number; length: number } | undefined {
const groups = str.match(/import\("(.*?)"\)\.(\w*)/);
const groups = str.match(/import\("(.*?)"\)\.?(\w*)/);
if (groups) {
const path = groups[1];
const name = groups[2];
const name = groups.length > 2 ? groups[2] : '';
const index = groups.index!;
const length = groups[0].length;
return { path, name, index, length };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function isPrivate(node: ParameterDeclaration | ClassMemberTypes): boolea
/**
* Change the absolute path into a relative one.
*/
function getRelativePath(fullPath: string): string {
export function getRelativePath(fullPath: string): string {
return Path.relative(REPO_ROOT, fullPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import ${json} from './${fileName}.json';
common: groupPluginApi(doc.common),
server: groupPluginApi(doc.server),
};
fs.writeFileSync(Path.resolve(folder, fileName + '.json'), JSON.stringify(scopedDoc));
fs.writeFileSync(Path.resolve(folder, fileName + '.json'), JSON.stringify(scopedDoc, null, 2));

mdx += scopApiToMdx(scopedDoc.client, 'Client', json, 'client');
mdx += scopApiToMdx(scopedDoc.server, 'Server', json, 'server');
Expand Down
1,567 changes: 1,566 additions & 1 deletion packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1,77 @@
{"id":"pluginA.foo","client":{"classes":[],"functions":[{"id":"def-public.doTheFooFnThing","type":"Function","children":[],"signature":["() => void"],"description":[],"label":"doTheFooFnThing","source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts","lineNumber":9,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L9"},"returnComment":[],"initialIsOpen":false}],"interfaces":[],"enums":[],"misc":[{"id":"def-public.FooType","type":"Type","label":"FooType","description":[],"source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts","lineNumber":11,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L11"},"signature":["() => \"foo\""],"initialIsOpen":false}],"objects":[]},"server":{"classes":[],"functions":[],"interfaces":[],"enums":[],"misc":[],"objects":[]},"common":{"classes":[],"functions":[],"interfaces":[],"enums":[],"misc":[{"id":"def-common.commonFoo","type":"string","label":"commonFoo","description":[],"source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts","lineNumber":9,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts#L9"},"signature":["\"COMMON VAR!\""],"initialIsOpen":false}],"objects":[]}}
{
"id": "pluginA.foo",
"client": {
"classes": [],
"functions": [
{
"id": "def-public.doTheFooFnThing",
"type": "Function",
"children": [],
"signature": [
"() => void"
],
"description": [],
"label": "doTheFooFnThing",
"source": {
"path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts",
"lineNumber": 9,
"link": "https://github.com/elastic/kibana/tree/masterpackages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L9"
},
"returnComment": [],
"initialIsOpen": false
}
],
"interfaces": [],
"enums": [],
"misc": [
{
"id": "def-public.FooType",
"type": "Type",
"label": "FooType",
"description": [],
"source": {
"path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts",
"lineNumber": 11,
"link": "https://github.com/elastic/kibana/tree/masterpackages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L11"
},
"signature": [
"() => \"foo\""
],
"initialIsOpen": false
}
],
"objects": []
},
"server": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [],
"objects": []
},
"common": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [
{
"id": "def-common.commonFoo",
"type": "string",
"label": "commonFoo",
"description": [],
"source": {
"path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts",
"lineNumber": 9,
"link": "https://github.com/elastic/kibana/tree/masterpackages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts#L9"
},
"signature": [
"\"COMMON VAR!\""
],
"initialIsOpen": false
}
],
"objects": []
}
}
2 changes: 1 addition & 1 deletion packages/kbn-docs-utils/src/api_docs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface Reference {
pluginId: string;
scope: ApiScope;
docId: string;
section: string;
section?: string;
text: string;
}

Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-docs-utils/src/api_docs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ export function getPluginApiDocId(
const cleanName = id.replace('.', '_');
if (serviceInfo) {
const serviceName = getServiceForPath(serviceInfo.apiPath, serviceInfo.directory);
log.debug(
`Service for path ${serviceInfo.apiPath} and ${serviceInfo.directory} is ${serviceName}`
);
const serviceFolder = serviceInfo.serviceFolders?.find((f) => f === serviceName);

if (serviceFolder) {
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

import { Client } from '@elastic/elasticsearch';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';

import { migrateKibanaIndex, createStats, cleanKibanaIndices } from '../lib';

Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable } from 'stream';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { Client } from '@elastic/elasticsearch';
import { createPromiseFromStreams, concatStreamProviders } from '@kbn/utils';
import { ES_CLIENT_HEADERS } from '../client_headers';
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/unload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable, Writable } from 'stream';
import { Client } from '@elastic/elasticsearch';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { createPromiseFromStreams } from '@kbn/utils';

import {
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import Url from 'url';
import readline from 'readline';
import Fs from 'fs';

import { RunWithCommands, createFlagError, KbnClient, CA_CERT_PATH } from '@kbn/dev-utils';
import { readConfigFile } from '@kbn/test';
import { RunWithCommands, createFlagError, CA_CERT_PATH } from '@kbn/dev-utils';
import { readConfigFile, KbnClient } from '@kbn/test';
import { Client } from '@elastic/elasticsearch';

import { EsArchiver } from './es_archiver';
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/es_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

import { Client } from '@elastic/elasticsearch';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';

import {
saveAction,
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import { inspect } from 'util';

import { Client } from '@elastic/elasticsearch';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { Stats } from '../stats';
import { deleteIndex } from './delete_index';
import { ES_CLIENT_HEADERS } from '../../client_headers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ export const schema = Joi.object()
})
.default(),

// settings for the saved objects svc
kbnArchiver: Joi.object()
.keys({
directory: Joi.string().default(defaultRelativeToConfigPath('fixtures/kbn_archiver')),
})
.default(),

// settings for the kibanaServer.uiSettings module
uiSettings: Joi.object()
.keys({
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ export { getUrl } from './jest/utils/get_url';
export { runCheckJestConfigsCli } from './jest/run_check_jest_configs_cli';

export { runJest } from './jest/run';

export * from './kbn_archiver_cli';

export * from './kbn_client';
Loading

0 comments on commit bd093f7

Please sign in to comment.