Skip to content

Commit

Permalink
Merge branch 'main' into multi-field-terms
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Nov 23, 2021
2 parents 2203e2e + 4706a8b commit 46ba8ed
Show file tree
Hide file tree
Showing 608 changed files with 6,968 additions and 3,198 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@
/src/plugins/navigation/ @elastic/kibana-app-services
/src/plugins/share/ @elastic/kibana-app-services
/src/plugins/ui_actions/ @elastic/kibana-app-services
/src/plugins/index_pattern_field_editor @elastic/kibana-app-services
/src/plugins/data_view_field_editor @elastic/kibana-app-services
/src/plugins/screenshot_mode @elastic/kibana-app-services
/src/plugins/bfetch/ @elastic/kibana-app-services
/src/plugins/index_pattern_management/ @elastic/kibana-app-services
/src/plugins/data_view_management/ @elastic/kibana-app-services
/src/plugins/inspector/ @elastic/kibana-app-services
/x-pack/examples/ui_actions_enhanced_examples/ @elastic/kibana-app-services
/x-pack/plugins/data_enhanced/ @elastic/kibana-app-services
Expand Down
5 changes: 2 additions & 3 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"home": "src/plugins/home",
"flot": "packages/kbn-ui-shared-deps-src/src/flot_charts",
"charts": "src/plugins/charts",
"customIntegrations": "src/plugins/custom_integrations",
"esUi": "src/plugins/es_ui_shared",
"devTools": "src/plugins/dev_tools",
"expressions": "src/plugins/expressions",
Expand All @@ -43,8 +42,8 @@
"esQuery": "packages/kbn-es-query/src",
"presentationUtil": "src/plugins/presentation_util",
"indexPatternEditor": "src/plugins/index_pattern_editor",
"indexPatternFieldEditor": "src/plugins/index_pattern_field_editor",
"indexPatternManagement": "src/plugins/index_pattern_management",
"indexPatternFieldEditor": "src/plugins/data_view_field_editor",
"indexPatternManagement": "src/plugins/data_view_management",
"interactiveSetup": "src/plugins/interactive_setup",
"advancedSettings": "src/plugins/advanced_settings",
"kibana_legacy": "src/plugins/kibana_legacy",
Expand Down
16 changes: 8 additions & 8 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ as uiSettings within the code.
|The data plugin provides common data access services, such as search and query, for solutions and application developers.
|{kib-repo}blob/{branch}/src/plugins/data_view_field_editor/README.md[dataViewFieldEditor]
|The reusable field editor across Kibana!
|{kib-repo}blob/{branch}/src/plugins/data_view_management[dataViewManagement]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/data_views/README.mdx[dataViews]
|The data views API provides a consistent method of structuring and formatting documents
and field lists across the various Kibana apps. Its typically used in conjunction with
Expand Down Expand Up @@ -141,14 +149,6 @@ for use in their own application.
|Create index patterns from within Kibana apps.
|{kib-repo}blob/{branch}/src/plugins/index_pattern_field_editor/README.md[indexPatternFieldEditor]
|The reusable field editor across Kibana!
|{kib-repo}blob/{branch}/src/plugins/index_pattern_management[indexPatternManagement]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/input_control_vis/README.md[inputControlVis]
|Contains the input control visualization allowing to place custom filter controls on a dashboard.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ readonly links: {
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
readonly fleet: Readonly<{
datastreamsILM: string;
beatsAgentComparison: string;
guide: string;
fleetServer: string;
Expand Down

Large diffs are not rendered by default.

Binary file added docs/osquery/images/mapped-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/osquery/images/scheduled-pack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/osquery/images/scheduled-query-groupds.png
Binary file not shown.
394 changes: 161 additions & 233 deletions docs/osquery/osquery.asciidoc

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions examples/data_view_field_editor_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Data view field editor example

This example data view field editor app shows how to:
- Edit data view fields via flyout
- Delete data view runtime fields with modal confirm prompt

To run this example, use the command `yarn start --run-examples`.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"id": "indexPatternFieldEditorExample",
"id": "dataViewFieldEditorExample",
"kibanaVersion": "kibana",
"version": "0.0.1",
"server": false,
"ui": true,
"requiredPlugins": ["data", "indexPatternFieldEditor", "developerExamples"],
"requiredPlugins": ["data", "dataViewFieldEditor", "developerExamples"],
"optionalPlugins": [],
"requiredBundles": [],
"owner": {
"name": "App Services",
"githubTeam": "kibana-app-services"
},
"description": "Index pattern field editor example app"
"description": "Data view field editor example app"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import {
IndexPattern,
IndexPatternField,
} from '../../../src/plugins/data/public';
import { IndexPatternFieldEditorStart } from '../../../src/plugins/index_pattern_field_editor/public';
import { IndexPatternFieldEditorStart } from '../../../src/plugins/data_view_field_editor/public';

interface Props {
indexPattern?: IndexPattern;
indexPatternFieldEditor: IndexPatternFieldEditorStart;
dataViewFieldEditor: IndexPatternFieldEditorStart;
}

const IndexPatternFieldEditorExample = ({ indexPattern, indexPatternFieldEditor }: Props) => {
const IndexPatternFieldEditorExample = ({ indexPattern, dataViewFieldEditor }: Props) => {
const [fields, setFields] = useState<IndexPatternField[]>(
indexPattern?.getNonScriptedFields() || []
);
Expand All @@ -52,8 +52,8 @@ const IndexPatternFieldEditorExample = ({ indexPattern, indexPatternFieldEditor
type: 'icon',
'data-test-subj': 'editField',
onClick: (fld: IndexPatternField) =>
indexPatternFieldEditor.openEditor({
ctx: { indexPattern: indexPattern! },
dataViewFieldEditor.openEditor({
ctx: { dataView: indexPattern! },
fieldName: fld.name,
onSave: refreshFields,
}),
Expand All @@ -66,10 +66,10 @@ const IndexPatternFieldEditorExample = ({ indexPattern, indexPatternFieldEditor
'data-test-subj': 'deleteField',
available: (fld) => !!fld.runtimeField,
onClick: (fld: IndexPatternField) =>
indexPatternFieldEditor.openDeleteModal({
dataViewFieldEditor.openDeleteModal({
fieldName: fld.name,
ctx: {
indexPattern: indexPattern!,
dataView: indexPattern!,
},
onDelete: refreshFields,
}),
Expand All @@ -84,8 +84,8 @@ const IndexPatternFieldEditorExample = ({ indexPattern, indexPatternFieldEditor
<div>
<EuiButton
onClick={() =>
indexPatternFieldEditor.openEditor({
ctx: { indexPattern: indexPattern! },
dataViewFieldEditor.openEditor({
ctx: { dataView: indexPattern! },
onSave: refreshFields,
})
}
Expand Down Expand Up @@ -125,18 +125,18 @@ const IndexPatternFieldEditorExample = ({ indexPattern, indexPatternFieldEditor

interface RenderAppDependencies {
data: DataPublicPluginStart;
indexPatternFieldEditor: IndexPatternFieldEditorStart;
dataViewFieldEditor: IndexPatternFieldEditorStart;
}

export const renderApp = async (
{ data, indexPatternFieldEditor }: RenderAppDependencies,
{ data, dataViewFieldEditor }: RenderAppDependencies,
{ element }: AppMountParameters
) => {
const indexPattern = (await data.indexPatterns.getDefault()) || undefined;
ReactDOM.render(
<IndexPatternFieldEditorExample
indexPattern={indexPattern}
indexPatternFieldEditor={indexPatternFieldEditor}
dataViewFieldEditor={dataViewFieldEditor}
/>,
element
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import { Plugin, CoreSetup, AppMountParameters, AppNavLinkStatus } from '../../../src/core/public';
import { DeveloperExamplesSetup } from '../../developer_examples/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
import { IndexPatternFieldEditorStart } from '../../../src/plugins/index_pattern_field_editor/public';
import { IndexPatternFieldEditorStart } from '../../../src/plugins/data_view_field_editor/public';

interface StartDeps {
data: DataPublicPluginStart;
indexPatternFieldEditor: IndexPatternFieldEditorStart;
dataViewFieldEditor: IndexPatternFieldEditorStart;
}

interface SetupDeps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
{ "path": "../../src/plugins/data/tsconfig.json" },
{ "path": "../../src/plugins/index_pattern_field_editor/tsconfig.json" },
{ "path": "../../src/plugins/data_view_field_editor/tsconfig.json" },
{ "path": "../developer_examples/tsconfig.json" },
]
}
2 changes: 1 addition & 1 deletion examples/field_formats_example/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"githubTeam": "kibana-app-services"
},
"description": "A plugin that demonstrates field formats usage",
"requiredPlugins": ["developerExamples", "fieldFormats", "indexPatternFieldEditor", "data"]
"requiredPlugins": ["developerExamples", "fieldFormats", "dataViewFieldEditor", "data"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
FieldFormatEditor,
FieldFormatEditorFactory,
IndexPatternFieldEditorSetup,
} from '../../../../src/plugins/index_pattern_field_editor/public';
} from '../../../../src/plugins/data_view_field_editor/public';
import { ExampleCurrencyFormat } from './2_creating_custom_formatter';

// 1. Create an editor component
Expand Down
12 changes: 6 additions & 6 deletions examples/field_formats_example/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ import { registerExampleFormat } from './examples/2_creating_custom_formatter';
import {
IndexPatternFieldEditorStart,
IndexPatternFieldEditorSetup,
} from '../../../src/plugins/index_pattern_field_editor/public';
} from '../../../src/plugins/data_view_field_editor/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
import { registerExampleFormatEditor } from './examples/3_creating_custom_format_editor';
import img from './formats.png';

interface SetupDeps {
developerExamples: DeveloperExamplesSetup;
fieldFormats: FieldFormatsSetup;
indexPatternFieldEditor: IndexPatternFieldEditorSetup;
dataViewFieldEditor: IndexPatternFieldEditorSetup;
}

interface StartDeps {
fieldFormats: FieldFormatsStart;
indexPatternFieldEditor: IndexPatternFieldEditorStart;
dataViewFieldEditor: IndexPatternFieldEditorStart;
data: DataPublicPluginStart;
}

export class FieldFormatsExamplePlugin implements Plugin<void, void, SetupDeps, StartDeps> {
public setup(core: CoreSetup<StartDeps>, deps: SetupDeps) {
registerExampleFormat(deps.fieldFormats);
registerExampleFormatEditor(deps.indexPatternFieldEditor);
registerExampleFormatEditor(deps.dataViewFieldEditor);

// just for demonstration purposes:
// opens a field editor using default index pattern and first number field
Expand All @@ -65,9 +65,9 @@ export class FieldFormatsExamplePlugin implements Plugin<void, void, SetupDeps,
return;
}

plugins.indexPatternFieldEditor.openEditor({
plugins.dataViewFieldEditor.openEditor({
ctx: {
indexPattern,
dataView: indexPattern,
},
fieldName: numberField.name,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/field_formats_example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
{ "path": "../developer_examples/tsconfig.json" },
{ "path": "../../src/plugins/field_formats/tsconfig.json" },
{ "path": "../../src/plugins/data/tsconfig.json" },
{ "path": "../../src/plugins/index_pattern_field_editor/tsconfig.json" }
{ "path": "../../src/plugins/data_view_field_editor/tsconfig.json" }
]
}
7 changes: 0 additions & 7 deletions examples/index_pattern_field_editor_example/README.md

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"@turf/distance": "6.0.1",
"@turf/helpers": "6.0.1",
"@turf/length": "^6.0.2",
"@types/jsonwebtoken": "^8.5.6",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.7.3",
Expand Down
1 change: 1 addition & 0 deletions packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ module.exports = {
'@kbn/eslint/no_async_foreach': 'error',
'@kbn/eslint/no_trailing_import_slash': 'error',
'@kbn/eslint/no_constructor_args_in_property_initializers': 'error',
'@kbn/eslint/no_this_in_property_initializers': 'error',
},
};
1 change: 1 addition & 0 deletions packages/kbn-eslint-plugin-eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ module.exports = {
no_async_foreach: require('./rules/no_async_foreach'),
no_trailing_import_slash: require('./rules/no_trailing_import_slash'),
no_constructor_args_in_property_initializers: require('./rules/no_constructor_args_in_property_initializers'),
no_this_in_property_initializers: require('./rules/no_this_in_property_initializers'),
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module.exports = {
node.type === esTypes.FunctionExpression ||
node.type === esTypes.ArrowFunctionExpression
) {
return traverse.STOP;
return traverse.SKIP;
}

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ ruleTester.run('@kbn/eslint/no_constructor_args_in_property_initializers', rule,
],

invalid: [
// no catch
{
code: dedent`
class Foo {
Expand Down Expand Up @@ -96,5 +95,25 @@ ruleTester.run('@kbn/eslint/no_constructor_args_in_property_initializers', rule,
},
],
},
{
code: dedent`
class Foo {
readonly bar = y(this.deps.history).x(
() => {
this.deps.usage()
}
);
constructor(private readonly deps: unknown) {}
}
`,
errors: [
{
line: 2,
message: `The constructor argument "deps" can't be used in a class property intializer, define the property in the constructor instead`,
},
],
},
],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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.
*/

const tsEstree = require('@typescript-eslint/typescript-estree');
const traverse = require('eslint-traverse');
const esTypes = tsEstree.AST_NODE_TYPES;

/** @typedef {import("eslint").Rule.RuleModule} Rule */
/** @typedef {import("@typescript-eslint/typescript-estree").TSESTree.Node} Node */
/** @typedef {import("@typescript-eslint/typescript-estree").TSESTree.ClassBody} ClassBody */

/**
* @param {string} arg
*/
const ERROR_MSG = `"this" is not fully initialized in class property intializers, define the value for this property in the constructor instead`;

/** @type {Rule} */
module.exports = {
meta: {
schema: [],
},
create: (context) => ({
ClassBody(_) {
const node = /** @type {ClassBody} */ (_);

for (const prop of node.body) {
if (prop.type !== esTypes.PropertyDefinition) {
continue;
}

const visitor = (path) => {
/** @type {Node} node */
const node = path.node;

if (
node.type === esTypes.FunctionExpression ||
node.type === esTypes.ArrowFunctionExpression
) {
return traverse.STOP;
}

if (
node.type === esTypes.ThisExpression &&
node.parent?.type !== esTypes.MemberExpression
) {
context.report({
message: ERROR_MSG,
loc: node.loc,
});
}
};

traverse(context, prop, visitor);
}
},
}),
};
Loading

0 comments on commit 46ba8ed

Please sign in to comment.