[7.x] Create runtime field plugin, runtime field editor plugin (#87387) (#87728)

* Create runtime field plugin, runtime field editor plugin (#87387)
This commit is contained in:
Matthew Kime 2021-01-07 17:12:27 -06:00 committed by GitHub
parent 1bb1c030f6
commit 74c4781841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 129 additions and 26 deletions

View file

@ -164,6 +164,10 @@ Content is fetched from the remote (https://feeds.elastic.co and https://feeds-s
|Create choropleth maps. Display the results of a term-aggregation as e.g. countries, zip-codes, states.
|{kib-repo}blob/{branch}/src/plugins/runtime_fields/README.mdx[runtimeFields]
|The runtime fields plugin provides types and constants for OSS and xpack runtime field related code.
|{kib-repo}blob/{branch}/src/plugins/saved_objects/README.md[savedObjects]
|The savedObjects plugin exposes utilities to manipulate saved objects on the client side.
@ -479,8 +483,8 @@ Elastic.
|Welcome to the Kibana rollup plugin! This plugin provides Kibana support for Elasticsearch's rollup feature. Please refer to the Elasticsearch documentation to understand rollup indices and how to create rollup jobs.
|{kib-repo}blob/{branch}/x-pack/plugins/runtime_fields/README.md[runtimeFields]
|Welcome to the home of the runtime field editor and everything related to runtime fields!
|{kib-repo}blob/{branch}/x-pack/plugins/runtime_field_editor/README.md[runtimeFieldEditor]
|Welcome to the home of the runtime field editor!
|{kib-repo}blob/{branch}/x-pack/plugins/saved_objects_tagging/README.md[savedObjectsTagging]

View file

@ -102,6 +102,7 @@ pageLoadAssetSize:
visualizations: 295169
visualize: 57433
watcher: 43742
runtimeFields: 10000
stackAlerts: 29684
runtimeFields: 41752
presentationUtil: 28545
runtimeFieldEditor: 46986

View file

@ -0,0 +1,4 @@
# Runtime Fields
The runtime fields plugin provides types and constants for OSS and xpack runtime field related code.

View file

@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export const RUNTIME_FIELD_TYPES = ['keyword', 'long', 'double', 'date', 'ip', 'boolean'] as const;

View file

@ -0,0 +1,21 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export * from './constants';
export * from './types';

View file

@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { RUNTIME_FIELD_TYPES } from './constants';
export type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
export interface RuntimeField {
name: string;
type: RuntimeType;
script: {
source: string;
};
}

View file

@ -0,0 +1,6 @@
{
"id": "runtimeFields",
"version": "kibana",
"server": false,
"ui": true
}

View file

@ -0,0 +1,28 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export * from '../common';
export function plugin() {
return {
setup() {},
start() {},
stop() {},
};
}

View file

@ -42,7 +42,7 @@
"xpack.remoteClusters": "plugins/remote_clusters",
"xpack.reporting": ["plugins/reporting"],
"xpack.rollupJobs": ["plugins/rollup"],
"xpack.runtimeFields": "plugins/runtime_fields",
"xpack.runtimeFields": "plugins/runtime_field_editor",
"xpack.searchProfiler": "plugins/searchprofiler",
"xpack.security": "plugins/security",
"xpack.server": "legacy/server",

View file

@ -9,6 +9,6 @@
"requiredBundles": [
"kibanaReact",
"esUiShared",
"runtimeFields"
"runtimeFieldEditor"
]
}

View file

@ -58,7 +58,7 @@ export {
RuntimeField,
RuntimeFieldEditorFlyoutContent,
RuntimeFieldEditorFlyoutContentProps,
} from '../../../../../runtime_fields/public';
} from '../../../../../runtime_field_editor/public';
export { createKibanaReactContext } from '../../../../../../../src/plugins/kibana_react/public';

View file

@ -1,6 +1,6 @@
# Runtime fields
# Runtime fields editor
Welcome to the home of the runtime field editor and everything related to runtime fields!
Welcome to the home of the runtime field editor!
## The runtime field editor

View file

@ -7,5 +7,5 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/plugins/runtime_fields'],
roots: ['<rootDir>/x-pack/plugins/runtime_field_editor'],
};

View file

@ -1,5 +1,5 @@
{
"id": "runtimeFields",
"id": "runtimeFieldEditor",
"version": "kibana",
"server": false,
"ui": true,

View file

@ -3,11 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ComboBoxOption } from './types';
export const RUNTIME_FIELD_TYPES = ['keyword', 'long', 'double', 'date', 'ip', 'boolean'] as const;
type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
import { ComboBoxOption, RuntimeType } from './types';
export const RUNTIME_FIELD_OPTIONS: Array<ComboBoxOption<RuntimeType>> = [
{

View file

@ -4,8 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { DataPublicPluginStart } from 'src/plugins/data/public';
export type {
RuntimeField,
RuntimeType,
RUNTIME_FIELD_TYPES,
} from 'src/plugins/runtime_fields/common';
import { RUNTIME_FIELD_TYPES } from './constants';
import { OpenRuntimeFieldEditorProps } from './load_editor';
export interface LoadEditorResponse {
@ -26,16 +30,6 @@ export interface StartPlugins {
data: DataPublicPluginStart;
}
export type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
export interface RuntimeField {
name: string;
type: RuntimeType;
script: {
source: string;
};
}
export interface ComboBoxOption<T = unknown> {
label: string;
value?: T;