Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/plugins/console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ Autocomplete definitions are all created in the form of javascript objects loade
### Creating definitions
The [`generated`](https://github.com/elastic/kibana/blob/main/src/plugins/console/server/lib/spec_definitions/json/generated) folder contains definitions created automatically from Elasticsearch REST API specifications. See this [README](https://github.com/elastic/kibana/blob/main/packages/kbn-spec-to-console/README.md) file for more information on the `spec-to-console` script.

Manually created override files in the [`overrides`](https://github.com/elastic/kibana/blob/main/src/plugins/console/server/lib/spec_definitions/json/overrides) folder contain fixes for generated files and additions for request body parameters.
Manually created override files in the [`overrides`](https://github.com/elastic/kibana/blob/main/src/plugins/console/server/lib/spec_definitions/json/overrides) folder contain additions for request body parameters since those
are not created by the script. Any other fixes such as documentation links, request methods and patterns and url parameters
should be addressed at the source. That means this should be fixed in Elasticsearch REST API specifications and then
autocomplete definitions can be re-generated with the script.

If there are any endpoints missing completely from the `generated` folder, this should also be addressed at the source, i.e.
Elasticsearch REST API specifications. If for some reason, that is not possible, then additional definitions files
can be placed in the folder [`manual`]((https://github.com/elastic/kibana/blob/main/src/plugins/console/server/lib/spec_definitions/json/manual)).

### Top level keys
Use following top level keys in the definitions objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ export const AUTOCOMPLETE_DEFINITIONS_FOLDER = resolve(
__dirname,
'../../server/lib/spec_definitions/json'
);

export const GENERATED_SUBFOLDER = 'generated';
export const OVERRIDES_SUBFOLDER = 'overrides';
export const MANUAL_SUBFOLDER = 'manual';
7 changes: 6 additions & 1 deletion src/plugins/console/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
export { MAJOR_VERSION } from './plugin';
export { API_BASE_PATH, KIBANA_API_PREFIX } from './api';
export { DEFAULT_VARIABLES } from './variables';
export { AUTOCOMPLETE_DEFINITIONS_FOLDER } from './autocomplete_definitions';
export {
AUTOCOMPLETE_DEFINITIONS_FOLDER,
GENERATED_SUBFOLDER,
OVERRIDES_SUBFOLDER,
MANUAL_SUBFOLDER,
} from './autocomplete_definitions';
23 changes: 23 additions & 0 deletions src/plugins/console/common/types/autocomplete_definitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export type EndpointsAvailability = 'stack' | 'serverless';

export interface EndpointDescription {
methods?: string[];
patterns?: string | string[];
url_params?: Record<string, unknown>;
data_autocomplete_rules?: Record<string, unknown>;
url_components?: Record<string, unknown>;
priority?: number;
availability?: Record<EndpointsAvailability, boolean>;
}

export interface EndpointDefinition {
[endpointName: string]: EndpointDescription;
}
1 change: 1 addition & 0 deletions src/plugins/console/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

export * from './models';
export * from './plugin_config';
export * from './autocomplete_definitions';
5 changes: 3 additions & 2 deletions src/plugins/console/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ const schemaLatest = schema.object(
}),
autocompleteDefinitions: schema.object({
// Only displays the endpoints that are available in the specified environment
// Current supported values are 'stack' and 'serverless'
endpointsAvailability: schema.string({ defaultValue: 'stack' }),
endpointsAvailability: schema.oneOf([schema.literal('stack'), schema.literal('serverless')], {
defaultValue: 'stack',
}),
}),
},
{ defaultValue: undefined }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please refer to this [README](https://github.com/elastic/kibana/blob/main/src/plugins/console/README.md#creating-definitions) file before adding/editing definitions files in this folder.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading