- Page: {"notifications":{"toasts":{}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"apiKeysAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}}}
+ Page: {"notifications":{"toasts":{}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"apiKeysAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}}}
`);
diff --git a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx
index 86f54bca88dbd..9c41d6624065e 100644
--- a/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx
+++ b/x-pack/plugins/security/public/management/role_mappings/role_mappings_management_app.test.tsx
@@ -53,7 +53,7 @@ describe('roleMappingsManagementApp', () => {
expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `#${basePath}`, text: 'Role Mappings' }]);
expect(container).toMatchInlineSnapshot(`
- Role Mappings Page: {"notifications":{"toasts":{}},"roleMappingsAPI":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"}}
+ Role Mappings Page: {"notifications":{"toasts":{}},"roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"}}
`);
@@ -75,7 +75,7 @@ describe('roleMappingsManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Role Mapping Edit Page: {"roleMappingsAPI":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"}}
+ Role Mapping Edit Page: {"roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"}}
`);
@@ -98,7 +98,7 @@ describe('roleMappingsManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Role Mapping Edit Page: {"name":"someRoleMappingName","roleMappingsAPI":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"}}
+ Role Mapping Edit Page: {"name":"someRoleMappingName","roleMappingsAPI":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"}}
`);
diff --git a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx
index 48bc1a6580a93..5936409eb6e8b 100644
--- a/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx
+++ b/x-pack/plugins/security/public/management/roles/roles_management_app.test.tsx
@@ -64,7 +64,7 @@ describe('rolesManagementApp', () => {
expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `#${basePath}`, text: 'Roles' }]);
expect(container).toMatchInlineSnapshot(`
- Roles Page: {"notifications":{"toasts":{}},"rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}}}
+ Roles Page: {"notifications":{"toasts":{}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}}}
`);
@@ -86,7 +86,7 @@ describe('rolesManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Role Edit Page: {"action":"edit","rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"userAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}}}
+ Role Edit Page: {"action":"edit","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}}}
`);
@@ -109,7 +109,7 @@ describe('rolesManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Role Edit Page: {"action":"edit","roleName":"someRoleName","rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"userAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}}}
+ Role Edit Page: {"action":"edit","roleName":"someRoleName","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}}}
`);
@@ -132,7 +132,7 @@ describe('rolesManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Role Edit Page: {"action":"clone","roleName":"someRoleName","rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"userAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}}}
+ Role Edit Page: {"action":"clone","roleName":"someRoleName","rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"userAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"indicesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"privilegesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"fatalErrors":{},"license":{"features$":{"_isScalar":false}},"docLinks":{"esDocBasePath":"https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/"},"uiCapabilities":{"catalogue":{},"management":{},"navLinks":{}}}
`);
diff --git a/x-pack/plugins/security/public/management/users/users_management_app.test.tsx b/x-pack/plugins/security/public/management/users/users_management_app.test.tsx
index 48ffcfc550a84..fd81756f176f7 100644
--- a/x-pack/plugins/security/public/management/users/users_management_app.test.tsx
+++ b/x-pack/plugins/security/public/management/users/users_management_app.test.tsx
@@ -58,7 +58,7 @@ describe('usersManagementApp', () => {
expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `#${basePath}`, text: 'Users' }]);
expect(container).toMatchInlineSnapshot(`
- Users Page: {"notifications":{"toasts":{}},"apiClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}}}
+ Users Page: {"notifications":{"toasts":{}},"apiClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}}}
`);
@@ -80,7 +80,7 @@ describe('usersManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- User Edit Page: {"authc":{},"apiClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}}}
+ User Edit Page: {"authc":{},"apiClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}}}
`);
@@ -103,7 +103,7 @@ describe('usersManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- User Edit Page: {"authc":{},"apiClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}},"username":"someUserName"}
+ User Edit Page: {"authc":{},"apiClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"rolesAPIClient":{"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}}},"notifications":{"toasts":{}},"username":"someUserName"}
`);
diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx
index b19ef995283da..2e274e08ee13b 100644
--- a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx
+++ b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx
@@ -81,7 +81,7 @@ describe('spacesManagementApp', () => {
expect(setBreadcrumbs).toHaveBeenCalledWith([{ href: `#${basePath}`, text: 'Spaces' }]);
expect(container).toMatchInlineSnapshot(`
- Spaces Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"securityEnabled":true}
+ Spaces Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"securityEnabled":true}
`);
@@ -103,7 +103,7 @@ describe('spacesManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"securityEnabled":true}
+ Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"securityEnabled":true}
`);
@@ -126,7 +126,7 @@ describe('spacesManagementApp', () => {
]);
expect(container).toMatchInlineSnapshot(`
- Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"spaceId":"some-space","securityEnabled":true}
+ Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"http":{"basePath":{"basePath":"","serverBasePath":""},"anonymousPaths":{}},"notifications":{"toasts":{}},"spacesManager":{"onActiveSpaceChange$":{"_isScalar":false}},"spaceId":"some-space","securityEnabled":true}
`);
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index b171863f26c21..4b06645cdfe04 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -250,13 +250,6 @@
"common.ui.flotCharts.wedLabel": "水",
"common.ui.paginateControls.pageSizeLabel": "ページサイズ",
"common.ui.paginateControls.scrollTopButtonLabel": "最上部に移動",
- "common.ui.savedObjects.confirmModal.overwriteButtonLabel": "上書き",
- "common.ui.savedObjects.confirmModal.overwriteConfirmationMessage": "{title} を上書きしてよろしいですか?",
- "common.ui.savedObjects.confirmModal.overwriteTitle": "{name} を上書きしますか?",
- "common.ui.savedObjects.confirmModal.saveDuplicateButtonLabel": "{name} を保存",
- "common.ui.savedObjects.confirmModal.saveDuplicateConfirmationMessage": "「{title}」というタイトルの {name} が既に存在します。保存を続けますか?",
- "common.ui.savedObjects.overwriteRejectedDescription": "上書き確認が拒否されました",
- "common.ui.savedObjects.saveDuplicateRejectedDescription": "重複ファイルの保存確認が拒否されました",
"common.ui.scriptingLanguages.errorFetchingToastDescription": "Elasticsearch から利用可能なスクリプト言語の取得中にエラーが発生しました",
"common.ui.stateManagement.unableToParseUrlErrorMessage": "URL をパースできません",
"common.ui.stateManagement.unableToRestoreUrlErrorMessage": "URL を完全に復元できません。共有機能を使用していることを確認してください。",
@@ -1449,7 +1442,6 @@
"kbn.management.indexPatterns.listBreadcrumb": "インデックスパターン",
"kbn.management.indexPatternTable.createBtn": "インデックスパターンの作成",
"kbn.management.indexPatternTable.title": "インデックスパターン",
- "kbn.management.landing.header": "Kibana {version} 管理",
"kbn.management.landing.subhead": "インデックス、インデックスパターン、保存されたオブジェクト、Kibana の設定、その他を管理します。",
"kbn.management.landing.text": "すべてのツールの一覧は、左のメニューにあります。",
"kbn.management.objects.confirmModalOptions.deleteButtonLabel": "削除",
@@ -2440,12 +2432,19 @@
"regionMap.visParams.vectorMapLabel": "ベクトルマップ",
"regionMap.visualization.unableToShowMismatchesWarningText": "次の各用語がシェイプの結合フィールドのシェイプと一致することを確認してください: {mismatches}",
"regionMap.visualization.unableToShowMismatchesWarningTitle": "{mismatchesLength} {oneMismatch, plural, one { 件の結果} other { 件の結果}}をマップに表示できません",
+ "savedObjects.confirmModal.overwriteButtonLabel": "上書き",
+ "savedObjects.confirmModal.overwriteConfirmationMessage": "{title} を上書きしてよろしいですか?",
+ "savedObjects.confirmModal.overwriteTitle": "{name} を上書きしますか?",
+ "savedObjects.confirmModal.saveDuplicateButtonLabel": "{name} を保存",
+ "savedObjects.confirmModal.saveDuplicateConfirmationMessage": "「{title}」というタイトルの {name} が既に存在します。保存を続けますか?",
"savedObjects.finder.filterButtonLabel": "タイプ",
"savedObjects.finder.searchPlaceholder": "検索...",
"savedObjects.finder.sortAsc": "昇順",
"savedObjects.finder.sortAuto": "ベストマッチ",
"savedObjects.finder.sortButtonLabel": "並べ替え",
"savedObjects.finder.sortDesc": "降順",
+ "savedObjects.overwriteRejectedDescription": "上書き確認が拒否されました",
+ "savedObjects.saveDuplicateRejectedDescription": "重複ファイルの保存確認が拒否されました",
"savedObjects.saveModal.cancelButtonLabel": "キャンセル",
"savedObjects.saveModal.descriptionLabel": "説明",
"savedObjects.saveModal.duplicateTitleDescription": "{confirmSaveLabel} をクリックすると、既存の {objectType} が上書きされます。",
@@ -2698,8 +2697,6 @@
"timelion.help.functions.points.args.symbolHelpText": "点のシンボルです。{validSymbols} の 1 つ",
"timelion.help.functions.points.args.weightHelpText": "点の周りの太さです",
"timelion.help.functions.pointsHelpText": "数列を点として表示します",
- "timelion.help.functions.precision.args.precisionHelpText": "各値を四捨五入する桁数です",
- "timelion.help.functions.precisionHelpText": "値の小数点以下の四捨五入する桁数です",
"timelion.help.functions.props.args.globalHelpText": "各数列に対し、seriesList にプロップを設定します",
"timelion.help.functions.propsHelpText": "数列に任意のプロパティを設定するため、自己責任で行ってください。例: {example}",
"timelion.help.functions.quandl.args.codeHelpText": "プロットする Quandl コードです。これらは quandl.com に掲載されています。",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 050e9bd40f58d..ecf4dfbb33be6 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -250,13 +250,6 @@
"common.ui.flotCharts.wedLabel": "周三",
"common.ui.paginateControls.pageSizeLabel": "页面大小",
"common.ui.paginateControls.scrollTopButtonLabel": "滚动至顶部",
- "common.ui.savedObjects.confirmModal.overwriteButtonLabel": "覆盖",
- "common.ui.savedObjects.confirmModal.overwriteConfirmationMessage": "确定要覆盖 “{title}”?",
- "common.ui.savedObjects.confirmModal.overwriteTitle": "覆盖“{name}”?",
- "common.ui.savedObjects.confirmModal.saveDuplicateButtonLabel": "保存“{name}”",
- "common.ui.savedObjects.confirmModal.saveDuplicateConfirmationMessage": "具有标题 “{title}” 的 “{name}” 已存在。是否确定要保存?",
- "common.ui.savedObjects.overwriteRejectedDescription": "已拒绝覆盖确认",
- "common.ui.savedObjects.saveDuplicateRejectedDescription": "已拒绝使用重复标题保存确认",
"common.ui.scriptingLanguages.errorFetchingToastDescription": "从 Elasticsearch 获取可用的脚本语言时出错",
"common.ui.stateManagement.unableToParseUrlErrorMessage": "无法解析 URL",
"common.ui.stateManagement.unableToRestoreUrlErrorMessage": "无法完整还原 URL,确保使用共享功能。",
@@ -1449,7 +1442,6 @@
"kbn.management.indexPatterns.listBreadcrumb": "索引模式",
"kbn.management.indexPatternTable.createBtn": "创建索引模式",
"kbn.management.indexPatternTable.title": "索引模式",
- "kbn.management.landing.header": "Kibana {version} 管理",
"kbn.management.landing.subhead": "管理您的索引、索引模式、已保存对象、Kibana 设置等等。",
"kbn.management.landing.text": "在左侧菜单中可找到完整工具列表",
"kbn.management.objects.confirmModalOptions.deleteButtonLabel": "删除",
@@ -2440,12 +2432,19 @@
"regionMap.visParams.vectorMapLabel": "矢量地图",
"regionMap.visualization.unableToShowMismatchesWarningText": "确保每个字词与该形状的联接字段匹配:{mismatches}",
"regionMap.visualization.unableToShowMismatchesWarningTitle": "无法在地图上显示 {mismatchesLength} {oneMismatch, plural, one { 个结果} other { 个结果}}",
+ "savedObjects.confirmModal.overwriteButtonLabel": "覆盖",
+ "savedObjects.confirmModal.overwriteConfirmationMessage": "确定要覆盖 “{title}”?",
+ "savedObjects.confirmModal.overwriteTitle": "覆盖“{name}”?",
+ "savedObjects.confirmModal.saveDuplicateButtonLabel": "保存“{name}”",
+ "savedObjects.confirmModal.saveDuplicateConfirmationMessage": "具有标题 “{title}” 的 “{name}” 已存在。是否确定要保存?",
"savedObjects.finder.filterButtonLabel": "类型",
"savedObjects.finder.searchPlaceholder": "搜索……",
"savedObjects.finder.sortAsc": "升序",
"savedObjects.finder.sortAuto": "最佳匹配",
"savedObjects.finder.sortButtonLabel": "排序",
"savedObjects.finder.sortDesc": "降序",
+ "savedObjects.overwriteRejectedDescription": "已拒绝覆盖确认",
+ "savedObjects.saveDuplicateRejectedDescription": "已拒绝使用重复标题保存确认",
"savedObjects.saveModal.cancelButtonLabel": "取消",
"savedObjects.saveModal.descriptionLabel": "描述",
"savedObjects.saveModal.duplicateTitleDescription": "单击“{confirmSaveLabel}”可覆盖现有 {objectType}。",
@@ -2698,8 +2697,6 @@
"timelion.help.functions.points.args.symbolHelpText": "点符号。以下选项之一:{validSymbols}",
"timelion.help.functions.points.args.weightHelpText": "围绕点的线条粗细",
"timelion.help.functions.pointsHelpText": "将序列显示为点",
- "timelion.help.functions.precision.args.precisionHelpText": "将每个值舍入到的小数位数",
- "timelion.help.functions.precisionHelpText": "将值的小数部分舍入到的小数位数",
"timelion.help.functions.props.args.globalHelpText": "在 seriesList 与每个序列上设置属性",
"timelion.help.functions.propsHelpText": "在序列上可设置任意属性,但请自担风险。例如 {example}",
"timelion.help.functions.quandl.args.codeHelpText": "要绘图的 quandl 代码。可以在 quandl.com 找到这些内容。",
diff --git a/x-pack/plugins/watcher/server/index.ts b/x-pack/plugins/watcher/server/index.ts
index 51eb7bfa543fe..356be781fb194 100644
--- a/x-pack/plugins/watcher/server/index.ts
+++ b/x-pack/plugins/watcher/server/index.ts
@@ -6,4 +6,6 @@
import { PluginInitializerContext } from 'kibana/server';
import { WatcherServerPlugin } from './plugin';
+export { WatcherContext } from './plugin';
+
export const plugin = (ctx: PluginInitializerContext) => new WatcherServerPlugin(ctx);
diff --git a/x-pack/plugins/watcher/server/lib/call_with_request_factory.ts b/x-pack/plugins/watcher/server/lib/call_with_request_factory.ts
deleted file mode 100644
index 4884c75436c24..0000000000000
--- a/x-pack/plugins/watcher/server/lib/call_with_request_factory.ts
+++ /dev/null
@@ -1,28 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { ElasticsearchServiceSetup } from 'kibana/server';
-import { once } from 'lodash';
-import { elasticsearchJsPlugin } from './elasticsearch_js_plugin';
-
-const callWithRequest = once((elasticsearchService: ElasticsearchServiceSetup) => {
- const config = { plugins: [elasticsearchJsPlugin] };
- return elasticsearchService.createClient('watcher', config);
-});
-
-export const callWithRequestFactory = (
- elasticsearchService: ElasticsearchServiceSetup,
- request: any
-) => {
- return (...args: any[]) => {
- return (
- callWithRequest(elasticsearchService)
- .asScoped(request)
- // @ts-ignore
- .callAsCurrentUser(...args)
- );
- };
-};
diff --git a/x-pack/plugins/watcher/server/lib/fetch_all_from_scroll/fetch_all_from_scroll.ts b/x-pack/plugins/watcher/server/lib/fetch_all_from_scroll/fetch_all_from_scroll.ts
index de01bd5965504..8e8ca369dd02b 100644
--- a/x-pack/plugins/watcher/server/lib/fetch_all_from_scroll/fetch_all_from_scroll.ts
+++ b/x-pack/plugins/watcher/server/lib/fetch_all_from_scroll/fetch_all_from_scroll.ts
@@ -4,24 +4,31 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
import { ES_SCROLL_SETTINGS } from '../../../common/constants';
-export function fetchAllFromScroll(response: any, callWithRequest: any, hits: any[] = []) {
- const newHits = get(response, 'hits.hits', []);
- const scrollId = get(response, '_scroll_id');
+export function fetchAllFromScroll(
+ searchResuls: any,
+ dataClient: IScopedClusterClient,
+ hits: any[] = []
+): Promise {
+ const newHits = get(searchResuls, 'hits.hits', []);
+ const scrollId = get(searchResuls, '_scroll_id');
if (newHits.length > 0) {
hits.push(...newHits);
- return callWithRequest('scroll', {
- body: {
- scroll: ES_SCROLL_SETTINGS.KEEPALIVE,
- scroll_id: scrollId,
- },
- }).then((innerResponse: any) => {
- return fetchAllFromScroll(innerResponse, callWithRequest, hits);
- });
+ return dataClient
+ .callAsCurrentUser('scroll', {
+ body: {
+ scroll: ES_SCROLL_SETTINGS.KEEPALIVE,
+ scroll_id: scrollId,
+ },
+ })
+ .then((innerResponse: any) => {
+ return fetchAllFromScroll(innerResponse, dataClient, hits);
+ });
}
return Promise.resolve(hits);
diff --git a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts b/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts
index d010a23952725..1b2476fc78b45 100644
--- a/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts
+++ b/x-pack/plugins/watcher/server/lib/license_pre_routing_factory/license_pre_routing_factory.ts
@@ -12,13 +12,13 @@ import {
} from 'kibana/server';
import { RouteDependencies } from '../../types';
-export const licensePreRoutingFactory = (
+export const licensePreRoutingFactory = (
{ getLicenseStatus }: RouteDependencies,
- handler: RequestHandler
+ handler: RequestHandler
) => {
return function licenseCheck(
ctx: RequestHandlerContext,
- request: KibanaRequest,
+ request: KibanaRequest
,
response: KibanaResponseFactory
) {
const licenseStatus = getLicenseStatus();
diff --git a/x-pack/plugins/watcher/server/plugin.ts b/x-pack/plugins/watcher/server/plugin.ts
index 1f7b3823609ec..51d85c2001bd2 100644
--- a/x-pack/plugins/watcher/server/plugin.ts
+++ b/x-pack/plugins/watcher/server/plugin.ts
@@ -3,7 +3,20 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'kibana/server';
+
+declare module 'kibana/server' {
+ interface RequestHandlerContext {
+ watcher?: WatcherContext;
+ }
+}
+
+import {
+ CoreSetup,
+ IScopedClusterClient,
+ Logger,
+ Plugin,
+ PluginInitializerContext,
+} from 'kibana/server';
import { PLUGIN } from '../common/constants';
import { Dependencies, LicenseStatus, RouteDependencies } from './types';
import { LICENSE_CHECK_STATE } from '../../licensing/server';
@@ -15,6 +28,11 @@ import { registerWatchesRoutes } from './routes/api/watches';
import { registerWatchRoutes } from './routes/api/watch';
import { registerListFieldsRoute } from './routes/api/register_list_fields_route';
import { registerLoadHistoryRoute } from './routes/api/register_load_history_route';
+import { elasticsearchJsPlugin } from './lib/elasticsearch_js_plugin';
+
+export interface WatcherContext {
+ client: IScopedClusterClient;
+}
export class WatcherServerPlugin implements Plugin {
log: Logger;
@@ -31,15 +49,20 @@ export class WatcherServerPlugin implements Plugin {
{ http, elasticsearch: elasticsearchService }: CoreSetup,
{ licensing }: Dependencies
) {
- const elasticsearch = await elasticsearchService.adminClient;
const router = http.createRouter();
const routeDependencies: RouteDependencies = {
- elasticsearch,
- elasticsearchService,
router,
getLicenseStatus: () => this.licenseStatus,
};
+ const config = { plugins: [elasticsearchJsPlugin] };
+ const watcherESClient = elasticsearchService.createClient('watcher', config);
+ http.registerRouteHandlerContext('watcher', (ctx, request) => {
+ return {
+ client: watcherESClient.asScoped(request),
+ };
+ });
+
registerListFieldsRoute(routeDependencies);
registerLoadHistoryRoute(routeDependencies);
registerIndicesRoutes(routeDependencies);
diff --git a/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts b/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts
index 30607b82e3295..df6f62135baeb 100644
--- a/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/indices/register_get_route.ts
@@ -5,13 +5,14 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { reduce, size } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { isEsError } from '../../../lib/is_es_error';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
+const bodySchema = schema.object({ pattern: schema.string() }, { allowUnknowns: true });
+
function getIndexNamesFromAliasesResponse(json: Record) {
return reduce(
json,
@@ -26,67 +27,66 @@ function getIndexNamesFromAliasesResponse(json: Record) {
);
}
-function getIndices(callWithRequest: any, pattern: string, limit = 10) {
- return callWithRequest('indices.getAlias', {
- index: pattern,
- ignore: [404],
- }).then((aliasResult: any) => {
- if (aliasResult.status !== 404) {
- const indicesFromAliasResponse = getIndexNamesFromAliasesResponse(aliasResult);
- return indicesFromAliasResponse.slice(0, limit);
- }
-
- const params = {
+function getIndices(dataClient: IScopedClusterClient, pattern: string, limit = 10) {
+ return dataClient
+ .callAsCurrentUser('indices.getAlias', {
index: pattern,
ignore: [404],
- body: {
- size: 0, // no hits
- aggs: {
- indices: {
- terms: {
- field: '_index',
- size: limit,
+ })
+ .then((aliasResult: any) => {
+ if (aliasResult.status !== 404) {
+ const indicesFromAliasResponse = getIndexNamesFromAliasesResponse(aliasResult);
+ return indicesFromAliasResponse.slice(0, limit);
+ }
+
+ const params = {
+ index: pattern,
+ ignore: [404],
+ body: {
+ size: 0, // no hits
+ aggs: {
+ indices: {
+ terms: {
+ field: '_index',
+ size: limit,
+ },
},
},
},
- },
- };
+ };
- return callWithRequest('search', params).then((response: any) => {
- if (response.status === 404 || !response.aggregations) {
- return [];
- }
- return response.aggregations.indices.buckets.map((bucket: any) => bucket.key);
+ return dataClient.callAsCurrentUser('search', params).then((response: any) => {
+ if (response.status === 404 || !response.aggregations) {
+ return [];
+ }
+ return response.aggregations.indices.buckets.map((bucket: any) => bucket.key);
+ });
});
- });
}
export function registerGetRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const { pattern } = request.body;
-
- try {
- const indices = await getIndices(callWithRequest, pattern);
- return response.ok({ body: { indices } });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.post(
{
path: '/api/watcher/indices',
validate: {
- body: schema.object({}, { allowUnknowns: true }),
+ body: bodySchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { pattern } = request.body;
+
+ try {
+ const indices = await getIndices(ctx.watcher!.client, pattern);
+ return response.ok({ body: { indices } });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts b/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts
index a61fd16e8be4a..bd537cd6d21ab 100644
--- a/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/license/register_refresh_route.ts
@@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { RequestHandler } from 'kibana/server';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
/*
@@ -13,16 +12,15 @@ it needs to make a round-trip to the kibana server. This refresh endpoint is pro
for when the client needs to check the license, but doesn't need to pull data from the
server for any reason, i.e., when adding a new watch.
*/
-export function registerRefreshRoute(deps: RouteDependencies) {
- const handler: RequestHandler = (ctx, request, response) => {
- return response.ok({ body: { success: true } });
- };
+export function registerRefreshRoute(deps: RouteDependencies) {
deps.router.get(
{
path: '/api/watcher/license/refresh',
validate: false,
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, (ctx, request, response) => {
+ return response.ok({ body: { success: true } });
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts b/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts
index 7c47379b87589..d72e5ad2f817d 100644
--- a/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/register_list_fields_route.ts
@@ -5,15 +5,18 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
-import { callWithRequestFactory } from '../../lib/call_with_request_factory';
+import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../lib/is_es_error';
// @ts-ignore
import { Fields } from '../../models/fields/index';
import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory';
import { RouteDependencies } from '../../types';
-function fetchFields(callWithRequest: any, indexes: string[]) {
+const bodySchema = schema.object({
+ indexes: schema.arrayOf(schema.string()),
+});
+
+function fetchFields(dataClient: IScopedClusterClient, indexes: string[]) {
const params = {
index: indexes,
fields: ['*'],
@@ -22,44 +25,39 @@ function fetchFields(callWithRequest: any, indexes: string[]) {
ignore: 404,
};
- return callWithRequest('fieldCaps', params);
+ return dataClient.callAsCurrentUser('fieldCaps', params);
}
export function registerListFieldsRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const { indexes } = request.body;
-
- try {
- const fieldsResponse = await fetchFields(callWithRequest, indexes);
- const json = fieldsResponse.status === 404 ? { fields: [] } : fieldsResponse;
- const fields = Fields.fromUpstreamJson(json);
- return response.ok({ body: fields.downstreamJson });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({
- statusCode: e.statusCode,
- body: {
- message: e.message,
- },
- });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.post(
{
path: '/api/watcher/fields',
validate: {
- body: schema.object({
- indexes: schema.arrayOf(schema.string()),
- }),
+ body: bodySchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { indexes } = request.body;
+
+ try {
+ const fieldsResponse = await fetchFields(ctx.watcher!.client, indexes);
+ const json = fieldsResponse.status === 404 ? { fields: [] } : fieldsResponse;
+ const fields = Fields.fromUpstreamJson(json);
+ return response.ok({ body: fields.downstreamJson });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({
+ statusCode: e.statusCode,
+ body: {
+ message: e.message,
+ },
+ });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts b/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts
index 1be8477df79bc..8c9068123ce8d 100644
--- a/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/register_load_history_route.ts
@@ -6,8 +6,7 @@
import { schema } from '@kbn/config-schema';
import { get } from 'lodash';
-import { RequestHandler } from 'kibana/server';
-import { callWithRequestFactory } from '../../lib/call_with_request_factory';
+import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../lib/is_es_error';
import { INDEX_NAMES } from '../../../common/constants';
import { RouteDependencies } from '../../types';
@@ -15,8 +14,12 @@ import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory'
// @ts-ignore
import { WatchHistoryItem } from '../../models/watch_history_item/index';
-function fetchHistoryItem(callWithRequest: any, watchHistoryItemId: string) {
- return callWithRequest('search', {
+const paramsSchema = schema.object({
+ id: schema.string(),
+});
+
+function fetchHistoryItem(dataClient: IScopedClusterClient, watchHistoryItemId: string) {
+ return dataClient.callAsCurrentUser('search', {
index: INDEX_NAMES.WATCHER_HISTORY,
body: {
query: {
@@ -29,49 +32,44 @@ function fetchHistoryItem(callWithRequest: any, watchHistoryItemId: string) {
}
export function registerLoadHistoryRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const id = request.params.id;
-
- try {
- const responseFromES = await fetchHistoryItem(callWithRequest, id);
- const hit = get(responseFromES, 'hits.hits[0]');
- if (!hit) {
- return response.notFound({ body: `Watch History Item with id = ${id} not found` });
- }
- const watchHistoryItemJson = get(hit, '_source');
- const watchId = get(hit, '_source.watch_id');
- const json = {
- id,
- watchId,
- watchHistoryItemJson,
- includeDetails: true,
- };
-
- const watchHistoryItem = WatchHistoryItem.fromUpstreamJson(json);
- return response.ok({
- body: { watchHistoryItem: watchHistoryItem.downstreamJson },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.get(
{
path: '/api/watcher/history/{id}',
validate: {
- params: schema.object({
- id: schema.string(),
- }),
+ params: paramsSchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const id = request.params.id;
+
+ try {
+ const responseFromES = await fetchHistoryItem(ctx.watcher!.client, id);
+ const hit = get(responseFromES, 'hits.hits[0]');
+ if (!hit) {
+ return response.notFound({ body: `Watch History Item with id = ${id} not found` });
+ }
+ const watchHistoryItemJson = get(hit, '_source');
+ const watchId = get(hit, '_source.watch_id');
+ const json = {
+ id,
+ watchId,
+ watchHistoryItemJson,
+ includeDetails: true,
+ };
+
+ const watchHistoryItem = WatchHistoryItem.fromUpstreamJson(json);
+ return response.ok({
+ body: { watchHistoryItem: watchHistoryItem.downstreamJson },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts b/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts
index 6c70c2d0d07b6..fe9dd32735692 100644
--- a/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/settings/register_load_route.ts
@@ -4,14 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { IClusterClient, RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../lib/is_es_error';
// @ts-ignore
import { Settings } from '../../../models/settings/index';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
-function fetchClusterSettings(client: IClusterClient) {
+function fetchClusterSettings(client: IScopedClusterClient) {
return client.callAsInternalUser('cluster.getSettings', {
includeDefaults: true,
filterPath: '**.xpack.notification',
@@ -19,25 +19,24 @@ function fetchClusterSettings(client: IClusterClient) {
}
export function registerLoadRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- try {
- const settings = await fetchClusterSettings(deps.elasticsearch);
- return response.ok({ body: Settings.fromUpstreamJson(settings).downstreamJson });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
deps.router.get(
{
path: '/api/watcher/settings',
validate: false,
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ try {
+ const settings = await fetchClusterSettings(ctx.watcher!.client);
+ return response.ok({ body: Settings.fromUpstreamJson(settings).downstreamJson });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts
index 08eec7456e3a5..9e024a63b82c5 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/action/register_acknowledge_route.ts
@@ -6,60 +6,58 @@
import { schema } from '@kbn/config-schema';
import { get } from 'lodash';
-import { RequestHandler } from 'kibana/server';
-import { callWithRequestFactory } from '../../../../lib/call_with_request_factory';
+import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../../lib/is_es_error';
// @ts-ignore
import { WatchStatus } from '../../../../models/watch_status/index';
import { RouteDependencies } from '../../../../types';
import { licensePreRoutingFactory } from '../../../../lib/license_pre_routing_factory';
-function acknowledgeAction(callWithRequest: any, watchId: string, actionId: string) {
- return callWithRequest('watcher.ackWatch', {
+const paramsSchema = schema.object({
+ watchId: schema.string(),
+ actionId: schema.string(),
+});
+
+function acknowledgeAction(dataClient: IScopedClusterClient, watchId: string, actionId: string) {
+ return dataClient.callAsCurrentUser('watcher.ackWatch', {
id: watchId,
action: actionId,
});
}
export function registerAcknowledgeRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const { watchId, actionId } = request.params;
-
- try {
- const hit = await acknowledgeAction(callWithRequest, watchId, actionId);
- const watchStatusJson = get(hit, 'status');
- const json = {
- id: watchId,
- watchStatusJson,
- };
-
- const watchStatus = WatchStatus.fromUpstreamJson(json);
- return response.ok({
- body: { watchStatus: watchStatus.downstreamJson },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
- return response.customError({ statusCode: e.statusCode, body });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.put(
{
path: '/api/watcher/watch/{watchId}/action/{actionId}/acknowledge',
validate: {
- params: schema.object({
- watchId: schema.string(),
- actionId: schema.string(),
- }),
+ params: paramsSchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { watchId, actionId } = request.params;
+
+ try {
+ const hit = await acknowledgeAction(ctx.watcher!.client, watchId, actionId);
+ const watchStatusJson = get(hit, 'status');
+ const json = {
+ id: watchId,
+ watchStatusJson,
+ };
+
+ const watchStatus = WatchStatus.fromUpstreamJson(json);
+ return response.ok({
+ body: { watchStatus: watchStatus.downstreamJson },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
+ return response.customError({ statusCode: e.statusCode, body });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts
index fdc20854ed8c2..1afeeb4e80efb 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_activate_route.ts
@@ -5,62 +5,59 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { isEsError } from '../../../lib/is_es_error';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore
import { WatchStatus } from '../../../models/watch_status/index';
-function activateWatch(callWithRequest: any, watchId: string) {
- return callWithRequest('watcher.activateWatch', {
+function activateWatch(dataClient: IScopedClusterClient, watchId: string) {
+ return dataClient.callAsCurrentUser('watcher.activateWatch', {
id: watchId,
});
}
-export function registerActivateRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
-
- const { watchId } = request.params;
-
- try {
- const hit = await activateWatch(callWithRequest, watchId);
- const watchStatusJson = get(hit, 'status');
- const json = {
- id: watchId,
- watchStatusJson,
- };
-
- const watchStatus = WatchStatus.fromUpstreamJson(json);
- return response.ok({
- body: {
- watchStatus: watchStatus.downstreamJson,
- },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
- return response.customError({ statusCode: e.statusCode, body });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
+const paramsSchema = schema.object({
+ watchId: schema.string(),
+});
+export function registerActivateRoute(deps: RouteDependencies) {
deps.router.put(
{
path: '/api/watcher/watch/{watchId}/activate',
validate: {
- params: schema.object({
- watchId: schema.string(),
- }),
+ params: paramsSchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { watchId } = request.params;
+
+ try {
+ const hit = await activateWatch(ctx.watcher!.client, watchId);
+ const watchStatusJson = get(hit, 'status');
+ const json = {
+ id: watchId,
+ watchStatusJson,
+ };
+
+ const watchStatus = WatchStatus.fromUpstreamJson(json);
+ return response.ok({
+ body: {
+ watchStatus: watchStatus.downstreamJson,
+ },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
+ return response.customError({ statusCode: e.statusCode, body });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts
index 08d99f42df054..3171d8ee2e1e5 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_deactivate_route.ts
@@ -3,63 +3,61 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
+
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { isEsError } from '../../../lib/is_es_error';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore
import { WatchStatus } from '../../../models/watch_status/index';
-function deactivateWatch(callWithRequest: any, watchId: string) {
- return callWithRequest('watcher.deactivateWatch', {
+const paramsSchema = schema.object({
+ watchId: schema.string(),
+});
+
+function deactivateWatch(dataClient: IScopedClusterClient, watchId: string) {
+ return dataClient.callAsCurrentUser('watcher.deactivateWatch', {
id: watchId,
});
}
export function registerDeactivateRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
-
- const { watchId } = request.params;
-
- try {
- const hit = await deactivateWatch(callWithRequest, watchId);
- const watchStatusJson = get(hit, 'status');
- const json = {
- id: watchId,
- watchStatusJson,
- };
-
- const watchStatus = WatchStatus.fromUpstreamJson(json);
- return response.ok({
- body: {
- watchStatus: watchStatus.downstreamJson,
- },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
- return response.customError({ statusCode: e.statusCode, body });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.put(
{
path: '/api/watcher/watch/{watchId}/deactivate',
validate: {
- params: schema.object({
- watchId: schema.string(),
- }),
+ params: paramsSchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { watchId } = request.params;
+
+ try {
+ const hit = await deactivateWatch(ctx.watcher!.client, watchId);
+ const watchStatusJson = get(hit, 'status');
+ const json = {
+ id: watchId,
+ watchStatusJson,
+ };
+
+ const watchStatus = WatchStatus.fromUpstreamJson(json);
+ return response.ok({
+ body: {
+ watchStatus: watchStatus.downstreamJson,
+ },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
+ return response.customError({ statusCode: e.statusCode, body });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts
index 6e95cf959bc9c..bfdf328550bbe 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_delete_route.ts
@@ -5,49 +5,46 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
+import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../lib/is_es_error';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
-function deleteWatch(callWithRequest: any, watchId: string) {
- return callWithRequest('watcher.deleteWatch', {
+const paramsSchema = schema.object({
+ watchId: schema.string(),
+});
+
+function deleteWatch(dataClient: IScopedClusterClient, watchId: string) {
+ return dataClient.callAsCurrentUser('watcher.deleteWatch', {
id: watchId,
});
}
export function registerDeleteRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
-
- const { watchId } = request.params;
-
- try {
- return response.ok({
- body: await deleteWatch(callWithRequest, watchId),
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
- return response.customError({ statusCode: e.statusCode, body });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.delete(
{
path: '/api/watcher/watch/{watchId}',
validate: {
- params: schema.object({
- watchId: schema.string(),
- }),
+ params: paramsSchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { watchId } = request.params;
+
+ try {
+ return response.ok({
+ body: await deleteWatch(ctx.watcher!.client, watchId),
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ const body = e.statusCode === 404 ? `Watch with id = ${watchId} not found` : e;
+ return response.customError({ statusCode: e.statusCode, body });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts
index fef6d07317da5..7aaa77c05a5f0 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_execute_route.ts
@@ -5,9 +5,8 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { isEsError } from '../../../lib/is_es_error';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
@@ -19,60 +18,63 @@ import { Watch } from '../../../models/watch/index';
// @ts-ignore
import { WatchHistoryItem } from '../../../models/watch_history_item/index';
-function executeWatch(callWithRequest: any, executeDetails: any, watchJson: any) {
+const bodySchema = schema.object({
+ executeDetails: schema.object({}, { allowUnknowns: true }),
+ watch: schema.object({}, { allowUnknowns: true }),
+});
+
+function executeWatch(dataClient: IScopedClusterClient, executeDetails: any, watchJson: any) {
const body = executeDetails;
body.watch = watchJson;
- return callWithRequest('watcher.executeWatch', {
+ return dataClient.callAsCurrentUser('watcher.executeWatch', {
body,
});
}
export function registerExecuteRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const executeDetails = ExecuteDetails.fromDownstreamJson(request.body.executeDetails);
- const watch = Watch.fromDownstreamJson(request.body.watch);
-
- try {
- const hit = await executeWatch(callWithRequest, executeDetails.upstreamJson, watch.watchJson);
- const id = get(hit, '_id');
- const watchHistoryItemJson = get(hit, 'watch_record');
- const watchId = get(hit, 'watch_record.watch_id');
- const json = {
- id,
- watchId,
- watchHistoryItemJson,
- includeDetails: true,
- };
-
- const watchHistoryItem = WatchHistoryItem.fromUpstreamJson(json);
- return response.ok({
- body: {
- watchHistoryItem: watchHistoryItem.downstreamJson,
- },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.put(
{
path: '/api/watcher/watch/execute',
validate: {
- body: schema.object({
- executeDetails: schema.object({}, { allowUnknowns: true }),
- watch: schema.object({}, { allowUnknowns: true }),
- }),
+ body: bodySchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const executeDetails = ExecuteDetails.fromDownstreamJson(request.body.executeDetails);
+ const watch = Watch.fromDownstreamJson(request.body.watch);
+
+ try {
+ const hit = await executeWatch(
+ ctx.watcher!.client,
+ executeDetails.upstreamJson,
+ watch.watchJson
+ );
+ const id = get(hit, '_id');
+ const watchHistoryItemJson = get(hit, 'watch_record');
+ const watchId = get(hit, 'watch_record.watch_id');
+ const json = {
+ id,
+ watchId,
+ watchHistoryItemJson,
+ includeDetails: true,
+ };
+
+ const watchHistoryItem = WatchHistoryItem.fromUpstreamJson(json);
+ return response.ok({
+ body: {
+ watchHistoryItem: watchHistoryItem.downstreamJson,
+ },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts
index 7f0f1ac8d66a3..b64c28e114b72 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_history_route.ts
@@ -5,9 +5,8 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll';
import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants';
import { isEsError } from '../../../lib/is_es_error';
@@ -16,7 +15,15 @@ import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_facto
// @ts-ignore
import { WatchHistoryItem } from '../../../models/watch_history_item/index';
-function fetchHistoryItems(callWithRequest: any, watchId: any, startTime: any) {
+const paramsSchema = schema.object({
+ watchId: schema.string(),
+});
+
+const querySchema = schema.object({
+ startTime: schema.string(),
+});
+
+function fetchHistoryItems(dataClient: IScopedClusterClient, watchId: any, startTime: any) {
const params: any = {
index: INDEX_NAMES.WATCHER_HISTORY,
scroll: ES_SCROLL_SETTINGS.KEEPALIVE,
@@ -37,61 +44,57 @@ function fetchHistoryItems(callWithRequest: any, watchId: any, startTime: any) {
params.body.query.bool.must.push(timeRangeQuery);
}
- return callWithRequest('search', params).then((response: any) =>
- fetchAllFromScroll(response, callWithRequest)
- );
+ return dataClient
+ .callAsCurrentUser('search', params)
+ .then((response: any) => fetchAllFromScroll(response, dataClient));
}
export function registerHistoryRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const { watchId } = request.params;
- const { startTime } = request.query;
-
- try {
- const hits = await fetchHistoryItems(callWithRequest, watchId, startTime);
- const watchHistoryItems = hits.map((hit: any) => {
- const id = get(hit, '_id');
- const watchHistoryItemJson = get(hit, '_source');
-
- const opts = { includeDetails: false };
- return WatchHistoryItem.fromUpstreamJson(
- {
- id,
- watchId,
- watchHistoryItemJson,
- },
- opts
- );
- });
-
- return response.ok({
- body: {
- watchHistoryItems: watchHistoryItems.map(
- (watchHistoryItem: any) => watchHistoryItem.downstreamJson
- ),
- },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.get(
{
path: '/api/watcher/watch/{watchId}/history',
validate: {
- params: schema.object({
- watchId: schema.string(),
- }),
+ params: paramsSchema,
+ query: querySchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { watchId } = request.params;
+ const { startTime } = request.query;
+
+ try {
+ const hits = await fetchHistoryItems(ctx.watcher!.client, watchId, startTime);
+ const watchHistoryItems = hits.map((hit: any) => {
+ const id = get(hit, '_id');
+ const watchHistoryItemJson = get(hit, '_source');
+
+ const opts = { includeDetails: false };
+ return WatchHistoryItem.fromUpstreamJson(
+ {
+ id,
+ watchId,
+ watchHistoryItemJson,
+ },
+ opts
+ );
+ });
+
+ return response.ok({
+ body: {
+ watchHistoryItems: watchHistoryItems.map(
+ (watchHistoryItem: any) => watchHistoryItem.downstreamJson
+ ),
+ },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts
index 91d71cd737121..6363054921333 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_load_route.ts
@@ -5,65 +5,63 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { isEsError } from '../../../lib/is_es_error';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
// @ts-ignore
import { Watch } from '../../../models/watch/index';
import { RouteDependencies } from '../../../types';
-function fetchWatch(callWithRequest: any, watchId: string) {
- return callWithRequest('watcher.getWatch', {
+const paramsSchema = schema.object({
+ id: schema.string(),
+});
+
+function fetchWatch(dataClient: IScopedClusterClient, watchId: string) {
+ return dataClient.callAsCurrentUser('watcher.getWatch', {
id: watchId,
});
}
export function registerLoadRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
-
- const id = request.params.id;
-
- try {
- const hit = await fetchWatch(callWithRequest, id);
- const watchJson = get(hit, 'watch');
- const watchStatusJson = get(hit, 'status');
- const json = {
- id,
- watchJson,
- watchStatusJson,
- };
-
- const watch = Watch.fromUpstreamJson(json, {
- throwExceptions: {
- Action: false,
- },
- });
- return response.ok({
- body: { watch: watch.downstreamJson },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- const body = e.statusCode === 404 ? `Watch with id = ${id} not found` : e;
- return response.customError({ statusCode: e.statusCode, body });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
deps.router.get(
{
path: '/api/watcher/watch/{id}',
validate: {
- params: schema.object({
- id: schema.string(),
- }),
+ params: paramsSchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const id = request.params.id;
+
+ try {
+ const hit = await fetchWatch(ctx.watcher!.client, id);
+ const watchJson = get(hit, 'watch');
+ const watchStatusJson = get(hit, 'status');
+ const json = {
+ id,
+ watchJson,
+ watchStatusJson,
+ };
+
+ const watch = Watch.fromUpstreamJson(json, {
+ throwExceptions: {
+ Action: false,
+ },
+ });
+ return response.ok({
+ body: { watch: watch.downstreamJson },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ const body = e.statusCode === 404 ? `Watch with id = ${id} not found` : e;
+ return response.customError({ statusCode: e.statusCode, body });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts
index 7986424e6229a..572790f12a5f8 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_save_route.ts
@@ -5,98 +5,104 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { i18n } from '@kbn/i18n';
import { WATCH_TYPES } from '../../../../common/constants';
import { serializeJsonWatch, serializeThresholdWatch } from '../../../../common/lib/serialization';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { isEsError } from '../../../lib/is_es_error';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
-function fetchWatch(callWithRequest: any, watchId: string) {
- return callWithRequest('watcher.getWatch', {
+const paramsSchema = schema.object({
+ id: schema.string(),
+});
+
+const bodySchema = schema.object(
+ {
+ type: schema.string(),
+ isNew: schema.boolean(),
+ },
+ { allowUnknowns: true }
+);
+
+function fetchWatch(dataClient: IScopedClusterClient, watchId: string) {
+ return dataClient.callAsCurrentUser('watcher.getWatch', {
id: watchId,
});
}
-function saveWatch(callWithRequest: any, id: string, body: any) {
- return callWithRequest('watcher.putWatch', {
+function saveWatch(dataClient: IScopedClusterClient, id: string, body: any) {
+ return dataClient.callAsCurrentUser('watcher.putWatch', {
id,
body,
});
}
export function registerSaveRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const { id } = request.params;
- const { type, isNew, ...watchConfig } = request.body;
+ deps.router.put(
+ {
+ path: '/api/watcher/watch/{id}',
+ validate: {
+ params: paramsSchema,
+ body: bodySchema,
+ },
+ },
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const { id } = request.params;
+ const { type, isNew, ...watchConfig } = request.body;
- // For new watches, verify watch with the same ID doesn't already exist
- if (isNew) {
- try {
- const existingWatch = await fetchWatch(callWithRequest, id);
- if (existingWatch.found) {
- return response.conflict({
- body: {
- message: i18n.translate('xpack.watcher.saveRoute.duplicateWatchIdErrorMessage', {
- defaultMessage: "There is already a watch with ID '{watchId}'.",
- values: {
- watchId: id,
- },
- }),
- },
- });
- }
- } catch (e) {
- const es404 = isEsError(e) && e.statusCode === 404;
- if (!es404) {
- return response.internalError({ body: e });
+ // For new watches, verify watch with the same ID doesn't already exist
+ if (isNew) {
+ try {
+ const existingWatch = await fetchWatch(ctx.watcher!.client, id);
+ if (existingWatch.found) {
+ return response.conflict({
+ body: {
+ message: i18n.translate('xpack.watcher.saveRoute.duplicateWatchIdErrorMessage', {
+ defaultMessage: "There is already a watch with ID '{watchId}'.",
+ values: {
+ watchId: id,
+ },
+ }),
+ },
+ });
+ }
+ } catch (e) {
+ const es404 = isEsError(e) && e.statusCode === 404;
+ if (!es404) {
+ return response.internalError({ body: e });
+ }
+ // Else continue...
}
- // Else continue...
}
- }
- let serializedWatch;
+ let serializedWatch;
- switch (type) {
- case WATCH_TYPES.JSON:
- const { name, watch } = watchConfig;
- serializedWatch = serializeJsonWatch(name, watch);
- break;
+ switch (type) {
+ case WATCH_TYPES.JSON:
+ const { name, watch } = watchConfig as any;
+ serializedWatch = serializeJsonWatch(name, watch);
+ break;
- case WATCH_TYPES.THRESHOLD:
- serializedWatch = serializeThresholdWatch(watchConfig);
- break;
- }
-
- try {
- // Create new watch
- return response.ok({
- body: await saveWatch(callWithRequest, id, serializedWatch),
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
+ case WATCH_TYPES.THRESHOLD:
+ serializedWatch = serializeThresholdWatch(watchConfig);
+ break;
}
- // Case: default
- return response.internalError({ body: e });
- }
- };
+ try {
+ // Create new watch
+ return response.ok({
+ body: await saveWatch(ctx.watcher!.client, id, serializedWatch),
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
- deps.router.put(
- {
- path: '/api/watcher/watch/{id}',
- validate: {
- params: schema.object({
- id: schema.string(),
- }),
- body: schema.object({}, { allowUnknowns: true }),
- },
- },
- licensePreRoutingFactory(deps, handler)
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts b/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts
index f2110bcc0ebdb..200b35953b6f2 100644
--- a/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watch/register_visualize_route.ts
@@ -5,8 +5,7 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
+import { IScopedClusterClient } from 'kibana/server';
import { isEsError } from '../../../lib/is_es_error';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
@@ -16,7 +15,12 @@ import { Watch } from '../../../models/watch/index';
// @ts-ignore
import { VisualizeOptions } from '../../../models/visualize_options/index';
-function fetchVisualizeData(callWithRequest: any, index: any, body: any) {
+const bodySchema = schema.object({
+ watch: schema.object({}, { allowUnknowns: true }),
+ options: schema.object({}, { allowUnknowns: true }),
+});
+
+function fetchVisualizeData(dataClient: IScopedClusterClient, index: any, body: any) {
const params = {
index,
body,
@@ -25,46 +29,40 @@ function fetchVisualizeData(callWithRequest: any, index: any, body: any) {
ignore: [404],
};
- return callWithRequest('search', params);
+ return dataClient.callAsCurrentUser('search', params);
}
export function registerVisualizeRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
- const watch = Watch.fromDownstreamJson(request.body.watch);
- const options = VisualizeOptions.fromDownstreamJson(request.body.options);
- const body = watch.getVisualizeQuery(options);
-
- try {
- const hits = await fetchVisualizeData(callWithRequest, watch.index, body);
- const visualizeData = watch.formatVisualizeData(hits);
-
- return response.ok({
- body: {
- visualizeData,
- },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({ statusCode: e.statusCode, body: e });
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
-
deps.router.post(
{
path: '/api/watcher/watch/visualize',
validate: {
- body: schema.object({
- watch: schema.object({}, { allowUnknowns: true }),
- options: schema.object({}, { allowUnknowns: true }),
- }),
+ body: bodySchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ const watch = Watch.fromDownstreamJson(request.body.watch);
+ const options = VisualizeOptions.fromDownstreamJson(request.body.options);
+ const body = watch.getVisualizeQuery(options);
+
+ try {
+ const hits = await fetchVisualizeData(ctx.watcher!.client, watch.index, body);
+ const visualizeData = watch.formatVisualizeData(hits);
+
+ return response.ok({
+ body: {
+ visualizeData,
+ },
+ });
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({ statusCode: e.statusCode, body: e });
+ }
+
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts b/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts
index 2ac824529f9a6..71e0a77bff972 100644
--- a/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watches/register_delete_route.ts
@@ -5,16 +5,20 @@
*/
import { schema } from '@kbn/config-schema';
-import { RequestHandler } from 'kibana/server';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
+import { IScopedClusterClient } from 'kibana/server';
import { RouteDependencies } from '../../../types';
import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_factory';
-function deleteWatches(callWithRequest: any, watchIds: string[]) {
+const bodySchema = schema.object({
+ watchIds: schema.arrayOf(schema.string()),
+});
+
+function deleteWatches(dataClient: IScopedClusterClient, watchIds: string[]) {
const deletePromises = watchIds.map(watchId => {
- return callWithRequest('watcher.deleteWatch', {
- id: watchId,
- })
+ return dataClient
+ .callAsCurrentUser('watcher.deleteWatch', {
+ id: watchId,
+ })
.then((success: Array<{ _id: string }>) => ({ success }))
.catch((error: Array<{ _id: string }>) => ({ error }));
});
@@ -22,7 +26,7 @@ function deleteWatches(callWithRequest: any, watchIds: string[]) {
return Promise.all(deletePromises).then(results => {
const errors: Error[] = [];
const successes: boolean[] = [];
- results.forEach(({ success, error }) => {
+ results.forEach(({ success, error }: { success?: any; error?: any }) => {
if (success) {
successes.push(success._id);
} else if (error) {
@@ -38,26 +42,20 @@ function deleteWatches(callWithRequest: any, watchIds: string[]) {
}
export function registerDeleteRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
-
- try {
- const results = await deleteWatches(callWithRequest, request.body.watchIds);
- return response.ok({ body: { results } });
- } catch (e) {
- return response.internalError({ body: e });
- }
- };
-
deps.router.post(
{
path: '/api/watcher/watches/delete',
validate: {
- body: schema.object({
- watchIds: schema.arrayOf(schema.string()),
- }),
+ body: bodySchema,
},
},
- licensePreRoutingFactory(deps, handler)
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ try {
+ const results = await deleteWatches(ctx.watcher!.client, request.body.watchIds);
+ return response.ok({ body: { results } });
+ } catch (e) {
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts b/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts
index fcbdf688a2ab4..5e823a0a8d2de 100644
--- a/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts
+++ b/x-pack/plugins/watcher/server/routes/api/watches/register_list_route.ts
@@ -4,9 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { RequestHandler } from 'kibana/server';
+import { IScopedClusterClient } from 'kibana/server';
import { get } from 'lodash';
-import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
import { fetchAllFromScroll } from '../../../lib/fetch_all_from_scroll';
import { INDEX_NAMES, ES_SCROLL_SETTINGS } from '../../../../common/constants';
import { isEsError } from '../../../lib/is_es_error';
@@ -15,7 +14,7 @@ import { licensePreRoutingFactory } from '../../../lib/license_pre_routing_facto
// @ts-ignore
import { Watch } from '../../../models/watch/index';
-function fetchWatches(callWithRequest: any) {
+function fetchWatches(dataClient: IScopedClusterClient) {
const params = {
index: INDEX_NAMES.WATCHES,
scroll: ES_SCROLL_SETTINGS.KEEPALIVE,
@@ -25,62 +24,58 @@ function fetchWatches(callWithRequest: any) {
ignore: [404],
};
- return callWithRequest('search', params).then((response: any) =>
- fetchAllFromScroll(response, callWithRequest)
- );
+ return dataClient
+ .callAsCurrentUser('search', params)
+ .then((response: any) => fetchAllFromScroll(response, dataClient));
}
export function registerListRoute(deps: RouteDependencies) {
- const handler: RequestHandler = async (ctx, request, response) => {
- const callWithRequest = callWithRequestFactory(deps.elasticsearchService, request);
-
- try {
- const hits = await fetchWatches(callWithRequest);
- const watches = hits.map((hit: any) => {
- const id = get(hit, '_id');
- const watchJson = get(hit, '_source');
- const watchStatusJson = get(hit, '_source.status');
+ deps.router.get(
+ {
+ path: '/api/watcher/watches',
+ validate: false,
+ },
+ licensePreRoutingFactory(deps, async (ctx, request, response) => {
+ try {
+ const hits = await fetchWatches(ctx.watcher!.client);
+ const watches = hits.map((hit: any) => {
+ const id = get(hit, '_id');
+ const watchJson = get(hit, '_source');
+ const watchStatusJson = get(hit, '_source.status');
- return Watch.fromUpstreamJson(
- {
- id,
- watchJson,
- watchStatusJson,
- },
- {
- throwExceptions: {
- Action: false,
+ return Watch.fromUpstreamJson(
+ {
+ id,
+ watchJson,
+ watchStatusJson,
},
- }
- );
- });
+ {
+ throwExceptions: {
+ Action: false,
+ },
+ }
+ );
+ });
- return response.ok({
- body: {
- watches: watches.map((watch: any) => watch.downstreamJson),
- },
- });
- } catch (e) {
- // Case: Error from Elasticsearch JS client
- if (isEsError(e)) {
- return response.customError({
- statusCode: e.statusCode,
+ return response.ok({
body: {
- message: e.message,
+ watches: watches.map((watch: any) => watch.downstreamJson),
},
});
- }
-
- // Case: default
- return response.internalError({ body: e });
- }
- };
+ } catch (e) {
+ // Case: Error from Elasticsearch JS client
+ if (isEsError(e)) {
+ return response.customError({
+ statusCode: e.statusCode,
+ body: {
+ message: e.message,
+ },
+ });
+ }
- deps.router.get(
- {
- path: '/api/watcher/watches',
- validate: false,
- },
- licensePreRoutingFactory(deps, handler)
+ // Case: default
+ return response.internalError({ body: e });
+ }
+ })
);
}
diff --git a/x-pack/plugins/watcher/server/types.ts b/x-pack/plugins/watcher/server/types.ts
index d9f2d3c3b1e7a..dd941054114a8 100644
--- a/x-pack/plugins/watcher/server/types.ts
+++ b/x-pack/plugins/watcher/server/types.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { IRouter, ElasticsearchServiceSetup, IClusterClient } from 'kibana/server';
+import { IRouter } from 'kibana/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { XPackMainPlugin } from '../../../legacy/plugins/xpack_main/server/xpack_main';
@@ -24,8 +24,6 @@ export interface ServerShim {
export interface RouteDependencies {
router: IRouter;
getLicenseStatus: () => LicenseStatus;
- elasticsearchService: ElasticsearchServiceSetup;
- elasticsearch: IClusterClient;
}
export interface LicenseStatus {
diff --git a/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts b/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts
index 47afe7553fe62..1c7245234b089 100644
--- a/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts
+++ b/x-pack/test/api_integration/apis/ml/bucket_span_estimator.ts
@@ -69,6 +69,23 @@ export default ({ getService }: FtrProviderContext) => {
responseBody: { name: '3h', ms: 10800000 },
},
},
+ {
+ testTitleSuffix: 'with 1 field, 1 agg, no split, and empty filters',
+ user: USER.ML_POWERUSER,
+ requestBody: {
+ aggTypes: ['avg'],
+ duration: { start: 1560297859000, end: 1562975136000 },
+ fields: ['taxless_total_price'],
+ filters: [],
+ index: 'ecommerce',
+ query: { bool: { must: [{ match_all: {} }] } },
+ timeField: 'order_date',
+ },
+ expected: {
+ responseCode: 200,
+ responseBody: { name: '15m', ms: 900000 },
+ },
+ },
];
describe('bucket span estimator', function() {
diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts
index 261a853387619..0d4c6b2c87666 100644
--- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts
+++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts
@@ -55,7 +55,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
expectSpaceSelector: false,
}
);
- await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' });
+ await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
});
@@ -69,7 +69,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Stack Management']);
+ expect(navLinks).to.eql(['Management']);
});
it(`allows settings to be changed`, async () => {
@@ -125,7 +125,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows Management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Stack Management']);
+ expect(navLinks).to.eql(['Management']);
});
it(`does not allow settings to be changed`, async () => {
@@ -176,7 +176,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows Management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Discover', 'Stack Management']);
+ expect(navLinks).to.eql(['Discover', 'Management']);
});
it(`does not allow navigation to advanced settings; redirects to management home`, async () => {
diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts
index 53202089e8961..fc4f385df3694 100644
--- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts
+++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts
@@ -41,9 +41,8 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.contain('Stack Management');
+ expect(navLinks).to.contain('Management');
});
it(`allows settings to be changed`, async () => {
diff --git a/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts b/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts
index 7c9c9f9c8c155..e2d5efac4644c 100644
--- a/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts
+++ b/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts
@@ -60,7 +60,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows apm navlink', async () => {
const navLinks = await appsMenu.readLinks();
- expect(navLinks.map(link => link.text)).to.eql(['APM', 'Stack Management']);
+ expect(navLinks.map(link => link.text)).to.eql(['APM', 'Management']);
});
it('can navigate to APM app', async () => {
@@ -109,7 +109,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows apm navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['APM', 'Stack Management']);
+ expect(navLinks).to.eql(['APM', 'Management']);
});
it('can navigate to APM app', async () => {
diff --git a/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts b/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts
index 474240b201fac..1ac1784e0e05d 100644
--- a/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts
+++ b/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts
@@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const spacesService = getService('spaces');
- const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security', 'settings']);
+ const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -30,7 +30,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('APM');
});
diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts
index 71c10bd8248be..d0e37ec8e3f35 100644
--- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts
+++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts
@@ -66,7 +66,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows canvas navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Canvas', 'Stack Management']);
+ expect(navLinks).to.eql(['Canvas', 'Management']);
});
it(`landing page shows "Create new workpad" button`, async () => {
@@ -142,7 +142,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows canvas navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Canvas', 'Stack Management']);
+ expect(navLinks).to.eql(['Canvas', 'Management']);
});
it(`landing page shows disabled "Create new workpad" button`, async () => {
diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts
index 5395f125bbd22..28b572401892b 100644
--- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts
+++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts
@@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects(['common', 'canvas', 'security', 'spaceSelector', 'settings']);
+ const PageObjects = getPageObjects(['common', 'canvas', 'security', 'spaceSelector']);
const appsMenu = getService('appsMenu');
describe('spaces feature controls', function() {
@@ -40,7 +40,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Canvas');
});
diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts
index bfffefaecd94c..b966d37becc3f 100644
--- a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts
+++ b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts
@@ -77,7 +77,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows dashboard navlink', async () => {
const navLinks = await appsMenu.readLinks();
- expect(navLinks.map(link => link.text)).to.eql(['Dashboard', 'Stack Management']);
+ expect(navLinks.map(link => link.text)).to.eql(['Dashboard', 'Management']);
});
it(`landing page shows "Create new Dashboard" button`, async () => {
@@ -261,7 +261,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows dashboard navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Dashboard', 'Stack Management']);
+ expect(navLinks).to.eql(['Dashboard', 'Management']);
});
it(`landing page doesn't show "Create new Dashboard" button`, async () => {
diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts
index 1f4f0f33a061e..5ab26e4189096 100644
--- a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts
+++ b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts
@@ -14,13 +14,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const config = getService('config');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects([
- 'common',
- 'dashboard',
- 'security',
- 'spaceSelector',
- 'settings',
- ]);
+ const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'spaceSelector']);
const appsMenu = getService('appsMenu');
const testSubjects = getService('testSubjects');
@@ -50,7 +44,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Dashboard');
});
diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js
index b521c47585d58..b9c0b0095b96b 100644
--- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js
+++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js
@@ -37,10 +37,7 @@ export default function({ getService, getPageObjects }) {
log.debug('Dashboard View Mode:initTests');
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('dashboard_view_mode');
- await kibanaServer.uiSettings.replace({
- defaultIndex: 'logstash-*',
- pageNavigation: 'individual',
- });
+ await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' });
await browser.setWindowSize(1600, 1000);
await PageObjects.common.navigateToApp('discover');
@@ -200,7 +197,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.security.forceLogout();
await PageObjects.security.login('mixeduser', '123456');
- if (await appsMenu.linkExists('Stack Management')) {
+ if (await appsMenu.linkExists('Management')) {
throw new Error('Expected management nav link to not be shown');
}
});
@@ -209,7 +206,7 @@ export default function({ getService, getPageObjects }) {
await PageObjects.security.forceLogout();
await PageObjects.security.login('mysuperuser', '123456');
- if (!(await appsMenu.linkExists('Stack Management'))) {
+ if (!(await appsMenu.linkExists('Management'))) {
throw new Error('Expected management nav link to be shown');
}
});
diff --git a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts
index 162bf23c29490..3d17d235b7f4f 100644
--- a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts
+++ b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts
@@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows Dev Tools navlink', async () => {
const navLinks = await appsMenu.readLinks();
- expect(navLinks.map(link => link.text)).to.eql(['Dev Tools', 'Stack Management']);
+ expect(navLinks.map(link => link.text)).to.eql(['Dev Tools', 'Management']);
});
describe('console', () => {
@@ -145,7 +145,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it(`shows 'Dev Tools' navlink`, async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Dev Tools', 'Stack Management']);
+ expect(navLinks).to.eql(['Dev Tools', 'Management']);
});
describe('console', () => {
diff --git a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts
index 561b7f64eb77d..d1eddfe89c59e 100644
--- a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts
+++ b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts
@@ -10,13 +10,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const config = getService('config');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects([
- 'common',
- 'dashboard',
- 'security',
- 'spaceSelector',
- 'settings',
- ]);
+ const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'spaceSelector']);
const appsMenu = getService('appsMenu');
const testSubjects = getService('testSubjects');
const grokDebugger = getService('grokDebugger');
@@ -47,7 +41,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Dev Tools');
});
diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts
index 53d0872b810fe..87ae5231d1031 100644
--- a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts
+++ b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts
@@ -83,7 +83,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows discover navlink', async () => {
const navLinks = await appsMenu.readLinks();
- expect(navLinks.map(link => link.text)).to.eql(['Discover', 'Stack Management']);
+ expect(navLinks.map(link => link.text)).to.eql(['Discover', 'Management']);
});
it('shows save button', async () => {
@@ -170,7 +170,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows discover navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Discover', 'Stack Management']);
+ expect(navLinks).to.eql(['Discover', 'Management']);
});
it(`doesn't show save button`, async () => {
diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts
index ba7d4077b2740..4bedc757f0b57 100644
--- a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts
+++ b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts
@@ -16,7 +16,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
'timePicker',
'security',
'spaceSelector',
- 'settings',
]);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -51,7 +50,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Discover');
});
diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts
index 37de93a0a7e91..a2b062e6ef84f 100644
--- a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts
+++ b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts
@@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows graph navlink', async () => {
const navLinks = await appsMenu.readLinks();
- expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Stack Management']);
+ expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Management']);
});
it('landing page shows "Create new graph" button', async () => {
@@ -127,7 +127,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows graph navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Graph', 'Stack Management']);
+ expect(navLinks).to.eql(['Graph', 'Management']);
});
it('does not show a "Create new Workspace" button', async () => {
diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts
index d0d0232b5a8b1..a0b0d5bef9668 100644
--- a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts
+++ b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts
@@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects(['common', 'graph', 'security', 'error', 'settings']);
+ const PageObjects = getPageObjects(['common', 'graph', 'security', 'error']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -34,7 +34,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Graph');
});
diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts
index 0783767d8f152..d72c9b970204a 100644
--- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts
+++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts
@@ -71,7 +71,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Stack Management']);
+ expect(navLinks).to.eql(['Management']);
});
it(`index pattern listing shows create button`, async () => {
@@ -114,7 +114,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
}
);
- await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' });
+ await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
});
@@ -125,7 +125,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Stack Management']);
+ expect(navLinks).to.eql(['Management']);
});
it(`index pattern listing doesn't show create button`, async () => {
@@ -177,7 +177,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows Management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Discover', 'Stack Management']);
+ expect(navLinks).to.eql(['Discover', 'Management']);
});
it(`doesn't show Index Patterns in management side-nav`, async () => {
diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts
index d4422e94d10cf..7d9bee37bbbc4 100644
--- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts
+++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts
@@ -41,9 +41,8 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.contain('Stack Management');
+ expect(navLinks).to.contain('Management');
});
it(`index pattern listing shows create button`, async () => {
diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts
index ede77b7d9afa7..bf35d4dc06aa2 100644
--- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts
+++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts
@@ -61,7 +61,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows metrics navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Metrics', 'Stack Management']);
+ expect(navLinks).to.eql(['Metrics', 'Management']);
});
describe('infrastructure landing page without data', () => {
@@ -177,7 +177,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows metrics navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Metrics', 'Stack Management']);
+ expect(navLinks).to.eql(['Metrics', 'Management']);
});
describe('infrastructure landing page without data', () => {
diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts
index 3bbcc1aa7043c..37056c7f17ca1 100644
--- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts
+++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts
@@ -9,13 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects([
- 'common',
- 'infraHome',
- 'security',
- 'spaceSelector',
- 'settings',
- ]);
+ const PageObjects = getPageObjects(['common', 'infraHome', 'security', 'spaceSelector']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -47,7 +41,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Metrics');
});
diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts
index 48ad4e90fd413..e5a6e27a0fadb 100644
--- a/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts
+++ b/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts
@@ -58,7 +58,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows logs navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Logs', 'Stack Management']);
+ expect(navLinks).to.eql(['Logs', 'Management']);
});
describe('logs landing page without data', () => {
@@ -121,7 +121,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows logs navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Logs', 'Stack Management']);
+ expect(navLinks).to.eql(['Logs', 'Management']);
});
describe('logs landing page without data', () => {
diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts
index 0094d227514c0..985131113c535 100644
--- a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts
+++ b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts
@@ -9,13 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects([
- 'common',
- 'infraHome',
- 'security',
- 'spaceSelector',
- 'settings',
- ]);
+ const PageObjects = getPageObjects(['common', 'infraHome', 'security', 'spaceSelector']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -42,7 +36,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Logs');
});
diff --git a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts
index c25c1bfe4b731..8fb6f21c778d3 100644
--- a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts
+++ b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts
@@ -10,7 +10,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const security = getService('security');
const appsMenu = getService('appsMenu');
- const PageObjects = getPageObjects(['common', 'security', 'settings']);
+ const PageObjects = getPageObjects(['common', 'security']);
describe('security', () => {
before(async () => {
@@ -94,7 +94,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
await PageObjects.security.login('machine_learning_user', 'machine_learning_user-password');
- await PageObjects.settings.setNavType('individual');
});
after(async () => {
diff --git a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts
index c633852a2da0a..fc94688e98811 100644
--- a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts
+++ b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts
@@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error', 'settings']);
+ const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error']);
const appsMenu = getService('appsMenu');
const testSubjects = getService('testSubjects');
@@ -39,7 +39,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Machine Learning');
});
diff --git a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts
index ece162cbd96cc..804ad5725edfd 100644
--- a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts
+++ b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts
@@ -66,7 +66,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows maps navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Maps', 'Stack Management']);
+ expect(navLinks).to.eql(['Maps', 'Management']);
});
it(`allows a map to be created`, async () => {
@@ -153,7 +153,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows Maps navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Maps', 'Stack Management']);
+ expect(navLinks).to.eql(['Maps', 'Management']);
});
it(`does not show create new button`, async () => {
@@ -248,7 +248,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('does not show Maps navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Discover', 'Stack Management']);
+ expect(navLinks).to.eql(['Discover', 'Management']);
});
it(`returns a 404`, async () => {
diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts
index 130aefb3cae2a..d985da42ab5ed 100644
--- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts
+++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts
@@ -10,7 +10,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const security = getService('security');
const appsMenu = getService('appsMenu');
- const PageObjects = getPageObjects(['common', 'security', 'settings']);
+ const PageObjects = getPageObjects(['common', 'security']);
describe('security', () => {
before(async () => {
@@ -97,7 +97,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
});
it('shows monitoring navlink', async () => {
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Stack Monitoring');
});
diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts
index 0465cbcf54541..9e306b074d214 100644
--- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts
+++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts
@@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error', 'settings']);
+ const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error']);
const appsMenu = getService('appsMenu');
const find = getService('find');
@@ -41,7 +41,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Stack Monitoring');
});
diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
index 9ca314ba5ec18..49b684a37079e 100644
--- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
+++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts
@@ -16,7 +16,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
describe('security feature controls', () => {
before(async () => {
await esArchiver.load('empty_kibana');
- await PageObjects.settings.setNavType('individual');
});
after(async () => {
@@ -57,7 +56,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.contain('Stack Management');
+ expect(navLinks).to.contain('Management');
});
it(`displays Spaces management section`, async () => {
@@ -135,7 +134,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows management navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.contain('Stack Management');
+ expect(navLinks).to.contain('Management');
});
it(`doesn't display Spaces management section`, async () => {
diff --git a/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts b/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts
index 62483a10552e3..dea45f161e451 100644
--- a/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts
+++ b/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts
@@ -60,7 +60,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows timelion navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Timelion', 'Stack Management']);
+ expect(navLinks).to.eql(['Timelion', 'Management']);
});
it(`allows a timelion sheet to be created`, async () => {
@@ -112,7 +112,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows timelion navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Timelion', 'Stack Management']);
+ expect(navLinks).to.eql(['Timelion', 'Management']);
});
it(`does not allow a timelion sheet to be created`, async () => {
diff --git a/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts b/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts
index 7e0fe731301a6..fb203a23359bd 100644
--- a/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts
+++ b/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts
@@ -9,13 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects([
- 'common',
- 'timelion',
- 'security',
- 'spaceSelector',
- 'settings',
- ]);
+ const PageObjects = getPageObjects(['common', 'timelion', 'security', 'spaceSelector']);
const appsMenu = getService('appsMenu');
describe('timelion', () => {
@@ -44,7 +38,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Timelion');
});
diff --git a/x-pack/test/functional/apps/transform/cloning.ts b/x-pack/test/functional/apps/transform/cloning.ts
new file mode 100644
index 0000000000000..f06dc0a14a383
--- /dev/null
+++ b/x-pack/test/functional/apps/transform/cloning.ts
@@ -0,0 +1,65 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { FtrProviderContext } from '../../ftr_provider_context';
+import { TransformPivotConfig } from '../../../../legacy/plugins/transform/public/app/common';
+
+function getTransformConfig(): TransformPivotConfig {
+ const date = Date.now();
+ return {
+ id: `ec_2_${date}`,
+ source: { index: ['ecommerce'] },
+ pivot: {
+ group_by: { category: { terms: { field: 'category.keyword' } } },
+ aggregations: { 'products.base_price.avg': { avg: { field: 'products.base_price' } } },
+ },
+ description:
+ 'ecommerce batch transform with avg(products.base_price) grouped by terms(category.keyword)',
+ dest: { index: `user-ec_2_${date}` },
+ };
+}
+
+export default function({ getService }: FtrProviderContext) {
+ const esArchiver = getService('esArchiver');
+ const transform = getService('transform');
+
+ describe('cloning', function() {
+ this.tags(['smoke']);
+ const transformConfig = getTransformConfig();
+
+ before(async () => {
+ await esArchiver.load('ml/ecommerce');
+ await transform.api.createAndRunTransform(transformConfig);
+ await transform.securityUI.loginAsTransformPowerUser();
+ });
+
+ after(async () => {
+ await esArchiver.unload('ml/ecommerce');
+ await transform.api.deleteIndices(transformConfig.dest.index);
+ await transform.api.cleanTransformIndices();
+ });
+
+ const testDataList = [
+ {
+ suiteTitle: 'batch transform with terms group and avg agg',
+ expected: {},
+ },
+ ];
+
+ for (const testData of testDataList) {
+ describe(`${testData.suiteTitle}`, function() {
+ after(async () => {
+ // await transform.api.deleteIndices();
+ });
+
+ it('loads the home page', async () => {
+ await transform.navigation.navigateTo();
+ await transform.management.assertTransformListPageExists();
+ });
+ });
+ }
+ });
+}
diff --git a/x-pack/test/functional/apps/transform/index.ts b/x-pack/test/functional/apps/transform/index.ts
index 66a55105b3ca8..60b72f122f113 100644
--- a/x-pack/test/functional/apps/transform/index.ts
+++ b/x-pack/test/functional/apps/transform/index.ts
@@ -23,5 +23,6 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./creation_index_pattern'));
loadTestFile(require.resolve('./creation_saved_search'));
+ loadTestFile(require.resolve('./cloning'));
});
}
diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts
index 4ff82484db91c..a004f8db66823 100644
--- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts
+++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts
@@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows uptime navlink', async () => {
const navLinks = await appsMenu.readLinks();
- expect(navLinks.map(link => link.text)).to.eql(['Uptime', 'Stack Management']);
+ expect(navLinks.map(link => link.text)).to.eql(['Uptime', 'Management']);
});
it('can navigate to Uptime app', async () => {
@@ -115,7 +115,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows uptime navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Uptime', 'Stack Management']);
+ expect(navLinks).to.eql(['Uptime', 'Management']);
});
it('can navigate to Uptime app', async () => {
diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts
index c3dcb1b27771f..77c5b323340bf 100644
--- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts
+++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts
@@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) {
const spacesService = getService('spaces');
- const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security', 'settings']);
+ const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -30,7 +30,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Uptime');
});
diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts
index 1876f46038326..e5b6512d1c1b0 100644
--- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts
+++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts
@@ -76,7 +76,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows visualize navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Visualize', 'Stack Management']);
+ expect(navLinks).to.eql(['Visualize', 'Management']);
});
it(`landing page shows "Create new Visualization" button`, async () => {
@@ -200,7 +200,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
it('shows visualize navlink', async () => {
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
- expect(navLinks).to.eql(['Visualize', 'Stack Management']);
+ expect(navLinks).to.eql(['Visualize', 'Management']);
});
it(`landing page shows "Create new Visualization" button`, async () => {
diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts
index b1cb156caad90..4f12dd16247f6 100644
--- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts
+++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts
@@ -11,13 +11,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const config = getService('config');
const spacesService = getService('spaces');
- const PageObjects = getPageObjects([
- 'common',
- 'visualize',
- 'security',
- 'spaceSelector',
- 'settings',
- ]);
+ const PageObjects = getPageObjects(['common', 'visualize', 'security', 'spaceSelector']);
const testSubjects = getService('testSubjects');
const appsMenu = getService('appsMenu');
@@ -47,7 +41,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
});
- await PageObjects.settings.setNavType('individual');
const navLinks = (await appsMenu.readLinks()).map(link => link.text);
expect(navLinks).to.contain('Visualize');
});
diff --git a/x-pack/test/functional/services/transform_ui/api.ts b/x-pack/test/functional/services/transform_ui/api.ts
index a6756e5940d72..6a4a1dfff6ea1 100644
--- a/x-pack/test/functional/services/transform_ui/api.ts
+++ b/x-pack/test/functional/services/transform_ui/api.ts
@@ -7,10 +7,17 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
+import {
+ TRANSFORM_STATE,
+ TransformPivotConfig,
+ TransformStats,
+} from '../../../../legacy/plugins/transform/public/app/common';
+
export function TransformAPIProvider({ getService }: FtrProviderContext) {
const es = getService('legacyEs');
const log = getService('log');
const retry = getService('retry');
+ const esSupertest = getService('esSupertest');
return {
async deleteIndices(indices: string) {
@@ -39,5 +46,89 @@ export function TransformAPIProvider({ getService }: FtrProviderContext) {
async cleanTransformIndices() {
await this.deleteIndices('.transform-*');
},
+
+ async getTransformStats(transformId: string): Promise {
+ log.debug(`Fetching transform stats for transform ${transformId}`);
+ const statsResponse = await esSupertest
+ .get(`/_transform/${transformId}/_stats`)
+ .expect(200)
+ .then((res: any) => res.body);
+
+ expect(statsResponse.transforms).to.have.length(1);
+ return statsResponse.transforms[0];
+ },
+
+ async getTransformState(transformId: string): Promise {
+ const stats = await this.getTransformStats(transformId);
+ const state: TRANSFORM_STATE = stats.state;
+
+ return state;
+ },
+
+ async waitForTransformState(transformId: string, expectedState: TRANSFORM_STATE) {
+ await retry.waitForWithTimeout(
+ `transform state to be ${expectedState}`,
+ 2 * 60 * 1000,
+ async () => {
+ const state = await this.getTransformState(transformId);
+ if (state === expectedState) {
+ return true;
+ } else {
+ throw new Error(`expected transform state to be ${expectedState} but got ${state}`);
+ }
+ }
+ );
+ },
+
+ async waitForBatchTransformToComplete(transformId: string) {
+ await retry.waitForWithTimeout(`batch transform to complete`, 2 * 60 * 1000, async () => {
+ const stats = await this.getTransformStats(transformId);
+ if (stats.state === TRANSFORM_STATE.STOPPED && stats.checkpointing.last.checkpoint === 1) {
+ return true;
+ } else {
+ throw new Error(
+ `expected batch transform to be stopped with last checkpoint = 1 (got status: '${stats.state}', checkpoint: '${stats.checkpointing.last.checkpoint}')`
+ );
+ }
+ });
+ },
+
+ async getTransform(transformId: string) {
+ return await esSupertest.get(`/_transform/${transformId}`).expect(200);
+ },
+
+ async createTransform(transformConfig: TransformPivotConfig) {
+ const transformId = transformConfig.id;
+ log.debug(`Creating transform with id '${transformId}'...`);
+ await esSupertest
+ .put(`/_transform/${transformId}`)
+ .send(transformConfig)
+ .expect(200);
+
+ await retry.waitForWithTimeout(`'${transformId}' to be created`, 5 * 1000, async () => {
+ if (await this.getTransform(transformId)) {
+ return true;
+ } else {
+ throw new Error(`expected transform '${transformId}' to be created`);
+ }
+ });
+ },
+
+ async startTransform(transformId: string) {
+ log.debug(`Starting transform '${transformId}' ...`);
+ await esSupertest.post(`/_transform/${transformId}/_start`).expect(200);
+ },
+
+ async createAndRunTransform(transformConfig: TransformPivotConfig) {
+ await this.createTransform(transformConfig);
+ await this.startTransform(transformConfig.id);
+ if (transformConfig.sync === undefined) {
+ // batch mode
+ await this.waitForBatchTransformToComplete(transformConfig.id);
+ } else {
+ // continuous mode
+ await this.waitForTransformState(transformConfig.id, TRANSFORM_STATE.STARTED);
+ }
+ },
};
}
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 3db4731f0adfb..86fc3d6cd6a6c 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
@@ -18,7 +18,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const alerting = getService('alerting');
const retry = getService('retry');
- describe('Alert Details', function() {
+ // FLAKY: https://github.com/elastic/kibana/issues/57426
+ describe.skip('Alert Details', function() {
describe('Header', function() {
const testRunUuid = uuid.v4();
before(async () => {