diff --git a/.ci/end2end.groovy b/.ci/end2end.groovy deleted file mode 100644 index f1095f8035b6c4..00000000000000 --- a/.ci/end2end.groovy +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env groovy - -library identifier: 'apm@current', -retriever: modernSCM( - [$class: 'GitSCMSource', - credentialsId: 'f94e9298-83ae-417e-ba91-85c279771570', - id: '37cf2c00-2cc7-482e-8c62-7bbffef475e2', - remote: 'git@github.com:elastic/apm-pipeline-library.git']) - -pipeline { - agent { label 'linux && immutable' } - environment { - BASE_DIR = 'src/github.com/elastic/kibana' - HOME = "${env.WORKSPACE}" - E2E_DIR = 'x-pack/plugins/apm/e2e' - PIPELINE_LOG_LEVEL = 'INFO' - KBN_OPTIMIZER_THEMES = 'v7light' - } - options { - timeout(time: 1, unit: 'HOURS') - buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10', daysToKeepStr: '30')) - timestamps() - ansiColor('xterm') - disableResume() - durabilityHint('PERFORMANCE_OPTIMIZED') - } - triggers { - issueCommentTrigger('(?i)(retest|.*jenkins\\W+run\\W+(?:the\\W+)?e2e?.*)') - } - parameters { - booleanParam(name: 'FORCE', defaultValue: false, description: 'Whether to force the run.') - } - stages { - stage('Checkout') { - options { skipDefaultCheckout() } - steps { - deleteDir() - gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false, - shallow: false, reference: "/var/lib/jenkins/.git-references/kibana.git") - - // Filter when to run based on the below reasons: - // - On a PRs when: - // - There are changes related to the APM UI project - // - only when the owners of those changes are members of the given GitHub teams - // - On merges to branches when: - // - There are changes related to the APM UI project - // - FORCE parameter is set to true. - script { - def apm_updated = false - dir("${BASE_DIR}"){ - apm_updated = isGitRegionMatch(patterns: [ "^x-pack/plugins/apm/.*" ]) - } - if (isPR()) { - def isMember = isMemberOf(user: env.CHANGE_AUTHOR, team: ['apm-ui', 'uptime']) - setEnvVar('RUN_APM_E2E', params.FORCE || (apm_updated && isMember)) - } else { - setEnvVar('RUN_APM_E2E', params.FORCE || apm_updated) - } - } - } - } - stage('Prepare Kibana') { - options { skipDefaultCheckout() } - when { expression { return env.RUN_APM_E2E != "false" } } - environment { - JENKINS_NODE_COOKIE = 'dontKillMe' - } - steps { - notifyStatus('Preparing kibana', 'PENDING') - dir("${BASE_DIR}"){ - sh "${E2E_DIR}/ci/prepare-kibana.sh" - } - } - post { - unsuccessful { - notifyStatus('Kibana warm up failed', 'FAILURE') - } - } - } - stage('Smoke Tests'){ - options { skipDefaultCheckout() } - when { expression { return env.RUN_APM_E2E != "false" } } - steps{ - notifyTestStatus('Running smoke tests', 'PENDING') - dir("${BASE_DIR}"){ - sh "${E2E_DIR}/ci/run-e2e.sh" - } - } - post { - always { - dir("${BASE_DIR}/${E2E_DIR}"){ - archiveArtifacts(allowEmptyArchive: false, artifacts: 'cypress/screenshots/**,cypress/videos/**,cypress/test-results/*e2e-tests.xml') - junit(allowEmptyResults: true, testResults: 'cypress/test-results/*e2e-tests.xml') - dir('tmp/apm-integration-testing'){ - sh 'docker-compose logs > apm-its-docker.log || true' - sh 'docker-compose down -v || true' - archiveArtifacts(allowEmptyArchive: true, artifacts: 'apm-its-docker.log') - } - archiveArtifacts(allowEmptyArchive: true, artifacts: 'tmp/*.log') - } - } - unsuccessful { - notifyTestStatus('Test failures', 'FAILURE') - } - success { - notifyTestStatus('Tests passed', 'SUCCESS') - } - } - } - } - post { - always { - dir("${BASE_DIR}"){ - archiveArtifacts(allowEmptyArchive: true, artifacts: "${E2E_DIR}/kibana.log") - } - } - cleanup { - notifyBuildResult(prComment: false, analyzeFlakey: false, shouldNotify: false) - } - } -} - -def notifyStatus(String description, String status) { - withGithubStatus.notify('end2end-for-apm-ui', description, status, getBlueoceanTabURL('pipeline')) -} - -def notifyTestStatus(String description, String status) { - withGithubStatus.notify('end2end-for-apm-ui', description, status, getBlueoceanTabURL('tests')) -} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d08676c5070b45..8269acd9242c4c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -144,7 +144,6 @@ /x-pack/plugins/dashboard_enhanced/ @elastic/kibana-presentation /x-pack/test/functional/apps/canvas/ @elastic/kibana-presentation #CC# /src/plugins/kibana_react/public/code_editor/ @elastic/kibana-presentation -#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-presentation # Machine Learning /x-pack/plugins/ml/ @elastic/ml-ui diff --git a/api_docs/dashboard_mode.json b/api_docs/dashboard_mode.json deleted file mode 100644 index eb2927e3515781..00000000000000 --- a/api_docs/dashboard_mode.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "id": "dashboardMode", - "client": { - "classes": [], - "functions": [], - "interfaces": [], - "enums": [], - "misc": [], - "objects": [] - }, - "server": { - "classes": [ - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin", - "type": "Class", - "tags": [], - "label": "DashboardModeServerPlugin", - "description": [], - "signature": [ - { - "pluginId": "dashboardMode", - "scope": "server", - "docId": "kibDashboardModePluginApi", - "section": "def-server.DashboardModeServerPlugin", - "text": "DashboardModeServerPlugin" - }, - " implements ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.Plugin", - "text": "Plugin" - }, - "" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "children": [ - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.Unnamed", - "type": "Function", - "tags": [], - "label": "Constructor", - "description": [], - "signature": [ - "any" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "children": [ - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.Unnamed.$1", - "type": "Object", - "tags": [], - "label": "initializerContext", - "description": [], - "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.PluginInitializerContext", - "text": "PluginInitializerContext" - }, - "" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "isRequired": true - } - ], - "returnComment": [] - }, - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.setup", - "type": "Function", - "tags": [], - "label": "setup", - "description": [], - "signature": [ - "(core: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreSetup", - "text": "CoreSetup" - }, - ", { security }: DashboardModeServerSetupDependencies) => void" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "children": [ - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.setup.$1", - "type": "Object", - "tags": [], - "label": "core", - "description": [], - "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreSetup", - "text": "CoreSetup" - }, - "" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "isRequired": true - }, - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.setup.$2", - "type": "Object", - "tags": [], - "label": "{ security }", - "description": [], - "signature": [ - "DashboardModeServerSetupDependencies" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "isRequired": true - } - ], - "returnComment": [] - }, - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.start", - "type": "Function", - "tags": [], - "label": "start", - "description": [], - "signature": [ - "(core: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreStart", - "text": "CoreStart" - }, - ") => void" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "children": [ - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.start.$1", - "type": "Object", - "tags": [], - "label": "core", - "description": [], - "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreStart", - "text": "CoreStart" - } - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "isRequired": true - } - ], - "returnComment": [] - }, - { - "parentPluginId": "dashboardMode", - "id": "def-server.DashboardModeServerPlugin.stop", - "type": "Function", - "tags": [], - "label": "stop", - "description": [], - "signature": [ - "() => void" - ], - "path": "x-pack/plugins/dashboard_mode/server/plugin.ts", - "deprecated": false, - "children": [], - "returnComment": [] - } - ], - "initialIsOpen": false - } - ], - "functions": [], - "interfaces": [], - "enums": [], - "misc": [], - "objects": [] - }, - "common": { - "classes": [], - "functions": [], - "interfaces": [], - "enums": [], - "misc": [], - "objects": [ - { - "parentPluginId": "dashboardMode", - "id": "def-common.UI_SETTINGS", - "type": "Object", - "tags": [], - "label": "UI_SETTINGS", - "description": [], - "path": "x-pack/plugins/dashboard_mode/common/constants.ts", - "deprecated": false, - "children": [ - { - "parentPluginId": "dashboardMode", - "id": "def-common.UI_SETTINGS.CONFIG_DASHBOARD_ONLY_MODE_ROLES", - "type": "string", - "tags": [], - "label": "CONFIG_DASHBOARD_ONLY_MODE_ROLES", - "description": [], - "path": "x-pack/plugins/dashboard_mode/common/constants.ts", - "deprecated": false - } - ], - "initialIsOpen": false - } - ] - } -} \ No newline at end of file diff --git a/api_docs/dashboard_mode.mdx b/api_docs/dashboard_mode.mdx deleted file mode 100644 index 606532e85fe783..00000000000000 --- a/api_docs/dashboard_mode.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: kibDashboardModePluginApi -slug: /kibana-dev-docs/dashboardModePluginApi -title: dashboardMode -image: https://source.unsplash.com/400x175/?github -summary: API docs for the dashboardMode plugin -date: 2020-11-16 -tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboardMode'] -warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info. ---- -import dashboardModeObj from './dashboard_mode.json'; - - - - - -**Code health stats** - -| Public API count | Any count | Items lacking comments | Missing exports | -|-------------------|-----------|------------------------|-----------------| -| 11 | 0 | 11 | 0 | - -## Server - -### Classes - - -## Common - -### Objects - - diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 3879a54a99470d..4addef8fbb9319 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -378,10 +378,6 @@ The client-side plugin configures following values: |Adds drilldown capabilities to dashboard. Owned by the Kibana App team. -|{kib-repo}blob/{branch}/x-pack/plugins/dashboard_mode/README.md[dashboardMode] -|The deprecated dashboard only mode. - - |{kib-repo}blob/{branch}/x-pack/plugins/data_enhanced/README.md[dataEnhanced] |The data_enhanced plugin is the x-pack counterpart to the src/plguins/data plugin. diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.md index c12fb45e6ab42f..f71eb03d89d725 100644 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.md +++ b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.md @@ -22,5 +22,4 @@ export interface ChromeNavLinks | [getForceAppSwitcherNavigation$()](./kibana-plugin-core-public.chromenavlinks.getforceappswitchernavigation_.md) | An observable of the forced app switcher state. | | [getNavLinks$()](./kibana-plugin-core-public.chromenavlinks.getnavlinks_.md) | Get an observable for a sorted list of navlinks. | | [has(id)](./kibana-plugin-core-public.chromenavlinks.has.md) | Check whether or not a navlink exists. | -| [showOnly(id)](./kibana-plugin-core-public.chromenavlinks.showonly.md) | Remove all navlinks except the one matching the given id. | diff --git a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.showonly.md b/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.showonly.md deleted file mode 100644 index 8f188f5fb71c93..00000000000000 --- a/docs/development/core/public/kibana-plugin-core-public.chromenavlinks.showonly.md +++ /dev/null @@ -1,28 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [ChromeNavLinks](./kibana-plugin-core-public.chromenavlinks.md) > [showOnly](./kibana-plugin-core-public.chromenavlinks.showonly.md) - -## ChromeNavLinks.showOnly() method - -Remove all navlinks except the one matching the given id. - -Signature: - -```typescript -showOnly(id: string): void; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| id | string | | - -Returns: - -`void` - -## Remarks - -NOTE: this is not reversible. - diff --git a/docs/user/monitoring/kibana-alerts.asciidoc b/docs/user/monitoring/kibana-alerts.asciidoc index f00a3999ab2775..64ba8bf044e4fe 100644 --- a/docs/user/monitoring/kibana-alerts.asciidoc +++ b/docs/user/monitoring/kibana-alerts.asciidoc @@ -124,7 +124,7 @@ valid for 30 days. == Alerts and rules [discrete] === Create default rules -This option can be used to create default rules in this kibana spaces. This is +This option can be used to create default rules in this kibana space. This is useful for scenarios when you didn't choose to create these default rules initially or anytime later if the rules were accidentally deleted. diff --git a/packages/kbn-alerts/.babelrc b/packages/kbn-alerts/.babelrc new file mode 100644 index 00000000000000..40a198521b9035 --- /dev/null +++ b/packages/kbn-alerts/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-alerts/.babelrc.browser b/packages/kbn-alerts/.babelrc.browser new file mode 100644 index 00000000000000..71bbfbcd6eb2f8 --- /dev/null +++ b/packages/kbn-alerts/.babelrc.browser @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/webpack_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-alerts/BUILD.bazel b/packages/kbn-alerts/BUILD.bazel index c585b4430bfcb2..a571380202cd64 100644 --- a/packages/kbn-alerts/BUILD.bazel +++ b/packages/kbn-alerts/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-alerts" @@ -12,8 +13,7 @@ SOURCE_FILES = glob( ], exclude = [ "**/*.test.*", - "**/*.mock.*", - "**/*.mocks.*", + "**/__snapshots__" ], ) @@ -25,32 +25,40 @@ filegroup( ) NPM_MODULE_EXTRA_FILES = [ - "react/package.json", "package.json", "README.md", ] -SRC_DEPS = [ - "//packages/kbn-babel-preset", - "//packages/kbn-dev-utils", +RUNTIME_DEPS = [ "//packages/kbn-i18n", - "@npm//@babel/core", - "@npm//babel-loader", "@npm//@elastic/eui", + "@npm//enzyme", "@npm//react", "@npm//resize-observer-polyfill", - "@npm//rxjs", - "@npm//tslib", ] TYPES_DEPS = [ - "@npm//typescript", + "//packages/kbn-i18n", + "@npm//@elastic/eui", + "@npm//resize-observer-polyfill", + "@npm//@types/enzyme", "@npm//@types/jest", "@npm//@types/node", "@npm//@types/react", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + config_file = ".babelrc.browser" +) ts_config( name = "tsconfig", @@ -61,50 +69,26 @@ ts_config( ], ) -ts_config( - name = "tsconfig_browser", - src = "tsconfig.browser.json", - deps = [ - "//:tsconfig.base.json", - "//:tsconfig.browser.json", - "//:tsconfig.browser_bazel.json", - ], -) - ts_project( - name = "tsc", + name = "tsc_types", args = ["--pretty"], srcs = SRCS, - deps = DEPS, - allow_js = True, + deps = TYPES_DEPS, declaration = True, - declaration_dir = "target_types", declaration_map = True, - out_dir = "target_node", + emit_declaration_only = True, + out_dir = "target_types", root_dir = "src", source_map = True, tsconfig = ":tsconfig", ) -ts_project( - name = "tsc_browser", - args = ['--pretty'], - srcs = SRCS, - deps = DEPS, - allow_js = True, - declaration = False, - out_dir = "target_web", - source_map = True, - root_dir = "src", - tsconfig = ":tsconfig_browser", -) - js_library( name = PKG_BASE_NAME, - package_name = PKG_REQUIRE_NAME, srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"], + package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], - deps = [":tsc", ":tsc_browser"] + DEPS, ) pkg_npm( @@ -120,4 +104,4 @@ filegroup( ":npm_module", ], visibility = ["//visibility:public"], -) \ No newline at end of file +) diff --git a/packages/kbn-alerts/babel.config.js b/packages/kbn-alerts/babel.config.js deleted file mode 100644 index b4a118df51af51..00000000000000 --- a/packages/kbn-alerts/babel.config.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -module.exports = { - env: { - web: { - presets: ['@kbn/babel-preset/webpack_preset'], - }, - node: { - presets: ['@kbn/babel-preset/node_preset'], - }, - }, - ignore: ['**/*.test.ts', '**/*.test.tsx'], -}; diff --git a/packages/kbn-alerts/react/package.json b/packages/kbn-alerts/react/package.json deleted file mode 100644 index c5f222b5843acf..00000000000000 --- a/packages/kbn-alerts/react/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "browser": "../target_web/react", - "main": "../target_node/react", - "types": "../target_types/react/index.d.ts" -} diff --git a/packages/kbn-alerts/tsconfig.browser.json b/packages/kbn-alerts/tsconfig.browser.json deleted file mode 100644 index bb58f529eb0bbf..00000000000000 --- a/packages/kbn-alerts/tsconfig.browser.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "../../tsconfig.browser_bazel.json", - "compilerOptions": { - "allowJs": true, - "outDir": "./target_web", - "declaration": false, - "isolatedModules": true, - "sourceMap": true, - "sourceRoot": "../../../../../packages/kbn-alerts/src", - "types": [ - "jest", - "node" - ], - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - ], - "exclude": [ - "**/__fixtures__/**/*" - ] -} \ No newline at end of file diff --git a/packages/kbn-alerts/tsconfig.json b/packages/kbn-alerts/tsconfig.json index 6a791ca2e58445..fa18a407443548 100644 --- a/packages/kbn-alerts/tsconfig.json +++ b/packages/kbn-alerts/tsconfig.json @@ -1,15 +1,14 @@ { "extends": "../../tsconfig.bazel.json", "compilerOptions": { - "allowJs": true, - "declarationDir": "./target_types", - "outDir": "target_node", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-alerts/src", - "rootDir": "src", "types": ["jest", "node", "resize-observer-polyfill"] }, - "include": ["src/**/*"] -} \ No newline at end of file + "include": ["src/**/*"], +} diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index b11458d6539e85..2070bad7b163ed 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -12,7 +12,6 @@ pageLoadAssetSize: crossClusterReplication: 65408 dashboard: 374194 dashboardEnhanced: 65646 - dashboardMode: 22716 data: 824229 dataEnhanced: 50420 devTools: 38637 diff --git a/packages/kbn-securitysolution-autocomplete/.babelrc b/packages/kbn-securitysolution-autocomplete/.babelrc new file mode 100644 index 00000000000000..40a198521b9035 --- /dev/null +++ b/packages/kbn-securitysolution-autocomplete/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-securitysolution-autocomplete/.babelrc.browser b/packages/kbn-securitysolution-autocomplete/.babelrc.browser new file mode 100644 index 00000000000000..71bbfbcd6eb2f8 --- /dev/null +++ b/packages/kbn-securitysolution-autocomplete/.babelrc.browser @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/webpack_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-securitysolution-autocomplete/BUILD.bazel b/packages/kbn-securitysolution-autocomplete/BUILD.bazel index 18c3b8f3ae3bb5..53cd7b4f8d3e1b 100644 --- a/packages/kbn-securitysolution-autocomplete/BUILD.bazel +++ b/packages/kbn-securitysolution-autocomplete/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-securitysolution-autocomplete" @@ -25,35 +26,54 @@ filegroup( ) NPM_MODULE_EXTRA_FILES = [ - "react/package.json", "package.json", "README.md", ] -SRC_DEPS = [ - "//packages/kbn-babel-preset", - "//packages/kbn-dev-utils", +RUNTIME_DEPS = [ + "//packages/kbn-es-query", "//packages/kbn-i18n", - "//packages/kbn-securitysolution-io-ts-list-types", "//packages/kbn-securitysolution-list-hooks", - "//packages/kbn-es-query", - "@npm//@babel/core", - "@npm//babel-loader", + "//packages/kbn-securitysolution-list-utils", + "//packages/kbn-securitysolution-io-ts-list-types", "@npm//@elastic/eui", + "@npm//@testing-library/react", + "@npm//@testing-library/react-hooks", + "@npm//enzyme", + "@npm//moment", "@npm//react", "@npm//resize-observer-polyfill", - "@npm//rxjs", - "@npm//tslib", ] TYPES_DEPS = [ - "@npm//typescript", + "//packages/kbn-es-query", + "//packages/kbn-i18n", + "//packages/kbn-securitysolution-list-hooks", + "//packages/kbn-securitysolution-list-utils", + "//packages/kbn-securitysolution-io-ts-list-types", + "@npm//@elastic/eui", + "@npm//@testing-library/react", + "@npm//@testing-library/react-hooks", + "@npm//moment", + "@npm//resize-observer-polyfill", + "@npm//@types/enzyme", "@npm//@types/jest", "@npm//@types/node", "@npm//@types/react", ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + config_file = ".babelrc.browser" +) ts_config( name = "tsconfig", @@ -64,50 +84,26 @@ ts_config( ], ) -ts_config( - name = "tsconfig_browser", - src = "tsconfig.browser.json", - deps = [ - "//:tsconfig.base.json", - "//:tsconfig.browser.json", - "//:tsconfig.browser_bazel.json", - ], -) - ts_project( - name = "tsc", + name = "tsc_types", args = ["--pretty"], srcs = SRCS, - deps = DEPS, - allow_js = True, + deps = TYPES_DEPS, declaration = True, - declaration_dir = "target_types", declaration_map = True, - out_dir = "target_node", + emit_declaration_only = True, + out_dir = "target_types", root_dir = "src", source_map = True, tsconfig = ":tsconfig", ) -ts_project( - name = "tsc_browser", - args = ['--pretty'], - srcs = SRCS, - deps = DEPS, - allow_js = True, - declaration = False, - out_dir = "target_web", - source_map = True, - root_dir = "src", - tsconfig = ":tsconfig_browser", -) - js_library( name = PKG_BASE_NAME, - package_name = PKG_REQUIRE_NAME, srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"], + package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], - deps = [":tsc", ":tsc_browser"] + DEPS, ) pkg_npm( diff --git a/packages/kbn-securitysolution-autocomplete/babel.config.js b/packages/kbn-securitysolution-autocomplete/babel.config.js deleted file mode 100644 index b4a118df51af51..00000000000000 --- a/packages/kbn-securitysolution-autocomplete/babel.config.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -module.exports = { - env: { - web: { - presets: ['@kbn/babel-preset/webpack_preset'], - }, - node: { - presets: ['@kbn/babel-preset/node_preset'], - }, - }, - ignore: ['**/*.test.ts', '**/*.test.tsx'], -}; diff --git a/packages/kbn-securitysolution-autocomplete/react/package.json b/packages/kbn-securitysolution-autocomplete/react/package.json deleted file mode 100644 index c5f222b5843acf..00000000000000 --- a/packages/kbn-securitysolution-autocomplete/react/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "browser": "../target_web/react", - "main": "../target_node/react", - "types": "../target_types/react/index.d.ts" -} diff --git a/packages/kbn-securitysolution-autocomplete/tsconfig.browser.json b/packages/kbn-securitysolution-autocomplete/tsconfig.browser.json deleted file mode 100644 index 404043569aa92f..00000000000000 --- a/packages/kbn-securitysolution-autocomplete/tsconfig.browser.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "../../tsconfig.browser_bazel.json", - "compilerOptions": { - "allowJs": true, - "outDir": "./target_web", - "declaration": false, - "isolatedModules": true, - "sourceMap": true, - "sourceRoot": "../../../../../packages/kbn-securitysolution-autocomplete/src", - "types": [ - "jest", - "node" - ], - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - ], - "exclude": [ - "**/__fixtures__/**/*" - ] -} diff --git a/packages/kbn-securitysolution-autocomplete/tsconfig.json b/packages/kbn-securitysolution-autocomplete/tsconfig.json index 484b639f94332a..fa7eff82340115 100644 --- a/packages/kbn-securitysolution-autocomplete/tsconfig.json +++ b/packages/kbn-securitysolution-autocomplete/tsconfig.json @@ -1,15 +1,14 @@ { "extends": "../../tsconfig.bazel.json", "compilerOptions": { - "allowJs": true, - "declarationDir": "./target_types", - "outDir": "target_node", "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-securitysolution-autocomplete/src", "rootDir": "src", "types": ["jest", "node", "resize-observer-polyfill"] }, - "include": ["src/**/*"] + "include": ["src/**/*"], } diff --git a/packages/kbn-securitysolution-utils/.babelrc b/packages/kbn-securitysolution-utils/.babelrc new file mode 100644 index 00000000000000..40a198521b9035 --- /dev/null +++ b/packages/kbn-securitysolution-utils/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-securitysolution-utils/BUILD.bazel b/packages/kbn-securitysolution-utils/BUILD.bazel index 41fb97bc6079e0..c3d6b92044ef64 100644 --- a/packages/kbn-securitysolution-utils/BUILD.bazel +++ b/packages/kbn-securitysolution-utils/BUILD.bazel @@ -1,5 +1,6 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") PKG_BASE_NAME = "kbn-securitysolution-utils" @@ -27,18 +28,23 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "@npm//tslib", "@npm//uuid", ] TYPES_DEPS = [ + "@npm//tslib", "@npm//@types/jest", "@npm//@types/node", "@npm//@types/uuid" ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -50,24 +56,25 @@ ts_config( ) ts_project( - name = "tsc", - srcs = SRCS, + name = "tsc_types", args = ["--pretty"], + srcs = SRCS, + deps = TYPES_DEPS, declaration = True, declaration_map = True, - out_dir = "target", + emit_declaration_only = True, + out_dir = "target_types", root_dir = "src", source_map = True, tsconfig = ":tsconfig", - deps = DEPS, ) js_library( name = PKG_BASE_NAME, - package_name = PKG_REQUIRE_NAME, srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], - deps = DEPS + [":tsc"], ) pkg_npm( diff --git a/packages/kbn-securitysolution-utils/package.json b/packages/kbn-securitysolution-utils/package.json index d4b46ed07bfdd3..98f19e33d379bc 100644 --- a/packages/kbn-securitysolution-utils/package.json +++ b/packages/kbn-securitysolution-utils/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "security solution utilities to use across plugins such lists, security_solution, cases, etc...", "license": "SSPL-1.0 OR Elastic License 2.0", - "main": "./target/index.js", - "types": "./target/index.d.ts", + "main": "./target_node/index.js", + "types": "./target_types/index.d.ts", "private": true } diff --git a/packages/kbn-securitysolution-utils/tsconfig.json b/packages/kbn-securitysolution-utils/tsconfig.json index 3894b53d6cff31..23fdf3178e174c 100644 --- a/packages/kbn-securitysolution-utils/tsconfig.json +++ b/packages/kbn-securitysolution-utils/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "outDir": "target", + "emitDeclarationOnly": true, + "outDir": "target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-securitysolution-utils/src", diff --git a/src/core/public/chrome/chrome_service.mock.ts b/src/core/public/chrome/chrome_service.mock.ts index 5e29218250fb90..347b81abf6d512 100644 --- a/src/core/public/chrome/chrome_service.mock.ts +++ b/src/core/public/chrome/chrome_service.mock.ts @@ -19,7 +19,6 @@ const createStartContractMock = () => { has: jest.fn(), get: jest.fn(), getAll: jest.fn(), - showOnly: jest.fn(), enableForcedAppSwitcherNavigation: jest.fn(), getForceAppSwitcherNavigation$: jest.fn(), }, diff --git a/src/core/public/chrome/nav_links/nav_links_service.test.ts b/src/core/public/chrome/nav_links/nav_links_service.test.ts index e1d537da6959b7..294a6de914a422 100644 --- a/src/core/public/chrome/nav_links/nav_links_service.test.ts +++ b/src/core/public/chrome/nav_links/nav_links_service.test.ts @@ -89,10 +89,8 @@ describe('NavLinksService', () => { const navLinkIds$ = start.getNavLinks$().pipe(map((links) => links.map((l) => l.id))); const emittedLinks: string[][] = []; navLinkIds$.subscribe((r) => emittedLinks.push(r)); - start.showOnly('app1'); - service.stop(); - expect(emittedLinks).toEqual([['app2', 'app1', 'app2:deepApp2', 'app2:deepApp1'], ['app1']]); + expect(emittedLinks).toEqual([['app2', 'app1', 'app2:deepApp2', 'app2:deepApp1']]); }); it('completes when service is stopped', async () => { @@ -133,74 +131,6 @@ describe('NavLinksService', () => { }); }); - describe('#showOnly()', () => { - it('does nothing if link does not exist', async () => { - start.showOnly('fake'); - expect( - await start - .getNavLinks$() - .pipe( - take(1), - map((links) => links.map((l) => l.id)) - ) - .toPromise() - ).toEqual(['app2', 'app1', 'app2:deepApp2', 'app2:deepApp1']); - }); - - it('does nothing on chromeless applications', async () => { - start.showOnly('chromelessApp'); - expect( - await start - .getNavLinks$() - .pipe( - take(1), - map((links) => links.map((l) => l.id)) - ) - .toPromise() - ).toEqual(['app2', 'app1', 'app2:deepApp2', 'app2:deepApp1']); - }); - - it('removes all other links', async () => { - start.showOnly('app2'); - expect( - await start - .getNavLinks$() - .pipe( - take(1), - map((links) => links.map((l) => l.id)) - ) - .toPromise() - ).toEqual(['app2']); - }); - - it('show only deep link', async () => { - start.showOnly('app2:deepApp1'); - expect( - await start - .getNavLinks$() - .pipe( - take(1), - map((links) => links.map((l) => l.id)) - ) - .toPromise() - ).toEqual(['app2:deepApp1']); - }); - - it('still removes all other links when availableApps are re-emitted', async () => { - start.showOnly('app2'); - mockAppService.applications$.next(mockAppService.applications$.value); - expect( - await start - .getNavLinks$() - .pipe( - take(1), - map((links) => links.map((l) => l.id)) - ) - .toPromise() - ).toEqual(['app2']); - }); - }); - describe('#enableForcedAppSwitcherNavigation()', () => { it('flips #getForceAppSwitcherNavigation$()', async () => { await expect(start.getForceAppSwitcherNavigation$().pipe(take(1)).toPromise()).resolves.toBe( diff --git a/src/core/public/chrome/nav_links/nav_links_service.ts b/src/core/public/chrome/nav_links/nav_links_service.ts index af961987a63095..6a91d4d1790766 100644 --- a/src/core/public/chrome/nav_links/nav_links_service.ts +++ b/src/core/public/chrome/nav_links/nav_links_service.ts @@ -7,7 +7,7 @@ */ import { sortBy } from 'lodash'; -import { BehaviorSubject, combineLatest, Observable, ReplaySubject } from 'rxjs'; +import { BehaviorSubject, Observable, ReplaySubject } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; import { InternalApplicationStart, PublicAppDeepLinkInfo, PublicAppInfo } from '../../application'; @@ -48,16 +48,6 @@ export interface ChromeNavLinks { */ has(id: string): boolean; - /** - * Remove all navlinks except the one matching the given id. - * - * @remarks - * NOTE: this is not reversible. - * - * @param id - */ - showOnly(id: string): void; - /** * Enable forced navigation mode, which will trigger a page refresh * when a nav link is clicked and only the hash is updated. @@ -78,39 +68,25 @@ export interface ChromeNavLinks { getForceAppSwitcherNavigation$(): Observable; } -type LinksUpdater = (navLinks: Map) => Map; - export class NavLinksService { private readonly stop$ = new ReplaySubject(1); public start({ application, http }: StartDeps): ChromeNavLinks { - const appLinks$ = application.applications$.pipe( - map((apps) => { - return new Map( - [...apps] - .filter(([, app]) => !app.chromeless) - .reduce((navLinks: Array<[string, NavLinkWrapper]>, [appId, app]) => { - navLinks.push( - [appId, toNavLink(app, http.basePath)], - ...toNavDeepLinks(app, app.deepLinks, http.basePath) - ); - return navLinks; - }, []) - ); - }) - ); - - // now that availableApps$ is an observable, we need to keep record of all - // manual link modifications to be able to re-apply then after every - // availableApps$ changes. - // Only in use by `showOnly` API, can be removed once dashboard_mode is removed in 8.0 - const linkUpdaters$ = new BehaviorSubject([]); const navLinks$ = new BehaviorSubject>(new Map()); - - combineLatest([appLinks$, linkUpdaters$]) + application.applications$ .pipe( - map(([appLinks, linkUpdaters]) => { - return linkUpdaters.reduce((links, updater) => updater(links), appLinks); + map((apps) => { + return new Map( + [...apps] + .filter(([, app]) => !app.chromeless) + .reduce((navLinks: Array<[string, NavLinkWrapper]>, [appId, app]) => { + navLinks.push( + [appId, toNavLink(app, http.basePath)], + ...toNavDeepLinks(app, app.deepLinks, http.basePath) + ); + return navLinks; + }, []) + ); }) ) .subscribe((navlinks) => { @@ -137,17 +113,6 @@ export class NavLinksService { return navLinks$.value.has(id); }, - showOnly(id: string) { - if (!this.has(id)) { - return; - } - - const updater: LinksUpdater = (navLinks) => - new Map([...navLinks.entries()].filter(([linkId]) => linkId === id)); - - linkUpdaters$.next([...linkUpdaters$.value, updater]); - }, - enableForcedAppSwitcherNavigation() { forceAppSwitcherNavigation$.next(true); }, diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 2217b71d2f1a31..043759378faa30 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -324,7 +324,6 @@ export interface ChromeNavLinks { getForceAppSwitcherNavigation$(): Observable; getNavLinks$(): Observable>>; has(id: string): boolean; - showOnly(id: string): void; } // @public diff --git a/src/plugins/dashboard/public/application/dashboard_router.tsx b/src/plugins/dashboard/public/application/dashboard_router.tsx index cb40b305428698..902a03bd84ad2c 100644 --- a/src/plugins/dashboard/public/application/dashboard_router.tsx +++ b/src/plugins/dashboard/public/application/dashboard_router.tsx @@ -80,7 +80,6 @@ export async function mountApp({ data: dataStart, share: shareStart, embeddable: embeddableStart, - kibanaLegacy: { dashboardConfig }, savedObjectsTaggingOss, visualizations, presentationUtil, @@ -117,12 +116,12 @@ export async function mountApp({ allowByValueEmbeddables: initializerContext.config.get() .allowByValueEmbeddables, dashboardCapabilities: { - hideWriteControls: dashboardConfig.getHideWriteControls(), show: Boolean(coreStart.application.capabilities.dashboard.show), saveQuery: Boolean(coreStart.application.capabilities.dashboard.saveQuery), createNew: Boolean(coreStart.application.capabilities.dashboard.createNew), mapsCapabilities: { save: Boolean(coreStart.application.capabilities.maps?.save) }, createShortUrl: Boolean(coreStart.application.capabilities.dashboard.createShortUrl), + showWriteControls: Boolean(coreStart.application.capabilities.dashboard.showWriteControls), visualizeCapabilities: { save: Boolean(coreStart.application.capabilities.visualize?.save) }, storeSearchSession: Boolean(coreStart.application.capabilities.dashboard.storeSearchSession), }, @@ -251,7 +250,7 @@ export async function mountApp({ ); addHelpMenuToAppChrome(dashboardServices.chrome, coreStart.docLinks); - if (dashboardServices.dashboardCapabilities.hideWriteControls) { + if (!dashboardServices.dashboardCapabilities.showWriteControls) { coreStart.chrome.setBadge({ text: dashboardReadonlyBadge.getText(), tooltip: dashboardReadonlyBadge.getTooltip(), diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx index 953bd619c444b9..86f81aa1ee10d9 100644 --- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx +++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx @@ -79,7 +79,7 @@ const defaultCapabilities: DashboardAppCapabilities = { createNew: false, saveQuery: false, createShortUrl: false, - hideWriteControls: true, + showWriteControls: false, mapsCapabilities: { save: false }, visualizeCapabilities: { save: false }, storeSearchSession: true, diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx index cbe10438e578aa..35b304f7cc65b4 100644 --- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx +++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx @@ -117,7 +117,7 @@ export class DashboardViewport extends React.Component { setLastSavedState( savedObjectToDashboardState({ - hideWriteControls: dashboardBuildContext.dashboardCapabilities.hideWriteControls, + showWriteControls: dashboardBuildContext.dashboardCapabilities.showWriteControls, version: dashboardBuildContext.kibanaVersion, savedObjectsTagging, usageCollection, @@ -341,7 +341,12 @@ export const useDashboardAppState = ({ if (from && to) timefilter.setTime({ from, to }); if (refreshInterval) timefilter.setRefreshInterval(refreshInterval); } - dispatchDashboardStateChange(setDashboardState(lastSavedState)); + dispatchDashboardStateChange( + setDashboardState({ + ...lastSavedState, + viewMode: ViewMode.VIEW, + }) + ); }, [lastSavedState, dashboardAppState, data.query.timefilter, dispatchDashboardStateChange]); /** diff --git a/src/plugins/dashboard/public/application/lib/convert_dashboard_state.ts b/src/plugins/dashboard/public/application/lib/convert_dashboard_state.ts index 2e6290ec920c03..d17f8405d734f4 100644 --- a/src/plugins/dashboard/public/application/lib/convert_dashboard_state.ts +++ b/src/plugins/dashboard/public/application/lib/convert_dashboard_state.ts @@ -27,7 +27,7 @@ import { interface SavedObjectToDashboardStateProps { version: string; - hideWriteControls: boolean; + showWriteControls: boolean; savedDashboard: DashboardSavedObject; usageCollection: DashboardAppServices['usageCollection']; savedObjectsTagging: DashboardAppServices['savedObjectsTagging']; @@ -55,9 +55,9 @@ interface StateToRawDashboardStateProps { */ export const savedObjectToDashboardState = ({ version, - hideWriteControls, savedDashboard, usageCollection, + showWriteControls, savedObjectsTagging, }: SavedObjectToDashboardStateProps): DashboardState => { const rawState = migrateAppState( @@ -70,7 +70,7 @@ export const savedObjectToDashboardState = ({ description: savedDashboard.description || '', tags: getTagsFromSavedDashboard(savedDashboard, savedObjectsTagging), panels: savedDashboard.panelsJSON ? JSON.parse(savedDashboard.panelsJSON) : [], - viewMode: savedDashboard.id || hideWriteControls ? ViewMode.VIEW : ViewMode.EDIT, + viewMode: savedDashboard.id || showWriteControls ? ViewMode.EDIT : ViewMode.VIEW, options: savedDashboard.optionsJSON ? JSON.parse(savedDashboard.optionsJSON) : {}, }, version, diff --git a/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts b/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts index 9069173c15e8f8..04461a46ad0da5 100644 --- a/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts +++ b/src/plugins/dashboard/public/application/lib/load_saved_dashboard_state.ts @@ -38,7 +38,7 @@ export const loadSavedDashboardState = async ({ }: DashboardBuildContext & { savedDashboardId?: string }): Promise< LoadSavedDashboardStateReturn | undefined > => { - const { hideWriteControls } = dashboardCapabilities; + const { showWriteControls } = dashboardCapabilities; const { queryString } = query; // BWC - remove for 8.0 @@ -66,12 +66,12 @@ export const loadSavedDashboardState = async ({ const savedDashboardState = savedObjectToDashboardState({ savedDashboard, usageCollection, - hideWriteControls, + showWriteControls, savedObjectsTagging, version: initializerContext.env.packageInfo.version, }); - const isViewMode = hideWriteControls || Boolean(savedDashboard.id); + const isViewMode = !showWriteControls || Boolean(savedDashboard.id); savedDashboardState.viewMode = isViewMode ? ViewMode.VIEW : ViewMode.EDIT; savedDashboardState.filters = cleanFiltersForSerialize(savedDashboardState.filters); savedDashboardState.query = migrateLegacyQuery( diff --git a/src/plugins/dashboard/public/application/lib/session_restoration.test.ts b/src/plugins/dashboard/public/application/lib/session_restoration.test.ts index c8366387471452..571dfb0a8beeba 100644 --- a/src/plugins/dashboard/public/application/lib/session_restoration.test.ts +++ b/src/plugins/dashboard/public/application/lib/session_restoration.test.ts @@ -19,7 +19,7 @@ describe('createSessionRestorationDataProvider', () => { getAppState: () => savedObjectToDashboardState({ version, - hideWriteControls: false, + showWriteControls: true, usageCollection: undefined, savedObjectsTagging: undefined, savedDashboard: getSavedDashboardMock(), diff --git a/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.tsx.snap b/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.tsx.snap index e78583be56569b..2e37dc61fe851e 100644 --- a/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.tsx.snap +++ b/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.tsx.snap @@ -112,8 +112,9 @@ exports[`after fetch When given a title that matches multiple dashboards, filter `; -exports[`after fetch hideWriteControls 1`] = ` +exports[`after fetch initialFilter 1`] = ` + Create new dashboard + + } body={ -

- There are no available dashboards. To change your permissions to view the dashboards in this space, contact your administrator. -

+ +

+ You can combine data views from any Kibana app into one dashboard and see everything in one place. +

+

+ + Install some sample data + , + } + } + /> +

+
} - iconType="glasses" + iconType="dashboardApp" title={

- No dashboards to view + Create your first dashboard

} /> @@ -154,7 +185,7 @@ exports[`after fetch hideWriteControls 1`] = ` entityNamePlural="dashboards" findItems={[Function]} headingId="dashboardListingHeading" - initialFilter="" + initialFilter="testFilter" initialPageSize={20} listingLimit={100} rowHeader="title" @@ -193,9 +224,8 @@ exports[`after fetch hideWriteControls 1`] = `
`; -exports[`after fetch initialFilter 1`] = ` +exports[`after fetch renders all table rows 1`] = ` `; -exports[`after fetch renders all table rows 1`] = ` +exports[`after fetch renders call to action when no dashboards exist 1`] = ` `; -exports[`after fetch renders call to action when no dashboards exist 1`] = ` +exports[`after fetch renders warning when listingLimit is exceeded 1`] = ` `; -exports[`after fetch renders warning when listingLimit is exceeded 1`] = ` +exports[`after fetch showWriteControls 1`] = ` - Create new dashboard - - } body={ - -

- You can combine data views from any Kibana app into one dashboard and see everything in one place. -

-

- - Install some sample data - , - } - } - /> -

-
+

+ There are no available dashboards. To change your permissions to view the dashboards in this space, contact your administrator. +

} - iconType="dashboardApp" + iconType="glasses" title={

- Create your first dashboard + No dashboards to view

} /> @@ -601,7 +601,7 @@ exports[`after fetch renders warning when listingLimit is exceeded 1`] = ` headingId="dashboardListingHeading" initialFilter="" initialPageSize={20} - listingLimit={1} + listingLimit={100} rowHeader="title" searchFilters={Array []} tableCaption="Dashboards" diff --git a/src/plugins/dashboard/public/application/listing/dashboard_listing.test.tsx b/src/plugins/dashboard/public/application/listing/dashboard_listing.test.tsx index 7602b2ed68b62d..37ee0ec13d7c94 100644 --- a/src/plugins/dashboard/public/application/listing/dashboard_listing.test.tsx +++ b/src/plugins/dashboard/public/application/listing/dashboard_listing.test.tsx @@ -133,9 +133,9 @@ describe('after fetch', () => { }); }); - test('hideWriteControls', async () => { + test('showWriteControls', async () => { const services = makeDefaultServices(); - services.dashboardCapabilities.hideWriteControls = true; + services.dashboardCapabilities.showWriteControls = false; const { component } = mountWith({ services }); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); diff --git a/src/plugins/dashboard/public/application/listing/dashboard_listing.tsx b/src/plugins/dashboard/public/application/listing/dashboard_listing.tsx index 7f72c77009cb9a..5f5923cb78696f 100644 --- a/src/plugins/dashboard/public/application/listing/dashboard_listing.tsx +++ b/src/plugins/dashboard/public/application/listing/dashboard_listing.tsx @@ -87,7 +87,7 @@ export const DashboardListing = ({ }; }, [title, savedObjectsClient, redirectTo, data.query, kbnUrlStateStorage]); - const hideWriteControls = dashboardCapabilities.hideWriteControls; + const { showWriteControls } = dashboardCapabilities; const listingLimit = savedObjects.settings.getListingLimit(); const defaultFilter = title ? `"${title}"` : ''; @@ -118,8 +118,8 @@ export const DashboardListing = ({ }, [dashboardSessionStorage, redirectTo, core.overlays]); const emptyPrompt = useMemo( - () => getNoItemsMessage(hideWriteControls, core.application, createItem), - [createItem, core.application, hideWriteControls] + () => getNoItemsMessage(showWriteControls, core.application, createItem), + [createItem, core.application, showWriteControls] ); const fetchItems = useCallback( @@ -171,10 +171,10 @@ export const DashboardListing = ({ } = dashboardListingTable; return ( void ) => { - if (hideWriteControls) { + if (!showWriteControls) { return ( ({ config: { defaultAppId: 'home', }, - dashboardConfig: { - turnHideWriteControlsOn: jest.fn(), - getHideWriteControls: jest.fn(), - }, loadFontAwesome: jest.fn(), loadAngularBootstrap: jest.fn(), }); diff --git a/src/plugins/kibana_legacy/public/plugin.ts b/src/plugins/kibana_legacy/public/plugin.ts index f60130d367b584..af22ceadaa9e1c 100644 --- a/src/plugins/kibana_legacy/public/plugin.ts +++ b/src/plugins/kibana_legacy/public/plugin.ts @@ -8,7 +8,6 @@ import { PluginInitializerContext, CoreStart, CoreSetup } from 'kibana/public'; import { ConfigSchema } from '../config'; -import { getDashboardConfig } from './dashboard_config'; import { injectHeaderStyle } from './utils/inject_header_style'; export class KibanaLegacyPlugin { @@ -21,11 +20,6 @@ export class KibanaLegacyPlugin { public start({ application, http: { basePath }, uiSettings }: CoreStart) { injectHeaderStyle(uiSettings); return { - /** - * Used to power dashboard mode. Should be removed when dashboard mode is removed eventually. - * @deprecated - */ - dashboardConfig: getDashboardConfig(!application.capabilities.dashboard.showWriteControls), /** * Loads the font-awesome icon font. Should be removed once the last consumer has migrated to EUI * @deprecated diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index 54a3fe9e4399c0..d29d6d6a86e853 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -134,7 +134,6 @@ export const applicationUsageSchema = { // X-Pack apm: commonSchema, canvas: commonSchema, - dashboard_mode: commonSchema, // It's a forward app so we'll likely never report it enterpriseSearch: commonSchema, appSearch: commonSchema, workplaceSearch: commonSchema, diff --git a/src/plugins/kibana_usage_collection/server/collectors/ui_metric/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/ui_metric/schema.ts index b64c23a2af2898..fec314fc6b87e0 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/ui_metric/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/ui_metric/schema.ts @@ -35,7 +35,6 @@ const uiMetricFromDataPluginSchema: MakeSchemaFrom = { apm: commonSchema, csm: commonSchema, canvas: commonSchema, - dashboard_mode: commonSchema, // It's a forward app so we'll likely never report it enterpriseSearch: commonSchema, appSearch: commonSchema, workplaceSearch: commonSchema, diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index ad19362dbf7db7..2cc16305109833 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -2136,137 +2136,6 @@ } } }, - "dashboard_mode": { - "properties": { - "appId": { - "type": "keyword", - "_meta": { - "description": "The application being tracked" - } - }, - "viewId": { - "type": "keyword", - "_meta": { - "description": "Always `main`" - } - }, - "clicks_total": { - "type": "long", - "_meta": { - "description": "General number of clicks in the application since we started counting them" - } - }, - "clicks_7_days": { - "type": "long", - "_meta": { - "description": "General number of clicks in the application over the last 7 days" - } - }, - "clicks_30_days": { - "type": "long", - "_meta": { - "description": "General number of clicks in the application over the last 30 days" - } - }, - "clicks_90_days": { - "type": "long", - "_meta": { - "description": "General number of clicks in the application over the last 90 days" - } - }, - "minutes_on_screen_total": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen since we started counting them." - } - }, - "minutes_on_screen_7_days": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen over the last 7 days" - } - }, - "minutes_on_screen_30_days": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen over the last 30 days" - } - }, - "minutes_on_screen_90_days": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen over the last 90 days" - } - }, - "views": { - "type": "array", - "items": { - "properties": { - "appId": { - "type": "keyword", - "_meta": { - "description": "The application being tracked" - } - }, - "viewId": { - "type": "keyword", - "_meta": { - "description": "The application view being tracked" - } - }, - "clicks_total": { - "type": "long", - "_meta": { - "description": "General number of clicks in the application sub view since we started counting them" - } - }, - "clicks_7_days": { - "type": "long", - "_meta": { - "description": "General number of clicks in the active application sub view over the last 7 days" - } - }, - "clicks_30_days": { - "type": "long", - "_meta": { - "description": "General number of clicks in the active application sub view over the last 30 days" - } - }, - "clicks_90_days": { - "type": "long", - "_meta": { - "description": "General number of clicks in the active application sub view over the last 90 days" - } - }, - "minutes_on_screen_total": { - "type": "float", - "_meta": { - "description": "Minutes the application sub view is active and on-screen since we started counting them." - } - }, - "minutes_on_screen_7_days": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" - } - }, - "minutes_on_screen_30_days": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" - } - }, - "minutes_on_screen_90_days": { - "type": "float", - "_meta": { - "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" - } - } - } - } - } - } - }, "enterpriseSearch": { "properties": { "appId": { @@ -8487,25 +8356,6 @@ } } }, - "dashboard_mode": { - "type": "array", - "items": { - "properties": { - "key": { - "type": "keyword", - "_meta": { - "description": "The event that is tracked" - } - }, - "value": { - "type": "long", - "_meta": { - "description": "The value of the event" - } - } - } - } - }, "enterpriseSearch": { "type": "array", "items": { diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 9b98ca864f4960..b51363f1b70064 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -13,7 +13,6 @@ "xpack.dashboard": "plugins/dashboard_enhanced", "xpack.discover": "plugins/discover_enhanced", "xpack.crossClusterReplication": "plugins/cross_cluster_replication", - "xpack.dashboardMode": "plugins/dashboard_mode", "xpack.data": "plugins/data_enhanced", "xpack.embeddableEnhanced": "plugins/embeddable_enhanced", "xpack.endpoint": "plugins/endpoint", diff --git a/x-pack/plugins/dashboard_mode/README.md b/x-pack/plugins/dashboard_mode/README.md deleted file mode 100644 index 4e244afb97fdf6..00000000000000 --- a/x-pack/plugins/dashboard_mode/README.md +++ /dev/null @@ -1 +0,0 @@ -The deprecated dashboard only mode. \ No newline at end of file diff --git a/x-pack/plugins/dashboard_mode/common/constants.ts b/x-pack/plugins/dashboard_mode/common/constants.ts deleted file mode 100644 index b58afc9b663c8d..00000000000000 --- a/x-pack/plugins/dashboard_mode/common/constants.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export const UI_SETTINGS = { - CONFIG_DASHBOARD_ONLY_MODE_ROLES: 'xpackDashboardMode:roles', -}; diff --git a/x-pack/plugins/dashboard_mode/common/index.ts b/x-pack/plugins/dashboard_mode/common/index.ts deleted file mode 100644 index e055aa4f577f5e..00000000000000 --- a/x-pack/plugins/dashboard_mode/common/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { UI_SETTINGS } from './constants'; diff --git a/x-pack/plugins/dashboard_mode/jest.config.js b/x-pack/plugins/dashboard_mode/jest.config.js deleted file mode 100644 index 7d0585938d166d..00000000000000 --- a/x-pack/plugins/dashboard_mode/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -module.exports = { - preset: '@kbn/test', - rootDir: '../../..', - roots: ['/x-pack/plugins/dashboard_mode'], -}; diff --git a/x-pack/plugins/dashboard_mode/kibana.json b/x-pack/plugins/dashboard_mode/kibana.json deleted file mode 100644 index 6fc59ce9a7fa11..00000000000000 --- a/x-pack/plugins/dashboard_mode/kibana.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "dashboardMode", - "owner": { - "name": "Kibana Presentation", - "githubTeam": "kibana-presentation" - }, - "version": "8.0.0", - "kibanaVersion": "kibana", - "configPath": ["xpack", "dashboard_mode"], - "optionalPlugins": ["security"], - "requiredPlugins": ["kibanaLegacy", "urlForwarding", "dashboard"], - "server": true, - "ui": true -} diff --git a/x-pack/plugins/dashboard_mode/public/index.ts b/x-pack/plugins/dashboard_mode/public/index.ts deleted file mode 100644 index 2418c0592acc1f..00000000000000 --- a/x-pack/plugins/dashboard_mode/public/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { plugin } from './plugin'; diff --git a/x-pack/plugins/dashboard_mode/public/plugin.ts b/x-pack/plugins/dashboard_mode/public/plugin.ts deleted file mode 100644 index efad46ab47fe7b..00000000000000 --- a/x-pack/plugins/dashboard_mode/public/plugin.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { trimStart } from 'lodash'; -import { CoreSetup } from 'kibana/public'; -import { KibanaLegacyStart } from '../../../../src/plugins/kibana_legacy/public'; -import { UrlForwardingStart } from '../../../../src/plugins/url_forwarding/public'; -import { - createDashboardEditUrl, - DashboardConstants, -} from '../../../../src/plugins/dashboard/public'; -import { AppNavLinkStatus } from '../../../../src/core/public'; - -function defaultUrl(defaultAppId: string) { - const isDashboardId = defaultAppId.startsWith(dashboardAppIdPrefix()); - return isDashboardId ? `/${defaultAppId}` : DashboardConstants.LANDING_PAGE_PATH; -} - -function dashboardAppIdPrefix() { - return trimStart(createDashboardEditUrl(''), '/'); -} - -function migratePath( - currentHash: string, - kibanaLegacy: KibanaLegacyStart, - urlForwarding: UrlForwardingStart -) { - if (currentHash === '' || currentHash === '#' || currentHash === '#/') { - return `#${defaultUrl(kibanaLegacy.config.defaultAppId || '')}`; - } - if (!currentHash.startsWith('#/dashboard')) { - return currentHash; - } - - const forwards = urlForwarding.getForwards(); - - if (currentHash.startsWith('#/dashboards')) { - const { rewritePath: migrateListingPath } = forwards.find( - ({ legacyAppId }) => legacyAppId === 'dashboards' - )!; - return migrateListingPath(currentHash); - } - - const { rewritePath: migrateDetailPath } = forwards.find( - ({ legacyAppId }) => legacyAppId === 'dashboard' - )!; - return migrateDetailPath(currentHash); -} - -export const plugin = () => ({ - setup(core: CoreSetup<{ kibanaLegacy: KibanaLegacyStart; urlForwarding: UrlForwardingStart }>) { - core.application.register({ - id: 'dashboard_mode', - title: 'Dashboard mode', - navLinkStatus: AppNavLinkStatus.hidden, - mount: async () => { - const [coreStart, { kibanaLegacy, urlForwarding }] = await core.getStartServices(); - kibanaLegacy.dashboardConfig.turnHideWriteControlsOn(); - coreStart.chrome.navLinks.showOnly('dashboards'); - setTimeout(() => { - coreStart.application.navigateToApp('dashboards', { - path: migratePath(window.location.hash, kibanaLegacy, urlForwarding), - }); - }, 0); - return () => {}; - }, - }); - }, - start() {}, -}); diff --git a/x-pack/plugins/dashboard_mode/server/index.ts b/x-pack/plugins/dashboard_mode/server/index.ts deleted file mode 100644 index 8be8ec09a28984..00000000000000 --- a/x-pack/plugins/dashboard_mode/server/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { PluginConfigDescriptor, PluginInitializerContext } from 'kibana/server'; -import { schema } from '@kbn/config-schema'; - -import { DashboardModeServerPlugin } from './plugin'; - -export const config: PluginConfigDescriptor = { - schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), -}; - -export function plugin(initializerContext: PluginInitializerContext) { - return new DashboardModeServerPlugin(initializerContext); -} - -export { DashboardModeServerPlugin as Plugin }; diff --git a/x-pack/plugins/dashboard_mode/server/interceptors/dashboard_mode_request_interceptor.test.ts b/x-pack/plugins/dashboard_mode/server/interceptors/dashboard_mode_request_interceptor.test.ts deleted file mode 100644 index e2e2c8c005670f..00000000000000 --- a/x-pack/plugins/dashboard_mode/server/interceptors/dashboard_mode_request_interceptor.test.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { parse as parseUrl } from 'url'; -import { - OnPostAuthHandler, - OnPostAuthToolkit, - KibanaRequest, - LifecycleResponseFactory, - IUiSettingsClient, -} from 'kibana/server'; -import { coreMock } from '../../../../../src/core/server/mocks'; - -import { AuthenticatedUser } from '../../../security/server'; -import { securityMock } from '../../../security/server/mocks'; - -import { setupDashboardModeRequestInterceptor } from './dashboard_mode_request_interceptor'; - -const DASHBOARD_ONLY_MODE_ROLE = 'test_dashboard_only_mode_role'; - -describe('DashboardOnlyModeRequestInterceptor', () => { - const core = coreMock.createSetup(); - const security = securityMock.createSetup(); - - let interceptor: OnPostAuthHandler; - let toolkit: OnPostAuthToolkit; - let uiSettingsMock: any; - - beforeEach(() => { - toolkit = { - next: jest.fn(), - }; - interceptor = setupDashboardModeRequestInterceptor({ - http: core.http, - security, - getUiSettingsClient: () => - (Promise.resolve({ - get: () => Promise.resolve(uiSettingsMock), - }) as unknown) as Promise, - }); - }); - - test('should not redirects for not app/* requests', async () => { - const request = ({ - url: { - pathname: 'api/test', - }, - } as unknown) as KibanaRequest; - - interceptor(request, {} as LifecycleResponseFactory, toolkit); - - expect(toolkit.next).toHaveBeenCalled(); - }); - - test('should not redirects not authenticated users', async () => { - const request = ({ - url: { - pathname: '/app/home', - }, - } as unknown) as KibanaRequest; - - interceptor(request, {} as LifecycleResponseFactory, toolkit); - - expect(toolkit.next).toHaveBeenCalled(); - }); - - describe('request for dashboard-only user', () => { - function testRedirectToDashboardModeApp(url: string) { - describe(`requests to url:"${url}"`, () => { - test('redirects to the dashboard_mode app instead', async () => { - const { pathname, search, hash } = parseUrl(url); - const request = ({ - url: { pathname, search, hash }, - credentials: { - roles: [DASHBOARD_ONLY_MODE_ROLE], - }, - } as unknown) as KibanaRequest; - - const response = ({ - redirected: jest.fn(), - } as unknown) as LifecycleResponseFactory; - - security.authc.getCurrentUser = jest.fn( - (r: KibanaRequest) => - (({ - roles: [DASHBOARD_ONLY_MODE_ROLE], - } as unknown) as AuthenticatedUser) - ); - - uiSettingsMock = [DASHBOARD_ONLY_MODE_ROLE]; - - await interceptor(request, response, toolkit); - - expect(response.redirected).toHaveBeenCalledWith({ - headers: { location: `/mock-server-basepath/app/dashboard_mode` }, - }); - }); - }); - } - - testRedirectToDashboardModeApp('/app/kibana'); - testRedirectToDashboardModeApp('/app/kibana#/foo/bar'); - testRedirectToDashboardModeApp('/app/kibana/foo/bar'); - testRedirectToDashboardModeApp('/app/kibana?foo=bar'); - testRedirectToDashboardModeApp('/app/dashboards?foo=bar'); - testRedirectToDashboardModeApp('/app/home?foo=bar'); - }); -}); diff --git a/x-pack/plugins/dashboard_mode/server/interceptors/dashboard_mode_request_interceptor.ts b/x-pack/plugins/dashboard_mode/server/interceptors/dashboard_mode_request_interceptor.ts deleted file mode 100644 index c177d24de0009f..00000000000000 --- a/x-pack/plugins/dashboard_mode/server/interceptors/dashboard_mode_request_interceptor.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { HttpServiceSetup, OnPostAuthHandler, IUiSettingsClient } from 'kibana/server'; -import { SecurityPluginSetup } from '../../../security/server'; -import { UI_SETTINGS } from '../../common'; - -const superuserRole = 'superuser'; - -interface DashboardModeRequestInterceptorDependencies { - http: HttpServiceSetup; - security: SecurityPluginSetup; - getUiSettingsClient: () => Promise; -} - -export const setupDashboardModeRequestInterceptor = ({ - http, - security, - getUiSettingsClient, -}: DashboardModeRequestInterceptorDependencies) => - (async (request, response, toolkit) => { - const path = request.url.pathname; - const isAppRequest = path.startsWith('/app/'); - - if (!isAppRequest) { - return toolkit.next(); - } - - const authenticatedUser = security.authc.getCurrentUser(request); - const roles = authenticatedUser?.roles || []; - - if (!authenticatedUser || roles.length === 0) { - return toolkit.next(); - } - - const uiSettings = await getUiSettingsClient(); - const dashboardOnlyModeRoles = await uiSettings.get( - UI_SETTINGS.CONFIG_DASHBOARD_ONLY_MODE_ROLES - ); - - if (!dashboardOnlyModeRoles) { - return toolkit.next(); - } - - const isDashboardOnlyModeUser = roles.find((role) => dashboardOnlyModeRoles.includes(role)); - const isSuperUser = roles.find((role) => role === superuserRole); - - const enforceDashboardOnlyMode = isDashboardOnlyModeUser && !isSuperUser; - - if (enforceDashboardOnlyMode) { - if ( - path.startsWith('/app/home') || - path.startsWith('/app/kibana') || - path.startsWith('/app/dashboards') - ) { - const dashBoardModeUrl = `${http.basePath.get(request)}/app/dashboard_mode`; - // If the user is in "Dashboard only mode" they should only be allowed to see - // the dashboard app and none others. - - return response.redirected({ - headers: { - location: dashBoardModeUrl, - }, - }); - } - - if (path.startsWith('/app/dashboard_mode')) { - // let through requests to the dashboard_mode app - return toolkit.next(); - } - - return response.notFound(); - } - - return toolkit.next(); - }) as OnPostAuthHandler; diff --git a/x-pack/plugins/dashboard_mode/server/interceptors/index.ts b/x-pack/plugins/dashboard_mode/server/interceptors/index.ts deleted file mode 100644 index 5736fb5c86e226..00000000000000 --- a/x-pack/plugins/dashboard_mode/server/interceptors/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { setupDashboardModeRequestInterceptor } from './dashboard_mode_request_interceptor'; diff --git a/x-pack/plugins/dashboard_mode/server/plugin.ts b/x-pack/plugins/dashboard_mode/server/plugin.ts deleted file mode 100644 index 2c526ba03ef561..00000000000000 --- a/x-pack/plugins/dashboard_mode/server/plugin.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - PluginInitializerContext, - CoreSetup, - CoreStart, - Plugin, - SavedObjectsClient, - Logger, -} from '../../../../src/core/server'; - -import { SecurityPluginSetup } from '../../security/server'; -import { setupDashboardModeRequestInterceptor } from './interceptors'; - -import { getUiSettings } from './ui_settings'; - -interface DashboardModeServerSetupDependencies { - security?: SecurityPluginSetup; -} - -export class DashboardModeServerPlugin implements Plugin { - private initializerContext: PluginInitializerContext; - private logger?: Logger; - - constructor(initializerContext: PluginInitializerContext) { - this.initializerContext = initializerContext; - } - - public setup(core: CoreSetup, { security }: DashboardModeServerSetupDependencies) { - this.logger = this.initializerContext.logger.get(); - - core.uiSettings.register(getUiSettings()); - - const getUiSettingsClient = async () => { - const [coreStart] = await core.getStartServices(); - const { savedObjects, uiSettings } = coreStart; - const savedObjectsClient = new SavedObjectsClient(savedObjects.createInternalRepository()); - - return uiSettings.asScopedToClient(savedObjectsClient); - }; - - if (security) { - const dashboardModeRequestInterceptor = setupDashboardModeRequestInterceptor({ - http: core.http, - security, - getUiSettingsClient, - }); - - core.http.registerOnPostAuth(dashboardModeRequestInterceptor); - - this.logger.debug(`registered DashboardModeRequestInterceptor`); - } - } - - public start(core: CoreStart) {} - - public stop() {} -} diff --git a/x-pack/plugins/dashboard_mode/server/ui_settings.ts b/x-pack/plugins/dashboard_mode/server/ui_settings.ts deleted file mode 100644 index a0678b7b27bdd5..00000000000000 --- a/x-pack/plugins/dashboard_mode/server/ui_settings.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; -import { schema } from '@kbn/config-schema'; -import { UiSettingsParams } from 'kibana/server'; -import { UI_SETTINGS } from '../common'; - -const DASHBOARD_ONLY_USER_ROLE = 'kibana_dashboard_only_user'; - -export function getUiSettings(): Record> { - return { - [UI_SETTINGS.CONFIG_DASHBOARD_ONLY_MODE_ROLES]: { - name: i18n.translate('xpack.dashboardMode.uiSettings.dashboardsOnlyRolesTitle', { - defaultMessage: 'Dashboards only roles', - }), - description: i18n.translate('xpack.dashboardMode.uiSettings.dashboardsOnlyRolesDescription', { - defaultMessage: 'Roles that belong to View Dashboards Only mode', - }), - value: [DASHBOARD_ONLY_USER_ROLE], - category: ['dashboard'], - sensitive: true, - deprecation: { - message: i18n.translate('xpack.dashboardMode.uiSettings.dashboardsOnlyRolesDeprecation', { - defaultMessage: 'This setting is deprecated and will be removed in Kibana 8.0.', - }), - docLinksKey: 'dashboardSettings', - }, - schema: schema.arrayOf(schema.string()), - }, - }; -} diff --git a/x-pack/plugins/dashboard_mode/tsconfig.json b/x-pack/plugins/dashboard_mode/tsconfig.json deleted file mode 100644 index 8094e70e96b602..00000000000000 --- a/x-pack/plugins/dashboard_mode/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true, - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*", - "../../../typings/**/*" - ], - "references": [ - { "path": "../../../src/core/tsconfig.json" }, - { "path": "../../../src/plugins/dashboard/tsconfig.json" }, - { "path": "../../../src/plugins/kibana_legacy/tsconfig.json" }, - { "path": "../../../src/plugins/url_forwarding/tsconfig.json" }, - { "path": "../security/tsconfig.json" } - ] -} diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts index 44ea53fe0b8706..c1c84c040f51e6 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n'; import { DiscoverStart } from '../../../../../../src/plugins/discover/public'; import { ViewMode, IEmbeddable } from '../../../../../../src/plugins/embeddable/public'; import { StartServicesGetter } from '../../../../../../src/plugins/kibana_utils/public'; -import { KibanaLegacyStart } from '../../../../../../src/plugins/kibana_legacy/public'; import { CoreStart } from '../../../../../../src/core/public'; import { KibanaLocation } from '../../../../../../src/plugins/share/public'; import * as shared from './shared'; @@ -18,11 +17,6 @@ export const ACTION_EXPLORE_DATA = 'ACTION_EXPLORE_DATA'; export interface PluginDeps { discover: Pick; - kibanaLegacy?: { - dashboardConfig: { - getHideWriteControls: KibanaLegacyStart['dashboardConfig']['getHideWriteControls']; - }; - }; } export interface CoreDeps { @@ -53,11 +47,6 @@ export abstract class AbstractExploreDataAction { const core = coreMock.createStart(); @@ -65,11 +63,6 @@ const setup = ( discover: { locator, }, - kibanaLegacy: { - dashboardConfig: { - getHideWriteControls: () => dashboardOnlyMode, - }, - }, }; const params: Params = { @@ -193,13 +186,6 @@ describe('"Explore underlying data" panel action', () => { expect(isCompatible).toBe(false); }); - test('return false for dashboard_only mode', async () => { - const { action, context } = setup({ dashboardOnlyMode: true }); - const isCompatible = await action.isCompatible(context); - - expect(isCompatible).toBe(false); - }); - test('returns false if Discover app is disabled', async () => { const { action, context, core } = setup(); diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts index e0a8cf20ee943d..334898ada6a3ef 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/explore_data_context_menu_action.test.ts @@ -28,7 +28,7 @@ afterEach(() => { i18nTranslateSpy.mockClear(); }); -const setup = ({ dashboardOnlyMode = false }: { dashboardOnlyMode?: boolean } = {}) => { +const setup = () => { const core = coreMock.createStart(); const locator: DiscoverAppLocator = { getLocation: jest.fn(() => @@ -51,11 +51,6 @@ const setup = ({ dashboardOnlyMode = false }: { dashboardOnlyMode?: boolean } = discover: { locator, }, - kibanaLegacy: { - dashboardConfig: { - getHideWriteControls: () => dashboardOnlyMode, - }, - }, }; const params: Params = { @@ -177,13 +172,6 @@ describe('"Explore underlying data" panel action', () => { expect(isCompatible).toBe(false); }); - test('return false for dashboard_only mode', async () => { - const { action, context } = setup({ dashboardOnlyMode: true }); - const isCompatible = await action.isCompatible(context); - - expect(isCompatible).toBe(false); - }); - test('returns false if Discover app is disabled', async () => { const { action, context, core } = setup(); diff --git a/x-pack/plugins/monitoring/public/alerts/enable_alerts_modal.tsx b/x-pack/plugins/monitoring/public/alerts/enable_alerts_modal.tsx index 827ce958deb119..780997ca98191d 100644 --- a/x-pack/plugins/monitoring/public/alerts/enable_alerts_modal.tsx +++ b/x-pack/plugins/monitoring/public/alerts/enable_alerts_modal.tsx @@ -42,7 +42,7 @@ export const EnableAlertsModal: React.FC = ({ alerts }: Props) => { { id: 'create-alerts', label: i18n.translate('xpack.monitoring.alerts.modal.yesOption', { - defaultMessage: 'Yes (Recommended - create default rules in this kibana spaces)', + defaultMessage: 'Yes (Recommended - create default rules in this kibana space)', }), }, { diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/acknowledged.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/acknowledged.spec.ts index f933c5a4ed0a29..516ac444f0774a 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/acknowledged.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/acknowledged.spec.ts @@ -53,7 +53,7 @@ describe('Marking alerts as acknowledged', () => { refreshPage(); waitForAlertsToBeLoaded(); goToOpenedAlerts(); - + waitForAlertsToBeLoaded(); const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeMarkedAcknowledged; cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`); diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.test.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.test.tsx index c5a04e3a626df1..1ef57a3499922e 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.test.tsx @@ -6,7 +6,11 @@ */ import { ExistsFilter, Filter } from '@kbn/es-query'; -import { buildAlertsRuleIdFilter, buildThreatMatchFilter } from './default_config'; +import { + buildAlertsRuleIdFilter, + buildAlertStatusFilter, + buildThreatMatchFilter, +} from './default_config'; jest.mock('./actions'); @@ -61,6 +65,65 @@ describe('alerts default_config', () => { }); }); + describe('buildAlertStatusFilter', () => { + test('when status is acknowledged, filter will build for both `in-progress` and `acknowledged`', () => { + const filters = buildAlertStatusFilter('acknowledged'); + const expected = { + meta: { + alias: null, + disabled: false, + key: 'signal.status', + negate: false, + params: { + query: 'acknowledged', + }, + type: 'phrase', + }, + query: { + bool: { + should: [ + { + term: { + 'signal.status': 'acknowledged', + }, + }, + { + term: { + 'signal.status': 'in-progress', + }, + }, + ], + }, + }, + }; + expect(filters).toHaveLength(1); + expect(filters[0]).toEqual(expected); + }); + + test('when status is `open` or `closed`, filter will build for solely that status', () => { + const filters = buildAlertStatusFilter('open'); + const expected = { + meta: { + alias: null, + disabled: false, + key: 'signal.status', + negate: false, + params: { + query: 'open', + }, + type: 'phrase', + }, + query: { + term: { + 'signal.status': 'open', + }, + }, + }; + expect(filters).toHaveLength(1); + expect(filters[0]).toEqual(expected); + }); + }); + // TODO: move these tests to ../timelines/components/timeline/body/events/event_column_view.tsx // describe.skip('getAlertActions', () => { // let setEventsLoading: ({ eventIds, isLoading }: SetEventsLoadingProps) => void; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx index 75bd41037934b7..1c58c339cb5b24 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx @@ -26,25 +26,47 @@ import { SubsetTimelineModel } from '../../../timelines/store/timeline/model'; import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; import { columns } from '../../configurations/security_solution_detections/columns'; -export const buildAlertStatusFilter = (status: Status): Filter[] => [ - { - meta: { - alias: null, - negate: false, - disabled: false, - type: 'phrase', - key: 'signal.status', - params: { - query: status, - }, - }, - query: { - term: { - 'signal.status': status, +export const buildAlertStatusFilter = (status: Status): Filter[] => { + const combinedQuery = + status === 'acknowledged' + ? { + bool: { + should: [ + { + term: { + 'signal.status': status, + }, + }, + { + term: { + 'signal.status': 'in-progress', + }, + }, + ], + }, + } + : { + term: { + 'signal.status': status, + }, + }; + + return [ + { + meta: { + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: 'signal.status', + params: { + query: status, + }, }, + query: combinedQuery, }, - }, -]; + ]; +}; export const buildAlertsRuleIdFilter = (ruleId: string | null): Filter[] => ruleId @@ -139,25 +161,47 @@ export const requiredFieldsForActions = [ ]; // TODO: Once we are past experimental phase this code should be removed -export const buildAlertStatusFilterRuleRegistry = (status: Status): Filter[] => [ - { - meta: { - alias: null, - negate: false, - disabled: false, - type: 'phrase', - key: ALERT_STATUS, - params: { - query: status, - }, - }, - query: { - term: { - [ALERT_STATUS]: status, +export const buildAlertStatusFilterRuleRegistry = (status: Status): Filter[] => { + const combinedQuery = + status === 'acknowledged' + ? { + bool: { + should: [ + { + term: { + [ALERT_STATUS]: status, + }, + }, + { + term: { + [ALERT_STATUS]: 'in-progress', + }, + }, + ], + }, + } + : { + term: { + [ALERT_STATUS]: status, + }, + }; + + return [ + { + meta: { + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: ALERT_STATUS, + params: { + query: status, + }, }, + query: combinedQuery, }, - }, -]; + ]; +}; export const buildShowBuildingBlockFilterRuleRegistry = ( showBuildingBlockAlerts: boolean diff --git a/x-pack/plugins/security_solution/public/detections/configurations/security_solution_detections/columns.ts b/x-pack/plugins/security_solution/public/detections/configurations/security_solution_detections/columns.ts index 89de83ab6e5cfe..beeed344c31ef0 100644 --- a/x-pack/plugins/security_solution/public/detections/configurations/security_solution_detections/columns.ts +++ b/x-pack/plugins/security_solution/public/detections/configurations/security_solution_detections/columns.ts @@ -26,7 +26,7 @@ export const columns: Array< { columnHeaderType: defaultColumnHeaderType, id: '@timestamp', - initialWidth: DEFAULT_DATE_COLUMN_MIN_WIDTH + 5, + initialWidth: DEFAULT_DATE_COLUMN_MIN_WIDTH + 10, }, { columnHeaderType: defaultColumnHeaderType, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap index 6050263fff6381..6bc2dc089494dd 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/__snapshots__/index.test.tsx.snap @@ -521,6 +521,7 @@ exports[`ColumnHeaders rendering renders correctly against snapshot 1`] = ` "compare": null, "type": [Function], }, + "width": 108, }, ] } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/control_columns/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/control_columns/index.tsx index e4f4c26417351b..d38bf2136513e4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/control_columns/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/control_columns/index.tsx @@ -9,8 +9,11 @@ import { ControlColumnProps } from '../../../../../../common/types/timeline'; import { Actions } from '../actions'; import { HeaderActions } from '../actions/header_actions'; +const DEFAULT_CONTROL_COLUMN_WIDTH = 108; + export const defaultControlColumn: ControlColumnProps = { id: 'default-timeline-control-column', + width: DEFAULT_CONTROL_COLUMN_WIDTH, headerCellRender: HeaderActions, rowCellRender: Actions, }; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index dcea8f43a8f54d..87d10ff1ff13bf 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7609,9 +7609,6 @@ "xpack.dashboard.drilldown.goToDashboard": "ダッシュボードに移動", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "ドリルダウンを作成", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "ドリルダウンを管理", - "xpack.dashboardMode.uiSettings.dashboardsOnlyRolesDeprecation": "この設定はサポートが終了し、Kibana 8.0 では削除されます。", - "xpack.dashboardMode.uiSettings.dashboardsOnlyRolesDescription": "ダッシュボード表示専用モードのロールです", - "xpack.dashboardMode.uiSettings.dashboardsOnlyRolesTitle": "ダッシュボード専用ロール", "xpack.data.mgmt.searchSessions.actionDelete": "削除", "xpack.data.mgmt.searchSessions.actionExtend": "延長", "xpack.data.mgmt.searchSessions.actionRename": "名前を編集", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 95cd134e16f71a..0d546e6b9455a4 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7851,9 +7851,6 @@ "xpack.dashboard.drilldown.goToDashboard": "前往仪表板", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "创建向下钻取", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "管理向下钻取", - "xpack.dashboardMode.uiSettings.dashboardsOnlyRolesDeprecation": "此设置已过时,将在 Kibana 8.0 中移除。", - "xpack.dashboardMode.uiSettings.dashboardsOnlyRolesDescription": "属于“仅查看仪表板”模式的角色", - "xpack.dashboardMode.uiSettings.dashboardsOnlyRolesTitle": "仅限仪表板的角色", "xpack.data.mgmt.searchSessions.actionDelete": "删除", "xpack.data.mgmt.searchSessions.actionExtend": "延长", "xpack.data.mgmt.searchSessions.actionRename": "编辑名称", diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts index 7e819fb15ea1fc..93535826d14e70 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts @@ -39,7 +39,8 @@ export default function alertTests({ getService }: FtrProviderContext) { const esTestIndexTool = new ESTestIndexTool(es, retry); const taskManagerUtils = new TaskManagerUtils(es, retry); - describe('alerts', () => { + // FLAKY: https://github.com/elastic/kibana/issues/106492 + describe.skip('alerts', () => { const authorizationIndex = '.kibana-test-authorization'; const objectRemover = new ObjectRemover(supertest); diff --git a/x-pack/test/api_integration/apis/ml/modules/index.ts b/x-pack/test/api_integration/apis/ml/modules/index.ts index ffb1a14a184697..c6a75eccfa4c83 100644 --- a/x-pack/test/api_integration/apis/ml/modules/index.ts +++ b/x-pack/test/api_integration/apis/ml/modules/index.ts @@ -14,8 +14,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const fleetPackages = ['apache', 'nginx']; - // FLAKY: https://github.com/elastic/kibana/issues/102282 - describe.skip('modules', function () { + describe('modules', function () { before(async () => { // use empty_kibana to make sure the fleet setup is removed correctly after the tests await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana'); diff --git a/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts b/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts index fc56615b3b13aa..dac9ed70bc483b 100644 --- a/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts +++ b/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts @@ -43,7 +43,8 @@ export default function ApiTest({ getService }: FtrProviderContext) { } ); - registry.when( + // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109583 + registry.when.skip( 'correlations latency slow transactions with data and default args', { config: 'trial', archives: ['apm_8.0.0'] }, () => { diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js deleted file mode 100644 index 2adf13db26250d..00000000000000 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; - -export default function ({ getPageObjects, getService }) { - const testSubjects = getService('testSubjects'); - const esArchiver = getService('esArchiver'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const PageObjects = getPageObjects(['common', 'dashboard', 'visualize', 'lens']); - - // FLAKY: https://github.com/elastic/kibana/issues/102366 - describe.skip('empty dashboard', function () { - before(async () => { - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.clickNewDashboard(); - }); - - after(async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('adds Lens visualization to empty dashboard', async () => { - const title = 'Dashboard Test Lens'; - await PageObjects.lens.createAndAddLensFromDashboard({ title, redirectToOrigin: true }); - await PageObjects.dashboard.waitForRenderComplete(); - await testSubjects.exists(`embeddablePanelHeading-${title}`); - }); - - it('redirects via save and return button after edit', async () => { - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.lens.saveAndReturn(); - }); - - it('redirects via save as button after edit, renaming itself', async () => { - const newTitle = 'wowee, looks like I have a new title'; - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.dashboard.waitForRenderComplete(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.lens.save(newTitle, false, true); - await PageObjects.dashboard.waitForRenderComplete(); - const newPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(newPanelCount).to.eql(originalPanelCount); - const titles = await PageObjects.dashboard.getPanelTitles(); - expect(titles.indexOf(newTitle)).to.not.be(-1); - }); - - it('redirects via save as button after edit, adding a new panel', async () => { - const newTitle = 'wowee, my title just got cooler'; - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.dashboard.waitForRenderComplete(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.lens.save(newTitle, true, true); - await PageObjects.dashboard.waitForRenderComplete(); - const newPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(newPanelCount).to.eql(originalPanelCount + 1); - const titles = await PageObjects.dashboard.getPanelTitles(); - expect(titles.indexOf(newTitle)).to.not.be(-1); - }); - - it('loses originatingApp connection after save as when redirectToOrigin is false', async () => { - await PageObjects.dashboard.saveDashboard('empty dashboard test'); - await PageObjects.dashboard.switchToEditMode(); - const newTitle = 'wowee, my title just got cooler again'; - await PageObjects.dashboard.waitForRenderComplete(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.lens.save(newTitle, true, false); - await PageObjects.lens.notLinkedToOriginatingApp(); - await PageObjects.common.navigateToApp('dashboard'); - }); - - it('loses originatingApp connection after first save when redirectToOrigin is false', async () => { - const title = 'non-dashboard Test Lens'; - await PageObjects.dashboard.loadSavedDashboard('empty dashboard test'); - await PageObjects.dashboard.switchToEditMode(); - await PageObjects.lens.createAndAddLensFromDashboard({ title }); - await PageObjects.lens.notLinkedToOriginatingApp(); - await PageObjects.common.navigateToApp('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 deleted file mode 100644 index af7d16969c6058..00000000000000 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; - -export default function ({ getService, getPageObjects }) { - const kibanaServer = getService('kibanaServer'); - const esArchiver = getService('esArchiver'); - const browser = getService('browser'); - const log = getService('log'); - const pieChart = getService('pieChart'); - const security = getService('security'); - const testSubjects = getService('testSubjects'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const appsMenu = getService('appsMenu'); - const filterBar = getService('filterBar'); - const PageObjects = getPageObjects([ - 'security', - 'common', - 'discover', - 'dashboard', - 'header', - 'settings', - 'timePicker', - 'share', - ]); - const dashboardName = 'Dashboard View Mode Test Dashboard'; - - describe('Dashboard View Mode', function () { - this.tags(['skipFirefox']); - - before('initialize tests', async () => { - log.debug('Dashboard View Mode:initTests'); - await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); - await kibanaServer.importExport.load( - 'x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode' - ); - await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' }); - await browser.setWindowSize(1600, 1000); - - await PageObjects.common.navigateToApp('dashboard'); - }); - - after(async () => { - await kibanaServer.importExport.unload( - 'x-pack/test/functional/fixtures/kbn_archiver/dashboard_view_mode' - ); - const types = [ - 'search', - 'dashboard', - 'visualization', - 'search-session', - 'core-usage-stats', - 'event_loop_delays_daily', - 'search-telemetry', - 'core-usage-stats', - ]; - await kibanaServer.savedObjects.clean({ types }); - }); - - // FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/109351 - describe.skip('Dashboard viewer', () => { - after(async () => { - await security.testUser.restoreDefaults(); - }); - - it('shows only the dashboard app link', async () => { - await security.testUser.setRoles(['test_logstash_reader', 'kibana_dashboard_only_user']); - await PageObjects.header.waitUntilLoadingHasFinished(); - const appLinks = await appsMenu.readLinks(); - expect(appLinks).to.have.length(1); - expect(appLinks[0]).to.have.property('text', 'Dashboard'); - }); - - it('shows the dashboard landing page by default', async () => { - const currentUrl = await browser.getCurrentUrl(); - console.log('url: ', currentUrl); - expect(currentUrl).to.contain('dashboards'); - }); - - it('does not show the create dashboard button', async () => { - const createNewButtonExists = await testSubjects.exists('newItemButton'); - expect(createNewButtonExists).to.be(false); - }); - - it('opens a dashboard up', async () => { - await PageObjects.dashboard.loadSavedDashboard(dashboardName); - const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage(); - expect(onDashboardLandingPage).to.be(false); - }); - - it('can filter on a visualization', async () => { - await PageObjects.timePicker.setHistoricalDataRange(); - await pieChart.filterOnPieSlice(); - const filterCount = await filterBar.getFilterCount(); - expect(filterCount).to.equal(1); - }); - - it('shows the full screen menu item', async () => { - const fullScreenMenuItemExists = await testSubjects.exists('dashboardFullScreenMode'); - expect(fullScreenMenuItemExists).to.be(true); - }); - - it('does not show the edit menu item', async () => { - const editMenuItemExists = await testSubjects.exists('dashboardEditMode'); - expect(editMenuItemExists).to.be(false); - }); - - it('does not show the view menu item', async () => { - const viewMenuItemExists = await testSubjects.exists('dashboardViewOnlyMode'); - expect(viewMenuItemExists).to.be(false); - }); - - it('does not show the reporting menu item', async () => { - const reportingMenuItemExists = await testSubjects.exists('topNavReportingLink'); - expect(reportingMenuItemExists).to.be(false); - }); - - it('shows the sharing menu item', async () => { - const shareMenuItemExists = await testSubjects.exists('shareTopNavButton'); - expect(shareMenuItemExists).to.be(true); - }); - - it(`Permalinks doesn't show create short-url button`, async () => { - await PageObjects.share.openShareMenuItem('Permalinks'); - await PageObjects.share.createShortUrlMissingOrFail(); - }); - - it('does not show the visualization edit icon', async () => { - await dashboardPanelActions.expectMissingEditPanelAction(); - }); - - it('does not show the visualization delete icon', async () => { - await dashboardPanelActions.expectMissingRemovePanelAction(); - }); - - it('shows the timepicker', async () => { - const timePickerExists = await PageObjects.timePicker.timePickerExists(); - expect(timePickerExists).to.be(true); - }); - - it('can paginate on a saved search', async () => { - await PageObjects.dashboard.expectToolbarPaginationDisplayed({ displayed: true }); - }); - - it('is loaded for a user who is assigned a non-dashboard mode role', async () => { - await security.testUser.setRoles([ - 'test_logstash_reader', - 'kibana_dashboard_only_user', - 'kibana_admin', - ]); - await PageObjects.header.waitUntilLoadingHasFinished(); - - if (await appsMenu.linkExists('Stack Management')) { - throw new Error('Expected management nav link to not be shown'); - } - }); - - it('is not loaded for a user who is assigned a superuser role', async () => { - await security.testUser.setRoles(['kibana_dashboard_only_user', 'superuser']); - await PageObjects.header.waitUntilLoadingHasFinished(); - - if (!(await appsMenu.linkExists('Stack Management'))) { - throw new Error('Expected management nav link to be shown'); - } - }); - }); - }); -} diff --git a/x-pack/test/functional/apps/dashboard_mode/index.js b/x-pack/test/functional/apps/dashboard_mode/index.js deleted file mode 100644 index c28b805dc6b23f..00000000000000 --- a/x-pack/test/functional/apps/dashboard_mode/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export default function ({ loadTestFile }) { - describe('dashboard mode', function () { - this.tags('ciGroup7'); - - loadTestFile(require.resolve('./dashboard_view_mode')); - loadTestFile(require.resolve('./dashboard_empty_screen')); - }); -} diff --git a/x-pack/test/functional/apps/infra/home_page.ts b/x-pack/test/functional/apps/infra/home_page.ts index e344f86f89fe8e..255f2c49e56217 100644 --- a/x-pack/test/functional/apps/infra/home_page.ts +++ b/x-pack/test/functional/apps/infra/home_page.ts @@ -87,7 +87,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); - describe('Saved Views', () => { + // FLAKY: https://github.com/elastic/kibana/issues/106650 + describe.skip('Saved Views', () => { before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs')); after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs')); it('should have save and load controls', async () => { diff --git a/x-pack/test/functional/apps/uptime/overview.ts b/x-pack/test/functional/apps/uptime/overview.ts index 2d2c3a8d5faa77..17311bc99e22d3 100644 --- a/x-pack/test/functional/apps/uptime/overview.ts +++ b/x-pack/test/functional/apps/uptime/overview.ts @@ -15,7 +15,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - describe('overview page', function () { + // FLAKY: https://github.com/elastic/kibana/issues/89072 + describe.skip('overview page', function () { const DEFAULT_DATE_START = 'Sep 10, 2019 @ 12:40:08.078'; const DEFAULT_DATE_END = 'Sep 11, 2019 @ 19:40:08.078'; diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 704ce819b5b382..c8822b62ebd812 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -29,7 +29,6 @@ export default async function ({ readConfigFile }) { resolve(__dirname, './apps/monitoring'), resolve(__dirname, './apps/watcher'), resolve(__dirname, './apps/dashboard'), - resolve(__dirname, './apps/dashboard_mode'), resolve(__dirname, './apps/discover'), resolve(__dirname, './apps/security'), resolve(__dirname, './apps/spaces'), diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 1bfd24d6ad29db..0744af0776597f 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -54,7 +54,6 @@ { "path": "../plugins/banners/tsconfig.json" }, { "path": "../plugins/cases/tsconfig.json" }, { "path": "../plugins/cloud/tsconfig.json" }, - { "path": "../plugins/dashboard_mode/tsconfig.json" }, { "path": "../plugins/enterprise_search/tsconfig.json" }, { "path": "../plugins/fleet/tsconfig.json" }, { "path": "../plugins/global_search/tsconfig.json" },