diff --git a/.eslintrc.js b/.eslintrc.js index c328cb1618bb6..865bcc008afbc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -794,6 +794,7 @@ module.exports = { { files: ['x-pack/plugins/fleet/**/*.{js,mjs,ts,tsx}'], rules: { + '@typescript-eslint/consistent-type-imports': 'error', 'import/order': [ 'warn', { diff --git a/api_docs/data.json b/api_docs/data.json index 612b911915f9d..7989768e180ce 100644 --- a/api_docs/data.json +++ b/api_docs/data.json @@ -23950,37 +23950,6 @@ "returnComment": [], "initialIsOpen": false }, - { - "id": "def-common.doesKueryExpressionHaveLuceneSyntaxError", - "type": "Function", - "children": [ - { - "type": "Any", - "label": "expression", - "isRequired": true, - "signature": [ - "any" - ], - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 60 - } - } - ], - "signature": [ - "(expression: any) => boolean" - ], - "description": [], - "label": "doesKueryExpressionHaveLuceneSyntaxError", - "source": { - "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 59 - }, - "tags": [], - "returnComment": [], - "initialIsOpen": false - }, { "id": "def-common.enableFilter", "type": "Function", @@ -25761,7 +25730,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 78 + "lineNumber": 67 } }, { @@ -25781,7 +25750,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 79 + "lineNumber": 68 } }, { @@ -25794,7 +25763,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 80 + "lineNumber": 69 } }, { @@ -25807,7 +25776,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 81 + "lineNumber": 70 } } ], @@ -25841,7 +25810,7 @@ "label": "toElasticsearchQuery", "source": { "path": "src/plugins/data/common/es_query/kuery/ast/ast.ts", - "lineNumber": 77 + "lineNumber": 66 }, "tags": [ "params" @@ -26395,17 +26364,6 @@ "lineNumber": 23 } }, - { - "tags": [], - "id": "def-common.KueryParseOptions.errorOnLuceneSyntax", - "type": "boolean", - "label": "errorOnLuceneSyntax", - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/kuery/types.ts", - "lineNumber": 24 - } - }, { "tags": [], "id": "def-common.KueryParseOptions.cursorSymbol", @@ -26414,7 +26372,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/types.ts", - "lineNumber": 25 + "lineNumber": 24 }, "signature": [ "string | undefined" @@ -26428,7 +26386,7 @@ "description": [], "source": { "path": "src/plugins/data/common/es_query/kuery/types.ts", - "lineNumber": 26 + "lineNumber": 25 }, "signature": [ "boolean | undefined" diff --git a/api_docs/ml.json b/api_docs/ml.json index f626cf8dc3ba0..3a3463b7397e2 100644 --- a/api_docs/ml.json +++ b/api_docs/ml.json @@ -546,7 +546,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 80 + "lineNumber": 94 }, "signature": [ { @@ -567,7 +567,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 81 + "lineNumber": 95 }, "signature": [ { @@ -588,7 +588,7 @@ "description": [], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 82 + "lineNumber": 96 }, "signature": [ "{ search: ", @@ -621,7 +621,7 @@ ], "source": { "path": "x-pack/plugins/ml/common/types/modules.ts", - "lineNumber": 79 + "lineNumber": 93 }, "initialIsOpen": false }, diff --git a/api_docs/saved_objects.json b/api_docs/saved_objects.json index e4b71b23a047e..a3bc4b059c712 100644 --- a/api_docs/saved_objects.json +++ b/api_docs/saved_objects.json @@ -220,11 +220,11 @@ { "id": "def-public.SavedObjectLoader", "type": "Class", - "tags": [], - "label": "SavedObjectLoader", - "description": [ - "\nThe SavedObjectLoader class provides some convenience functions\nto load and save one kind of saved objects (specified in the constructor).\n\nIt is based on the SavedObjectClient which implements loading and saving\nin an abstract, type-agnostic way. If possible, use SavedObjectClient directly\nto avoid pulling in extra functionality which isn't used." + "tags": [ + "deprecated" ], + "label": "SavedObjectLoader", + "description": [], "children": [ { "tags": [], @@ -234,7 +234,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 34 + "lineNumber": 35 } }, { @@ -245,7 +245,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 35 + "lineNumber": 36 } }, { @@ -256,7 +256,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 36 + "lineNumber": 37 }, "signature": [ "Record" @@ -281,7 +281,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 39 + "lineNumber": 40 } }, { @@ -302,7 +302,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 40 + "lineNumber": 41 } } ], @@ -310,7 +310,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 38 + "lineNumber": 39 } }, { @@ -334,7 +334,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 60 + "lineNumber": 61 } } ], @@ -342,7 +342,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 60 + "lineNumber": 61 } }, { @@ -364,7 +364,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 68 + "lineNumber": 69 } } ], @@ -372,7 +372,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 68 + "lineNumber": 69 } }, { @@ -394,7 +394,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 72 + "lineNumber": 73 } } ], @@ -402,7 +402,7 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 72 + "lineNumber": 73 } }, { @@ -434,7 +434,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 92 + "lineNumber": 93 } }, { @@ -447,7 +447,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 93 + "lineNumber": 94 } }, { @@ -467,7 +467,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 94 + "lineNumber": 95 } } ], @@ -477,7 +477,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 91 + "lineNumber": 92 } }, { @@ -514,7 +514,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 113 + "lineNumber": 114 }, "signature": [ "Record" @@ -528,7 +528,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 114 + "lineNumber": 115 } }, { @@ -539,7 +539,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 115 + "lineNumber": 116 }, "signature": [ { @@ -555,7 +555,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 112 + "lineNumber": 113 } } ], @@ -565,7 +565,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 108 + "lineNumber": 109 } }, { @@ -595,7 +595,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 152 + "lineNumber": 153 } }, { @@ -615,7 +615,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 152 + "lineNumber": 153 } } ], @@ -623,20 +623,22 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 152 + "lineNumber": 153 } } ], "source": { "path": "src/plugins/saved_objects/public/saved_object/saved_object_loader.ts", - "lineNumber": 32 + "lineNumber": 33 }, "initialIsOpen": false }, { "id": "def-public.SavedObjectSaveModal", "type": "Class", - "tags": [], + "tags": [ + "deprecated" + ], "label": "SavedObjectSaveModal", "description": [], "signature": [ @@ -671,7 +673,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 72 + "lineNumber": 73 } }, { @@ -682,7 +684,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 73 + "lineNumber": 74 } }, { @@ -693,7 +695,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 74 + "lineNumber": 75 } }, { @@ -704,7 +706,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 75 + "lineNumber": 76 } }, { @@ -715,7 +717,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 76 + "lineNumber": 77 } }, { @@ -726,7 +728,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 77 + "lineNumber": 78 } } ], @@ -734,7 +736,7 @@ "label": "state", "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 71 + "lineNumber": 72 } }, { @@ -750,13 +752,13 @@ "returnComment": [], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 80 + "lineNumber": 81 } } ], "source": { "path": "src/plugins/saved_objects/public/save_modal/saved_object_save_modal.tsx", - "lineNumber": 69 + "lineNumber": 70 }, "initialIsOpen": false } @@ -1517,7 +1519,9 @@ "type": "Interface", "label": "SavedObject", "description": [], - "tags": [], + "tags": [ + "deprecated" + ], "children": [ { "tags": [], @@ -1527,7 +1531,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 25 + "lineNumber": 26 }, "signature": [ "() => { attributes: ", @@ -1557,7 +1561,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 26 + "lineNumber": 27 }, "signature": [ "Record" @@ -1571,7 +1575,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 27 + "lineNumber": 28 }, "signature": [ "(resp: Record) => Promise<", @@ -1593,7 +1597,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 28 + "lineNumber": 29 } }, { @@ -1604,7 +1608,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 29 + "lineNumber": 30 }, "signature": [ "(opts: ", @@ -1626,7 +1630,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 30 + "lineNumber": 31 }, "signature": [ "any" @@ -1640,7 +1644,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 31 + "lineNumber": 32 }, "signature": [ "(() => Promise<{}>) | undefined" @@ -1654,7 +1658,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 32 + "lineNumber": 33 }, "signature": [ "() => void" @@ -1668,7 +1672,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 33 + "lineNumber": 34 }, "signature": [ "() => string" @@ -1682,7 +1686,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 34 + "lineNumber": 35 }, "signature": [ "() => string" @@ -1696,7 +1700,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 35 + "lineNumber": 36 }, "signature": [ "() => string" @@ -1710,7 +1714,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 36 + "lineNumber": 37 }, "signature": [ "((id?: string | undefined) => Promise<", @@ -1732,7 +1736,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 37 + "lineNumber": 38 }, "signature": [ "string | undefined" @@ -1746,7 +1750,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 38 + "lineNumber": 39 }, "signature": [ "(() => Promise<", @@ -1768,7 +1772,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 39 + "lineNumber": 40 } }, { @@ -1779,7 +1783,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 40 + "lineNumber": 41 }, "signature": [ "() => boolean" @@ -1793,7 +1797,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 41 + "lineNumber": 42 } }, { @@ -1804,7 +1808,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 42 + "lineNumber": 43 }, "signature": [ "Record | undefined" @@ -1818,7 +1822,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 43 + "lineNumber": 44 }, "signature": [ "(saveOptions: ", @@ -1840,7 +1844,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 44 + "lineNumber": 45 }, "signature": [ "Pick<", @@ -1862,7 +1866,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 45 + "lineNumber": 46 }, "signature": [ { @@ -1883,7 +1887,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 46 + "lineNumber": 47 } }, { @@ -1894,7 +1898,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 47 + "lineNumber": 48 } }, { @@ -1905,7 +1909,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 48 + "lineNumber": 49 }, "signature": [ { @@ -1921,7 +1925,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 24 + "lineNumber": 25 }, "initialIsOpen": false }, @@ -1940,7 +1944,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 78 + "lineNumber": 79 }, "signature": [ "((savedObject: ", @@ -1970,7 +1974,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 79 + "lineNumber": 80 }, "signature": [ "any" @@ -1984,7 +1988,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 80 + "lineNumber": 81 }, "signature": [ "((opts: ", @@ -2014,7 +2018,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 81 + "lineNumber": 82 }, "signature": [ "( void) | undefined" @@ -2072,7 +2076,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 84 + "lineNumber": 85 }, "signature": [ { @@ -2093,7 +2097,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 85 + "lineNumber": 86 }, "signature": [ "Record | undefined" @@ -2107,7 +2111,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 86 + "lineNumber": 87 }, "signature": [ "Record | undefined" @@ -2121,7 +2125,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 87 + "lineNumber": 88 }, "signature": [ "string | undefined" @@ -2135,7 +2139,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 88 + "lineNumber": 89 }, "signature": [ "boolean | Pick<", @@ -2157,7 +2161,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 89 + "lineNumber": 90 }, "signature": [ "string | undefined" @@ -2166,7 +2170,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 76 + "lineNumber": 77 }, "initialIsOpen": false }, @@ -2599,7 +2603,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 52 + "lineNumber": 53 }, "signature": [ "boolean | undefined" @@ -2613,7 +2617,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 53 + "lineNumber": 54 }, "signature": [ "boolean | undefined" @@ -2627,7 +2631,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 54 + "lineNumber": 55 }, "signature": [ "(() => void) | undefined" @@ -2641,7 +2645,7 @@ "description": [], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 55 + "lineNumber": 56 }, "signature": [ "boolean | undefined" @@ -2650,7 +2654,7 @@ ], "source": { "path": "src/plugins/saved_objects/public/types.ts", - "lineNumber": 51 + "lineNumber": 52 }, "initialIsOpen": false }, @@ -2819,14 +2823,16 @@ "tags": [], "children": [ { - "tags": [], + "tags": [ + "deprecated" + ], "id": "def-public.SavedObjectsStart.SavedObjectClass", "type": "Object", "label": "SavedObjectClass", "description": [], "source": { "path": "src/plugins/saved_objects/public/plugin.ts", - "lineNumber": 26 + "lineNumber": 27 }, "signature": [ "new (raw: Record) => ", @@ -2840,14 +2846,16 @@ ] }, { - "tags": [], + "tags": [ + "deprecated" + ], "id": "def-public.SavedObjectsStart.settings", "type": "Object", "label": "settings", "description": [], "source": { "path": "src/plugins/saved_objects/public/plugin.ts", - "lineNumber": 27 + "lineNumber": 29 }, "signature": [ "{ getPerPage: () => number; getListingLimit: () => number; }" diff --git a/api_docs/security.json b/api_docs/security.json index 5c605debf1908..8e1214654a82f 100644 --- a/api_docs/security.json +++ b/api_docs/security.json @@ -445,6 +445,20 @@ "signature": [ "number | undefined" ] + }, + { + "tags": [], + "id": "def-public.UserMenuLink.setAsProfile", + "type": "CompoundType", + "label": "setAsProfile", + "description": [], + "source": { + "path": "x-pack/plugins/security/public/nav_control/nav_control_component.tsx", + "lineNumber": 33 + }, + "signature": [ + "boolean | undefined" + ] } ], "source": { diff --git a/api_docs/visualizations.json b/api_docs/visualizations.json index 2357e8b12608b..d66aa8b8cbe67 100644 --- a/api_docs/visualizations.json +++ b/api_docs/visualizations.json @@ -476,7 +476,8 @@ "docId": "kibVisualizationsPluginApi", "section": "def-public.SerializedVis", "text": "SerializedVis" - } + }, + "" ], "description": [], "source": { @@ -505,7 +506,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ", \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">, \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", { "pluginId": "visualizations", "scope": "public", @@ -538,7 +547,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ", \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">, \"type\" | \"id\" | \"description\" | \"title\" | \"params\" | \"uiState\"> & Pick<{ data: Partial<", { "pluginId": "visualizations", "scope": "public", @@ -583,15 +600,7 @@ "section": "def-public.Vis", "text": "Vis" }, - "<", - { - "pluginId": "visualizations", - "scope": "common", - "docId": "kibVisualizationsPluginApi", - "section": "def-common.VisParams", - "text": "VisParams" - }, - ">" + "" ], "description": [], "children": [], @@ -614,7 +623,16 @@ "docId": "kibVisualizationsPluginApi", "section": "def-public.SerializedVis", "text": "SerializedVis" - } + }, + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">" ], "description": [], "children": [], @@ -1393,6 +1411,16 @@ "id": "def-public.SerializedVis", "type": "Interface", "label": "SerializedVis", + "signature": [ + { + "pluginId": "visualizations", + "scope": "public", + "docId": "kibVisualizationsPluginApi", + "section": "def-public.SerializedVis", + "text": "SerializedVis" + }, + "" + ], "description": [], "tags": [], "children": [ @@ -1449,7 +1477,7 @@ { "tags": [], "id": "def-public.SerializedVis.params", - "type": "Object", + "type": "Uncategorized", "label": "params", "description": [], "source": { @@ -1457,13 +1485,7 @@ "lineNumber": 47 }, "signature": [ - { - "pluginId": "visualizations", - "scope": "common", - "docId": "kibVisualizationsPluginApi", - "section": "def-common.VisParams", - "text": "VisParams" - } + "T" ] }, { @@ -2922,7 +2944,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - " | undefined" + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + "> | undefined" ] }, { @@ -3213,7 +3243,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - " | undefined; }, parent?: ", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + "> | undefined; }, parent?: ", { "pluginId": "embeddable", "scope": "public", @@ -3228,14 +3266,6 @@ "docId": "kibEmbeddablePluginApi", "section": "def-public.ContainerInput", "text": "ContainerInput" - }, - "<{}>, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" } ], "initialIsOpen": false @@ -3433,7 +3463,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ") => Promise<", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">) => Promise<", { "pluginId": "visualizations", "scope": "public", @@ -3478,7 +3516,16 @@ "docId": "kibVisualizationsPluginApi", "section": "def-public.SerializedVis", "text": "SerializedVis" - } + }, + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">" ] }, { @@ -3500,7 +3547,15 @@ "section": "def-public.SerializedVis", "text": "SerializedVis" }, - ") => ", + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.VisParams", + "text": "VisParams" + }, + ">) => ", { "pluginId": "visualizations", "scope": "public", diff --git a/docs/action-type-template.asciidoc b/docs/action-type-template.asciidoc index 5b61c259563ad..f477fb06c007f 100644 --- a/docs/action-type-template.asciidoc +++ b/docs/action-type-template.asciidoc @@ -1,10 +1,10 @@ [[-action-type]] -=== action +=== connector and action ++++ ++++ -Include a short description of the action type. +Include a short description of the connector type. [float] [[-connector-configuration]] @@ -13,7 +13,7 @@ Include a short description of the action type. connectors have the following configuration properties. //// -List of user-facing connector configurations. This should align with the fields available in the Create connector flyout form for this action type. +List of user-facing connector configurations. This should align with the fields available in the Create connector flyout form for this connector type. //// Property1:: A short description of this property. @@ -21,16 +21,16 @@ Property2:: A short description of this property with format hints. This can be [float] [[Preconfigured--configuration]] -==== Preconfigured action type +==== Preconfigured connector type //// -Example preconfigured format for this action type +Example preconfigured format for this connector type //// [source,text] -- my-: - name: preconfigured--action-type + name: preconfigured--connector-type actionTypeId: . config: property1: value1 @@ -39,17 +39,15 @@ Example preconfigured format for this action type property3: value3 -- -[float] -[[-connector-config-properties]] //// List of properties from the ConfigSchema and SecretsSchema for this action type. //// -Config defines information for the action type. +Config defines information for the connector type. `property1`:: A short description of this property. `property2`:: A short descriptionn of this property. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `property3`:: A short descriptionn of this property. @@ -57,7 +55,7 @@ Secrets defines sensitive information for the action type. [[-action-configuration]] ==== Action configuration - actions have the following configuration properties. + actions have the following properties. //// List of user-facing action configurations. This should align with the fields available in the Action section of the Create/Update alert flyout. diff --git a/docs/alert-type-template.asciidoc b/docs/alert-type-template.asciidoc deleted file mode 100644 index 292ed00d05496..0000000000000 --- a/docs/alert-type-template.asciidoc +++ /dev/null @@ -1,39 +0,0 @@ -[[alert-type-]] -=== - -Include a short description of the alert type. - -[float] -==== Create the alert - -Fill in the <>, then select **. - -[float] -==== Define the conditions - -Define properties to detect the condition. - -//// -Optional, include a screenshot -[role="screenshot"] -image::user/alerting/images/alert-types--conditions.png[Conditions for alert type] -//// - -Condition1:: This is a condition the user must define. -Condition2:: This is another condition the user must define. - -[float] -==== Add action variables - -<> to run when the alert condition is met. The following variables are specific to the alert. You can also specify <>. - -`context.variableA`:: A short description of the context variable defined by the alert type. -`context.variableB`:: A short description of the context variable defined by the alert type with an example. Example: `this is what variableB outputs`. - -//// -Optional, include a step-by-step example for creating this alert -[float] -==== Example - -In this section, you will use the {kib} <> to setup and tune the conditions on an alert. For this example, we want to detect when . -//// \ No newline at end of file diff --git a/docs/management/alerting/alert-details.asciidoc b/docs/management/alerting/alert-details.asciidoc deleted file mode 100644 index 0510b90272f90..0000000000000 --- a/docs/management/alerting/alert-details.asciidoc +++ /dev/null @@ -1,33 +0,0 @@ -[role="xpack"] -[[alert-details]] -=== Alert details - - -The *Alert details* page tells you about the state of the alert and provides granular control over the actions it is taking. - -[role="screenshot"] -image::images/alerts-details-instances-active.png[Alert details page with three alert instances] - -In this example, alerts detect when a site serves more than a threshold number of bytes in a 24 hour period. Three sites are above the threshold. These are called alert instances - occurrences of the condition being detected - and the instance name, status, time of detection, and duration of the condition are shown in this view. - -Upon detection, each instance can trigger one or more actions. If the condition persists, the same actions will trigger either on the next scheduled alert check, or (if defined) after the re-notify period on the alert has passed. To prevent re-notification, you can suppress future actions by clicking on the eye icon to mute an individual alert instance. Muting means that the alert checks continue to run on a schedule, but that instance will not trigger any action. - -[role="screenshot"] -image::images/alerts-details-instance-muting.png[Muting an alert instance] - -Alert instances will come and go from the list depending on whether they meet the alert conditions or not - unless they are muted. If a muted instance no longer meets the alert conditions, it will appear as inactive in the list. This prevents an instance from triggering actions if it reappears in the future. - -[role="screenshot"] -image::images/alerts-details-instances-inactive.png[Alert details page with three inactive alert instances] - -If you want to suppress actions on all current and future instances, you can mute the entire alert. Alert checks continue to run and the instance list will update as instances activate or deactivate, but no actions will be triggered. - -[role="screenshot"] -image::images/alerts-details-muting.png[Use the mute toggle to suppress all action on current and future instances] - -You can also disable an alert altogether. When disabled, the alert stops running checks altogether and will clear any instances it is tracking. You may want to disable alerts that are not currently needed to reduce the load on {kib} and {es}. - -[role="screenshot"] -image::images/alerts-details-disabling.png[Use the disable toggle to turn off alert checks and clear instances tracked] - -* For further information on alerting concepts and examples, see <>. diff --git a/docs/management/alerting/alert-management.asciidoc b/docs/management/alerting/alert-management.asciidoc deleted file mode 100644 index 4fd1d8a7182db..0000000000000 --- a/docs/management/alerting/alert-management.asciidoc +++ /dev/null @@ -1,58 +0,0 @@ -[role="xpack"] -[[alert-management]] -=== Managing Alerts - - -The *Alerts* tab provides a cross-app view of alerting. Different {kib} apps like {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and <> can offer their own alerts. The *Alerts* tab provides a central place to: - -* <> alerts -* <> including enabling/disabling, muting/unmuting, and deleting -* Drill-down to <> - -[role="screenshot"] -image:management/alerting/images/alerts-and-actions-ui.png[Example alert listing in the Alerts and Actions UI] - -For more information on alerting concepts and the types of alerts and actions available, see <>. - -[float] -==== Finding alerts - -The *Alerts* tab lists all alerts in the current space, including summary information about their execution frequency, tags, and type. - -The *search bar* can be used to quickly find alerts by name or tag. - -[role="screenshot"] -image::images/alerts-filter-by-search.png[Filtering the alerts list using the search bar] - -The *type* dropdown lets you filter to a subset of alert types. - -[role="screenshot"] -image::images/alerts-filter-by-type.png[Filtering the alerts list by types of alert] - -The *Action type* dropdown lets you filter by the type of action used in the alert. - -[role="screenshot"] -image::images/alerts-filter-by-action-type.png[Filtering the alert list by type of action] - -[float] -[[create-edit-alerts]] -==== Creating and editing alerts - -Many alerts must be created within the context of a {kib} app like <>, <>, or <>, but others are generic. Generic alert types can be created in the *Alerts* management UI by clicking the *Create* button. This will launch a flyout that guides you through selecting an alert type and configuring it's properties. Refer to <> for details on what types of alerts are available and how to configure them. - -After an alert is created, you can re-open the flyout and change an alerts properties by clicking the *Edit* button shown on each row of the alert listing. - - -[float] -[[controlling-alerts]] -==== Controlling alerts - -The alert listing allows you to quickly mute/unmute, disable/enable, and delete individual alerts by clicking the action button. - -[role="screenshot"] -image:management/alerting/images/individual-mute-disable.png[The actions button allows an individual alert to be muted, disabled, or deleted] - -These operations can also be performed in bulk by multi-selecting alerts and clicking the *Manage alerts* button: - -[role="screenshot"] -image:management/alerting/images/bulk-mute-disable.png[The Manage alerts button lets you mute/unmute, enable/disable, and delete in bulk] diff --git a/docs/management/alerting/alerts-and-actions-intro.asciidoc b/docs/management/alerting/alerts-and-actions-intro.asciidoc deleted file mode 100644 index 2352cb99bf543..0000000000000 --- a/docs/management/alerting/alerts-and-actions-intro.asciidoc +++ /dev/null @@ -1,30 +0,0 @@ -[role="xpack"] -[[managing-alerts-and-actions]] -== Alerts and Actions - - -The *Alerts and Actions* UI lets you <> in a space, and provides tools to <> so that alerts can trigger actions like notification, indexing, and ticketing. - -To manage alerting and connectors, open the main menu, -then click *Stack Management > Alerts and Insights > Alerts and Actions*. - -[role="screenshot"] -image:management/alerting/images/alerts-and-actions-ui.png[Example alert listing in the Alerts and Actions UI] - -[NOTE] -============================================================================ -Similar to dashboards, alerts and connectors reside in a <>. -The *Alerts and Actions* UI only shows alerts and connectors for the current space. -============================================================================ - -[NOTE] -============================================================================ -{es} also offers alerting capabilities through Watcher, which -can be managed through the <>. See -<> for more information. -============================================================================ - -[float] -=== Required permissions - -Access to alerts and actions is granted based on your privileges to alerting-enabled features. See <> for more information. diff --git a/docs/management/alerting/connector-management.asciidoc b/docs/management/alerting/connector-management.asciidoc index 46e106e6e9648..dd3b5209ed4a0 100644 --- a/docs/management/alerting/connector-management.asciidoc +++ b/docs/management/alerting/connector-management.asciidoc @@ -2,14 +2,12 @@ [[connector-management]] === Managing Connectors -beta[] - -Alerts use *Connectors* to route actions to different destinations like log files, ticketing systems, and messaging tools. While each {kib} app can offer their own types of alerts, they typically share connectors. The *Connectors* tab offers a central place to view and manage all the connectors in the current space. +Rules use *Connectors* to route actions to different destinations like log files, ticketing systems, and messaging tools. While each {kib} app can offer their own types of rules, they typically share connectors. The *Connectors* tab offers a central place to view and manage all the connectors in the current space. For more information on connectors and the types of actions available see <>. [role="screenshot"] -image::images/connector-listing.png[Example connector listing in the Alerts and Actions UI] +image::images/connector-listing.png[Example connector listing in the Rules and Connectors UI] [float] @@ -21,15 +19,10 @@ The *Connectors* tab lists all connectors in the current space. The *search bar* image::images/connector-filter-by-search.png[Filtering the connector list using the search bar] -The *type* dropdown also lets you filter to a subset of action types. - -[role="screenshot"] -image::images/connector-filter-by-type.png[Filtering the connector list by types of actions] - -The *Actions* column indicates the number of actions that reference the connector. This count helps you confirm a connector is unused before you delete it, and tells you how many actions will be affected when a connector is modified. +The *type* dropdown also lets you filter to a subset of connector types. [role="screenshot"] -image::images/connector-action-count.png[Filtering the connector list by types of actions] +image::images/connector-filter-by-type.png[Filtering the connector list by types of connectors] You can delete individual connectors using the trash icon. Connectors can also be deleted in bulk by multi-selecting them and clicking the *Delete* button to the left of the search box. @@ -44,4 +37,4 @@ When this happens the action will fail to execute, and appear as errors in the { ==== Creating a new connector -New connectors can be created by clicking the *Create connector* button, which will guide you to select the type of connector and configure it's properties. Refer to <> for the types of connectors available and how to configure them. Once you create a connector it will be made available to you anytime you set up an action in the current space. +New connectors can be created by clicking the *Create connector* button, which will guide you to select the type of connector and configure its properties. Refer to <> for the types of connectors available and how to configure them. Once you create a connector it will be made available to you anytime you set up an action in the current space. diff --git a/docs/management/alerting/images/alerts-and-actions-ui.png b/docs/management/alerting/images/alerts-and-actions-ui.png deleted file mode 100644 index d46df21e6f6b0..0000000000000 Binary files a/docs/management/alerting/images/alerts-and-actions-ui.png and /dev/null differ diff --git a/docs/management/alerting/images/alerts-details-instances-active.png b/docs/management/alerting/images/alerts-details-instances-active.png deleted file mode 100644 index 7506d1cb8c65e..0000000000000 Binary files a/docs/management/alerting/images/alerts-details-instances-active.png and /dev/null differ diff --git a/docs/management/alerting/images/alerts-details-instances-inactive.png b/docs/management/alerting/images/alerts-details-instances-inactive.png deleted file mode 100644 index a757d59e12360..0000000000000 Binary files a/docs/management/alerting/images/alerts-details-instances-inactive.png and /dev/null differ diff --git a/docs/management/alerting/images/alerts-details-muting.png b/docs/management/alerting/images/alerts-details-muting.png deleted file mode 100644 index 29cdf707b4912..0000000000000 Binary files a/docs/management/alerting/images/alerts-details-muting.png and /dev/null differ diff --git a/docs/management/alerting/images/alerts-filter-by-action-type.png b/docs/management/alerting/images/alerts-filter-by-action-type.png deleted file mode 100644 index c0e495a87ecd3..0000000000000 Binary files a/docs/management/alerting/images/alerts-filter-by-action-type.png and /dev/null differ diff --git a/docs/management/alerting/images/alerts-filter-by-search.png b/docs/management/alerting/images/alerts-filter-by-search.png deleted file mode 100644 index df4b6d7d9d9aa..0000000000000 Binary files a/docs/management/alerting/images/alerts-filter-by-search.png and /dev/null differ diff --git a/docs/management/alerting/images/bulk-mute-disable.png b/docs/management/alerting/images/bulk-mute-disable.png index 04cdc3f03f34d..7ac4ac8fc3daf 100644 Binary files a/docs/management/alerting/images/bulk-mute-disable.png and b/docs/management/alerting/images/bulk-mute-disable.png differ diff --git a/docs/management/alerting/images/connector-filter-by-search.png b/docs/management/alerting/images/connector-filter-by-search.png index 1f052ea23a577..97348e70d91b3 100644 Binary files a/docs/management/alerting/images/connector-filter-by-search.png and b/docs/management/alerting/images/connector-filter-by-search.png differ diff --git a/docs/management/alerting/images/connector-filter-by-type.png b/docs/management/alerting/images/connector-filter-by-type.png index 06c7d6f4dad47..b95ef4e1a2e3e 100644 Binary files a/docs/management/alerting/images/connector-filter-by-type.png and b/docs/management/alerting/images/connector-filter-by-type.png differ diff --git a/docs/management/alerting/images/connector-listing.png b/docs/management/alerting/images/connector-listing.png index 43014ff88057f..68a529e16aa76 100644 Binary files a/docs/management/alerting/images/connector-listing.png and b/docs/management/alerting/images/connector-listing.png differ diff --git a/docs/management/alerting/images/individual-mute-disable.png b/docs/management/alerting/images/individual-mute-disable.png index dc187c97de309..0ed2bfc0186c0 100644 Binary files a/docs/management/alerting/images/individual-mute-disable.png and b/docs/management/alerting/images/individual-mute-disable.png differ diff --git a/docs/management/alerting/images/alerts-details-instance-muting.png b/docs/management/alerting/images/rule-details-alert-muting.png similarity index 100% rename from docs/management/alerting/images/alerts-details-instance-muting.png rename to docs/management/alerting/images/rule-details-alert-muting.png diff --git a/docs/management/alerting/images/rule-details-alerts-active.png b/docs/management/alerting/images/rule-details-alerts-active.png new file mode 100644 index 0000000000000..205fe533c1b4d Binary files /dev/null and b/docs/management/alerting/images/rule-details-alerts-active.png differ diff --git a/docs/management/alerting/images/rule-details-alerts-inactive.png b/docs/management/alerting/images/rule-details-alerts-inactive.png new file mode 100644 index 0000000000000..f84910ae0dcdc Binary files /dev/null and b/docs/management/alerting/images/rule-details-alerts-inactive.png differ diff --git a/docs/management/alerting/images/alerts-details-disabling.png b/docs/management/alerting/images/rule-details-disabling.png similarity index 100% rename from docs/management/alerting/images/alerts-details-disabling.png rename to docs/management/alerting/images/rule-details-disabling.png diff --git a/docs/management/alerting/images/rule-details-muting.png b/docs/management/alerting/images/rule-details-muting.png new file mode 100644 index 0000000000000..c19db43a854eb Binary files /dev/null and b/docs/management/alerting/images/rule-details-muting.png differ diff --git a/docs/management/alerting/images/rules-and-connectors-ui.png b/docs/management/alerting/images/rules-and-connectors-ui.png new file mode 100644 index 0000000000000..3a464fa7cf375 Binary files /dev/null and b/docs/management/alerting/images/rules-and-connectors-ui.png differ diff --git a/docs/management/alerting/images/rules-filter-by-action-type.png b/docs/management/alerting/images/rules-filter-by-action-type.png new file mode 100644 index 0000000000000..eded89a81dd37 Binary files /dev/null and b/docs/management/alerting/images/rules-filter-by-action-type.png differ diff --git a/docs/management/alerting/images/rules-filter-by-search.png b/docs/management/alerting/images/rules-filter-by-search.png new file mode 100644 index 0000000000000..8bda3602c98b9 Binary files /dev/null and b/docs/management/alerting/images/rules-filter-by-search.png differ diff --git a/docs/management/alerting/images/alerts-filter-by-type.png b/docs/management/alerting/images/rules-filter-by-type.png similarity index 100% rename from docs/management/alerting/images/alerts-filter-by-type.png rename to docs/management/alerting/images/rules-filter-by-type.png diff --git a/docs/management/alerting/rule-details.asciidoc b/docs/management/alerting/rule-details.asciidoc new file mode 100644 index 0000000000000..a893db280c7f7 --- /dev/null +++ b/docs/management/alerting/rule-details.asciidoc @@ -0,0 +1,33 @@ +[role="xpack"] +[[rule-details]] +=== Rule details + + +The *Rule details* page tells you about the state of the rule and provides granular control over the actions it is taking. + +[role="screenshot"] +image::images/rule-details-alerts-active.png[Rule details page with three alerts] + +In this example, the rule detects when a site serves more than a threshold number of bytes in a 24 hour period. Three sites are above the threshold. These are called alerts - occurrences of the condition being detected - and the alert name, status, time of detection, and duration of the condition are shown in this view. + +Upon detection, each alert can trigger one or more actions. If the condition persists, the same actions will trigger either on the next scheduled rule check, or (if defined) after the re-notify period on the rule has passed. To prevent re-notification, you can suppress future actions by clicking on the eye icon to mute an individual alert. Muting means that the rule checks continue to run on a schedule, but that alert will not trigger any action. + +[role="screenshot"] +image::images/rule-details-alert-muting.png[Muting an alert] + +Alerts will come and go from the list depending on whether they meet the rule conditions or not - unless they are muted. If a muted instance no longer meets the rule conditions, it will appear as inactive in the list. This prevents an alert from triggering actions if it reappears in the future. + +[role="screenshot"] +image::images/rule-details-alerts-inactive.png[Rule details page with three inactive alerts] + +If you want to suppress actions on all current and future alerts, you can mute the entire rule. Rule checks continue to run and the alert list will update as alerts activate or deactivate, but no actions will be triggered. + +[role="screenshot"] +image::images/rule-details-muting.png[Use the mute toggle to suppress all actions on current and future alerts] + +You can also disable a rule altogether. When disabled, the rule stops running checks altogether and will clear any alerts it is tracking. You may want to disable rules that are not currently needed to reduce the load on {kib} and {es}. + +[role="screenshot"] +image::images/rule-details-disabling.png[Use the disable toggle to turn off rule checks and clear alerts tracked] + +* For further information on alerting concepts and examples, see <>. diff --git a/docs/management/alerting/rule-management.asciidoc b/docs/management/alerting/rule-management.asciidoc new file mode 100644 index 0000000000000..b43dc9eb635e9 --- /dev/null +++ b/docs/management/alerting/rule-management.asciidoc @@ -0,0 +1,58 @@ +[role="xpack"] +[[alert-management]] +=== Managing Rules + + +The *Rules* tab provides a cross-app view of alerting. Different {kib} apps like {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and <> can offer their own rules. The *Rules* tab provides a central place to: + +* <> rules +* <> including enabling/disabling, muting/unmuting, and deleting +* Drill-down to <> + +[role="screenshot"] +image:management/alerting/images/rules-and-connectors-ui.png[Example rule listing in the Rules and Connectors UI] + +For more information on alerting concepts and the types of rules and connectors available, see <>. + +[float] +==== Finding rules + +The *Rules* tab lists all rules in the current space, including summary information about their execution frequency, tags, and type. + +The *search bar* can be used to quickly find rules by name or tag. + +[role="screenshot"] +image::images/rules-filter-by-search.png[Filtering the rules list using the search bar] + +The *type* dropdown lets you filter to a subset of rule types. + +[role="screenshot"] +image::images/rules-filter-by-type.png[Filtering the rules list by types of rule] + +The *Action type* dropdown lets you filter by the type of action used in the rule. + +[role="screenshot"] +image::images/rules-filter-by-action-type.png[Filtering the rule list by type of action] + +[float] +[[create-edit-rules]] +==== Creating and editing rules + +Many rules must be created within the context of a {kib} app like <>, <>, or <>, but others are generic. Generic rule types can be created in the *Rules* management UI by clicking the *Create* button. This will launch a flyout that guides you through selecting a rule type and configuring its properties. Refer to <> for details on what types of rules are available and how to configure them. + +After a rule is created, you can re-open the flyout and change a rule's properties by clicking the *Edit* button shown on each row of the rule listing. + + +[float] +[[controlling-rules]] +==== Controlling rules + +The rule listing allows you to quickly mute/unmute, disable/enable, and delete individual rules by clicking the action button. + +[role="screenshot"] +image:management/alerting/images/individual-mute-disable.png[The actions button allows an individual rule to be muted, disabled, or deleted] + +These operations can also be performed in bulk by multi-selecting rules and clicking the *Manage rules* button: + +[role="screenshot"] +image:management/alerting/images/bulk-mute-disable.png[The Manage rules button lets you mute/unmute, enable/disable, and delete in bulk] diff --git a/docs/management/alerting/rules-and-connectors-intro.asciidoc b/docs/management/alerting/rules-and-connectors-intro.asciidoc new file mode 100644 index 0000000000000..6e23ca95e2266 --- /dev/null +++ b/docs/management/alerting/rules-and-connectors-intro.asciidoc @@ -0,0 +1,29 @@ +[role="xpack"] +[[managing-alerts-and-actions]] +== Rules and Connectors + + +The *Rules and Connectors* UI lets you <> in a space, and provides tools to <> so that rules can trigger actions like notification, indexing, and ticketing. + +To manage rules and connectors, open the main menu, then click *Stack Management > Alerts and Insights > Rules and Connectors*. + +[role="screenshot"] +image:management/alerting/images/rules-and-connectors-ui.png[Example rule listing in the Rules and Connectors UI] + +[NOTE] +============================================================================ +Similar to dashboards, rules and connectors reside in a <>. +The *Rules and Connectors* UI only shows rules and connectors for the current space. +============================================================================ + +[NOTE] +============================================================================ +{es} also offers alerting capabilities through Watcher, which +can be managed through the <>. See +<> for more information. +============================================================================ + +[float] +=== Required permissions + +Access to rules and connectors is granted based on your privileges to alerting-enabled features. See <> for more information. diff --git a/docs/rule-type-template.asciidoc b/docs/rule-type-template.asciidoc new file mode 100644 index 0000000000000..605bdd57c1492 --- /dev/null +++ b/docs/rule-type-template.asciidoc @@ -0,0 +1,39 @@ +[[rule-type-]] +=== + +Include a short description of the rule type. + +[float] +==== Create the rule + +Fill in the <>, then select **. + +[float] +==== Define the conditions + +Define properties to detect the condition. + +//// +Optional, include a screenshot +[role="screenshot"] +image::user/alerting/images/rule-types--conditions.png[Conditions for rule type] +//// + +Condition1:: This is a condition the user must define. +Condition2:: This is another condition the user must define. + +[float] +==== Add action variables + +<> to run when the rule condition is met. The following variables are specific to the rule. You can also specify <>. + +`context.variableA`:: A short description of the context variable defined by the rule type. +`context.variableB`:: A short description of the context variable defined by the rule type with an example. Example: `this is what variableB outputs`. + +//// +Optional, include a step-by-step example for creating this rule +[float] +==== Example + +In this section, you will use the {kib} <> to setup and tune the conditions on an rule. For this example, we want to detect when . +//// \ No newline at end of file diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index 6813a77776b5b..3645499d5f9ff 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -23,14 +23,14 @@ You can configure the following settings in the `kibana.yml` file. | `xpack.encryptedSavedObjects` `.encryptionKey` - | A string of 32 or more characters used to encrypt sensitive properties on alerts and actions before they're stored in {es}. Third party credentials — such as the username and password used to connect to an SMTP service — are an example of encrypted properties. + + | A string of 32 or more characters used to encrypt sensitive properties on alerting rules and actions before they're stored in {es}. Third party credentials — such as the username and password used to connect to an SMTP service — are an example of encrypted properties. + + {kib} offers a <> to help generate this encryption key. + + - If not set, {kib} will generate a random key on startup, but all alert and action functions will be blocked. Generated keys are not allowed for alerts and actions because when a new key is generated on restart, existing encrypted data becomes inaccessible. For the same reason, alerts and actions in high-availability deployments of {kib} will behave unexpectedly if the key isn't the same on all instances of {kib}. + + If not set, {kib} will generate a random key on startup, but all alerting and action functions will be blocked. Generated keys are not allowed for alerting and actions because when a new key is generated on restart, existing encrypted data becomes inaccessible. For the same reason, alerting and actions in high-availability deployments of {kib} will behave unexpectedly if the key isn't the same on all instances of {kib}. + + Although the key can be specified in clear text in `kibana.yml`, it's recommended to store this key securely in the <>. - Be sure to back up the encryption key value somewhere safe, as your alerts and actions will cease to function due to decryption failures should you lose it. If you want to rotate the encryption key, be sure to follow the instructions on <>. + Be sure to back up the encryption key value somewhere safe, as your alerting rules and actions will cease to function due to decryption failures should you lose it. If you want to rotate the encryption key, be sure to follow the instructions on <>. |=== @@ -75,6 +75,6 @@ a|`xpack.actions.` [float] [[alert-settings]] -==== Alert settings +==== Alerting settings You do not need to configure any additional settings to use alerting in {kib}. diff --git a/docs/user/alerting/action-types.asciidoc b/docs/user/alerting/action-types.asciidoc index 586feeb032cb4..b648f5a9ccde5 100644 --- a/docs/user/alerting/action-types.asciidoc +++ b/docs/user/alerting/action-types.asciidoc @@ -1,8 +1,8 @@ [role="xpack"] [[action-types]] -== Actions and connectors +== Connectors and actions -Actions are Kibana services or integrations with third-party systems that run as background tasks on the Kibana server when alert conditions are met. {kib} provides the following types of actions: +Connectors provide a central place to store connection information for services and integrations with third party systems. Actions are instantiations of a connector that are linked to rules and run as background tasks on the {kib} server when rule conditions are met. {kib} provides the following types of connectors: [cols="2"] |=== @@ -50,20 +50,18 @@ a| <> [NOTE] ============================================== -Some action types are paid commercial features, while others are free. +Some connector types are paid commercial features, while others are free. For a comparison of the Elastic subscription levels, see https://www.elastic.co/subscriptions[the subscription page]. ============================================== [float] [[create-connectors]] -=== Preconfigured actions and connectors +=== Preconfigured connectors -For out-of-the-box and standardized connectors, you can <> +For out-of-the-box and standardized connectors, you can <> before {kib} starts. -If you preconfigure a connector, you can also <>. - include::action-types/email.asciidoc[] include::action-types/resilient.asciidoc[] include::action-types/index.asciidoc[] diff --git a/docs/user/alerting/action-types/email.asciidoc b/docs/user/alerting/action-types/email.asciidoc index 3813eccd048d9..58f1300d0c287 100644 --- a/docs/user/alerting/action-types/email.asciidoc +++ b/docs/user/alerting/action-types/email.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[email-action-type]] -=== Email action +=== Email connector and action ++++ Email ++++ -The email action type uses the SMTP protocol to send mail message, using an integration of https://nodemailer.com/[Nodemailer]. Email message text is sent as both plain text and html text. +The email connector uses the SMTP protocol to send mail messages, using an integration of https://nodemailer.com/[Nodemailer]. Email message text is sent as both plain text and html text. NOTE: For emails to have a footer with a link back to {kib}, set the <> configuration setting. @@ -26,12 +26,12 @@ Password:: Password for login type authentication. [float] [[Preconfigured-email-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-email: - name: preconfigured-email-action-type + name: preconfigured-email-connector-type actionTypeId: .email config: from: testsender@test.com @@ -43,7 +43,7 @@ Password:: Password for login type authentication. password: passwordkeystorevalue -- -Config defines information for the action type. +Config defines information for the connector type. `service`:: The name of a https://nodemailer.com/smtp/well-known/[well-known email service provider]. If `service` is provided, `host`, `port`, and `secure` properties are ignored. For more information on the `gmail` service value, see the https://nodemailer.com/usage/using-gmail/[Nodemailer Gmail documentation]. `from`:: An email address that corresponds to *Sender*. @@ -52,7 +52,7 @@ Config defines information for the action type. `secure`:: A boolean that corresponds to *Secure*. `hasAuth`:: A boolean that corresponds to *Requires authentication*. If `true`, this connector will require values for `user` and `password` inside the secrets configuration. Defaults to `true`. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `user`:: A string that corresponds to *Username*. Required if `hasAuth` is set to `true`. `password`:: A string that corresponds to *Password*. Should be stored in the <>. Required if `hasAuth` is set to `true`. @@ -71,24 +71,22 @@ Message:: The message text of the email. Markdown format is supported. [[configuring-email]] ==== Configuring email accounts for well-known services -The email action can send email using many popular SMTP email services. +The email connector can send email using many popular SMTP email services. -You configure the email action to send emails using the connector form. -For more information about configuring the email connector to work with different email -systems, refer to: +For more information about configuring the email connector to work with different email systems, refer to: * <> * <> * <> * <> -For other email servers, you can check the list of well-known services that Nodemailer supports in the JSON file https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json[well-known/services.json]. The properties of the objects in those files — `host`, `port`, and `secure` — correspond to the same email action configuration properties. A missing `secure` property in the "well-known/services.json" file is considered `false`. Typically, `port: 465` uses `secure: true`, and `port: 25` and `port: 587` use `secure: false`. +For other email servers, you can check the list of well-known services that Nodemailer supports in the JSON file https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json[well-known/services.json]. The properties of the objects in those files — `host`, `port`, and `secure` — correspond to the same email connector configuration properties. A missing `secure` property in the "well-known/services.json" file is considered `false`. Typically, `port: 465` uses `secure: true`, and `port: 25` and `port: 587` use `secure: false`. [float] [[gmail]] ===== Sending email from Gmail -Use the following email account settings to send email from the +Use the following email connector configuration to send email from the https://mail.google.com[Gmail] SMTP service: [source,text] @@ -108,7 +106,7 @@ to configure Gmail to https://support.google.com/accounts/answer/6010255?hl=en[a less secure apps to access your account]. If two-step verification is enabled for your account, you must generate and use -a unique App Password to send email from {watcher}. See +a unique App Password to send email from {kib}. See https://support.google.com/accounts/answer/185833?hl=en[Sign in using App Passwords] for more information. @@ -116,7 +114,7 @@ for more information. [[outlook]] ===== Sending email from Outlook.com -Use the following email account settings to send email action from the +Use the following email connector configuration to send email from the https://www.outlook.com/[Outlook.com] SMTP service: [source,text] @@ -130,8 +128,8 @@ secrets: password: -------------------------------------------------- -When sending emails, you must provide a from address, either as the default -in your account configuration or as part of the email action in the watch. +When sending emails, you must provide a `from` address, either as the default +in your connector configuration or as part of the email action in the rule. NOTE: You must use a unique App Password if two-step verification is enabled. See http://windows.microsoft.com/en-us/windows/app-passwords-two-step-verification[App @@ -141,7 +139,7 @@ NOTE: You must use a unique App Password if two-step verification is enabled. [[amazon-ses]] ===== Sending email from Amazon SES (Simple Email Service) -Use the following email account settings to send email from the +Use the following email connector configuration to send email from the http://aws.amazon.com/ses[Amazon Simple Email Service] (SES) SMTP service: [source,text] @@ -168,7 +166,7 @@ NOTE: You must use your Amazon SES SMTP credentials to send email through [[exchange]] ===== Sending email from Microsoft Exchange -Use the following email account settings to send email action from Microsoft +Use the following email connector configuration to send email from Microsoft Exchange: [source,text] diff --git a/docs/user/alerting/action-types/index.asciidoc b/docs/user/alerting/action-types/index.asciidoc index a57048243d757..80226e737e9c0 100644 --- a/docs/user/alerting/action-types/index.asciidoc +++ b/docs/user/alerting/action-types/index.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[index-action-type]] -=== Index action +=== Index connector and action ++++ Index ++++ -The index action type will index a document into {es}. See also the {ref}/indices-create-index.html[create index API]. +The index connector will index a document into {es}. See also the {ref}/indices-create-index.html[create index API]. [float] [[index-connector-configuration]] @@ -20,12 +20,12 @@ Execution time field:: This field will be automatically set to the time the ale [float] [[Preconfigured-index-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-index: - name: action-type-index + name: preconfigured-index-connector-type actionTypeId: .index config: index: .kibana @@ -33,7 +33,7 @@ Execution time field:: This field will be automatically set to the time the ale executionTimeField: somedate -- -Config defines information for the action type. +Config defines information for the connector type. `index`:: A string that corresponds to *Index*. `refresh`:: A boolean that corresponds to *Refresh*. Defaults to `false`. @@ -51,19 +51,19 @@ Document:: The document to index in JSON format. [[index-action-example]] ==== Example -Example of the index document for Index Threshold alert: +Example of the index document for Index Threshold rule: [source,text] -------------------------------------------------- { + "rule_id": "{{ruleId}}", + "rule_name": "{{ruleName}}", "alert_id": "{{alertId}}", - "alert_name": "{{alertName}}", - "alert_instance_id": "{{alertInstanceId}}", "context_message": "{{context.message}}" } -------------------------------------------------- -Example of create test index using the API. +Example of creating a test index using the API. [source,text] -------------------------------------------------- @@ -74,9 +74,9 @@ PUT test }, "mappings" : { "properties" : { + "rule_id" : { "type" : "text" }, + "rule_name" : { "type" : "text" }, "alert_id" : { "type" : "text" }, - "alert_name" : { "type" : "text" }, - "alert_instance_id" : { "type" : "text" }, "context_message": { "type" : "text" } } } diff --git a/docs/user/alerting/action-types/jira.asciidoc b/docs/user/alerting/action-types/jira.asciidoc index a1941b4b30283..7b4dc69bb639a 100644 --- a/docs/user/alerting/action-types/jira.asciidoc +++ b/docs/user/alerting/action-types/jira.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[jira-action-type]] -=== Jira action +=== Jira connector and action ++++ Jira ++++ -The Jira action type uses the https://developer.atlassian.com/cloud/jira/platform/rest/v2/[REST API v2] to create Jira issues. +The Jira connector uses the https://developer.atlassian.com/cloud/jira/platform/rest/v2/[REST API v2] to create Jira issues. [float] [[jira-connector-configuration]] @@ -21,12 +21,12 @@ API token (or password):: Jira API authentication token (or password) for HTTP [float] [[Preconfigured-jira-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-jira: - name: preconfigured-jira-action-type + name: preconfigured-jira-connector-type actionTypeId: .jira config: apiUrl: https://elastic.atlassian.net @@ -36,12 +36,12 @@ API token (or password):: Jira API authentication token (or password) for HTTP apiToken: tokenkeystorevalue -- -Config defines information for the action type. +Config defines information for the connector type. `apiUrl`:: An address that corresponds to *URL*. `projectKey`:: A key that corresponds to *Project Key*. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `email`:: A string that corresponds to *Email*. `apiToken`:: A string that corresponds to *API Token*. Should be stored in the <>. diff --git a/docs/user/alerting/action-types/pagerduty.asciidoc b/docs/user/alerting/action-types/pagerduty.asciidoc index f74b5773b3719..c32e6c8a6635f 100644 --- a/docs/user/alerting/action-types/pagerduty.asciidoc +++ b/docs/user/alerting/action-types/pagerduty.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[pagerduty-action-type]] -=== PagerDuty action +=== PagerDuty connector and action ++++ PagerDuty ++++ -The PagerDuty action type uses the https://v2.developer.pagerduty.com/docs/events-api-v2[v2 Events API] to trigger, acknowledge, and resolve PagerDuty alerts. +The PagerDuty connector uses the https://v2.developer.pagerduty.com/docs/events-api-v2[v2 Events API] to trigger, acknowledge, and resolve PagerDuty alerts. [float] [[pagerduty-connector-configuration]] @@ -19,12 +19,12 @@ Integration Key:: A 32 character PagerDuty Integration Key for an integration [float] [[Preconfigured-pagerduty-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-pagerduty: - name: preconfigured-pagerduty-action-type + name: preconfigured-pagerduty-connector-type actionTypeId: .pagerduty config: apiUrl: https://test.host @@ -32,11 +32,11 @@ Integration Key:: A 32 character PagerDuty Integration Key for an integration routingKey: testroutingkey -- -Config defines information for the action type. +Config defines information for the connector type. `apiURL`:: A URL string that corresponds to *API URL*. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `routingKey`:: A string that corresponds to *Integration Key*. @@ -62,11 +62,11 @@ For more details on these properties, see https://v2.developer.pagerduty.com/v2/ [[pagerduty-benefits]] ==== Configure PagerDuty -By integrating PagerDuty with alerts, you can: +By integrating PagerDuty with rules, you can: -* Route your alerts to the right PagerDuty responder within your team, based on your structure, escalation policies, and workflows. -* Automatically generate incidents of different types and severity based on each alert’s context. -* Tailor the incident data to match your needs by easily passing the alerting context from Kibana to PagerDuty. +* Route your rules to the right PagerDuty responder within your team, based on your structure, escalation policies, and workflows. +* Automatically generate incidents of different types and severity based on each rule’s context. +* Tailor the incident data to match your needs by easily passing the rule context from Kibana to PagerDuty. [float] [[pagerduty-support]] @@ -110,10 +110,9 @@ image::user/alerting/images/pagerduty-integration.png[PagerDuty Integrations tab . Create a PagerDuty Connector in Kibana. You can: + -* Create a connector as part of creating an alert by selecting PagerDuty in the *Actions* -section of the alert configuration and selecting *Add new*. -* Alternatively, create a connector. To create a connector, open the main menu, click *Stack Management* > -Alerts and Actions*, select *Connectors*, click *Create connector*, then select the PagerDuty option. +* Create a connector as part of creating an rule by selecting PagerDuty in the *Actions* +section of the rule configuration and selecting *Add new*. +* Alternatively, create a connector. To create a connector, open the main menu, click *Stack Management > Rules and Connectors*, select *Connectors*, click *Create connector*, then select the PagerDuty option. . Configure the connector by giving it a name and entering the Integration Key, optionally entering a custom API URL. + @@ -122,15 +121,15 @@ See <> for how to obtain the endpoint and . Save the Connector. -. To create an alert, open the main menu, then click *Stack Management > Alerts and Actions* or the application of your choice. +. To create a rule, open the main menu, then click *Stack Management > Rules and Connectors* or the application of your choice. . Set up an action using your PagerDuty connector, by determining: + * The action’s type: Trigger, Resolve, or Acknowledge. * The event’s severity: Info, warning, error, or critical. -* An array of different fields, including the timestamp, group, class, component, and your dedup key. By default, the dedup is configured to create a new PagerDuty incident for each alert instance and reuse the incident when a recovered alert instance reactivates. -Depending on your custom needs, assign them variables from the alerting context. -To see the available context variables, click on the *Add alert variable* icon next +* An array of different fields, including the timestamp, group, class, component, and your dedup key. By default, the dedup is configured to create a new PagerDuty incident for each alert and reuse the incident when a recovered alert reactivates. +Depending on your custom needs, assign them variables from the rule context. +To see the available context variables, click on the *Add variable* icon next to each corresponding field. For more details on these parameters, see the <> and the PagerDuty https://v2.developer.pagerduty.com/v2/docs/send-an-event-events-api-v2[API v2 documentation]. diff --git a/docs/user/alerting/action-types/pre-configured-connectors.asciidoc b/docs/user/alerting/action-types/pre-configured-connectors.asciidoc index a748a06398ef3..ee8a28a864824 100644 --- a/docs/user/alerting/action-types/pre-configured-connectors.asciidoc +++ b/docs/user/alerting/action-types/pre-configured-connectors.asciidoc @@ -1,24 +1,20 @@ [role="xpack"] -[[pre-configured-action-types-and-connectors]] +[[pre-configured-connectors]] -=== Preconfigured connectors and action types +=== Preconfigured connectors -You can preconfigure a connector or action type to have all the information it needs prior to startup -by adding it to the `kibana.yml` file. +You can preconfigure a connector to have all the information it needs prior to startup by adding it to the `kibana.yml` file. -Preconfigured connectors offer the following capabilities: +Preconfigured connectors offer the following benefits: - Require no setup. Configuration and credentials needed to execute an action are predefined, including the connector name and ID. - Appear in all spaces because they are not saved objects. - Cannot be edited or deleted. -A preconfigured action type has only preconfigured connectors. Preconfigured -connectors can belong to either the preconfigured action type or to the regular action type. - [float] [[preconfigured-connector-example]] -==== Preconfigured connectors +==== Preconfigured connectors example This example shows a valid configuration for two out-of-the box connectors: <> and <>. @@ -44,78 +40,27 @@ two out-of-the box connectors: <> and < The key is the action connector identifier, `my-slack1` in this example. +<1> The key is the connector identifier, `my-slack1` in this example. <2> `actionTypeId` is the action type identifier. <3> `name` is the name of the preconfigured connector. -<4> `config` is the action type specific to the configuration. -<5> `secrets` is sensitive configuration, such as username, password, and keys. +<4> `config` is the configuration specific to the connector type. +<5> `secrets` is the sensitive configuration, such as username, password, and keys, specific to the connector type. [NOTE] ============================================== Sensitive properties, such as passwords, can also be stored in the <>. ============================================== -//// [float] [[managing-pre-configured-connectors]] ==== View preconfigured connectors -//// -When you open the main menu, click *Stack Management > Alerts and Actions*. Preconfigured connectors -appear on the <>, -regardless of which space you are in. -They are tagged as “preconfigured”, and you cannot delete them. +When you open the main menu, click *Stack Management > Rules and Connectors*. Preconfigured connectors appear on the <>, regardless of which space you are in. They are tagged as “preconfigured”, and you cannot delete them. [role="screenshot"] -image::images/pre-configured-connectors-managing.png[Connectors managing tab with pre-cofigured] +image::images/pre-configured-connectors-managing.png[Connectors managing tab with pre-configured] -Clicking a preconfigured connector shows the description, but not the configuration. -A message indicates that this is a preconfigured connector. +Clicking a preconfigured connector shows the description, but not the configuration. A message indicates that this is a preconfigured connector. [role="screenshot"] image::images/pre-configured-connectors-view-screen.png[Pre-configured connector view details] - -The connector details preview is disabled for preconfigured connectors -of a preconfigured action type. - -[role="screenshot"] -image::images/pre-configured-action-type-managing.png[Connectors managing tab with pre-cofigured] - -[float] -[[preconfigured-action-type-example]] -==== Preconfigured action type - -This example shows a preconfigured action type with one out-of-the box connector. - -```js - xpack.actions.enabledActionTypes: ['.slack', '.email', '.index'] <1> - xpack.actions.preconfigured: <2> - my-server-log: - actionTypeId: .server-log - name: 'Server log #xyz' -``` - -<1> `enabledActionTypes` prevents the preconfigured action type from creating and deleting connectors. For more details, check <>. -<2> `preconfigured` is the setting for defining the list of available connectors for the preconfigured action type. - -[[managing-pre-configured-action-types]] -To attach a preconfigured action to an alert: - -. Open the main menu, click *Stack Management > Alerts and Actions*, then open the *Connectors* tab. - -. Click *Create connector.* - -. In the list of available action types, select the preconfigured action type you want. -+ -[role="screenshot"] -image::images/pre-configured-action-type-select-type.png[Pre-configured connector create menu] - -. In *Create alert*, open the connector dropdown, and then select the preconfigured -connector. -+ -The `preconfigured` label distinguishes it from a space-aware connector. -+ -[role="screenshot"] -image::images/alert-pre-configured-connectors-dropdown.png[Dropdown list with pre-cofigured connectors] - -. Click *Add action*. diff --git a/docs/user/alerting/action-types/resilient.asciidoc b/docs/user/alerting/action-types/resilient.asciidoc index 296156875ceb6..862af0e526337 100644 --- a/docs/user/alerting/action-types/resilient.asciidoc +++ b/docs/user/alerting/action-types/resilient.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[resilient-action-type]] -=== IBM Resilient action +=== IBM Resilient connector and action ++++ IBM Resilient ++++ -The IBM Resilient action type uses the https://developer.ibm.com/security/resilient/rest/[RESILIENT REST v2] to create IBM Resilient incidents. +The IBM Resilient connector uses the https://developer.ibm.com/security/resilient/rest/[RESILIENT REST v2] to create IBM Resilient incidents. [float] [[resilient-connector-configuration]] @@ -21,12 +21,12 @@ API key secret:: The authentication key secret for HTTP Basic authentication. [float] [[Preconfigured-resilient-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-resilient: - name: preconfigured-resilient-action-type + name: preconfigured-resilient-connector-type actionTypeId: .resilient config: apiUrl: https://elastic.resilient.net @@ -36,12 +36,12 @@ API key secret:: The authentication key secret for HTTP Basic authentication. apiKeySecret: tokenkeystorevalue -- -Config defines information for the action type. +Config defines information for the connector type. `apiUrl`:: An address that corresponds to *URL*. `orgId`:: An ID that corresponds to *Organization ID*. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `apiKeyId`:: A string that corresponds to *API key ID*. `apiKeySecret`:: A string that corresponds to *API Key secret*. Should be stored in the <>. diff --git a/docs/user/alerting/action-types/server-log.asciidoc b/docs/user/alerting/action-types/server-log.asciidoc index 7849a70a239c3..e497ed3a4467a 100644 --- a/docs/user/alerting/action-types/server-log.asciidoc +++ b/docs/user/alerting/action-types/server-log.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[server-log-action-type]] -=== Server log action +=== Server log connector and action ++++ Server log ++++ -This action type writes an entry to the {kib} server log. +This connector writes an entry to the {kib} server log. [float] [[server-log-connector-configuration]] @@ -17,12 +17,12 @@ Name:: The name of the connector. The name is used to identify a connector [float] [[Preconfigured-server-log-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-server-log: - name: test + name: preconfigured-server-log-connector-type actionTypeId: .server-log -- diff --git a/docs/user/alerting/action-types/servicenow.asciidoc b/docs/user/alerting/action-types/servicenow.asciidoc index f002c39416f1a..35d50f1bfeb72 100644 --- a/docs/user/alerting/action-types/servicenow.asciidoc +++ b/docs/user/alerting/action-types/servicenow.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[servicenow-action-type]] -=== ServiceNow action +=== ServiceNow connector and action ++++ ServiceNow ++++ -The ServiceNow action type uses the https://developer.servicenow.com/app.do#!/rest_api_doc?v=orlando&id=c_TableAPI[V2 Table API] to create ServiceNow incidents. +The ServiceNow connector uses the https://developer.servicenow.com/app.do#!/rest_api_doc?v=orlando&id=c_TableAPI[V2 Table API] to create ServiceNow incidents. [float] [[servicenow-connector-configuration]] @@ -20,12 +20,12 @@ Password:: Password for HTTP Basic authentication. [float] [[Preconfigured-servicenow-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-servicenow: - name: preconfigured-servicenow-action-type + name: preconfigured-servicenow-connector-type actionTypeId: .servicenow config: apiUrl: https://dev94428.service-now.com/ @@ -34,11 +34,11 @@ Password:: Password for HTTP Basic authentication. password: passwordkeystorevalue -- -Config defines information for the action type. +Config defines information for the connector type. `apiUrl`:: An address that corresponds to *URL*. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `username`:: A string that corresponds to *Username*. `password`:: A string that corresponds to *Password*. Should be stored in the <>. diff --git a/docs/user/alerting/action-types/slack.asciidoc b/docs/user/alerting/action-types/slack.asciidoc index 6f7d1b3e11d31..3ef369e2a4e4a 100644 --- a/docs/user/alerting/action-types/slack.asciidoc +++ b/docs/user/alerting/action-types/slack.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[slack-action-type]] -=== Slack action +=== Slack connector and action ++++ Slack ++++ -The Slack action type uses https://api.slack.com/incoming-webhooks[Slack Incoming Webhooks]. +The Slack connector uses https://api.slack.com/incoming-webhooks[Slack Incoming Webhooks]. [float] [[slack-connector-configuration]] @@ -18,18 +18,18 @@ Webhook URL:: The URL of the incoming webhook. See https://api.slack.com/messa [float] [[Preconfigured-slack-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-slack: - name: preconfigured-slack-action-type + name: preconfigured-slack-connector-type actionTypeId: .slack secrets: webhookUrl: 'https://hooks.slack.com/services/abcd/efgh/ijklmnopqrstuvwxyz' -- -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `webhookUrl`:: A string that corresponds to *Webhook URL*. diff --git a/docs/user/alerting/action-types/teams.asciidoc b/docs/user/alerting/action-types/teams.asciidoc index 294b5474e390a..1a0e52141ee9c 100644 --- a/docs/user/alerting/action-types/teams.asciidoc +++ b/docs/user/alerting/action-types/teams.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[teams-action-type]] -=== Microsoft Teams action +=== Microsoft Teams connector and action ++++ Microsoft Teams ++++ -The Microsoft Teams action type uses https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook[Incoming Webhooks]. +The Microsoft Teams connector uses https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook[Incoming Webhooks]. [float] [[teams-connector-configuration]] @@ -18,18 +18,18 @@ Webhook URL:: The URL of the incoming webhook. See https://docs.microsoft.com/ [float] [[Preconfigured-teams-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-teams: - name: preconfigured-teams-action-type + name: preconfigured-teams-connector-type actionTypeId: .teams secrets: webhookUrl: 'https://outlook.office.com/webhook/abcd@0123456/IncomingWebhook/abcdefgh/ijklmnopqrstuvwxyz' -- -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `webhookUrl`:: A string that corresponds to *Webhook URL*. diff --git a/docs/user/alerting/action-types/webhook.asciidoc b/docs/user/alerting/action-types/webhook.asciidoc index 381d6e72bf9c0..01ddfee288fc8 100644 --- a/docs/user/alerting/action-types/webhook.asciidoc +++ b/docs/user/alerting/action-types/webhook.asciidoc @@ -1,11 +1,11 @@ [role="xpack"] [[webhook-action-type]] -=== Webhook action +=== Webhook connector and action ++++ Webhook ++++ -The Webhook action type uses https://github.com/axios/axios[axios] to send a POST or PUT request to a web service. +The Webhook connector uses https://github.com/axios/axios[axios] to send a POST or PUT request to a web service. [float] [[webhook-connector-configuration]] @@ -23,12 +23,12 @@ Password:: Password for HTTP basic authentication. [float] [[Preconfigured-webhook-configuration]] -==== Preconfigured action type +==== Preconfigured connector type [source,text] -- my-webhook: - name: preconfigured-webhook-action-type + name: preconfigured-webhook-connector-type actionTypeId: .webhook config: url: https://test.host @@ -40,14 +40,14 @@ Password:: Password for HTTP basic authentication. password: passwordkeystorevalue -- -Config defines information for the action type. +Config defines information for the connector type. `url`:: A URL string that corresponds to *URL*. `method`:: A string that corresponds to *Method*. `headers`:: A record that corresponds to *Headers*. `hasAuth`:: A boolean that corresponds to *Requires authentication*. If `true`, this connector will require values for `user` and `password` inside the secrets configuration. Defaults to `true`. -Secrets defines sensitive information for the action type. +Secrets defines sensitive information for the connector type. `user`:: A string that corresponds to *User*. Required if `hasAuth` is set to `true`. `password`:: A string that corresponds to *Password*. Should be stored in the <>. Required if `hasAuth` is set to `true`. diff --git a/docs/user/alerting/alert-types.asciidoc b/docs/user/alerting/alert-types.asciidoc deleted file mode 100644 index af193cf2f037f..0000000000000 --- a/docs/user/alerting/alert-types.asciidoc +++ /dev/null @@ -1,42 +0,0 @@ -[role="xpack"] -[[alert-types]] -== Alerts - -Kibana provides two types of alerts: - -* Stack alerts, which are built into {kib} -* Domain-specific alerts, which are registered by {kib} apps. - -[float] -==== Standard stack alerts - -{kib} provides two stack alerts: - -* <> -* <> - -Users require the `all` privilege to access the *Stack Alerts* feature and create and edit alerts. -See <> for more information. - -[float] -==== Domain-specific alerts - -For domain-specific alerts, refer to the documentation for that app. -{kib} supports these alerts: - -* {observability-guide}/create-alerts.html[Observability alerts] -* {security-guide}/prebuilt-rules.html[Security alerts] -* <> -* {ml-docs}/ml-configuring-alerts.html[{ml-cap} alerts] beta:[] - -[NOTE] -============================================== -Some alert types are subscription features, while others are free features. -For a comparison of the Elastic subscription levels, -see {subscriptions}[the subscription page]. -============================================== - - -include::stack-alerts/index-threshold.asciidoc[] -include::stack-alerts/es-query.asciidoc[] -include::maps-alerts/geo-alert-types.asciidoc[] diff --git a/docs/user/alerting/alerting-getting-started.asciidoc b/docs/user/alerting/alerting-getting-started.asciidoc index 7eae7d9a3b6e4..2c8985075398e 100644 --- a/docs/user/alerting/alerting-getting-started.asciidoc +++ b/docs/user/alerting/alerting-getting-started.asciidoc @@ -1,13 +1,13 @@ [role="xpack"] [[alerting-getting-started]] -= Alerting and Actions += Alerting -- -Alerting allows you to detect complex conditions within different {kib} apps and trigger actions when those conditions are met. Alerting is integrated with {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and {ml-docs}/ml-configuring-alerts.html[*{ml-app}*], can be centrally managed from the <> UI, and provides a set of built-in <> and <> (known as stack alerts) for you to use. +Alerting allows you to define *rules* to detect complex conditions within different {kib} apps and trigger actions when those conditions are met. Alerting is integrated with {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and {ml-docs}/ml-configuring-alerts.html[*{ml-app}*], can be centrally managed from the <> UI, and provides a set of built-in <> and <> (known as stack rules) for you to use. -image::images/alerting-overview.png[Alerts and actions UI] +image::images/alerting-overview.png[Rules and Connectors UI] [IMPORTANT] ============================================== @@ -17,120 +17,119 @@ To make sure you can access alerting and actions, see the < 0.9 on each server for the two minutes (condition), checked every minute (schedule), sending a warning email message via SMTP with subject `CPU on {{server}} is high` (action). +For example, when monitoring a set of servers, a rule might check for average CPU usage > 0.9 on each server for the last two minutes (condition), checked every minute (schedule), sending a warning email message via SMTP with subject `CPU on {{server}} is high` (action). -image::images/what-is-an-alert.svg[Three components of an alert] +image::images/what-is-a-rule.svg[Three components of a rule] -The following sections each part of the alert is described in more detail. +The following sections describe each part of the rule in more detail. [float] [[alerting-concepts-conditions]] ==== Conditions -Under the hood, {kib} alerts detect conditions by running javascript function on the {kib} server, which gives it flexibility to support a wide range of detections, anything from the results of a simple {es} query to heavy computations involving data from multiple sources or external systems. +Under the hood, {kib} rules detect conditions by running a javascript function on the {kib} server, which gives it the flexibility to support a wide range of conditions, anything from the results of a simple {es} query to heavy computations involving data from multiple sources or external systems. -These detections are packaged and exposed as *alert types*. An alert type hides the underlying details of the detection, and exposes a set of parameters -to control the details of the conditions to detect. +These conditions are packaged and exposed as *rule types*. A rule type hides the underlying details of the condition, and exposes a set of parameters +to control the details of the conditions to detect. -For example, an <> lets you specify the index to query, an aggregation field, and a time window, but the details of the underlying {es} query are hidden. +For example, an <> lets you specify the index to query, an aggregation field, and a time window, but the details of the underlying {es} query are hidden. -See <> for the types of alerts provided by {kib} and how they express their conditions. +See <> for the types of rules provided by {kib} and how they express their conditions. [float] [[alerting-concepts-scheduling]] ==== Schedule -Alert schedules are defined as an interval between subsequent checks, and can range from a few seconds to months. +Rule schedules are defined as an interval between subsequent checks, and can range from a few seconds to months. [IMPORTANT] ============================================== -The intervals of alert checks in {kib} are approximate, their timing of their execution is affected by factors such as the frequency at which tasks are claimed and the task load on the system. See <> for more information. +The intervals of rule checks in {kib} are approximate. The timing of their execution is affected by factors such as the frequency at which tasks are claimed and the task load on the system. See <> for more information. ============================================== [float] [[alerting-concepts-actions]] ==== Actions -Actions are invocations of {kib} services or integrations with third-party systems, that run as background tasks on the {kib} server when alert conditions are met. +Actions are invocations of connectors, which allow interaction with {kib} services or integrations with third-party systems. Actions run as background tasks on the {kib} server when rule conditions are met. -When defining actions in an alert, you specify: +When defining actions in a rule, you specify: -* the *action type*: the type of service or integration to use -* the connection for that type by referencing a <> -* a mapping of alert values to properties exposed for that type of action +* the *connector type*: the type of service or integration to use +* the connection for that type by referencing a <> +* a mapping of rule values to properties exposed for that type of action -The result is a template: all the parameters needed to invoke a service are supplied except for specific values that are only known at the time the alert condition is detected. +The result is a template: all the parameters needed to invoke a service are supplied except for specific values that are only known at the time the rule condition is detected. -In the server monitoring example, the `email` action type is used, and `server` is mapped to the body of the email, using the template string `CPU on {{server}} is high`. +In the server monitoring example, the `email` connector type is used, and `server` is mapped to the body of the email, using the template string `CPU on {{server}} is high`. -When the alert detects the condition, it creates an <> containing the details of the condition, renders the template with these details such as server name, and executes the action on the {kib} server by invoking the `email` action type. +When the rule detects the condition, it creates an <> containing the details of the condition, renders the template with these details such as server name, and executes the action on the {kib} server by invoking the `email` connector type. image::images/what-is-an-action.svg[Actions are like templates that are rendered when an alert detects a condition] -See <> for details on the types of actions provided by {kib}. +See <> for details on the types of connectors provided by {kib}. [float] [[alerting-concepts-alert-instances]] -=== Alert instances +=== Alerts -When checking for a condition, an alert might identify multiple occurrences of the condition. {kib} tracks each of these *alert instances* separately and takes action per instance. +When checking for a condition, a rule might identify multiple occurrences of the condition. {kib} tracks each of these *alerts* separately and takes an action per alert. -Using the server monitoring example, each server with average CPU > 0.9 is tracked as an alert instance. This means a separate email is sent for each server that exceeds the threshold. +Using the server monitoring example, each server with average CPU > 0.9 is tracked as an alert. This means a separate email is sent for each server that exceeds the threshold. -image::images/alert-instances.svg[{kib} tracks each detected condition as an alert instance and takes action on each instance] +image::images/alerts.svg[{kib} tracks each detected condition as an alert and takes action on each alert] [float] [[alerting-concepts-suppressing-duplicate-notifications]] === Suppressing duplicate notifications -Since actions are taken per instance, alerts can end up generating a large number of actions. Take the following example where an alert is monitoring three servers every minute for CPU usage > 0.9: +Since actions are executed per alert, a rule can end up generating a large number of actions. Take the following example where a rule is monitoring three servers every minute for CPU usage > 0.9: -* Minute 1: server X123 > 0.9. *One email* is sent for server X123. -* Minute 2: X123 and Y456 > 0.9. *Two emails* are sent, on for X123 and one for Y456. +* Minute 1: server X123 > 0.9. *One email* is sent for server X123. +* Minute 2: X123 and Y456 > 0.9. *Two emails* are sent, one for X123 and one for Y456. * Minute 3: X123, Y456, Z789 > 0.9. *Three emails* are sent, one for each of X123, Y456, Z789. -In the above example, three emails are sent for server X123 in the span of 3 minutes for the same condition. Often it's desirable to suppress frequent re-notification. Operations like muting and re-notification throttling can be applied at the instance level. If we set the alert re-notify interval to 5 minutes, we reduce noise by only getting emails for new servers that exceed the threshold: +In the above example, three emails are sent for server X123 in the span of 3 minutes for the same rule. Often it's desirable to suppress frequent re-notification. Operations like muting and throttling can be applied at the alert level. If we set the rule re-notify interval to 5 minutes, we reduce noise by only getting emails for new servers that exceed the threshold: * Minute 1: server X123 > 0.9. *One email* is sent for server X123. -* Minute 2: X123 and Y456 > 0.9. *One email* is sent for Y456 -* Minute 3: X123, Y456, Z789 > 0.9. *One email* is sent for Z789. +* Minute 2: X123 and Y456 > 0.9. *One email* is sent for Y456. +* Minute 3: X123, Y456, Z789 > 0.9. *One email* is sent for Z789. [float] [[alerting-concepts-connectors]] === Connectors -Actions often involve connecting with services inside {kib} or integrations with third-party systems. -Rather than repeatedly entering connection information and credentials for each action, {kib} simplifies action setup using *connectors*. +Actions often involve connecting with services inside {kib} or integrating with third-party systems. +Rather than repeatedly entering connection information and credentials for each action, {kib} simplifies action setup using *connectors*. -*Connectors* provide a central place to store connection information for services and integrations. For example if four alerts send email notifications via the same SMTP service, -they all reference the same SMTP connector. When the SMTP settings change they are updated once in the connector, instead of having to update four alerts. +*Connectors* provide a central place to store connection information for services and integrations. For example if four rules send email notifications via the same SMTP service, they can all reference the same SMTP connector. When the SMTP settings change, you can update them once in the connector, instead of having to update four rules. -image::images/alert-concepts-connectors.svg[Connectors provide a central place to store service connection settings] +image::images/rule-concepts-connectors.svg[Connectors provide a central place to store service connection settings] [float] === Summary -An _alert_ consists of conditions, _actions_, and a schedule. When conditions are met, _alert instances_ are created that render _actions_ and invoke them. To make action setup and update easier, actions refer to _connectors_ that centralize the information used to connect with {kib} services and third-party integrations. The following example ties these concepts together: +A *rule* consists of conditions, *actions*, and a schedule. When conditions are met, *alerts* are created that render *actions* and invoke them. To make action setup and update easier, actions use *connectors* that centralize the information used to connect with {kib} services and third-party integrations. The following example ties these concepts together: -image::images/alert-concepts-summary.svg[Alerts, actions, alert instances and connectors work together to convert detection into action] +image::images/rule-concepts-summary.svg[Rules, connectors, alerts and actions work together to convert detection into action] -. Anytime an *alert*'s conditions are met, an *alert instance* is created. This example checks for servers with average CPU > 0.9. Three servers meet the condition, so three instances are created. -. Instances create *actions* as long as they are not muted or throttled. When actions are created, the template that was setup in the alert is filled with actual values. In this example three actions are created, and the template string {{server}} is replaced with the server name for each instance. -. {kib} invokes the actions, sending them to a 3rd party *integration* like an email service. -. If the 3rd party integration has connection parameters or credentials, {kib} will fetch these from the *connector* referenced in the action. +. Anytime a *rule*'s conditions are met, an *alert* is created. This example checks for servers with average CPU > 0.9. Three servers meet the condition, so three alerts are created. +. Alerts create *actions* as long as they are not muted or throttled. When actions are created, the template that was setup in the rule is filled with actual values. In this example, three actions are created, and the template string {{server}} is replaced with the server name for each alert. +. {kib} invokes the actions, sending them to a third party *integration* like an email service. +. If the third party integration has connection parameters or credentials, {kib} will fetch these from the *connector* referenced in the action. [float] @@ -139,17 +138,17 @@ image::images/alert-concepts-summary.svg[Alerts, actions, alert instances and co {kib} alerting and <> are both used to detect conditions and can trigger actions in response, but they are completely independent alerting systems. -This section will clarify some of the important differences in the function and intent of the two systems. +This section will clarify some of the important differences in the function and intent of the two systems. Functionally, {kib} alerting differs in that: * Scheduled checks are run on {kib} instead of {es} -* {kib} <> through *alert types*, whereas watches provide low-level control over inputs, conditions, and transformations. -* {kib} alerts tracks and persists the state of each detected condition through *alert instances*. This makes it possible to mute and throttle individual instances, and detect changes in state such as resolution. -* Actions are linked to *alert instances* in {kib} alerting. Actions are fired for each occurrence of a detected condition, rather than for the entire alert. +* {kib} <> through *rule types*, whereas watches provide low-level control over inputs, conditions, and transformations. +* {kib} rules track and persist the state of each detected condition through *alerts*. This makes it possible to mute and throttle individual alerts, and detect changes in state such as resolution. +* Actions are linked to *alerts* in {kib} alerting. Actions are fired for each occurrence of a detected condition, rather than for the entire rule. -At a higher level, {kib} alerts allow rich integrations across use cases like <>, <>, <>, and <>. -Pre-packaged *alert types* simplify setup, hide the details complex domain-specific detections, while providing a consistent interface across {kib}. +At a higher level, {kib} alerting allows rich integrations across use cases like <>, <>, <>, and <>. +Pre-packaged *rule types* simplify setup and hide the details of complex, domain-specific detections, while providing a consistent interface across {kib}. [float] [[alerting-setup-prerequisites]] @@ -162,13 +161,13 @@ If you are using an *on-premises* Elastic Stack deployment: If you are using an *on-premises* Elastic Stack deployment with <>: -* You must enable Transport Layer Security (TLS) for communication <>. {kib} alerting uses <> to secure background alert checks and actions, and API keys require {ref}/configuring-tls.html#tls-http[TLS on the HTTP interface]. A proxy will not suffice. +* You must enable Transport Layer Security (TLS) for communication <>. {kib} alerting uses <> to secure background rule checks and actions, and API keys require {ref}/configuring-tls.html#tls-http[TLS on the HTTP interface]. A proxy will not suffice. [float] [[alerting-setup-production]] == Production considerations and scaling guidance -When relying on alerts and actions as mission critical services, make sure you follow the <>. +When relying on alerting and actions as mission critical services, make sure you follow the <>. See <> for more information on the scalability of {kib} alerting. @@ -187,29 +186,29 @@ To access alerting in a space, a user must have access to one of the following f * <> See <> for more information on configuring roles that provide access to these features. -Also note that a user will need +read+ privileges for the *Actions and Connectors* feature to attach actions to an alert or to edit an alert that has an action attached to it. +Also note that a user will need +read+ privileges for the *Actions and Connectors* feature to attach actions to a rule or to edit a rule that has an action attached to it. [float] [[alerting-spaces]] === Space isolation -Alerts and connectors are isolated to the {kib} space in which they were created. An alert or connector created in one space will not be visible in another. +Rules and connectors are isolated to the {kib} space in which they were created. A rule or connector created in one space will not be visible in another. [float] [[alerting-authorization]] === Authorization -Alerts, including all background detection and the actions they generate are authorized using an <> associated with the last user to edit the alert. Upon creating or modifying an alert, an API key is generated for that user, capturing a snapshot of their privileges at that moment in time. The API key is then used to run all background tasks associated with the alert including detection checks and executing actions. +Rules, including all background detection and the actions they generate are authorized using an <> associated with the last user to edit the rule. Upon creating or modifying a rule, an API key is generated for that user, capturing a snapshot of their privileges at that moment in time. The API key is then used to run all background tasks associated with the rule including detection checks and executing actions. [IMPORTANT] ============================================== -If an alert requires certain privileges to run such as index privileges, keep in mind that if a user without those privileges updates the alert, the alert will no longer function. +If a rule requires certain privileges to run, such as index privileges, keep in mind that if a user without those privileges updates the rule, the rule will no longer function. ============================================== [float] [[alerting-restricting-actions]] === Restricting actions -For security reasons you may wish to limit the extent to which {kib} can connect to external services. <> allows you to disable certain <> and allowlist the hostnames that {kib} can connect with. +For security reasons you may wish to limit the extent to which {kib} can connect to external services. <> allows you to disable certain <> and allowlist the hostnames that {kib} can connect with. -- diff --git a/docs/user/alerting/alerting-troubleshooting.asciidoc b/docs/user/alerting/alerting-troubleshooting.asciidoc index 84bbeaf126a3b..f4673d10bc248 100644 --- a/docs/user/alerting/alerting-troubleshooting.asciidoc +++ b/docs/user/alerting/alerting-troubleshooting.asciidoc @@ -10,46 +10,46 @@ If your problem isn’t described here, please review open issues in the followi Have a question? Contact us in the https://discuss.elastic.co/[discuss forum]. [float] -[[alerts-small-check-interval-run-late]] -=== Alerts with small check intervals run late +[[rules-small-check-interval-run-late]] +=== Rules with small check intervals run late *Problem*: -Alerts with a small check interval, such as every two seconds, run later than scheduled. +Rules with a small check interval, such as every two seconds, run later than scheduled. *Resolution*: -Alerts run as background tasks at a cadence defined by their *check interval*. -When an Alert *check interval* is smaller than the Task Manager <> the alert will run late. +Rules run as background tasks at a cadence defined by their *check interval*. +When a Rule *check interval* is smaller than the Task Manager <> the rule will run late. -Either tweak the <> or increase the *check interval* of the alerts in question. +Either tweak the <> or increase the *check interval* of the rules in question. For more details, see <>. [float] -[[scheduled-alerts-run-late]] -=== Alerts run late +[[scheduled-rules-run-late]] +=== Rules run late *Problem*: -Scheduled alerts run at an inconsistent cadence, often running late. +Scheduled rules run at an inconsistent cadence, often running late. -Actions run long after the status of an alert changes, sending a notification of the change too late. +Actions run long after the status of a rule changes, sending a notification of the change too late. *Solution*: -Alerts and actions run as background tasks by each {kib} instance at a default rate of ten tasks every three seconds. +Rules and actions run as background tasks by each {kib} instance at a default rate of ten tasks every three seconds. -If many alerts or actions are scheduled to run at the same time, pending tasks will queue in {es}. Each {kib} instance then polls for pending tasks at a rate of up to ten tasks at a time, at three second intervals. Because alerts and actions are backed by tasks, it is possible for pending tasks in the queue to exceed this capacity and run late. +If many rules or actions are scheduled to run at the same time, pending tasks will queue in {es}. Each {kib} instance then polls for pending tasks at a rate of up to ten tasks at a time, at three second intervals. Because rules and actions are backed by tasks, it is possible for pending tasks in the queue to exceed this capacity and run late. For details on diagnosing the underlying causes of such delays, see <>. Alerting and action tasks are identified by their type. -* Alert tasks always begin with `alerting:`. For example, the `alerting:.index-threshold` tasks back the <>. +* Alerting tasks always begin with `alerting:`. For example, the `alerting:.index-threshold` tasks back the <>. * Action tasks always begin with `actions:`. For example, the `actions:.index` tasks back the <>. -When diagnosing issues related to Alerting, focus on the thats that begin with `alerting:` and `actions:`. +When diagnosing issues related to Alerting, focus on the tasks that begin with `alerting:` and `actions:`. For more details on monitoring and diagnosing task execution in Task Manager, see <>. diff --git a/docs/user/alerting/defining-alerts.asciidoc b/docs/user/alerting/defining-alerts.asciidoc deleted file mode 100644 index 8f1a0f06f75ae..0000000000000 --- a/docs/user/alerting/defining-alerts.asciidoc +++ /dev/null @@ -1,115 +0,0 @@ -[role="xpack"] -[[defining-alerts]] -== Defining alerts - -{kib} alerts can be created in a variety of apps including <>, <>, <>, <>, <> and from <> UI. While alerting details may differ from app to app, they share a common interface for defining and configuring alerts that this section describes in more detail. - -[float] -=== Create an alert - -When you create an alert, you must define the alert details, conditions, and actions. - -. <> -. <> -. <> - -image::images/alert-flyout-sections.png[The three sections of an alert definition] - -[float] -[[defining-alerts-general-details]] -=== General alert details - -All alerts share the following four properties. - -[role="screenshot"] -image::images/alert-flyout-general-details.png[alt='All alerts have name, tags, check every, and notify properties in common'] - -Name:: The name of the alert. While this name does not have to be unique, the name can be referenced in actions and also appears in the searchable alert listing in the management UI. A distinctive name can help identify and find an alert. -Tags:: A list of tag names that can be applied to an alert. Tags can help you organize and find alerts, because tags appear in the alert listing in the management UI which is searchable by tag. -Check every:: This value determines how frequently the alert conditions below are checked. Note that the timing of background alert checks are not guaranteed, particularly for intervals of less than 10 seconds. See <> for more information. -Notify:: This value limits how often actions are repeated when an alert instance remains active across alert checks. See <> for more information. + -- **Only on status change**: Actions are not repeated when an alert instance remains active across checks. Actions run only when the alert status changes. -- **Every time alert is active**: Actions are repeated when an alert instance remains active across checks. -- **On a custom action interval**: Actions are suppressed for the throttle interval, but repeat when an alert instance remains active across checks for a duration longer than the throttle interval. - - -[float] -[[defining-alerts-type-conditions]] -=== Alert type and conditions - -Depending upon the {kib} app and context, you may be prompted to choose the type of alert you wish to create. Some apps will pre-select the type of alert for you. - -[role="screenshot"] -image::images/alert-flyout-alert-type-selection.png[Choosing the type of alert to create] - -Each alert type provides its own way of defining the conditions to detect, but an expression formed by a series of clauses is a common pattern. Each clause has a UI control that allows you to define the clause. For example, in an index threshold alert the `WHEN` clause allows you to select an aggregation operation to apply to a numeric field. - -[role="screenshot"] -image::images/alert-flyout-alert-conditions.png[UI for defining alert conditions on an index threshold alert] - -[float] -[[defining-alerts-actions-details]] -=== Action type and action details - -To add an action to an alert, you first select the type of action: - -[role="screenshot"] -image::images/alert-flyout-action-type-selection.png[UI for selecting an action type] - -When an alert instance matches a condition, the alert is marked as _Active_ and assigned an action group. The actions in that group are triggered. -When the condition is no longer detected, the alert is assigned to the _Recovered_ action group, which triggers any actions assigned to that group. - -**Run When** allows you to assign an action to an action group. This will trigger the action in accordance with your **Notify** setting. - -Each action must specify a <> instance. If no connectors exist for that action type, click *Add action* to create one. - -Each action type exposes different properties. For example an email action allows you to set the recipients, the subject, and a message body in markdown format. See <> for details on the types of actions provided by {kib} and their properties. - -[role="screenshot"] -image::images/alert-flyout-action-details.png[UI for defining an email action] - -[float] -[[defining-alerts-actions-variables]] -==== Action variables -Using the https://mustache.github.io/[Mustache] template syntax `{{variable name}}`, you can pass alert values at the time a condition is detected to an action. You can access the list of available variables using the "add variable" button. Although available variables differ by alert type, all alert types pass the following variables: - -`alertId`:: The ID of the alert. -`alertName`:: The name of the alert. -`spaceId`:: The ID of the space for the alert. -`tags`:: The list of tags applied to the alert. -`date`:: The date the alert scheduled the action, in ISO format. -`alertInstanceId`:: The ID of the alert instance that scheduled the action. -`alertActionGroup`:: The ID of the action group of the alert instance that scheduled the action. -`alertActionSubgroup`:: The action subgroup of the alert instance that scheduled the action. -`alertActionGroupName`:: The name of the action group of the alert instance that scheduled the action. -`kibanaBaseUrl`:: The configured <>. If not configured, this will be empty. - -[role="screenshot"] -image::images/alert-flyout-action-variables.png[Passing alert values to an action] - -Some cases exist where the variable values will be "escaped", when used in a context where escaping is needed: - -- For the <> connector, the `message` action configuration property escapes any characters that would be interpreted as Markdown. -- For the <> connector, the `message` action configuration property escapes any characters that would be interpreted as Slack Markdown. -- For the <> connector, the `body` action configuration property escapes any characters that are invalid in JSON string values. - -Mustache also supports "triple braces" of the form `{{{variable name}}}`, which indicates no escaping should be done at all. Care should be used when using this form, as it could end up rendering the variable content in such a way as to make the resulting parameter invalid or formatted incorrectly. - -Each alert type defines additional variables as properties of the variable `context`. For example, if an alert type defines a variable `value`, it can be used in an action parameter as `{{context.value}}`. - -For diagnostic or exploratory purposes, action variables whose values are objects, such as `context`, can be referenced directly as variables. The resulting value will be a JSON representation of the object. For example, if an action parameter includes `{{context}}`, it will expand to the JSON representation of all the variables and values provided by the alert type. - -You can attach more than one action. Clicking the "Add action" button will prompt you to select another alert type and repeat the above steps again. - -[role="screenshot"] -image::images/alert-flyout-add-action.png[You can add multiple actions on an alert] - -[NOTE] -============================================== -Actions are not required on alerts. You can run an alert without actions to understand its behavior, and then <> later. -============================================== - -[float] -=== Manage alerts - -To modify an alert after it was created, including muting or disabling it, use the <>. diff --git a/docs/user/alerting/defining-rules.asciidoc b/docs/user/alerting/defining-rules.asciidoc new file mode 100644 index 0000000000000..63839cf465e98 --- /dev/null +++ b/docs/user/alerting/defining-rules.asciidoc @@ -0,0 +1,115 @@ +[role="xpack"] +[[defining-alerts]] +== Defining rules + +{kib} alerting rules can be created in a variety of apps including <>, <>, <>, <>, <> and from the <> UI. While alerting details may differ from app to app, they share a common interface for defining and configuring rules that this section describes in more detail. + +[float] +=== Create a rule + +When you create a rule, you must define the rule details, conditions, and actions. + +. <> +. <> +. <> + +image::images/rule-flyout-sections.png[The three sections of a rule definition] + +[float] +[[defining-alerts-general-details]] +=== General rule details + +All rules share the following four properties. + +[role="screenshot"] +image::images/rule-flyout-general-details.png[alt='All rules have name, tags, check every, and notify properties in common'] + +Name:: The name of the rule. While this name does not have to be unique, the name can be referenced in actions and also appears in the searchable rule listing in the management UI. A distinctive name can help identify and find a rule. +Tags:: A list of tag names that can be applied to a rule. Tags can help you organize and find rules, because tags appear in the rule listing in the management UI which is searchable by tag. +Check every:: This value determines how frequently the rule conditions below are checked. Note that the timing of background rule checks are not guaranteed, particularly for intervals of less than 10 seconds. See <> for more information. +Notify:: This value limits how often actions are repeated when an alert remains active across rule checks. See <> for more information. + +- **Only on status change**: Actions are not repeated when an alert remains active across checks. Actions run only when the rule status changes. +- **Every time rule is active**: Actions are repeated when an alert remains active across checks. +- **On a custom action interval**: Actions are suppressed for the throttle interval, but repeat when an alert remains active across checks for a duration longer than the throttle interval. + + +[float] +[[defining-alerts-type-conditions]] +=== Rule type and conditions + +Depending upon the {kib} app and context, you may be prompted to choose the type of rule you wish to create. Some apps will pre-select the type of rule for you. + +[role="screenshot"] +image::images/rule-flyout-rule-type-selection.png[Choosing the type of rule to create] + +Each rule type provides its own way of defining the conditions to detect, but an expression formed by a series of clauses is a common pattern. Each clause has a UI control that allows you to define the clause. For example, in an index threshold rule the `WHEN` clause allows you to select an aggregation operation to apply to a numeric field. + +[role="screenshot"] +image::images/rule-flyout-rule-conditions.png[UI for defining rule conditions on an index threshold rule] + +[float] +[[defining-alerts-actions-details]] +=== Action type and action details + +To add an action to a rule, you first select the type of connector: + +[role="screenshot"] +image::images/rule-flyout-connector-type-selection.png[UI for selecting an action type] + +When an alert matches a condition, the rule is marked as _Active_ and assigned an action group. The actions in that group are triggered. +When the condition is no longer detected, the rule is assigned to the _Recovered_ action group, which triggers any actions assigned to that group. + +**Run When** allows you to assign an action to an action group. This will trigger the action in accordance with your **Notify** setting. + +Each action must specify a <> instance. If no connectors exist for that action type, click *Add connector* to create one. + +Each action type exposes different properties. For example an email action allows you to set the recipients, the subject, and a message body in markdown format. See <> for details on the types of actions provided by {kib} and their properties. + +[role="screenshot"] +image::images/rule-flyout-action-details.png[UI for defining an email action] + +[float] +[[defining-alerts-actions-variables]] +==== Action variables +Using the https://mustache.github.io/[Mustache] template syntax `{{variable name}}`, you can pass rule values at the time a condition is detected to an action. You can access the list of available variables using the "add variable" button. Although available variables differ by rule type, all rule types pass the following variables: + +`rule.id`:: The ID of the rule. +`rule.name`:: The name of the rule. +`rule.spaceId`:: The ID of the space for the rule. +`rule.tags`:: The list of tags applied to the rule. +`date`:: The date the rule scheduled the action, in ISO format. +`alert.id`:: The ID of the alert that scheduled the action. +`alert.actionGroup`:: The ID of the action group of the alert that scheduled the action. +`alert.actionSubgroup`:: The action subgroup of the alert that scheduled the action. +`alert.actionGroupName`:: The name of the action group of the alert that scheduled the action. +`kibanaBaseUrl`:: The configured <>. If not configured, this will be empty. + +[role="screenshot"] +image::images/rule-flyout-action-variables.png[Passing rule values to an action] + +Some cases exist where the variable values will be "escaped", when used in a context where escaping is needed: + +- For the <> connector, the `message` action configuration property escapes any characters that would be interpreted as Markdown. +- For the <> connector, the `message` action configuration property escapes any characters that would be interpreted as Slack Markdown. +- For the <> connector, the `body` action configuration property escapes any characters that are invalid in JSON string values. + +Mustache also supports "triple braces" of the form `{{{variable name}}}`, which indicates no escaping should be done at all. Care should be used when using this form, as it could end up rendering the variable content in such a way as to make the resulting parameter invalid or formatted incorrectly. + +Each rule type defines additional variables as properties of the variable `context`. For example, if a rule type defines a variable `value`, it can be used in an action parameter as `{{context.value}}`. + +For diagnostic or exploratory purposes, action variables whose values are objects, such as `context`, can be referenced directly as variables. The resulting value will be a JSON representation of the object. For example, if an action parameter includes `{{context}}`, it will expand to the JSON representation of all the variables and values provided by the rule type. + +You can attach more than one action. Clicking the "Add action" button will prompt you to select another rule type and repeat the above steps again. + +[role="screenshot"] +image::images/rule-flyout-add-action.png[You can add multiple actions on a rule] + +[NOTE] +============================================== +Actions are not required on rules. You can run a rule without actions to understand its behavior, and then <> later. +============================================== + +[float] +=== Manage rules + +To modify a rule after it was created, including muting or disabling it, use the <>. diff --git a/docs/user/alerting/images/alert-concepts-connectors.svg b/docs/user/alerting/images/alert-concepts-connectors.svg deleted file mode 100644 index 9ae4c21ee5870..0000000000000 --- a/docs/user/alerting/images/alert-concepts-connectors.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/user/alerting/images/alert-concepts-summary.svg b/docs/user/alerting/images/alert-concepts-summary.svg deleted file mode 100644 index 0aed3bf22375f..0000000000000 --- a/docs/user/alerting/images/alert-concepts-summary.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/user/alerting/images/alert-flyout-action-details.png b/docs/user/alerting/images/alert-flyout-action-details.png deleted file mode 100644 index 7547fc819f539..0000000000000 Binary files a/docs/user/alerting/images/alert-flyout-action-details.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-flyout-action-type-selection.png b/docs/user/alerting/images/alert-flyout-action-type-selection.png deleted file mode 100644 index 2df2a031c6661..0000000000000 Binary files a/docs/user/alerting/images/alert-flyout-action-type-selection.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-flyout-action-variables.png b/docs/user/alerting/images/alert-flyout-action-variables.png deleted file mode 100644 index 5b3684ad3fae4..0000000000000 Binary files a/docs/user/alerting/images/alert-flyout-action-variables.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-flyout-alert-type-selection.png b/docs/user/alerting/images/alert-flyout-alert-type-selection.png deleted file mode 100644 index 6ebbe4213ba7d..0000000000000 Binary files a/docs/user/alerting/images/alert-flyout-alert-type-selection.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-flyout-sections.png b/docs/user/alerting/images/alert-flyout-sections.png deleted file mode 100644 index 8fa4bfffe39a3..0000000000000 Binary files a/docs/user/alerting/images/alert-flyout-sections.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-instances.svg b/docs/user/alerting/images/alert-instances.svg deleted file mode 100644 index 97f610041f0eb..0000000000000 --- a/docs/user/alerting/images/alert-instances.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/user/alerting/images/alert-pre-configured-connectors-dropdown.png b/docs/user/alerting/images/alert-pre-configured-connectors-dropdown.png deleted file mode 100644 index 081688758eb48..0000000000000 Binary files a/docs/user/alerting/images/alert-pre-configured-connectors-dropdown.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-pre-configured-slack-connector.png b/docs/user/alerting/images/alert-pre-configured-slack-connector.png deleted file mode 100644 index e9d81877fbf4f..0000000000000 Binary files a/docs/user/alerting/images/alert-pre-configured-slack-connector.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-types-es-query-example-action-variable.png b/docs/user/alerting/images/alert-types-es-query-example-action-variable.png deleted file mode 100644 index 7e40499d78fdd..0000000000000 Binary files a/docs/user/alerting/images/alert-types-es-query-example-action-variable.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-types-es-query-select.png b/docs/user/alerting/images/alert-types-es-query-select.png deleted file mode 100644 index 61fe724ea1412..0000000000000 Binary files a/docs/user/alerting/images/alert-types-es-query-select.png and /dev/null differ diff --git a/docs/user/alerting/images/alert-types-index-threshold-select.png b/docs/user/alerting/images/alert-types-index-threshold-select.png deleted file mode 100644 index 7a68d8815b6d9..0000000000000 Binary files a/docs/user/alerting/images/alert-types-index-threshold-select.png and /dev/null differ diff --git a/docs/user/alerting/images/alerting-overview.png b/docs/user/alerting/images/alerting-overview.png index b4ec6f3df6028..7a4124f1b0377 100644 Binary files a/docs/user/alerting/images/alerting-overview.png and b/docs/user/alerting/images/alerting-overview.png differ diff --git a/docs/user/alerting/images/alerts.svg b/docs/user/alerting/images/alerts.svg new file mode 100644 index 0000000000000..022b3106ae802 --- /dev/null +++ b/docs/user/alerting/images/alerts.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/user/alerting/images/pre-configured-action-type-alert-form.png b/docs/user/alerting/images/pre-configured-action-type-alert-form.png deleted file mode 100644 index e12bad468009a..0000000000000 Binary files a/docs/user/alerting/images/pre-configured-action-type-alert-form.png and /dev/null differ diff --git a/docs/user/alerting/images/pre-configured-action-type-managing.png b/docs/user/alerting/images/pre-configured-action-type-managing.png deleted file mode 100644 index 95fe1c6aa0958..0000000000000 Binary files a/docs/user/alerting/images/pre-configured-action-type-managing.png and /dev/null differ diff --git a/docs/user/alerting/images/pre-configured-action-type-select-type.png b/docs/user/alerting/images/pre-configured-action-type-select-type.png deleted file mode 100644 index 91ca831840ce9..0000000000000 Binary files a/docs/user/alerting/images/pre-configured-action-type-select-type.png and /dev/null differ diff --git a/docs/user/alerting/images/pre-configured-connectors-managing.png b/docs/user/alerting/images/pre-configured-connectors-managing.png index f97e93175fa36..e41b89b331007 100644 Binary files a/docs/user/alerting/images/pre-configured-connectors-managing.png and b/docs/user/alerting/images/pre-configured-connectors-managing.png differ diff --git a/docs/user/alerting/images/pre-configured-connectors-view-screen.png b/docs/user/alerting/images/pre-configured-connectors-view-screen.png index 9c75f86498beb..b2d00b307000e 100644 Binary files a/docs/user/alerting/images/pre-configured-connectors-view-screen.png and b/docs/user/alerting/images/pre-configured-connectors-view-screen.png differ diff --git a/docs/user/alerting/images/rule-concepts-connectors.svg b/docs/user/alerting/images/rule-concepts-connectors.svg new file mode 100644 index 0000000000000..caee5f858fea9 --- /dev/null +++ b/docs/user/alerting/images/rule-concepts-connectors.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/user/alerting/images/rule-concepts-summary.svg b/docs/user/alerting/images/rule-concepts-summary.svg new file mode 100644 index 0000000000000..aed7020b9d3e2 --- /dev/null +++ b/docs/user/alerting/images/rule-concepts-summary.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/user/alerting/images/rule-flyout-action-details.png b/docs/user/alerting/images/rule-flyout-action-details.png new file mode 100644 index 0000000000000..682829619a2a6 Binary files /dev/null and b/docs/user/alerting/images/rule-flyout-action-details.png differ diff --git a/docs/user/alerting/images/rule-flyout-action-variables.png b/docs/user/alerting/images/rule-flyout-action-variables.png new file mode 100644 index 0000000000000..31da8a2d58021 Binary files /dev/null and b/docs/user/alerting/images/rule-flyout-action-variables.png differ diff --git a/docs/user/alerting/images/alert-flyout-add-action.png b/docs/user/alerting/images/rule-flyout-add-action.png similarity index 100% rename from docs/user/alerting/images/alert-flyout-add-action.png rename to docs/user/alerting/images/rule-flyout-add-action.png diff --git a/docs/user/alerting/images/rule-flyout-connector-type-selection.png b/docs/user/alerting/images/rule-flyout-connector-type-selection.png new file mode 100644 index 0000000000000..88428110a8f66 Binary files /dev/null and b/docs/user/alerting/images/rule-flyout-connector-type-selection.png differ diff --git a/docs/user/alerting/images/alert-flyout-general-details.png b/docs/user/alerting/images/rule-flyout-general-details.png similarity index 100% rename from docs/user/alerting/images/alert-flyout-general-details.png rename to docs/user/alerting/images/rule-flyout-general-details.png diff --git a/docs/user/alerting/images/alert-flyout-alert-conditions.png b/docs/user/alerting/images/rule-flyout-rule-conditions.png similarity index 100% rename from docs/user/alerting/images/alert-flyout-alert-conditions.png rename to docs/user/alerting/images/rule-flyout-rule-conditions.png diff --git a/docs/user/alerting/images/rule-flyout-rule-type-selection.png b/docs/user/alerting/images/rule-flyout-rule-type-selection.png new file mode 100644 index 0000000000000..40f2ce44b631d Binary files /dev/null and b/docs/user/alerting/images/rule-flyout-rule-type-selection.png differ diff --git a/docs/user/alerting/images/rule-flyout-sections.png b/docs/user/alerting/images/rule-flyout-sections.png new file mode 100644 index 0000000000000..773c6a6fa8dbc Binary files /dev/null and b/docs/user/alerting/images/rule-flyout-sections.png differ diff --git a/docs/user/alerting/images/alert-types-es-query-conditions.png b/docs/user/alerting/images/rule-types-es-query-conditions.png similarity index 100% rename from docs/user/alerting/images/alert-types-es-query-conditions.png rename to docs/user/alerting/images/rule-types-es-query-conditions.png diff --git a/docs/user/alerting/images/rule-types-es-query-example-action-variable.png b/docs/user/alerting/images/rule-types-es-query-example-action-variable.png new file mode 100644 index 0000000000000..8cb5c07543ddc Binary files /dev/null and b/docs/user/alerting/images/rule-types-es-query-example-action-variable.png differ diff --git a/docs/user/alerting/images/alert-types-es-query-invalid.png b/docs/user/alerting/images/rule-types-es-query-invalid.png similarity index 100% rename from docs/user/alerting/images/alert-types-es-query-invalid.png rename to docs/user/alerting/images/rule-types-es-query-invalid.png diff --git a/docs/user/alerting/images/alert-types-es-query-valid.png b/docs/user/alerting/images/rule-types-es-query-valid.png similarity index 100% rename from docs/user/alerting/images/alert-types-es-query-valid.png rename to docs/user/alerting/images/rule-types-es-query-valid.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-conditions.png b/docs/user/alerting/images/rule-types-index-threshold-conditions.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-conditions.png rename to docs/user/alerting/images/rule-types-index-threshold-conditions.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-aggregation.png b/docs/user/alerting/images/rule-types-index-threshold-example-aggregation.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-aggregation.png rename to docs/user/alerting/images/rule-types-index-threshold-example-aggregation.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-comparison.png b/docs/user/alerting/images/rule-types-index-threshold-example-comparison.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-comparison.png rename to docs/user/alerting/images/rule-types-index-threshold-example-comparison.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-grouping.png b/docs/user/alerting/images/rule-types-index-threshold-example-grouping.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-grouping.png rename to docs/user/alerting/images/rule-types-index-threshold-example-grouping.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-index.png b/docs/user/alerting/images/rule-types-index-threshold-example-index.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-index.png rename to docs/user/alerting/images/rule-types-index-threshold-example-index.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-preview.png b/docs/user/alerting/images/rule-types-index-threshold-example-preview.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-preview.png rename to docs/user/alerting/images/rule-types-index-threshold-example-preview.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-threshold.png b/docs/user/alerting/images/rule-types-index-threshold-example-threshold.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-threshold.png rename to docs/user/alerting/images/rule-types-index-threshold-example-threshold.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-timefield.png b/docs/user/alerting/images/rule-types-index-threshold-example-timefield.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-timefield.png rename to docs/user/alerting/images/rule-types-index-threshold-example-timefield.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-example-window.png b/docs/user/alerting/images/rule-types-index-threshold-example-window.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-example-window.png rename to docs/user/alerting/images/rule-types-index-threshold-example-window.png diff --git a/docs/user/alerting/images/alert-types-index-threshold-preview.png b/docs/user/alerting/images/rule-types-index-threshold-preview.png similarity index 100% rename from docs/user/alerting/images/alert-types-index-threshold-preview.png rename to docs/user/alerting/images/rule-types-index-threshold-preview.png diff --git a/docs/user/alerting/images/rule-types-index-threshold-select.png b/docs/user/alerting/images/rule-types-index-threshold-select.png new file mode 100644 index 0000000000000..aeb9de279b3a1 Binary files /dev/null and b/docs/user/alerting/images/rule-types-index-threshold-select.png differ diff --git a/docs/user/alerting/images/what-is-a-rule.svg b/docs/user/alerting/images/what-is-a-rule.svg new file mode 100644 index 0000000000000..2117e448ba136 --- /dev/null +++ b/docs/user/alerting/images/what-is-a-rule.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/user/alerting/images/what-is-an-action.svg b/docs/user/alerting/images/what-is-an-action.svg index 7675f717a6c84..f8435ee24fc19 100644 --- a/docs/user/alerting/images/what-is-an-action.svg +++ b/docs/user/alerting/images/what-is-an-action.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/docs/user/alerting/images/what-is-an-alert.svg b/docs/user/alerting/images/what-is-an-alert.svg deleted file mode 100644 index b4dc02fae39a5..0000000000000 --- a/docs/user/alerting/images/what-is-an-alert.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/user/alerting/index.asciidoc b/docs/user/alerting/index.asciidoc index be95fe0ef0f86..a29ca1c4ca012 100644 --- a/docs/user/alerting/index.asciidoc +++ b/docs/user/alerting/index.asciidoc @@ -1,5 +1,5 @@ include::alerting-getting-started.asciidoc[] -include::defining-alerts.asciidoc[] +include::defining-rules.asciidoc[] include::action-types.asciidoc[] -include::alert-types.asciidoc[] +include::rule-types.asciidoc[] include::alerting-troubleshooting.asciidoc[] diff --git a/docs/user/alerting/maps-alerts/geo-alert-types.asciidoc b/docs/user/alerting/map-rules/geo-rule-types.asciidoc similarity index 68% rename from docs/user/alerting/maps-alerts/geo-alert-types.asciidoc rename to docs/user/alerting/map-rules/geo-rule-types.asciidoc index f899cd0204b9a..4b17145c2d149 100644 --- a/docs/user/alerting/maps-alerts/geo-alert-types.asciidoc +++ b/docs/user/alerting/map-rules/geo-rule-types.asciidoc @@ -1,16 +1,16 @@ [role="xpack"] [[geo-alerting]] -=== Geo alerting +=== Geo rule type -Alerting now includes one additional stack alert: <>. +Alerting now includes one additional stack rule: <>. -As with other stack alerts, you need `all` access to the *Stack Alerts* feature -to be able to create and edit a geo alert. +As with other stack rules, you need `all` access to the *Stack Rules* feature +to be able to create and edit a geo rule. See <> for more information on configuring roles that provide access to this feature. [float] ==== Geo alerting requirements -To create a *Tracking containment* alert, the following requirements must be present: +To create a *Tracking containment* rule, the following requirements must be present: - *Tracks index or index pattern*: An index containing a `geo_point` field, `date` field, and some form of entity identifier. An entity identifier is a `keyword` or `number` @@ -18,7 +18,7 @@ field that consistently identifies the entity to be tracked. The data in this in updating so that there are entity movements to alert upon. - *Boundaries index or index pattern*: An index containing `geo_shape` data, such as boundary data and bounding box data. This data is presumed to be static (not updating). Shape data matching the query is -harvested once when the alert is created and anytime after when the alert is re-enabled +harvested once when the rule is created and anytime after when the rule is re-enabled after disablement. By design, current interval entity locations (_current_ is determined by `date` in @@ -26,26 +26,26 @@ the *Tracked index or index pattern*) are queried to determine if they are conta within any monitored boundaries. Entity data should be somewhat "real time", meaning the dates of new documents aren’t older than the current time minus the amount of the interval. If data older than -`now - ` is ingested, it won't trigger an alert. +`now - ` is ingested, it won't trigger a rule. [float] -==== Creating a geo alert -Click the *Create* button in the <>. -Complete the <>. +==== Creating a geo rule +Click the *Create* button in the <>. +Complete the <>. [role="screenshot"] -image::user/alerting/images/alert-types-tracking-select.png[Choosing a tracking alert type] +image::user/alerting/images/alert-types-tracking-select.png[Choosing a tracking rule type] [float] -[[alert-type-tracking-containment]] +[[rule-type-tracking-containment]] ==== Tracking containment -The Tracking containment alert type runs an {es} query over indices, determining if any +The Tracking containment rule type runs an {es} query over indices, determining if any documents are currently contained within any boundaries from the specified boundary index. In the event that an entity is contained within a boundary, an alert may be generated. [float] ===== Defining the conditions -Tracking containment alerts have 3 clauses that define the condition to detect, +Tracking containment rules have 3 clauses that define the condition to detect, as well as 2 Kuery bars used to provide additional filtering context for each of the indices. [role="screenshot"] @@ -54,15 +54,15 @@ image::user/alerting/images/alert-types-tracking-containment-conditions.png[Five Index (entity):: This clause requires an *index or index pattern*, a *time field* that will be used for the *time window*, and a *`geo_point` field* for tracking. When entity:: This clause specifies which crossing option to track. The values *Entered*, *Exited*, and *Crossed* can be selected to indicate which crossing conditions -should trigger an alert. *Entered* alerts on entry into a boundary, *Exited* alerts on exit +should trigger a rule. *Entered* alerts on entry into a boundary, *Exited* alerts on exit from a boundary, and *Crossed* alerts on all boundary crossings whether they be entrances or exits. Index (Boundary):: This clause requires an *index or index pattern*, a *`geo_shape` field* identifying boundaries, and an optional *Human-readable boundary name* for better alerting messages. -Conditions for how an alert is tracked can be specified uniquely for each individual action. -An alert can be triggered either when a containment condition is met or when an entity +Conditions for how a rule is tracked can be specified uniquely for each individual action. +A rule can be triggered either when a containment condition is met or when an entity is no longer contained. [role="screenshot"] diff --git a/docs/user/alerting/rule-types.asciidoc b/docs/user/alerting/rule-types.asciidoc new file mode 100644 index 0000000000000..44a22c548757c --- /dev/null +++ b/docs/user/alerting/rule-types.asciidoc @@ -0,0 +1,42 @@ +[role="xpack"] +[[rule-types]] +== Rules + +Kibana provides two types of rules: + +* Stack rules, which are built into {kib} +* Domain-specific rules, which are registered by {kib} apps. + +[float] +==== Standard stack rules + +{kib} provides two stack rules: + +* <> +* <> + +Users require the `all` privilege to access the *Stack Rules* feature and create and edit rules. +See <> for more information. + +[float] +==== Domain-specific rules + +For domain-specific rules, refer to the documentation for that app. +{kib} supports these rules: + +* {observability-guide}/create-alerts.html[Observability rules] +* {security-guide}/prebuilt-rules.html[Security rules] +* <> +* {ml-docs}/ml-configuring-alerts.html[{ml-cap} rules] beta:[] + +[NOTE] +============================================== +Some rule types are subscription features, while others are free features. +For a comparison of the Elastic subscription levels, +see {subscriptions}[the subscription page]. +============================================== + + +include::stack-rules/index-threshold.asciidoc[] +include::stack-rules/es-query.asciidoc[] +include::map-rules/geo-rule-types.asciidoc[] diff --git a/docs/user/alerting/stack-alerts/es-query.asciidoc b/docs/user/alerting/stack-rules/es-query.asciidoc similarity index 60% rename from docs/user/alerting/stack-alerts/es-query.asciidoc rename to docs/user/alerting/stack-rules/es-query.asciidoc index cac53f6600163..c62ebbf4bf2bc 100644 --- a/docs/user/alerting/stack-alerts/es-query.asciidoc +++ b/docs/user/alerting/stack-rules/es-query.asciidoc @@ -1,13 +1,13 @@ [role="xpack"] -[[alert-type-es-query]] +[[rule-type-es-query]] === {es} query -The {es} query alert type runs a user-configured {es} query, compares the number of matches to a configured threshold, and schedules actions to run when the threshold condition is met. +The {es} query rule type runs a user-configured {es} query, compares the number of matches to a configured threshold, and schedules actions to run when the threshold condition is met. [float] -==== Create the alert +==== Create the rule -Fill in the <>, then select *{es} query*. +Fill in the <>, then select *{es} query*. [float] ==== Define the conditions @@ -15,35 +15,35 @@ Fill in the <>, then select *{es Define properties to detect the condition. [role="screenshot"] -image::user/alerting/images/alert-types-es-query-conditions.png[Five clauses define the condition to detect] +image::user/alerting/images/rule-types-es-query-conditions.png[Five clauses define the condition to detect] Index:: This clause requires an *index or index pattern* and a *time field* that will be used for the *time window*. Size:: This clause specifies the number of documents to pass to the configured actions when the the threshold condition is met. {es} query:: This clause specifies the ES DSL query to execute. The number of documents that match this query will be evaulated against the threshold condition. Aggregations are not supported at this time. Threshold:: This clause defines a threshold value and a comparison operator (`is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The number of documents that match the specified query is compared to this threshold. -Time window:: This clause determines how far back to search for documents, using the *time field* set in the *index* clause. Generally this value should be set to a value higher than the *check every* value in the <>, to avoid gaps in detection. +Time window:: This clause determines how far back to search for documents, using the *time field* set in the *index* clause. Generally this value should be set to a value higher than the *check every* value in the <>, to avoid gaps in detection. [float] ==== Add action variables -<> to run when the alert condition is met. The following variables are specific to the {es} query alert. You can also specify <>. +<> to run when the rule condition is met. The following variables are specific to the {es} query rule. You can also specify <>. -`context.title`:: A preconstructed title for the alert. Example: `alert term match alert query matched`. -`context.message`:: A preconstructed message for the alert. Example: + -`alert 'term match alert' is active:` + +`context.title`:: A preconstructed title for the rule. Example: `rule term match alert query matched`. +`context.message`:: A preconstructed message for the rule. Example: + +`rule 'term match alert' is active:` + `- Value: 42` + `- Conditions Met: count greater than 4 over 5m` + `- Timestamp: 2020-01-01T00:00:00.000Z` `context.group`:: The name of the action group associated with the condition. Example: `query matched`. -`context.date`:: The date, in ISO format, that the alert met the condition. Example: `2020-01-01T00:00:00.000Z`. -`context.value`:: The value of the alert that met the condition. +`context.date`:: The date, in ISO format, that the rule met the condition. Example: `2020-01-01T00:00:00.000Z`. +`context.value`:: The value of the rule that met the condition. `context.conditions`:: A description of the condition. Example: `count greater than 4`. `context.hits`:: The most recent ES documents that matched the query. Using the https://mustache.github.io/[Mustache] template array syntax, you can iterate over these hits to get values from the ES documents into your actions. + [role="screenshot"] -image::images/alert-types-es-query-example-action-variable.png[Iterate over hits using Mustache template syntax] +image::images/rule-types-es-query-example-action-variable.png[Iterate over hits using Mustache template syntax] [float] @@ -55,9 +55,9 @@ Use the *Test query* feature to verify that your query DSL is valid. match the query will be displayed. + [role="screenshot"] -image::user/alerting/images/alert-types-es-query-valid.png[Test {es} query returns number of matches when valid] +image::user/alerting/images/rule-types-es-query-valid.png[Test {es} query returns number of matches when valid] * An error message is shown if the query is invalid. + [role="screenshot"] -image::user/alerting/images/alert-types-es-query-invalid.png[Test {es} query shows error when invalid] \ No newline at end of file +image::user/alerting/images/rule-types-es-query-invalid.png[Test {es} query shows error when invalid] \ No newline at end of file diff --git a/docs/user/alerting/stack-alerts/index-threshold.asciidoc b/docs/user/alerting/stack-rules/index-threshold.asciidoc similarity index 50% rename from docs/user/alerting/stack-alerts/index-threshold.asciidoc rename to docs/user/alerting/stack-rules/index-threshold.asciidoc index 89ca8e3087f12..43b750b85fb3b 100644 --- a/docs/user/alerting/stack-alerts/index-threshold.asciidoc +++ b/docs/user/alerting/stack-rules/index-threshold.asciidoc @@ -1,13 +1,13 @@ [role="xpack"] -[[alert-type-index-threshold]] +[[rule-type-index-threshold]] === Index threshold -The index threshold alert type runs an {es} query. It aggregates field values from documents, compares them to threshold values, and schedules actions to run when the thresholds are met. +The index threshold rule type runs an {es} query. It aggregates field values from documents, compares them to threshold values, and schedules actions to run when the thresholds are met. [float] -==== Create the alert +==== Create the rule -Fill in the <>, then select *Index Threshold*. +Fill in the <>, then select *Index Threshold*. [float] ==== Define the conditions @@ -15,86 +15,86 @@ Fill in the <>, then select *Ind Define properties to detect the condition. [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-conditions.png[Five clauses define the condition to detect] +image::user/alerting/images/rule-types-index-threshold-conditions.png[Five clauses define the condition to detect] Index:: This clause requires an *index or index pattern* and a *time field* that will be used for the *time window*. When:: This clause specifies how the value to be compared to the threshold is calculated. The value is calculated by aggregating a numeric field a the *time window*. The aggregation options are: `count`, `average`, `sum`, `min`, and `max`. When using `count` the document count is used, and an aggregation field is not necessary. -Over/Grouped Over:: This clause lets you configure whether the aggregation is applied over all documents, or should be split into groups using a grouping field. If grouping is used, an <> will be created for each group when it exceeds the threshold. To limit the number of instances on high cardinality fields, you must specify the number of groups to check against the threshold. Only the *top* groups are checked. +Over/Grouped Over:: This clause lets you configure whether the aggregation is applied over all documents, or should be split into groups using a grouping field. If grouping is used, an <> will be created for each group when it exceeds the threshold. To limit the number of alerts on high cardinality fields, you must specify the number of groups to check against the threshold. Only the *top* groups are checked. Threshold:: This clause defines a threshold value and a comparison operator (one of `is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The result of the aggregation is compared to this threshold. -Time window:: This clause determines how far back to search for documents, using the *time field* set in the *index* clause. Generally this value should be to a value higher than the *check every* value in the <>, to avoid gaps in detection. +Time window:: This clause determines how far back to search for documents, using the *time field* set in the *index* clause. Generally this value should be to a value higher than the *check every* value in the <>, to avoid gaps in detection. If data is available and all clauses have been defined, a preview chart will render the threshold value and display a line chart showing the value for the last 30 intervals. This can provide an indication of recent values and their proximity to the threshold, and help you tune the clauses. [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-preview.png[Five clauses define the condition to detect] +image::user/alerting/images/rule-types-index-threshold-preview.png[Five clauses define the condition to detect] [float] ==== Add action variables -<> to run when the alert condition is met. The following variables are specific to the index threshold alert. You can also specify <>. +<> to run when the rule condition is met. The following variables are specific to the index threshold rule. You can also specify <>. -`context.title`:: A preconstructed title for the alert. Example: `alert kibana sites - high egress met threshold`. -`context.message`:: A preconstructed message for the alert. Example: + -`alert 'kibana sites - high egress' is active for group 'threshold met':` + +`context.title`:: A preconstructed title for the rule. Example: `rule kibana sites - high egress met threshold`. +`context.message`:: A preconstructed message for the rule. Example: + +`rule 'kibana sites - high egress' is active for group 'threshold met':` + `- Value: 42` + `- Conditions Met: count greater than 4 over 5m` + `- Timestamp: 2020-01-01T00:00:00.000Z` `context.group`:: The name of the action group associated with the threshold condition. Example: `threshold met`. -`context.date`:: The date, in ISO format, that the alert met the threshold condition. Example: `2020-01-01T00:00:00.000Z`. -`context.value`:: The value for the alert that met the threshold condition. +`context.date`:: The date, in ISO format, that the rule met the threshold condition. Example: `2020-01-01T00:00:00.000Z`. +`context.value`:: The value for the rule that met the threshold condition. `context.conditions`:: A description of the threshold condition. Example: `count greater than 4` [float] ==== Example -In this example, you will use the {kib} <> to set up and tune the conditions on an index threshold alert. For this example, you want to detect when any of the top four sites serve more than 420,000 bytes over a 24 hour period. +In this example, you will use the {kib} <> to set up and tune the conditions on an index threshold rule. For this example, you want to detect when any of the top four sites serve more than 420,000 bytes over a 24 hour period. -. Open the main menu, then click **Stack Management > Alerts and Actions**. +. Open the main menu, then click **Stack Management > Rules and Connectors**. -. Create a new alert that is checked every four hours and executes actions when the alert status changes. +. Create a new rule that is checked every four hours and executes actions when the rule status changes. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-select.png[Choosing an index threshold alert type] +image::user/alerting/images/rule-types-index-threshold-select.png[Choosing an index threshold rule type] -. Select the **Index threshold** alert type. +. Select the **Index threshold** rule type. . Click *Index*, and set *Indices to query* to *kibana_sample_data_logs*. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-index.png[Choosing an index] +image::user/alerting/images/rule-types-index-threshold-example-index.png[Choosing an index] . Set the *Time field* to *@timestamp*. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-timefield.png[Choosing a time field] +image::user/alerting/images/rule-types-index-threshold-example-timefield.png[Choosing a time field] . To detect the number of bytes served during the time window, click *When* and select `sum` as the aggregation, and bytes as the field to aggregate. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-aggregation.png[Choosing the aggregation] +image::user/alerting/images/rule-types-index-threshold-example-aggregation.png[Choosing the aggregation] . To detect the four sites that have the most traffic, click *Over* and select `top`, enter `4`, and select `host.keyword` as the field. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-grouping.png[Choosing the groups] +image::user/alerting/images/rule-types-index-threshold-example-grouping.png[Choosing the groups] -. To alert when any of the top four sites exceeds 420,000 bytes over a 24 hour period, select `is above` and enter `420000`. +. To trigger the rule when any of the top four sites exceeds 420,000 bytes over a 24 hour period, select `is above` and enter `420000`. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-threshold.png[Setting the threshold] +image::user/alerting/images/rule-types-index-threshold-example-threshold.png[Setting the threshold] -. Finally, click *For the last*, enter `24` and select `hours` to complete the alert configuration. +. Finally, click *For the last*, enter `24` and select `hours` to complete the rule configuration. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-window.png[Setting the time window] +image::user/alerting/images/rule-types-index-threshold-example-window.png[Setting the time window] . The preview chart will render showing the 24 hour sum of bytes at 4 hours intervals (the *check every* interval) for the past 120 hours (the last 30 intervals). + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-preview.png[Setting the time window] +image::user/alerting/images/rule-types-index-threshold-example-preview.png[Setting the time window] -. Change the time window and observe the effect it has on the chart. Compare a 24 window to a 12 hour window. Notice the variability in the sum of bytes, due to different traffic levels during the day compared to at night. This variability would result in noisy alerts, so the 24 hour window is better. The preview chart can help you find the right values for your alert. +. Change the time window and observe the effect it has on the chart. Compare a 24 window to a 12 hour window. Notice the variability in the sum of bytes, due to different traffic levels during the day compared to at night. This variability would result in noisy rules, so the 24 hour window is better. The preview chart can help you find the right values for your rule. + [role="screenshot"] -image::user/alerting/images/alert-types-index-threshold-example-comparison.png[Comparing two time windows] \ No newline at end of file +image::user/alerting/images/rule-types-index-threshold-example-comparison.png[Comparing two time windows] \ No newline at end of file diff --git a/docs/user/dashboard/dashboard.asciidoc b/docs/user/dashboard/dashboard.asciidoc index 75589ad74724c..1752f067801b4 100644 --- a/docs/user/dashboard/dashboard.asciidoc +++ b/docs/user/dashboard/dashboard.asciidoc @@ -34,11 +34,14 @@ Dashboards support many types of panels, and provide several editors that you ca | <> | Add context to your panels with <>, or add dynamic filters with <>. -| <> -| Display a previously saved search table from <>. The table results are not aggregated. +| <> +| Display a saved search table from <>. The table results are not aggregated. -| <> -| Display a previously saved visualization of <> anomaly detection data. +| <> +| Display a table of live streaming logs. + +| <> +| Display the results from machine learning anomaly detection jobs. |=== @@ -78,37 +81,84 @@ Begin with an empty dashboard, or open an existing dashboard. * To open an existing dashboard, click the dashboard *Title* you want to open. +[float] +[[add-panels]] +=== Add panels + +To add panels to the dashboard, you can use one of the editors to create a new panel, +add an existing panel from the *Visualize Library*, add a table of live streaming logs, or the add the results from a machine learning anomaly detection job. + [float] [[create-panels-with-lens]] -=== Create panels +==== Create panels + +To create panels, use one of the editors, then add the panel to the dashboard. + +. On the dashboard, click *Create panel*. + +. On the *New visualization* window, click the editor you want to use. *Lens* is recommended for most users. + +. To create the panel, configure the editor options. + +. To add the panel to the dashboard, choose one of the following options: + +* To add the panel to the dashboard without saving to the *Visualize Library*, click *Save and return*. ++ +To add a title to the panel, click *No Title*, enter the *Panel title*, then click *Save*. + +* To save the panel to the *Visualize Library*, click *Save to Library*, configure the options, then click *Save and return*. ++ +When panels are saved in the *Visualize Library*, image:dashboard/images/visualize-library-icon.png[Visualize Library icon] appears in the header. + +[float] +[[add-panels-from-the-library]] +==== Add panels from the library + +Add panels that you've already created from the *Visualize Library*. + +. On the dashboard, click *Add from library*. + +. On the *Add from library* flyout, click the panels you want to add to the dashboard. + +. To close the flyout, click *X*. ++ +When a panel contains a stored query, both queries are applied. -Choose the type of panel you want to create, then save the panel to the dashboard. +. To make changes to the panel, open the panel menu, then select the following options: -. From the dashboard, choose one of the following options: +* *Edit visualization* — Opens an editor so that you can reconfigure the panel. ++ +To make changes to the panel without affecting the original version, open the panel menu, then click *More > Unlink from library*. -* To create a panel, click *Create panel*, then click the panel type on the *New visualization* window. *Lens* is recommended for most users. +* *Edit panel title* — Opens the *Customize panel* window to change the *Panel title* and specify whether you want to display the panel title. -* To add a saved panel, click *Add from library*, then select the panel you want to add. When a panel contains a stored query, both queries are applied. +[float] +[[add-a-table-of-live-streaming-logs]] +==== Add a logs panel -. To save the panel, click *Save* in the toolbar, then configure the *Save visualization* options. +Add a panel that displays a table of live streaming logs. -.. Enter the *Title* and optional *Description*. +. On the dashboard, click *Add from library*. -.. From the *Tags* drop down, select any applicable tags. +. On the *Add from library* flyout, click *Create new*, then select *Log stream*. + +[float] +[[add-machine-learning-results]] +==== Add machine learning results -.. Select *Add to Dashboard after saving*. +Add a panel that displays the results from machine learning anomaly detection jobs. -.. Click *Save and return*. +. On the dashboard, click *Add from library*. -TIP: To access your saved panels, open the main menu, then click *Visualize Library*. +. On the *Add from library* flyout, click *Create new*, then select *ML Anomaly Swim Lane*. [float] [[arrange-panels]] [[moving-containers]] [[resizing-containers]] -=== Arrange panels +=== Arrange the panels -To compare the data in the panels, arrange the panels on the dashboard, or remove the panel from the dashboard. +To compare the data in the panels, reorganize or remove the panels on the dashboard. . From the toolbar, click *Edit*, then use the following options: @@ -116,56 +166,101 @@ To compare the data in the panels, arrange the panels on the dashboard, or remov * To resize, click the resize control, then drag to the new dimensions. -* To delete, open the panel menu, then select *Delete from dashboard*. +* To maximize the panel to fullscreen, open the panel menu, then click *More > Maximize panel*. + +* To delete, open the panel menu, then click *More > Delete from dashboard*. . To save your changes, click *Save* in the toolbar. +[float] +[[apply-design-options]] +=== Apply design options + +Apply a set of design options to the entire dashboard. + +. From the toolbar, click *Edit > Options*. + +. Select the following options: + +* *Use margins between panels* — Specifies a margin of space between each panel. + +* *Show panel titles* — Specifies the appearance of titles in the header of each panel. + +* *Sync color pallettes across panels* — Specifies whether the color pallette is applied to all panels. + [float] [[search-or-filter-your-data]] === Search or filter your data -{kib} provides you with several ways to search your data and apply {es} filters. You can combine the filters with any panel-specific -filters to display the data want to you see. +{kib} provides you with several ways to search your data and apply {es} filters. You can combine the filters with any panel +filter to display the data want to you see. -[role="screenshot"] -image::dashboard/images/dashboard-filters.png[Labeled interface with semi-structured search, time filter, and additional filters] +[float] +[[semi-structured-search]] +==== Semi-structured search + +Combine free text search with field-based search using the <>. +Type a search term to match across all fields, or begin typing a field name to +get prompted with field names and operators you can use to build a structured query. + +For example, in the sample web logs data, the following query displays data only for the US: + +. Enter `g`, then select *geo.source*. -Semi-structured search:: - Combine free text search with field-based search using the <>. - Type a search term to match across all fields, or begin typing a field name to - get prompted with field names and operators you can use to build a structured query. - For example, in the sample web logs data, this query displays data only for the US: +. Select *equals some value* and *US*, then click *Update*. - . Enter `g`, then select *geo.source*. - . Select *equals some value* and *US*, then click *Update*. - . For a more complex search, try: +. For a more complex search, try: [source,text] ------------------- geo.src : "US" and url.keyword : "https://www.elastic.co/downloads/beats/metricbeat" ------------------- -Time filter:: - Dashboards have a global time filter that restricts the data that displays, but individual panels can - override the global time filter. +[float] +[[time-filter]] +==== Time filter + +The <> restrict the data that appears on the dashboard, but you can override the time filter with panel filters. - . To update the time filter, add a panel that displays time on the x-axis. +. To update the time filter, add a panel that displays time-based data along the x-axis. - . Open the panel menu, then select *More > Customize time range*. +. Open the panel menu, then select *More > Customize time range*. - . On the *Customize panel time range* window, specify the new time range, then click *Add to panel*. - +. On the *Customize panel time range* window, specify the time range, then click *Add to panel*. ++ [role="screenshot"] image:images/time_range_per_panel.gif[Time range per dashboard panel] -Additional filters with AND:: - Add filters to a dashboard, or pin filters to multiple places in {kib}. To add filters, using a basic editor or an advanced JSON editor for the {es} {ref}/query-dsl.html[query DSL]. - When you use more than one index pattern on a dashboard, the filter editor allows you to filter only one dashboard. - To dynamically add filters, click a series on a dashboard. For example, to filter the dashboard to display only ios data: - . Click *Add filter*. - . Set *Field* to *machine.os*, *Operator* to *is*, and *Value* to *ios*. - . *Save* the filter. - . To remove the filter, click *x*. +[float] +[[additional-filters-with-and]] +==== Additional filters with AND + +Add filters to a dashboard, or pin filters to multiple places in {kib}. To add filters, you can use the *Edit Filter* options, or the advanced JSON editor for the {es} {ref}/query-dsl.html[Query DSL]. +When there is one or more index patterns on the dashboard, you can select the index pattern that contains the fields you want to create the filter. + +For example, to filter the dashboard to display only ios data from *kibana_sample_data_logs*: + +. Click *Add filter*. + +. From the *Index Pattern* dropdown, select *kibana_sample_data_logs*. + +. Set *Field* to *machine.os*, *Operator* to *is*, and *Value* to *ios*. + +. *Save* the filter. ++ +To remove the filter, click *x*. + +[float] +[[add-dynamic-filters]] +==== Add dynamic filters + +When you see data in a panel that you want to use as a filter, you can dynamically create the filter. To dynamically add filters, click the data in a panel. + +. Click the data in the panel. + +. Select filters you want to apply to all of the dashboard panels, then click *Apply*. ++ +To remove the filters, click *x*. [float] [[clone-panels]] @@ -173,7 +268,7 @@ Additional filters with AND:: To duplicate a panel and the configured functionality, clone the panel. Cloned panels continue to replicate all of the functionality from the original panel, including renaming, editing, and cloning. When you clone a panel, the clone appears beside the original panel, and moves other panels to provide a space on the -dashboard. +dashboard. . From the toolbar, click *Edit*. @@ -182,52 +277,75 @@ dashboard. [role="screenshot"] image:images/clone_panel.gif[clone panel] + -To access the cloned panel, open the main menu, then click *Visualize Library*. +When cloned panels are saved in the *Visualize Library*, image:dashboard/images/visualize-library-icon.png[Visualize Library icon] appears in the header. + +[float] +[[copy-to-dashboard]] +=== Copy panels + +To add a panel to another dashboard, copy the panel. + +. Open the panel menu, then select *More > Copy to dashboard*. + +. On the *Copy to dashboard* window, select the dashboard, then click *Copy and go to dashboard*. [float] [[explore-the-underlying-data]] === Explore the underlying documents -Dashboard panels have a shortcut to view the underlying documents in *Discover*. Open the panel menu, -then click *Explore underlying data*. *Discover* will be opened with the same time range and filters as the panel. +View the underlying documents in a panel, or in a data series. + +TIP: *Explore underlying data* is supported only for visualization panels with a single index pattern. +To view the underlying documents in the panel: + +. Open the panel menu. + +. Click *Explore underlying data*. ++ +*Discover* opens with the same time range and filters as the panel. ++ [role="screenshot"] image::images/explore_data_context_menu.png[Explore underlying data from panel context menu] -A second shortcut is disabled by default, and creates a new interaction when clicking on a chart. -This shortcut is similar to a <>, but can show you data for only one series. -To enable the chart interactivity shortcut, add the following to kibana.yml: +To view the underlying documents in a data series: +. In kibana.yml, add the following: ++ ["source","yml"] ----------- xpack.discoverEnhanced.actions.exploreDataInChart.enabled: true ----------- +. Open the dashboard, then click on the data series you want to view. ++ [role="screenshot"] image::images/explore_data_in_chart.png[Explore underlying data from chart] -TIP: *Explore underlying data* is available only for visualization panels with a single index pattern. - [float] [[download-csv]] -=== Download panel data as CSV +=== Download the panel data Download panel data in a CSV file. You can download most panels in a CSV file, but there is a shortcut available for *Lens* panels. [role="xpack"] -Lens:: +To download *Lens* panel data in a CSV file: + Open the *Lens* panel menu, then select *More > Download as CSV*. -+ + [role="screenshot"] image::images/download_csv_context_menu.png[Download as CSV from panel context menu] -All panels:: - . Open the panel menu, then select *Inspect*. +To download all other panel data in a CSV file: + +. Open the panel menu, then select *Inspect*. - . Click *Download CSV*, then select the CSV type from the dropdown. The *Formatted CSV* contains - human-readable dates and numbers, while the *Unformatted* option is for computer use. +. Click *Download CSV*, then select the CSV type from the dropdown: +* *Formatted CSV* — Contains human-readable dates and numbers. +* *Unformatted* — Best used for computer use. ++ [role="screenshot"] image:images/Dashboard_inspect.png[Inspect in dashboard] @@ -237,15 +355,13 @@ image:images/Dashboard_inspect.png[Inspect in dashboard] When you're finished making changes, save the dashboard. -. From the toolbar, click *Save*. - -. Enter the dashboard *Title* and an optional *Description*. +From the toolbar, choose one of the following options: -. From the *Tags* dropdown, select the tags you want to apply. +* *Save as* — Opens the *Save dashboard* window, which allows you to specify the title and dashboard options. -. To save the time range, select *Store time with dashboard*. +* *Save* — Allows you to save the changes you've made to an existing dashboard. -. Click *Save*. +* *Switch to view mode* — Allows you to exit *Edit* mode without saving your changes, or you can discard the changes you've made. All dashboards with unsaved changes display *Unsaved changes* in the toolbar. [float] [[share-the-dashboard]] diff --git a/docs/user/dashboard/images/clone_panel.gif b/docs/user/dashboard/images/clone_panel.gif index e521e438d051a..7fba789a2bf54 100644 Binary files a/docs/user/dashboard/images/clone_panel.gif and b/docs/user/dashboard/images/clone_panel.gif differ diff --git a/docs/user/dashboard/images/visualize-library-icon.png b/docs/user/dashboard/images/visualize-library-icon.png new file mode 100644 index 0000000000000..19031df9f4af8 Binary files /dev/null and b/docs/user/dashboard/images/visualize-library-icon.png differ diff --git a/docs/user/images/alerts-and-actions.png b/docs/user/images/alerts-and-actions.png deleted file mode 100755 index 227abd9441e15..0000000000000 Binary files a/docs/user/images/alerts-and-actions.png and /dev/null differ diff --git a/docs/user/images/rules-and-connectors.png b/docs/user/images/rules-and-connectors.png new file mode 100644 index 0000000000000..5cda25b54536f Binary files /dev/null and b/docs/user/images/rules-and-connectors.png differ diff --git a/docs/user/introduction.asciidoc b/docs/user/introduction.asciidoc index 8ab29f375484c..8a0dd5e4e2a2b 100644 --- a/docs/user/introduction.asciidoc +++ b/docs/user/introduction.asciidoc @@ -170,24 +170,24 @@ image::images/intro-management.png[Index Management view in Stack Management] [float] ==== Alert and take action Detecting and acting on significant shifts and signals in your data is a need -that exists in almost every use case. For example, you might set an alert to notify you when: +that exists in almost every use case. For example, you might set a rule to notify you when: * A shift occurs in your business critical KPIs. * System resources, such as memory, CPU and disk space, take a dip. * An unusually high number of service requests, suspicious processes, and login attempts occurs. -An alert triggers when a specified condition is met. For example, -you can trigger an alert when the average or max of one of +A rule triggers when a specified condition is met. For example, +you can create a rule when the average or max of one of your metrics exceeds a threshold within a specified time frame. -When the alert triggers, you can send a notification to a system that is part of +When the rule triggers, you can send a notification to a system that is part of your daily workflow. {kib} integrates with email, Slack, PagerDuty, and ServiceNow, to name a few. -A dedicated view for creating, searching, and editing alerts is in <>. +A dedicated view for creating, searching, and editing rules is in <>. [role="screenshot"] -image::images/alerts-and-actions.png[Alerts and Actions view] +image::images/rules-and-connectors.png[Rules and Connectors view] [float] @@ -425,8 +425,8 @@ the <>. |Manage your Elasticsearch data |< Data>> -|Set up alerts -|< Alerts and Actions>> +|Set up rules +|< Rules and Connectors>> |Organize your workspace and users |< Spaces>> diff --git a/docs/user/management.asciidoc b/docs/user/management.asciidoc index 9d2b0ae593b34..f29718e6d588b 100644 --- a/docs/user/management.asciidoc +++ b/docs/user/management.asciidoc @@ -79,8 +79,8 @@ You can add and remove remote clusters, and check their connectivity. [cols="50, 50"] |=== -| <> -| Centrally manage your alerts across {kib}. Create and manage reusable +| <> +| Centrally manage your rules across {kib}. Create and manage reusable connectors for triggering actions. | <> @@ -177,11 +177,11 @@ next major version of {es}, and then reindex, if needed. include::{kib-repo-dir}/management/advanced-options.asciidoc[] -include::{kib-repo-dir}/management/alerting/alerts-and-actions-intro.asciidoc[] +include::{kib-repo-dir}/management/alerting/rules-and-connectors-intro.asciidoc[] -include::{kib-repo-dir}/management/alerting/alert-management.asciidoc[] +include::{kib-repo-dir}/management/alerting/rule-management.asciidoc[] -include::{kib-repo-dir}/management/alerting/alert-details.asciidoc[] +include::{kib-repo-dir}/management/alerting/rule-details.asciidoc[] include::{kib-repo-dir}/management/alerting/connector-management.asciidoc[] diff --git a/docs/user/production-considerations/alerting-production-considerations.asciidoc b/docs/user/production-considerations/alerting-production-considerations.asciidoc index 77c24becef8ef..57c255c809dc5 100644 --- a/docs/user/production-considerations/alerting-production-considerations.asciidoc +++ b/docs/user/production-considerations/alerting-production-considerations.asciidoc @@ -6,27 +6,27 @@ Alerting ++++ -Alerting runs both alert checks and actions as persistent background tasks managed by the Task Manager. +Alerting runs both rule checks and actions as persistent background tasks managed by the Task Manager. -When relying on alerts and actions as mission critical services, make sure you follow the <> for Task Manager. +When relying on rules and actions as mission critical services, make sure you follow the <> for Task Manager. [float] [[alerting-background-tasks]] -=== Running background alert checks and actions +=== Running background rule checks and actions -{kib} uses background tasks to run alerts and actions, distributed across all {kib} instances in the cluster. +{kib} uses background tasks to run rules and actions, distributed across all {kib} instances in the cluster. By default, each {kib} instance polls for work at three second intervals, and can run a maximum of ten concurrent tasks. These tasks are then run on the {kib} server. -Alerts are recurring background tasks which are rescheduled according to the <> on completion. +Rules are recurring background tasks which are rescheduled according to the <> on completion. Actions are non-recurring background tasks which are deleted on completion. For more details on Task Manager, see <>. [IMPORTANT] ============================================== -Alert and action tasks can run late or at an inconsistent schedule. +Rule and action tasks can run late or at an inconsistent schedule. This is typically a symptom of the specific usage of the cluster in question. You can address such issues by tweaking the <> or scaling the deployment to better suit your use case. @@ -38,14 +38,14 @@ For detailed guidance, see < [[alerting-scaling-guidance]] === Scaling Guidance -As alerts and actions leverage background tasks to perform the majority of work, scaling Alerting is possible by following the <>. +As rules and actions leverage background tasks to perform the majority of work, scaling Alerting is possible by following the <>. When estimating the required task throughput, keep the following in mind: -* Each alert uses a single recurring task that is scheduled to run at the cadence defined by its <>. +* Each rule uses a single recurring task that is scheduled to run at the cadence defined by its <>. * Each action uses a single task. However, because <>, alerts can generate a large number of non-recurring tasks. -It is difficult to predict how much throughput is needed to ensure all alerts and actions are executed at consistent schedules. -By counting alerts as recurring tasks and actions as non-recurring tasks, a rough throughput <> as a _tasks per minute_ measurement. +It is difficult to predict how much throughput is needed to ensure all rules and actions are executed at consistent schedules. +By counting rules as recurring tasks and actions as non-recurring tasks, a rough throughput <> as a _tasks per minute_ measurement. -Predicting the buffer required to account for actions depends heavily on the alert types you use, the amount of alert Instances they might detect, and the number of actions you might choose to assign to action groups. With that in mind, regularly <> of your Task Manager instances. +Predicting the buffer required to account for actions depends heavily on the rule types you use, the amount of alerts they might detect, and the number of actions you might choose to assign to action groups. With that in mind, regularly <> of your Task Manager instances. diff --git a/examples/search_examples/public/search_sessions/app.tsx b/examples/search_examples/public/search_sessions/app.tsx index 3c9d38776dfdf..bf57964dc1f86 100644 --- a/examples/search_examples/public/search_sessions/app.tsx +++ b/examples/search_examples/public/search_sessions/app.tsx @@ -247,6 +247,12 @@ export const SearchSessionsExampleApp = ({ )} + {!indexPattern && ( + <> + + + + )}

This example shows how you can use data.search.session service to @@ -332,7 +338,8 @@ export const SearchSessionsExampleApp = ({ size="xs" onClick={() => search()} iconType="play" - disabled={isSearching} + disabled={isSearching || !indexPattern || !numericFieldName} + data-test-subj={'startSearch'} > Start the search from low-level client (data.search.search) @@ -401,6 +408,7 @@ export const SearchSessionsExampleApp = ({ onClick={() => { search(data.search.session.getSessionId()); }} + data-test-subj={'restoreSearch'} > Restore the search session @@ -493,7 +501,7 @@ function SearchInspector({ tookMs: number | null; }) { return ( -

+
The search took: {tookMs ? Math.round(tookMs) : 'unknown'}ms @@ -582,11 +590,24 @@ function useAppState({ data }: { data: DataPublicPluginStart }) { useEffect(() => { let canceled = false; const loadIndexPattern = async () => { - const loadedIndexPattern = state.indexPatternId + // eslint-disable-next-line no-console + console.warn('Loading default index pattern'); + let loadedIndexPattern = state.indexPatternId ? await data.indexPatterns.get(state.indexPatternId) : await data.indexPatterns.getDefault(); + if (!loadedIndexPattern) { + // try to find any available index pattern + const [id] = await data.indexPatterns.getIds(true); + if (id) { + loadedIndexPattern = await data.indexPatterns.get(id); + } + } if (canceled) return; - if (!loadedIndexPattern) return; + if (!loadedIndexPattern) { + // eslint-disable-next-line no-console + console.warn('No index patterns to pick from'); + return; + } if (!state.indexPatternId) { setState({ indexPatternId: loadedIndexPattern.id, @@ -766,3 +787,11 @@ function NoShardDelayCallout() { ); } + +function NoIndexPatternsCallout() { + return ( + Missing index patterns!} color="warning" iconType="help"> +

This demo requires at least one index pattern.

+
+ ); +} diff --git a/packages/kbn-apm-config-loader/src/config_loader.ts b/packages/kbn-apm-config-loader/src/config_loader.ts index d9b8fcaa8f1c6..75f69481da76a 100644 --- a/packages/kbn-apm-config-loader/src/config_loader.ts +++ b/packages/kbn-apm-config-loader/src/config_loader.ts @@ -8,13 +8,16 @@ import { getConfigurationFilePaths, getConfigFromFiles, applyConfigOverrides } from './utils'; import { ApmConfiguration } from './config'; +import { ApmAgentConfig } from './types'; + +let apmConfig: ApmConfiguration | undefined; /** * Load the APM configuration. * * @param argv the `process.argv` arguments * @param rootDir The root directory of kibana (where the sources and the `package.json` file are) - * @param production true for production builds, false otherwise + * @param isDistributable true for production builds, false otherwise */ export const loadConfiguration = ( argv: string[], @@ -24,5 +27,19 @@ export const loadConfiguration = ( const configPaths = getConfigurationFilePaths(argv); const rawConfiguration = getConfigFromFiles(configPaths); applyConfigOverrides(rawConfiguration, argv); - return new ApmConfiguration(rootDir, rawConfiguration, isDistributable); + + apmConfig = new ApmConfiguration(rootDir, rawConfiguration, isDistributable); + return apmConfig; +}; + +export const getConfiguration = (serviceName: string): ApmAgentConfig | undefined => { + // integration test runner starts a kibana server that import the module without initializing APM. + // so we need to check initialization of the config. + // note that we can't just load the configuration during this module's import + // because jest IT are ran with `--config path-to-jest-config.js` which conflicts with the CLI's `config` arg + // causing the config loader to try to load the jest js config as yaml and throws. + if (apmConfig) { + return apmConfig.getConfig(serviceName); + } + return undefined; }; diff --git a/packages/kbn-apm-config-loader/src/index.ts b/packages/kbn-apm-config-loader/src/index.ts index 737bd1bc8e49b..da42bfad1841a 100644 --- a/packages/kbn-apm-config-loader/src/index.ts +++ b/packages/kbn-apm-config-loader/src/index.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ -export { loadConfiguration } from './config_loader'; +export { getConfiguration } from './config_loader'; +export { initApm } from './init_apm'; export type { ApmConfiguration } from './config'; export type { ApmAgentConfig } from './types'; diff --git a/packages/kbn-apm-config-loader/src/init_apm.test.mocks.ts b/packages/kbn-apm-config-loader/src/init_apm.test.mocks.ts new file mode 100644 index 0000000000000..c3a1f6b77158f --- /dev/null +++ b/packages/kbn-apm-config-loader/src/init_apm.test.mocks.ts @@ -0,0 +1,12 @@ +/* + * 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 const mockLoadConfiguration = jest.fn(); +jest.doMock('./config_loader', () => ({ + loadConfiguration: mockLoadConfiguration, +})); diff --git a/packages/kbn-apm-config-loader/src/init_apm.test.ts b/packages/kbn-apm-config-loader/src/init_apm.test.ts new file mode 100644 index 0000000000000..95f0a15a448c8 --- /dev/null +++ b/packages/kbn-apm-config-loader/src/init_apm.test.ts @@ -0,0 +1,66 @@ +/* + * 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. + */ + +import { mockLoadConfiguration } from './init_apm.test.mocks'; + +import { initApm } from './init_apm'; +import apm from 'elastic-apm-node'; + +describe('initApm', () => { + let apmAddFilterSpy: jest.SpyInstance; + let apmStartSpy: jest.SpyInstance; + let getConfig: jest.Mock; + + beforeEach(() => { + apmAddFilterSpy = jest.spyOn(apm, 'addFilter').mockImplementation(() => undefined); + apmStartSpy = jest.spyOn(apm, 'start').mockImplementation(() => undefined as any); + getConfig = jest.fn(); + + mockLoadConfiguration.mockImplementation(() => ({ + getConfig, + })); + }); + + afterEach(() => { + jest.restoreAllMocks(); + mockLoadConfiguration.mockReset(); + }); + + it('calls `loadConfiguration` with the correct options', () => { + initApm(['foo', 'bar'], 'rootDir', true, 'service-name'); + + expect(mockLoadConfiguration).toHaveBeenCalledTimes(1); + expect(mockLoadConfiguration).toHaveBeenCalledWith(['foo', 'bar'], 'rootDir', true); + }); + + it('calls `apmConfigLoader.getConfig` with the correct options', () => { + initApm(['foo', 'bar'], 'rootDir', true, 'service-name'); + + expect(getConfig).toHaveBeenCalledTimes(1); + expect(getConfig).toHaveBeenCalledWith('service-name'); + }); + + it('registers a filter using `addFilter`', () => { + initApm(['foo', 'bar'], 'rootDir', true, 'service-name'); + + expect(apmAddFilterSpy).toHaveBeenCalledTimes(1); + expect(apmAddFilterSpy).toHaveBeenCalledWith(expect.any(Function)); + }); + + it('starts apm with the config returned from `getConfig`', () => { + const config = { + foo: 'bar', + }; + getConfig.mockReturnValue(config); + + initApm(['foo', 'bar'], 'rootDir', true, 'service-name'); + + expect(apmStartSpy).toHaveBeenCalledTimes(1); + expect(apmStartSpy).toHaveBeenCalledWith(config); + }); +}); diff --git a/packages/kbn-apm-config-loader/src/init_apm.ts b/packages/kbn-apm-config-loader/src/init_apm.ts new file mode 100644 index 0000000000000..21c40c8b39419 --- /dev/null +++ b/packages/kbn-apm-config-loader/src/init_apm.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + +import { loadConfiguration } from './config_loader'; + +export const initApm = ( + argv: string[], + rootDir: string, + isDistributable: boolean, + serviceName: string +) => { + const apmConfigLoader = loadConfiguration(argv, rootDir, isDistributable); + const apmConfig = apmConfigLoader.getConfig(serviceName); + + // we want to only load the module when effectively used + // eslint-disable-next-line @typescript-eslint/no-var-requires + const apm = require('elastic-apm-node'); + + // Filter out all user PII + apm.addFilter((payload: Record) => { + try { + if (payload.context?.user && typeof payload.context.user === 'object') { + Object.keys(payload.context.user).forEach((key) => { + payload.context.user[key] = '[REDACTED]'; + }); + } + } catch (e) { + // just silently ignore the error + } + return payload; + }); + + apm.start(apmConfig); +}; diff --git a/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js b/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js index bd2606e98aeaa..2ded0e509c253 100644 --- a/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js +++ b/packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js @@ -21,6 +21,7 @@ require('@babel/register')({ 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'), ], babelrc: false, presets: [require.resolve('@kbn/babel-preset/node_preset')], diff --git a/src/apm.js b/src/apm.js deleted file mode 100644 index b5137b8f3624c..0000000000000 --- a/src/apm.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 { join } = require('path'); -const { name, build } = require('../package.json'); -const { loadConfiguration } = require('@kbn/apm-config-loader'); - -const ROOT_DIR = join(__dirname, '..'); -let apmConfig; - -/** - * Flag to disable APM RUM support on all kibana builds by default - */ -const isKibanaDistributable = Boolean(build && build.distributable === true); - -module.exports = function (serviceName = name) { - apmConfig = loadConfiguration(process.argv, ROOT_DIR, isKibanaDistributable); - const conf = apmConfig.getConfig(serviceName); - const apm = require('elastic-apm-node'); - - // Filter out all user PII - apm.addFilter((payload) => { - try { - if (payload.context && payload.context.user && typeof payload.context.user === 'object') { - Object.keys(payload.context.user).forEach((key) => { - payload.context.user[key] = '[REDACTED]'; - }); - } - } finally { - return payload; - } - }); - - apm.start(conf); -}; - -module.exports.getConfig = (serviceName) => { - // integration test runner starts a kibana server that import the module without initializing APM. - // so we need to check initialization of the config. - // note that we can't just load the configuration during this module's import - // because jest IT are ran with `--config path-to-jest-config.js` which conflicts with the CLI's `config` arg - // causing the config loader to try to load the jest js config as yaml and throws. - if (apmConfig) { - return apmConfig.getConfig(serviceName); - } - return {}; -}; diff --git a/src/cli/apm.js b/src/cli/apm.js new file mode 100644 index 0000000000000..0a9f38b7efca1 --- /dev/null +++ b/src/cli/apm.js @@ -0,0 +1,18 @@ +/* + * 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 { join } = require('path'); +const { name, build } = require('../../package.json'); +const { initApm } = require('@kbn/apm-config-loader'); + +const rootDir = join(__dirname, '../..'); +const isKibanaDistributable = Boolean(build && build.distributable === true); + +module.exports = function (serviceName = name) { + initApm(process.argv, rootDir, isKibanaDistributable, serviceName); +}; diff --git a/src/cli/dev.js b/src/cli/dev.js index 614529cc26588..42263986f98f3 100644 --- a/src/cli/dev.js +++ b/src/cli/dev.js @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -require('../apm')(process.env.ELASTIC_APM_SERVICE_NAME || 'kibana-proxy'); +require('./apm')(process.env.ELASTIC_APM_SERVICE_NAME || 'kibana-proxy'); require('../setup_node_env'); require('../setup_node_env/root'); require('./cli'); diff --git a/src/cli/dist.js b/src/cli/dist.js index b22bffa8cbd93..fccc93cd53631 100644 --- a/src/cli/dist.js +++ b/src/cli/dist.js @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -require('../apm')(); +require('./apm')(); require('../setup_node_env/dist'); require('../setup_node_env/root'); require('./cli'); diff --git a/src/core/server/http_resources/get_apm_config.test.mocks.ts b/src/core/server/http_resources/get_apm_config.test.mocks.ts index 635e93913c222..8c3fa180a04f0 100644 --- a/src/core/server/http_resources/get_apm_config.test.mocks.ts +++ b/src/core/server/http_resources/get_apm_config.test.mocks.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -export const getConfigMock = jest.fn(); -jest.doMock('../../../apm', () => ({ - getConfig: getConfigMock, +export const getConfigurationMock = jest.fn(); +jest.doMock('@kbn/apm-config-loader', () => ({ + getConfiguration: getConfigurationMock, })); export const agentMock = {} as Record; diff --git a/src/core/server/http_resources/get_apm_config.test.ts b/src/core/server/http_resources/get_apm_config.test.ts index 6ef68494ced07..bd867375f46d6 100644 --- a/src/core/server/http_resources/get_apm_config.test.ts +++ b/src/core/server/http_resources/get_apm_config.test.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { getConfigMock, agentMock } from './get_apm_config.test.mocks'; +import { getConfigurationMock, agentMock } from './get_apm_config.test.mocks'; import { getApmConfig } from './get_apm_config'; const defaultApmConfig = { @@ -16,28 +16,28 @@ const defaultApmConfig = { describe('getApmConfig', () => { beforeEach(() => { - getConfigMock.mockReturnValue(defaultApmConfig); + getConfigurationMock.mockReturnValue(defaultApmConfig); }); afterEach(() => { - getConfigMock.mockReset(); + getConfigurationMock.mockReset(); agentMock.currentTransaction = null; }); it('returns null if apm is disabled', () => { - getConfigMock.mockReturnValue({ + getConfigurationMock.mockReturnValue({ active: false, }); expect(getApmConfig('/path')).toBeNull(); - getConfigMock.mockReturnValue(undefined); + getConfigurationMock.mockReturnValue(undefined); expect(getApmConfig('/path')).toBeNull(); }); it('calls `getConfig` with the correct parameters', () => { getApmConfig('/path'); - expect(getConfigMock).toHaveBeenCalledWith('kibana-frontend'); + expect(getConfigurationMock).toHaveBeenCalledWith('kibana-frontend'); }); it('returns the configuration from the `getConfig` call', () => { diff --git a/src/core/server/http_resources/get_apm_config.ts b/src/core/server/http_resources/get_apm_config.ts index 0b0eb7426f863..6ea172b162d28 100644 --- a/src/core/server/http_resources/get_apm_config.ts +++ b/src/core/server/http_resources/get_apm_config.ts @@ -7,11 +7,10 @@ */ import agent from 'elastic-apm-node'; -// @ts-expect-error apm module is a js file outside of core (need to split APM/rum configuration) -import { getConfig } from '../../../apm'; +import { getConfiguration } from '@kbn/apm-config-loader'; export const getApmConfig = (requestPath: string) => { - const baseConfig = getConfig('kibana-frontend'); + const baseConfig = getConfiguration('kibana-frontend'); if (!baseConfig?.active) { return null; } diff --git a/src/core/server/ui_settings/saved_objects/migrations.test.ts b/src/core/server/ui_settings/saved_objects/migrations.test.ts index 7b53f4e21dd9b..cf96372bd20bc 100644 --- a/src/core/server/ui_settings/saved_objects/migrations.test.ts +++ b/src/core/server/ui_settings/saved_objects/migrations.test.ts @@ -45,6 +45,39 @@ describe('ui_settings 7.9.0 migrations', () => { }); }); +describe('ui_settings 7.12.0 migrations', () => { + const migration = migrations['7.12.0']; + + test('returns doc on empty object', () => { + expect(migration({} as SavedObjectUnsanitizedDoc)).toEqual({ + references: [], + }); + }); + test('properly migrates timepicker:quickRanges', () => { + const initialQuickRange: any = { + from: '123', + to: '321', + display: 'abc', + section: 2, + }; + const { section, ...migratedQuickRange } = initialQuickRange; + + const doc = { + type: 'config', + id: '8.0.0', + attributes: { + buildNum: 9007199254740991, + 'timepicker:quickRanges': JSON.stringify([initialQuickRange]), + }, + references: [], + updated_at: '2020-06-09T20:18:20.349Z', + migrationVersion: {}, + }; + const migrated = migration(doc); + expect(JSON.parse(migrated.attributes['timepicker:quickRanges'])).toEqual([migratedQuickRange]); + }); +}); + describe('ui_settings 7.13.0 migrations', () => { const migration = migrations['7.13.0']; diff --git a/src/plugins/dashboard/common/saved_dashboard_references.test.ts b/src/plugins/dashboard/common/saved_dashboard_references.test.ts index cee9aef46f6aa..584d7e5e63a92 100644 --- a/src/plugins/dashboard/common/saved_dashboard_references.test.ts +++ b/src/plugins/dashboard/common/saved_dashboard_references.test.ts @@ -30,11 +30,13 @@ describe('extractReferences', () => { type: 'visualization', id: '1', title: 'Title 1', + version: '7.9.1', }, { type: 'visualization', id: '2', title: 'Title 2', + version: '7.9.1', }, ]), }, @@ -46,7 +48,7 @@ describe('extractReferences', () => { Object { "attributes": Object { "foo": true, - "panelsJSON": "[{\\"embeddableConfig\\":{},\\"title\\":\\"Title 1\\",\\"panelRefName\\":\\"panel_0\\"},{\\"embeddableConfig\\":{},\\"title\\":\\"Title 2\\",\\"panelRefName\\":\\"panel_1\\"}]", + "panelsJSON": "[{\\"version\\":\\"7.9.1\\",\\"embeddableConfig\\":{},\\"title\\":\\"Title 1\\",\\"panelRefName\\":\\"panel_0\\"},{\\"version\\":\\"7.9.1\\",\\"embeddableConfig\\":{},\\"title\\":\\"Title 2\\",\\"panelRefName\\":\\"panel_1\\"}]", }, "references": Array [ Object { @@ -73,6 +75,7 @@ describe('extractReferences', () => { { id: '1', title: 'Title 1', + version: '7.9.1', }, ]), }, @@ -92,6 +95,7 @@ describe('extractReferences', () => { { type: 'visualization', title: 'Title 1', + version: '7.9.1', }, ]), }, @@ -101,12 +105,85 @@ describe('extractReferences', () => { Object { "attributes": Object { "foo": true, - "panelsJSON": "[{\\"type\\":\\"visualization\\",\\"embeddableConfig\\":{},\\"title\\":\\"Title 1\\"}]", + "panelsJSON": "[{\\"version\\":\\"7.9.1\\",\\"type\\":\\"visualization\\",\\"embeddableConfig\\":{},\\"title\\":\\"Title 1\\"}]", }, "references": Array [], } `); }); + + // https://github.com/elastic/kibana/issues/93772 + test('passes when received older RAW SO with older panels', () => { + const doc = { + id: '1', + attributes: { + hits: 0, + timeFrom: 'now-16h/h', + timeTo: 'now', + refreshInterval: { + display: '1 minute', + section: 2, + value: 60000, + pause: false, + }, + description: '', + uiStateJSON: '{"P-1":{"vis":{"legendOpen":false}}}', + title: 'Errors/Fatals/Warnings dashboard', + timeRestore: true, + version: 1, + panelsJSON: + '[{"col":1,"id":"544891f0-2cf2-11e8-9735-93e95b055f48","panelIndex":1,"row":1,"size_x":12,"size_y":8,"type":"visualization"}]', + optionsJSON: '{"darkTheme":true}', + kibanaSavedObjectMeta: { + searchSourceJSON: + '{"highlightAll":true,"filter":[{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}}}]}', + }, + }, + references: [], + }; + const updatedDoc = extractReferences(doc, deps); + + expect(updatedDoc).toMatchInlineSnapshot(` + Object { + "attributes": Object { + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": Object { + "searchSourceJSON": "{\\"highlightAll\\":true,\\"filter\\":[{\\"query\\":{\\"query_string\\":{\\"analyze_wildcard\\":true,\\"query\\":\\"*\\"}}}]}", + }, + "optionsJSON": "{\\"darkTheme\\":true}", + "panelsJSON": "[{\\"col\\":1,\\"panelIndex\\":1,\\"row\\":1,\\"size_x\\":12,\\"size_y\\":8,\\"panelRefName\\":\\"panel_0\\"}]", + "refreshInterval": Object { + "display": "1 minute", + "pause": false, + "section": 2, + "value": 60000, + }, + "timeFrom": "now-16h/h", + "timeRestore": true, + "timeTo": "now", + "title": "Errors/Fatals/Warnings dashboard", + "uiStateJSON": "{\\"P-1\\":{\\"vis\\":{\\"legendOpen\\":false}}}", + "version": 1, + }, + "references": Array [ + Object { + "id": "544891f0-2cf2-11e8-9735-93e95b055f48", + "name": "panel_0", + "type": "visualization", + }, + ], + } + `); + + const panel = JSON.parse(updatedDoc.attributes.panelsJSON as string)[0]; + + // unknown older panel keys are left untouched + expect(panel).toHaveProperty('col'); + expect(panel).toHaveProperty('row'); + expect(panel).toHaveProperty('size_x'); + expect(panel).toHaveProperty('size_y'); + }); }); describe('injectReferences', () => { diff --git a/src/plugins/dashboard/common/saved_dashboard_references.ts b/src/plugins/dashboard/common/saved_dashboard_references.ts index 9da71a5cc729f..f1fea99057f83 100644 --- a/src/plugins/dashboard/common/saved_dashboard_references.ts +++ b/src/plugins/dashboard/common/saved_dashboard_references.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import semverSatisfies from 'semver/functions/satisfies'; import { SavedObjectAttributes, SavedObjectReference } from '../../../core/types'; import { extractPanelsReferences, @@ -33,17 +34,35 @@ export function extractReferences( const panelReferences: SavedObjectReference[] = []; let panels: Array> = JSON.parse(String(attributes.panelsJSON)); - const extractedReferencesResult = extractPanelsReferences( - (panels as unknown) as SavedDashboardPanel730ToLatest[], - deps - ); + const isPre730Panel = (panel: Record): boolean => { + return 'version' in panel ? semverSatisfies(panel.version, '<7.3') : true; + }; - panels = (extractedReferencesResult.map((res) => res.panel) as unknown) as Array< - Record - >; - extractedReferencesResult.forEach((res) => { - panelReferences.push(...res.references); - }); + const hasPre730Panel = panels.some(isPre730Panel); + + /** + * `extractPanelsReferences` only knows how to reliably handle "latest" panels + * It is possible that `extractReferences` is run on older dashboard SO with older panels, + * for example, when importing a saved object using saved object UI `extractReferences` is called BEFORE any server side migrations are run. + * + * In this case we skip running `extractPanelsReferences` on such object. + * We also know that there is nothing to extract + * (First possible entity to be extracted by this mechanism is a dashboard drilldown since 7.11) + */ + if (!hasPre730Panel) { + const extractedReferencesResult = extractPanelsReferences( + // it is ~safe~ to cast to `SavedDashboardPanel730ToLatest` because above we've checked that there are only >=7.3 panels + (panels as unknown) as SavedDashboardPanel730ToLatest[], + deps + ); + + panels = (extractedReferencesResult.map((res) => res.panel) as unknown) as Array< + Record + >; + extractedReferencesResult.forEach((res) => { + panelReferences.push(...res.references); + }); + } // TODO: This extraction should be done by EmbeddablePersistableStateService // https://github.com/elastic/kibana/issues/82830 diff --git a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js index 72083bd335c68..4d1cede837f13 100644 --- a/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js +++ b/src/plugins/data/common/es_query/kuery/ast/_generated_/kuery.js @@ -46,29 +46,28 @@ module.exports = (function() { if (query !== null) return query; return nodeTypes.function.buildNode('is', '*', '*'); }, - peg$c1 = function() { return errorOnLuceneSyntax; }, - peg$c2 = function(head, query) { return query; }, - peg$c3 = function(head, tail) { + peg$c1 = function(head, query) { return query; }, + peg$c2 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) return cursor; return buildFunctionNode('or', nodes); }, - peg$c4 = function(head, tail) { + peg$c3 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) return cursor; return buildFunctionNode('and', nodes); }, - peg$c5 = function(query) { + peg$c4 = function(query) { if (query.type === 'cursor') return query; return buildFunctionNode('not', [query]); }, - peg$c6 = "(", - peg$c7 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c8 = ")", - peg$c9 = { type: "literal", value: ")", description: "\")\"" }, - peg$c10 = function(query, trailing) { + peg$c5 = "(", + peg$c6 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c7 = ")", + peg$c8 = { type: "literal", value: ")", description: "\")\"" }, + peg$c9 = function(query, trailing) { if (trailing.type === 'cursor') { return { ...trailing, @@ -77,13 +76,13 @@ module.exports = (function() { } return query; }, - peg$c11 = ":", - peg$c12 = { type: "literal", value: ":", description: "\":\"" }, - peg$c13 = "{", - peg$c14 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c15 = "}", - peg$c16 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c17 = function(field, query, trailing) { + peg$c10 = ":", + peg$c11 = { type: "literal", value: ":", description: "\":\"" }, + peg$c12 = "{", + peg$c13 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c14 = "}", + peg$c15 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c16 = function(field, query, trailing) { if (query.type === 'cursor') { return { ...query, @@ -99,8 +98,8 @@ module.exports = (function() { } return buildFunctionNode('nested', [field, query]); }, - peg$c18 = { type: "other", description: "fieldName" }, - peg$c19 = function(field, operator, value) { + peg$c17 = { type: "other", description: "fieldName" }, + peg$c18 = function(field, operator, value) { if (value.type === 'cursor') { return { ...value, @@ -110,7 +109,7 @@ module.exports = (function() { const range = buildNamedArgNode(operator, value); return buildFunctionNode('range', [field, range]); }, - peg$c20 = function(field, partial) { + peg$c19 = function(field, partial) { if (partial.type === 'cursor') { return { ...partial, @@ -120,7 +119,7 @@ module.exports = (function() { } return partial(field); }, - peg$c21 = function(partial) { + peg$c20 = function(partial) { if (partial.type === 'cursor') { const fieldName = `${partial.prefix}${partial.suffix}`.trim(); return { @@ -132,7 +131,7 @@ module.exports = (function() { const field = buildLiteralNode(null); return partial(field); }, - peg$c22 = function(partial, trailing) { + peg$c21 = function(partial, trailing) { if (trailing.type === 'cursor') { return { ...trailing, @@ -141,8 +140,8 @@ module.exports = (function() { } return partial; }, - peg$c23 = function(head, partial) { return partial; }, - peg$c24 = function(head, tail) { + peg$c22 = function(head, partial) { return partial; }, + peg$c23 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) { @@ -153,7 +152,7 @@ module.exports = (function() { } return (field) => buildFunctionNode('or', nodes.map(partial => partial(field))); }, - peg$c25 = function(head, tail) { + peg$c24 = function(head, tail) { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) { @@ -164,7 +163,7 @@ module.exports = (function() { } return (field) => buildFunctionNode('and', nodes.map(partial => partial(field))); }, - peg$c26 = function(partial) { + peg$c25 = function(partial) { if (partial.type === 'cursor') { return { ...list, @@ -173,13 +172,13 @@ module.exports = (function() { } return (field) => buildFunctionNode('not', [partial(field)]); }, - peg$c27 = { type: "other", description: "value" }, - peg$c28 = function(value) { + peg$c26 = { type: "other", description: "value" }, + peg$c27 = function(value) { if (value.type === 'cursor') return value; const isPhrase = buildLiteralNode(true); return (field) => buildFunctionNode('is', [field, value, isPhrase]); }, - peg$c29 = function(value) { + peg$c28 = function(value) { if (value.type === 'cursor') return value; if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) { @@ -189,20 +188,20 @@ module.exports = (function() { const isPhrase = buildLiteralNode(false); return (field) => buildFunctionNode('is', [field, value, isPhrase]); }, - peg$c30 = { type: "other", description: "OR" }, - peg$c31 = "or", - peg$c32 = { type: "literal", value: "or", description: "\"or\"" }, - peg$c33 = { type: "other", description: "AND" }, - peg$c34 = "and", - peg$c35 = { type: "literal", value: "and", description: "\"and\"" }, - peg$c36 = { type: "other", description: "NOT" }, - peg$c37 = "not", - peg$c38 = { type: "literal", value: "not", description: "\"not\"" }, - peg$c39 = { type: "other", description: "literal" }, - peg$c40 = function() { return parseCursor; }, - peg$c41 = "\"", - peg$c42 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c43 = function(prefix, cursor, suffix) { + peg$c29 = { type: "other", description: "OR" }, + peg$c30 = "or", + peg$c31 = { type: "literal", value: "or", description: "\"or\"" }, + peg$c32 = { type: "other", description: "AND" }, + peg$c33 = "and", + peg$c34 = { type: "literal", value: "and", description: "\"and\"" }, + peg$c35 = { type: "other", description: "NOT" }, + peg$c36 = "not", + peg$c37 = { type: "literal", value: "not", description: "\"not\"" }, + peg$c38 = { type: "other", description: "literal" }, + peg$c39 = function() { return parseCursor; }, + peg$c40 = "\"", + peg$c41 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c42 = function(prefix, cursor, suffix) { const { start, end } = location(); return { type: 'cursor', @@ -213,17 +212,17 @@ module.exports = (function() { text: text().replace(cursor, '') }; }, - peg$c44 = function(chars) { + peg$c43 = function(chars) { return buildLiteralNode(chars.join('')); }, - peg$c45 = "\\", - peg$c46 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c47 = /^[\\"]/, - peg$c48 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" }, - peg$c49 = function(char) { return char; }, - peg$c50 = /^[^"]/, - peg$c51 = { type: "class", value: "[^\"]", description: "[^\"]" }, - peg$c52 = function(chars) { + peg$c44 = "\\", + peg$c45 = { type: "literal", value: "\\", description: "\"\\\\\"" }, + peg$c46 = /^[\\"]/, + peg$c47 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" }, + peg$c48 = function(char) { return char; }, + peg$c49 = /^[^"]/, + peg$c50 = { type: "class", value: "[^\"]", description: "[^\"]" }, + peg$c51 = function(chars) { const sequence = chars.join('').trim(); if (sequence === 'null') return buildLiteralNode(null); if (sequence === 'true') return buildLiteralNode(true); @@ -231,103 +230,40 @@ module.exports = (function() { if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence); return buildLiteralNode(sequence); }, - peg$c53 = { type: "any", description: "any character" }, - peg$c54 = "*", - peg$c55 = { type: "literal", value: "*", description: "\"*\"" }, - peg$c56 = function() { return wildcardSymbol; }, - peg$c57 = "\\t", - peg$c58 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c59 = function() { return '\t'; }, - peg$c60 = "\\r", - peg$c61 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c62 = function() { return '\r'; }, - peg$c63 = "\\n", - peg$c64 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c65 = function() { return '\n'; }, - peg$c66 = function(keyword) { return keyword; }, - peg$c67 = /^[\\():<>"*{}]/, - peg$c68 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" }, - peg$c69 = "<=", - peg$c70 = { type: "literal", value: "<=", description: "\"<=\"" }, - peg$c71 = function() { return 'lte'; }, - peg$c72 = ">=", - peg$c73 = { type: "literal", value: ">=", description: "\">=\"" }, - peg$c74 = function() { return 'gte'; }, - peg$c75 = "<", - peg$c76 = { type: "literal", value: "<", description: "\"<\"" }, - peg$c77 = function() { return 'lt'; }, - peg$c78 = ">", - peg$c79 = { type: "literal", value: ">", description: "\">\"" }, - peg$c80 = function() { return 'gt'; }, - peg$c81 = { type: "other", description: "whitespace" }, - peg$c82 = /^[ \t\r\n]/, - peg$c83 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" }, - peg$c84 = "@kuery-cursor@", - peg$c85 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" }, - peg$c86 = function() { return cursorSymbol; }, - peg$c87 = "||", - peg$c88 = { type: "literal", value: "||", description: "\"||\"" }, - peg$c89 = function() { - error('LuceneOr'); - }, - peg$c90 = "&&", - peg$c91 = { type: "literal", value: "&&", description: "\"&&\"" }, - peg$c92 = function() { - error('LuceneAnd'); - }, - peg$c93 = "+", - peg$c94 = { type: "literal", value: "+", description: "\"+\"" }, - peg$c95 = "-", - peg$c96 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c97 = function() { - error('LuceneNot'); - }, - peg$c98 = "!", - peg$c99 = { type: "literal", value: "!", description: "\"!\"" }, - peg$c100 = "_exists_", - peg$c101 = { type: "literal", value: "_exists_", description: "\"_exists_\"" }, - peg$c102 = function() { - error('LuceneExists'); - }, - peg$c103 = function() { - error('LuceneRange'); - }, - peg$c104 = "?", - peg$c105 = { type: "literal", value: "?", description: "\"?\"" }, - peg$c106 = function() { - error('LuceneWildcard'); - }, - peg$c107 = "/", - peg$c108 = { type: "literal", value: "/", description: "\"/\"" }, - peg$c109 = /^[^\/]/, - peg$c110 = { type: "class", value: "[^/]", description: "[^/]" }, - peg$c111 = function() { - error('LuceneRegex'); - }, - peg$c112 = "~", - peg$c113 = { type: "literal", value: "~", description: "\"~\"" }, - peg$c114 = /^[0-9]/, - peg$c115 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c116 = function() { - error('LuceneFuzzy'); - }, - peg$c117 = function() { - error('LuceneProximity'); - }, - peg$c118 = "^", - peg$c119 = { type: "literal", value: "^", description: "\"^\"" }, - peg$c120 = function() { - error('LuceneBoost'); - }, - peg$c121 = function() { return char; }, - peg$c122 = "=", - peg$c123 = { type: "literal", value: "=", description: "\"=\"" }, - peg$c124 = "[", - peg$c125 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c126 = "]", - peg$c127 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c128 = "TO", - peg$c129 = { type: "literal", value: "TO", description: "\"TO\"" }, + peg$c52 = { type: "any", description: "any character" }, + peg$c53 = "*", + peg$c54 = { type: "literal", value: "*", description: "\"*\"" }, + peg$c55 = function() { return wildcardSymbol; }, + peg$c56 = "\\t", + peg$c57 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, + peg$c58 = function() { return '\t'; }, + peg$c59 = "\\r", + peg$c60 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, + peg$c61 = function() { return '\r'; }, + peg$c62 = "\\n", + peg$c63 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, + peg$c64 = function() { return '\n'; }, + peg$c65 = function(keyword) { return keyword; }, + peg$c66 = /^[\\():<>"*{}]/, + peg$c67 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" }, + peg$c68 = "<=", + peg$c69 = { type: "literal", value: "<=", description: "\"<=\"" }, + peg$c70 = function() { return 'lte'; }, + peg$c71 = ">=", + peg$c72 = { type: "literal", value: ">=", description: "\">=\"" }, + peg$c73 = function() { return 'gte'; }, + peg$c74 = "<", + peg$c75 = { type: "literal", value: "<", description: "\"<\"" }, + peg$c76 = function() { return 'lt'; }, + peg$c77 = ">", + peg$c78 = { type: "literal", value: ">", description: "\">\"" }, + peg$c79 = function() { return 'gt'; }, + peg$c80 = { type: "other", description: "whitespace" }, + peg$c81 = /^[ \t\r\n]/, + peg$c82 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" }, + peg$c83 = "@kuery-cursor@", + peg$c84 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" }, + peg$c85 = function() { return cursorSymbol; }, peg$currPos = 0, peg$savedPos = 0, @@ -519,7 +455,7 @@ module.exports = (function() { function peg$parsestart() { var s0, s1, s2, s3; - var key = peg$currPos * 56 + 0, + var key = peg$currPos * 34 + 0, cached = peg$resultsCache[key]; if (cached) { @@ -567,7 +503,7 @@ module.exports = (function() { function peg$parseOrQuery() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 1, + var key = peg$currPos * 34 + 1, cached = peg$resultsCache[key]; if (cached) { @@ -577,85 +513,62 @@ module.exports = (function() { } s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } + s1 = peg$parseAndQuery(); if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneQuery(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseAndQuery(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c2(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + s2 = []; + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$parseOr(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAndQuery(); - if (s5 !== peg$FAILED) { - peg$savedPos = s3; - s4 = peg$c2(s1, s5); - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$FAILED; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseOr(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndQuery(); + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c1(s1, s5); + s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c3(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c2(s1, s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseAndQuery(); - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseAndQuery(); } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -666,7 +579,7 @@ module.exports = (function() { function peg$parseAndQuery() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 2, + var key = peg$currPos * 34 + 2, cached = peg$resultsCache[key]; if (cached) { @@ -685,7 +598,7 @@ module.exports = (function() { s5 = peg$parseNotQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c2(s1, s5); + s4 = peg$c1(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -704,7 +617,7 @@ module.exports = (function() { s5 = peg$parseNotQuery(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c2(s1, s5); + s4 = peg$c1(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -720,7 +633,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c4(s1, s2); + s1 = peg$c3(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -742,7 +655,7 @@ module.exports = (function() { function peg$parseNotQuery() { var s0, s1, s2; - var key = peg$currPos * 56 + 3, + var key = peg$currPos * 34 + 3, cached = peg$resultsCache[key]; if (cached) { @@ -757,7 +670,7 @@ module.exports = (function() { s2 = peg$parseSubQuery(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c5(s2); + s1 = peg$c4(s2); s0 = s1; } else { peg$currPos = s0; @@ -779,7 +692,7 @@ module.exports = (function() { function peg$parseSubQuery() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 4, + var key = peg$currPos * 34 + 4, cached = peg$resultsCache[key]; if (cached) { @@ -790,11 +703,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c6; + s1 = peg$c5; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s1 !== peg$FAILED) { s2 = []; @@ -809,15 +722,15 @@ module.exports = (function() { s4 = peg$parseOptionalSpace(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c8; + s5 = peg$c7; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c10(s3, s4); + s1 = peg$c9(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -851,7 +764,7 @@ module.exports = (function() { function peg$parseNestedQuery() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - var key = peg$currPos * 56 + 5, + var key = peg$currPos * 34 + 5, cached = peg$resultsCache[key]; if (cached) { @@ -871,11 +784,11 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; + s3 = peg$c10; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; @@ -886,11 +799,11 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { - s5 = peg$c13; + s5 = peg$c12; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s5 !== peg$FAILED) { s6 = []; @@ -905,15 +818,15 @@ module.exports = (function() { s8 = peg$parseOptionalSpace(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c15; + s9 = peg$c14; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + if (peg$silentFails === 0) { peg$fail(peg$c15); } } if (s9 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c17(s1, s7, s8); + s1 = peg$c16(s1, s7, s8); s0 = s1; } else { peg$currPos = s0; @@ -963,7 +876,7 @@ module.exports = (function() { function peg$parseExpression() { var s0; - var key = peg$currPos * 56 + 6, + var key = peg$currPos * 34 + 6, cached = peg$resultsCache[key]; if (cached) { @@ -988,7 +901,7 @@ module.exports = (function() { function peg$parseField() { var s0, s1; - var key = peg$currPos * 56 + 7, + var key = peg$currPos * 34 + 7, cached = peg$resultsCache[key]; if (cached) { @@ -1002,7 +915,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } + if (peg$silentFails === 0) { peg$fail(peg$c17); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1013,7 +926,7 @@ module.exports = (function() { function peg$parseFieldRangeExpression() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 8, + var key = peg$currPos * 34 + 8, cached = peg$resultsCache[key]; if (cached) { @@ -1044,7 +957,7 @@ module.exports = (function() { s5 = peg$parseLiteral(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c19(s1, s3, s5); + s1 = peg$c18(s1, s3, s5); s0 = s1; } else { peg$currPos = s0; @@ -1075,7 +988,7 @@ module.exports = (function() { function peg$parseFieldValueExpression() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 9, + var key = peg$currPos * 34 + 9, cached = peg$resultsCache[key]; if (cached) { @@ -1095,11 +1008,11 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; + s3 = peg$c10; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s3 !== peg$FAILED) { s4 = []; @@ -1112,7 +1025,7 @@ module.exports = (function() { s5 = peg$parseListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c20(s1, s5); + s1 = peg$c19(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -1143,7 +1056,7 @@ module.exports = (function() { function peg$parseValueExpression() { var s0, s1; - var key = peg$currPos * 56 + 10, + var key = peg$currPos * 34 + 10, cached = peg$resultsCache[key]; if (cached) { @@ -1156,7 +1069,7 @@ module.exports = (function() { s1 = peg$parseValue(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c21(s1); + s1 = peg$c20(s1); } s0 = s1; @@ -1168,7 +1081,7 @@ module.exports = (function() { function peg$parseListOfValues() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 11, + var key = peg$currPos * 34 + 11, cached = peg$resultsCache[key]; if (cached) { @@ -1179,11 +1092,11 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c6; + s1 = peg$c5; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { peg$fail(peg$c6); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1198,15 +1111,15 @@ module.exports = (function() { s4 = peg$parseOptionalSpace(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c8; + s5 = peg$c7; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } + if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s5 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c22(s3, s4); + s1 = peg$c21(s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -1240,7 +1153,7 @@ module.exports = (function() { function peg$parseOrListOfValues() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 12, + var key = peg$currPos * 34 + 12, cached = peg$resultsCache[key]; if (cached) { @@ -1259,7 +1172,7 @@ module.exports = (function() { s5 = peg$parseAndListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1278,7 +1191,7 @@ module.exports = (function() { s5 = peg$parseAndListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1294,7 +1207,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c24(s1, s2); + s1 = peg$c23(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -1316,7 +1229,7 @@ module.exports = (function() { function peg$parseAndListOfValues() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 13, + var key = peg$currPos * 34 + 13, cached = peg$resultsCache[key]; if (cached) { @@ -1335,7 +1248,7 @@ module.exports = (function() { s5 = peg$parseNotListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1354,7 +1267,7 @@ module.exports = (function() { s5 = peg$parseNotListOfValues(); if (s5 !== peg$FAILED) { peg$savedPos = s3; - s4 = peg$c23(s1, s5); + s4 = peg$c22(s1, s5); s3 = s4; } else { peg$currPos = s3; @@ -1370,7 +1283,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c25(s1, s2); + s1 = peg$c24(s1, s2); s0 = s1; } else { peg$currPos = s0; @@ -1392,7 +1305,7 @@ module.exports = (function() { function peg$parseNotListOfValues() { var s0, s1, s2; - var key = peg$currPos * 56 + 14, + var key = peg$currPos * 34 + 14, cached = peg$resultsCache[key]; if (cached) { @@ -1407,7 +1320,7 @@ module.exports = (function() { s2 = peg$parseListOfValues(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c26(s2); + s1 = peg$c25(s2); s0 = s1; } else { peg$currPos = s0; @@ -1429,7 +1342,7 @@ module.exports = (function() { function peg$parseValue() { var s0, s1; - var key = peg$currPos * 56 + 15, + var key = peg$currPos * 34 + 15, cached = peg$resultsCache[key]; if (cached) { @@ -1443,7 +1356,7 @@ module.exports = (function() { s1 = peg$parseQuotedString(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c28(s1); + s1 = peg$c27(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -1451,14 +1364,14 @@ module.exports = (function() { s1 = peg$parseUnquotedLiteral(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c29(s1); + s1 = peg$c28(s1); } s0 = s1; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } + if (peg$silentFails === 0) { peg$fail(peg$c26); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1469,7 +1382,7 @@ module.exports = (function() { function peg$parseOr() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 56 + 16, + var key = peg$currPos * 34 + 16, cached = peg$resultsCache[key]; if (cached) { @@ -1491,12 +1404,12 @@ module.exports = (function() { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c31) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1524,33 +1437,10 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneOr(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1561,7 +1451,7 @@ module.exports = (function() { function peg$parseAnd() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 56 + 17, + var key = peg$currPos * 34 + 17, cached = peg$resultsCache[key]; if (cached) { @@ -1583,12 +1473,12 @@ module.exports = (function() { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c34) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1616,33 +1506,10 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneAnd(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } + if (peg$silentFails === 0) { peg$fail(peg$c32); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1653,7 +1520,7 @@ module.exports = (function() { function peg$parseNot() { var s0, s1, s2, s3; - var key = peg$currPos * 56 + 18, + var key = peg$currPos * 34 + 18, cached = peg$resultsCache[key]; if (cached) { @@ -1664,12 +1531,12 @@ module.exports = (function() { peg$silentFails++; s0 = peg$currPos; - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c37) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { s1 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1693,33 +1560,10 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - peg$savedPos = peg$currPos; - s1 = peg$c1(); - if (s1) { - s1 = void 0; - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneNot(); - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c35); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1730,7 +1574,7 @@ module.exports = (function() { function peg$parseLiteral() { var s0, s1; - var key = peg$currPos * 56 + 19, + var key = peg$currPos * 34 + 19, cached = peg$resultsCache[key]; if (cached) { @@ -1747,7 +1591,7 @@ module.exports = (function() { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } + if (peg$silentFails === 0) { peg$fail(peg$c38); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1758,7 +1602,7 @@ module.exports = (function() { function peg$parseQuotedString() { var s0, s1, s2, s3, s4, s5, s6; - var key = peg$currPos * 56 + 20, + var key = peg$currPos * 34 + 20, cached = peg$resultsCache[key]; if (cached) { @@ -1769,7 +1613,7 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { @@ -1777,11 +1621,11 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c41; + s2 = peg$c40; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s2 !== peg$FAILED) { s3 = []; @@ -1801,15 +1645,15 @@ module.exports = (function() { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c41; + s6 = peg$c40; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c43(s3, s4, s5); + s1 = peg$c42(s3, s4, s5); s0 = s1; } else { peg$currPos = s0; @@ -1838,11 +1682,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c41; + s1 = peg$c40; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1853,15 +1697,15 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c41; + s3 = peg$c40; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } + if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c44(s2); + s1 = peg$c43(s2); s0 = s1; } else { peg$currPos = s0; @@ -1885,7 +1729,7 @@ module.exports = (function() { function peg$parseQuotedCharacter() { var s0, s1, s2; - var key = peg$currPos * 56 + 21, + var key = peg$currPos * 34 + 21, cached = peg$resultsCache[key]; if (cached) { @@ -1898,23 +1742,23 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - if (peg$c47.test(input.charAt(peg$currPos))) { + if (peg$c46.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; @@ -1937,16 +1781,16 @@ module.exports = (function() { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (peg$c50.test(input.charAt(peg$currPos))) { + if (peg$c49.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c51); } + if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; @@ -1967,7 +1811,7 @@ module.exports = (function() { function peg$parseUnquotedLiteral() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 22, + var key = peg$currPos * 34 + 22, cached = peg$resultsCache[key]; if (cached) { @@ -1978,7 +1822,7 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { @@ -2002,7 +1846,7 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c43(s2, s3, s4); + s1 = peg$c42(s2, s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -2034,7 +1878,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c52(s1); + s1 = peg$c51(s1); } s0 = s1; } @@ -2047,7 +1891,7 @@ module.exports = (function() { function peg$parseUnquotedCharacter() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 56 + 23, + var key = peg$currPos * 34 + 23, cached = peg$resultsCache[key]; if (cached) { @@ -2103,11 +1947,11 @@ module.exports = (function() { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c53); } + if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s4); + s1 = peg$c48(s4); s0 = s1; } else { peg$currPos = s0; @@ -2138,7 +1982,7 @@ module.exports = (function() { function peg$parseWildcard() { var s0, s1; - var key = peg$currPos * 56 + 24, + var key = peg$currPos * 34 + 24, cached = peg$resultsCache[key]; if (cached) { @@ -2149,15 +1993,15 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { - s1 = peg$c54; + s1 = peg$c53; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } + if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c56(); + s1 = peg$c55(); } s0 = s1; @@ -2169,7 +2013,7 @@ module.exports = (function() { function peg$parseOptionalSpace() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 56 + 25, + var key = peg$currPos * 34 + 25, cached = peg$resultsCache[key]; if (cached) { @@ -2180,7 +2024,7 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { @@ -2204,7 +2048,7 @@ module.exports = (function() { } if (s4 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c43(s2, s3, s4); + s1 = peg$c42(s2, s3, s4); s0 = s1; } else { peg$currPos = s0; @@ -2239,7 +2083,7 @@ module.exports = (function() { function peg$parseEscapedWhitespace() { var s0, s1; - var key = peg$currPos * 56 + 26, + var key = peg$currPos * 34 + 26, cached = peg$resultsCache[key]; if (cached) { @@ -2249,44 +2093,44 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c57) { - s1 = peg$c57; + if (input.substr(peg$currPos, 2) === peg$c56) { + s1 = peg$c56; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$c57); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(); + s1 = peg$c58(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c60) { - s1 = peg$c60; + if (input.substr(peg$currPos, 2) === peg$c59) { + s1 = peg$c59; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(); + s1 = peg$c61(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c63) { - s1 = peg$c63; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } + if (peg$silentFails === 0) { peg$fail(peg$c63); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c65(); + s1 = peg$c64(); } s0 = s1; } @@ -2300,7 +2144,7 @@ module.exports = (function() { function peg$parseEscapedSpecialCharacter() { var s0, s1, s2; - var key = peg$currPos * 56 + 27, + var key = peg$currPos * 34 + 27, cached = peg$resultsCache[key]; if (cached) { @@ -2311,17 +2155,17 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { s2 = peg$parseSpecialCharacter(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; @@ -2340,7 +2184,7 @@ module.exports = (function() { function peg$parseEscapedKeyword() { var s0, s1, s2; - var key = peg$currPos * 56 + 28, + var key = peg$currPos * 34 + 28, cached = peg$resultsCache[key]; if (cached) { @@ -2351,41 +2195,41 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; + s1 = peg$c44; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2).toLowerCase() === peg$c31) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c30) { s2 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c34) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c33) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 === peg$FAILED) { - if (input.substr(peg$currPos, 3).toLowerCase() === peg$c37) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c36) { s2 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$c37); } } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c66(s2); + s1 = peg$c65(s2); s0 = s1; } else { peg$currPos = s0; @@ -2404,7 +2248,7 @@ module.exports = (function() { function peg$parseKeyword() { var s0; - var key = peg$currPos * 56 + 29, + var key = peg$currPos * 34 + 29, cached = peg$resultsCache[key]; if (cached) { @@ -2429,7 +2273,7 @@ module.exports = (function() { function peg$parseSpecialCharacter() { var s0; - var key = peg$currPos * 56 + 30, + var key = peg$currPos * 34 + 30, cached = peg$resultsCache[key]; if (cached) { @@ -2438,12 +2282,12 @@ module.exports = (function() { return cached.result; } - if (peg$c67.test(input.charAt(peg$currPos))) { + if (peg$c66.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c68); } + if (peg$silentFails === 0) { peg$fail(peg$c67); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2454,7 +2298,7 @@ module.exports = (function() { function peg$parseRangeOperator() { var s0, s1; - var key = peg$currPos * 56 + 31, + var key = peg$currPos * 34 + 31, cached = peg$resultsCache[key]; if (cached) { @@ -2464,58 +2308,58 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c69) { - s1 = peg$c69; + if (input.substr(peg$currPos, 2) === peg$c68) { + s1 = peg$c68; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c71(); + s1 = peg$c70(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c72) { - s1 = peg$c72; + if (input.substr(peg$currPos, 2) === peg$c71) { + s1 = peg$c71; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c72); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c74(); + s1 = peg$c73(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c75; + s1 = peg$c74; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } + if (peg$silentFails === 0) { peg$fail(peg$c75); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c77(); + s1 = peg$c76(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c78; + s1 = peg$c77; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c80(); + s1 = peg$c79(); } s0 = s1; } @@ -2530,7 +2374,7 @@ module.exports = (function() { function peg$parseSpace() { var s0, s1; - var key = peg$currPos * 56 + 32, + var key = peg$currPos * 34 + 32, cached = peg$resultsCache[key]; if (cached) { @@ -2540,17 +2384,17 @@ module.exports = (function() { } peg$silentFails++; - if (peg$c82.test(input.charAt(peg$currPos))) { + if (peg$c81.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c83); } + if (peg$silentFails === 0) { peg$fail(peg$c82); } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2561,7 +2405,7 @@ module.exports = (function() { function peg$parseCursor() { var s0, s1, s2; - var key = peg$currPos * 56 + 33, + var key = peg$currPos * 34 + 33, cached = peg$resultsCache[key]; if (cached) { @@ -2572,23 +2416,23 @@ module.exports = (function() { s0 = peg$currPos; peg$savedPos = peg$currPos; - s1 = peg$c40(); + s1 = peg$c39(); if (s1) { s1 = void 0; } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 14) === peg$c84) { - s2 = peg$c84; + if (input.substr(peg$currPos, 14) === peg$c83) { + s2 = peg$c83; peg$currPos += 14; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c85); } + if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c86(); + s1 = peg$c85(); s0 = s1; } else { peg$currPos = s0; @@ -2604,1325 +2448,8 @@ module.exports = (function() { return s0; } - function peg$parseLuceneOr() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 34, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c87) { - s2 = peg$c87; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c89(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneAnd() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 35, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c90) { - s2 = peg$c90; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c91); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c92(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 43) { - s1 = peg$c93; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c94); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c92(); - } - s0 = s1; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneNot() { - var s0, s1; - - var key = peg$currPos * 56 + 36, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c95; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c97(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 33) { - s1 = peg$c98; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } - } - if (s1 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c97(); - } - s0 = s1; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneQuery() { - var s0; - - var key = peg$currPos * 56 + 37, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseLuceneFieldQuery(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneValue(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneExists(); - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneFieldQuery() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 56 + 38, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseLuceneLiteral(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLuceneValue(); - if (s5 !== peg$FAILED) { - s1 = [s1, s2, s3, s4, s5]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneValue() { - var s0; - - var key = peg$currPos * 56 + 39, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseLuceneRange(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneWildcard(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneRegex(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneFuzzy(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneProximity(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneBoost(); - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneExists() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 56 + 40, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c100) { - s1 = peg$c100; - peg$currPos += 8; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c11; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseSpace(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseSpace(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parseLuceneLiteral(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c102(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRange() { - var s0, s1, s2, s3, s4, s5, s6; - - var key = peg$currPos * 56 + 41, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseRangeOperator(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseLuceneLiteral(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c103(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseLuceneRangeStart(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseSpace(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseSpace(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parseLuceneLiteral(); - if (s3 !== peg$FAILED) { - s4 = peg$parseLuceneTo(); - if (s4 !== peg$FAILED) { - s5 = peg$parseLuceneLiteral(); - if (s5 !== peg$FAILED) { - s6 = peg$parseLuceneRangeEnd(); - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c103(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneWildcard() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 42, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseLuceneUnquotedCharacter(); - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 42) { - s2 = peg$c54; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - } - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseLuceneUnquotedCharacter(); - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 42) { - s2 = peg$c54; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - } - } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 63) { - s2 = peg$c104; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseLuceneWildcard(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseLuceneWildcard(); - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c106(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRegex() { - var s0, s1, s2, s3; - - var key = peg$currPos * 56 + 43, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 47) { - s1 = peg$c107; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c109.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c109.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 47) { - s3 = peg$c107; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c111(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneFuzzy() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 44, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseLuceneUnquotedLiteral(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 126) { - s2 = peg$c112; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c116(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneProximity() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 45, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseQuotedString(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 126) { - s2 = peg$c112; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c117(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneBoost() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 46, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseLuceneLiteral(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 94) { - s2 = peg$c118; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } - } - if (s2 !== peg$FAILED) { - s3 = []; - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c114.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c115); } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c120(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneLiteral() { - var s0; - - var key = peg$currPos * 56 + 47, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseQuotedString(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneUnquotedLiteral(); - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneUnquotedLiteral() { - var s0, s1; - - var key = peg$currPos * 56 + 48, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = []; - s1 = peg$parseLuceneUnquotedCharacter(); - if (s1 !== peg$FAILED) { - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parseLuceneUnquotedCharacter(); - } - } else { - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneUnquotedCharacter() { - var s0, s1, s2, s3; - - var key = peg$currPos * 56 + 49, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseEscapedWhitespace(); - if (s0 === peg$FAILED) { - s0 = peg$parseEscapedLuceneSpecialCharacter(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseLuceneSpecialCharacter(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = void 0; - } else { - peg$currPos = s1; - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parseLuceneKeyword(); - peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = void 0; - } else { - peg$currPos = s2; - s2 = peg$FAILED; - } - if (s2 !== peg$FAILED) { - if (input.length > peg$currPos) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c53); } - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneKeyword() { - var s0; - - var key = peg$currPos * 56 + 50, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$parseOr(); - if (s0 === peg$FAILED) { - s0 = peg$parseAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneOr(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneAnd(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneNot(); - if (s0 === peg$FAILED) { - s0 = peg$parseLuceneTo(); - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEscapedLuceneSpecialCharacter() { - var s0, s1, s2; - - var key = peg$currPos * 56 + 51, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c45; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseLuceneSpecialCharacter(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c121(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneSpecialCharacter() { - var s0; - - var key = peg$currPos * 56 + 52, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 43) { - s0 = peg$c93; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c94); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 45) { - s0 = peg$c95; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s0 = peg$c122; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c123); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 62) { - s0 = peg$c78; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 60) { - s0 = peg$c75; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 33) { - s0 = peg$c98; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c99); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 40) { - s0 = peg$c6; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s0 = peg$c8; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c13; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c15; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c124; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c125); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c126; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 94) { - s0 = peg$c118; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s0 = peg$c41; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c42); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 126) { - s0 = peg$c112; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 42) { - s0 = peg$c54; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 63) { - s0 = peg$c104; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c105); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s0 = peg$c11; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 92) { - s0 = peg$c45; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 47) { - s0 = peg$c107; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c108); } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneTo() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 56 + 53, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseSpace(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseSpace(); - } - } else { - s1 = peg$FAILED; - } - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 2) === peg$c128) { - s2 = peg$c128; - peg$currPos += 2; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c129); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseSpace(); - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseSpace(); - } - } else { - s3 = peg$FAILED; - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRangeStart() { - var s0; - - var key = peg$currPos * 56 + 54, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 91) { - s0 = peg$c124; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c125); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 123) { - s0 = peg$c13; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c14); } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseLuceneRangeEnd() { - var s0; - - var key = peg$currPos * 56 + 55, - cached = peg$resultsCache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 93) { - s0 = peg$c126; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c127); } - } - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s0 = peg$c15; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } - } - } - - peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - const { errorOnLuceneSyntax, parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; const buildLiteralNode = nodeTypes.literal.buildNode; const buildWildcardNode = nodeTypes.wildcard.buildNode; diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts b/src/plugins/data/common/es_query/kuery/ast/ast.test.ts index 34e91787c6320..7d6e4c14f1502 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.test.ts +++ b/src/plugins/data/common/es_query/kuery/ast/ast.test.ts @@ -6,12 +6,7 @@ * Side Public License, v 1. */ -import { - fromKueryExpression, - fromLiteralExpression, - toElasticsearchQuery, - doesKueryExpressionHaveLuceneSyntaxError, -} from './ast'; +import { fromKueryExpression, fromLiteralExpression, toElasticsearchQuery } from './ast'; import { nodeTypes } from '../node_types'; import { fields } from '../../../index_patterns/mocks'; import { IIndexPattern } from '../../../index_patterns'; @@ -376,81 +371,4 @@ describe('kuery AST API', () => { expect(result).toEqual(expected); }); }); - - describe('doesKueryExpressionHaveLuceneSyntaxError', () => { - test('should return true for Lucene ranges', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: [1 TO 10]'); - expect(result).toEqual(true); - }); - - test('should return false for KQL ranges', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar < 1'); - expect(result).toEqual(false); - }); - - test('should return true for Lucene exists', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('_exists_: bar'); - expect(result).toEqual(true); - }); - - test('should return false for KQL exists', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar:*'); - expect(result).toEqual(false); - }); - - test('should return true for Lucene wildcards', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba?'); - expect(result).toEqual(true); - }); - - test('should return false for KQL wildcards', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba*'); - expect(result).toEqual(false); - }); - - test('should return true for Lucene regex', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: /ba.*/'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene fuzziness', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba~'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene proximity', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: "ba"~2'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene boosting', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('bar: ba^2'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene + operator', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('+foo: bar'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene - operators', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('-foo: bar'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene && operators', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('foo: bar && baz: qux'); - expect(result).toEqual(true); - }); - - test('should return true for Lucene || operators', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('foo: bar || baz: qux'); - expect(result).toEqual(true); - }); - - test('should return true for mixed KQL/Lucene queries', () => { - const result = doesKueryExpressionHaveLuceneSyntaxError('foo: bar and (baz: qux || bag)'); - expect(result).toEqual(true); - }); - }); }); diff --git a/src/plugins/data/common/es_query/kuery/ast/ast.ts b/src/plugins/data/common/es_query/kuery/ast/ast.ts index 6ad76661edff4..5b22e3b3a3e0e 100644 --- a/src/plugins/data/common/es_query/kuery/ast/ast.ts +++ b/src/plugins/data/common/es_query/kuery/ast/ast.ts @@ -56,17 +56,6 @@ export const fromKueryExpression = ( } }; -export const doesKueryExpressionHaveLuceneSyntaxError = ( - expression: string | DslQuery -): boolean => { - try { - fromExpression(expression, { errorOnLuceneSyntax: true }, parseKuery); - return false; - } catch (e) { - return e.message.startsWith('Lucene'); - } -}; - /** * @params {String} indexPattern * @params {Object} config - contains the dateFormatTZ diff --git a/src/plugins/data/common/es_query/kuery/ast/kuery.peg b/src/plugins/data/common/es_query/kuery/ast/kuery.peg index e4d305ced7270..2e195ec7a618f 100644 --- a/src/plugins/data/common/es_query/kuery/ast/kuery.peg +++ b/src/plugins/data/common/es_query/kuery/ast/kuery.peg @@ -5,7 +5,7 @@ // Initialization block { - const { errorOnLuceneSyntax, parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; + const { parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options; const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes; const buildLiteralNode = nodeTypes.literal.buildNode; const buildWildcardNode = nodeTypes.wildcard.buildNode; @@ -26,8 +26,7 @@ start } OrQuery - = &{ return errorOnLuceneSyntax; } LuceneQuery - / head:AndQuery tail:(Or query:AndQuery { return query; })+ { + = head:AndQuery tail:(Or query:AndQuery { return query; })+ { const nodes = [head, ...tail]; const cursor = parseCursor && nodes.find(node => node.type === 'cursor'); if (cursor) return cursor; @@ -199,15 +198,12 @@ Value "value" Or "OR" = Space+ 'or'i Space+ - / &{ return errorOnLuceneSyntax; } LuceneOr And "AND" = Space+ 'and'i Space+ - / &{ return errorOnLuceneSyntax; } LuceneAnd Not "NOT" = 'not'i Space+ - / &{ return errorOnLuceneSyntax; } LuceneNot Literal "literal" = QuotedString / UnquotedLiteral @@ -306,109 +302,3 @@ Space "whitespace" Cursor = &{ return parseCursor; } '@kuery-cursor@' { return cursorSymbol; } - -// Temporary error rules (to help users transition from Lucene... should be removed at some point) - -LuceneOr - = Space* '||' Space* { - error('LuceneOr'); - } - -LuceneAnd - = Space* '&&' Space* { - error('LuceneAnd'); - } - / '+' { - error('LuceneAnd'); - } - -LuceneNot - = '-' { - error('LuceneNot'); - } - / '!' { - error('LuceneNot'); - } - -LuceneQuery - = LuceneFieldQuery - / LuceneValue - / LuceneExists - -LuceneFieldQuery - = LuceneLiteral Space* ':' Space* LuceneValue - -LuceneValue - = LuceneRange - / LuceneWildcard - / LuceneRegex - / LuceneFuzzy - / LuceneProximity - / LuceneBoost - -LuceneExists - = '_exists_' Space* ':' Space* LuceneLiteral { - error('LuceneExists'); - } - -LuceneRange - = RangeOperator Space* LuceneLiteral { - error('LuceneRange'); - } - / LuceneRangeStart Space* LuceneLiteral LuceneTo LuceneLiteral LuceneRangeEnd { - error('LuceneRange'); - } - -LuceneWildcard - = (LuceneUnquotedCharacter / '*')* '?' LuceneWildcard* { - error('LuceneWildcard'); - } - -LuceneRegex - = '/' [^/]* '/' { - error('LuceneRegex'); - } - -LuceneFuzzy - = LuceneUnquotedLiteral '~' [0-9]* { - error('LuceneFuzzy'); - } - -LuceneProximity - = QuotedString '~' [0-9]* { - error('LuceneProximity'); - } - -LuceneBoost - = LuceneLiteral '^' [0-9]* { - error('LuceneBoost'); - } - -LuceneLiteral - = QuotedString / LuceneUnquotedLiteral - -LuceneUnquotedLiteral - = LuceneUnquotedCharacter+ - -LuceneUnquotedCharacter - = EscapedWhitespace - / EscapedLuceneSpecialCharacter - / !LuceneSpecialCharacter !LuceneKeyword . - -LuceneKeyword - = Or / And / LuceneOr / LuceneAnd / LuceneNot / LuceneTo - -EscapedLuceneSpecialCharacter - = '\\' LuceneSpecialCharacter { return char; } - -LuceneSpecialCharacter - = '+' / '-' / '=' / '>' / '<' / '!' / '(' / ')' / '{' / '}' / '[' / ']' / '^' / '"' / '~' / '*' / '?' / ':' / '\\' / '/' - -LuceneTo - = Space+ 'TO' Space+ - -LuceneRangeStart - = '[' / '{' - -LuceneRangeEnd - = ']' / '}' diff --git a/src/plugins/data/common/es_query/kuery/types.ts b/src/plugins/data/common/es_query/kuery/types.ts index 3f787d5a41d3a..fe1496ead7ab6 100644 --- a/src/plugins/data/common/es_query/kuery/types.ts +++ b/src/plugins/data/common/es_query/kuery/types.ts @@ -21,7 +21,6 @@ export interface KueryParseOptions { }; startRule: string; allowLeadingWildcards: boolean; - errorOnLuceneSyntax: boolean; cursorSymbol?: string; parseCursor?: boolean; } diff --git a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx index 4142bccc09f40..88ccf6fe8a105 100644 --- a/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/data/public/ui/query_string_input/query_bar_top_row.tsx @@ -9,13 +9,10 @@ import dateMath from '@elastic/datemath'; import classNames from 'classnames'; import React, { useState } from 'react'; -import { i18n } from '@kbn/i18n'; import { - EuiButton, EuiFlexGroup, EuiFlexItem, - EuiLink, EuiSuperDatePicker, EuiFieldText, prettyDuration, @@ -23,12 +20,10 @@ import { } from '@elastic/eui'; // @ts-ignore import { EuiSuperUpdateButton, OnRefreshProps } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { Toast } from 'src/core/public'; import { IDataPluginServices, IIndexPattern, TimeRange, TimeHistoryContract, Query } from '../..'; -import { useKibana, toMountPoint, withKibana } from '../../../../kibana_react/public'; +import { useKibana, withKibana } from '../../../../kibana_react/public'; import QueryStringInputUI from './query_string_input'; -import { doesKueryExpressionHaveLuceneSyntaxError, UI_SETTINGS } from '../../../common'; +import { UI_SETTINGS } from '../../../common'; import { PersistedLog, getQueryLog } from '../../query'; import { NoDataPopover } from './no_data_popover'; @@ -72,9 +67,7 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { const [isQueryInputFocused, setIsQueryInputFocused] = useState(false); const kibana = useKibana(); - const { uiSettings, notifications, storage, appName, docLinks } = kibana.services; - - const kueryQuerySyntaxLink: string = docLinks!.links.query.kueryQuerySyntax; + const { uiSettings, storage, appName } = kibana.services; const queryLanguage = props.query && props.query.language; const persistedLog: PersistedLog | undefined = React.useMemo( @@ -152,8 +145,6 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { } function onSubmit({ query, dateRange }: { query?: Query; dateRange: TimeRange }) { - handleLuceneSyntaxWarning(); - if (props.timeHistory) { props.timeHistory.add(dateRange); } @@ -305,60 +296,6 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) { ); } - function handleLuceneSyntaxWarning() { - if (!props.query) return; - const { query, language } = props.query; - if ( - language === 'kuery' && - typeof query === 'string' && - (!storage || !storage.get('kibana.luceneSyntaxWarningOptOut')) && - doesKueryExpressionHaveLuceneSyntaxError(query) - ) { - const toast = notifications!.toasts.addWarning({ - title: i18n.translate('data.query.queryBar.luceneSyntaxWarningTitle', { - defaultMessage: 'Lucene syntax warning', - }), - text: toMountPoint( -
-

- - - - ), - }} - /> -

- - - onLuceneSyntaxWarningOptOut(toast)}> - - - - -
- ), - }); - } - } - - function onLuceneSyntaxWarningOptOut(toast: Toast) { - if (!storage) return; - storage.set('kibana.luceneSyntaxWarningOptOut', true); - notifications!.toasts.remove(toast); - } - const classes = classNames('kbnQueryBar', { 'kbnQueryBar--withDatePicker': props.showDatePicker, }); diff --git a/src/plugins/home/public/application/components/add_data/add_data.test.tsx b/src/plugins/home/public/application/components/add_data/add_data.test.tsx index 24635ef4aaa89..10119632c01b7 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.test.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.test.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { AddData } from './add_data'; import { shallowWithIntl } from '@kbn/test/jest'; +import { FeatureCatalogueEntry, FeatureCatalogueCategory } from '../../../services'; jest.mock('../app_navigation_handler', () => { return { @@ -28,9 +29,9 @@ beforeEach(() => { const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); -const mockFeatures = [ +const mockFeatures: FeatureCatalogueEntry[] = [ { - category: 'data', + category: FeatureCatalogueCategory.DATA, description: 'Ingest data from popular apps and services.', showOnHomePage: true, icon: 'indexOpen', @@ -40,7 +41,7 @@ const mockFeatures = [ title: 'Ingest data', }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Add and manage your fleet of Elastic Agents and integrations.', showOnHomePage: true, icon: 'indexManagementApp', @@ -50,7 +51,7 @@ const mockFeatures = [ title: 'Add Elastic Agent', }, { - category: 'data', + category: FeatureCatalogueCategory.DATA, description: 'Import your own CSV, NDJSON, or log file', showOnHomePage: true, icon: 'document', diff --git a/src/plugins/home/public/application/components/add_data/add_data.tsx b/src/plugins/home/public/application/components/add_data/add_data.tsx index f7ff43db29d6e..e20abab271f29 100644 --- a/src/plugins/home/public/application/components/add_data/add_data.tsx +++ b/src/plugins/home/public/application/components/add_data/add_data.tsx @@ -11,8 +11,7 @@ import PropTypes from 'prop-types'; import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { METRIC_TYPE } from '@kbn/analytics'; -// @ts-expect-error untyped service -import { FeatureCatalogueEntry } from '../../services'; +import type { FeatureCatalogueEntry } from '../../../services'; import { createAppNavigationHandler } from '../app_navigation_handler'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx index 6e28b295cd463..5b0728a8a4c71 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { ManageData } from './manage_data'; import { shallowWithIntl } from '@kbn/test/jest'; +import { FeatureCatalogueEntry, FeatureCatalogueCategory } from '../../../services'; jest.mock('../app_navigation_handler', () => { return { @@ -28,9 +29,9 @@ beforeEach(() => { const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); -const mockFeatures = [ +const mockFeatures: FeatureCatalogueEntry[] = [ { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Control who has access and what tasks they can perform.', icon: 'securityApp', id: 'security', @@ -40,7 +41,7 @@ const mockFeatures = [ showOnHomePage: true, }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Track the real-time health and performance of your deployment.', icon: 'monitoringApp', id: 'monitoring', @@ -50,7 +51,7 @@ const mockFeatures = [ showOnHomePage: true, }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Save snapshots to a backup repository, and restore to recover index and cluster state.', icon: 'storage', @@ -61,7 +62,7 @@ const mockFeatures = [ showOnHomePage: true, }, { - category: 'admin', + category: FeatureCatalogueCategory.ADMIN, description: 'Define lifecycle policies to automatically perform operations as an index ages.', icon: 'indexSettings', id: 'index_lifecycle_management', diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.tsx index dff3f0b1af428..4ca695b8cb118 100644 --- a/src/plugins/home/public/application/components/manage_data/manage_data.tsx +++ b/src/plugins/home/public/application/components/manage_data/manage_data.tsx @@ -11,8 +11,7 @@ import PropTypes from 'prop-types'; import { EuiFlexGroup, EuiHorizontalRule, EuiSpacer, EuiTitle, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { METRIC_TYPE } from '@kbn/analytics'; -// @ts-expect-error untyped service -import { FeatureCatalogueEntry } from '../../services'; +import { FeatureCatalogueEntry } from '../../../services'; import { createAppNavigationHandler } from '../app_navigation_handler'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; diff --git a/src/plugins/home/public/mocks/index.ts b/src/plugins/home/public/mocks.ts similarity index 67% rename from src/plugins/home/public/mocks/index.ts rename to src/plugins/home/public/mocks.ts index 4df32a84ae6c5..32bec31153ba0 100644 --- a/src/plugins/home/public/mocks/index.ts +++ b/src/plugins/home/public/mocks.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -import { featureCatalogueRegistryMock } from '../services/feature_catalogue/feature_catalogue_registry.mock'; -import { environmentServiceMock } from '../services/environment/environment.mock'; -import { configSchema } from '../../config'; -import { tutorialServiceMock } from '../services/tutorials/tutorial_service.mock'; +import { featureCatalogueRegistryMock } from './services/feature_catalogue/feature_catalogue_registry.mock'; +import { environmentServiceMock } from './services/environment/environment.mock'; +import { configSchema } from '../config'; +import { tutorialServiceMock } from './services/tutorials/tutorial_service.mock'; const createSetupContract = () => ({ featureCatalogue: featureCatalogueRegistryMock.createSetup(), diff --git a/src/plugins/home/server/tutorials/googlecloud_logs/index.ts b/src/plugins/home/server/tutorials/gcp_logs/index.ts similarity index 71% rename from src/plugins/home/server/tutorials/googlecloud_logs/index.ts rename to src/plugins/home/server/tutorials/gcp_logs/index.ts index 0b1a2ad89b8e5..6aa6adb183418 100644 --- a/src/plugins/home/server/tutorials/googlecloud_logs/index.ts +++ b/src/plugins/home/server/tutorials/gcp_logs/index.ts @@ -18,27 +18,27 @@ import { TutorialSchema, } from '../../services/tutorials/lib/tutorials_registry_types'; -export function googlecloudLogsSpecProvider(context: TutorialContext): TutorialSchema { - const moduleName = 'googlecloud'; +export function gcpLogsSpecProvider(context: TutorialContext): TutorialSchema { + const moduleName = 'gcp'; const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; return { - id: 'googlecloudLogs', - name: i18n.translate('home.tutorials.googlecloudLogs.nameTitle', { + id: 'gcpLogs', + name: i18n.translate('home.tutorials.gcpLogs.nameTitle', { defaultMessage: 'Google Cloud logs', }), moduleName, category: TutorialsCategory.SECURITY_SOLUTION, - shortDescription: i18n.translate('home.tutorials.googlecloudLogs.shortDescription', { + shortDescription: i18n.translate('home.tutorials.gcpLogs.shortDescription', { defaultMessage: 'Collect Google Cloud audit, firewall, and VPC flow logs.', }), - longDescription: i18n.translate('home.tutorials.googlecloudLogs.longDescription', { + longDescription: i18n.translate('home.tutorials.gcpLogs.longDescription', { defaultMessage: 'This is a module for Google Cloud logs. It supports reading audit, VPC flow, \ and firewall logs that have been exported from Stackdriver to a Google Pub/Sub \ topic sink. \ [Learn more]({learnMoreLink}).', values: { - learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-googlecloud.html', + learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-gcp.html', }, }), euiIconType: 'logoGoogleG', @@ -46,21 +46,18 @@ export function googlecloudLogsSpecProvider(context: TutorialContext): TutorialS dashboards: [ { id: '6576c480-73a2-11ea-a345-f985c61fe654', - linkLabel: i18n.translate( - 'home.tutorials.googlecloudLogs.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Audit Logs Dashbaord', - } - ), + linkLabel: i18n.translate('home.tutorials.gcpLogs.artifacts.dashboards.linkLabel', { + defaultMessage: 'Audit Logs Dashbaord', + }), isOverview: true, }, ], exportedFields: { - documentationUrl: '{config.docs.beats.filebeat}/exported-fields-googlecloud.html', + documentationUrl: '{config.docs.beats.filebeat}/exported-fields-gcp.html', }, }, completionTimeMinutes: 10, - previewImagePath: '/plugins/home/assets/googlecloud_logs/screenshot.png', + previewImagePath: '/plugins/home/assets/gcp_logs/screenshot.png', onPrem: onPremInstructions(moduleName, platforms, context), elasticCloud: cloudInstructions(moduleName, platforms), onPremElasticCloud: onPremCloudInstructions(moduleName, platforms), diff --git a/src/plugins/home/server/tutorials/googlecloud_metrics/index.ts b/src/plugins/home/server/tutorials/gcp_metrics/index.ts similarity index 63% rename from src/plugins/home/server/tutorials/googlecloud_metrics/index.ts rename to src/plugins/home/server/tutorials/gcp_metrics/index.ts index 1e9dc64d60b57..8416ab105de96 100644 --- a/src/plugins/home/server/tutorials/googlecloud_metrics/index.ts +++ b/src/plugins/home/server/tutorials/gcp_metrics/index.ts @@ -18,25 +18,25 @@ import { TutorialSchema, } from '../../services/tutorials/lib/tutorials_registry_types'; -export function googlecloudMetricsSpecProvider(context: TutorialContext): TutorialSchema { - const moduleName = 'googlecloud'; +export function gcpMetricsSpecProvider(context: TutorialContext): TutorialSchema { + const moduleName = 'gcp'; return { - id: 'googlecloudMetrics', - name: i18n.translate('home.tutorials.googlecloudMetrics.nameTitle', { + id: 'gcpMetrics', + name: i18n.translate('home.tutorials.gcpMetrics.nameTitle', { defaultMessage: 'Google Cloud metrics', }), moduleName, category: TutorialsCategory.METRICS, - shortDescription: i18n.translate('home.tutorials.googlecloudMetrics.shortDescription', { + shortDescription: i18n.translate('home.tutorials.gcpMetrics.shortDescription', { defaultMessage: 'Fetch monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API.', }), - longDescription: i18n.translate('home.tutorials.googlecloudMetrics.longDescription', { + longDescription: i18n.translate('home.tutorials.gcpMetrics.longDescription', { defaultMessage: - 'The `googlecloud` Metricbeat module fetches monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API. \ + 'The `gcp` Metricbeat module fetches monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API. \ [Learn more]({learnMoreLink}).', values: { - learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-googlecloud.html', + learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-gcp.html', }, }), euiIconType: 'logoGCP', @@ -45,21 +45,18 @@ export function googlecloudMetricsSpecProvider(context: TutorialContext): Tutori dashboards: [ { id: 'f40ee870-5e4a-11ea-a4f6-717338406083', - linkLabel: i18n.translate( - 'home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel', - { - defaultMessage: 'Google Cloud metrics dashboard', - } - ), + linkLabel: i18n.translate('home.tutorials.gcpMetrics.artifacts.dashboards.linkLabel', { + defaultMessage: 'Google Cloud metrics dashboard', + }), isOverview: true, }, ], exportedFields: { - documentationUrl: '{config.docs.beats.metricbeat}/exported-fields-googlecloud.html', + documentationUrl: '{config.docs.beats.metricbeat}/exported-fields-gcp.html', }, }, completionTimeMinutes: 10, - previewImagePath: '/plugins/home/assets/googlecloud_metrics/screenshot.png', + previewImagePath: '/plugins/home/assets/gcp_metrics/screenshot.png', onPrem: onPremInstructions(moduleName, context), elasticCloud: cloudInstructions(moduleName), onPremElasticCloud: onPremCloudInstructions(moduleName), diff --git a/src/plugins/home/server/tutorials/register.ts b/src/plugins/home/server/tutorials/register.ts index 62b696aca7f43..bc8c85c43e691 100644 --- a/src/plugins/home/server/tutorials/register.ts +++ b/src/plugins/home/server/tutorials/register.ts @@ -42,8 +42,8 @@ import { etcdMetricsSpecProvider } from './etcd_metrics'; import { f5LogsSpecProvider } from './f5_logs'; import { fortinetLogsSpecProvider } from './fortinet_logs'; import { golangMetricsSpecProvider } from './golang_metrics'; -import { googlecloudLogsSpecProvider } from './googlecloud_logs'; -import { googlecloudMetricsSpecProvider } from './googlecloud_metrics'; +import { gcpLogsSpecProvider } from './gcp_logs'; +import { gcpMetricsSpecProvider } from './gcp_metrics'; import { gsuiteLogsSpecProvider } from './gsuite_logs'; import { haproxyLogsSpecProvider } from './haproxy_logs'; import { haproxyMetricsSpecProvider } from './haproxy_metrics'; @@ -192,7 +192,7 @@ export const builtInTutorials = [ oracleMetricsSpecProvider, iisMetricsSpecProvider, azureLogsSpecProvider, - googlecloudMetricsSpecProvider, + gcpMetricsSpecProvider, auditdLogsSpecProvider, barracudaLogsSpecProvider, bluecoatLogsSpecProvider, @@ -202,7 +202,7 @@ export const builtInTutorials = [ cylanceLogsSpecProvider, f5LogsSpecProvider, fortinetLogsSpecProvider, - googlecloudLogsSpecProvider, + gcpLogsSpecProvider, gsuiteLogsSpecProvider, haproxyLogsSpecProvider, icingaLogsSpecProvider, diff --git a/test/examples/bfetch_explorer/index.ts b/test/examples/bfetch_explorer/index.ts index b487704663c62..e5b4789bf9178 100644 --- a/test/examples/bfetch_explorer/index.ts +++ b/test/examples/bfetch_explorer/index.ts @@ -14,6 +14,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid const PageObjects = getPageObjects(['common', 'header']); describe('bfetch explorer', function () { + this.tags('ciGroup2'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('bfetch-explorer', { insertTimestamp: false }); diff --git a/test/examples/config.js b/test/examples/config.js index 0ba7af0bfceb7..1ee095fbdedeb 100644 --- a/test/examples/config.js +++ b/test/examples/config.js @@ -6,12 +6,20 @@ * Side Public License, v 1. */ -import path from 'path'; +import path, { resolve } from 'path'; import { services } from '../plugin_functional/services'; +import fs from 'fs'; +import { KIBANA_ROOT } from '@kbn/test'; export default async function ({ readConfigFile }) { const functionalConfig = await readConfigFile(require.resolve('../functional/config')); + // Find all folders in /examples and /x-pack/examples since we treat all them as plugin folder + const examplesFiles = fs.readdirSync(resolve(KIBANA_ROOT, 'examples')); + const examples = examplesFiles.filter((file) => + fs.statSync(resolve(KIBANA_ROOT, 'examples', file)).isDirectory() + ); + return { testFiles: [ require.resolve('./embeddables'), @@ -50,9 +58,11 @@ export default async function ({ readConfigFile }) { ...functionalConfig.get('kbnTestServer'), serverArgs: [ ...functionalConfig.get('kbnTestServer.serverArgs'), - '--run-examples', - // Required to run examples + // Required to load new platform plugins via `--plugin-path` flag. '--env.name=development', + ...examples.map( + (exampleDir) => `--plugin-path=${resolve(KIBANA_ROOT, 'examples', exampleDir)}` + ), ], }, }; diff --git a/test/examples/embeddables/index.ts b/test/examples/embeddables/index.ts index 62ebae0882e05..b6ec314875566 100644 --- a/test/examples/embeddables/index.ts +++ b/test/examples/embeddables/index.ts @@ -18,6 +18,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header']); describe('embeddable explorer', function () { + this.tags('ciGroup2'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('embeddableExplorer'); diff --git a/test/examples/expressions_explorer/index.ts b/test/examples/expressions_explorer/index.ts index 119d51785741f..843b3da369d81 100644 --- a/test/examples/expressions_explorer/index.ts +++ b/test/examples/expressions_explorer/index.ts @@ -18,6 +18,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header']); describe('expressions explorer', function () { + this.tags('ciGroup2'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('expressionsExplorer'); diff --git a/test/examples/routing/index.ts b/test/examples/routing/index.ts index 1a53a0375f0ed..bef282c436a21 100644 --- a/test/examples/routing/index.ts +++ b/test/examples/routing/index.ts @@ -17,6 +17,7 @@ export default function ({ getService, getPageObjects, loadTestFile }: FtrProvid describe('routing examples', function () { before(async () => { + this.tags('ciGroup2'); await PageObjects.common.navigateToApp('routingExample'); }); diff --git a/test/examples/state_sync/index.ts b/test/examples/state_sync/index.ts index df3461a565498..83ab9edaa1cf0 100644 --- a/test/examples/state_sync/index.ts +++ b/test/examples/state_sync/index.ts @@ -17,6 +17,7 @@ export default function ({ const browser = getService('browser'); describe('state sync examples', function () { + this.tags('ciGroup2'); before(async () => { await browser.setWindowSize(1300, 900); }); diff --git a/test/examples/ui_actions/index.ts b/test/examples/ui_actions/index.ts index a0c1c47a995ac..3827d9c8d641e 100644 --- a/test/examples/ui_actions/index.ts +++ b/test/examples/ui_actions/index.ts @@ -18,6 +18,7 @@ export default function ({ const PageObjects = getPageObjects(['common', 'header']); describe('ui actions explorer', function () { + this.tags('ciGroup2'); before(async () => { await browser.setWindowSize(1300, 900); await PageObjects.common.navigateToApp('uiActionsExplorer'); diff --git a/test/functional/apps/dashboard/bwc_import.ts b/test/functional/apps/dashboard/bwc_import.ts new file mode 100644 index 0000000000000..03f1f126338fa --- /dev/null +++ b/test/functional/apps/dashboard/bwc_import.ts @@ -0,0 +1,43 @@ +/* + * 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. + */ + +import path from 'path'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['dashboard', 'header', 'settings', 'savedObjects', 'common']); + const dashboardExpect = getService('dashboardExpect'); + + describe('bwc import', function describeIndexTests() { + before(async function () { + await PageObjects.dashboard.initTests(); + await PageObjects.settings.navigateTo(); + await PageObjects.settings.clickKibanaSavedObjects(); + await PageObjects.savedObjects.importFile( + path.join(__dirname, 'exports', 'dashboard_6_0_1.json') + ); + await PageObjects.settings.associateIndexPattern( + 'dd684000-8255-11eb-a5e7-93c302c8f329', + 'logstash-*' + ); + await PageObjects.savedObjects.clickConfirmChanges(); + await PageObjects.savedObjects.clickImportDone(); + await PageObjects.common.navigateToApp('dashboard'); + }); + + describe('6.0.1 dashboard', () => { + it('loads an imported dashboard', async function () { + await PageObjects.dashboard.gotoDashboardLandingPage(); + await PageObjects.dashboard.loadSavedDashboard('My custom bwc dashboard'); + await PageObjects.header.waitUntilLoadingHasFinished(); + + await dashboardExpect.metricValuesExist(['14,004']); + }); + }); + }); +} diff --git a/test/functional/apps/dashboard/exports/dashboard_6_0_1.json b/test/functional/apps/dashboard/exports/dashboard_6_0_1.json new file mode 100644 index 0000000000000..8c5b1eda32b54 --- /dev/null +++ b/test/functional/apps/dashboard/exports/dashboard_6_0_1.json @@ -0,0 +1,46 @@ +[ + { + "_id": "924ed3d0-8256-11eb-a5e7-93c302c8f329", + "_type": "dashboard", + "_source": { + "title": "My custom bwc dashboard", + "hits": 0, + "description": "", + "panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"1bdf34a0-8266-11eb-a5e7-93c302c8f329\",\"col\":1,\"row\":1}]", + "optionsJSON": "{\"darkTheme\":false}", + "uiStateJSON": "{\"P-1\":{\"vis\":{\"defaultColors\":{\"0 - 100\":\"rgb(0,104,55)\"}}}}", + "version": 1, + "timeRestore": true, + "timeTo": "Wed Apr 20 2016 23:59:59 GMT+0200", + "timeFrom": "Thu Jan 01 2015 00:00:00 GMT+0100", + "refreshInterval": { + "display": "Off", + "pause": false, + "value": 0 + }, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[],\"highlightAll\":true,\"version\":true}" + } + }, + "_meta": { + "savedObjectVersion": 2 + } + }, + { + "_id": "1bdf34a0-8266-11eb-a5e7-93c302c8f329", + "_type": "visualization", + "_source": { + "title": "My custom bwc viz", + "visState": "{\"title\":\"My custom bwc viz\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"gauge\",\"gauge\":{\"verticalSplit\":false,\"autoExtend\":false,\"percentageMode\":false,\"gaugeType\":\"Metric\",\"gaugeStyle\":\"Full\",\"backStyle\":\"Full\",\"orientation\":\"vertical\",\"colorSchema\":\"Green to Red\",\"gaugeColorMode\":\"None\",\"useRange\":false,\"colorsRange\":[{\"from\":0,\"to\":100}],\"invertColors\":false,\"labels\":{\"show\":true,\"color\":\"black\"},\"scale\":{\"show\":false,\"labels\":false,\"color\":\"#333\",\"width\":2},\"type\":\"simple\",\"style\":{\"fontSize\":60,\"bgColor\":false,\"labelColor\":false,\"subText\":\"\"}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}", + "uiStateJSON": "{\"vis\":{\"defaultColors\":{\"0 - 100\":\"rgb(0,104,55)\"}}}", + "description": "", + "version": 1, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"index\":\"dd684000-8255-11eb-a5e7-93c302c8f329\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}" + } + }, + "_meta": { + "savedObjectVersion": 2 + } + } +] diff --git a/test/functional/apps/dashboard/index.ts b/test/functional/apps/dashboard/index.ts index d7bd9f6b51522..9f9422ddaec64 100644 --- a/test/functional/apps/dashboard/index.ts +++ b/test/functional/apps/dashboard/index.ts @@ -95,6 +95,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./dashboard_time_picker')); loadTestFile(require.resolve('./bwc_shared_urls')); + loadTestFile(require.resolve('./bwc_import')); loadTestFile(require.resolve('./panel_replacing')); loadTestFile(require.resolve('./panel_cloning')); loadTestFile(require.resolve('./copy_panel_to')); diff --git a/test/scripts/jenkins_build_plugins.sh b/test/scripts/jenkins_build_plugins.sh index cfb829ea2db54..962a126ab2700 100755 --- a/test/scripts/jenkins_build_plugins.sh +++ b/test/scripts/jenkins_build_plugins.sh @@ -8,5 +8,6 @@ node scripts/build_kibana_platform_plugins \ --scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \ --scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \ --scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \ + --scan-dir "$KIBANA_DIR/examples" \ --workers 6 \ --verbose diff --git a/test/scripts/jenkins_ci_group.sh b/test/scripts/jenkins_ci_group.sh index 58dcc9f52c089..3cf1c279f4134 100755 --- a/test/scripts/jenkins_ci_group.sh +++ b/test/scripts/jenkins_ci_group.sh @@ -14,7 +14,6 @@ if [[ -z "$CODE_COVERAGE" ]]; then if [[ ! "$TASK_QUEUE_PROCESS_ID" && "$CI_GROUP" == "1" ]]; then source test/scripts/jenkins_build_kbn_sample_panel_action.sh ./test/scripts/test/plugin_functional.sh - ./test/scripts/test/example_functional.sh ./test/scripts/test/interpreter_functional.sh fi else diff --git a/test/scripts/jenkins_plugin_functional.sh b/test/scripts/jenkins_plugin_functional.sh index 1811bdeb4ed4b..4781f98b92b1f 100755 --- a/test/scripts/jenkins_plugin_functional.sh +++ b/test/scripts/jenkins_plugin_functional.sh @@ -11,5 +11,4 @@ cd -; pwd ./test/scripts/test/plugin_functional.sh -./test/scripts/test/example_functional.sh ./test/scripts/test/interpreter_functional.sh diff --git a/test/scripts/jenkins_xpack_build_plugins.sh b/test/scripts/jenkins_xpack_build_plugins.sh index 06e8ce8b2fe59..496964983cc6c 100755 --- a/test/scripts/jenkins_xpack_build_plugins.sh +++ b/test/scripts/jenkins_xpack_build_plugins.sh @@ -13,5 +13,7 @@ node scripts/build_kibana_platform_plugins \ --scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \ --scan-dir "$XPACK_DIR/test/licensing_plugin/plugins" \ --scan-dir "$XPACK_DIR/test/usage_collection/plugins" \ + --scan-dir "$KIBANA_DIR/examples" \ + --scan-dir "$XPACK_DIR/examples" \ --workers 12 \ --verbose diff --git a/test/scripts/test/example_functional.sh b/test/scripts/test/example_functional.sh deleted file mode 100755 index 08915085505bc..0000000000000 --- a/test/scripts/test/example_functional.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -source test/scripts/jenkins_test_setup_oss.sh - -checks-reporter-with-killswitch "Example Functional Tests" \ - node scripts/functional_tests \ - --config test/examples/config.js \ - --bail \ - --debug diff --git a/x-pack/examples/alerting_example/public/application.tsx b/x-pack/examples/alerting_example/public/application.tsx index 3c869eb3438cc..a9d0b9fc84905 100644 --- a/x-pack/examples/alerting_example/public/application.tsx +++ b/x-pack/examples/alerting_example/public/application.tsx @@ -43,10 +43,10 @@ const AlertingExampleApp = ({ )} /> ) => { return ( - + ); @@ -56,7 +56,7 @@ const AlertingExampleApp = ({ path={`/astros/:id`} render={(props: RouteComponentProps<{ id: string }>) => { return ( - + ); diff --git a/x-pack/examples/alerting_example/public/components/create_alert.tsx b/x-pack/examples/alerting_example/public/components/create_alert.tsx index 8177763ca5fe8..889b0c7f2d7d6 100644 --- a/x-pack/examples/alerting_example/public/components/create_alert.tsx +++ b/x-pack/examples/alerting_example/public/components/create_alert.tsx @@ -36,8 +36,8 @@ export const CreateAlert = ({ } - title={`Create Alert`} - description="Create an new Alert based on one of our example Alert Types ." + title={`Create Rule`} + description="Create a new Rule based on one of our example Rule Types ." onClick={() => setAlertFlyoutVisibility(true)} /> diff --git a/x-pack/examples/alerting_example/public/components/documentation.tsx b/x-pack/examples/alerting_example/public/components/documentation.tsx index 3bfe4697253c3..2cef174675533 100644 --- a/x-pack/examples/alerting_example/public/components/documentation.tsx +++ b/x-pack/examples/alerting_example/public/components/documentation.tsx @@ -46,8 +46,8 @@ export const DocumentationPage = (

Plugin Structure

This example solution has both `server` and a `public` plugins. The `server` handles - registration of example the AlertTypes, while the `public` handles creation of, and - navigation for, these alert types. + registration of example the RuleTypes, while the `public` handles creation of, and + navigation for, these rule types.

diff --git a/x-pack/examples/alerting_example/public/components/view_alert.tsx b/x-pack/examples/alerting_example/public/components/view_alert.tsx index 12f0eb6f35701..8c942d685af27 100644 --- a/x-pack/examples/alerting_example/public/components/view_alert.tsx +++ b/x-pack/examples/alerting_example/public/components/view_alert.tsx @@ -43,37 +43,37 @@ export const ViewAlertPage = withRouter(({ http, id }: Props) => { return alert && alertState ? ( - +

- This is a generic view for all Alerts created by the + This is a generic view for all Rules created by the {ALERTING_EXAMPLE_APP_ID} plugin.

You are now viewing the {`${alert.name}`} - Alert, whose ID is {`${alert.id}`}. + Rule, whose ID is {`${alert.id}`}.

- Its AlertType is {`${alert.alertTypeId}`} and + Its RuleType is {`${alert.alertTypeId}`} and its scheduled to run at an interval of {`${alert.schedule.interval}`}.

-

Alert Instances

+

Alerts

{isEmpty(alertState.alertInstances) ? ( - -

This Alert doesn't have any active alert instances at the moment.

+ +

This Rule doesn't have any active alerts at the moment.

) : (

- Bellow are the active Alert Instances which were activated on the alerts last run. + Below are the active Alerts which were activated on the rules last run.
- For each instance id you can see its current state in JSON format. + For each alert id you can see its current state in JSON format.

diff --git a/x-pack/examples/alerting_example/public/components/view_astros_alert.tsx b/x-pack/examples/alerting_example/public/components/view_astros_alert.tsx index 1d8bf4e3a71dd..7e8487b0179fa 100644 --- a/x-pack/examples/alerting_example/public/components/view_astros_alert.tsx +++ b/x-pack/examples/alerting_example/public/components/view_astros_alert.tsx @@ -49,21 +49,20 @@ export const ViewPeopleInSpaceAlertPage = withRouter(({ http, id }: Props) => { return alert && alertState ? ( - +

This is a specific view for all - example.people-in-space Alerts created by - the + example.people-in-space Rules created by the {ALERTING_EXAMPLE_APP_ID} plugin.

-

Alert Instances

+

Alerts

{isEmpty(alertState.alertInstances) ? ( - +

The people in {alert.params.craft} at the moment are not {alert.params.op}{' '} {alert.params.outerSpaceCapacity} @@ -73,7 +72,7 @@ export const ViewPeopleInSpaceAlertPage = withRouter(({ http, id }: Props) => {

- The alert has been triggered because the people in {alert.params.craft} at the moment{' '} + The rule has been triggered because the people in {alert.params.craft} at the moment{' '} {alert.params.op} {alert.params.outerSpaceCapacity}

diff --git a/x-pack/examples/alerting_example/public/plugin.tsx b/x-pack/examples/alerting_example/public/plugin.tsx index c8f69b21b4ee4..6ec6f043d0e0e 100644 --- a/x-pack/examples/alerting_example/public/plugin.tsx +++ b/x-pack/examples/alerting_example/public/plugin.tsx @@ -63,7 +63,7 @@ export class AlertingExamplePlugin implements Plugin ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/context_menu_actions.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/context_menu_actions.tsx index 253cc1c0189dc..f25415101b9ac 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/context_menu_actions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/context_menu_actions.tsx @@ -14,9 +14,9 @@ import { EuiPopover, EuiButton, } from '@elastic/eui'; -import { EuiButtonProps } from '@elastic/eui/src/components/button/button'; -import { EuiContextMenuProps } from '@elastic/eui/src/components/context_menu/context_menu'; -import { EuiContextMenuPanelProps } from '@elastic/eui/src/components/context_menu/context_menu_panel'; +import type { EuiButtonProps } from '@elastic/eui/src/components/button/button'; +import type { EuiContextMenuProps } from '@elastic/eui/src/components/context_menu/context_menu'; +import type { EuiContextMenuPanelProps } from '@elastic/eui/src/components/context_menu/context_menu_panel'; type Props = { button?: { diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/enrollment_instructions/manual/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/enrollment_instructions/manual/index.tsx index 6243597cf003c..6f1adfc8cf9c1 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/enrollment_instructions/manual/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/enrollment_instructions/manual/index.tsx @@ -10,7 +10,7 @@ import styled from 'styled-components'; import { EuiText, EuiSpacer, EuiLink, EuiTitle, EuiCodeBlock } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EnrollmentAPIKey } from '../../../types'; +import type { EnrollmentAPIKey } from '../../../types'; interface Props { kibanaUrl: string; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/extension_wrapper.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/extension_wrapper.tsx index bb22586122295..9c7ebc03899e7 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/extension_wrapper.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/extension_wrapper.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import React, { memo, ReactNode, Suspense } from 'react'; +import type { ReactNode } from 'react'; +import React, { memo, Suspense } from 'react'; import { EuiErrorBoundary } from '@elastic/eui'; import { Loading } from './loading'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/header.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/header.tsx index d12311cf16d3d..f04ae88913c24 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/header.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/header.tsx @@ -8,8 +8,8 @@ import React, { memo } from 'react'; import styled from 'styled-components'; import { EuiFlexGroup, EuiFlexItem, EuiTabs, EuiTab, EuiSpacer } from '@elastic/eui'; -import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; -import { EuiFlexItemProps } from '@elastic/eui/src/components/flex/flex_item'; +import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; +import type { EuiFlexItemProps } from '@elastic/eui/src/components/flex/flex_item'; const Container = styled.div` border-bottom: ${(props) => props.theme.eui.euiBorderThin}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx index 526b6513173ef..51870b482c3f2 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx @@ -8,7 +8,7 @@ import React, { memo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiText, EuiLink, EuiSpacer } from '@elastic/eui'; -import { TutorialModuleNoticeComponent } from 'src/plugins/home/public'; +import type { TutorialModuleNoticeComponent } from 'src/plugins/home/public'; import { useGetPackages, useLink, useCapabilities } from '../../hooks'; import { pkgKeyFromPackageInfo } from '../../services/pkg_key_from_package_info'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx index a8672f6a4942e..071a9dc5943b2 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx @@ -7,8 +7,9 @@ import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import React, { CSSProperties, memo } from 'react'; -import { EuiLinkProps } from '@elastic/eui/src/components/link/link'; +import type { CSSProperties } from 'react'; +import React, { memo } from 'react'; +import type { EuiLinkProps } from '@elastic/eui/src/components/link/link'; const MIN_WIDTH: CSSProperties = { minWidth: 0 }; const NO_WRAP_WHITE_SPACE: CSSProperties = { whiteSpace: 'nowrap' }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx index 3b788126a570f..e42917700284e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx @@ -6,7 +6,8 @@ */ import React, { memo } from 'react'; -import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui'; +import type { EuiLinkAnchorProps } from '@elastic/eui'; +import { EuiLink } from '@elastic/eui'; import { useLink } from '../hooks'; import { AGENT_SAVED_OBJECT_TYPE } from '../constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/loading.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/loading.tsx index db2f9c492fa2a..3e6f000694dbc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/loading.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/loading.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; -import { EuiLoadingSpinnerSize } from '@elastic/eui/src/components/loading/loading_spinner'; +import type { EuiLoadingSpinnerSize } from '@elastic/eui/src/components/loading/loading_spinner'; export const Loading: React.FunctionComponent<{ size?: EuiLoadingSpinnerSize }> = ({ size }) => ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx index 5b8fddd2d5e05..cb0b02527f756 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx @@ -6,9 +6,11 @@ */ import React from 'react'; -import { EuiIcon, EuiIconProps } from '@elastic/eui'; +import type { EuiIconProps } from '@elastic/eui'; +import { EuiIcon } from '@elastic/eui'; -import { usePackageIconType, UsePackageIconType } from '../hooks'; +import type { UsePackageIconType } from '../hooks'; +import { usePackageIconType } from '../hooks'; export const PackageIcon: React.FunctionComponent< UsePackageIconType & Omit diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx index cac475fc7a98a..c9f8523e4ce60 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/search_bar.tsx @@ -7,11 +7,8 @@ import React, { useState, useEffect, useMemo } from 'react'; -import { - QueryStringInput, - IFieldType, - esKuery, -} from '../../../../../../../src/plugins/data/public'; +import type { IFieldType } from '../../../../../../../src/plugins/data/public'; +import { QueryStringInput, esKuery } from '../../../../../../../src/plugins/data/public'; import { useStartServices } from '../hooks'; import { INDEX_NAME, AGENT_SAVED_OBJECT_TYPE } from '../constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx index 000c664548cb8..e10f53741dba9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx @@ -6,9 +6,10 @@ */ import { i18n } from '@kbn/i18n'; -import { ChromeBreadcrumb } from 'src/core/public'; +import type { ChromeBreadcrumb } from 'src/core/public'; -import { BASE_PATH, Page, DynamicPagePathValues, pagePathGetters } from '../constants'; +import type { Page, DynamicPagePathValues } from '../constants'; +import { BASE_PATH, pagePathGetters } from '../constants'; import { useStartServices } from './use_core'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_fleet_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_fleet_status.tsx index c506ccda37de8..24ecc458d6bcc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_fleet_status.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_fleet_status.tsx @@ -7,7 +7,7 @@ import React, { useState, useContext, useEffect } from 'react'; -import { GetFleetStatusResponse } from '../types'; +import type { GetFleetStatusResponse } from '../types'; import { useConfig } from './use_config'; import { sendGetFleetStatus } from './use_request'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_intra_app_state.tsx b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_intra_app_state.tsx index e6f91093aafad..2a1df7605fcfa 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_intra_app_state.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_intra_app_state.tsx @@ -6,10 +6,10 @@ */ import React, { memo, useContext, useMemo } from 'react'; -import { AppMountParameters } from 'kibana/public'; +import type { AppMountParameters } from 'kibana/public'; import { useLocation } from 'react-router-dom'; -import { AnyIntraAppRouteState } from '../types'; +import type { AnyIntraAppRouteState } from '../types'; interface IntraAppState { forRoute: string; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts index 91c45e3019cf5..b42c6e68fb499 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts @@ -9,18 +9,18 @@ import { useState, useEffect } from 'react'; import type { HttpSetup } from 'src/core/public'; import { - UseRequestConfig as _UseRequestConfig, sendRequest as _sendRequest, useRequest as _useRequest, } from '../../../../../../../../src/plugins/es_ui_shared/public'; import type { SendRequestConfig, SendRequestResponse, + UseRequestConfig, } from '../../../../../../../../src/plugins/es_ui_shared/public'; let httpClient: HttpSetup; -export type UseRequestConfig = _UseRequestConfig; +export type { UseRequestConfig } from '../../../../../../../../src/plugins/es_ui_shared/public'; /** * @internal diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_sorting.tsx b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_sorting.tsx index a11586766ab9e..f6b1702387492 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_sorting.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_sorting.tsx @@ -6,7 +6,7 @@ */ import { useState } from 'react'; -import { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; +import type { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; export function useSorting(defaultSorting: CriteriaWithPagination['sort']) { const [sorting, setSorting] = useState['sort']>(defaultSorting); diff --git a/x-pack/plugins/fleet/public/applications/fleet/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/index.tsx index a66b28e5f05c9..7d31fb31b36a4 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/index.tsx @@ -7,13 +7,14 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { Redirect, Route, RouteProps } from 'react-router-dom'; -import { CoreStart, AppMountParameters } from 'src/core/public'; +import type { RouteProps } from 'react-router-dom'; +import { Redirect, Route } from 'react-router-dom'; +import type { CoreStart, AppMountParameters } from 'src/core/public'; -import { FleetConfigType, FleetStartServices } from '../../plugin'; +import type { FleetConfigType, FleetStartServices } from '../../plugin'; import { licenseService } from './hooks'; -import { UIExtensionsStorage } from './types'; +import type { UIExtensionsStorage } from './types'; import { AppRoutes, FleetAppContext, WithPermissionsAndSetup } from './app'; export interface ProtectedRouteProps extends RouteProps { diff --git a/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx b/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx index 001ad069f1b6f..ba6367a861e9d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx @@ -10,7 +10,7 @@ import styled from 'styled-components'; import { EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Section } from '../sections'; +import type { Section } from '../sections'; import { AlphaMessaging, SettingFlyout } from '../components'; import { useLink, useConfig } from '../hooks'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx b/x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx index c8a8d47e6d802..bb561ab82acaa 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx @@ -8,7 +8,8 @@ import React, { Fragment } from 'react'; import { EuiPageBody, EuiSpacer } from '@elastic/eui'; -import { Header, HeaderProps } from '../components'; +import type { HeaderProps } from '../components'; +import { Header } from '../components'; import { Page, ContentWrapper } from './without_header'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx b/x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx index 0a1346c888acc..c1fa1422fa8ab 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx @@ -5,19 +5,21 @@ * 2.0. */ -import { createMemoryHistory, History, createHashHistory } from 'history'; +import type { History } from 'history'; +import { createMemoryHistory, createHashHistory } from 'history'; import React, { memo } from 'react'; -import { render as reactRender, RenderOptions, RenderResult, act } from '@testing-library/react'; +import type { RenderOptions, RenderResult } from '@testing-library/react'; +import { render as reactRender, act } from '@testing-library/react'; import { ScopedHistory } from '../../../../../../../src/core/public'; import { FleetAppContext } from '../app'; -import { FleetConfigType } from '../../../plugin'; -import { UIExtensionsStorage } from '../types'; +import type { FleetConfigType } from '../../../plugin'; +import type { UIExtensionsStorage } from '../types'; import { createConfigurationMock } from './plugin_configuration'; import { createStartMock } from './plugin_interfaces'; import { createStartServices } from './fleet_start_services'; -import { MockedFleetStart, MockedFleetStartServices } from './types'; +import type { MockedFleetStart, MockedFleetStartServices } from './types'; type UiRender = (ui: React.ReactElement, options?: RenderOptions) => RenderResult; diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx b/x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx index 4dfa0805bdbc5..ab75962c344df 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx @@ -7,14 +7,15 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n/react'; -import { MockedKeys } from '@kbn/utility-types/jest'; +import type { MockedKeys } from '@kbn/utility-types/jest'; import { coreMock } from '../../../../../../../src/core/public/mocks'; -import { IStorage, Storage } from '../../../../../../../src/plugins/kibana_utils/public'; +import type { IStorage } from '../../../../../../../src/plugins/kibana_utils/public'; +import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; import { setHttpClient } from '../hooks/use_request'; import { createStartDepsMock } from './plugin_dependencies'; -import { MockedFleetStartServices } from './types'; +import type { MockedFleetStartServices } from './types'; // Taken from core. See: src/plugins/kibana_utils/public/storage/storage.test.ts const createMockStore = (): MockedKeys => { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx index 0db0f1f8cab72..9ee0b0a7b29ee 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx @@ -9,7 +9,7 @@ import React, { memo, useState, useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiContextMenuItem, EuiPortal } from '@elastic/eui'; -import { AgentPolicy } from '../../../types'; +import type { AgentPolicy } from '../../../types'; import { useCapabilities } from '../../../hooks'; import { ContextMenuActions } from '../../../components'; import { AgentEnrollmentFlyout } from '../../agents/components'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_copy_provider.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_copy_provider.tsx index d16a0351f1bbd..ef623d30b8847 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_copy_provider.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_copy_provider.tsx @@ -10,7 +10,7 @@ import { EuiConfirmModal, EuiFormRow, EuiFieldText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../types'; +import type { AgentPolicy } from '../../../types'; import { sendCopyAgentPolicy, useStartServices } from '../../../hooks'; interface Props { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_form.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_form.tsx index c0da3a72dce62..238cba217da8e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_form.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_form.tsx @@ -26,7 +26,7 @@ import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; import { dataTypes } from '../../../../../../common'; -import { NewAgentPolicy, AgentPolicy } from '../../../types'; +import type { NewAgentPolicy, AgentPolicy } from '../../../types'; import { isValidNamespace } from '../../../services'; import { AgentPolicyDeleteProvider } from './agent_policy_delete_provider'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/confirm_deploy_modal.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/confirm_deploy_modal.tsx index f75aea703fd19..fc34680eab063 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/confirm_deploy_modal.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/confirm_deploy_modal.tsx @@ -10,7 +10,7 @@ import { EuiCallOut, EuiConfirmModal, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { AgentPolicy } from '../../../types'; +import type { AgentPolicy } from '../../../types'; export const ConfirmDeployAgentPolicyModal: React.FunctionComponent<{ onConfirm: () => void; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/package_policy_delete_provider.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/package_policy_delete_provider.tsx index 05b2bbf46b9e9..198886e9b9c7f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/package_policy_delete_provider.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/package_policy_delete_provider.tsx @@ -12,7 +12,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { useStartServices, sendRequest, sendDeletePackagePolicy, useConfig } from '../../../hooks'; import { AGENT_API_ROUTES, AGENT_SAVED_OBJECT_TYPE } from '../../../constants'; -import { AgentPolicy } from '../../../types'; +import type { AgentPolicy } from '../../../types'; interface Props { agentPolicy: AgentPolicy; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx index 0f51b603a49aa..4aaf5343638be 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx @@ -19,9 +19,9 @@ import { } from '@elastic/eui'; import { WithHeaderLayout } from '../../../../layouts'; -import { AgentPolicy, PackageInfo } from '../../../../types'; +import type { AgentPolicy, PackageInfo } from '../../../../types'; import { PackageIcon } from '../../../../components/package_icon'; -import { CreatePackagePolicyFrom } from '../types'; +import type { CreatePackagePolicyFrom } from '../types'; export const CreatePackagePolicyPageLayout: React.FunctionComponent<{ from: CreatePackagePolicyFrom; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_config.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_config.tsx index c5c1033f1b800..037c716b42a36 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_config.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_config.tsx @@ -17,12 +17,9 @@ import { EuiButtonEmpty, } from '@elastic/eui'; -import { NewPackagePolicyInput, RegistryVarsEntry } from '../../../../types'; -import { - isAdvancedVar, - PackagePolicyConfigValidationResults, - validationHasErrors, -} from '../services'; +import type { NewPackagePolicyInput, RegistryVarsEntry } from '../../../../types'; +import type { PackagePolicyConfigValidationResults } from '../services'; +import { isAdvancedVar, validationHasErrors } from '../services'; import { PackagePolicyInputVarField } from './package_policy_input_var_field'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_panel.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_panel.tsx index 92098d6971d35..75d7a7549f721 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_panel.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_panel.tsx @@ -19,17 +19,14 @@ import { EuiSpacer, } from '@elastic/eui'; -import { +import type { NewPackagePolicyInput, PackagePolicyInputStream, RegistryInput, RegistryStream, } from '../../../../types'; -import { - PackagePolicyInputValidationResults, - hasInvalidButRequiredVar, - countValidationErrors, -} from '../services'; +import type { PackagePolicyInputValidationResults } from '../services'; +import { hasInvalidButRequiredVar, countValidationErrors } from '../services'; import { PackagePolicyInputConfig } from './package_policy_input_config'; import { PackagePolicyInputStreamConfig } from './package_policy_input_stream'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_stream.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_stream.tsx index b21e8ca2e2243..3337af7437112 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_stream.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_stream.tsx @@ -19,12 +19,13 @@ import { EuiButtonEmpty, } from '@elastic/eui'; -import { NewPackagePolicyInputStream, RegistryStream, RegistryVarsEntry } from '../../../../types'; -import { - isAdvancedVar, - PackagePolicyConfigValidationResults, - validationHasErrors, -} from '../services'; +import type { + NewPackagePolicyInputStream, + RegistryStream, + RegistryVarsEntry, +} from '../../../../types'; +import type { PackagePolicyConfigValidationResults } from '../services'; +import { isAdvancedVar, validationHasErrors } from '../services'; import { PackagePolicyInputVarField } from './package_policy_input_var_field'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx index 1a53607711a0a..15712f9042eb9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/package_policy_input_var_field.tsx @@ -18,7 +18,7 @@ import { EuiFieldPassword, } from '@elastic/eui'; -import { RegistryVarsEntry } from '../../../../types'; +import type { RegistryVarsEntry } from '../../../../types'; import 'brace/mode/yaml'; import 'brace/theme/textmate'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx index d9d43dc6ef975..11c672aa0596d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx @@ -9,9 +9,10 @@ import { Route } from 'react-router-dom'; import React from 'react'; import { act } from 'react-test-renderer'; -import { createTestRendererMock, MockedFleetStartServices, TestRenderer } from '../../../mock'; +import type { MockedFleetStartServices, TestRenderer } from '../../../mock'; +import { createTestRendererMock } from '../../../mock'; import { PAGE_ROUTING_PATHS, pagePathGetters, PLUGIN_ID } from '../../../constants'; -import { CreatePackagePolicyRouteState } from '../../../types'; +import type { CreatePackagePolicyRouteState } from '../../../types'; import { CreatePackagePolicyPage } from './index'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx index bf6540db7dee7..f312220d9faec 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import React, { useState, useEffect, useMemo, useCallback, ReactEventHandler } from 'react'; +import type { ReactEventHandler } from 'react'; +import React, { useState, useEffect, useMemo, useCallback } from 'react'; import { useRouteMatch, useHistory } from 'react-router-dom'; import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; @@ -19,10 +20,10 @@ import { EuiFlexItem, EuiSpacer, } from '@elastic/eui'; -import { EuiStepProps } from '@elastic/eui/src/components/steps/step'; -import { ApplicationStart } from 'kibana/public'; +import type { EuiStepProps } from '@elastic/eui/src/components/steps/step'; +import type { ApplicationStart } from 'kibana/public'; -import { +import type { AgentPolicy, PackageInfo, NewPackagePolicy, @@ -41,17 +42,14 @@ import { ConfirmDeployAgentPolicyModal } from '../components'; import { useIntraAppState } from '../../../hooks/use_intra_app_state'; import { useUIExtension } from '../../../hooks/use_ui_extension'; import { ExtensionWrapper } from '../../../components/extension_wrapper'; -import { PackagePolicyEditExtensionComponentProps } from '../../../types'; +import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; import { PLUGIN_ID } from '../../../../../../common/constants'; import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; import { CreatePackagePolicyPageLayout } from './components'; -import { CreatePackagePolicyFrom, PackagePolicyFormState } from './types'; -import { - PackagePolicyValidationResults, - validatePackagePolicy, - validationHasErrors, -} from './services'; +import type { CreatePackagePolicyFrom, PackagePolicyFormState } from './types'; +import type { PackagePolicyValidationResults } from './services'; +import { validatePackagePolicy, validationHasErrors } from './services'; import { StepSelectPackage } from './step_select_package'; import { StepSelectAgentPolicy } from './step_select_agent_policy'; import { StepConfigurePackagePolicy } from './step_configure_package'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_configure_package.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_configure_package.tsx index 35619f528f907..87c5af56f31b2 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_configure_package.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_configure_package.tsx @@ -15,7 +15,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { +import type { PackageInfo, RegistryStream, NewPackagePolicy, @@ -23,9 +23,9 @@ import { } from '../../../types'; import { Loading } from '../../../components'; -import { PackagePolicyValidationResults } from './services'; +import type { PackagePolicyValidationResults } from './services'; import { PackagePolicyInputPanel } from './components'; -import { CreatePackagePolicyFrom } from './types'; +import type { CreatePackagePolicyFrom } from './types'; const findStreamsForInputType = ( inputType: string, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx index fdcb4e15112a6..25234e5da3f81 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx @@ -19,12 +19,12 @@ import { EuiFlexItem, } from '@elastic/eui'; -import { AgentPolicy, PackageInfo, PackagePolicy, NewPackagePolicy } from '../../../types'; +import type { AgentPolicy, PackageInfo, PackagePolicy, NewPackagePolicy } from '../../../types'; import { packageToPackagePolicyInputs } from '../../../services'; import { Loading } from '../../../components'; import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; -import { PackagePolicyValidationResults } from './services'; +import type { PackagePolicyValidationResults } from './services'; export const StepDefinePackagePolicy: React.FunctionComponent<{ agentPolicy: AgentPolicy; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx index 5359075ed19c3..53fab8bda4a8c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx @@ -9,11 +9,11 @@ import React, { useEffect, useState, useMemo } from 'react'; import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import type { EuiComboBoxOptionOption } from '@elastic/eui'; import { EuiFlexGroup, EuiFlexItem, EuiComboBox, - EuiComboBoxOptionOption, EuiTextColor, EuiPortal, EuiFormRow, @@ -21,7 +21,7 @@ import { } from '@elastic/eui'; import { Error } from '../../../components'; -import { AgentPolicy, PackageInfo, GetAgentPoliciesResponseItem } from '../../../types'; +import type { AgentPolicy, PackageInfo, GetAgentPoliciesResponseItem } from '../../../types'; import { isPackageLimited, doesAgentPolicyAlreadyIncludePackage } from '../../../services'; import { useGetPackageInfoByKey, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx index 346dba971a2b4..80faba37e9a43 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx @@ -11,7 +11,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiSelectable, EuiSpacer } from '@elastic/eui'; import { Error } from '../../../components'; -import { AgentPolicy, PackageInfo, PackagePolicy, GetPackagesResponse } from '../../../types'; +import type { AgentPolicy, PackageInfo, PackagePolicy, GetPackagesResponse } from '../../../types'; import { useGetOneAgentPolicy, useGetPackages, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/index.tsx index c131183f20bdc..04ffa42a8cc33 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/index.tsx @@ -7,7 +7,7 @@ import React, { memo } from 'react'; -import { AgentPolicy, PackagePolicy } from '../../../../../types'; +import type { AgentPolicy, PackagePolicy } from '../../../../../types'; import { NoPackagePolicies } from './no_package_policies'; import { PackagePoliciesTable } from './package_policies_table'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx index 899c457bbd9f9..db88de0ba720b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx @@ -8,9 +8,9 @@ import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import type { EuiInMemoryTableProps } from '@elastic/eui'; import { EuiInMemoryTable, - EuiInMemoryTableProps, EuiBadge, EuiContextMenuItem, EuiButton, @@ -19,7 +19,7 @@ import { EuiText, } from '@elastic/eui'; -import { AgentPolicy, PackagePolicy } from '../../../../../types'; +import type { AgentPolicy, PackagePolicy } from '../../../../../types'; import { PackageIcon, ContextMenuActions } from '../../../../../components'; import { PackagePolicyDeleteProvider, DangerEuiContextMenuItem } from '../../../components'; import { useCapabilities, useLink } from '../../../../../hooks'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx index c10c197691390..e91d32a78ec96 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx @@ -12,7 +12,7 @@ import { EuiBottomBar, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty, EuiButton } fr import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../../../types'; +import type { AgentPolicy } from '../../../../../types'; import { useLink, useStartServices, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx index 8171dc12483a8..1147e9cf254fa 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx @@ -8,9 +8,9 @@ import React from 'react'; import { useRequest } from '../../../../hooks'; -import { GetAgentStatusResponse } from '../../../../types'; +import type { GetAgentStatusResponse } from '../../../../types'; import { agentRouteService } from '../../../../services'; -import { UseRequestConfig } from '../../../../hooks/use_request/use_request'; +import type { UseRequestConfig } from '../../../../hooks/use_request/use_request'; type RequestOptions = Pick, 'pollIntervalMs'>; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx index d365d9407ffc0..350d6439c9d3d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx @@ -20,10 +20,10 @@ import { EuiDescriptionListTitle, EuiDescriptionListDescription, } from '@elastic/eui'; -import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; +import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; import styled from 'styled-components'; -import { AgentPolicy, AgentPolicyDetailsDeployAgentAction } from '../../../types'; +import type { AgentPolicy, AgentPolicyDetailsDeployAgentAction } from '../../../types'; import { PAGE_ROUTING_PATHS } from '../../../constants'; import { useGetOneAgentPolicy, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 05ad1848a0bf5..8df8b7ebcd4cf 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -18,7 +18,7 @@ import { EuiSpacer, } from '@elastic/eui'; -import { AgentPolicy, PackageInfo, UpdatePackagePolicy } from '../../../types'; +import type { AgentPolicy, PackageInfo, UpdatePackagePolicy } from '../../../types'; import { useLink, useBreadcrumbs, @@ -33,12 +33,9 @@ import { import { Loading, Error } from '../../../components'; import { ConfirmDeployAgentPolicyModal } from '../components'; import { CreatePackagePolicyPageLayout } from '../create_package_policy_page/components'; -import { - PackagePolicyValidationResults, - validatePackagePolicy, - validationHasErrors, -} from '../create_package_policy_page/services'; -import { +import type { PackagePolicyValidationResults } from '../create_package_policy_page/services'; +import { validatePackagePolicy, validationHasErrors } from '../create_package_policy_page/services'; +import type { PackagePolicyFormState, CreatePackagePolicyFrom, } from '../create_package_policy_page/types'; @@ -46,8 +43,8 @@ import { StepConfigurePackagePolicy } from '../create_package_policy_page/step_c import { StepDefinePackagePolicy } from '../create_package_policy_page/step_define_package_policy'; import { useUIExtension } from '../../../hooks/use_ui_extension'; import { ExtensionWrapper } from '../../../components/extension_wrapper'; -import { GetOnePackagePolicyResponse } from '../../../../../../common/types/rest_spec'; -import { PackagePolicyEditExtensionComponentProps } from '../../../types'; +import type { GetOnePackagePolicyResponse } from '../../../../../../common/types/rest_spec'; +import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; export const EditPackagePolicyPage = memo(() => { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/components/create_agent_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/components/create_agent_policy.tsx index 3e103775ae494..33dbbb25c5d42 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/components/create_agent_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/components/create_agent_policy.tsx @@ -9,6 +9,7 @@ import React, { useState } from 'react'; import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import type { EuiFlyoutProps } from '@elastic/eui'; import { EuiFlyout, EuiFlyoutHeader, @@ -20,12 +21,11 @@ import { EuiButtonEmpty, EuiButton, EuiText, - EuiFlyoutProps, EuiSpacer, } from '@elastic/eui'; import { dataTypes } from '../../../../../../../common'; -import { NewAgentPolicy, AgentPolicy } from '../../../../types'; +import type { NewAgentPolicy, AgentPolicy } from '../../../../types'; import { useCapabilities, useStartServices, sendCreateAgentPolicy } from '../../../../hooks'; import { AgentPolicyForm, agentPolicyFormValidation } from '../../components'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx index 795c1934c3361..55788da05bcea 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx @@ -6,6 +6,7 @@ */ import React, { useCallback, useMemo, useState } from 'react'; +import type { EuiTableActionsColumnType, EuiTableFieldDataColumnType } from '@elastic/eui'; import { EuiSpacer, EuiText, @@ -15,16 +16,14 @@ import { EuiEmptyPrompt, EuiBasicTable, EuiLink, - EuiTableActionsColumnType, - EuiTableFieldDataColumnType, EuiTextColor, } from '@elastic/eui'; -import { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; +import type { CriteriaWithPagination } from '@elastic/eui/src/components/basic_table/basic_table'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, FormattedDate } from '@kbn/i18n/react'; import { useHistory } from 'react-router-dom'; -import { AgentPolicy } from '../../../types'; +import type { AgentPolicy } from '../../../types'; import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '../../../constants'; import { WithHeaderLayout } from '../../../layouts'; import { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx index 887e91e1c375d..e5ad131bd7e05 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx @@ -9,7 +9,7 @@ import React, { memo, useState, useMemo } from 'react'; import { EuiPortal, EuiContextMenuItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Agent } from '../../../../types'; +import type { Agent } from '../../../../types'; import { useCapabilities, useKibanaVersion } from '../../../../hooks'; import { ContextMenuActions } from '../../../../components'; import { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx index bbd47b9afb8c9..6e0206603a458 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_integrations.tsx @@ -6,6 +6,7 @@ */ import React, { memo, useMemo } from 'react'; +import type { EuiBasicTableProps } from '@elastic/eui'; import { EuiFlexGroup, EuiFlexItem, @@ -16,12 +17,11 @@ import { EuiPanel, EuiButtonIcon, EuiBasicTable, - EuiBasicTableProps, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; -import { Agent, AgentPolicy, PackagePolicy, PackagePolicyInput } from '../../../../../types'; +import type { Agent, AgentPolicy, PackagePolicy, PackagePolicyInput } from '../../../../../types'; import { useLink } from '../../../../../hooks'; import { PackageIcon } from '../../../../../components'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx index 28d7b026eb737..5492d13f8ab93 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx @@ -20,7 +20,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Agent, AgentPolicy } from '../../../../../types'; +import type { Agent, AgentPolicy } from '../../../../../types'; import { useKibanaVersion, useLink } from '../../../../../hooks'; import { isAgentUpgradeable } from '../../../../../services'; import { AgentPolicyPackageBadges } from '../../../components/agent_policy_package_badges'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/index.tsx index 656bb8509aa30..a0afa635beab8 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/index.tsx @@ -10,7 +10,7 @@ import styled from 'styled-components'; import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Agent, AgentPolicy } from '../../../../../types'; +import type { Agent, AgentPolicy } from '../../../../../types'; import { AgentDetailsOverviewSection } from './agent_details_overview'; import { AgentDetailsIntegrationsSection } from './agent_details_integrations'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx index ed2ae773bbb7e..6bc1db2fc4c7d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx @@ -28,9 +28,10 @@ import semverCoerce from 'semver/functions/coerce'; import { createStateContainerReactHelpers } from '../../../../../../../../../../../src/plugins/kibana_utils/public'; import { RedirectAppLinks } from '../../../../../../../../../../../src/plugins/kibana_react/public'; -import { TimeRange, esKuery } from '../../../../../../../../../../../src/plugins/data/public'; +import type { TimeRange } from '../../../../../../../../../../../src/plugins/data/public'; +import { esKuery } from '../../../../../../../../../../../src/plugins/data/public'; import { LogStream } from '../../../../../../../../../infra/public'; -import { Agent } from '../../../../../types'; +import type { Agent } from '../../../../../types'; import { useStartServices } from '../../../../../hooks'; import { DEFAULT_DATE_RANGE } from './constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx index fc277de634ba8..f4c6e19f09322 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { AgentLogsState } from './agent_logs'; +import type { AgentLogsState } from './agent_logs'; export const AGENT_LOG_INDEX_PATTERN = 'logs-elastic_agent-*,logs-elastic_agent.*-*'; export const AGENT_DATASET = 'elastic_agent'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/index.tsx index 7e37e5fb49cb3..ff31ffef03925 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/index.tsx @@ -7,17 +7,20 @@ import React, { memo, useEffect, useState, useMemo } from 'react'; +import type { + INullableBaseStateContainer, + PureTransition, +} from '../../../../../../../../../../../src/plugins/kibana_utils/public'; import { createStateContainer, syncState, createKbnUrlStateStorage, - INullableBaseStateContainer, - PureTransition, getStateFromKbnUrl, } from '../../../../../../../../../../../src/plugins/kibana_utils/public'; import { DEFAULT_LOGS_STATE, STATE_STORAGE_KEY } from './constants'; -import { AgentLogsUI, AgentLogsProps, AgentLogsState, AgentLogsUrlStateHelper } from './agent_logs'; +import type { AgentLogsProps, AgentLogsState } from './agent_logs'; +import { AgentLogsUI, AgentLogsUrlStateHelper } from './agent_logs'; export const AgentLogs: React.FunctionComponent> = memo( ({ agent }) => { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/query_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/query_bar.tsx index 776c866e22f4b..a05068534ab88 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/query_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/query_bar.tsx @@ -8,10 +8,8 @@ import React, { memo, useState, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; -import { - QueryStringInput, - IFieldType, -} from '../../../../../../../../../../../src/plugins/data/public'; +import type { IFieldType } from '../../../../../../../../../../../src/plugins/data/public'; +import { QueryStringInput } from '../../../../../../../../../../../src/plugins/data/public'; import { useStartServices } from '../../../../../hooks'; import { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/select_log_level.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/select_log_level.tsx index d4ea76605b777..5aadecf2ed27c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/select_log_level.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/select_log_level.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiSelect, EuiFormLabel, EuiButtonEmpty, EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; -import { Agent } from '../../../../../types'; +import type { Agent } from '../../../../../types'; import { sendPostAgentAction, useStartServices } from '../../../../../hooks'; import { AGENT_LOG_LEVELS, DEFAULT_LOG_LEVEL } from './constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx index dc1e25401bf18..adeb56f489ea3 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx @@ -17,12 +17,12 @@ import { EuiDescriptionListTitle, EuiDescriptionListDescription, } from '@elastic/eui'; -import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; +import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { EuiIconTip } from '@elastic/eui'; -import { Agent, AgentPolicy, AgentDetailsReassignPolicyAction } from '../../../types'; +import type { Agent, AgentPolicy, AgentDetailsReassignPolicyAction } from '../../../types'; import { PAGE_ROUTING_PATHS } from '../../../constants'; import { Loading, Error } from '../../../components'; import { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx index 1fe611dd97fcf..c859d585f4d82 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx @@ -20,7 +20,7 @@ import { import { FormattedMessage, FormattedNumber } from '@kbn/i18n/react'; import { SO_SEARCH_LIMIT } from '../../../../constants'; -import { Agent } from '../../../../types'; +import type { Agent } from '../../../../types'; import { AgentReassignAgentPolicyFlyout, AgentUnenrollAgentModal, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx index aface1fc9ac4b..1beaf437ceb0e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx @@ -17,7 +17,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../../types'; +import type { AgentPolicy } from '../../../../types'; import { SearchBar } from '../../../../components'; import { AGENTS_INDEX } from '../../../../constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_badges.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_badges.tsx index 755d895d3b768..35f13dc90e6e6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_badges.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_badges.tsx @@ -13,7 +13,7 @@ import { getColorForAgentStatus, getLabelForAgentStatus, } from '../../services/agent_status'; -import { SimplifiedAgentStatus } from '../../../../types'; +import type { SimplifiedAgentStatus } from '../../../../types'; export const AgentStatusBadges: React.FC<{ showInactive?: boolean; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_bar.tsx index 64bf580f15b5a..728134768b799 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/status_bar.tsx @@ -10,7 +10,7 @@ import { EuiColorPaletteDisplay } from '@elastic/eui'; import React, { useMemo } from 'react'; import { AGENT_STATUSES, getColorForAgentStatus } from '../../services/agent_status'; -import { SimplifiedAgentStatus } from '../../../../types'; +import type { SimplifiedAgentStatus } from '../../../../types'; const StyledEuiColorPaletteDisplay = styled(EuiColorPaletteDisplay)` &.ingest-agent-status-bar { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx index 9d3fb45ff2ff8..ff809d360e744 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/table_header.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { Agent, SimplifiedAgentStatus } from '../../../../types'; +import type { Agent, SimplifiedAgentStatus } from '../../../../types'; import { AgentStatusBar } from './status_bar'; import { AgentBulkActions } from './bulk_actions'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index a66105a15f17c..faf5da5f17f6b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; import { AgentEnrollmentFlyout } from '../components'; -import { Agent, AgentPolicy, SimplifiedAgentStatus } from '../../../types'; +import type { Agent, AgentPolicy, SimplifiedAgentStatus } from '../../../types'; import { usePagination, useCapabilities, @@ -48,7 +48,7 @@ import { } from '../components'; import { AgentTableHeader } from './components/table_header'; -import { SelectionMode } from './components/bulk_actions'; +import type { SelectionMode } from './components/bulk_actions'; import { SearchAndFilterBar } from './components/search_and_filter_bar'; const REFRESH_INTERVAL_MS = 30000; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/agent_policy_selection.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/agent_policy_selection.tsx index 09d66b9b7cfad..8d639b48681e3 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/agent_policy_selection.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/agent_policy_selection.tsx @@ -11,7 +11,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiSelect, EuiSpacer, EuiText, EuiButtonEmpty } from '@elastic/eui'; import { SO_SEARCH_LIMIT } from '../../../../constants'; -import { AgentPolicy, GetEnrollmentAPIKeysResponse } from '../../../../types'; +import type { AgentPolicy, GetEnrollmentAPIKeysResponse } from '../../../../types'; import { sendGetEnrollmentAPIKeys, useStartServices } from '../../../../hooks'; import { AgentPolicyPackageBadges } from '../agent_policy_package_badges'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx index e013e35488161..fadb7ab425ceb 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx @@ -23,7 +23,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../../types'; +import type { AgentPolicy } from '../../../../types'; import { ManagedInstructions } from './managed_instructions'; import { StandaloneInstructions } from './standalone_instructions'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx index 5a22a47c2593c..4925f60f19e26 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx @@ -7,11 +7,11 @@ import React, { useState } from 'react'; import { EuiSteps, EuiLink, EuiText, EuiSpacer } from '@elastic/eui'; -import { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; +import type { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../../types'; +import type { AgentPolicy } from '../../../../types'; import { useGetOneEnrollmentAPIKey, useStartServices, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/standalone_instructions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/standalone_instructions.tsx index 6e4f4168a64c5..7ccdfe05724f1 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/standalone_instructions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/standalone_instructions.tsx @@ -18,11 +18,11 @@ import { EuiCopy, EuiLink, } from '@elastic/eui'; -import { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; +import type { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../../types'; +import type { AgentPolicy } from '../../../../types'; import { useStartServices, useLink, sendGetOneAgentPolicyFull } from '../../../../hooks'; import { fullAgentPolicyToYaml, agentPolicyRouteService } from '../../../../services'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx index 8ea2259ca80c3..1d5e8cbfc5cd6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx @@ -10,7 +10,7 @@ import { EuiText, EuiButton, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { AgentPolicy } from '../../../../types'; +import type { AgentPolicy } from '../../../../types'; import { EnrollmentStepAgentPolicy } from './agent_policy_selection'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx index 26ad0550ae71f..eb693775a65c9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; import { EuiBadge, EuiToolTip } from '@elastic/eui'; -import { Agent } from '../../../types'; +import type { Agent } from '../../../types'; interface Props { agent: Agent; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx index e7868e4b6fe10..dcc87b0032d77 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx @@ -9,7 +9,7 @@ import React, { useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiSpacer, EuiText, EuiFlexGroup, EuiFlexItem, EuiBadge } from '@elastic/eui'; -import { PackagePolicy, PackagePolicyPackage } from '../../../types'; +import type { PackagePolicy, PackagePolicyPackage } from '../../../types'; import { useGetOneAgentPolicy } from '../../../hooks'; import { PackageIcon } from '../../../components/package_icon'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx index 265adc29164c5..a23b27cf888d6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx @@ -24,7 +24,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Agent } from '../../../../types'; +import type { Agent } from '../../../../types'; import { sendPutAgentReassign, sendPostBulkAgentReassign, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx index fe550123fec2a..696acb49abef3 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { EuiConfirmModal, EuiFormFieldset, EuiCheckbox } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Agent } from '../../../../types'; +import type { Agent } from '../../../../types'; import { sendPostAgentUnenroll, sendPostBulkAgentUnenroll, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_upgrade_modal/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_upgrade_modal/index.tsx index 90c291f249ef5..e8a4049d129c1 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_upgrade_modal/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_upgrade_modal/index.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { EuiConfirmModal, EuiBetaBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Agent } from '../../../../types'; +import type { Agent } from '../../../../types'; import { sendPostAgentUpgrade, sendPostBulkAgentUpgrade, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx index 6c79ab6657fa7..f31ee70da21bb 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiText, EuiFlexGroup, EuiFlexItem, EuiButton, EuiPortal } from '@elastic/eui'; -import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; +import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; import { useRouteMatch } from 'react-router-dom'; import { PAGE_ROUTING_PATHS } from '../../../constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx index 41dab3d6479e0..a7dd7d4938669 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiConfirmModal, EuiCallOut } from '@elastic/eui'; -import { EnrollmentAPIKey } from '../../../../types'; +import type { EnrollmentAPIKey } from '../../../../types'; interface Props { onCancel: () => void; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/new_enrollment_key_flyout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/new_enrollment_key_flyout.tsx index 9644845ca4ff5..a21e59c5c220f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/new_enrollment_key_flyout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/new_enrollment_key_flyout.tsx @@ -24,7 +24,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { AgentPolicy } from '../../../../types'; +import type { AgentPolicy } from '../../../../types'; import { useInput, useStartServices, sendRequest } from '../../../../hooks'; import { enrollmentAPIKeyRouteService } from '../../../../services'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/index.tsx index d7c66139ac77b..a19cf714135fc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/index.tsx @@ -7,6 +7,7 @@ import { i18n } from '@kbn/i18n'; import React, { useState } from 'react'; +import type { HorizontalAlignment } from '@elastic/eui'; import { EuiSpacer, EuiBasicTable, @@ -17,7 +18,6 @@ import { EuiToolTip, EuiIcon, EuiText, - HorizontalAlignment, } from '@elastic/eui'; import { FormattedMessage, FormattedDate } from '@kbn/i18n/react'; @@ -31,7 +31,7 @@ import { useStartServices, sendDeleteOneEnrollmentAPIKey, } from '../../../hooks'; -import { EnrollmentAPIKey } from '../../../types'; +import type { EnrollmentAPIKey } from '../../../types'; import { SearchBar } from '../../../components/search_bar'; import { NewEnrollmentTokenFlyout } from './components/new_enrollment_key_flyout'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/services/agent_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/services/agent_status.tsx index 301dd565f94c3..02b3a941437ec 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/services/agent_status.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/services/agent_status.tsx @@ -8,7 +8,7 @@ import { euiPaletteColorBlindBehindText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { SimplifiedAgentStatus } from '../../../types'; +import type { SimplifiedAgentStatus } from '../../../types'; const visColors = euiPaletteColorBlindBehindText(); const colorToHexMap = { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/setup_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/setup_page/index.tsx index 860e081748f56..0fe75dd3a8bfc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/setup_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/setup_page/index.tsx @@ -27,7 +27,7 @@ import { import { useStartServices, sendPostFleetSetup } from '../../../hooks'; import { WithoutHeaderLayout } from '../../../layouts'; -import { GetFleetStatusResponse } from '../../../types'; +import type { GetFleetStatusResponse } from '../../../types'; export const RequirementItem: React.FunctionComponent<{ isMissing: boolean }> = ({ isMissing, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/components/data_stream_row_actions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/components/data_stream_row_actions.tsx index 0516a0a8829af..4dedfc1bfdb4e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/components/data_stream_row_actions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/components/data_stream_row_actions.tsx @@ -9,7 +9,7 @@ import React, { memo } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { DataStream } from '../../../../types'; +import type { DataStream } from '../../../../types'; import { useKibanaLink } from '../../../../hooks'; import { ContextMenuActions } from '../../../../components'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx index dd525dcaf795b..f8518dc2a8668 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx @@ -6,6 +6,7 @@ */ import React, { useMemo } from 'react'; +import type { EuiTableActionsColumnType, EuiTableFieldDataColumnType } from '@elastic/eui'; import { EuiBadge, EuiButton, @@ -14,13 +15,11 @@ import { EuiFlexItem, EuiEmptyPrompt, EuiInMemoryTable, - EuiTableActionsColumnType, - EuiTableFieldDataColumnType, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, FormattedDate } from '@kbn/i18n/react'; -import { DataStream } from '../../../types'; +import type { DataStream } from '../../../types'; import { WithHeaderLayout } from '../../../layouts'; import { useGetDataStreams, useStartServices, usePagination, useBreadcrumbs } from '../../../hooks'; import { PackageIcon } from '../../../components/package_icon'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/assets_facet_group.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/assets_facet_group.tsx index a88c6ceaea0c4..2380a1fb87756 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/assets_facet_group.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/assets_facet_group.tsx @@ -19,12 +19,12 @@ import { import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n/react'; -import { +import type { AssetsGroupedByServiceByType, AssetTypeToParts, KibanaAssetType, - entries, } from '../../../types'; +import { entries } from '../../../types'; import { AssetIcons, AssetTitleMap, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icon_panel.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icon_panel.tsx index 9574ecbcf4e0c..63c6897021f4e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icon_panel.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icon_panel.tsx @@ -9,7 +9,8 @@ import React from 'react'; import styled from 'styled-components'; import { EuiIcon, EuiPanel } from '@elastic/eui'; -import { usePackageIconType, UsePackageIconType } from '../../../hooks'; +import type { UsePackageIconType } from '../../../hooks'; +import { usePackageIconType } from '../../../hooks'; import { Loading } from '../../../components'; const PanelWrapper = styled.div` diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icons.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icons.tsx index d7ad6667b6db0..86346fc2988dd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icons.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icons.tsx @@ -6,7 +6,8 @@ */ import React from 'react'; -import { EuiIconTip, EuiIconProps } from '@elastic/eui'; +import type { EuiIconProps } from '@elastic/eui'; +import { EuiIconTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; export const UpdateIcon = ({ size = 'm' }: { size?: EuiIconProps['size'] }) => ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx index 43985a9d8efa4..b4592a2283d6d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx @@ -9,7 +9,7 @@ import React from 'react'; import styled from 'styled-components'; import { EuiCard } from '@elastic/eui'; -import { PackageInfo, PackageListItem } from '../../../types'; +import type { PackageInfo, PackageListItem } from '../../../types'; import { useLink } from '../../../hooks'; import { PackageIcon } from '../../../components/package_icon'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx index da8f2c690a010..9ce223ea8e456 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx @@ -5,7 +5,9 @@ * 2.0. */ -import React, { Fragment, ReactNode, useState } from 'react'; +import type { ReactNode } from 'react'; +import React, { Fragment, useState } from 'react'; +import type { Query } from '@elastic/eui'; import { EuiFlexGrid, EuiFlexGroup, @@ -15,13 +17,12 @@ import { // @ts-ignore EuiSearchBar, EuiText, - Query, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { Loading } from '../../../components'; -import { PackageList } from '../../../types'; +import type { PackageList } from '../../../types'; import { useLocalSearch, searchIdField } from '../hooks'; import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/requirements.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/requirements.tsx index 3cb0f1e061fa3..040d930e88a71 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/requirements.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/requirements.tsx @@ -9,7 +9,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText, EuiTextColor, EuiTitle } f import React, { Fragment } from 'react'; import styled from 'styled-components'; -import { RequirementsByServiceName, ServiceName, entries } from '../../../types'; +import type { RequirementsByServiceName, ServiceName } from '../../../types'; +import { entries } from '../../../types'; import { ServiceTitleMap } from '../constants'; import { Version } from './version'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/version.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/version.tsx index cde8f1ebebfb5..231ba2ef40b5a 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/version.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/version.tsx @@ -8,7 +8,7 @@ import React from 'react'; import styled from 'styled-components'; -import { RequirementVersion } from '../../../types'; +import type { RequirementVersion } from '../../../types'; const CodeText = styled.span` font-family: ${(props) => props.theme.eui.euiCodeFontFamily}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx index a50c35765e661..de7e16e1e5d2b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx @@ -5,9 +5,10 @@ * 2.0. */ -import { IconType } from '@elastic/eui'; +import type { IconType } from '@elastic/eui'; -import { AssetType, ElasticsearchAssetType, KibanaAssetType, ServiceName } from '../../types'; +import type { AssetType, ServiceName } from '../../types'; +import { ElasticsearchAssetType, KibanaAssetType } from '../../types'; // only allow Kibana assets for the kibana key, ES asssets for elasticsearch, etc type ServiceNameToAssetTypes = Record, KibanaAssetType[]> & diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx index 784b7923c2d6d..08bc53e4eea7f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx @@ -8,7 +8,11 @@ import { useStartServices } from '../../../hooks/use_core'; import { PLUGIN_ID } from '../../../constants'; import { epmRouteService } from '../../../services'; -import { PackageSpecIcon, PackageSpecScreenshot, RegistryImage } from '../../../../../../common'; +import type { + PackageSpecIcon, + PackageSpecScreenshot, + RegistryImage, +} from '../../../../../../common'; const removeRelativePath = (relativePath: string): string => new URL(relativePath, 'http://example.com').pathname; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_local_search.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_local_search.tsx index 9c4839ff859f0..efdc2f3884542 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_local_search.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_local_search.tsx @@ -8,7 +8,7 @@ import { Search as LocalSearch } from 'js-search'; import { useEffect, useRef } from 'react'; -import { PackageList, PackageListItem } from '../../../types'; +import type { PackageList, PackageListItem } from '../../../types'; export type SearchField = keyof PackageListItem; export const searchIdField: SearchField = 'name'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx index b5412ce5b57ea..4f8242fe42613 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx @@ -9,10 +9,10 @@ import createContainer from 'constate'; import React, { useCallback, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { FormattedMessage } from '@kbn/i18n/react'; -import { NotificationsStart } from 'src/core/public'; +import type { NotificationsStart } from 'src/core/public'; import { toMountPoint } from '../../../../../../../../../src/plugins/kibana_react/public'; -import { PackageInfo } from '../../../types'; +import type { PackageInfo } from '../../../types'; import { sendInstallPackage, sendRemovePackage, useLink } from '../../../hooks'; import { InstallStatus } from '../../../types'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/icon_panel.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/icon_panel.tsx index 74d2b2fbc680f..6d5d52789a975 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/icon_panel.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/icon_panel.tsx @@ -9,7 +9,8 @@ import React from 'react'; import styled from 'styled-components'; import { EuiIcon, EuiPanel } from '@elastic/eui'; -import { usePackageIconType, UsePackageIconType } from '../../../../../hooks'; +import type { UsePackageIconType } from '../../../../../hooks'; +import { usePackageIconType } from '../../../../../hooks'; import { Loading } from '../../../../../components'; const PanelWrapper = styled.div` diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/update_icon.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/update_icon.tsx index d7ad6667b6db0..86346fc2988dd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/update_icon.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/update_icon.tsx @@ -6,7 +6,8 @@ */ import React from 'react'; -import { EuiIconTip, EuiIconProps } from '@elastic/eui'; +import type { EuiIconProps } from '@elastic/eui'; +import { EuiIconTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; export const UpdateIcon = ({ size = 'm' }: { size?: EuiIconProps['size'] }) => ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx index 3ea41436c22d8..6f76acbe187c6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx @@ -10,7 +10,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { useUIExtension } from '../../../../../hooks/use_ui_extension'; import { useLink } from '../../../../../hooks'; -import { PackageInfo } from '../../../../../types'; +import type { PackageInfo } from '../../../../../types'; import { pkgKeyFromPackageInfo } from '../../../../../services/pkg_key_from_package_info'; import { ExtensionWrapper } from '../../../../../components/extension_wrapper'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx index e17e9bdfe2ef2..a8e9ddf1c8f78 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx @@ -10,21 +10,25 @@ import { Route } from 'react-router-dom'; import { act, cleanup } from '@testing-library/react'; import { PAGE_ROUTING_PATHS, pagePathGetters } from '../../../../constants'; -import { +import type { GetAgentPoliciesResponse, GetFleetStatusResponse, GetInfoResponse, GetPackagePoliciesResponse, GetStatsResponse, } from '../../../../../../../common/types/rest_spec'; -import { DetailViewPanelName, KibanaAssetType } from '../../../../../../../common/types/models'; +import type { + DetailViewPanelName, + KibanaAssetType, +} from '../../../../../../../common/types/models'; import { agentPolicyRouteService, epmRouteService, fleetSetupRouteService, packagePolicyRouteService, } from '../../../../../../../common/services'; -import { createTestRendererMock, MockedFleetStartServices, TestRenderer } from '../../../../mock'; +import type { MockedFleetStartServices, TestRenderer } from '../../../../mock'; +import { createTestRendererMock } from '../../../../mock'; import { Detail } from './index'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx index 49e63ba6e935b..a4f465cd3d619 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx @@ -4,7 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import React, { ReactEventHandler, useCallback, useEffect, useMemo, useState } from 'react'; +import type { ReactEventHandler } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { Redirect, Route, Switch, useHistory, useLocation, useParams } from 'react-router-dom'; import styled from 'styled-components'; import { @@ -27,15 +28,16 @@ import { useUIExtension } from '../../../../hooks/use_ui_extension'; import { PAGE_ROUTING_PATHS, PLUGIN_ID } from '../../../../constants'; import { useCapabilities, useGetPackageInfoByKey, useLink } from '../../../../hooks'; import { pkgKeyFromPackageInfo } from '../../../../services/pkg_key_from_package_info'; -import { +import type { CreatePackagePolicyRouteState, DetailViewPanelName, - InstallStatus, PackageInfo, } from '../../../../types'; +import { InstallStatus } from '../../../../types'; import { Error, Loading } from '../../../../components'; import { useBreadcrumbs } from '../../../../hooks'; -import { WithHeaderLayout, WithHeaderLayoutProps } from '../../../../layouts'; +import type { WithHeaderLayoutProps } from '../../../../layouts'; +import { WithHeaderLayout } from '../../../../layouts'; import { RELEASE_BADGE_DESCRIPTION, RELEASE_BADGE_LABEL } from '../../components/release_badge'; import { useGetPackageInstallStatus, useSetPackageInstallStatus } from '../../hooks'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/details.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/details.tsx index 3d6573feab459..487df17980345 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/details.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/details.tsx @@ -14,15 +14,15 @@ import { EuiDescriptionList, EuiNotificationBadge, } from '@elastic/eui'; -import { EuiDescriptionListProps } from '@elastic/eui/src/components/description_list/description_list'; +import type { EuiDescriptionListProps } from '@elastic/eui/src/components/description_list/description_list'; -import { +import type { PackageInfo, PackageSpecCategory, AssetTypeToParts, KibanaAssetType, - entries, } from '../../../../../types'; +import { entries } from '../../../../../types'; import { useGetCategories } from '../../../../../hooks'; import { AssetTitleMap, DisplayedAssets, ServiceTitleMap } from '../../../constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/overview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/overview.tsx index da8a5133d77e6..bd6bece14f3e3 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/overview.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/overview.tsx @@ -8,7 +8,7 @@ import React, { memo } from 'react'; import styled from 'styled-components'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { PackageInfo } from '../../../../../types'; +import type { PackageInfo } from '../../../../../types'; import { Screenshots } from './screenshots'; import { Readme } from './readme'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx index 4a278967229ad..6df3a082ecb93 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiImage, EuiText, EuiPagination } from '@elastic/eui'; -import { ScreenshotItem } from '../../../../../types'; +import type { ScreenshotItem } from '../../../../../types'; import { useLinks } from '../../../hooks'; interface ScreenshotProps { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx index a573cd49e61ce..94b4b748cb1bd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx @@ -5,30 +5,24 @@ * 2.0. */ -import React, { memo, ReactNode, useCallback, useMemo } from 'react'; +import type { ReactNode } from 'react'; +import React, { memo, useCallback, useMemo } from 'react'; import { Redirect } from 'react-router-dom'; -import { - CriteriaWithPagination, - EuiBasicTable, - EuiLink, - EuiTableFieldDataColumnType, - EuiFlexGroup, - EuiFlexItem, -} from '@elastic/eui'; +import type { CriteriaWithPagination, EuiTableFieldDataColumnType } from '@elastic/eui'; +import { EuiBasicTable, EuiLink, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedRelative, FormattedMessage } from '@kbn/i18n/react'; import { InstallStatus } from '../../../../../types'; import { useLink, useUrlPagination } from '../../../../../hooks'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; -import { LinkAndRevision, LinkAndRevisionProps } from '../../../../../components'; +import type { LinkAndRevisionProps } from '../../../../../components'; +import { LinkAndRevision } from '../../../../../components'; import { LinkedAgentCount } from '../../../../../components/linked_agent_count'; import { useGetPackageInstallStatus } from '../../../hooks'; -import { - PackagePolicyAndAgentPolicy, - usePackagePoliciesWithAgentPolicy, -} from './use_package_policies_with_agent_policy'; +import type { PackagePolicyAndAgentPolicy } from './use_package_policies_with_agent_policy'; +import { usePackagePoliciesWithAgentPolicy } from './use_package_policies_with_agent_policy'; import { Persona } from './persona'; const IntegrationDetailsLink = memo<{ diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/persona.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/persona.tsx index 02e36df57009e..100945327e824 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/persona.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/persona.tsx @@ -4,9 +4,10 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import React, { CSSProperties, memo, useCallback } from 'react'; +import type { CSSProperties } from 'react'; +import React, { memo, useCallback } from 'react'; import { EuiAvatar, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; -import { EuiAvatarProps } from '@elastic/eui/src/components/avatar/avatar'; +import type { EuiAvatarProps } from '@elastic/eui/src/components/avatar/avatar'; const MIN_WIDTH: CSSProperties = { minWidth: 0 }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx index dd71d4090c86b..5edb695188a2d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx @@ -9,7 +9,8 @@ import { EuiButton } from '@elastic/eui'; import React, { Fragment, useCallback, useMemo, useState } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { PackageInfo, InstallStatus } from '../../../../../types'; +import type { PackageInfo } from '../../../../../types'; +import { InstallStatus } from '../../../../../types'; import { useCapabilities } from '../../../../../hooks'; import { useUninstallPackage, useGetPackageInstallStatus, useInstallPackage } from '../../../hooks'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx index 94c03f76cddaf..55ef530d36bba 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx @@ -12,7 +12,8 @@ import semverLt from 'semver/functions/lt'; import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiText, EuiSpacer } from '@elastic/eui'; -import { InstallStatus, PackageInfo } from '../../../../../types'; +import type { PackageInfo } from '../../../../../types'; +import { InstallStatus } from '../../../../../types'; import { useGetPackagePolicies } from '../../../../../hooks'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; import { useGetPackageInstallStatus } from '../../../hooks'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/category_facets.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/category_facets.tsx index 6a754ca86d7aa..e4d81f1d04118 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/category_facets.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/category_facets.tsx @@ -9,7 +9,7 @@ import { EuiFacetButton, EuiFacetGroup } from '@elastic/eui'; import React from 'react'; import { Loading } from '../../../../components'; -import { CategorySummaryItem, CategorySummaryList } from '../../../../types'; +import type { CategorySummaryItem, CategorySummaryList } from '../../../../types'; export function CategoryFacets({ isLoading, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx index 8f43adef71b10..e1aafde8772e1 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx @@ -7,14 +7,14 @@ import React, { useState } from 'react'; import { useRouteMatch, Switch, Route, useLocation, useHistory } from 'react-router-dom'; -import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; +import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; import { i18n } from '@kbn/i18n'; import { installationStatuses } from '../../../../../../../common/constants'; import { PAGE_ROUTING_PATHS } from '../../../../constants'; import { useLink, useGetCategories, useGetPackages, useBreadcrumbs } from '../../../../hooks'; import { WithHeaderLayout } from '../../../../layouts'; -import { CategorySummaryItem } from '../../../../types'; +import type { CategorySummaryItem } from '../../../../types'; import { PackageListGrid } from '../../components/package_list_grid'; import { CategoryFacets } from './category_facets'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/agent_policy_section.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/agent_policy_section.tsx index 9c3c76efddc1a..79a4f08faa752 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/agent_policy_section.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/agent_policy_section.tsx @@ -17,7 +17,7 @@ import { import { SO_SEARCH_LIMIT } from '../../../constants'; import { useLink, useGetPackagePolicies } from '../../../hooks'; -import { AgentPolicy } from '../../../types'; +import type { AgentPolicy } from '../../../types'; import { Loading } from '../../agents/components'; import { OverviewStats } from './overview_stats'; diff --git a/x-pack/plugins/fleet/scripts/dev_agent/script.ts b/x-pack/plugins/fleet/scripts/dev_agent/script.ts index e937706080218..b4bdea0c28996 100644 --- a/x-pack/plugins/fleet/scripts/dev_agent/script.ts +++ b/x-pack/plugins/fleet/scripts/dev_agent/script.ts @@ -7,7 +7,8 @@ import os from 'os'; -import { createFlagError, run, ToolingLog } from '@kbn/dev-utils'; +import type { ToolingLog } from '@kbn/dev-utils'; +import { createFlagError, run } from '@kbn/dev-utils'; import fetch from 'node-fetch'; import type { diff --git a/x-pack/plugins/fleet/server/collectors/agent_collectors.ts b/x-pack/plugins/fleet/server/collectors/agent_collectors.ts index 19be9a010889a..de16f6555d4bd 100644 --- a/x-pack/plugins/fleet/server/collectors/agent_collectors.ts +++ b/x-pack/plugins/fleet/server/collectors/agent_collectors.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectsClient } from 'kibana/server'; +import type { SavedObjectsClient } from 'kibana/server'; import type { ElasticsearchClient } from 'kibana/server'; -import { FleetConfigType } from '../../common/types'; +import type { FleetConfigType } from '../../common/types'; import * as AgentService from '../services/agents'; import { isFleetServerSetup } from '../services/fleet_server'; diff --git a/x-pack/plugins/fleet/server/collectors/package_collectors.ts b/x-pack/plugins/fleet/server/collectors/package_collectors.ts index 20370231c7919..01d1c2d966c78 100644 --- a/x-pack/plugins/fleet/server/collectors/package_collectors.ts +++ b/x-pack/plugins/fleet/server/collectors/package_collectors.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SavedObjectsClient } from 'kibana/server'; +import type { SavedObjectsClient } from 'kibana/server'; import _ from 'lodash'; import { getPackageSavedObjects } from '../services/epm/packages/get'; diff --git a/x-pack/plugins/fleet/server/errors/handlers.ts b/x-pack/plugins/fleet/server/errors/handlers.ts index 421f986ee8848..073727729ad84 100644 --- a/x-pack/plugins/fleet/server/errors/handlers.ts +++ b/x-pack/plugins/fleet/server/errors/handlers.ts @@ -5,14 +5,16 @@ * 2.0. */ -import Boom, { isBoom } from '@hapi/boom'; +import type Boom from '@hapi/boom'; +import { isBoom } from '@hapi/boom'; +import { errors as LegacyESErrors } from 'elasticsearch'; + import type { IKibanaResponse, KibanaResponseFactory, RequestHandlerContext, } from 'src/core/server'; -import { KibanaRequest } from 'src/core/server'; -import { errors as LegacyESErrors } from 'elasticsearch'; +import type { KibanaRequest } from 'src/core/server'; import { appContextService } from '../services'; diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index cd7afc63ab2ed..3289a762e57cb 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { Observable } from 'rxjs'; +import type { Observable } from 'rxjs'; import { first } from 'rxjs/operators'; -import { +import type { CoreSetup, CoreStart, ElasticsearchServiceStart, @@ -20,23 +20,23 @@ import { RequestHandlerContext, KibanaRequest, } from 'kibana/server'; -import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; +import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; -import { LicensingPluginSetup, ILicense } from '../../licensing/server'; -import { +import type { LicensingPluginSetup, ILicense } from '../../licensing/server'; +import type { EncryptedSavedObjectsPluginStart, EncryptedSavedObjectsPluginSetup, } from '../../encrypted_saved_objects/server'; -import { SecurityPluginSetup, SecurityPluginStart } from '../../security/server'; -import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; -import { +import type { SecurityPluginSetup, SecurityPluginStart } from '../../security/server'; +import type { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; +import type { EsAssetReference, FleetConfigType, NewPackagePolicy, UpdatePackagePolicy, } from '../common'; -import { CloudSetup } from '../../cloud/server'; +import type { CloudSetup } from '../../cloud/server'; import { PLUGIN_ID, @@ -64,16 +64,18 @@ import { registerSettingsRoutes, registerAppRoutes, } from './routes'; +import type { + ESIndexPatternService, + AgentService, + AgentPolicyServiceInterface, + PackageService, +} from './services'; import { appContextService, licenseService, ESIndexPatternSavedObjectService, - ESIndexPatternService, - AgentService, - AgentPolicyServiceInterface, agentPolicyService, packagePolicyService, - PackageService, } from './services'; import { getAgentStatusById, diff --git a/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts b/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts index f7cc750ff1e6f..f1e32f325dd0c 100644 --- a/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/actions_handlers.ts @@ -10,7 +10,7 @@ import type { RequestHandler } from 'kibana/server'; import type { TypeOf } from '@kbn/config-schema'; -import { PostNewAgentActionRequestSchema } from '../../types/rest_spec'; +import type { PostNewAgentActionRequestSchema } from '../../types/rest_spec'; import type { ActionsService } from '../../services/agents'; import type { PostNewAgentActionResponse } from '../../../common/types/rest_spec'; import { defaultIngestErrorHandler } from '../../errors'; diff --git a/x-pack/plugins/fleet/server/routes/agent/handlers.ts b/x-pack/plugins/fleet/server/routes/agent/handlers.ts index a949ea5c681b1..3745304334719 100644 --- a/x-pack/plugins/fleet/server/routes/agent/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/handlers.ts @@ -20,7 +20,7 @@ import type { PostAgentEnrollRequest, PostBulkAgentReassignResponse, } from '../../../common/types'; -import { +import type { GetAgentsRequestSchema, GetOneAgentRequestSchema, UpdateAgentRequestSchema, diff --git a/x-pack/plugins/fleet/server/routes/agent/index.ts b/x-pack/plugins/fleet/server/routes/agent/index.ts index 58bbde95b918b..6236808a5378e 100644 --- a/x-pack/plugins/fleet/server/routes/agent/index.ts +++ b/x-pack/plugins/fleet/server/routes/agent/index.ts @@ -37,7 +37,7 @@ import { } from '../../types'; import * as AgentService from '../../services/agents'; import { appContextService } from '../../services'; -import { FleetConfigType } from '../..'; +import type { FleetConfigType } from '../..'; import { getAgentsHandler, diff --git a/x-pack/plugins/fleet/server/routes/agent/unenroll_handler.ts b/x-pack/plugins/fleet/server/routes/agent/unenroll_handler.ts index 079783cef6d8b..245ef4afdeb11 100644 --- a/x-pack/plugins/fleet/server/routes/agent/unenroll_handler.ts +++ b/x-pack/plugins/fleet/server/routes/agent/unenroll_handler.ts @@ -12,7 +12,10 @@ import type { PostAgentUnenrollResponse, PostBulkAgentUnenrollResponse, } from '../../../common/types'; -import { PostAgentUnenrollRequestSchema, PostBulkAgentUnenrollRequestSchema } from '../../types'; +import type { + PostAgentUnenrollRequestSchema, + PostBulkAgentUnenrollRequestSchema, +} from '../../types'; import { licenseService } from '../../services'; import * as AgentService from '../../services/agents'; import { defaultIngestErrorHandler } from '../../errors'; diff --git a/x-pack/plugins/fleet/server/routes/agent/upgrade_handler.ts b/x-pack/plugins/fleet/server/routes/agent/upgrade_handler.ts index 5459ec32b94f3..f3267c95b0181 100644 --- a/x-pack/plugins/fleet/server/routes/agent/upgrade_handler.ts +++ b/x-pack/plugins/fleet/server/routes/agent/upgrade_handler.ts @@ -10,7 +10,7 @@ import type { TypeOf } from '@kbn/config-schema'; import semverCoerce from 'semver/functions/coerce'; import type { PostAgentUpgradeResponse, PostBulkAgentUpgradeResponse } from '../../../common/types'; -import { PostAgentUpgradeRequestSchema, PostBulkAgentUpgradeRequestSchema } from '../../types'; +import type { PostAgentUpgradeRequestSchema, PostBulkAgentUpgradeRequestSchema } from '../../types'; import * as AgentService from '../../services/agents'; import { appContextService } from '../../services'; import { defaultIngestErrorHandler } from '../../errors'; diff --git a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts index 0496c8c5b0b8f..e68b5ce66c4a9 100644 --- a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts @@ -13,7 +13,7 @@ import { fullAgentPolicyToYaml } from '../../../common/services'; import { appContextService, agentPolicyService, packagePolicyService } from '../../services'; import { listAgents } from '../../services/agents'; import { AGENT_SAVED_OBJECT_TYPE } from '../../constants'; -import { +import type { GetAgentPoliciesRequestSchema, GetOneAgentPolicyRequestSchema, CreateAgentPolicyRequestSchema, diff --git a/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts b/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts index 2a5fbc1bb6522..c85dc06c38286 100644 --- a/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts +++ b/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts @@ -8,7 +8,7 @@ import type { RequestHandler } from 'src/core/server'; import type { TypeOf } from '@kbn/config-schema'; -import { +import type { GetEnrollmentAPIKeysRequestSchema, PostEnrollmentAPIKeyRequestSchema, DeleteEnrollmentAPIKeyRequestSchema, diff --git a/x-pack/plugins/fleet/server/routes/epm/handlers.ts b/x-pack/plugins/fleet/server/routes/epm/handlers.ts index 7237bdb296cd6..293a3e9e28237 100644 --- a/x-pack/plugins/fleet/server/routes/epm/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/epm/handlers.ts @@ -23,7 +23,7 @@ import type { IBulkInstallPackageHTTPError, GetStatsResponse, } from '../../../common'; -import { +import type { GetCategoriesRequestSchema, GetPackagesRequestSchema, GetFileRequestSchema, @@ -228,9 +228,15 @@ export const installPackageFromRegistryHandler: RequestHandler< const savedObjectsClient = context.core.savedObjects.client; const esClient = context.core.elasticsearch.client.asCurrentUser; const { pkgkey } = request.params; - const { pkgName, pkgVersion } = splitPkgKey(pkgkey); - const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); + + let pkgName: string | undefined; + let pkgVersion: string | undefined; + try { + const parsedPkgKey = splitPkgKey(pkgkey); + pkgName = parsedPkgKey.pkgName; + pkgVersion = parsedPkgKey.pkgVersion; + const res = await installPackage({ installSource: 'registry', savedObjectsClient, @@ -244,14 +250,17 @@ export const installPackageFromRegistryHandler: RequestHandler< return response.ok({ body }); } catch (e) { const defaultResult = await defaultIngestErrorHandler({ error: e, response }); - await handleInstallPackageFailure({ - savedObjectsClient, - error: e, - pkgName, - pkgVersion, - installedPkg, - esClient, - }); + if (pkgName && pkgVersion) { + const installedPkg = await getInstallationObject({ savedObjectsClient, pkgName }); + await handleInstallPackageFailure({ + savedObjectsClient, + error: e, + pkgName, + pkgVersion, + installedPkg, + esClient, + }); + } return defaultResult; } diff --git a/x-pack/plugins/fleet/server/routes/install_script/index.ts b/x-pack/plugins/fleet/server/routes/install_script/index.ts index c3b3541871d03..673fe237700cf 100644 --- a/x-pack/plugins/fleet/server/routes/install_script/index.ts +++ b/x-pack/plugins/fleet/server/routes/install_script/index.ts @@ -7,7 +7,7 @@ import url from 'url'; -import { BasePath, KibanaRequest } from 'src/core/server'; +import type { BasePath, KibanaRequest } from 'src/core/server'; import type { IRouter } from 'src/core/server'; import { INSTALL_SCRIPT_API_ROUTES } from '../../constants'; diff --git a/x-pack/plugins/fleet/server/routes/limited_concurrency.ts b/x-pack/plugins/fleet/server/routes/limited_concurrency.ts index 78bdc4bb7554c..6f9a2bc95ea20 100644 --- a/x-pack/plugins/fleet/server/routes/limited_concurrency.ts +++ b/x-pack/plugins/fleet/server/routes/limited_concurrency.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'kibana/server'; +import type { KibanaRequest } from 'kibana/server'; import type { CoreSetup, LifecycleResponseFactory, diff --git a/x-pack/plugins/fleet/server/routes/output/handler.ts b/x-pack/plugins/fleet/server/routes/output/handler.ts index fe2ee8e9bee18..ebd3d213d33c3 100644 --- a/x-pack/plugins/fleet/server/routes/output/handler.ts +++ b/x-pack/plugins/fleet/server/routes/output/handler.ts @@ -8,7 +8,7 @@ import type { RequestHandler } from 'src/core/server'; import type { TypeOf } from '@kbn/config-schema'; -import { GetOneOutputRequestSchema, PutOutputRequestSchema } from '../../types'; +import type { GetOneOutputRequestSchema, PutOutputRequestSchema } from '../../types'; import type { GetOneOutputResponse, GetOutputsResponse } from '../../../common'; import { outputService } from '../../services/output'; import { defaultIngestErrorHandler } from '../../errors'; diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts index 6359fa45fd0f3..7f2b9d93e2df7 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.test.ts @@ -6,14 +6,14 @@ */ import { httpServerMock, httpServiceMock } from 'src/core/server/mocks'; -import { KibanaRequest } from 'kibana/server'; +import type { KibanaRequest } from 'kibana/server'; import type { IRouter, RequestHandler, RouteConfig } from 'kibana/server'; import { PACKAGE_POLICY_API_ROUTES } from '../../../common/constants'; import { appContextService, packagePolicyService } from '../../services'; import { createAppContextStartContractMock, xpackMocks } from '../../mocks'; import type { PackagePolicyServiceInterface, ExternalCallback } from '../..'; -import { CreatePackagePolicyRequestSchema } from '../../types/rest_spec'; +import type { CreatePackagePolicyRequestSchema } from '../../types/rest_spec'; import { registerRoutes } from './index'; diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts index 14d7e38752cf2..5e8abd5966e3a 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts @@ -11,7 +11,7 @@ import Boom from '@hapi/boom'; import { SavedObjectsErrorHelpers } from '../../../../../../src/core/server'; import type { RequestHandler } from '../../../../../../src/core/server'; import { appContextService, packagePolicyService } from '../../services'; -import { +import type { GetPackagePoliciesRequestSchema, GetOnePackagePolicyRequestSchema, CreatePackagePolicyRequestSchema, diff --git a/x-pack/plugins/fleet/server/routes/setup/handlers.ts b/x-pack/plugins/fleet/server/routes/setup/handlers.ts index b306b4d6802ad..a7fdcf78f4be9 100644 --- a/x-pack/plugins/fleet/server/routes/setup/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/setup/handlers.ts @@ -11,7 +11,7 @@ import type { TypeOf } from '@kbn/config-schema'; import { outputService, appContextService } from '../../services'; import type { GetFleetStatusResponse, PostIngestSetupResponse } from '../../../common'; import { setupIngestManager, setupFleet } from '../../services/setup'; -import { PostFleetSetupRequestSchema } from '../../types'; +import type { PostFleetSetupRequestSchema } from '../../types'; import { defaultIngestErrorHandler } from '../../errors'; export const getFleetStatusHandler: RequestHandler = async (context, request, response) => { diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 05e8fecdcaad1..923f4704aa652 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -22,20 +22,22 @@ import { } from '../constants'; import { - migratePackagePolicyToV7110, - migratePackagePolicyToV7120, - // @ts-expect-error -} from './security_solution'; -import { - migrateAgentToV7100, + migrateAgentActionToV7100, migrateAgentEventToV7100, migrateAgentPolicyToV7100, + migrateAgentToV7100, migrateEnrollmentApiKeysToV7100, migratePackagePolicyToV7100, migrateSettingsToV7100, - migrateAgentActionToV7100, } from './migrations/to_v7_10_0'; -import { migrateAgentToV7120, migrateAgentPolicyToV7120 } from './migrations/to_v7_12_0'; + +import { migratePackagePolicyToV7110 } from './migrations/to_v7_11_0'; + +import { + migrateAgentPolicyToV7120, + migrateAgentToV7120, + migratePackagePolicyToV7120, +} from './migrations/to_v7_12_0'; /* * Saved object types and mappings diff --git a/x-pack/test/send_search_to_background_integration/services/index.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/index.ts similarity index 52% rename from x-pack/test/send_search_to_background_integration/services/index.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/index.ts index f91fb386ae971..bbdd3f14fe22f 100644 --- a/x-pack/test/send_search_to_background_integration/services/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/index.ts @@ -5,10 +5,5 @@ * 2.0. */ -import { services as functionalServices } from '../../functional/services'; -import { SearchSessionsProvider } from './search_sessions'; - -export const services = { - ...functionalServices, - searchSessions: SearchSessionsProvider, -}; +export { migratePackagePolicyToV7110 } from './to_v7_11_0'; +export { migratePackagePolicyToV7120 } from './to_v7_12_0'; diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts similarity index 96% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.test.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts index 251539113fee1..13a4b185e5ea8 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.test.ts @@ -5,8 +5,10 @@ * 2.0. */ -import { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from 'kibana/server'; -import { PackagePolicy } from '../../../../../fleet/common'; +import type { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from 'kibana/server'; + +import type { PackagePolicy } from '../../../../common'; + import { migratePackagePolicyToV7110 } from './to_v7_11_0'; describe('7.11.0 Endpoint Package Policy migration', () => { diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.ts similarity index 88% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.ts index d0dc4f547332a..0c7b20ed28261 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_11_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_11_0.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; +import type { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; import { cloneDeep } from 'lodash'; -import { PackagePolicy } from '../../../../../fleet/common'; + +import type { PackagePolicy } from '../../../../common'; export const migratePackagePolicyToV7110: SavedObjectMigrationFn = ( packagePolicyDoc diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.test.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts similarity index 89% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.test.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts index 936d90cc1aa9c..d64fb55ba65a2 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.test.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.test.ts @@ -5,15 +5,16 @@ * 2.0. */ -import { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from 'kibana/server'; -import { PackagePolicy } from '../../../../../fleet/common'; -import { PolicyData, ProtectionModes } from '../../types'; +import type { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from 'kibana/server'; + +import type { PackagePolicy } from '../../../../common'; + import { migratePackagePolicyToV7120 } from './to_v7_12_0'; describe('7.12.0 Endpoint Package Policy migration', () => { const migration = migratePackagePolicyToV7120; it('adds ransomware option and notification customization', () => { - const doc: SavedObjectUnsanitizedDoc = { + const doc = { id: 'mock-saved-object-id', attributes: { name: 'Some Policy Name', @@ -41,7 +42,6 @@ describe('7.12.0 Endpoint Package Policy migration', () => { policy: { value: { windows: { - // @ts-expect-error popup: { malware: { message: '', @@ -58,9 +58,7 @@ describe('7.12.0 Endpoint Package Policy migration', () => { type: ' nested', }; - expect( - migration(doc, {} as SavedObjectMigrationContext) as SavedObjectUnsanitizedDoc - ).toEqual({ + expect(migration(doc, {} as SavedObjectMigrationContext)).toEqual({ attributes: { name: 'Some Policy Name', package: { @@ -88,7 +86,7 @@ describe('7.12.0 Endpoint Package Policy migration', () => { value: { windows: { ransomware: { - mode: ProtectionModes.off, + mode: 'off', }, popup: { malware: { diff --git a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.ts b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.ts similarity index 81% rename from x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.ts rename to x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.ts index 06d505a71025f..9d961af74a12a 100644 --- a/x-pack/plugins/security_solution/common/endpoint/policy/migrations/to_v7_12_0.ts +++ b/x-pack/plugins/fleet/server/saved_objects/migrations/security_solution/to_v7_12_0.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; +import type { SavedObjectMigrationFn, SavedObjectUnsanitizedDoc } from 'kibana/server'; import { cloneDeep } from 'lodash'; -import { PackagePolicy } from '../../../../../fleet/common'; -import { ProtectionModes } from '../../types'; + +import type { PackagePolicy } from '../../../../common'; export const migratePackagePolicyToV7120: SavedObjectMigrationFn = ( packagePolicyDoc @@ -19,7 +19,7 @@ export const migratePackagePolicyToV7120: SavedObjectMigrationFn = ( agentDoc ) => { diff --git a/x-pack/plugins/fleet/server/services/agent_policy_update.ts b/x-pack/plugins/fleet/server/services/agent_policy_update.ts index beab39d5146e4..dc566b2c435a6 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy_update.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy_update.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; import { generateEnrollmentAPIKey, deleteEnrollmentApiKeyForAgentPolicyId } from './api_keys'; diff --git a/x-pack/plugins/fleet/server/services/agents/acks.ts b/x-pack/plugins/fleet/server/services/agents/acks.ts index fd52d2d5d3c45..a29937e1257eb 100644 --- a/x-pack/plugins/fleet/server/services/agents/acks.ts +++ b/x-pack/plugins/fleet/server/services/agents/acks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient, SavedObjectsBulkCreateObject, diff --git a/x-pack/plugins/fleet/server/services/agents/authenticate.test.ts b/x-pack/plugins/fleet/server/services/agents/authenticate.test.ts index 240de8ccfd5a5..eaa240165e853 100644 --- a/x-pack/plugins/fleet/server/services/agents/authenticate.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/authenticate.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'kibana/server'; +import type { KibanaRequest } from 'kibana/server'; import { elasticsearchServiceMock } from 'src/core/server/mocks'; import { authenticateAgentWithAccessToken } from './authenticate'; diff --git a/x-pack/plugins/fleet/server/services/agents/authenticate.ts b/x-pack/plugins/fleet/server/services/agents/authenticate.ts index dfbf190a55186..0d0d520528dad 100644 --- a/x-pack/plugins/fleet/server/services/agents/authenticate.ts +++ b/x-pack/plugins/fleet/server/services/agents/authenticate.ts @@ -6,7 +6,7 @@ */ import Boom from '@hapi/boom'; -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient } from 'src/core/server'; import type { Agent } from '../../types'; diff --git a/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts b/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts index 0fc83914bcdce..37320cb24fe3f 100644 --- a/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts +++ b/x-pack/plugins/fleet/server/services/agents/checkin/state_new_actions.ts @@ -7,7 +7,8 @@ import semverParse from 'semver/functions/parse'; import semverLt from 'semver/functions/lt'; -import { timer, from, Observable, TimeoutError, of, EMPTY } from 'rxjs'; +import type { Observable } from 'rxjs'; +import { timer, from, TimeoutError, of, EMPTY } from 'rxjs'; import { omit } from 'lodash'; import { shareReplay, @@ -21,7 +22,7 @@ import { timeout, take, } from 'rxjs/operators'; -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server'; import type { Agent, AgentAction, AgentPolicyAction, AgentPolicyActionV7_9 } from '../../../types'; diff --git a/x-pack/plugins/fleet/server/services/agents/crud.ts b/x-pack/plugins/fleet/server/services/agents/crud.ts index 5bfb18e1592a5..975ca7fec08b1 100644 --- a/x-pack/plugins/fleet/server/services/agents/crud.ts +++ b/x-pack/plugins/fleet/server/services/agents/crud.ts @@ -6,16 +6,18 @@ */ import Boom from '@hapi/boom'; -import { SearchResponse } from 'elasticsearch'; +import type { SearchResponse } from 'elasticsearch'; import type { SavedObjectsClientContract, ElasticsearchClient } from 'src/core/server'; import type { AgentSOAttributes, Agent, ListWithKuery } from '../../types'; import { appContextService, agentPolicyService } from '../../services'; -import { FleetServerAgent, isAgentUpgradeable, SO_SEARCH_LIMIT } from '../../../common'; +import type { FleetServerAgent } from '../../../common'; +import { isAgentUpgradeable, SO_SEARCH_LIMIT } from '../../../common'; import { AGENT_SAVED_OBJECT_TYPE, AGENTS_INDEX } from '../../constants'; -import { ESSearchHit } from '../../../../../typings/elasticsearch'; +import type { ESSearchHit } from '../../../../../typings/elasticsearch'; import { escapeSearchQueryPhrase, normalizeKuery } from '../saved_object'; -import { esKuery, KueryNode } from '../../../../../../src/plugins/data/server'; +import type { KueryNode } from '../../../../../../src/plugins/data/server'; +import { esKuery } from '../../../../../../src/plugins/data/server'; import { IngestManagerError, isESClientError, AgentNotFoundError } from '../../errors'; import { searchHitToAgent, agentSOAttributesToFleetServerAgentDoc } from './helpers'; diff --git a/x-pack/plugins/fleet/server/services/agents/update.ts b/x-pack/plugins/fleet/server/services/agents/update.ts index 4365bc06d565f..28f1788f3f9b8 100644 --- a/x-pack/plugins/fleet/server/services/agents/update.ts +++ b/x-pack/plugins/fleet/server/services/agents/update.ts @@ -24,7 +24,7 @@ export async function unenrollForAgentPolicyId( kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id:"${policyId}"`, page: page++, perPage: 1000, - showInactive: true, + showInactive: false, }); if (agents.length === 0) { diff --git a/x-pack/plugins/fleet/server/services/api_keys/index.ts b/x-pack/plugins/fleet/server/services/api_keys/index.ts index 849867bdd5879..bf229c829fda8 100644 --- a/x-pack/plugins/fleet/server/services/api_keys/index.ts +++ b/x-pack/plugins/fleet/server/services/api_keys/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { SavedObjectsClientContract } from 'src/core/server'; import { createAPIKey } from './security'; diff --git a/x-pack/plugins/fleet/server/services/app_context.ts b/x-pack/plugins/fleet/server/services/app_context.ts index cad730b81f98b..21b519565e758 100644 --- a/x-pack/plugins/fleet/server/services/app_context.ts +++ b/x-pack/plugins/fleet/server/services/app_context.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { BehaviorSubject, Observable } from 'rxjs'; +import type { Observable } from 'rxjs'; +import { BehaviorSubject } from 'rxjs'; import { first } from 'rxjs/operators'; import { kibanaPackageJson } from '@kbn/utils'; -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient, SavedObjectsServiceStart, diff --git a/x-pack/plugins/fleet/server/services/artifacts/artifacts.test.ts b/x-pack/plugins/fleet/server/services/artifacts/artifacts.test.ts index 985699efc4379..b483a4e534e6c 100644 --- a/x-pack/plugins/fleet/server/services/artifacts/artifacts.test.ts +++ b/x-pack/plugins/fleet/server/services/artifacts/artifacts.test.ts @@ -29,7 +29,7 @@ import { listArtifacts, } from './artifacts'; -import { NewArtifact } from './types'; +import type { NewArtifact } from './types'; describe('When using the artifacts services', () => { let esClientMock: ReturnType; diff --git a/x-pack/plugins/fleet/server/services/artifacts/artifacts.ts b/x-pack/plugins/fleet/server/services/artifacts/artifacts.ts index ab82a3cb335bd..02a0d5669d967 100644 --- a/x-pack/plugins/fleet/server/services/artifacts/artifacts.ts +++ b/x-pack/plugins/fleet/server/services/artifacts/artifacts.ts @@ -8,18 +8,20 @@ import { deflate } from 'zlib'; import { promisify } from 'util'; -import { createHash, BinaryLike } from 'crypto'; +import type { BinaryLike } from 'crypto'; +import { createHash } from 'crypto'; import uuid from 'uuid'; -import { ElasticsearchClient } from 'kibana/server'; +import type { ElasticsearchClient } from 'kibana/server'; -import { FLEET_SERVER_ARTIFACTS_INDEX, ListResult } from '../../../common'; -import { ESSearchHit, ESSearchResponse } from '../../../../../typings/elasticsearch'; +import type { ListResult } from '../../../common'; +import { FLEET_SERVER_ARTIFACTS_INDEX } from '../../../common'; +import type { ESSearchHit, ESSearchResponse } from '../../../../../typings/elasticsearch'; import { ArtifactsElasticsearchError } from '../../errors'; import { isElasticsearchItemNotFoundError } from './utils'; -import { +import type { Artifact, ArtifactElasticsearchProperties, ArtifactEncodedMetadata, diff --git a/x-pack/plugins/fleet/server/services/artifacts/client.ts b/x-pack/plugins/fleet/server/services/artifacts/client.ts index 58837cb525766..87b752c5a2069 100644 --- a/x-pack/plugins/fleet/server/services/artifacts/client.ts +++ b/x-pack/plugins/fleet/server/services/artifacts/client.ts @@ -4,13 +4,13 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { ElasticsearchClient } from 'kibana/server'; +import type { ElasticsearchClient } from 'kibana/server'; -import { ListResult } from '../../../common'; +import type { ListResult } from '../../../common'; import { ArtifactsClientAccessDeniedError, ArtifactsClientError } from '../../errors'; -import { +import type { Artifact, ArtifactsClientCreateOptions, ArtifactEncodedMetadata, diff --git a/x-pack/plugins/fleet/server/services/artifacts/mappings.ts b/x-pack/plugins/fleet/server/services/artifacts/mappings.ts index b4fbc2c575cd1..bdc50d444c862 100644 --- a/x-pack/plugins/fleet/server/services/artifacts/mappings.ts +++ b/x-pack/plugins/fleet/server/services/artifacts/mappings.ts @@ -5,8 +5,9 @@ * 2.0. */ -import { Artifact, ArtifactElasticsearchProperties } from './types'; -import { ESSearchHit } from '../../../../../typings/elasticsearch'; +import type { ESSearchHit } from '../../../../../typings/elasticsearch'; + +import type { Artifact, ArtifactElasticsearchProperties } from './types'; import { ARTIFACT_DOWNLOAD_RELATIVE_PATH } from './constants'; export const esSearchHitToArtifact = < diff --git a/x-pack/plugins/fleet/server/services/artifacts/mocks.ts b/x-pack/plugins/fleet/server/services/artifacts/mocks.ts index 6763292f2fb44..a89d6913c680c 100644 --- a/x-pack/plugins/fleet/server/services/artifacts/mocks.ts +++ b/x-pack/plugins/fleet/server/services/artifacts/mocks.ts @@ -5,11 +5,14 @@ * 2.0. */ import { URL } from 'url'; -import { ApiResponse } from '@elastic/elasticsearch'; + +import type { ApiResponse } from '@elastic/elasticsearch'; import { ResponseError } from '@elastic/elasticsearch/lib/errors'; + import { elasticsearchServiceMock } from '../../../../../../src/core/server/mocks'; -import { ESSearchHit, ESSearchResponse } from '../../../../../typings/elasticsearch'; -import { Artifact, ArtifactElasticsearchProperties, ArtifactsClientInterface } from './types'; +import type { ESSearchHit, ESSearchResponse } from '../../../../../typings/elasticsearch'; + +import type { Artifact, ArtifactElasticsearchProperties, ArtifactsClientInterface } from './types'; export const createArtifactsClientMock = (): jest.Mocked => { return { diff --git a/x-pack/plugins/fleet/server/services/artifacts/types.ts b/x-pack/plugins/fleet/server/services/artifacts/types.ts index fee2e4768d42d..bbad7974bde79 100644 --- a/x-pack/plugins/fleet/server/services/artifacts/types.ts +++ b/x-pack/plugins/fleet/server/services/artifacts/types.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { ListResult } from '../../../common'; -import { ListWithKuery } from '../../types'; +import type { ListResult } from '../../../common'; +import type { ListWithKuery } from '../../types'; export interface NewArtifact { compressionAlgorithm: 'none' | 'zlib'; diff --git a/x-pack/plugins/fleet/server/services/config.ts b/x-pack/plugins/fleet/server/services/config.ts index 128cb6b136c23..f26099ad9c4db 100644 --- a/x-pack/plugins/fleet/server/services/config.ts +++ b/x-pack/plugins/fleet/server/services/config.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Observable, Subscription } from 'rxjs'; +import type { Observable, Subscription } from 'rxjs'; import type { FleetConfigType } from '../'; diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts index 32e062289f994..732f03440ce9d 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts @@ -19,7 +19,7 @@ jest.mock('./common', () => { }); import { ResponseError } from '@elastic/elasticsearch/lib/errors'; -import { DeeplyMockedKeys } from 'packages/kbn-utility-types/target/jest'; +import type { DeeplyMockedKeys } from 'packages/kbn-utility-types/target/jest'; import type { ElasticsearchClient, SavedObject, SavedObjectsClientContract } from 'kibana/server'; import { ElasticsearchAssetType } from '../../../../types'; diff --git a/x-pack/plugins/fleet/server/services/epm/packages/get.ts b/x-pack/plugins/fleet/server/services/epm/packages/get.ts index 77348d2f080be..98dbd3bd57162 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/get.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/get.ts @@ -19,7 +19,7 @@ import type { RegistryPackage, EpmPackageAdditions, } from '../../../../common/types'; -import { KibanaAssetType } from '../../../types'; +import type { KibanaAssetType } from '../../../types'; import type { Installation, PackageInfo } from '../../../types'; import { IngestManagerError } from '../../../errors'; import { appContextService } from '../../'; diff --git a/x-pack/plugins/fleet/server/services/epm/packages/install.ts b/x-pack/plugins/fleet/server/services/epm/packages/install.ts index 4d2a5528270e4..011e77fb7e89b 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/install.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/install.ts @@ -7,7 +7,7 @@ import semverGt from 'semver/functions/gt'; import semverLt from 'semver/functions/lt'; -import Boom from '@hapi/boom'; +import type Boom from '@hapi/boom'; import type { UnwrapPromise } from '@kbn/utility-types'; import type { ElasticsearchClient, SavedObject, SavedObjectsClientContract } from 'src/core/server'; @@ -21,7 +21,7 @@ import { PackageOutdatedError, } from '../../../errors'; import { PACKAGES_SAVED_OBJECT_TYPE, MAX_TIME_COMPLETE_INSTALL } from '../../../constants'; -import { KibanaAssetType } from '../../../types'; +import type { KibanaAssetType } from '../../../types'; import type { AssetReference, Installation, diff --git a/x-pack/plugins/fleet/server/services/epm/registry/index.ts b/x-pack/plugins/fleet/server/services/epm/registry/index.ts index 258bc23037616..0a755228e0b98 100644 --- a/x-pack/plugins/fleet/server/services/epm/registry/index.ts +++ b/x-pack/plugins/fleet/server/services/epm/registry/index.ts @@ -9,7 +9,7 @@ import { URL } from 'url'; import mime from 'mime-types'; import semverValid from 'semver/functions/valid'; -import { Response } from 'node-fetch'; +import type { Response } from 'node-fetch'; import { KibanaAssetType } from '../../../types'; import type { diff --git a/x-pack/plugins/fleet/server/services/epm/registry/proxy.ts b/x-pack/plugins/fleet/server/services/epm/registry/proxy.ts index 3c71fa0859fdb..ec0a8458ee5f7 100644 --- a/x-pack/plugins/fleet/server/services/epm/registry/proxy.ts +++ b/x-pack/plugins/fleet/server/services/epm/registry/proxy.ts @@ -6,8 +6,11 @@ */ import HttpProxyAgent from 'http-proxy-agent'; -import HttpsProxyAgent, { HttpsProxyAgent as IHttpsProxyAgent } from 'https-proxy-agent'; -import type { HttpsProxyAgentOptions } from 'https-proxy-agent'; +import HttpsProxyAgent from 'https-proxy-agent'; +import type { + HttpsProxyAgentOptions, + HttpsProxyAgent as IHttpsProxyAgent, +} from 'https-proxy-agent'; import { appContextService } from '../../index'; diff --git a/x-pack/plugins/fleet/server/services/epm/registry/requests.ts b/x-pack/plugins/fleet/server/services/epm/registry/requests.ts index 9cba2262dbc6b..40943aa0cffff 100644 --- a/x-pack/plugins/fleet/server/services/epm/registry/requests.ts +++ b/x-pack/plugins/fleet/server/services/epm/registry/requests.ts @@ -5,8 +5,8 @@ * 2.0. */ -import fetch, { FetchError, Response } from 'node-fetch'; -import type { RequestInit } from 'node-fetch'; +import fetch, { FetchError } from 'node-fetch'; +import type { RequestInit, Response } from 'node-fetch'; import pRetry from 'p-retry'; import { streamToString } from '../streams'; diff --git a/x-pack/plugins/fleet/server/services/fleet_server/elastic_index.ts b/x-pack/plugins/fleet/server/services/fleet_server/elastic_index.ts index d58228f57a1b2..9015b56441fb4 100644 --- a/x-pack/plugins/fleet/server/services/fleet_server/elastic_index.ts +++ b/x-pack/plugins/fleet/server/services/fleet_server/elastic_index.ts @@ -8,7 +8,8 @@ import type { ElasticsearchClient } from 'kibana/server'; import hash from 'object-hash'; -import { FLEET_SERVER_INDICES, FLEET_SERVER_INDICES_VERSION } from '../../../common'; +import type { FLEET_SERVER_INDICES } from '../../../common'; +import { FLEET_SERVER_INDICES_VERSION } from '../../../common'; import { appContextService } from '../app_context'; import ESFleetAgentIndex from './elasticsearch/fleet_agents.json'; diff --git a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts index fab3ac4a72813..1d5a788c3a2c2 100644 --- a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts +++ b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts @@ -6,7 +6,7 @@ */ import { isBoom } from '@hapi/boom'; -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import { ENROLLMENT_API_KEYS_INDEX, diff --git a/x-pack/plugins/fleet/server/services/index.ts b/x-pack/plugins/fleet/server/services/index.ts index dec8ecb2b39cd..2783ab36cda44 100644 --- a/x-pack/plugins/fleet/server/services/index.ts +++ b/x-pack/plugins/fleet/server/services/index.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { KibanaRequest } from 'kibana/server'; +import type { KibanaRequest } from 'kibana/server'; import type { ElasticsearchClient, SavedObjectsClientContract } from 'kibana/server'; import type { AgentStatus, Agent, EsAssetReference } from '../types'; -import { getAgent, listAgents } from './agents'; -import { agentPolicyService } from './agent_policy'; +import type { getAgent, listAgents } from './agents'; +import type { agentPolicyService } from './agent_policy'; import * as settingsService from './settings'; export { ESIndexPatternSavedObjectService } from './es_index_pattern'; diff --git a/x-pack/plugins/fleet/server/services/package_policy.test.ts b/x-pack/plugins/fleet/server/services/package_policy.test.ts index b5c465e443ea0..b3e726bdf7c9e 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.test.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.test.ts @@ -12,7 +12,7 @@ import { } from 'src/core/server/mocks'; import type { SavedObjectsUpdateResponse } from 'src/core/server'; -import { KibanaRequest } from 'kibana/server'; +import type { KibanaRequest } from 'kibana/server'; import type { PackageInfo, PackagePolicySOAttributes } from '../types'; import { createPackagePolicyMock } from '../../common/mocks'; diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 877d332bc5680..418a10225edad 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { KibanaRequest } from 'src/core/server'; +import type { KibanaRequest } from 'src/core/server'; import type { ElasticsearchClient, RequestHandlerContext, @@ -38,7 +38,7 @@ import type { PackagePolicySOAttributes, RegistryPackage, } from '../types'; -import { ExternalCallback } from '..'; +import type { ExternalCallback } from '..'; import { agentPolicyService } from './agent_policy'; import { outputService } from './output'; diff --git a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts b/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts index ca640fb8f6cd0..ea723e12256eb 100644 --- a/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts +++ b/x-pack/plugins/infra/common/http_api/log_sources/log_source_configuration.ts @@ -40,7 +40,7 @@ const logSourceMessageColumnConfigurationRT = rt.strict({ messageColumn: logSourceCommonColumnConfigurationRT, }); -const logSourceFieldColumnConfigurationRT = rt.strict({ +export const logSourceFieldColumnConfigurationRT = rt.strict({ fieldColumn: rt.intersection([ logSourceCommonColumnConfigurationRT, rt.strict({ diff --git a/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts index fef40b109941d..480fdc055a03f 100644 --- a/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts +++ b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts @@ -8,5 +8,27 @@ import { MetricsUIAggregation } from '../../../types'; export const memory: MetricsUIAggregation = { - memory: { avg: { field: 'kubernetes.pod.memory.usage.node.pct' } }, + memory_with_limit: { + avg: { + field: 'kubernetes.pod.memory.usage.limit.pct', + }, + }, + memory_without_limit: { + avg: { + field: 'kubernetes.pod.memory.usage.node.pct', + }, + }, + memory: { + bucket_script: { + buckets_path: { + with_limit: 'memory_with_limit', + without_limit: 'memory_without_limit', + }, + script: { + source: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit', + lang: 'painless', + }, + gap_policy: 'skip', + }, + }, }; diff --git a/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts index 9964d49e3a957..9c774e1b18ed0 100644 --- a/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts +++ b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts @@ -25,9 +25,23 @@ export const podMemoryUsage: TSVBMetricModelCreator = ( metrics: [ { field: 'kubernetes.pod.memory.usage.node.pct', - id: 'avg-memory-usage', + id: 'avg-memory-without', type: 'avg', }, + { + field: 'kubernetes.pod.memory.usage.limit.pct', + id: 'avg-memory-with', + type: 'avg', + }, + { + id: 'memory-usage', + type: 'calculation', + variables: [ + { id: 'memory_with', name: 'with_limit', field: 'avg-memory-with' }, + { id: 'memory_without', name: 'without_limit', field: 'avg-memory-without' }, + ], + script: 'params.with_limit > 0.0 ? params.with_limit : params.without_limit', + }, ], }, ], diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts index d8fb409f4eef3..bf7e497385f9a 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts @@ -18,7 +18,11 @@ import type { ISearchStrategy, PluginStart as DataPluginStart, } from '../../../../../../src/plugins/data/server'; -import { LogSourceColumnConfiguration } from '../../../common/http_api/log_sources'; +import { + LogSourceColumnConfiguration, + LogSourceConfigurationProperties, + logSourceFieldColumnConfigurationRT, +} from '../../../common/http_api/log_sources'; import { getLogEntryCursorFromHit, LogColumn, @@ -103,7 +107,7 @@ export const logEntriesSearchStrategyProvider = ({ params.size + 1, configuration.fields.timestamp, configuration.fields.tiebreaker, - messageFormattingRules.requiredFields, + getRequiredFields(configuration, messageFormattingRules, params.columns), params.query, params.highlightPhrase ), @@ -125,7 +129,12 @@ export const logEntriesSearchStrategyProvider = ({ const entries = rawResponse.hits.hits .slice(0, request.params.size) - .map(getLogEntryFromHit(configuration.logColumns, messageFormattingRules)); + .map( + getLogEntryFromHit( + request.params.columns ? request.params.columns : configuration.logColumns, + messageFormattingRules + ) + ); const sortDirection = getSortDirection(pickRequestCursor(request.params)); @@ -244,3 +253,26 @@ function getResponseCursors(entries: LogEntry[]) { return { topCursor, bottomCursor }; } + +const VIEW_IN_CONTEXT_FIELDS = ['log.file.path', 'host.name', 'container.id']; + +const getRequiredFields = ( + configuration: LogSourceConfigurationProperties, + messageFormattingRules: CompiledLogMessageFormattingRule, + columnOverrides?: LogSourceColumnConfiguration[] +): string[] => { + const columns = columnOverrides ? columnOverrides : configuration.logColumns; + + const fieldsFromColumns = columns.reduce((accumulatedFields, logColumn) => { + if (logSourceFieldColumnConfigurationRT.is(logColumn)) { + return [...accumulatedFields, logColumn.fieldColumn.field]; + } + return accumulatedFields; + }, []); + + const fieldsFromFormattingRules = messageFormattingRules.requiredFields; + + return Array.from( + new Set([...fieldsFromColumns, ...fieldsFromFormattingRules, ...VIEW_IN_CONTEXT_FIELDS]) + ); +}; diff --git a/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts b/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts index 613469fe75816..460703b22766f 100644 --- a/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts +++ b/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts @@ -20,8 +20,6 @@ import { } from '../../../utils/elasticsearch_runtime_types'; import { createSortClause, createTimeRangeFilterClauses } from './common'; -const CONTEXT_FIELDS = ['log.file.path', 'host.name', 'container.id']; - export const createGetLogEntriesQuery = ( logEntriesIndex: string, startTimestamp: number, @@ -36,7 +34,6 @@ export const createGetLogEntriesQuery = ( ): RequestParams.AsyncSearchSubmit> => { const sortDirection = getSortDirection(cursor); const highlightQuery = createHighlightQuery(highlightTerm, fields); - const fieldsWithContext = createFieldsWithContext(fields); return { index: logEntriesIndex, @@ -54,7 +51,7 @@ export const createGetLogEntriesQuery = ( ], }, }, - fields: fieldsWithContext, + fields, _source: false, ...createSortClause(sortDirection, timestampField, tiebreakerField), ...createSearchAfterClause(cursor), @@ -120,9 +117,6 @@ const createHighlightQuery = ( } }; -const createFieldsWithContext = (fields: string[]): string[] => - Array.from(new Set([...fields, ...CONTEXT_FIELDS])); - export const logEntryHitRT = rt.intersection([ commonHitFieldsRT, rt.type({ diff --git a/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts b/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts index f529f187c690c..f2a8b95f7b643 100644 --- a/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts +++ b/x-pack/plugins/maps/common/elasticsearch_util/elasticsearch_geo_utils.ts @@ -23,7 +23,7 @@ import { LAT_INDEX, } from '../constants'; import { getEsSpatialRelationLabel } from '../i18n_getters'; -import { Filter, FILTERS } from '../../../../../src/plugins/data/common'; +import { Filter, FilterMeta, FILTERS } from '../../../../../src/plugins/data/common'; import { MapExtent } from '../descriptor_types'; const SPATIAL_FILTER_TYPE = FILTERS.SPATIAL_FILTER; @@ -49,6 +49,12 @@ interface GeoShapeQueryBody { indexed_shape?: PreIndexedShape; } +// Index signature explicitly states that anything stored in an object using a string conforms to the structure +// problem is that Elasticsearch signature also allows for other string keys to conform to other structures, like 'ignore_unmapped' +// Use intersection type to exclude certain properties from the index signature +// https://basarat.gitbook.io/typescript/type-system/index-signatures#excluding-certain-properties-from-the-index-signature +type GeoShapeQuery = { ignore_unmapped: boolean } & { [geoFieldName: string]: GeoShapeQueryBody }; + export type GeoFilter = Filter & { geo_bounding_box?: { [geoFieldName: string]: ESBBox; @@ -57,9 +63,7 @@ export type GeoFilter = Filter & { distance: string; [geoFieldName: string]: Position | { lat: number; lon: number } | string; }; - geo_shape?: { - [geoFieldName: string]: GeoShapeQueryBody; - }; + geo_shape?: GeoShapeQuery; }; export interface PreIndexedShape { @@ -375,7 +379,7 @@ export function createSpatialFilterWithGeometry({ geoFieldName: string; geoFieldType: ES_GEO_FIELD_TYPE; relation: ES_SPATIAL_RELATIONS; -}) { +}): GeoFilter { ensureGeoField(geoFieldType); const isGeoPoint = geoFieldType === ES_GEO_FIELD_TYPE.GEO_POINT; @@ -385,12 +389,13 @@ export function createSpatialFilterWithGeometry({ defaultMessage: 'in', }) : getEsSpatialRelationLabel(relation); - const meta = { + const meta: FilterMeta = { type: SPATIAL_FILTER_TYPE, negate: false, index: indexPatternId, key: geoFieldName, alias: `${geoFieldName} ${relationLabel} ${geometryLabel}`, + disabled: false, }; const shapeQuery: GeoShapeQueryBody = { @@ -406,6 +411,9 @@ export function createSpatialFilterWithGeometry({ return { meta, + // Currently no way to create an object with exclude property from index signature + // typescript error for "ignore_unmapped is not assignable to type 'GeoShapeQueryBody'" expected" + // @ts-expect-error geo_shape: { ignore_unmapped: true, [geoFieldName]: shapeQuery, @@ -425,8 +433,8 @@ export function createDistanceFilterWithMeta({ geoFieldName: string; indexPatternId: string; point: Position; -}) { - const meta = { +}): GeoFilter { + const meta: FilterMeta = { type: SPATIAL_FILTER_TYPE, negate: false, index: indexPatternId, @@ -441,6 +449,7 @@ export function createDistanceFilterWithMeta({ pointLabel: point.join(', '), }, }), + disabled: false, }; return { diff --git a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts index d3a4fa4101ac9..d795315acbf50 100644 --- a/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts +++ b/x-pack/plugins/maps/public/classes/layers/blended_vector_layer/blended_vector_layer.ts @@ -298,10 +298,12 @@ export class BlendedVectorLayer extends VectorLayer implements IVectorLayer { this.getSource(), this.getCurrentStyle() ); + const source = this.getSource(); const canSkipFetch = await canSkipSourceUpdate({ - source: this.getSource(), + source, prevDataRequest: this.getDataRequest(dataRequestId), nextMeta: searchFilters, + extentAware: source.isFilterByMapBounds(), }); let activeSource; diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx index b2bb6a94197f0..01902d1fec89d 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.test.tsx @@ -37,7 +37,8 @@ const defaultConfig = { function createLayer( layerOptions: Partial = {}, - sourceOptions: Partial = {} + sourceOptions: Partial = {}, + isTimeAware: boolean = false ): TiledVectorLayer { const sourceDescriptor: TiledSingleLayerVectorSourceDescriptor = { type: SOURCE_TYPES.MVT_SINGLE_LAYER, @@ -47,6 +48,14 @@ function createLayer( ...sourceOptions, }; const mvtSource = new MVTSingleLayerVectorSource(sourceDescriptor); + if (isTimeAware) { + mvtSource.isTimeAware = async () => { + return true; + }; + mvtSource.getApplyGlobalTime = () => { + return true; + }; + } const defaultLayerOptions = { ...layerOptions, @@ -107,62 +116,75 @@ describe('syncData', () => { }); it('Should not resync when no changes to source params', async () => { - const layer1: TiledVectorLayer = createLayer({}, {}); - const syncContext1 = new MockSyncContext({ dataFilters: {} }); - - await layer1.syncData(syncContext1); - const dataRequestDescriptor: DataRequestDescriptor = { data: { ...defaultConfig }, dataId: 'source', }; - const layer2: TiledVectorLayer = createLayer( + const layer: TiledVectorLayer = createLayer( { __dataRequests: [dataRequestDescriptor], }, {} ); - const syncContext2 = new MockSyncContext({ dataFilters: {} }); - await layer2.syncData(syncContext2); + const syncContext = new MockSyncContext({ dataFilters: {} }); + await layer.syncData(syncContext); // @ts-expect-error - sinon.assert.notCalled(syncContext2.startLoading); + sinon.assert.notCalled(syncContext.startLoading); // @ts-expect-error - sinon.assert.notCalled(syncContext2.stopLoading); + sinon.assert.notCalled(syncContext.stopLoading); + }); + + it('Should resync when changes to syncContext', async () => { + const dataRequestDescriptor: DataRequestDescriptor = { + data: { ...defaultConfig }, + dataId: 'source', + }; + const layer: TiledVectorLayer = createLayer( + { + __dataRequests: [dataRequestDescriptor], + }, + {}, + true + ); + const syncContext = new MockSyncContext({ + dataFilters: { + timeFilters: { + from: 'now', + to: '30m', + mode: 'relative', + }, + }, + }); + await layer.syncData(syncContext); + // @ts-expect-error + sinon.assert.calledOnce(syncContext.startLoading); + // @ts-expect-error + sinon.assert.calledOnce(syncContext.stopLoading); }); describe('Should resync when changes to source params: ', () => { - [ - { layerName: 'barfoo' }, - { urlTemplate: 'https://sub.example.com/{z}/{x}/{y}.pbf' }, - { minSourceZoom: 1 }, - { maxSourceZoom: 12 }, - ].forEach((changes) => { + [{ layerName: 'barfoo' }, { minSourceZoom: 1 }, { maxSourceZoom: 12 }].forEach((changes) => { it(`change in ${Object.keys(changes).join(',')}`, async () => { - const layer1: TiledVectorLayer = createLayer({}, {}); - const syncContext1 = new MockSyncContext({ dataFilters: {} }); - - await layer1.syncData(syncContext1); - const dataRequestDescriptor: DataRequestDescriptor = { data: defaultConfig, dataId: 'source', }; - const layer2: TiledVectorLayer = createLayer( + const layer: TiledVectorLayer = createLayer( { __dataRequests: [dataRequestDescriptor], }, changes ); - const syncContext2 = new MockSyncContext({ dataFilters: {} }); - await layer2.syncData(syncContext2); + const syncContext = new MockSyncContext({ dataFilters: {} }); + await layer.syncData(syncContext); // @ts-expect-error - sinon.assert.calledOnce(syncContext2.startLoading); + sinon.assert.calledOnce(syncContext.startLoading); // @ts-expect-error - sinon.assert.calledOnce(syncContext2.stopLoading); + sinon.assert.calledOnce(syncContext.stopLoading); // @ts-expect-error - const call = syncContext2.stopLoading.getCall(0); + const call = syncContext.stopLoading.getCall(0); expect(call.args[2]).toEqual({ ...defaultConfig, ...changes }); }); }); diff --git a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx index 477b17ae03d7b..f2fe916953801 100644 --- a/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/tiled_vector_layer/tiled_vector_layer.tsx @@ -23,6 +23,7 @@ import { VectorSourceRequestMeta, } from '../../../../common/descriptor_types'; import { MVTSingleLayerVectorSourceConfig } from '../../sources/mvt_single_layer_vector_source/types'; +import { canSkipSourceUpdate } from '../../util/can_skip_fetch'; export class TiledVectorLayer extends VectorLayer { static type = LAYER_TYPE.TILED_VECTOR; @@ -68,18 +69,22 @@ export class TiledVectorLayer extends VectorLayer { this._style as IVectorStyle ); const prevDataRequest = this.getSourceDataRequest(); - - const templateWithMeta = await this._source.getUrlTemplateWithMeta(searchFilters); + const dataRequest = await this._source.getUrlTemplateWithMeta(searchFilters); if (prevDataRequest) { const data: MVTSingleLayerVectorSourceConfig = prevDataRequest.getData() as MVTSingleLayerVectorSourceConfig; if (data) { - const canSkipBecauseNoChanges = + const noChangesInSourceState: boolean = data.layerName === this._source.getLayerName() && data.minSourceZoom === this._source.getMinZoom() && - data.maxSourceZoom === this._source.getMaxZoom() && - data.urlTemplate === templateWithMeta.urlTemplate; - - if (canSkipBecauseNoChanges) { + data.maxSourceZoom === this._source.getMaxZoom(); + const noChangesInSearchState: boolean = await canSkipSourceUpdate({ + extentAware: false, // spatial extent knowledge is already fully automated by tile-loading based on pan-zooming + source: this.getSource(), + prevDataRequest, + nextMeta: searchFilters, + }); + const canSkip = noChangesInSourceState && noChangesInSearchState; + if (canSkip) { return null; } } @@ -87,7 +92,7 @@ export class TiledVectorLayer extends VectorLayer { startLoading(SOURCE_DATA_REQUEST_ID, requestToken, searchFilters); try { - stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, templateWithMeta, {}); + stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, dataRequest, {}); } catch (error) { onLoadError(SOURCE_DATA_REQUEST_ID, requestToken, error.message); } diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx index 91bdd74c158f9..e49339b6250b4 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/utils.tsx @@ -73,6 +73,7 @@ export async function syncVectorSource({ source, prevDataRequest, nextMeta: requestMeta, + extentAware: source.isFilterByMapBounds(), }); if (canSkipFetch) { return { diff --git a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx index b21bff9922671..104d0b56578d1 100644 --- a/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.tsx @@ -332,6 +332,7 @@ export class VectorLayer extends AbstractLayer implements IVectorLayer { source: joinSource, prevDataRequest, nextMeta: searchFilters, + extentAware: false, // join-sources are term-aggs that are spatially unaware (e.g. ESTermSource/TableSource). }); if (canSkipFetch) { return { diff --git a/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts b/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts index 961ca88719488..5f81a74ab03ce 100644 --- a/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts +++ b/x-pack/plugins/maps/public/classes/tooltips/tooltip_property.ts @@ -29,7 +29,7 @@ export interface FeatureGeometry { } export interface RenderTooltipContentParams { - addFilters(filter: object): void; + addFilters(filter: object, actionId: string): void; closeTooltip(): void; features: TooltipFeature[]; isLocked: boolean; diff --git a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js index ce58cb7d019ed..1901b15e8f350 100644 --- a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js +++ b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.test.js @@ -135,6 +135,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(true); @@ -154,6 +155,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(true); @@ -173,6 +175,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -189,6 +192,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -219,6 +223,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -238,6 +243,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -257,6 +263,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); @@ -273,6 +280,7 @@ describe('canSkipSourceUpdate', () => { source: queryAwareSourceMock, prevDataRequest, nextMeta, + extentAware: queryAwareSourceMock.isFilterByMapBounds(), }); expect(canSkipUpdate).toBe(false); diff --git a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts index 1b2fae413d909..575c99432f508 100644 --- a/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts +++ b/x-pack/plugins/maps/public/classes/util/can_skip_fetch.ts @@ -55,14 +55,15 @@ export async function canSkipSourceUpdate({ source, prevDataRequest, nextMeta, + extentAware, }: { source: ISource; prevDataRequest: DataRequest | undefined; nextMeta: DataMeta; + extentAware: boolean; }): Promise { const timeAware = await source.isTimeAware(); const refreshTimerAware = await source.isRefreshTimerAware(); - const extentAware = source.isFilterByMapBounds(); const isFieldAware = source.isFieldAware(); const isQueryAware = source.isQueryAware(); const isGeoGridPrecisionAware = source.isGeoGridPrecisionAware(); @@ -132,11 +133,12 @@ export async function canSkipSourceUpdate({ } let updateDueToPrecisionChange = false; + let updateDueToExtentChange = false; + if (isGeoGridPrecisionAware) { updateDueToPrecisionChange = !_.isEqual(prevMeta.geogridPrecision, nextMeta.geogridPrecision); } - let updateDueToExtentChange = false; if (extentAware) { updateDueToExtentChange = updateDueToExtent(prevMeta, nextMeta); } diff --git a/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx b/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx index 390a8eebfad58..622aeae3cbb87 100644 --- a/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx +++ b/x-pack/plugins/maps/public/connected_components/map_container/map_container.tsx @@ -37,7 +37,7 @@ import 'mapbox-gl/dist/mapbox-gl.css'; const RENDER_COMPLETE_EVENT = 'renderComplete'; export interface Props { - addFilters: ((filters: Filter[]) => Promise) | null; + addFilters: ((filters: Filter[], actionId: string) => Promise) | null; getFilterActions?: () => Promise; getActionContext?: () => ActionExecutionContext; onSingleValueTrigger?: (actionId: string, key: string, value: RawValue) => void; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts index a4b076c0dd7f0..f0df797582bef 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_circle.ts @@ -11,12 +11,17 @@ import turfDistance from '@turf/distance'; // @ts-expect-error import turfCircle from '@turf/circle'; +import { Position } from 'geojson'; + +export interface DrawCircleProperties { + center: Position; + radiusKm: number; +} type DrawCircleState = { circle: { - properties: { - center: {} | null; - radiusKm: number; + properties: Omit & { + center: Position | null; }; id: string | number; incomingCoords: (coords: unknown[]) => void; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.js b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx similarity index 63% rename from x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.js rename to x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx index aaec7ecb2b34f..f68875dc81394 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_control.tsx @@ -6,11 +6,18 @@ */ import _ from 'lodash'; -import React from 'react'; -import { DRAW_TYPE } from '../../../../common/constants'; +import React, { Component } from 'react'; +// @ts-expect-error import MapboxDraw from '@mapbox/mapbox-gl-draw'; +// @ts-expect-error import DrawRectangle from 'mapbox-gl-draw-rectangle-mode'; -import { DrawCircle } from './draw_circle'; +import { Map as MbMap } from 'mapbox-gl'; +import { i18n } from '@kbn/i18n'; +import { Filter } from 'src/plugins/data/public'; +import { Feature, Polygon } from 'geojson'; +import { DRAW_TYPE, ES_GEO_FIELD_TYPE, ES_SPATIAL_RELATIONS } from '../../../../common/constants'; +import { DrawState } from '../../../../common/descriptor_types'; +import { DrawCircle, DrawCircleProperties } from './draw_circle'; import { createDistanceFilterWithMeta, createSpatialFilterWithGeometry, @@ -18,6 +25,7 @@ import { roundCoordinates, } from '../../../../common/elasticsearch_util'; import { DrawTooltip } from './draw_tooltip'; +import { getToasts } from '../../../kibana_services'; const DRAW_RECTANGLE = 'draw_rectangle'; const DRAW_CIRCLE = 'draw_circle'; @@ -26,15 +34,21 @@ const mbDrawModes = MapboxDraw.modes; mbDrawModes[DRAW_RECTANGLE] = DrawRectangle; mbDrawModes[DRAW_CIRCLE] = DrawCircle; -export class DrawControl extends React.Component { - constructor() { - super(); - this._mbDrawControl = new MapboxDraw({ - displayControlsDefault: false, - modes: mbDrawModes, - }); - this._mbDrawControlAdded = false; - } +export interface Props { + addFilters: (filters: Filter[], actionId: string) => Promise; + disableDrawState: () => void; + drawState?: DrawState; + isDrawingFilter: boolean; + mbMap: MbMap; +} + +export class DrawControl extends Component { + private _isMounted = false; + private _mbDrawControlAdded = false; + private _mbDrawControl = new MapboxDraw({ + displayControlsDefault: false, + modes: mbDrawModes, + }); componentDidUpdate() { this._syncDrawControl(); @@ -63,14 +77,19 @@ export class DrawControl extends React.Component { } }, 0); - _onDraw = async (e) => { - if (!e.features.length) { + _onDraw = async (e: { features: Feature[] }) => { + if ( + !e.features.length || + !this.props.drawState || + !this.props.drawState.geoFieldName || + !this.props.drawState.indexPatternId + ) { return; } - let filter; + let filter: Filter | undefined; if (this.props.drawState.drawType === DRAW_TYPE.DISTANCE) { - const circle = e.features[0]; + const circle = e.features[0] as Feature & { properties: DrawCircleProperties }; const distanceKm = _.round( circle.properties.radiusKm, circle.properties.radiusKm > 10 ? 0 : 2 @@ -85,7 +104,7 @@ export class DrawControl extends React.Component { precision = 3; } filter = createDistanceFilterWithMeta({ - alias: this.props.drawState.filterLabel, + alias: this.props.drawState.filterLabel ? this.props.drawState.filterLabel : '', distanceKm, geoFieldName: this.props.drawState.geoFieldName, indexPatternId: this.props.drawState.indexPatternId, @@ -95,7 +114,7 @@ export class DrawControl extends React.Component { ], }); } else { - const geometry = e.features[0].geometry; + const geometry = e.features[0].geometry as Polygon; // MapboxDraw returns coordinates with 12 decimals. Round to a more reasonable number roundCoordinates(geometry.coordinates); @@ -106,24 +125,34 @@ export class DrawControl extends React.Component { : geometry, indexPatternId: this.props.drawState.indexPatternId, geoFieldName: this.props.drawState.geoFieldName, - geoFieldType: this.props.drawState.geoFieldType, - geometryLabel: this.props.drawState.geometryLabel, - relation: this.props.drawState.relation, + geoFieldType: this.props.drawState.geoFieldType + ? this.props.drawState.geoFieldType + : ES_GEO_FIELD_TYPE.GEO_POINT, + geometryLabel: this.props.drawState.geometryLabel ? this.props.drawState.geometryLabel : '', + relation: this.props.drawState.relation + ? this.props.drawState.relation + : ES_SPATIAL_RELATIONS.INTERSECTS, }); } try { - await this.props.addFilters([filter], this.props.drawState.actionId); + await this.props.addFilters([filter!], this.props.drawState.actionId); } catch (error) { - // TODO notify user why filter was not created - console.error(error); + getToasts().addWarning( + i18n.translate('xpack.maps.drawControl.unableToCreatFilter', { + defaultMessage: `Unable to create filter, error: '{errorMsg}'.`, + values: { + errorMsg: error.message, + }, + }) + ); } finally { this.props.disableDrawState(); } }; _removeDrawControl() { - if (!this.props.mbMap || !this._mbDrawControlAdded) { + if (!this._mbDrawControlAdded) { return; } @@ -134,7 +163,7 @@ export class DrawControl extends React.Component { } _updateDrawControl() { - if (!this.props.mbMap) { + if (!this.props.drawState) { return; } @@ -159,7 +188,7 @@ export class DrawControl extends React.Component { } render() { - if (!this.props.mbMap || !this.props.isDrawingFilter) { + if (!this.props.isDrawingFilter || !this.props.drawState) { return null; } diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.js b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.tsx similarity index 84% rename from x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.js rename to x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.tsx index 01e90d8e2daf4..099f409c91c21 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/draw_tooltip.tsx @@ -6,25 +6,35 @@ */ import _ from 'lodash'; -import React, { Component } from 'react'; +import React, { Component, RefObject } from 'react'; import { EuiPopover, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { Map as MbMap } from 'mapbox-gl'; import { DRAW_TYPE } from '../../../../common/constants'; +import { DrawState } from '../../../../common/descriptor_types'; const noop = () => {}; -export class DrawTooltip extends Component { - state = { +interface Props { + mbMap: MbMap; + drawState: DrawState; +} + +interface State { + x?: number; + y?: number; + isOpen: boolean; +} + +export class DrawTooltip extends Component { + private readonly _popoverRef: RefObject = React.createRef(); + + state: State = { x: undefined, y: undefined, isOpen: false, }; - constructor(props) { - super(props); - this._popoverRef = React.createRef(); - } - componentDidMount() { this.props.mbMap.on('mousemove', this._updateTooltipLocation); this.props.mbMap.on('mouseout', this._hideTooltip); @@ -43,6 +53,10 @@ export class DrawTooltip extends Component { } render() { + if (this.state.x === undefined || this.state.y === undefined) { + return null; + } + let instructions; if (this.props.drawState.drawType === DRAW_TYPE.BOUNDS) { instructions = i18n.translate('xpack.maps.drawTooltip.boundsInstructions', { diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.js b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.ts similarity index 63% rename from x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.js rename to x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.ts index 9324ebc0c9fe9..cc2f560c63d24 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/draw_control/index.ts @@ -5,19 +5,22 @@ * 2.0. */ +import { AnyAction } from 'redux'; +import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; import { DrawControl } from './draw_control'; import { updateDrawState } from '../../../actions'; import { getDrawState, isDrawingFilter } from '../../../selectors/map_selectors'; +import { MapStoreState } from '../../../reducers/store'; -function mapStateToProps(state = {}) { +function mapStateToProps(state: MapStoreState) { return { isDrawingFilter: isDrawingFilter(state), drawState: getDrawState(state), }; } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps(dispatch: ThunkDispatch) { return { disableDrawState() { dispatch(updateDrawState(null)); @@ -25,5 +28,5 @@ function mapDispatchToProps(dispatch) { }; } -const connectedDrawControl = connect(mapStateToProps, mapDispatchToProps)(DrawControl); -export { connectedDrawControl as DrawControl }; +const connected = connect(mapStateToProps, mapDispatchToProps)(DrawControl); +export { connected as DrawControl }; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js index fa07460a584a7..3950c6ef124be 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_geometry_filter_form.js @@ -9,6 +9,7 @@ import React, { Component } from 'react'; import { i18n } from '@kbn/i18n'; import { URL_MAX_LENGTH } from '../../../../../../../src/core/public'; +import { ACTION_GLOBAL_APPLY_FILTER } from '../../../../../../../src/plugins/data/public'; import { createSpatialFilterWithGeometry } from '../../../../common/elasticsearch_util'; import { GEO_JSON_TYPE } from '../../../../common/constants'; import { GeometryFilterForm } from '../../../components/geometry_filter_form'; @@ -90,7 +91,7 @@ export class FeatureGeometryFilterForm extends Component { return; } - this.props.addFilters([filter]); + this.props.addFilters([filter], ACTION_GLOBAL_APPLY_FILTER); this.props.onClose(); }; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js index 996c530dcae94..2bd1d5c9cacf5 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/feature_properties.js @@ -192,7 +192,7 @@ export class FeatureProperties extends React.Component { onClick={async () => { this.props.onCloseTooltip(); const filters = await tooltipProperty.getESFilters(); - this.props.addFilters(filters); + this.props.addFilters(filters, ACTION_GLOBAL_APPLY_FILTER); }} aria-label={i18n.translate('xpack.maps.tooltip.filterOnPropertyAriaLabel', { defaultMessage: 'Filter on property', diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx index 5dbe2f97ee6d3..fae89a0484f11 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx +++ b/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.tsx @@ -17,7 +17,6 @@ import sprites2 from '@elastic/maki/dist/sprite@2.png'; import { Adapters } from 'src/plugins/inspector/public'; import { Filter } from 'src/plugins/data/public'; import { ActionExecutionContext, Action } from 'src/plugins/ui_actions/public'; -// @ts-expect-error import { DrawControl } from './draw_control'; import { ScaleControl } from './scale_control'; // @ts-expect-error @@ -67,7 +66,7 @@ export interface Props { clearMouseCoordinates: () => void; clearGoto: () => void; setMapInitError: (errorMessage: string) => void; - addFilters: ((filters: Filter[]) => Promise) | null; + addFilters: ((filters: Filter[], actionId: string) => Promise) | null; getFilterActions?: () => Promise; getActionContext?: () => ActionExecutionContext; onSingleValueTrigger?: (actionId: string, key: string, value: RawValue) => void; @@ -418,7 +417,9 @@ export class MBMap extends Component { let tooltipControl; let scaleControl; if (this.state.mbMap) { - drawControl = ; + drawControl = this.props.addFilters ? ( + + ) : null; tooltipControl = !this.props.settings.disableTooltipControl ? ( ( ), diff --git a/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx b/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx index 6673aded2ecbe..6f6cf2dc9351b 100644 --- a/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx +++ b/x-pack/plugins/reporting/public/components/reporting_panel_content.tsx @@ -223,7 +223,17 @@ class ReportingPanelContentUi extends Component { text: toMountPoint( + + + ), + }} /> ), 'data-test-subj': 'queueReportSuccess', diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts index 0b59170dfc778..81edb51e41458 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram/index.ts @@ -38,11 +38,11 @@ export interface MatrixHistogramRequestOptions extends RequestBasicOptions { stackByField: string; threshold?: | { - field: string | string[] | undefined; - value: number; + field: string[]; + value: string; cardinality?: { field: string[]; - value: number; + value: string; }; } | undefined; diff --git a/x-pack/plugins/security_solution/common/shared_exports.ts b/x-pack/plugins/security_solution/common/shared_exports.ts index f10aaf45dcac3..bf740ddce9fd6 100644 --- a/x-pack/plugins/security_solution/common/shared_exports.ts +++ b/x-pack/plugins/security_solution/common/shared_exports.ts @@ -17,6 +17,4 @@ export { exactCheck } from './exact_check'; export { getPaths, foldLeftRight, removeExternalLinkText } from './test_utils'; export { validate, validateEither } from './validate'; export { formatErrors } from './format_errors'; -export { migratePackagePolicyToV7110 } from './endpoint/policy/migrations/to_v7_11_0'; -export { migratePackagePolicyToV7120 } from './endpoint/policy/migrations/to_v7_12_0'; export { addIdToItem, removeIdFromItem } from './add_remove_id_to_item'; diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts index d846d887cb681..2e0f1ac762ca8 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/types.ts @@ -15,6 +15,7 @@ import { MatrixHistogramType } from '../../../../common/search_strategy/security import { UpdateDateRange } from '../charts/common'; import { GlobalTimeArgs } from '../../containers/use_global_time'; import { DocValueFields } from '../../../../common/search_strategy'; +import { Threshold } from '../../../detections/components/rules/query_preview'; export type MatrixHistogramMappingTypes = Record< string, @@ -74,16 +75,7 @@ export interface MatrixHistogramQueryProps { stackByField: string; startDate: string; histogramType: MatrixHistogramType; - threshold?: - | { - field: string | string[] | undefined; - value: number; - cardinality?: { - field: string[]; - value: number; - }; - } - | undefined; + threshold?: Threshold; skip?: boolean; isPtrIncluded?: boolean; } diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts index dd01a9bc4b2e6..bc4888acc90ff 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/helpers.ts @@ -166,7 +166,7 @@ export const getThresholdHistogramConfig = (): ChartSeriesConfigs => { yTickFormatter: (value: string | number): string => value.toLocaleString(), tickSize: 8, }, - yAxisTitle: i18n.QUERY_GRAPH_COUNT, + yAxisTitle: i18n.THRESHOLD_QUERY_GRAPH_COUNT, settings: { legendPosition: Position.Right, showLegend: true, diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx index 1ca1f0710d78f..2ef114a25f32a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.test.tsx @@ -328,11 +328,11 @@ describe('PreviewQuery', () => { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} @@ -375,11 +375,11 @@ describe('PreviewQuery', () => { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} @@ -409,7 +409,7 @@ describe('PreviewQuery', () => { expect(wrapper.find('[data-test-subj="previewQueryWarning"]').exists()).toBeTruthy(); }); - test('it renders query histogram when preview button clicked, rule type is threshold, and threshold field is not defined', () => { + test('it renders query histogram when preview button clicked, rule type is threshold, and threshold field is empty array', () => { const wrapper = mount( { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: undefined, - value: 200, + field: [], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} @@ -451,11 +451,11 @@ describe('PreviewQuery', () => { query={{ query: { query: 'file where true', language: 'kuery' }, filters: [] }} index={['foo-*']} threshold={{ - field: ' ', - value: 200, + field: [' '], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }} isDisabled={false} diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx index c0c26780e8d71..70d292660388d 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/index.tsx @@ -32,6 +32,7 @@ import { formatDate } from '../../../../common/components/super_date_picker'; import { State, queryPreviewReducer } from './reducer'; import { isNoisy } from './helpers'; import { PreviewCustomQueryHistogram } from './custom_histogram'; +import { FieldValueThreshold } from '../threshold_input'; const Select = styled(EuiSelect)` width: ${({ theme }) => theme.eui.euiSuperDatePickerWidth}; @@ -56,16 +57,7 @@ export const initialState: State = { showNonEqlHistogram: false, }; -export type Threshold = - | { - field: string | string[] | undefined; - value: number; - cardinality?: { - field: string[]; - value: number; - }; - } - | undefined; +export type Threshold = FieldValueThreshold | undefined; interface PreviewQueryProps { dataTestSubj: string; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts index b0728cd8cc827..930b7066da5cc 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.test.ts @@ -335,11 +335,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'threshold', @@ -351,15 +351,15 @@ describe('queryPreviewReducer', () => { expect(update.warnings).toEqual([]); }); - test('should set thresholdFieldExists to false if threshold field is not defined', () => { + test('should set thresholdFieldExists to false if threshold field is empty array', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: undefined, - value: 200, + field: [], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'threshold', @@ -375,11 +375,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: ' ', - value: 200, + field: [' '], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'threshold', @@ -395,11 +395,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'eql', @@ -414,11 +414,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'query', @@ -433,11 +433,11 @@ describe('queryPreviewReducer', () => { const update = reducer(initialState, { type: 'setThresholdQueryVals', threshold: { - field: 'agent.hostname', - value: 200, + field: ['agent.hostname'], + value: '200', cardinality: { field: ['user.name'], - value: 2, + value: '2', }, }, ruleType: 'saved_query', diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts index 2d301bf96122d..2dff858d61c79 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/reducer.ts @@ -67,7 +67,6 @@ export type Action = type: 'setToFrom'; }; -/* eslint-disable-next-line complexity */ export const queryPreviewReducer = () => (state: State, action: Action): State => { switch (action.type) { case 'setQueryInfo': { @@ -132,9 +131,8 @@ export const queryPreviewReducer = () => (state: State, action: Action): State = const thresholdField = action.threshold != null && action.threshold.field != null && - ((typeof action.threshold.field === 'string' && action.threshold.field.trim() !== '') || - (Array.isArray(action.threshold.field) && - action.threshold.field.every((field) => field.trim() !== ''))); + action.threshold.field.length > 0 && + action.threshold.field.every((field) => field.trim() !== ''); const showNonEqlHist = action.ruleType === 'query' || action.ruleType === 'saved_query' || diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts index b3cd8769a34a3..4809a39ef2937 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_preview/translations.ts @@ -42,6 +42,13 @@ export const QUERY_GRAPH_COUNT = i18n.translate( } ); +export const THRESHOLD_QUERY_GRAPH_COUNT = i18n.translate( + 'xpack.securitySolution.detectionEngine.queryPreview.queryThresholdGraphCountLabel', + { + defaultMessage: 'Cumulative Threshold Count', + } +); + export const QUERY_GRAPH_HITS_TITLE = i18n.translate( 'xpack.securitySolution.detectionEngine.queryPreview.queryGraphHitsTitle', { diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx index 733c2303255cc..362dbb4bb722b 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx @@ -6,7 +6,7 @@ */ import { EuiButtonEmpty, EuiFormRow, EuiSpacer } from '@elastic/eui'; -import React, { FC, memo, useCallback, useState, useEffect, useMemo } from 'react'; +import React, { FC, memo, useCallback, useState, useEffect } from 'react'; import styled from 'styled-components'; // Prefer importing entire lodash library, e.g. import { get } from "lodash" // eslint-disable-next-line no-restricted-imports @@ -54,7 +54,7 @@ import { import { EqlQueryBar } from '../eql_query_bar'; import { ThreatMatchInput } from '../threatmatch_input'; import { BrowserField, BrowserFields, useFetchIndex } from '../../../../common/containers/source'; -import { PreviewQuery, Threshold } from '../query_preview'; +import { PreviewQuery } from '../query_preview'; const CommonUseField = getUseField({ component: Field }); @@ -154,24 +154,15 @@ const StepDefineRuleComponent: FC = ({ ruleType: formRuleType, queryBar: formQuery, threatIndex: formThreatIndex, - 'threshold.field': formThresholdField, - 'threshold.value': formThresholdValue, - 'threshold.cardinality.field': formThresholdCardinalityField, - 'threshold.cardinality.value': formThresholdCardinalityValue, + threshold: formThreshold, }, - ] = useFormData< - DefineStepRule & { - 'threshold.field': string[] | undefined; - 'threshold.value': number | undefined; - 'threshold.cardinality.field': string[] | undefined; - 'threshold.cardinality.value': number | undefined; - } - >({ + ] = useFormData({ form, watch: [ 'index', 'ruleType', 'queryBar', + 'threshold', 'threshold.field', 'threshold.value', 'threshold.cardinality.field', @@ -288,24 +279,6 @@ const StepDefineRuleComponent: FC = ({ setOpenTimelineSearch(false); }, []); - const thresholdFormValue = useMemo((): Threshold | undefined => { - return formThresholdValue != null - ? { - field: formThresholdField ?? [], - value: formThresholdValue, - cardinality: { - field: formThresholdCardinalityField ?? [], - value: formThresholdCardinalityValue ?? 0, // FIXME - }, - } - : undefined; - }, [ - formThresholdField, - formThresholdValue, - formThresholdCardinalityField, - formThresholdCardinalityValue, - ]); - const ThresholdInputChildren = useCallback( ({ thresholdField, thresholdValue, thresholdCardinalityField, thresholdCardinalityValue }) => ( = ({ index={index} query={formQuery} isDisabled={!isQueryBarValid || index.length === 0} - threshold={thresholdFormValue} + threshold={formThreshold} /> )} diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts index 0bf1118835414..4b374dc0ceaa6 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/__mocks__/index.ts @@ -99,17 +99,19 @@ export const expectedThresholdDsl = { aggregations: { eventActionGroup: { terms: { - field: 'host.name', + script: { + lang: 'painless', + source: "doc['host.name'].value + ':' + doc['agent.name'].value", + }, order: { _count: 'desc' }, size: 10, - min_doc_count: 200, }, aggs: { events: { date_histogram: { field: '@timestamp', fixed_interval: '2700000ms', - min_doc_count: 0, + min_doc_count: 200, extended_bounds: { min: 1599581486215, max: 1599667886215 }, }, }, @@ -157,14 +159,130 @@ export const expectedThresholdMissingFieldDsl = { missing: 'All others', order: { _count: 'desc' }, size: 10, - min_doc_count: 200, }, aggs: { events: { date_histogram: { field: '@timestamp', fixed_interval: '2700000ms', - min_doc_count: 0, + min_doc_count: 200, + extended_bounds: { min: 1599581486215, max: 1599667886215 }, + }, + }, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { must: [], filter: [{ match_all: {} }], should: [], must_not: [] } }, + { + range: { + '@timestamp': { + gte: '2020-09-08T16:11:26.215Z', + lte: '2020-09-09T16:11:26.215Z', + format: 'strict_date_optional_time', + }, + }, + }, + ], + }, + }, + size: 0, + }, +}; + +export const expectedThresholdWithCardinalityDsl = { + allowNoIndices: true, + body: { + aggregations: { + eventActionGroup: { + aggs: { + cardinality_check: { + bucket_selector: { + buckets_path: { cardinalityCount: 'cardinality_count' }, + script: 'params.cardinalityCount >= 10', + }, + }, + cardinality_count: { cardinality: { field: 'agent.name' } }, + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 200, + }, + }, + }, + terms: { + field: 'event.action', + missing: 'All others', + order: { _count: 'desc' }, + size: 10, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { filter: [{ match_all: {} }], must: [], must_not: [], should: [] } }, + { + range: { + '@timestamp': { + format: 'strict_date_optional_time', + gte: '2020-09-08T16:11:26.215Z', + lte: '2020-09-09T16:11:26.215Z', + }, + }, + }, + ], + }, + }, + size: 0, + }, + ignoreUnavailable: true, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + track_total_hits: true, +}; + +export const expectedThresholdWithGroupFieldsAndCardinalityDsl = { + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + allowNoIndices: true, + ignoreUnavailable: true, + track_total_hits: true, + body: { + aggregations: { + eventActionGroup: { + terms: { + script: { + lang: 'painless', + source: "doc['host.name'].value + ':' + doc['agent.name'].value", + }, + order: { _count: 'desc' }, + size: 10, + }, + aggs: { + events: { + date_histogram: { + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 200, extended_bounds: { min: 1599581486215, max: 1599667886215 }, }, }, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.test.ts new file mode 100644 index 0000000000000..ed317031dab04 --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.test.ts @@ -0,0 +1,174 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { buildThresholdTermsQuery, buildThresholdCardinalityQuery, BaseQuery } from './helpers'; + +const BASE_QUERY: BaseQuery = { + eventActionGroup: { + terms: { + order: { + _count: 'desc', + }, + size: 10, + }, + aggs: { + events: { + date_histogram: { + field: '@timestamp', + fixed_interval: '5000ms', + min_doc_count: 0, + extended_bounds: { + min: 1599581486215, + max: 1599667886215, + }, + }, + }, + }, + }, +}; + +const STACK_BY_FIELD = 'event.action'; + +describe('buildEventsHistogramQuery - helpers', () => { + describe('buildThresholdTermsQuery', () => { + test('it builds a terms query using script if threshold field/s exist', () => { + const query = buildThresholdTermsQuery({ + query: BASE_QUERY, + fields: ['agent.name', 'host.name'], + stackByField: STACK_BY_FIELD, + missing: {}, + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '5000ms', + min_doc_count: 0, + }, + }, + }, + terms: { + order: { _count: 'desc' }, + script: { + lang: 'painless', + source: "doc['agent.name'].value + ':' + doc['host.name'].value", + }, + size: 10, + }, + }, + }); + }); + + test('it builds a terms query using default stackByField if threshold field/s do not exist', () => { + const query = buildThresholdTermsQuery({ + query: BASE_QUERY, + fields: [], + stackByField: STACK_BY_FIELD, + missing: { missing: 'All others' }, + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '5000ms', + min_doc_count: 0, + }, + }, + }, + terms: { + field: 'event.action', + missing: 'All others', + order: { _count: 'desc' }, + size: 10, + }, + }, + }); + }); + }); + + describe('buildThresholdCardinalityQuery', () => { + const TERMS_QUERY = { + eventActionGroup: { + terms: { + field: 'host.name', + order: { _count: 'desc' }, + size: 10, + min_doc_count: 200, + }, + aggs: { + events: { + date_histogram: { + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 0, + extended_bounds: { min: 1599581486215, max: 1599667886215 }, + }, + }, + }, + }, + }; + + test('it builds query with cardinality', () => { + const query = buildThresholdCardinalityQuery({ + query: TERMS_QUERY, + cardinalityField: 'agent.name', + cardinalityValue: '100', + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + cardinality_check: { + bucket_selector: { + buckets_path: { cardinalityCount: 'cardinality_count' }, + script: 'params.cardinalityCount >= 100', + }, + }, + cardinality_count: { cardinality: { field: 'agent.name' } }, + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 0, + }, + }, + }, + terms: { field: 'host.name', min_doc_count: 200, order: { _count: 'desc' }, size: 10 }, + }, + }); + }); + + test('it builds a terms query using default stackByField if threshold field/s do not exist', () => { + const query = buildThresholdCardinalityQuery({ + query: TERMS_QUERY, + cardinalityField: '', + cardinalityValue: '', + }); + expect(query).toEqual({ + eventActionGroup: { + aggs: { + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 0, + }, + }, + }, + terms: { field: 'host.name', min_doc_count: 200, order: { _count: 'desc' }, size: 10 }, + }, + }); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.ts new file mode 100644 index 0000000000000..6aed879371a0a --- /dev/null +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/helpers.ts @@ -0,0 +1,114 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface BaseQuery { + eventActionGroup: { + terms: { + min_doc_count?: number; + order?: { + _count?: string; + }; + size?: number; + field?: string | string[]; + script?: { + lang: string; + source: string; + }; + missing?: string; + }; + aggs: { + events?: unknown; + cardinality_count?: { + cardinality?: { + field?: string; + }; + }; + cardinality_check?: { + bucket_selector?: { + buckets_path?: { + cardinalityCount?: string; + }; + script?: string; + }; + }; + }; + }; +} + +export const buildThresholdTermsQuery = ({ + query, + fields, + stackByField, + missing, +}: { + query: BaseQuery; + fields: string[]; + stackByField: string; + missing: { missing?: string }; +}): BaseQuery => { + if (fields.length > 1) { + return { + eventActionGroup: { + ...query.eventActionGroup, + terms: { + ...query.eventActionGroup.terms, + script: { + lang: 'painless', + source: fields.map((f) => `doc['${f}'].value`).join(` + ':' + `), + }, + }, + }, + }; + } else { + return { + eventActionGroup: { + ...query.eventActionGroup, + terms: { + ...query.eventActionGroup.terms, + field: fields[0] ?? stackByField, + ...missing, + }, + }, + }; + } +}; + +export const buildThresholdCardinalityQuery = ({ + query, + cardinalityField, + cardinalityValue, +}: { + query: BaseQuery; + cardinalityField: string | undefined; + cardinalityValue: string; +}): BaseQuery => { + if (cardinalityField != null && cardinalityField !== '' && cardinalityValue !== '') { + return { + eventActionGroup: { + ...query.eventActionGroup, + aggs: { + ...query.eventActionGroup.aggs, + cardinality_count: { + cardinality: { + field: cardinalityField, + }, + }, + cardinality_check: { + bucket_selector: { + buckets_path: { + cardinalityCount: 'cardinality_count', + }, + script: `params.cardinalityCount >= ${cardinalityValue}`, + }, + }, + }, + }, + }; + } else { + return query; + } +}; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts index c6e15aeefed1f..a2d8650b3380f 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.test.ts @@ -11,6 +11,7 @@ import { expectedDsl, expectedThresholdDsl, expectedThresholdMissingFieldDsl, + expectedThresholdWithCardinalityDsl, } from './__mocks__/'; describe('buildEventsHistogramQuery', () => { @@ -18,15 +19,111 @@ describe('buildEventsHistogramQuery', () => { expect(buildEventsHistogramQuery(mockOptions)).toEqual(expectedDsl); }); - test('builds query with just min doc if "threshold.field" is undefined and "missing" param included', () => { + test('builds query with just min doc if "threshold.field" is empty array and "missing" param included', () => { expect( - buildEventsHistogramQuery({ ...mockOptions, threshold: { field: undefined, value: 200 } }) + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { field: [], value: '200', cardinality: { field: [], value: '0' } }, + }) ).toEqual(expectedThresholdMissingFieldDsl); }); - test('builds query with specified threshold field and without "missing" param if "threshold.field" is defined', () => { + test('builds query with specified threshold fields and without "missing" param if "threshold.field" is multi field', () => { expect( - buildEventsHistogramQuery({ ...mockOptions, threshold: { field: 'host.name', value: 200 } }) + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { + field: ['host.name', 'agent.name'], + value: '200', + }, + }) ).toEqual(expectedThresholdDsl); }); + + test('builds query with specified threshold cardinality if defined', () => { + expect( + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { + field: [], + value: '200', + cardinality: { field: ['agent.name'], value: '10' }, + }, + }) + ).toEqual(expectedThresholdWithCardinalityDsl); + }); + + test('builds query with specified threshold group fields and cardinality if defined', () => { + expect( + buildEventsHistogramQuery({ + ...mockOptions, + threshold: { + field: ['host.name', 'agent.name'], + value: '200', + cardinality: { field: ['agent.name'], value: '10' }, + }, + }) + ).toEqual({ + allowNoIndices: true, + body: { + aggregations: { + eventActionGroup: { + aggs: { + cardinality_check: { + bucket_selector: { + buckets_path: { cardinalityCount: 'cardinality_count' }, + script: 'params.cardinalityCount >= 10', + }, + }, + cardinality_count: { cardinality: { field: 'agent.name' } }, + events: { + date_histogram: { + extended_bounds: { max: 1599667886215, min: 1599581486215 }, + field: '@timestamp', + fixed_interval: '2700000ms', + min_doc_count: 200, + }, + }, + }, + terms: { + order: { _count: 'desc' }, + script: { + lang: 'painless', + source: "doc['host.name'].value + ':' + doc['agent.name'].value", + }, + size: 10, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { filter: [{ match_all: {} }], must: [], must_not: [], should: [] } }, + { + range: { + '@timestamp': { + format: 'strict_date_optional_time', + gte: '2020-09-08T16:11:26.215Z', + lte: '2020-09-09T16:11:26.215Z', + }, + }, + }, + ], + }, + }, + size: 0, + }, + ignoreUnavailable: true, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'logs-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + track_total_hits: true, + }); + }); }); diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts index 04b428f9de89e..15bc4694c1174 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram/events/query.events_histogram.dsl.ts @@ -14,6 +14,7 @@ import { } from '../../../../../utils/build_query'; import { MatrixHistogramRequestOptions } from '../../../../../../common/search_strategy/security_solution/matrix_histogram'; import * as i18n from './translations'; +import { BaseQuery, buildThresholdCardinalityQuery, buildThresholdTermsQuery } from './helpers'; export const buildEventsHistogramQuery = ({ filterQuery, @@ -42,7 +43,7 @@ export const buildEventsHistogramQuery = ({ date_histogram: { field: histogramTimestampField, fixed_interval: interval, - min_doc_count: 0, + min_doc_count: threshold != null ? Number(threshold?.value) : 0, extended_bounds: { min: moment(from).valueOf(), max: moment(to).valueOf(), @@ -58,22 +59,37 @@ export const buildEventsHistogramQuery = ({ : {}; if (threshold != null) { - return { + const query: BaseQuery = { eventActionGroup: { terms: { - field: threshold.field ?? stackByField, - ...(threshold.field != null ? {} : missing), order: { _count: 'desc', }, size: 10, - min_doc_count: threshold.value, }, aggs: { events: dateHistogram, }, }, }; + const baseQuery = buildThresholdTermsQuery({ + query, + fields: threshold.field ?? [], + stackByField, + missing, + }); + + if (threshold.cardinality != null) { + const enrichedQuery = buildThresholdCardinalityQuery({ + query: baseQuery, + cardinalityField: threshold.cardinality.field[0], + cardinalityValue: threshold.cardinality.value, + }); + + return enrichedQuery; + } + + return baseQuery; } return { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 8eec34c137ecb..c0c810496bb9a 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -952,12 +952,8 @@ "data.query.queryBar.kqlOffLabel": "オフ", "data.query.queryBar.kqlOnLabel": "オン", "data.query.queryBar.luceneLanguageName": "Lucene", - "data.query.queryBar.luceneSyntaxWarningMessage": "Lucene クエリ構文を使用しているようですが、Kibana クエリ言語 (KQL) が選択されています。KQL ドキュメント {link} を確認してください。", - "data.query.queryBar.luceneSyntaxWarningOptOutText": "今後表示しない", - "data.query.queryBar.luceneSyntaxWarningTitle": "Lucene 構文警告", "data.query.queryBar.searchInputAriaLabel": "{pageType} ページの検索とフィルタリングを行うには入力を開始してください", "data.query.queryBar.searchInputPlaceholder": "検索", - "data.query.queryBar.syntaxOptionsDescription.docsLinkText": "こちら", "data.query.queryBar.syntaxOptionsTitle": "構文オプション", "data.search.aggs.aggGroups.bucketsText": "バケット", "data.search.aggs.aggGroups.metricsText": "メトリック", @@ -2389,14 +2385,14 @@ "home.tutorials.golangMetrics.longDescription": "Metricbeat モジュール「{moduleName}」は、Golang アプリから内部メトリックを取得します。[詳細] ({learnMoreLink}) 。", "home.tutorials.golangMetrics.nameTitle": "Golang メトリック", "home.tutorials.golangMetrics.shortDescription": "Golang アプリから内部メトリックを取得します。", - "home.tutorials.googlecloudLogs.artifacts.dashboards.linkLabel": "監査ログダッシュボード", - "home.tutorials.googlecloudLogs.longDescription": "これは Google Cloud ログのモジュールです。Stackdriver から Google Pub/Sub トピックシンクにエクスポートされた監査、VPC フロー、ファイアウォールログの読み取りをサポートします。[詳細] ({learnMoreLink}) 。", - "home.tutorials.googlecloudLogs.nameTitle": "Google Cloud ログ", - "home.tutorials.googlecloudLogs.shortDescription": "Google Cloud 監査、ファイアウォール、VPC フローログを収集します。", - "home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel": "Google Cloudメトリックダッシュボード", - "home.tutorials.googlecloudMetrics.longDescription": "「googlecloud」Metricbeatモジュールは、Stackdriver Monitoring APIを使用して、Google Cloud Platformから監視メトリックを取得します。[詳細] ({learnMoreLink}) 。", - "home.tutorials.googlecloudMetrics.nameTitle": "Google Cloudメトリック", - "home.tutorials.googlecloudMetrics.shortDescription": "Stackdriver Monitoring API を使用して、Google Cloud Platform から監視メトリックを取得します。", + "home.tutorials.gcpLogs.artifacts.dashboards.linkLabel": "監査ログダッシュボード", + "home.tutorials.gcpLogs.longDescription": "これは Google Cloud ログのモジュールです。Stackdriver から Google Pub/Sub トピックシンクにエクスポートされた監査、VPC フロー、ファイアウォールログの読み取りをサポートします。[詳細]({learnMoreLink})。", + "home.tutorials.gcpLogs.nameTitle": "Google Cloud ログ", + "home.tutorials.gcpLogs.shortDescription": "Google Cloud 監査、ファイアウォール、VPC フローログを収集します。", + "home.tutorials.gcpMetrics.artifacts.dashboards.linkLabel": "Google Cloudメトリックダッシュボード", + "home.tutorials.gcpMetrics.longDescription": "「gcp」Metricbeatモジュールは、Stackdriver Monitoring APIを使用して、Google Cloud Platformから監視メトリックを取得します。[詳細]({learnMoreLink})。", + "home.tutorials.gcpMetrics.nameTitle": "Google Cloudメトリック", + "home.tutorials.gcpMetrics.shortDescription": "Stackdriver Monitoring API を使用して、Google Cloud Platform から監視メトリックを取得します。", "home.tutorials.gsuiteLogs.artifacts.dashboards.linkLabel": "セキュリティアプリ", "home.tutorials.gsuiteLogs.longDescription": "これは異なる GSuite 監査レポート API からデータを取り込むためのモジュールです。[詳細] ({learnMoreLink}) 。", "home.tutorials.gsuiteLogs.nameTitle": "GSuite ログ", @@ -17067,7 +17063,6 @@ "xpack.reporting.panelContent.notification.cantReachServerDescription": "サーバーと通信できません。再試行してください。", "xpack.reporting.panelContent.notification.reportingErrorTitle": "レポートエラー", "xpack.reporting.panelContent.saveWorkDescription": "レポートの生成前に変更内容を保存してください。", - "xpack.reporting.panelContent.successfullyQueuedReportNotificationDescription": "管理で進捗を確認できます", "xpack.reporting.panelContent.successfullyQueuedReportNotificationTitle": "{objectType} のレポートキュー", "xpack.reporting.panelContent.whatCanBeExportedWarningDescription": "初めに変更内容を保存してください", "xpack.reporting.panelContent.whatCanBeExportedWarningTitle": "保存された {objectType} のみエクスポートできます", @@ -17086,7 +17081,6 @@ "xpack.reporting.publicNotifier.maxSizeReached.partialReportTitle": "{reportObjectType}「{reportObjectTitle}」の部分レポートが作成されました", "xpack.reporting.publicNotifier.pollingErrorMessage": "レポート通知エラー", "xpack.reporting.publicNotifier.reportLink.pickItUpFromPathDescription": "{path}から開始します。", - "xpack.reporting.publicNotifier.reportLink.reportingSectionUrlLinkLabel": "管理 > Kibana > レポート", "xpack.reporting.publicNotifier.successfullyCreatedReportNotificationTitle": "{reportObjectType}「{reportObjectTitle}」のレポートが作成されました", "xpack.reporting.registerFeature.reportingDescription": "Discover、可視化、ダッシュボードから生成されたレポートを管理します。", "xpack.reporting.registerFeature.reportingTitle": "レポート", @@ -22193,12 +22187,10 @@ "xpack.transform.wizard.nextStepButton": "次へ", "xpack.transform.wizard.previousStepButton": "前へ", "xpack.triggersActionsUI.actionVariables.dateLabel": "アラートがアクションをスケジュールした日付。", - "xpack.triggersActionsUI.alerts.breadcrumbTitle": "アラート", "xpack.triggersActionsUI.appName": "アラートとアクション", "xpack.triggersActionsUI.cases.configureCases.mappingFieldSummary": "まとめ", "xpack.triggersActionsUI.checkActionTypeEnabled.actionTypeDisabledByConfigMessage": "このコネクターは Kibana の構成で無効になっています。", "xpack.triggersActionsUI.checkActionTypeEnabled.actionTypeDisabledByLicenseMessage": "このコネクターには {minimumLicenseRequired} ライセンスが必要です。", - "xpack.triggersActionsUI.checkAlertTypeEnabled.alertTypeDisabledByLicenseMessage": "このアラートタイプには {minimumLicenseRequired} ライセンスが必要です。", "xpack.triggersActionsUI.common.constants.comparators.groupByTypes.allDocumentsLabel": "すべてのドキュメント", "xpack.triggersActionsUI.common.constants.comparators.groupByTypes.topLabel": "トップ", "xpack.triggersActionsUI.common.constants.comparators.isAboveLabel": "より大:", @@ -22220,7 +22212,6 @@ "xpack.triggersActionsUI.common.expressionItems.threshold.descriptionLabel": "タイミング", "xpack.triggersActionsUI.common.expressionItems.threshold.popoverTitle": "タイミング", "xpack.triggersActionsUI.components.addMessageVariables.addVariablePopoverButton": "変数を追加", - "xpack.triggersActionsUI.components.addMessageVariables.addVariableTitle": "アラート変数を追加", "xpack.triggersActionsUI.components.builtinActionTypes.common.requiredShortDescTextField": "短い説明が必要です。", "xpack.triggersActionsUI.components.builtinActionTypes.emailAction.actionTypeTitle": "メールに送信", "xpack.triggersActionsUI.components.builtinActionTypes.emailAction.configureAccountsHelpLabel": "電子メールアカウントの構成", @@ -22427,9 +22418,6 @@ "xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.viewHeadersSwitch": "HTTP ヘッダーを追加", "xpack.triggersActionsUI.components.deleteSelectedIdsErrorNotification.descriptionText": "{numErrors, number} {numErrors, plural, one {{singleTitle}} other {{multipleTitle}}}を削除できませんでした", "xpack.triggersActionsUI.components.deleteSelectedIdsSuccessNotification.descriptionText": "{numSuccesses, number} {numSuccesses, plural, one {{singleTitle}} other {{multipleTitle}}}を削除しました", - "xpack.triggersActionsUI.components.emptyConnectorsPrompt.addActionButtonLabel": "コネクターを作成", - "xpack.triggersActionsUI.components.emptyConnectorsPrompt.addActionEmptyBody": "Kibanaで実行するメール、Slack、Elasticsearch、およびサードパーティサービスを構成します。", - "xpack.triggersActionsUI.components.emptyConnectorsPrompt.addActionEmptyTitle": "初めてのコネクターを作成する", "xpack.triggersActionsUI.components.emptyPrompt.emptyButton": "アラートの作成", "xpack.triggersActionsUI.components.emptyPrompt.emptyDesc": "条件が満たされたときにメール、Slack、または別のコネクターを通してアラートを受信します。", "xpack.triggersActionsUI.components.emptyPrompt.emptyTitle": "初めてのアラートを作成する", @@ -22463,8 +22451,6 @@ "xpack.triggersActionsUI.deleteSelectedIdsConfirmModal.cancelButtonLabel": "キャンセル", "xpack.triggersActionsUI.deleteSelectedIdsConfirmModal.deleteButtonLabel": "{numIdsToDelete, plural, one {{singleTitle}} other {# {multipleTitle}}}を削除 ", "xpack.triggersActionsUI.deleteSelectedIdsConfirmModal.descriptionText": "{numIdsToDelete, plural, one {削除された {singleTitle}} other {deleted {multipleTitle}}}を回復できません。", - "xpack.triggersActionsUI.home.alertsAndActionsDocsLinkText": "ドキュメント", - "xpack.triggersActionsUI.home.alertsTabTitle": "アラート", "xpack.triggersActionsUI.home.appTitle": "アラートとアクション", "xpack.triggersActionsUI.home.breadcrumbTitle": "アラートとアクション", "xpack.triggersActionsUI.home.connectorsTabTitle": "コネクター", @@ -22481,12 +22467,9 @@ "xpack.triggersActionsUI.sections.actionConnectorAdd.upgradeYourPlanBannerTitle": "ライセンスをアップグレードしてすべてのコネクターにアクセス", "xpack.triggersActionsUI.sections.actionConnectorForm.actionNameLabel": "コネクター名", "xpack.triggersActionsUI.sections.actionConnectorForm.actions.actionConfigurationWarningHelpLinkText": "詳細情報", - "xpack.triggersActionsUI.sections.actionConnectorForm.actions.actionTypeConfigurationWarningTitleText": "アクションタイプが登録されていません。", "xpack.triggersActionsUI.sections.actionConnectorForm.connectorSettingsLabel": "コネクター設定", "xpack.triggersActionsUI.sections.actionConnectorForm.error.requiredNameText": "名前が必要です。", "xpack.triggersActionsUI.sections.actionConnectorForm.loadingConnectorSettingsDescription": "コネクター設定を読み込んでいます...", - "xpack.triggersActionsUI.sections.actionForm.getMoreActionsTitle": "さらにアクションを表示", - "xpack.triggersActionsUI.sections.actionForm.getMoreAlertTypesTitle": "その他のアラートタイプを取得", "xpack.triggersActionsUI.sections.actionForm.preconfiguredTitleMessage": " (構成済み) ", "xpack.triggersActionsUI.sections.actionForm.RecoveredMessage": "回復済み", "xpack.triggersActionsUI.sections.actionsConnectorsList.addActionButtonLabel": "コネクターを作成", @@ -22507,7 +22490,6 @@ "xpack.triggersActionsUI.sections.actionsConnectorsList.noPermissionToCreateTitle": "コネクターを作成する権限がありません", "xpack.triggersActionsUI.sections.actionsConnectorsList.singleTitle": "コネクター", "xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionsMessage": "コネクターを読み込めません", - "xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionTypesMessage": "アクションタイプを読み込めません", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthPasswordText": "パスワードが必要です。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthUserNameText": "ユーザー名が必要です。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderKeyText": "キーが必要です。", @@ -22527,12 +22509,9 @@ "xpack.triggersActionsUI.sections.alertAdd.indexControls.timeFieldOptionLabel": "フィールドを選択", "xpack.triggersActionsUI.sections.alertAdd.operationName": "作成", "xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText": "アラートを作成できません。", - "xpack.triggersActionsUI.sections.alertAdd.saveSuccessNotificationText": "アラート「{alertName}」を作成しました", "xpack.triggersActionsUI.sections.alertAddFooter.cancelButtonLabel": "キャンセル", "xpack.triggersActionsUI.sections.alertAddFooter.saveButtonLabel": "保存", - "xpack.triggersActionsUI.sections.alertDetails.alertInstances.disabledAlert": "このアラートは無効になっていて再表示できません。[↑ を無効にする]を切り替えてアクティブにします。", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.duration": "期間", - "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.instance": "インスタンス", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.mute": "ミュート", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.start": "開始", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.status": "ステータス", @@ -22543,7 +22522,6 @@ "xpack.triggersActionsUI.sections.alertDetails.dismissButtonTitle": "閉じる", "xpack.triggersActionsUI.sections.alertDetails.editAlertButtonLabel": "編集", "xpack.triggersActionsUI.sections.alertDetails.manageLicensePlanBannerLinkTitle": "ライセンスの管理", - "xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertInstanceSummaryMessage": "アラートインスタンス概要を読み込めません:{message}", "xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertMessage": "アラートを読み込めません:{message}", "xpack.triggersActionsUI.sections.alertDetails.viewAlertInAppButtonLabel": "アプリで表示", "xpack.triggersActionsUI.sections.alertEdit.cancelButtonLabel": "キャンセル", @@ -22551,7 +22529,6 @@ "xpack.triggersActionsUI.sections.alertEdit.flyoutTitle": "アラートを編集", "xpack.triggersActionsUI.sections.alertEdit.saveButtonLabel": "保存", "xpack.triggersActionsUI.sections.alertEdit.saveErrorNotificationText": "アラートを更新できません。", - "xpack.triggersActionsUI.sections.alertEdit.saveSuccessNotificationText": "「{alertName}」 を更新しました", "xpack.triggersActionsUI.sections.alertForm.accordion.deleteIconAriaLabel": "削除", "xpack.triggersActionsUI.sections.alertForm.actionDisabledTitle": "このアクションは無効です", "xpack.triggersActionsUI.sections.alertForm.actionIdLabel": "{connectorInstance} コネクター", @@ -22576,7 +22553,6 @@ "xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onThrottleInterval.description": "設定した間隔を使用してアクションを実行します。", "xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onThrottleInterval.display": "カスタムアクション間隔", "xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onThrottleInterval.label": "カスタムアクション間隔", - "xpack.triggersActionsUI.sections.alertForm.alertTypeSelectLabel": "アラートタイプを選択", "xpack.triggersActionsUI.sections.alertForm.changeAlertTypeAriaLabel": "削除", "xpack.triggersActionsUI.sections.alertForm.checkFieldLabel": "確認間隔", "xpack.triggersActionsUI.sections.alertForm.checkWithTooltip": "条件を評価する頻度を定義します。", @@ -22587,34 +22563,24 @@ "xpack.triggersActionsUI.sections.alertForm.connectorAddInline.addNewConnectorEmptyButton": "コネクターの追加", "xpack.triggersActionsUI.sections.alertForm.documentationLabel": "ドキュメント", "xpack.triggersActionsUI.sections.alertForm.emptyConnectorsLabel": "{actionTypeName}コネクターがありません", - "xpack.triggersActionsUI.sections.alertForm.error.noAuthorizedAlertTypes": "アラートを{operation}するには、適切な権限が付与されている必要があります。", - "xpack.triggersActionsUI.sections.alertForm.error.noAuthorizedAlertTypesTitle": "アラートタイプを{operation}する権限がありません。", "xpack.triggersActionsUI.sections.alertForm.error.requiredActionConnector": "{actionTypeId}のアクションコネクターが必要です。", - "xpack.triggersActionsUI.sections.alertForm.error.requiredAlertTypeIdText": "アラートタイプが必要です。", "xpack.triggersActionsUI.sections.alertForm.error.requiredIntervalText": "確認間隔が必要です。", "xpack.triggersActionsUI.sections.alertForm.error.requiredNameText": "名前が必要です。", "xpack.triggersActionsUI.sections.alertForm.existingAlertActionTypeEditTitle": "{actionConnectorName}", - "xpack.triggersActionsUI.sections.alertForm.loadingActionTypesDescription": "アクションタイプを読み込み中…", - "xpack.triggersActionsUI.sections.alertForm.loadingAlertTypeParamsDescription": "アラートタイプパラメーターを読み込んでいます...", - "xpack.triggersActionsUI.sections.alertForm.loadingAlertTypesDescription": "アラートタイプを読み込んでいます...", "xpack.triggersActionsUI.sections.alertForm.loadingConnectorsDescription": "コネクターを読み込んでいます…", "xpack.triggersActionsUI.sections.alertForm.newAlertActionTypeEditTitle": "{actionConnectorName}", "xpack.triggersActionsUI.sections.alertForm.preconfiguredTitleMessage": "構成済み", "xpack.triggersActionsUI.sections.alertForm.renotifyFieldLabel": "通知", "xpack.triggersActionsUI.sections.alertForm.renotifyWithTooltip": "アラートがアクティブな間にアクションを繰り返す頻度を定義します。", "xpack.triggersActionsUI.sections.alertForm.searchPlaceholderTitle": "検索", - "xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeTitle": "アクションタイプを選択してください", "xpack.triggersActionsUI.sections.alertForm.solutionFilterLabel": "解決策でフィルター", "xpack.triggersActionsUI.sections.alertForm.tagsFieldLabel": "タグ (任意) ", "xpack.triggersActionsUI.sections.alertForm.unableToAddAction": "デフォルトアクショングループの定義がないのでアクションを追加できません", "xpack.triggersActionsUI.sections.alertForm.unableToLoadActionsMessage": "コネクターを読み込めません", - "xpack.triggersActionsUI.sections.alertForm.unableToLoadActionTypesMessage": "アクションタイプを読み込めません", - "xpack.triggersActionsUI.sections.alertForm.unableToLoadAlertTypesMessage": "アラートタイプを読み込めません", "xpack.triggersActionsUI.sections.alertForm.unableToLoadConnectorTitle": "コネクターを読み込めません。", "xpack.triggersActionsUI.sections.alertForm.unableToLoadConnectorTitle'": "コネクターを読み込めません。", "xpack.triggersActionsUI.sections.alertForm.unauthorizedToCreateForEmptyConnectors": "許可されたユーザーのみがコネクターを構成できます。管理者にお問い合わせください。", "xpack.triggersActionsUI.sections.alertsList.actionTypeFilterLabel": "アクションタイプ", - "xpack.triggersActionsUI.sections.alertsList.addActionButtonLabel": "アラートの作成", "xpack.triggersActionsUI.sections.alertsList.alertErrorReasonDecrypting": "アラートの復号中にエラーが発生しました。", "xpack.triggersActionsUI.sections.alertsList.alertErrorReasonLicense": "アラートを実行できません", "xpack.triggersActionsUI.sections.alertsList.alertErrorReasonReading": "アラートの読み取り中にエラーが発生しました。", @@ -22638,11 +22604,6 @@ "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.deleteAllTitle": "削除", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.disableAllTitle": "無効にする", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.enableAllTitle": "有効にする", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDeleteAlertsMessage": "アラートを削除できませんでした", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDisableAlertsMessage": "アラートを無効にできませんでした", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToEnableAlertsMessage": "アラートを有効にできませんでした", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToMuteAlertsMessage": "アラートをミュートにできませんでした", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToUnmuteAlertsMessage": "アラートのミュートを解除できませんでした", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.muteAllTitle": "ミュート", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.unmuteAllTitle": "ミュート解除", "xpack.triggersActionsUI.sections.alertsList.collapsedItemActons.deleteTitle": "削除", @@ -22666,10 +22627,6 @@ "xpack.triggersActionsUI.sections.alertsList.totalStausesPendingDescription": "保留:{totalStausesPending}", "xpack.triggersActionsUI.sections.alertsList.totalStausesUnknownDescription": "不明:{totalStausesUnknown}", "xpack.triggersActionsUI.sections.alertsList.typeFilterLabel": "型", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadActionTypesMessage": "アクションタイプを読み込めません", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsMessage": "アラートを読み込めません", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsStatusesInfoMessage": "アラートステータス情報を読み込めません", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertTypesMessage": "アラートタイプを読み込めません", "xpack.triggersActionsUI.sections.alertsList.viewBunnerButtonLabel": "表示", "xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.addBccButton": "Bcc", "xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.addCcButton": "Cc", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 5ac0bd7d571fd..9a8c014dbc386 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -955,12 +955,8 @@ "data.query.queryBar.kqlOffLabel": "关闭", "data.query.queryBar.kqlOnLabel": "开启", "data.query.queryBar.luceneLanguageName": "Lucene", - "data.query.queryBar.luceneSyntaxWarningMessage": "尽管选择了 Kibana 查询语言 (KQL),但似乎您正在尝试使用 Lucene 查询语法。请查看 KQL 文档 {link}。", - "data.query.queryBar.luceneSyntaxWarningOptOutText": "不再显示", - "data.query.queryBar.luceneSyntaxWarningTitle": "Lucene 语法警告", "data.query.queryBar.searchInputAriaLabel": "开始键入内容,以搜索并筛选 {pageType} 页面", "data.query.queryBar.searchInputPlaceholder": "搜索", - "data.query.queryBar.syntaxOptionsDescription.docsLinkText": "此处", "data.query.queryBar.syntaxOptionsTitle": "语法选项", "data.search.aggs.aggGroups.bucketsText": "存储桶", "data.search.aggs.aggGroups.metricsText": "指标", @@ -2401,14 +2397,14 @@ "home.tutorials.golangMetrics.longDescription": "Metricbeat 模块 `{moduleName}` 从 Golang 应用提取内部指标。[了解详情]({learnMoreLink})。", "home.tutorials.golangMetrics.nameTitle": "Golang 指标", "home.tutorials.golangMetrics.shortDescription": "从 Golang 应用提取内部指标。", - "home.tutorials.googlecloudLogs.artifacts.dashboards.linkLabel": "审计日志仪表板", - "home.tutorials.googlecloudLogs.longDescription": "此模块适用于 Google Cloud 日志。其支持读取从 Stackdriver 导出到 Google Pub/Sub 主题接收器 的审计、VPC 流和防火墙日志。[了解详情]({learnMoreLink})。", - "home.tutorials.googlecloudLogs.nameTitle": "Google Cloud 日志", - "home.tutorials.googlecloudLogs.shortDescription": "收集 Google Cloud 审计、防火墙、VPC 流日志。", - "home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel": "Google Cloud 指标仪表板", - "home.tutorials.googlecloudMetrics.longDescription": "Metricbeat 模块 `googlecloud` 使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。[了解详情]({learnMoreLink})。", - "home.tutorials.googlecloudMetrics.nameTitle": "Google Cloud 指标", - "home.tutorials.googlecloudMetrics.shortDescription": "使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。", + "home.tutorials.gcpLogs.artifacts.dashboards.linkLabel": "审计日志仪表板", + "home.tutorials.gcpLogs.longDescription": "此模块适用于 Google Cloud 日志。其支持读取从 Stackdriver 导出到 Google Pub/Sub 主题接收器 的审计、VPC 流和防火墙日志。[了解详情]({learnMoreLink})。", + "home.tutorials.gcpLogs.nameTitle": "Google Cloud 日志", + "home.tutorials.gcpLogs.shortDescription": "收集 Google Cloud 审计、防火墙、VPC 流日志。", + "home.tutorials.gcpMetrics.artifacts.dashboards.linkLabel": "Google Cloud 指标仪表板", + "home.tutorials.gcpMetrics.longDescription": "Metricbeat 模块 `gcp` 使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。[了解详情]({learnMoreLink})。", + "home.tutorials.gcpMetrics.nameTitle": "Google Cloud 指标", + "home.tutorials.gcpMetrics.shortDescription": "使用 Stackdriver 监测 API 从 Google Cloud Platform 提取监测指标。", "home.tutorials.gsuiteLogs.artifacts.dashboards.linkLabel": "Security 应用", "home.tutorials.gsuiteLogs.longDescription": "这是用于从不同 GSuite 审计报告 API 采集数据的模块。[了解详情]({learnMoreLink})。", "home.tutorials.gsuiteLogs.nameTitle": "GSuite 日志", @@ -17293,7 +17289,6 @@ "xpack.reporting.panelContent.notification.cantReachServerDescription": "无法访问服务器。请重试。", "xpack.reporting.panelContent.notification.reportingErrorTitle": "报告错误", "xpack.reporting.panelContent.saveWorkDescription": "请在生成报告之前保存您的工作。", - "xpack.reporting.panelContent.successfullyQueuedReportNotificationDescription": "在“管理”中跟踪其进度", "xpack.reporting.panelContent.successfullyQueuedReportNotificationTitle": "已为 {objectType} 排队报告", "xpack.reporting.panelContent.whatCanBeExportedWarningDescription": "请先保存您的工作", "xpack.reporting.panelContent.whatCanBeExportedWarningTitle": "只会导出保存的 {objectType}", @@ -17312,7 +17307,6 @@ "xpack.reporting.publicNotifier.maxSizeReached.partialReportTitle": "已为 {reportObjectType} '{reportObjectTitle}' 创建部分报告", "xpack.reporting.publicNotifier.pollingErrorMessage": "报告通知器错误!", "xpack.reporting.publicNotifier.reportLink.pickItUpFromPathDescription": "从 {path} 中提取。", - "xpack.reporting.publicNotifier.reportLink.reportingSectionUrlLinkLabel": "管理 > Kibana > Reporting", "xpack.reporting.publicNotifier.successfullyCreatedReportNotificationTitle": "已为 {reportObjectType}“{reportObjectTitle}”创建报告", "xpack.reporting.registerFeature.reportingDescription": "管理您从 Discover、Visualize 和 Dashboard 生成的报告。", "xpack.reporting.registerFeature.reportingTitle": "Reporting", @@ -22545,12 +22539,10 @@ "xpack.transform.wizard.nextStepButton": "下一步", "xpack.transform.wizard.previousStepButton": "上一步", "xpack.triggersActionsUI.actionVariables.dateLabel": "告警计划操作的日期。", - "xpack.triggersActionsUI.alerts.breadcrumbTitle": "告警", "xpack.triggersActionsUI.appName": "告警和操作", "xpack.triggersActionsUI.cases.configureCases.mappingFieldSummary": "摘要", "xpack.triggersActionsUI.checkActionTypeEnabled.actionTypeDisabledByConfigMessage": "连接器已由 Kibana 配置禁用。", "xpack.triggersActionsUI.checkActionTypeEnabled.actionTypeDisabledByLicenseMessage": "此连接器需要{minimumLicenseRequired}许可证。", - "xpack.triggersActionsUI.checkAlertTypeEnabled.alertTypeDisabledByLicenseMessage": "此告警类型需要{minimumLicenseRequired}许可证。", "xpack.triggersActionsUI.common.constants.comparators.groupByTypes.allDocumentsLabel": "所有文档", "xpack.triggersActionsUI.common.constants.comparators.groupByTypes.topLabel": "排名前", "xpack.triggersActionsUI.common.constants.comparators.isAboveLabel": "高于", @@ -22572,7 +22564,6 @@ "xpack.triggersActionsUI.common.expressionItems.threshold.descriptionLabel": "当", "xpack.triggersActionsUI.common.expressionItems.threshold.popoverTitle": "当", "xpack.triggersActionsUI.components.addMessageVariables.addVariablePopoverButton": "添加变量", - "xpack.triggersActionsUI.components.addMessageVariables.addVariableTitle": "添加告警变量", "xpack.triggersActionsUI.components.builtinActionTypes.common.requiredShortDescTextField": "“简短描述”必填。", "xpack.triggersActionsUI.components.builtinActionTypes.emailAction.actionTypeTitle": "发送到电子邮件", "xpack.triggersActionsUI.components.builtinActionTypes.emailAction.configureAccountsHelpLabel": "配置电子邮件帐户", @@ -22778,9 +22769,6 @@ "xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.valueTextFieldLabel": "值", "xpack.triggersActionsUI.components.builtinActionTypes.webhookAction.viewHeadersSwitch": "添加 HTTP 标头", "xpack.triggersActionsUI.components.deleteSelectedIdsErrorNotification.descriptionText": "无法删除 {numErrors, number} 个{numErrors, plural, one {{singleTitle}} other {{multipleTitle}}}", - "xpack.triggersActionsUI.components.emptyConnectorsPrompt.addActionButtonLabel": "创建连接器", - "xpack.triggersActionsUI.components.emptyConnectorsPrompt.addActionEmptyBody": "配置电子邮件、Slack、Elasticsearch,以及 Kibana 运行的第三方服务。", - "xpack.triggersActionsUI.components.emptyConnectorsPrompt.addActionEmptyTitle": "创建您的首个连接器", "xpack.triggersActionsUI.components.emptyPrompt.emptyButton": "创建告警", "xpack.triggersActionsUI.components.emptyPrompt.emptyDesc": "条件满足时通过电子邮件、Slack 或其他连接器接收告警。", "xpack.triggersActionsUI.components.emptyPrompt.emptyTitle": "创建您的首个告警", @@ -22814,8 +22802,6 @@ "xpack.triggersActionsUI.deleteSelectedIdsConfirmModal.cancelButtonLabel": "取消", "xpack.triggersActionsUI.deleteSelectedIdsConfirmModal.deleteButtonLabel": "删除{numIdsToDelete, plural, one {{singleTitle}} other { # 个{multipleTitle}}} ", "xpack.triggersActionsUI.deleteSelectedIdsConfirmModal.descriptionText": "无法恢复{numIdsToDelete, plural, one {删除的{singleTitle}} other {删除的{multipleTitle}}}。", - "xpack.triggersActionsUI.home.alertsAndActionsDocsLinkText": "文档", - "xpack.triggersActionsUI.home.alertsTabTitle": "告警", "xpack.triggersActionsUI.home.appTitle": "告警和操作", "xpack.triggersActionsUI.home.breadcrumbTitle": "告警和操作", "xpack.triggersActionsUI.home.connectorsTabTitle": "连接器", @@ -22831,14 +22817,10 @@ "xpack.triggersActionsUI.sections.actionConnectorAdd.upgradeYourPlanBannerMessage": "升级您的许可证或开始为期 30 天的免费试用,以便可以立即使用所有第三方连接器。", "xpack.triggersActionsUI.sections.actionConnectorAdd.upgradeYourPlanBannerTitle": "升级您的许可证以访问所有连接器", "xpack.triggersActionsUI.sections.actionConnectorForm.actionNameLabel": "连接器名称", - "xpack.triggersActionsUI.sections.actionConnectorForm.actions.actionConfigurationWarningDescriptionText": "要创建此连接器,必须至少配置一个 {actionType} 帐户。{docLink}", "xpack.triggersActionsUI.sections.actionConnectorForm.actions.actionConfigurationWarningHelpLinkText": "了解详情。", - "xpack.triggersActionsUI.sections.actionConnectorForm.actions.actionTypeConfigurationWarningTitleText": "未注册操作类型", "xpack.triggersActionsUI.sections.actionConnectorForm.connectorSettingsLabel": "连接器设置", "xpack.triggersActionsUI.sections.actionConnectorForm.error.requiredNameText": "“名称”必填。", "xpack.triggersActionsUI.sections.actionConnectorForm.loadingConnectorSettingsDescription": "正在加载连接器设置……", - "xpack.triggersActionsUI.sections.actionForm.getMoreActionsTitle": "获取更多的操作", - "xpack.triggersActionsUI.sections.actionForm.getMoreAlertTypesTitle": "获取更多告警类型", "xpack.triggersActionsUI.sections.actionForm.preconfiguredTitleMessage": " (预配置) ", "xpack.triggersActionsUI.sections.actionForm.RecoveredMessage": "已恢复", "xpack.triggersActionsUI.sections.actionsConnectorsList.addActionButtonLabel": "创建连接器", @@ -22859,7 +22841,6 @@ "xpack.triggersActionsUI.sections.actionsConnectorsList.noPermissionToCreateTitle": "无权创建连接器", "xpack.triggersActionsUI.sections.actionsConnectorsList.singleTitle": "连接器", "xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionsMessage": "无法加载连接器", - "xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionTypesMessage": "无法加载操作类型", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthPasswordText": "“密码”必填。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredAuthUserNameText": "“用户名”必填。", "xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderKeyText": "“键”必填。", @@ -22879,12 +22860,9 @@ "xpack.triggersActionsUI.sections.alertAdd.indexControls.timeFieldOptionLabel": "选择字段", "xpack.triggersActionsUI.sections.alertAdd.operationName": "创建", "xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText": "无法创建告警。", - "xpack.triggersActionsUI.sections.alertAdd.saveSuccessNotificationText": "已创建告警“{alertName}”", "xpack.triggersActionsUI.sections.alertAddFooter.cancelButtonLabel": "取消", "xpack.triggersActionsUI.sections.alertAddFooter.saveButtonLabel": "保存", - "xpack.triggersActionsUI.sections.alertDetails.alertInstances.disabledAlert": "此告警已禁用,无法显示。切换禁用 ↑ 以激活。", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.duration": "持续时间", - "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.instance": "实例", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.mute": "静音", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.start": "启动", "xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.columns.status": "状态", @@ -22895,7 +22873,6 @@ "xpack.triggersActionsUI.sections.alertDetails.dismissButtonTitle": "关闭", "xpack.triggersActionsUI.sections.alertDetails.editAlertButtonLabel": "编辑", "xpack.triggersActionsUI.sections.alertDetails.manageLicensePlanBannerLinkTitle": "管理许可证", - "xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertInstanceSummaryMessage": "无法加载告警实例摘要:{message}", "xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertMessage": "无法加载告警:{message}", "xpack.triggersActionsUI.sections.alertDetails.viewAlertInAppButtonLabel": "在应用中查看", "xpack.triggersActionsUI.sections.alertEdit.cancelButtonLabel": "取消", @@ -22903,7 +22880,6 @@ "xpack.triggersActionsUI.sections.alertEdit.flyoutTitle": "编辑告警", "xpack.triggersActionsUI.sections.alertEdit.saveButtonLabel": "保存", "xpack.triggersActionsUI.sections.alertEdit.saveErrorNotificationText": "无法更新告警。", - "xpack.triggersActionsUI.sections.alertEdit.saveSuccessNotificationText": "已更新“{alertName}”", "xpack.triggersActionsUI.sections.alertForm.accordion.deleteIconAriaLabel": "删除", "xpack.triggersActionsUI.sections.alertForm.actionDisabledTitle": "此操作已禁用", "xpack.triggersActionsUI.sections.alertForm.actionIdLabel": "{connectorInstance} 连接器", @@ -22928,7 +22904,6 @@ "xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onThrottleInterval.description": "操作按照您设置的时间间隔运行。", "xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onThrottleInterval.display": "按定制操作时间间隔", "xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onThrottleInterval.label": "按定制操作时间间隔", - "xpack.triggersActionsUI.sections.alertForm.alertTypeSelectLabel": "选择告警类型", "xpack.triggersActionsUI.sections.alertForm.changeAlertTypeAriaLabel": "删除", "xpack.triggersActionsUI.sections.alertForm.checkFieldLabel": "检查频率", "xpack.triggersActionsUI.sections.alertForm.checkWithTooltip": "定义评估条件的频率。", @@ -22939,34 +22914,24 @@ "xpack.triggersActionsUI.sections.alertForm.connectorAddInline.addNewConnectorEmptyButton": "添加连接器", "xpack.triggersActionsUI.sections.alertForm.documentationLabel": "文档", "xpack.triggersActionsUI.sections.alertForm.emptyConnectorsLabel": "无 {actionTypeName} 连接器", - "xpack.triggersActionsUI.sections.alertForm.error.noAuthorizedAlertTypes": "为了{operation}告警,您需要获得相应的权限。", - "xpack.triggersActionsUI.sections.alertForm.error.noAuthorizedAlertTypesTitle": "您尚无权{operation}任何告警类型", "xpack.triggersActionsUI.sections.alertForm.error.requiredActionConnector": "{actionTypeId} 的操作连接器必填。", - "xpack.triggersActionsUI.sections.alertForm.error.requiredAlertTypeIdText": "告警类型必填。", "xpack.triggersActionsUI.sections.alertForm.error.requiredIntervalText": "“检查时间间隔”必填。", "xpack.triggersActionsUI.sections.alertForm.error.requiredNameText": "“名称”必填。", "xpack.triggersActionsUI.sections.alertForm.existingAlertActionTypeEditTitle": "{actionConnectorName}", - "xpack.triggersActionsUI.sections.alertForm.loadingActionTypesDescription": "正在加载操作类型……", - "xpack.triggersActionsUI.sections.alertForm.loadingAlertTypeParamsDescription": "正在加载告警类型参数……", - "xpack.triggersActionsUI.sections.alertForm.loadingAlertTypesDescription": "正在加载告警类型……", "xpack.triggersActionsUI.sections.alertForm.loadingConnectorsDescription": "正在加载连接器……", "xpack.triggersActionsUI.sections.alertForm.newAlertActionTypeEditTitle": "{actionConnectorName}", "xpack.triggersActionsUI.sections.alertForm.preconfiguredTitleMessage": "预配置", "xpack.triggersActionsUI.sections.alertForm.renotifyFieldLabel": "通知", "xpack.triggersActionsUI.sections.alertForm.renotifyWithTooltip": "定义告警处于活动状态时重复操作的频率。", "xpack.triggersActionsUI.sections.alertForm.searchPlaceholderTitle": "搜索", - "xpack.triggersActionsUI.sections.alertForm.selectAlertActionTypeTitle": "选择操作类型", "xpack.triggersActionsUI.sections.alertForm.solutionFilterLabel": "按解决方案筛选", "xpack.triggersActionsUI.sections.alertForm.tagsFieldLabel": "标签 (可选) ", "xpack.triggersActionsUI.sections.alertForm.unableToAddAction": "无法添加操作,因为未定义默认操作组", "xpack.triggersActionsUI.sections.alertForm.unableToLoadActionsMessage": "无法加载连接器", - "xpack.triggersActionsUI.sections.alertForm.unableToLoadActionTypesMessage": "无法加载操作类型", - "xpack.triggersActionsUI.sections.alertForm.unableToLoadAlertTypesMessage": "无法加载告警类型", "xpack.triggersActionsUI.sections.alertForm.unableToLoadConnectorTitle": "无法加载连接器。", "xpack.triggersActionsUI.sections.alertForm.unableToLoadConnectorTitle'": "无法加载连接器。", "xpack.triggersActionsUI.sections.alertForm.unauthorizedToCreateForEmptyConnectors": "只有获得授权的用户才能配置连接器。请联系您的管理员。", "xpack.triggersActionsUI.sections.alertsList.actionTypeFilterLabel": "操作类型", - "xpack.triggersActionsUI.sections.alertsList.addActionButtonLabel": "创建告警", "xpack.triggersActionsUI.sections.alertsList.alertErrorReasonDecrypting": "解密告警时发生错误。", "xpack.triggersActionsUI.sections.alertsList.alertErrorReasonLicense": "无法运行告警", "xpack.triggersActionsUI.sections.alertsList.alertErrorReasonReading": "读取告警时发生错误。", @@ -22991,11 +22956,6 @@ "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.deleteAllTitle": "删除", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.disableAllTitle": "禁用", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.enableAllTitle": "启用", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDeleteAlertsMessage": "无法删除告警", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDisableAlertsMessage": "无法禁用告警", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToEnableAlertsMessage": "无法启用告警", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToMuteAlertsMessage": "无法静音告警", - "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToUnmuteAlertsMessage": "无法使告警取消静音", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.muteAllTitle": "静音", "xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.unmuteAllTitle": "取消静音", "xpack.triggersActionsUI.sections.alertsList.collapsedItemActons.deleteTitle": "删除", @@ -23019,10 +22979,6 @@ "xpack.triggersActionsUI.sections.alertsList.totalStausesPendingDescription": "待处理:{totalStausesPending}", "xpack.triggersActionsUI.sections.alertsList.totalStausesUnknownDescription": "未知:{totalStausesUnknown}", "xpack.triggersActionsUI.sections.alertsList.typeFilterLabel": "类型", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadActionTypesMessage": "无法加载操作类型", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsMessage": "无法加载告警", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsStatusesInfoMessage": "无法加载告警状态信息", - "xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertTypesMessage": "无法加载告警类型", "xpack.triggersActionsUI.sections.alertsList.viewBunnerButtonLabel": "查看", "xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.addBccButton": "密送", "xpack.triggersActionsUI.sections.builtinActionTypes.emailAction.addCcButton": "抄送", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx index 162e161378690..2e0614e7ea963 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx @@ -12,7 +12,7 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; import useObservable from 'react-use/lib/useObservable'; import { KibanaFeature } from '../../../features/common'; -import { Section, routeToAlertDetails } from './constants'; +import { Section, routeToRuleDetails, legacyRouteToRuleDetails } from './constants'; import { ActionTypeRegistryContract, AlertTypeRegistryContract } from '../types'; import { ChartsPluginStart } from '../../../../../src/plugins/charts/public'; import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; @@ -55,7 +55,7 @@ export const renderApp = (deps: TriggersAndActionsUiServices) => { export const App = ({ deps }: { deps: TriggersAndActionsUiServices }) => { const { savedObjects, uiSettings } = deps; - const sections: Section[] = ['alerts', 'connectors']; + const sections: Section[] = ['rules', 'connectors']; const isDarkMode = useObservable(uiSettings.get$('theme:darkMode')); const sectionsRegex = sections.join('|'); @@ -81,10 +81,16 @@ export const AppWithoutRouter = ({ sectionsRegex }: { sectionsRegex: string }) = component={suspendedComponentWithProps(TriggersActionsUIHome, 'xl')} /> - + } + /> + + ); }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.tsx index 87a76bb127eb3..bf89e4f6ae6e1 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/add_message_variables.tsx @@ -55,9 +55,9 @@ export const AddMessageVariables: React.FunctionComponent = ({ )); const addVariableButtonTitle = i18n.translate( - 'xpack.triggersActionsUI.components.addMessageVariables.addVariableTitle', + 'xpack.triggersActionsUI.components.addMessageVariables.addRuleVariableTitle', { - defaultMessage: 'Add alert variable', + defaultMessage: 'Add rule variable', } ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx index 22cb126268a72..3baf4e33fb68d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.test.tsx @@ -127,7 +127,7 @@ describe('health check', () => { const description = queryByRole(/banner/i); expect(description!.textContent).toMatchInlineSnapshot( - `"To create an alert, set a value for xpack.encryptedSavedObjects.encryptionKey in your kibana.yml file and ensure the Encrypted Saved Objects plugin is enabled. Learn how.(opens in a new tab or window)"` + `"To create a rule, set a value for xpack.encryptedSavedObjects.encryptionKey in your kibana.yml file and ensure the Encrypted Saved Objects plugin is enabled. Learn how.(opens in a new tab or window)"` ); const action = queryByText(/Learn/i); @@ -158,11 +158,11 @@ describe('health check', () => { const description = queryByText(/Transport Layer Security/i); expect(description!.textContent).toMatchInlineSnapshot( - `"You must enable Transport Layer Security between Kibana and Elasticsearch and configure an encryption key in your kibana.yml file. Learn how(opens in a new tab or window)"` + `"You must enable Transport Layer Security between Kibana and Elasticsearch and configure an encryption key in your kibana.yml file. Learn how.(opens in a new tab or window)"` ); const action = queryByText(/Learn/i); - expect(action!.textContent).toMatchInlineSnapshot(`"Learn how(opens in a new tab or window)"`); + expect(action!.textContent).toMatchInlineSnapshot(`"Learn how.(opens in a new tab or window)"`); expect(action!.getAttribute('href')).toMatchInlineSnapshot( `"https://www.elastic.co/guide/en/kibana/mocked-test-branch/alerting-getting-started.html#alerting-setup-prerequisites"` ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx index ffd6739282a3b..208fd5ec66f1d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx @@ -118,7 +118,7 @@ const EncryptionError = ({ docLinks, className }: PromptErrorProps) => ( {i18n.translate( 'xpack.triggersActionsUI.components.healthCheck.encryptionErrorBeforeKey', { - defaultMessage: 'To create an alert, set a value for ', + defaultMessage: 'To create a rule, set a value for ', } )} {'xpack.encryptedSavedObjects.encryptionKey'} @@ -185,7 +185,7 @@ const AlertsError = ({ docLinks, className }: PromptErrorProps) => (

} @@ -193,11 +193,11 @@ const AlertsError = ({ docLinks, className }: PromptErrorProps) => (

{i18n.translate('xpack.triggersActionsUI.components.healthCheck.alertsError', { - defaultMessage: 'To create an alert, set alerts and actions plugins enabled. ', + defaultMessage: 'To create a rule, you must enable the alerting and actions plugins. ', })} {i18n.translate('xpack.triggersActionsUI.components.healthCheck.alertsErrorAction', { - defaultMessage: 'Learn how to enable Alerts and Actions.', + defaultMessage: 'Learn how.', })}

@@ -231,7 +231,7 @@ const TlsAndEncryptionError = ({ docLinks, className }: PromptErrorProps) => ( {i18n.translate( 'xpack.triggersActionsUI.components.healthCheck.tlsAndEncryptionErrorAction', { - defaultMessage: 'Learn how', + defaultMessage: 'Learn how.', } )} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_connectors_prompt.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_connectors_prompt.tsx index 2f319fcaa01df..e56fad409d98f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_connectors_prompt.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_connectors_prompt.tsx @@ -22,7 +22,7 @@ export const EmptyConnectorsPrompt = ({ onCTAClicked }: { onCTAClicked: () => vo

@@ -32,7 +32,7 @@ export const EmptyConnectorsPrompt = ({ onCTAClicked }: { onCTAClicked: () => vo body={

@@ -47,7 +47,7 @@ export const EmptyConnectorsPrompt = ({ onCTAClicked }: { onCTAClicked: () => vo onClick={onCTAClicked} > diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_prompt.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_prompt.tsx index 8f94d1ac93106..39187ccb14cd8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_prompt.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/prompts/empty_prompt.tsx @@ -17,7 +17,7 @@ export const EmptyPrompt = ({ onCTAClicked }: { onCTAClicked: () => void }) => (

} @@ -38,7 +38,7 @@ export const EmptyPrompt = ({ onCTAClicked }: { onCTAClicked: () => void }) => ( > } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts b/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts index e5db5a45975af..2d0b2e99c10a6 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts @@ -10,12 +10,14 @@ import { i18n } from '@kbn/i18n'; export { BASE_ALERT_API_PATH } from '../../../../alerting/common'; export { BASE_ACTION_API_PATH } from '../../../../actions/common'; -export type Section = 'connectors' | 'alerts'; +export type Section = 'connectors' | 'rules'; export const routeToHome = `/`; export const routeToConnectors = `/connectors`; -export const routeToAlerts = `/alerts`; -export const routeToAlertDetails = `/alert/:alertId`; +export const routeToRules = `/rules`; +export const routeToRuleDetails = `/rule/:ruleId`; +export const legacyRouteToRules = `/alerts`; +export const legacyRouteToRuleDetails = `/alert/:alertId`; export const recoveredActionGroupMessage = i18n.translate( 'xpack.triggersActionsUI.sections.actionForm.RecoveredMessage', diff --git a/x-pack/plugins/triggers_actions_ui/public/application/constants/plugin.ts b/x-pack/plugins/triggers_actions_ui/public/application/constants/plugin.ts index 169787fc28294..bf5cf6d58c69c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/constants/plugin.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/constants/plugin.ts @@ -9,7 +9,7 @@ export const PLUGIN = { ID: 'triggersActionsUi', getI18nName: (i18n: any): string => { return i18n.translate('xpack.triggersActionsUI.appName', { - defaultMessage: 'Alerts and Actions', + defaultMessage: 'Rules and Connectors', }); }, }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx index a265adfecf55f..3d71d5404da2b 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx @@ -21,10 +21,10 @@ describe('home', () => { location: createLocation('/'), match: { isExact: true, - path: `/alerts`, + path: `/rules`, url: '', params: { - section: 'alerts', + section: 'rules', }, }, }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.tsx index c251a1d597f27..b77593c990550 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.tsx @@ -21,7 +21,7 @@ import { EuiFlexItem, } from '@elastic/eui'; -import { Section, routeToConnectors, routeToAlerts } from './constants'; +import { Section, routeToConnectors, routeToRules } from './constants'; import { getAlertingSectionBreadcrumb } from './lib/breadcrumb'; import { getCurrentDocTitle } from './lib/doc_title'; import { hasShowActionsCapability } from './lib/capabilities'; @@ -56,9 +56,9 @@ export const TriggersActionsUIHome: React.FunctionComponent = []; tabs.push({ - id: 'alerts', + id: 'rules', name: ( - + ), }); @@ -93,7 +93,7 @@ export const TriggersActionsUIHome: React.FunctionComponent @@ -105,7 +105,7 @@ export const TriggersActionsUIHome: React.FunctionComponent @@ -117,7 +117,7 @@ export const TriggersActionsUIHome: React.FunctionComponent

@@ -153,7 +153,7 @@ export const TriggersActionsUIHome: React.FunctionComponent ( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts index 5186318194be7..4dbda8f5d9614 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts @@ -7,7 +7,7 @@ import { getAlertingSectionBreadcrumb, getAlertDetailsBreadcrumb } from './breadcrumb'; import { i18n } from '@kbn/i18n'; -import { routeToConnectors, routeToAlerts, routeToHome } from '../constants'; +import { routeToConnectors, routeToRules, routeToHome } from '../constants'; describe('getAlertingSectionBreadcrumb', () => { test('if change calls return proper breadcrumb title ', async () => { @@ -17,15 +17,15 @@ describe('getAlertingSectionBreadcrumb', () => { }), href: `${routeToConnectors}`, }); - expect(getAlertingSectionBreadcrumb('alerts')).toMatchObject({ - text: i18n.translate('xpack.triggersActionsUI.alerts.breadcrumbTitle', { - defaultMessage: 'Alerts', + expect(getAlertingSectionBreadcrumb('rules')).toMatchObject({ + text: i18n.translate('xpack.triggersActionsUI.rules.breadcrumbTitle', { + defaultMessage: 'Rules', }), - href: `${routeToAlerts}`, + href: `${routeToRules}`, }); expect(getAlertingSectionBreadcrumb('home')).toMatchObject({ text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', { - defaultMessage: 'Alerts and Actions', + defaultMessage: 'Rules and Connectors', }), href: `${routeToHome}`, }); @@ -38,7 +38,7 @@ describe('getAlertDetailsBreadcrumb', () => { text: i18n.translate('xpack.triggersActionsUI.alertDetails.breadcrumbTitle', { defaultMessage: 'testName', }), - href: '/alert/testId', + href: '/rule/testId', }); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts index a91a9c19a0b67..b98aac8719d32 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { routeToHome, routeToConnectors, routeToAlerts, routeToAlertDetails } from '../constants'; +import { routeToHome, routeToConnectors, routeToRules, routeToRuleDetails } from '../constants'; export const getAlertingSectionBreadcrumb = (type: string): { text: string; href: string } => { // Home and sections @@ -18,17 +18,17 @@ export const getAlertingSectionBreadcrumb = (type: string): { text: string; href }), href: `${routeToConnectors}`, }; - case 'alerts': + case 'rules': return { - text: i18n.translate('xpack.triggersActionsUI.alerts.breadcrumbTitle', { - defaultMessage: 'Alerts', + text: i18n.translate('xpack.triggersActionsUI.rules.breadcrumbTitle', { + defaultMessage: 'Rules', }), - href: `${routeToAlerts}`, + href: `${routeToRules}`, }; default: return { text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', { - defaultMessage: 'Alerts and Actions', + defaultMessage: 'Rules and Connectors', }), href: `${routeToHome}`, }; @@ -41,6 +41,6 @@ export const getAlertDetailsBreadcrumb = ( ): { text: string; href: string } => { return { text: name, - href: `${routeToAlertDetails.replace(':alertId', id)}`, + href: `${routeToRuleDetails.replace(':ruleId', id)}`, }; }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.test.tsx index a232ead01f81d..44cb17262fb57 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.test.tsx @@ -61,7 +61,7 @@ describe('checkAlertTypeEnabled', () => { expect(checkAlertTypeEnabled(alertType)).toMatchInlineSnapshot(` Object { "isEnabled": false, - "message": "This alert type requires a Gold license.", + "message": "This rule type requires a Gold license.", } `); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.tsx b/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.tsx index 9f030d64a8592..9348b367aee9b 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/check_alert_type_enabled.tsx @@ -21,9 +21,9 @@ const getLicenseCheckResult = (alertType: AlertType) => { return { isEnabled: false, message: i18n.translate( - 'xpack.triggersActionsUI.checkAlertTypeEnabled.alertTypeDisabledByLicenseMessage', + 'xpack.triggersActionsUI.checkAlertTypeEnabled.ruleTypeDisabledByLicenseMessage', { - defaultMessage: 'This alert type requires a {minimumLicenseRequired} license.', + defaultMessage: 'This rule type requires a {minimumLicenseRequired} license.', values: { minimumLicenseRequired: upperFirst(alertType.minimumLicenseRequired), }, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.test.ts index f8ce5c87f3c37..af352de0cc6e7 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.test.ts @@ -9,8 +9,8 @@ import { getCurrentDocTitle } from './doc_title'; describe('getCurrentDocTitle', () => { test('if change calls return the proper doc title ', async () => { - expect(getCurrentDocTitle('home') === 'Alerts and Actions').toBeTruthy(); + expect(getCurrentDocTitle('home') === 'Rules and Connectors').toBeTruthy(); expect(getCurrentDocTitle('connectors') === 'Connectors').toBeTruthy(); - expect(getCurrentDocTitle('alerts') === 'Alerts').toBeTruthy(); + expect(getCurrentDocTitle('rules') === 'Rules').toBeTruthy(); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.ts index 4b3c251b35a75..fab9e19c8acee 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/doc_title.ts @@ -16,14 +16,14 @@ export const getCurrentDocTitle = (page: string): string => { defaultMessage: 'Connectors', }); break; - case 'alerts': - updatedTitle = i18n.translate('xpack.triggersActionsUI.alerts.breadcrumbTitle', { - defaultMessage: 'Alerts', + case 'rules': + updatedTitle = i18n.translate('xpack.triggersActionsUI.rules.breadcrumbTitle', { + defaultMessage: 'Rules', }); break; default: updatedTitle = i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', { - defaultMessage: 'Alerts and Actions', + defaultMessage: 'Rules and Connectors', }); } return updatedTitle; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx index ae77a3bdde891..e8176d752555c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_connector_form.tsx @@ -140,9 +140,9 @@ export const ActionConnectorForm = ({

@@ -417,8 +417,8 @@ export const ActionForm = ({ className="actActionForm__getMoreActionsLink" > @@ -431,8 +431,8 @@ export const ActionForm = ({ {isLoadingActionTypes ? ( ) : ( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx index 7601df9b498e6..4428d635c6493 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx @@ -75,8 +75,8 @@ export const ActionTypeMenu = ({ if (toasts) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionTypesMessage', - { defaultMessage: 'Unable to load action types' } + 'xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadConnectorTypesMessage', + { defaultMessage: 'Unable to load connector types' } ), }); } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx index c4ace3dc560b6..8afa2d2b57529 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/test_connector_form.tsx @@ -54,7 +54,12 @@ export const TestConnectorForm = ({ const steps = [ { - title: 'Create an action', + title: i18n.translate( + 'xpack.triggersActionsUI.sections.testConnectorForm.createActionHeader', + { + defaultMessage: 'Create an action', + } + ), children: ParamsFieldsComponent ? ( ) : ( -

This Connector does not require any Action Parameter.

+

+ +

), }, { - title: 'Run the action', + title: i18n.translate('xpack.triggersActionsUI.sections.testConnectorForm.runTestHeader', { + defaultMessage: 'Run the test', + }), children: ( {executeEnabled ? null : ( @@ -122,7 +134,12 @@ export const TestConnectorForm = ({ ), }, { - title: 'Results', + title: i18n.translate( + 'xpack.triggersActionsUI.sections.testConnectorForm.testResultsHeader', + { + defaultMessage: 'Results', + } + ), children: pipe( executionResult, map((result) => @@ -144,7 +161,7 @@ const AwaitingExecution = () => (

@@ -156,7 +173,7 @@ const SuccessfulExecution = () => ( title={i18n.translate( 'xpack.triggersActionsUI.sections.testConnectorForm.executionSuccessfulTitle', { - defaultMessage: 'Action was successful', + defaultMessage: 'Test was successful', values: {}, } )} @@ -212,7 +229,7 @@ const FailedExecussion = ({ title={i18n.translate( 'xpack.triggersActionsUI.sections.testConnectorForm.executionFailureTitle', { - defaultMessage: 'Action failed to run', + defaultMessage: 'Test failed to run', } )} data-test-subj="executionFailureResult" diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx index 1555cc9b03b5d..d80041312d790 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.tsx @@ -84,8 +84,8 @@ export const ActionsConnectorsList: React.FunctionComponent = () => { } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionTypesMessage', - { defaultMessage: 'Unable to load action types' } + 'xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadConnectorTypesMessage', + { defaultMessage: 'Unable to load connector types' } ), }); } finally { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx index d425566d8f3df..0796f09b13460 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import { i18n } from '@kbn/i18n'; import React, { useState, Fragment, useEffect, useReducer } from 'react'; import { keyBy } from 'lodash'; import { useHistory } from 'react-router-dom'; @@ -39,7 +40,7 @@ import { import { AlertInstancesRouteWithApi } from './alert_instances_route'; import { ViewInApp } from './view_in_app'; import { AlertEdit } from '../../alert_form'; -import { routeToAlertDetails } from '../../../constants'; +import { routeToRuleDetails } from '../../../constants'; import { alertsErrorReasonTranslationsMapping } from '../../alerts_list/translations'; import { useKibana } from '../../../../common/lib/kibana'; import { alertReducer } from '../../alert_form/alert_reducer'; @@ -108,7 +109,7 @@ export const AlertDetails: React.FunctionComponent = ({ const [dissmissAlertErrors, setDissmissAlertErrors] = useState(false); const setAlert = async () => { - history.push(routeToAlertDetails.replace(`:alertId`, alert.id)); + history.push(routeToRuleDetails.replace(`:ruleId`, alert.id)); }; const getAlertStatusErrorReasonText = () => { @@ -331,11 +332,20 @@ export const AlertDetails: React.FunctionComponent = ({ ) : ( - +

diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx index e9f961487f4a9..41c70a6737fa0 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.test.tsx @@ -146,7 +146,7 @@ describe('getAlertData useEffect handler', () => { ); expect(toastNotifications.addDanger).toHaveBeenCalledTimes(1); expect(toastNotifications.addDanger).toHaveBeenCalledWith({ - title: 'Unable to load alert: OMG', + title: 'Unable to load rule: OMG', }); }); @@ -192,7 +192,7 @@ describe('getAlertData useEffect handler', () => { ); expect(toastNotifications.addDanger).toHaveBeenCalledTimes(1); expect(toastNotifications.addDanger).toHaveBeenCalledWith({ - title: 'Unable to load alert: OMG no alert type', + title: 'Unable to load rule: OMG no alert type', }); }); @@ -242,7 +242,7 @@ describe('getAlertData useEffect handler', () => { ); expect(toastNotifications.addDanger).toHaveBeenCalledTimes(1); expect(toastNotifications.addDanger).toHaveBeenCalledWith({ - title: 'Unable to load alert: OMG no action type', + title: 'Unable to load rule: OMG no action type', }); }); @@ -290,7 +290,7 @@ describe('getAlertData useEffect handler', () => { ); expect(toastNotifications.addDanger).toHaveBeenCalledTimes(1); expect(toastNotifications.addDanger).toHaveBeenCalledWith({ - title: `Unable to load alert: Invalid Alert Type: ${alert.alertTypeId}`, + title: `Unable to load rule: Invalid Alert Type: ${alert.alertTypeId}`, }); }); @@ -349,7 +349,7 @@ describe('getAlertData useEffect handler', () => { ); expect(toastNotifications.addDanger).toHaveBeenCalledTimes(1); expect(toastNotifications.addDanger).toHaveBeenCalledWith({ - title: `Unable to load alert: Invalid Action Type: ${missingActionType.id}`, + title: `Unable to load rule: Invalid Action Type: ${missingActionType.id}`, }); }); }); @@ -374,12 +374,12 @@ function mockRouterProps(alert: Alert) { return { match: { isExact: false, - path: `/alert/${alert.id}`, + path: `/rule/${alert.id}`, url: '', - params: { alertId: alert.id }, + params: { ruleId: alert.id }, }, history: createMemoryHistory(), - location: createLocation(`/alert/${alert.id}`), + location: createLocation(`/rule/${alert.id}`), }; } function mockAlert(overloads: Partial = {}): Alert { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.tsx index 445e8fa06e7ff..2d6db5f6330cc 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details_route.tsx @@ -24,14 +24,14 @@ import { useKibana } from '../../../../common/lib/kibana'; import { CenterJustifiedSpinner } from '../../../components/center_justified_spinner'; type AlertDetailsRouteProps = RouteComponentProps<{ - alertId: string; + ruleId: string; }> & Pick & Pick; export const AlertDetailsRoute: React.FunctionComponent = ({ match: { - params: { alertId }, + params: { ruleId }, }, loadAlert, loadAlertTypes, @@ -48,7 +48,7 @@ export const AlertDetailsRoute: React.FunctionComponent const [refreshToken, requestRefresh] = React.useState(); useEffect(() => { getAlertData( - alertId, + ruleId, loadAlert, loadAlertTypes, loadActionTypes, @@ -57,7 +57,7 @@ export const AlertDetailsRoute: React.FunctionComponent setActionTypes, toasts ); - }, [alertId, http, loadActionTypes, loadAlert, loadAlertTypes, toasts, refreshToken]); + }, [ruleId, http, loadActionTypes, loadAlert, loadAlertTypes, toasts, refreshToken]); return alert && alertType && actionTypes ? ( { ); expect(toastNotifications.addDanger).toHaveBeenCalledTimes(1); expect(toastNotifications.addDanger).toHaveBeenCalledWith({ - title: 'Unable to load alert instance summary: OMG', + title: 'Unable to load alerts: OMG', }); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances_route.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances_route.tsx index cf5e3e4577977..713e8e8b6cc95 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances_route.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances_route.tsx @@ -69,9 +69,9 @@ export async function getAlertInstanceSummary( } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertInstanceSummaryMessage', + 'xpack.triggersActionsUI.sections.alertDetails.unableToLoadAlertsMessage', { - defaultMessage: 'Unable to load alert instance summary: {message}', + defaultMessage: 'Unable to load alerts: {message}', values: { message: e.message, }, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.tsx index 90fb96b81a775..bcae77f896b71 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_add.tsx @@ -154,9 +154,9 @@ const AlertAdd = ({ const newAlert = await createAlert({ http, alert: alert as AlertUpdates }); toasts.addSuccess( i18n.translate('xpack.triggersActionsUI.sections.alertAdd.saveSuccessNotificationText', { - defaultMessage: 'Created alert "{alertName}"', + defaultMessage: 'Created rule "{ruleName}"', values: { - alertName: newAlert.name, + ruleName: newAlert.name, }, }) ); @@ -165,7 +165,7 @@ const AlertAdd = ({ toasts.addDanger( errorRes.body?.message ?? i18n.translate('xpack.triggersActionsUI.sections.alertAdd.saveErrorNotificationText', { - defaultMessage: 'Cannot create alert.', + defaultMessage: 'Cannot create rule.', }) ); } @@ -183,7 +183,7 @@ const AlertAdd = ({

diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.tsx index 20761c5760be3..d704111858e4f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_edit.tsx @@ -100,9 +100,9 @@ export const AlertEdit = ({ const newAlert = await updateAlert({ http, alert, id: alert.id }); toasts.addSuccess( i18n.translate('xpack.triggersActionsUI.sections.alertEdit.saveSuccessNotificationText', { - defaultMessage: "Updated '{alertName}'", + defaultMessage: "Updated '{ruleName}'", values: { - alertName: newAlert.name, + ruleName: newAlert.name, }, }) ); @@ -121,7 +121,7 @@ export const AlertEdit = ({ toasts.addDanger( errorRes.body?.message ?? i18n.translate('xpack.triggersActionsUI.sections.alertEdit.saveErrorNotificationText', { - defaultMessage: 'Cannot update alert.', + defaultMessage: 'Cannot update rule.', }) ); } @@ -139,7 +139,7 @@ export const AlertEdit = ({

@@ -157,7 +157,7 @@ export const AlertEdit = ({ data-test-subj="hasActionsDisabled" title={i18n.translate( 'xpack.triggersActionsUI.sections.alertEdit.disabledActionsWarningTitle', - { defaultMessage: 'This alert has actions that are disabled' } + { defaultMessage: 'This rule has actions that are disabled' } )} /> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx index 7756f9e92a2cb..fdf398003ab03 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_form.tsx @@ -102,8 +102,8 @@ export function validateBaseProperties(alertObject: InitialAlert): ValidationRes } if (!alertObject.alertTypeId) { errors.alertTypeId.push( - i18n.translate('xpack.triggersActionsUI.sections.alertForm.error.requiredAlertTypeIdText', { - defaultMessage: 'Alert type is required.', + i18n.translate('xpack.triggersActionsUI.sections.alertForm.error.requiredRuleTypeIdText', { + defaultMessage: 'Rule type is required.', }) ); } @@ -113,7 +113,7 @@ export function validateBaseProperties(alertObject: InitialAlert): ValidationRes if (emptyConnectorActions !== undefined) { errors.actionConnectors.push( i18n.translate('xpack.triggersActionsUI.sections.alertForm.error.requiredActionConnector', { - defaultMessage: 'Action connector for {actionTypeId} is required.', + defaultMessage: 'Action for {actionTypeId} connector is required.', values: { actionTypeId: emptyConnectorActions.actionTypeId }, }) ); @@ -277,8 +277,8 @@ export const AlertForm = ({ } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertForm.unableToLoadAlertTypesMessage', - { defaultMessage: 'Unable to load alert types' } + 'xpack.triggersActionsUI.sections.alertForm.unableToLoadRuleTypesMessage', + { defaultMessage: 'Unable to load rule types' } ), }); } @@ -581,8 +581,8 @@ export const AlertForm = ({ fallback={ } @@ -815,8 +815,8 @@ export const AlertForm = ({ className="actActionForm__getMoreActionsLink" >
@@ -826,8 +826,8 @@ export const AlertForm = ({
@@ -876,8 +876,8 @@ export const AlertForm = ({ ) : ( )} @@ -893,8 +893,8 @@ const NoAuthorizedAlertTypes = ({ operation }: { operation: string }) => ( title={

@@ -903,8 +903,8 @@ const NoAuthorizedAlertTypes = ({ operation }: { operation: string }) => (

diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.tsx index ee0f1c4c0ceb8..95fbe9c6ae614 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/alert_notify_when.tsx @@ -49,7 +49,7 @@ const NOTIFY_WHEN_OPTIONS: Array> = [

@@ -62,7 +62,7 @@ const NOTIFY_WHEN_OPTIONS: Array> = [ inputDisplay: i18n.translate( 'xpack.triggersActionsUI.sections.alertForm.alertNotifyWhen.onActiveAlert.display', { - defaultMessage: 'Every time alert is active', + defaultMessage: 'Every time rule is active', } ), 'data-test-subj': 'onActiveAlert', @@ -70,14 +70,14 @@ const NOTIFY_WHEN_OPTIONS: Array> = [

@@ -166,7 +166,7 @@ export const AlertNotifyWhen = ({ position="right" type="questionInCircle" content={i18n.translate('xpack.triggersActionsUI.sections.alertForm.renotifyWithTooltip', { - defaultMessage: 'Define how often to repeat the action while the alert is active.', + defaultMessage: 'Define how often to repeat the action while the rule is active.', })} /> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_close.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_close.tsx index 6d71fe858f1c1..df54ecb921156 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_close.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_close.tsx @@ -21,7 +21,7 @@ export const ConfirmAlertClose: React.FC = ({ onConfirm, onCancel }) => { title={i18n.translate( 'xpack.triggersActionsUI.sections.confirmAlertClose.confirmAlertCloseTitle', { - defaultMessage: 'Discard unsaved changes to alert?', + defaultMessage: 'Discard unsaved changes to rule?', } )} onCancel={onCancel} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_save.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_save.tsx index c406ec7c80283..f81293293f557 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_save.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_form/confirm_alert_save.tsx @@ -21,7 +21,7 @@ export const ConfirmAlertSave: React.FC = ({ onConfirm, onCancel }) => { title={i18n.translate( 'xpack.triggersActionsUI.sections.confirmAlertSave.confirmAlertSaveTitle', { - defaultMessage: 'Save Alert with no actions?', + defaultMessage: 'Save rule with no actions?', } )} onCancel={onCancel} @@ -29,7 +29,7 @@ export const ConfirmAlertSave: React.FC = ({ onConfirm, onCancel }) => { confirmButtonText={i18n.translate( 'xpack.triggersActionsUI.sections.confirmAlertSave.confirmAlertSaveConfirmButtonText', { - defaultMessage: 'Save alert', + defaultMessage: 'Save rule', } )} cancelButtonText={i18n.translate( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx index 65ef771157ee5..d43dd9f05344f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/alerts_list.tsx @@ -47,7 +47,7 @@ import { } from '../../../lib/alert_api'; import { loadActionTypes } from '../../../lib/action_connector_api'; import { hasExecuteActionsCapability } from '../../../lib/capabilities'; -import { routeToAlertDetails, DEFAULT_SEARCH_PAGE_SIZE } from '../../../constants'; +import { routeToRuleDetails, DEFAULT_SEARCH_PAGE_SIZE } from '../../../constants'; import { DeleteModalConfirmation } from '../../../components/delete_modal_confirmation'; import { EmptyPrompt } from '../../../components/prompts/empty_prompt'; import { @@ -154,8 +154,8 @@ export const AlertsList: React.FunctionComponent = () => { } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertTypesMessage', - { defaultMessage: 'Unable to load alert types' } + 'xpack.triggersActionsUI.sections.alertsList.unableToLoadRuleTypesMessage', + { defaultMessage: 'Unable to load rule types' } ), }); setAlertTypesState({ ...alertTypesState, isLoading: false }); @@ -179,8 +179,8 @@ export const AlertsList: React.FunctionComponent = () => { } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.unableToLoadActionTypesMessage', - { defaultMessage: 'Unable to load action types' } + 'xpack.triggersActionsUI.sections.alertsList.unableToLoadConnectorTypesMessage', + { defaultMessage: 'Unable to load connector types' } ), }); } @@ -214,9 +214,9 @@ export const AlertsList: React.FunctionComponent = () => { } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsMessage', + 'xpack.triggersActionsUI.sections.alertsList.unableToLoadRulesMessage', { - defaultMessage: 'Unable to load alerts', + defaultMessage: 'Unable to load rules', } ), }); @@ -240,9 +240,9 @@ export const AlertsList: React.FunctionComponent = () => { } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.unableToLoadAlertsStatusesInfoMessage', + 'xpack.triggersActionsUI.sections.alertsList.unableToLoadRuleStatusInfoMessage', { - defaultMessage: 'Unable to load alert statuses info', + defaultMessage: 'Unable to load rule status info', } ), }); @@ -322,7 +322,7 @@ export const AlertsList: React.FunctionComponent = () => { { - history.push(routeToAlertDetails.replace(`:alertId`, alert.id)); + history.push(routeToRuleDetails.replace(`:ruleId`, alert.id)); }} > {name} @@ -509,8 +509,8 @@ export const AlertsList: React.FunctionComponent = () => { onClick={() => setAlertFlyoutVisibility(true)} > @@ -552,7 +552,7 @@ export const AlertsList: React.FunctionComponent = () => { title={ { { apiDeleteCall={deleteAlerts} idsToDelete={alertsToDelete} singleTitle={i18n.translate('xpack.triggersActionsUI.sections.alertsList.singleTitle', { - defaultMessage: 'alert', + defaultMessage: 'rule', })} multipleTitle={i18n.translate('xpack.triggersActionsUI.sections.alertsList.multipleTitle', { - defaultMessage: 'alerts', + defaultMessage: 'rules', })} setIsLoadingState={(isLoading: boolean) => { setAlertsState({ ...alertsState, isLoading }); @@ -789,7 +789,7 @@ const noPermissionPrompt = (

} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.tsx index 652fa27867770..b5458ee4cb54f 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/collapsed_item_actions.tsx @@ -92,7 +92,7 @@ export const CollapsedItemActions: React.FunctionComponent = ({
@@ -122,7 +122,7 @@ export const CollapsedItemActions: React.FunctionComponent = ({
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/manage_license_modal.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/manage_license_modal.tsx index 4a5739c8b4430..ba1e19959d883 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/manage_license_modal.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/components/manage_license_modal.tsx @@ -51,7 +51,7 @@ export const ManageLicenseModal: React.FC = ({

diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/translations.ts b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/translations.ts index 1a2c576b1fa28..95322fa0d0bcf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/translations.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_list/translations.ts @@ -67,28 +67,28 @@ export const ALERT_ERROR_UNKNOWN_REASON = i18n.translate( export const ALERT_ERROR_READING_REASON = i18n.translate( 'xpack.triggersActionsUI.sections.alertsList.alertErrorReasonReading', { - defaultMessage: 'An error occurred when reading the alert.', + defaultMessage: 'An error occurred when reading the rule.', } ); export const ALERT_ERROR_DECRYPTING_REASON = i18n.translate( 'xpack.triggersActionsUI.sections.alertsList.alertErrorReasonDecrypting', { - defaultMessage: 'An error occurred when decrypting the alert.', + defaultMessage: 'An error occurred when decrypting the rule.', } ); export const ALERT_ERROR_EXECUTION_REASON = i18n.translate( 'xpack.triggersActionsUI.sections.alertsList.alertErrorReasonRunning', { - defaultMessage: 'An error occurred when running the alert.', + defaultMessage: 'An error occurred when running the rule.', } ); export const ALERT_ERROR_LICENSE_REASON = i18n.translate( 'xpack.triggersActionsUI.sections.alertsList.alertErrorReasonLicense', { - defaultMessage: 'Cannot run alert', + defaultMessage: 'Cannot run rule', } ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/alert_quick_edit_buttons.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/alert_quick_edit_buttons.tsx index e40bc4bcf5c83..660c86e97a35e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/alert_quick_edit_buttons.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/alert_quick_edit_buttons.tsx @@ -62,9 +62,9 @@ export const AlertQuickEditButtons: React.FunctionComponent = ({ } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToMuteAlertsMessage', + 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToMuteRulesMessage', { - defaultMessage: 'Failed to mute alert(s)', + defaultMessage: 'Failed to mute rule(s)', } ), }); @@ -82,9 +82,9 @@ export const AlertQuickEditButtons: React.FunctionComponent = ({ } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToUnmuteAlertsMessage', + 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToUnmuteRulesMessage', { - defaultMessage: 'Failed to unmute alert(s)', + defaultMessage: 'Failed to unmute rule(s)', } ), }); @@ -102,9 +102,9 @@ export const AlertQuickEditButtons: React.FunctionComponent = ({ } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToEnableAlertsMessage', + 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToEnableRulesMessage', { - defaultMessage: 'Failed to enable alert(s)', + defaultMessage: 'Failed to enable rule(s)', } ), }); @@ -122,9 +122,9 @@ export const AlertQuickEditButtons: React.FunctionComponent = ({ } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDisableAlertsMessage', + 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDisableRulesMessage', { - defaultMessage: 'Failed to disable alert(s)', + defaultMessage: 'Failed to disable rule(s)', } ), }); @@ -142,9 +142,9 @@ export const AlertQuickEditButtons: React.FunctionComponent = ({ } catch (e) { toasts.addDanger({ title: i18n.translate( - 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDeleteAlertsMessage', + 'xpack.triggersActionsUI.sections.alertsList.bulkActionPopover.failedToDeleteRulesMessage', { - defaultMessage: 'Failed to delete alert(s)', + defaultMessage: 'Failed to delete rule(s)', } ), }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/bulk_operation_popover.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/bulk_operation_popover.tsx index 9b1abcee825bd..56cf856763c94 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/bulk_operation_popover.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/bulk_operation_popover.tsx @@ -26,7 +26,7 @@ export const BulkOperationPopover: React.FunctionComponent = ({ children }) => { > } diff --git a/x-pack/plugins/triggers_actions_ui/public/plugin.ts b/x-pack/plugins/triggers_actions_ui/public/plugin.ts index 0d6089038c5ad..a027f25d15eb7 100644 --- a/x-pack/plugins/triggers_actions_ui/public/plugin.ts +++ b/x-pack/plugins/triggers_actions_ui/public/plugin.ts @@ -95,12 +95,12 @@ export class Plugin const alertTypeRegistry = this.alertTypeRegistry; const featureTitle = i18n.translate('xpack.triggersActionsUI.managementSection.displayName', { - defaultMessage: 'Alerts and Actions', + defaultMessage: 'Rules and Connectors', }); const featureDescription = i18n.translate( 'xpack.triggersActionsUI.managementSection.displayDescription', { - defaultMessage: 'Detect conditions using alerts, and take actions using connectors.', + defaultMessage: 'Detect conditions using rules, and take actions using connectors.', } ); diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index 1be511b0cbb5b..132915922fcea 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -76,6 +76,7 @@ const onlyNotInCoverageTests = [ require.resolve('../test/send_search_to_background_integration/config.ts'), require.resolve('../test/saved_object_tagging/api_integration/security_and_spaces/config.ts'), require.resolve('../test/saved_object_tagging/api_integration/tagging_api/config.ts'), + require.resolve('../test/examples/config.ts'), ]; require('../../src/setup_node_env'); diff --git a/x-pack/test/examples/config.ts b/x-pack/test/examples/config.ts new file mode 100644 index 0000000000000..dd087772ae52c --- /dev/null +++ b/x-pack/test/examples/config.ts @@ -0,0 +1,53 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; +import { resolve } from 'path'; +import fs from 'fs'; +import { KIBANA_ROOT } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config')); + + // Find all folders in /examples and /x-pack/examples since we treat all them as plugin folder + const examplesFiles = fs.readdirSync(resolve(KIBANA_ROOT, 'examples')); + const examples = examplesFiles.filter((file) => + fs.statSync(resolve(KIBANA_ROOT, 'examples', file)).isDirectory() + ); + + const xpackExamplesFiles = fs.readdirSync(resolve(KIBANA_ROOT, 'x-pack/examples')); + const xpackExamples = xpackExamplesFiles.filter((file) => + fs.statSync(resolve(KIBANA_ROOT, 'x-pack/examples', file)).isDirectory() + ); + + return { + // default to the xpack functional config + ...xpackFunctionalConfig.getAll(), + + junit: { + reportName: 'X-Pack Example plugin functional tests', + }, + + testFiles: [require.resolve('./search_examples')], + + kbnTestServer: { + ...xpackFunctionalConfig.get('kbnTestServer'), + + serverArgs: [ + ...xpackFunctionalConfig.get('kbnTestServer.serverArgs'), + // Required to load new platform plugins via `--plugin-path` flag. + '--env.name=development', + ...examples.map( + (exampleDir) => `--plugin-path=${resolve(KIBANA_ROOT, 'examples', exampleDir)}` + ), + ...xpackExamples.map( + (exampleDir) => `--plugin-path=${resolve(KIBANA_ROOT, 'x-pack/examples', exampleDir)}` + ), + ], + }, + }; +} diff --git a/x-pack/test/examples/search_examples/index.ts b/x-pack/test/examples/search_examples/index.ts new file mode 100644 index 0000000000000..2cac0d1b60de7 --- /dev/null +++ b/x-pack/test/examples/search_examples/index.ts @@ -0,0 +1,28 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { PluginFunctionalProviderContext } from 'test/plugin_functional/services'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService, loadTestFile }: PluginFunctionalProviderContext) { + const esArchiver = getService('esArchiver'); + + describe('search examples', function () { + this.tags('ciGroup13'); + before(async () => { + await esArchiver.emptyKibanaIndex(); + await esArchiver.loadIfNeeded('logstash_functional'); + await esArchiver.loadIfNeeded('lens/basic'); // need at least one index pattern + }); + + after(async () => { + await esArchiver.unload('lens/basic'); + }); + + loadTestFile(require.resolve('./search_session_example')); + }); +} diff --git a/x-pack/test/examples/search_examples/search_session_example.ts b/x-pack/test/examples/search_examples/search_session_example.ts new file mode 100644 index 0000000000000..4834fbddea899 --- /dev/null +++ b/x-pack/test/examples/search_examples/search_session_example.ts @@ -0,0 +1,47 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../functional/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['common']); + const log = getService('log'); + const es = getService('es'); + const searchSessions = getService('searchSessions'); + + describe('Search session example', () => { + const appId = 'searchExamples'; + + before(async function () { + const { body } = await es.info(); + if (!body.version.number.includes('SNAPSHOT')) { + log.debug('Skipping because this build does not have the required shard_delay agg'); + this.skip(); + return; + } + + await PageObjects.common.navigateToApp(appId, { insertTimestamp: false }); + await testSubjects.click('/search-sessions'); + }); + + after(async () => { + await searchSessions.deleteAllSearchSessions(); + }); + + it('should start search, save session, restore session using "restore" button', async () => { + await testSubjects.clickWhenNotDisabled('startSearch'); + await testSubjects.find('searchResults-1'); + await searchSessions.expectState('completed'); + await searchSessions.save(); + await searchSessions.expectState('backgroundCompleted'); + await testSubjects.click('restoreSearch'); + await testSubjects.find('searchResults-2'); + }); + }); +} diff --git a/x-pack/test/functional/services/index.ts b/x-pack/test/functional/services/index.ts index 968aa7ebeb92d..0da518a5e8967 100644 --- a/x-pack/test/functional/services/index.ts +++ b/x-pack/test/functional/services/index.ts @@ -58,6 +58,7 @@ import { DashboardDrilldownsManageProvider, DashboardPanelTimeRangeProvider, } from './dashboard'; +import { SearchSessionsProvider } from './search_sessions'; // define the name and providers for services that should be // available to your tests. If you don't specify anything here @@ -106,4 +107,5 @@ export const services = { dashboardDrilldownPanelActions: DashboardDrilldownPanelActionsProvider, dashboardDrilldownsManage: DashboardDrilldownsManageProvider, dashboardPanelTimeRange: DashboardPanelTimeRangeProvider, + searchSessions: SearchSessionsProvider, }; diff --git a/x-pack/test/functional/services/ml/navigation.ts b/x-pack/test/functional/services/ml/navigation.ts index 57ee7e5ad0954..93b8a5efecc07 100644 --- a/x-pack/test/functional/services/ml/navigation.ts +++ b/x-pack/test/functional/services/ml/navigation.ts @@ -38,7 +38,7 @@ export function MachineLearningNavigationProvider({ async navigateToAlertsAndAction() { await PageObjects.common.navigateToApp('triggersActions'); - await testSubjects.click('alertsTab'); + await testSubjects.click('rulesTab'); await testSubjects.existOrFail('alertsList'); }, diff --git a/x-pack/test/send_search_to_background_integration/services/search_sessions.ts b/x-pack/test/functional/services/search_sessions.ts similarity index 100% rename from x-pack/test/send_search_to_background_integration/services/search_sessions.ts rename to x-pack/test/functional/services/search_sessions.ts diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts index e6eb6f2d65350..d73488fab2373 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alert_create_flyout.ts @@ -100,7 +100,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('create alert', function () { before(async () => { await pageObjects.common.navigateToApp('triggersActions'); - await testSubjects.click('alertsTab'); + await testSubjects.click('rulesTab'); }); it('should create an alert', async () => { @@ -144,7 +144,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('saveAlertButton'); const toastTitle = await pageObjects.common.closeToast(); - expect(toastTitle).to.eql(`Created alert "${alertName}"`); + expect(toastTitle).to.eql(`Created rule "${alertName}"`); await pageObjects.triggersActionsUI.searchAlerts(alertName); const searchResultsAfterSave = await pageObjects.triggersActionsUI.getAlertsList(); expect(searchResultsAfterSave).to.eql([ @@ -195,7 +195,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('saveAlertButton'); const toastTitle = await pageObjects.common.closeToast(); - expect(toastTitle).to.eql(`Created alert "${alertName}"`); + expect(toastTitle).to.eql(`Created rule "${alertName}"`); await pageObjects.triggersActionsUI.searchAlerts(alertName); const searchResultsAfterSave = await pageObjects.triggersActionsUI.getAlertsList(); expect(searchResultsAfterSave).to.eql([ @@ -228,7 +228,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.missingOrFail('confirmAlertSaveModal'); const toastTitle = await pageObjects.common.closeToast(); - expect(toastTitle).to.eql(`Created alert "${alertName}"`); + expect(toastTitle).to.eql(`Created rule "${alertName}"`); await pageObjects.triggersActionsUI.searchAlerts(alertName); const searchResultsAfterSave = await pageObjects.triggersActionsUI.getAlertsList(); expect(searchResultsAfterSave).to.eql([ diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts index 829fd9c85cbf0..e24d5a4ccf653 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts @@ -51,13 +51,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { } async function refreshAlertsList() { - await testSubjects.click('alertsTab'); + await testSubjects.click('rulesTab'); } describe('alerts list', function () { before(async () => { await pageObjects.common.navigateToApp('triggersActions'); - await testSubjects.click('alertsTab'); + await testSubjects.click('rulesTab'); }); afterEach(async () => { @@ -218,7 +218,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await retry.try(async () => { const toastTitle = await pageObjects.common.closeToast(); - expect(toastTitle).to.eql('Deleted 1 alert'); + expect(toastTitle).to.eql('Deleted 1 rule'); }); await pageObjects.triggersActionsUI.searchAlerts(secondAlert.name); @@ -339,7 +339,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await retry.try(async () => { const toastTitle = await pageObjects.common.closeToast(); - expect(toastTitle).to.eql('Deleted 1 alert'); + expect(toastTitle).to.eql('Deleted 1 rule'); }); await pageObjects.triggersActionsUI.searchAlerts(namePrefix); @@ -404,13 +404,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await ( await alertsErrorBannerExistErrors[0].findByCssSelector('.euiCallOutHeader') ).getVisibleText() - ).to.equal('Error found in 1 alert.'); + ).to.equal('Error found in 1 rule.'); }); await refreshAlertsList(); - expect(await testSubjects.getVisibleText('totalAlertsCount')).to.be( - 'Showing: 2 of 2 alerts.' - ); + expect(await testSubjects.getVisibleText('totalAlertsCount')).to.be('Showing: 2 of 2 rules.'); expect(await testSubjects.getVisibleText('totalActiveAlertsCount')).to.be('Active: 0'); expect(await testSubjects.getVisibleText('totalOkAlertsCount')).to.be('Ok: 1'); expect(await testSubjects.getVisibleText('totalErrorAlertsCount')).to.be('Error: 1'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts index 0017f7ba04b87..d27be915be512 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts @@ -355,7 +355,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { expect(toastTitle).to.eql('Deleted 1 connector'); // click on first alert - await pageObjects.triggersActionsUI.changeTabs('alertsTab'); + await pageObjects.triggersActionsUI.changeTabs('rulesTab'); await pageObjects.triggersActionsUI.clickOnAlertInAlertsList(alert.name); const editButton = await testSubjects.find('openEditAlertFlyoutButton'); @@ -415,7 +415,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { expect(toastTitle).to.eql('Deleted 1 connector'); // click on first alert - await pageObjects.triggersActionsUI.changeTabs('alertsTab'); + await pageObjects.triggersActionsUI.changeTabs('rulesTab'); await pageObjects.triggersActionsUI.clickOnAlertInAlertsList(alert.name); const editButton = await testSubjects.find('openEditAlertFlyoutButton'); @@ -480,7 +480,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.alertDetailsUI.clickViewInApp(); - expect(await pageObjects.alertDetailsUI.getNoOpAppTitle()).to.be(`View Alert ${alert.id}`); + expect(await pageObjects.alertDetailsUI.getNoOpAppTitle()).to.be(`View Rule ${alert.id}`); }); it('renders a disabled alert details view in app button', async () => { diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts index 6c23a04a0a8d2..1b1288e4b4db8 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts @@ -31,7 +31,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('Loads the Alerts page', async () => { await pageObjects.common.navigateToApp('triggersActions'); const headingText = await pageObjects.triggersActionsUI.getSectionHeadingText(); - expect(headingText).to.be('Alerts and Actions'); + expect(headingText).to.be('Rules and Connectors'); }); }); @@ -45,10 +45,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('Loads the Alerts page', async () => { - await log.debug('Checking for section heading to say Triggers and Actions.'); + await log.debug('Checking for section heading to say Rules and Connectors.'); const headingText = await pageObjects.triggersActionsUI.getSectionHeadingText(); - expect(headingText).to.be('Alerts and Actions'); + expect(headingText).to.be('Rules and Connectors'); }); describe('Connectors tab', () => { @@ -70,13 +70,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Alerts tab', () => { it('renders the alerts tab', async () => { // Navigate to the alerts tab - await pageObjects.triggersActionsUI.changeTabs('alertsTab'); + await pageObjects.triggersActionsUI.changeTabs('rulesTab'); await pageObjects.header.waitUntilLoadingHasFinished(); // Verify url const url = await browser.getCurrentUrl(); - expect(url).to.contain(`/alerts`); + expect(url).to.contain(`/rules`); // Verify content await testSubjects.existOrFail('alertsList'); @@ -109,7 +109,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.triggersActionsUI.clickOnAlertInAlertsList(createdAlert.name); // Verify url - expect(await browser.getCurrentUrl()).to.contain(`/alert/${createdAlert.id}`); + expect(await browser.getCurrentUrl()).to.contain(`/rule/${createdAlert.id}`); }); }); }); diff --git a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/application.tsx b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/application.tsx index b15f2031e3a2b..2198ce456be4f 100644 --- a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/application.tsx +++ b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/application.tsx @@ -21,11 +21,11 @@ const AlertingExampleApp = (deps: AlertingExampleComponentParams) => { ) => { return ( -

View Alert {props.match.params.id}

+

View Rule {props.match.params.id}

); }} diff --git a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/plugin.ts b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/plugin.ts index e314ced54d0a2..48a3aca742c72 100644 --- a/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/plugin.ts +++ b/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/public/plugin.ts @@ -24,7 +24,7 @@ export class AlertingFixturePlugin implements Plugin `/alert/${alert.id}` + (alert: SanitizedAlert, alertType: AlertType) => `/rule/${alert.id}` ); triggersActionsUi.alertTypeRegistry.register({ diff --git a/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts b/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts index 7b5e0c81479f9..8d4311a3ec322 100644 --- a/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts +++ b/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts @@ -138,7 +138,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext) await this.searchAlerts(name); await find.clickDisplayedByCssSelector(`[data-test-subj="alertsList"] [title="${name}"]`); }, - async changeTabs(tab: 'alertsTab' | 'connectorsTab') { + async changeTabs(tab: 'rulesTab' | 'connectorsTab') { await testSubjects.click(tab); }, async toggleSwitch(testSubject: string) { diff --git a/x-pack/test/send_search_to_background_integration/config.ts b/x-pack/test/send_search_to_background_integration/config.ts index 2763ebb63c3ef..af87e521bd302 100644 --- a/x-pack/test/send_search_to_background_integration/config.ts +++ b/x-pack/test/send_search_to_background_integration/config.ts @@ -7,8 +7,7 @@ import { resolve } from 'path'; import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; -import { services as functionalServices } from '../functional/services'; -import { services } from './services'; +import { services } from '../functional/services'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config')); @@ -35,9 +34,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { '--xpack.data_enhanced.search.sessions.enabled=true', // enable WIP send to background UI ], }, - services: { - ...functionalServices, - ...services, - }, + services, }; } diff --git a/x-pack/test/send_search_to_background_integration/ftr_provider_context.d.ts b/x-pack/test/send_search_to_background_integration/ftr_provider_context.d.ts index 58ebd71086130..c65eeb91fe5b9 100644 --- a/x-pack/test/send_search_to_background_integration/ftr_provider_context.d.ts +++ b/x-pack/test/send_search_to_background_integration/ftr_provider_context.d.ts @@ -7,6 +7,6 @@ import { GenericFtrProviderContext } from '@kbn/test/types/ftr'; import { pageObjects } from '../functional/page_objects'; -import { services } from './services'; +import { services } from '../functional/services'; export type FtrProviderContext = GenericFtrProviderContext;