diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh index b697f22c009d..ab68a60dcfc2 100755 --- a/.ci/packer_cache.sh +++ b/.ci/packer_cache.sh @@ -44,6 +44,7 @@ tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \ x-pack/legacy/plugins/*/node_modules \ x-pack/legacy/plugins/reporting/.chromium \ test/plugin_functional/plugins/*/node_modules \ + examples/*/node_modules \ .es \ .chromedriver \ .geckodriver; diff --git a/.eslintrc.js b/.eslintrc.js index 106724c323d3..03a674993ab5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -131,12 +131,6 @@ module.exports = { 'react-hooks/exhaustive-deps': 'off', }, }, - { - files: ['src/plugins/eui_utils/**/*.{js,ts,tsx}'], - rules: { - 'react-hooks/exhaustive-deps': 'off', - }, - }, { files: ['src/plugins/kibana_react/**/*.{js,ts,tsx}'], rules: { @@ -170,13 +164,6 @@ module.exports = { 'react-hooks/rules-of-hooks': 'off', }, }, - { - files: ['x-pack/legacy/plugins/infra/**/*.{js,ts,tsx}'], - rules: { - 'react-hooks/exhaustive-deps': 'off', - 'react-hooks/rules-of-hooks': 'off', - }, - }, { files: ['x-pack/legacy/plugins/lens/**/*.{js,ts,tsx}'], rules: { @@ -202,60 +189,6 @@ module.exports = { 'react-hooks/exhaustive-deps': 'off', }, }, - { - files: ['x-pack/legacy/plugins/uptime/**/*.{js,ts,tsx}'], - rules: { - 'react-hooks/exhaustive-deps': 'off', - 'react-hooks/rules-of-hooks': 'off', - }, - }, - { - files: ['x-pack/legacy/plugins/watcher/**/*.{js,ts,tsx}'], - rules: { - 'react-hooks/rules-of-hooks': 'off', - 'react-hooks/exhaustive-deps': 'off', - }, - }, - - /** - * Prettier - */ - { - files: [ - '.eslintrc.js', - 'packages/kbn-utility-types/**/*', - 'packages/kbn-eslint-plugin-eslint/**/*', - 'packages/kbn-config-schema/**/*', - 'packages/kbn-pm/**/*', - 'packages/kbn-es/**/*', - 'packages/elastic-datemath/**/*', - 'packages/kbn-i18n/**/*', - 'packages/kbn-dev-utils/**/*', - 'packages/kbn-plugin-helpers/**/*', - 'packages/kbn-plugin-generator/**/*', - 'packages/kbn-test-subj-selector/**/*', - 'packages/kbn-test/**/*', - 'packages/kbn-eslint-import-resolver-kibana/**/*', - 'src/legacy/server/saved_objects/**/*', - 'x-pack/legacy/plugins/apm/**/*', - 'x-pack/legacy/plugins/canvas/**/*', - '**/*.{ts,tsx}', - 'src/legacy/core_plugins/metrics/**/*.js', - ], - plugins: ['prettier'], - rules: Object.assign( - { - 'prettier/prettier': [ - 'error', - { - endOfLine: 'auto', - }, - ], - }, - require('eslint-config-prettier').rules, - require('eslint-config-prettier/react').rules - ), - }, /** * Files that require Apache 2.0 headers, settings @@ -317,7 +250,8 @@ module.exports = { 'src/legacy/**/*', 'x-pack/**/*', '!x-pack/**/*.test.*', - 'src/plugins/**/(public|server)/**/*', + '!x-pack/test/**/*', + '(src|x-pack)/plugins/**/(public|server)/**/*', 'src/core/(public|server)/**/*', ], from: [ @@ -337,16 +271,35 @@ module.exports = { '!src/core/server/types', '!src/core/server/*.test.mocks.ts', - 'src/plugins/**/public/**/*', - '!src/plugins/**/public/index.{js,ts,tsx}', - - 'src/plugins/**/server/**/*', - '!src/plugins/**/server/index.{js,ts,tsx}', + '(src|x-pack)/plugins/**/(public|server)/**/*', + '!(src|x-pack)/plugins/**/(public|server)/(index|mocks).{js,ts,tsx}', ], allowSameFolder: true, + errorMessage: 'Plugins may only import from top-level public and server modules.', }, { - target: ['src/core/**/*'], + target: [ + '(src|x-pack)/plugins/**/*', + '!(src|x-pack)/plugins/*/server/**/*', + + 'src/legacy/core_plugins/**/*', + '!src/legacy/core_plugins/*/server/**/*', + '!src/legacy/core_plugins/*/index.{js,ts,tsx}', + + 'x-pack/legacy/plugins/**/*', + '!x-pack/legacy/plugins/*/server/**/*', + '!x-pack/legacy/plugins/*/index.{js,ts,tsx}', + ], + from: [ + 'src/core/server', + 'src/core/server/**/*', + '(src|x-pack)/plugins/*/server/**/*', + ], + errorMessage: + 'Server modules cannot be imported into client modules or shared modules.', + }, + { + target: ['src/**/*'], from: ['x-pack/**/*'], errorMessage: 'OSS cannot import x-pack files.', }, @@ -360,6 +313,11 @@ module.exports = { ], errorMessage: 'The core cannot depend on any plugins.', }, + { + target: ['(src|x-pack)/plugins/*/public/**/*'], + from: ['ui/**/*', 'uiExports/**/*'], + errorMessage: 'Plugins cannot import legacy UI code.', + }, { from: ['src/legacy/ui/**/*', 'ui/**/*'], target: [ @@ -720,8 +678,6 @@ module.exports = { 'accessor-pairs': 'error', 'array-callback-return': 'error', 'no-array-constructor': 'error', - // This will be turned on after bug fixes are mostly completed - // 'arrow-body-style': ['warn', 'as-needed'], complexity: 'warn', // This will be turned on after bug fixes are mostly completed // 'consistent-return': 'warn', @@ -751,7 +707,6 @@ module.exports = { 'no-extra-bind': 'error', 'no-extra-boolean-cast': 'error', 'no-extra-label': 'error', - 'no-floating-decimal': 'error', 'no-func-assign': 'error', 'no-implicit-globals': 'error', 'no-implied-eval': 'error', @@ -792,8 +747,6 @@ module.exports = { 'prefer-spread': 'error', // This style will be turned on after most bugs are fixed // 'prefer-template': 'warn', - // This style will be turned on after most bugs are fixed - // quotes: ['warn', 'single', { avoidEscape: true }], 'react/boolean-prop-naming': 'error', 'react/button-has-type': 'error', 'react/forbid-dom-props': 'error', @@ -829,13 +782,10 @@ module.exports = { 'react/jsx-sort-default-props': 'error', // might be introduced after the other warns are fixed // 'react/jsx-sort-props': 'error', - 'react/jsx-tag-spacing': 'error', // might be introduced after the other warns are fixed 'react-hooks/exhaustive-deps': 'off', 'require-atomic-updates': 'error', - 'rest-spread-spacing': ['error', 'never'], 'symbol-description': 'error', - 'template-curly-spacing': 'error', 'vars-on-top': 'error', }, }, @@ -870,8 +820,6 @@ module.exports = { { files: ['x-pack/legacy/plugins/monitoring/**/*.js'], rules: { - 'block-spacing': ['error', 'always'], - curly: ['error', 'all'], 'no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }], 'no-else-return': 'error', }, @@ -888,7 +836,6 @@ module.exports = { files: ['x-pack/legacy/plugins/canvas/**/*.js'], rules: { radix: 'error', - curly: ['error', 'all'], // module importing 'import/order': [ @@ -906,7 +853,6 @@ module.exports = { 'react/self-closing-comp': 'error', 'react/sort-comp': 'error', 'react/jsx-boolean-value': 'error', - 'react/jsx-wrap-multilines': 'error', 'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }], 'react/forbid-elements': [ 'error', @@ -983,5 +929,17 @@ module.exports = { 'import/no-default-export': 'error', }, }, + + /** + * Prettier disables all conflicting rules, listing as last override so it takes precedence + */ + { + files: ['**/*'], + rules: { + ...require('eslint-config-prettier').rules, + ...require('eslint-config-prettier/react').rules, + ...require('eslint-config-prettier/@typescript-eslint').rules, + }, + }, ], }; diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c5e6768c17d4..1137fb99f81a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,7 +5,19 @@ # App /x-pack/legacy/plugins/lens/ @elastic/kibana-app /x-pack/legacy/plugins/graph/ @elastic/kibana-app +/src/plugins/share/ @elastic/kibana-app +/src/legacy/server/url_shortening/ @elastic/kibana-app /src/legacy/server/sample_data/ @elastic/kibana-app +/src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app +/src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app +/src/legacy/core_plugins/kibana/public/visualize/ @elastic/kibana-app +/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app +/src/legacy/core_plugins/kibana/public/home/ @elastic/kibana-app +/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app +/src/plugins/home/ @elastic/kibana-app +/src/plugins/kibana_legacy/ @elastic/kibana-app +/src/plugins/timelion/ @elastic/kibana-app +/src/plugins/dev_tools/ @elastic/kibana-app # App Architecture /src/plugins/data/ @elastic/kibana-app-arch @@ -14,7 +26,6 @@ /src/plugins/kibana_react/ @elastic/kibana-app-arch /src/plugins/kibana_utils/ @elastic/kibana-app-arch /src/plugins/navigation/ @elastic/kibana-app-arch -/src/plugins/share/ @elastic/kibana-app-arch /src/plugins/ui_actions/ @elastic/kibana-app-arch /src/plugins/visualizations/ @elastic/kibana-app-arch /x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch @@ -28,7 +39,6 @@ /src/legacy/core_plugins/kibana/server/routes/api/suggestions/ @elastic/kibana-app-arch /src/legacy/core_plugins/visualizations/ @elastic/kibana-app-arch /src/legacy/server/index_patterns/ @elastic/kibana-app-arch -/src/legacy/server/url_shortening/ @elastic/kibana-app-arch # APM /x-pack/legacy/plugins/apm/ @elastic/apm-ui @@ -57,6 +67,13 @@ /x-pack/test/functional/services/transform_ui/ @elastic/ml-ui /x-pack/test/functional/services/transform.ts @elastic/ml-ui +# Maps +/x-pack/legacy/plugins/maps/ @elastic/kibana-gis +/x-pack/test/api_integration/apis/maps/ @elastic/kibana-gis +/x-pack/test/functional/apps/maps/ @elastic/kibana-gis +/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis +/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis + # Operations /src/dev/ @elastic/kibana-operations /src/setup_node_env/ @elastic/kibana-operations @@ -80,7 +97,6 @@ /x-pack/plugins/licensing/ @elastic/kibana-platform /packages/kbn-config-schema/ @elastic/kibana-platform /src/legacy/server/config/ @elastic/kibana-platform -/src/legacy/server/csp/ @elastic/kibana-platform /src/legacy/server/http/ @elastic/kibana-platform /src/legacy/server/i18n/ @elastic/kibana-platform /src/legacy/server/logging/ @elastic/kibana-platform @@ -88,24 +104,31 @@ /src/legacy/server/status/ @elastic/kibana-platform # Security +/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-platform /x-pack/legacy/plugins/security/ @elastic/kibana-security /x-pack/legacy/plugins/spaces/ @elastic/kibana-security /x-pack/plugins/spaces/ @elastic/kibana-security /x-pack/legacy/plugins/encrypted_saved_objects/ @elastic/kibana-security /x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security -/src/legacy/server/csp/ @elastic/kibana-security /x-pack/plugins/security/ @elastic/kibana-security /x-pack/test/api_integration/apis/security/ @elastic/kibana-security -# Kibana Stack Services -/src/dev/i18n @elastic/kibana-stack-services -/packages/kbn-analytics/ @elastic/kibana-stack-services -/src/legacy/core_plugins/ui_metric/ @elastic/kibana-stack-services -/src/plugins/usage_collection/ @elastic/kibana-stack-services -/x-pack/legacy/plugins/telemetry @elastic/kibana-stack-services -/x-pack/legacy/plugins/alerting @elastic/kibana-stack-services -/x-pack/legacy/plugins/actions @elastic/kibana-stack-services -/x-pack/legacy/plugins/task_manager @elastic/kibana-stack-services +# Kibana Localization +/src/dev/i18n @elastic/kibana-localization + +# Pulse +/packages/kbn-analytics/ @elastic/pulse +/src/legacy/core_plugins/ui_metric/ @elastic/pulse +/src/plugins/usage_collection/ @elastic/pulse +/x-pack/legacy/plugins/telemetry @elastic/pulse + +# Kibana Alerting Services +/x-pack/legacy/plugins/alerting @elastic/kibana-alerting-services +/x-pack/legacy/plugins/actions @elastic/kibana-alerting-services +/x-pack/legacy/plugins/task_manager @elastic/kibana-alerting-services +/x-pack/test/alerting_api_integration @elastic/kibana-alerting-services +/x-pack/test/plugin_api_integration/plugins/task_manager @elastic/kibana-alerting-services +/x-pack/test/plugin_api_integration/test_suites/task_manager @elastic/kibana-alerting-services # Design **/*.scss @elastic/kibana-design diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 57b299912ae9..000000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,13 +0,0 @@ -'Team:AppArch': -- src/plugins/data/**/* -- src/plugins/embeddable/**/* -- src/plugins/kibana_react/**/* -- src/plugins/navigation/**/* -- src/plugins/kibana_utils/**/* -- src/legacy/core_plugins/dashboard_embeddable_container/**/* -- src/legacy/core_plugins/data/**/* -- src/legacy/core_plugins/embeddable_api/**/* -- src/legacy/core_plugins/interpreter/**/* -- src/legacy/ui/public/index_patterns/**/* -- src/legacy/ui/public/indexed_array/**/* -- src/legacy/ui/public/new_platform/**/* diff --git a/.github/workflows/pr-project-assigner.yml b/.github/workflows/pr-project-assigner.yml new file mode 100644 index 000000000000..59123731dce6 --- /dev/null +++ b/.github/workflows/pr-project-assigner.yml @@ -0,0 +1,21 @@ +on: + pull_request: + types: [labeled, unlabeled] + +jobs: + assign_to_project: + runs-on: ubuntu-latest + name: Assign a PR to project based on label + steps: + - name: Assign to project + uses: elastic/github-actions/project-assigner@v1.0.0 + id: project_assigner + with: + issue-mappings: | + [ + { "label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173897 }, + { "label": "Feature:Lens", "projectName": "Lens", "columnId": 6219362 }, + { "label": "Team:Platform", "projectName": "kibana-platform", "columnId": 5514360 }, + {"label": "Team:Canvas", "projectName": "canvas", "columnId": 6187580} + ] + ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/project-assigner.yml b/.github/workflows/project-assigner.yml new file mode 100644 index 000000000000..aec3bf88f0ee --- /dev/null +++ b/.github/workflows/project-assigner.yml @@ -0,0 +1,17 @@ +on: + issues: + types: [labeled, unlabeled] + +jobs: + assign_to_project: + runs-on: ubuntu-latest + name: Assign issue or PR to project based on label + steps: + - name: Assign to project + uses: elastic/github-actions/project-assigner@v1.0.0 + id: project_assigner + with: + issue-mappings: '[{"label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173895}, {"label": "Feature:Lens", "projectName": "Lens", "columnId": 6219363}, {"label": "Team:Canvas", "projectName": "canvas", "columnId": 6187593}]' + ghToken: ${{ secrets.GITHUB_TOKEN }} + + diff --git a/.gitignore b/.gitignore index e7391a5c292d..02b20da297fc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ disabledPlugins webpackstats.json /config/* !/config/kibana.yml -!/config/apm.js coverage selenium .babel_register_cache.json diff --git a/.i18nrc.json b/.i18nrc.json index a1c49ae03f35..4bc0f773ee8b 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -4,9 +4,14 @@ "console": "src/legacy/core_plugins/console", "core": "src/core", "dashboardEmbeddableContainer": "src/plugins/dashboard_embeddable_container", - "data": ["src/legacy/core_plugins/data", "src/plugins/data"], + "data": [ + "src/legacy/core_plugins/data", + "src/plugins/data" + ], "embeddableApi": "src/plugins/embeddable", + "embeddableExamples": "examples/embeddable_examples", "share": "src/plugins/share", + "home": "src/plugins/home", "esUi": "src/plugins/es_ui_shared", "devTools": "src/plugins/dev_tools", "expressions": "src/plugins/expressions", @@ -17,11 +22,11 @@ "kbn": "src/legacy/core_plugins/kibana", "kbnDocViews": "src/legacy/core_plugins/kbn_doc_views", "kbnVislibVisTypes": "src/legacy/core_plugins/kbn_vislib_vis_types", - "management": "src/legacy/core_plugins/management", + "management": ["src/legacy/core_plugins/management", "src/plugins/management"], "kibana_react": "src/legacy/core_plugins/kibana_react", "kibana-react": "src/plugins/kibana_react", "kibana_utils": "src/plugins/kibana_utils", - "navigation": "src/legacy/core_plugins/navigation", + "navigation": "src/plugins/navigation", "newsfeed": "src/plugins/newsfeed", "regionMap": "src/legacy/core_plugins/region_map", "server": "src/legacy/server", @@ -36,8 +41,13 @@ "visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud", "visTypeTimeseries": "src/legacy/core_plugins/vis_type_timeseries", "visTypeVega": "src/legacy/core_plugins/vis_type_vega", - "visualizations": ["src/plugins/visualizations", "src/legacy/core_plugins/visualizations"] + "visualizations": [ + "src/plugins/visualizations", + "src/legacy/core_plugins/visualizations" + ] }, - "exclude": ["src/legacy/ui/ui_render/ui_render_mixin.js"], + "exclude": [ + "src/legacy/ui/ui_render/ui_render_mixin.js" + ], "translations": [] -} +} \ No newline at end of file diff --git a/.node-version b/.node-version index 95abd2ac4991..06c9b9d30634 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -10.15.2 +10.18.0 diff --git a/.nvmrc b/.nvmrc index 95abd2ac4991..06c9b9d30634 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -10.15.2 +10.18.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 599cf2697003..06e08c85dafe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -218,6 +218,7 @@ node scripts/makelogs --auth : > The default username and password combination are `elastic:changeme` > Make sure to execute `node scripts/makelogs` *after* elasticsearch is up and running! + ### Running Elasticsearch Remotely You can save some system resources, and the effort of generating sample data, if you have a remote Elasticsearch cluster to connect to. (**Elasticians: you do! Check with your team about where to find credentials**) @@ -239,6 +240,41 @@ kibana.index: '.{YourGitHubHandle}-kibana' xpack.task_manager.index: '.{YourGitHubHandle}-task-manager-kibana' ``` +### Running remote clusters +Setup remote clusters for cross cluster search (CCS) and cross cluster replication (CCR). + +Start your primary cluster by running: +```bash +yarn es snapshot -E path.data=../data_prod1 +``` + +Start your remote cluster by running: +```bash +yarn es snapshot -E transport.port=9500 -E http.port=9201 -E path.data=../data_prod2 +``` + +Once both clusters are running, start kibana. Kibana will connect to the primary cluster. + +Setup the remote cluster in Kibana from either `Management` -> `Elasticsearch` -> `Remote Clusters` UI or by running the following script in `Console`. +``` +PUT _cluster/settings +{ + "persistent": { + "cluster": { + "remote": { + "cluster_one": { + "seeds": [ + "localhost:9500" + ] + } + } + } + } +} +``` + +Follow the [cross-cluster search](https://www.elastic.co/guide/en/kibana/current/management-cross-cluster-search.html) instructions for setting up index patterns to search across clusters. + ### Running Kibana Start the development server. @@ -506,7 +542,7 @@ yarn test:browser --dev # remove the --dev flag to run them once and close * In System Preferences > Sharing, change your computer name to be something simple, e.g. "computer". * Run Kibana with `yarn start --host=computer.local` (substituting your computer name). * Now you can run your VM, open the browser, and navigate to `http://computer.local:5601` to test Kibana. -* Alternatively you can use browserstack +* Alternatively you can use browserstack #### Running Browser Automation Tests diff --git a/Gruntfile.js b/Gruntfile.js index e98708b87e3a..c33a576d4340 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ require('./src/setup_node_env'); -module.exports = function (grunt) { +module.exports = function(grunt) { // set the config once before calling load-grunt-config // and once during so that we have access to it via // grunt.config.get() within the config files @@ -35,8 +35,8 @@ module.exports = function (grunt) { init: true, config: config, loadGruntTasks: { - pattern: ['grunt-*', '@*/grunt-*', 'gruntify-*', '@*/gruntify-*'] - } + pattern: ['grunt-*', '@*/grunt-*', 'gruntify-*', '@*/gruntify-*'], + }, }); // load task definitions diff --git a/NOTICE.txt b/NOTICE.txt index 989bb6f754a0..955c3127fa95 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Kibana source code with Kibana X-Pack source code -Copyright 2012-2019 Elasticsearch B.V. +Copyright 2012-2020 Elasticsearch B.V. --- Pretty handling of logarithmic axes. @@ -186,32 +186,6 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---- -This product includes code that is based on facebookincubator/idx, which was -available under a "MIT" license. - -MIT License - -Copyright (c) 2013-present, Facebook, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - --- This product includes code that was extracted from angular@1.3. Original license: diff --git a/config/apm.js b/config/apm.js deleted file mode 100644 index 8efbbf87487e..000000000000 --- a/config/apm.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * DO NOT EDIT THIS FILE! - * - * This file contains the configuration for the Elastic APM instrumentaion of - * Kibana itself and is only intented to be used during development of Kibana. - * - * Instrumentation is turned off by default. Once activated it will send APM - * data to an Elasticsearch cluster accessible by Elastic employees. - * - * To modify the configuration, either use environment variables, or create a - * file named `config/apm.dev.js`, which exports a config object as described - * in the docs. - * - * For an overview over the available configuration files, see: - * https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html - * - * For general information about Elastic APM, see: - * https://www.elastic.co/guide/en/apm/get-started/current/index.html - */ - -const { readFileSync } = require('fs'); -const { join } = require('path'); -const { execSync } = require('child_process'); -const merge = require('lodash.merge'); - -module.exports = merge({ - active: false, - serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443', - // The secretToken below is intended to be hardcoded in this file even though - // it makes it public. This is not a security/privacy issue. Normally we'd - // instead disable the need for a secretToken in the APM Server config where - // the data is transmitted to, but due to how it's being hosted, it's easier, - // for now, to simply leave it in. - secretToken: 'R0Gjg46pE9K9wGestd', - globalLabels: {}, - centralConfig: false, - logUncaughtExceptions: true -}, devConfig()); - -const rev = gitRev(); -if (rev !== null) module.exports.globalLabels.git_rev = rev; - -try { - const filename = join(__dirname, '..', 'data', 'uuid'); - module.exports.globalLabels.kibana_uuid = readFileSync(filename, 'utf-8'); -} catch (e) {} // eslint-disable-line no-empty - -function gitRev() { - try { - return execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim(); - } catch (e) { - return null; - } -} - -function devConfig() { - try { - return require('./apm.dev'); // eslint-disable-line import/no-unresolved - } catch (e) { - return {}; - } -} diff --git a/docs/api/spaces-management/post.asciidoc b/docs/api/spaces-management/post.asciidoc index d8c194d8dc2b..4d4627e98899 100644 --- a/docs/api/spaces-management/post.asciidoc +++ b/docs/api/spaces-management/post.asciidoc @@ -16,28 +16,28 @@ experimental["The underlying Spaces concepts are stable, but the APIs for managi [[spaces-api-post-request-body]] ==== Request body -`id`:: +`id`:: (Required, string) The space ID that is part of the Kibana URL when inside the space. You are unable to change the ID with the update operation. -`name`:: +`name`:: (Required, string) The display name for the space. -`description`:: +`description`:: (Optional, string) The description for the space. -`disabledFeatures`:: +`disabledFeatures`:: (Optional, string array) The list of disabled features for the space. To get a list of available feature IDs, use the <>. -`initials`:: +`initials`:: (Optional, string) Specifies the initials shown in the space avatar. By default, the initials are automatically generated from the space name. Initials must be 1 or 2 characters. -`color`:: +`color`:: (Optional, string) Specifies the hexadecimal color code used in the space avatar. By default, the color is automatically generated from the space name. -`imageUrl`:: +`imageUrl`:: (Optional, string) Specifies the data-url encoded image to display in the space avatar. If specified, `initials` will not be displayed, and the `color` will be visible as the background color for transparent images. For best results, your image should be 64x64. Images will not be optimized by this API call, so care should be taken when using custom images. - + [[spaces-api-post-response-codes]] ==== Response codes diff --git a/docs/api/using-api.asciidoc b/docs/api/using-api.asciidoc index 82071af46363..37c5315025dc 100644 --- a/docs/api/using-api.asciidoc +++ b/docs/api/using-api.asciidoc @@ -1,7 +1,7 @@ [[using-api]] == Using the APIs -Interact with the {kib} APIs through the `curl` command and HTTP and HTTPs protocols. +Interact with the {kib} APIs through the `curl` command and HTTP and HTTPs protocols. It is recommended that you use HTTPs on port 5601 because it is more secure. @@ -34,13 +34,37 @@ For example, the following `curl` command exports a dashboard: curl -X POST -u $USER:$PASSWORD "localhost:5601/api/kibana/dashboards/export?dashboard=942dcef0-b2cd-11e8-ad8e-85441f0c2e5c" -- -The following {kib} APIs are available: +[float] +[[api-request-headers]] +=== Request headers + +For all APIs, you must use a request header. The {kib} APIs support the `kbn-xsrf` and `Content-Type` headers. + +`kbn-xsrf: true`:: + By default, you must use `kbn-xsrf` for all API calls, except in the following scenarios: + +* The API endpoint uses the `GET` or `HEAD` methods + +* The path is whitelisted using the <> setting + +* XSRF protections are disabled using the `server.xsrf.disableProtection` setting -* <> -* <> -* <> -* <> -* <> -* <> -* <> -* <> +`Content-Type: application/json`:: + Applicable only when you send a payload in the API request. {kib} API requests and responses use JSON. Typically, if you include the `kbn-xsrf` header, you must also include the `Content-Type` header. + +Request header example: + +[source,sh] +-- +curl -X POST \ + http://localhost:5601/api/spaces/space \ + -H 'Content-Type: application/json' \ + -H 'kbn-xsrf: true' \ + -d '{ + "id": "sales", + "name": "Sales", + "description": "This is your Sales Space!", + "disabledFeatures": [] +} +' +-- diff --git a/docs/apm/advanced-queries.asciidoc b/docs/apm/advanced-queries.asciidoc index 1f064c1cad3f..942882f8c4df 100644 --- a/docs/apm/advanced-queries.asciidoc +++ b/docs/apm/advanced-queries.asciidoc @@ -1,9 +1,7 @@ [[advanced-queries]] === Advanced queries -When querying, you're simply searching and selecting data from fields in Elasticsearch documents. -It may be helpful to view some of your documents in {kibana-ref}/discover.html[Discover] to better understand how APM data is stored in Elasticsearch. - +When querying in the APM app, you're simply searching and selecting data from fields in Elasticsearch documents. Queries entered into the query bar are also added as parameters to the URL, so it's easy to share a specific query or view with others. @@ -13,11 +11,48 @@ In the screenshot below, you can begin to see some of the transaction fields ava image::apm/images/apm-query-bar.png[Example of the Kibana Query bar in APM app in Kibana] [float] -==== Example queries +==== Example APM app queries * Exclude response times slower than 2000 ms: `transaction.duration.us > 2000000` * Filter by response status code: `context.response.status_code >= 400` * Filter by single user ID: `context.user.id : 12` -* View _all_ transactions for an endpoint, instead of just a sample - `processor.event: "transaction" AND transaction.name: ""` TIP: Read the {kibana-ref}/kuery-query.html[Kibana Query Language Enhancements] documentation to learn more about the capabilities of the {kib} query language. + +[float] +[[discover-advanced-queries]] +=== Querying in the Discover app + +It may also be helpful to view your APM data in the {kibana-ref}/discover.html[Discover app]. +Querying documents in Discover works the same way as querying in the APM app, +and all of the example queries listed above can also be used in the Discover app. + +[float] +==== Example Discover app query + +One example where you may want to make use of the Discover app, +is for viewing _all_ transactions for an endpoint, instead of just a sample. + +TIP: Starting in v7.6, you can view 10 samples per bucket in the APM app, instead of just one. + +Use the APM app to find a transaction name and time bucket that you're interested in learning more about. +Then, switch to the Discover app and make a search: + +["source","sh"] +----- +processor.event: "transaction" AND transaction.name: "" and transaction.duration.us > 13000 and transaction.duration.us < 14000` +----- + +In this example, we're interested in viewing all of the `APIRestController#customers` transactions +that took between 13 and 14 milliseconds. Here's what Discover returns: + +[role="screenshot"] +image::apm/images/advanced-discover.png[View all transactions in bucket] + +You can now explore the data until you find a specific transaction that you're interested in. +Copy that transaction's `transaction.id`, and paste it into the APM app to view the data in the context of the APM app: + +[role="screenshot"] +image::apm/images/specific-transaction-search.png[View specific transaction in apm app] +[role="screenshot"] +image::apm/images/specific-transaction.png[View specific transaction in apm app] diff --git a/docs/apm/images/advanced-discover.png b/docs/apm/images/advanced-discover.png new file mode 100644 index 000000000000..56ba58b2c1d4 Binary files /dev/null and b/docs/apm/images/advanced-discover.png differ diff --git a/docs/apm/images/specific-transaction-search.png b/docs/apm/images/specific-transaction-search.png new file mode 100644 index 000000000000..4ed548f01571 Binary files /dev/null and b/docs/apm/images/specific-transaction-search.png differ diff --git a/docs/apm/images/specific-transaction.png b/docs/apm/images/specific-transaction.png new file mode 100644 index 000000000000..9911dbd879f4 Binary files /dev/null and b/docs/apm/images/specific-transaction.png differ diff --git a/docs/apm/settings.asciidoc b/docs/apm/settings.asciidoc new file mode 100644 index 000000000000..2fc8748f13b0 --- /dev/null +++ b/docs/apm/settings.asciidoc @@ -0,0 +1,10 @@ +// Do not link directly to this page. +// Link to the anchor in `/docs/settings/apm-settings.asciidoc` instead. +[[apm-settings-in-kibana]] +=== APM settings in Kibana + +You do not need to configure any settings to use APM. It is enabled by default. +If you'd like to change any of the default values, +copy and paste the relevant settings below into your `kibana.yml` configuration file. + +include::./../settings/apm-settings.asciidoc[tag=general-apm-settings] diff --git a/docs/apm/troubleshooting.asciidoc b/docs/apm/troubleshooting.asciidoc index 0e902e3608e7..ec0863b09d65 100644 --- a/docs/apm/troubleshooting.asciidoc +++ b/docs/apm/troubleshooting.asciidoc @@ -42,3 +42,22 @@ Finally, this problem can also occur if you've changed the index name that you w The default index pattern can be found {apm-server-ref}/elasticsearch-output.html#index-option-es[here]. If you change this setting, you must also configure the `setup.template.name` and `setup.template.pattern` options. See {apm-server-ref}/configuration-template.html[Load the Elasticsearch index template]. + +==== Unknown route + +The {apm-app-ref}/transactions.html[transaction overview] will only display helpful information +when the transactions in your services are named correctly. +If you're seeing "GET unknown route" or "unknown route" in the APM app, +it could be a sign that something isn't working like it should. + +Elastic APM Agents come with built-in support for popular frameworks out-of-the-box. +This means, among other things, that the Agent will try to automatically name HTTP requests. +As an example, the Node.js Agent uses the route that handled the request, while the Java Agent uses the Servlet name. + +"Unknown route" indicates that the Agent can't determine what to name the request, +perhaps because the technology you're using isn't supported, the Agent has been installed incorrectly, +or because something is happening to the request that the Agent doesn't understand. + +To resolve this, you'll need to head over to the relevant {apm-agents-ref}[Agent documentation]. +Specifically, view the Agent's supported technologies page. +You can also use the Agent's public API to manually set a name for the transaction. diff --git a/docs/apm/using-the-apm-ui.asciidoc b/docs/apm/using-the-apm-ui.asciidoc index 818e4429d25a..95ec41cf8a40 100644 --- a/docs/apm/using-the-apm-ui.asciidoc +++ b/docs/apm/using-the-apm-ui.asciidoc @@ -8,15 +8,18 @@ Not to worry, we've created this guide to help you get the most out of Elastic A APM is available via the navigation sidebar in {Kib}. -* <> -* <> -* <> -* <> -* <> -* <> -* <> -* <> -* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> +* <> include::filters.asciidoc[] @@ -36,4 +39,6 @@ include::agent-configuration.asciidoc[] include::advanced-queries.asciidoc[] +include::settings.asciidoc[] + include::troubleshooting.asciidoc[] diff --git a/docs/canvas/canvas-elements.asciidoc b/docs/canvas/canvas-elements.asciidoc index c5c6f116ee34..dc605a47de38 100644 --- a/docs/canvas/canvas-elements.asciidoc +++ b/docs/canvas/canvas-elements.asciidoc @@ -20,24 +20,24 @@ When you add elements to your workpad, you can: [[add-canvas-element]] === Add elements to your workpad -Choose the elements to display on your workpad, then familiarize yourself with the element using the preconfigured demo data. +Choose the elements to display on your workpad, then familiarize yourself with the element using the preconfigured demo data. By default, every element you add to a workpad uses demo data until you change the data source. The demo data includes a small sample data set that you can use to experiment with your element. . Click *Add element*. -. In the *Elements* window, select the element you want to use. +. In the *Elements* window, select the element you want to use. + [role="screenshot"] image::images/canvas-element-select.gif[Canvas elements] -. Play around with the default settings and see what the element can do. +. Play around with the default settings and see what the element can do. -TIP: Want to use a different element? You can delete the element by selecting it, clicking the *Element options* icon in the top right corner, then selecting *Delete*. +TIP: Want to use a different element? You can delete the element by selecting it, clicking the *Element options* icon in the top right, then selecting *Delete*. [float] [[connect-element-data]] === Connect the element to your data -When you are ready to move on from the demo data, connect the element to your own data. +When you have finished using the demo data, connect the element to a data source. . Make sure that the element is selected, then select *Data*. @@ -45,55 +45,51 @@ When you are ready to move on from the demo data, connect the element to your ow [float] [[elasticsearch-sql-data-source]] -==== Connect to Elasticsearch SQL +==== Connect to {es} SQL -Access your data in Elasticsearch using the Elasticsearch SQL syntax. +Access your data in {es} using SQL syntax. For information about SQL syntax, refer to {ref}/sql-spec.html[SQL language]. -Unfamiliar with writing Elasticsearch SQL queries? For more information, refer to {ref}/sql-spec.html[SQL language]. +. Click *{es} SQL*. -. Click *Elasticsearch SQL*. +. In the *{es} SQL query* box, enter your query, then *Preview* it. -. In the *Elasticearch SQL query* box, enter your query, then *Preview* it. - -. If everything looks correct, *Save* it. +. If everything looks correct, *Save* it. [float] [[elasticsearch-raw-doc-data-source]] -==== Connect to Elasticsearch raw data +==== Connect to {es} raw data -Use the Lucene query syntax to use your raw data in Elasticsearch. +Access your raw data in {es} without the use of aggregations. Use {es} raw data when you have low volume datasets, or to plot exact, non-aggregated values. -For for more information about the Lucene query string sytax, refer to <>. +To use targeted queries, you can enter a query using the <>. -. Click *Elasticsearch raw documents*. +. Click *{es} raw documents*. -. In the *Index* field, enter the index pattern that you want to display. +. In the *Index* field, enter the index pattern that you want to display. . From the *Fields* dropdown, select the associated fields you want to display. . To sort the data, select an option from the *Sort Field* and *Sort Order* dropdowns. -. For more targeted queries, enter a *Query* using the Lucene query string syntax. +. For more targeted queries, enter a *Query* using the Lucene query string syntax. -. *Preview* the query. +. *Preview* the query. -. If your query looks correct, *Save* it. +. If your query looks correct, *Save* it. [float] [[timelion-data-source]] ==== Connect to Timelion -Use <> queries to use your time series data. +Access your time series data using <> queries. To use Timelion queries, you can enter a query using the <>. . Click *Timelion*. -. Enter a *Query* using the Lucene query string syntax. -+ -For for more information about the Lucene query string syntax, refer to <>. +. Enter a *Query* using the Lucene query string syntax. . Enter the *Interval*, then *Preview* the query. -. If your query looks correct, *Save* it. +. If your query looks correct, *Save* it. [float] [[configure-display-options]] @@ -109,7 +105,7 @@ When you connect your element to a data source, the element often appears as a w . Click *Display* -. Change the display options for the element. +. Change the display options for the element. [float] [[element-display-container]] @@ -122,7 +118,7 @@ Further define the appearance of the element container and border. . Expand *Container style*. . Change the *Appearance* and *Border* options. - + [float] [[apply-element-styles]] ==== Apply a set of styles @@ -155,7 +151,7 @@ Increase or decrease how often your data refreshes on your workpad. [role="screenshot"] image::images/canvas-refresh-interval.png[Element data refresh interval] -TIP: To manually refresh the data, click the *Refresh data* icon. +TIP: To manually refresh the data, click the *Refresh data* icon. [float] [[organize-element]] @@ -223,7 +219,7 @@ Change the order of how the elements are displayed on your workpad. . Select an element. -. In the top right corder, click the *Element options* icon. +. In the top right corder, click the *Element options* icon. . Select *Order*, then select the order that you want the element to appear. @@ -262,7 +258,7 @@ When you have run out of room on your workpad page, add more pages. . Click *Page 1*, then click *+*. -. On the *Page* editor panel on the right, select the page transition from the *Transition* dropdown. +. On the *Page* editor panel on the right, select the page transition from the *Transition* dropdown. + [role="screenshot"] image::images/canvas-add-pages.gif[Add pages] diff --git a/docs/canvas/canvas-expression-lifecycle.asciidoc b/docs/canvas/canvas-expression-lifecycle.asciidoc new file mode 100644 index 000000000000..895c1382c4d3 --- /dev/null +++ b/docs/canvas/canvas-expression-lifecycle.asciidoc @@ -0,0 +1,261 @@ +[role="xpack"] +[[canvas-expression-lifecycle]] +== Canvas expression lifecycle + +Elements in Canvas are all created using an *expression language* that defines how to retrieve, manipulate, and ultimately visualize data. The goal is to allow you to do most of what you need without understanding the *expression language*, but learning how it works unlocks a lot of Canvas's power. + + +[[canvas-expressions-always-start-with-a-function]] +=== Expressions always start with a function + +Expressions simply execute <> in a specific order, which produce some output value. That output can then be inserted into another function, and another after that, until it produces the output you need. + +To use demo dataset available in Canvas to produce a table, run the following expression: + +[source,text] +---- +filters +| demodata +| table +| render +---- + +This expression starts out with the <> function, which provides the value of any time filters or dropdown filters in the workpad. This is then inserted into <>, a function that returns exactly what you expect, demo data. Because the <> function receives the filter information from the <> function before it, it applies those filters to reduce the set of data it returns. We call the output from the previous function _context_. + +The filtered <> becomes the _context_ of the next function, <>, which creates a table visualization from this data set. The <> function isn’t strictly required, but by being explicit, you have the option of providing arguments to control things like the font used in the table. The output of the <> function becomes the _context_ of the <> function. Like the <>, the <> function isn’t required either, but it allows access to other arguments, such as styling the border of the element or injecting custom CSS. + + +[[canvas-function-arguments]] +=== Function arguments + +Let’s look at another expression, which uses the same <> function, but instead produces a pie chart. + +image::images/canvas-functions-can-take-arguments-pie-chart.png[Pie Chart, height=400] +[source,text] +---- +filters +| demodata +| pointseries color="state" size="max(price)" +| pie +| render +---- + +To produce a filtered set of random data, the expression uses the <> and <> functions. This time, however, the output becomes the context for the <> function, which is a way to aggregate your data, similar to how Elasticsearch works, but more generalized. In this case, the data is split up using the `color` and `size` dimensions, using arguments on the <> function. Each unique value in the state column will have an associated size value, which in this case, will be the maximum value of the price column. + +If the expression stopped there, it would produce a `pointseries` data type as the output of this expression. But instead of looking at the raw values, the result is inserted into the <> function, which will produce an output that will render a pie visualization. And just like before, this is inserted into the <> function, which is useful for its arguments. + +The end result is a simple pie chart that uses the default color palette, but the <> function can take additional arguments that control how it gets rendered. For example, you can provide a `hole` argument to turn your pie chart into a donut chart by changing the expression to: + + +image::images/canvas-functions-can-take-arguments-donut-chart.png[Donut Chart, height=400] +[source,text] +---- +filters +| demodata +| pointseries color="state" size="max(price)" +| pie hole=50 +| render +---- + + +[[canvas-aliases-and-unnamed-arguments]] +=== Aliases and unnamed arguments + +Argument definitions have one canonical name, which is always provided in the underlying code. When argument definitions are used in an expression, they often include aliases that make them easier or faster to type. + +For example, the <> function has 2 arguments: + +* `expression` - Produces a calculated value. +* `name` - The name of column. + +The `expression` argument includes some aliases, namely `exp`, `fn`, and `function`. That means that you can use any of those four options to provide that argument’s value. + +So `mapColumn name=newColumn fn={string example}` is equal to `mapColumn name=newColumn expression={string example}`. + +There’s also a special type of alias which allows you to leave off the argument’s name entirely. The alias for this is an underscore, which indicates that the argument is an _unnamed_ argument and can be provided without explicitly naming it in the expression. The `name` argument here uses the _unnamed_ alias, which means that you can further simplify our example to `mapColumn newColumn fn={string example}`. + +NOTE: There can only be one _unnamed_ argument for each function. + + +[[canvas-change-your-expression-change-your-output]] +=== Change your expression, change your output +You can substitute one function for another to change the output. For example, you could change the visualization by swapping out the <> function for another renderer, a function that returns a `render` data type. + +Let’s change that last pie chart into a bubble chart by replacing the <> function with the <> function. This is possible because both functions can accept a `pointseries` data type as their _context_. Switching the functions will work, but it won’t produce a useful visualization on its own since you don’t have the x-axis and y-axis defined. You will also need to modify the <> function to change its output. In this case, you can change the `size` argument to `y`, so the maximum price values are plotted on the y-axis, and add an `x` argument using the `@timestamp` field in the data to plot those values over time. This leaves you with the following expression and produces a bubble chart showing the max price of each state over time: + +image::images/canvas-change-your-expression-chart.png[Bubble Chart, height=400] +[source,text] +---- +filters +| demodata +| pointseries color="state" y="max(price)" x="@timestamp" +| plot +| render +---- + +Similar to the <> function, the <> function takes arguments that control the design elements of the visualization. As one example, passing a `legend` argument with a value of `false` to the function will hide the legend on the chart. + +image::images/canvas-change-your-expression-chart-no-legend.png[Bubble Chart Without Legend, height=400] +[source,text,subs=+quotes] +---- +filters +| demodata +| pointseries color="state" y="max(price)" x="@timestamp" +| plot *legend=false* +| render +---- + + +[[canvas-fetch-and-manipulate-data]] +=== Fetch and manipulate data +So far, you have only seen expressions as a way to produce visualizations, but that’s not really what’s happening. Expressions only produce data, which is then used to create something, which in the case of Canvas, means rendering an element. An element can be a visualization, driven by data, but it can also be something much simpler, like a static image. Either way, an expression is used to produce an output that is used to render the desired result. For example, here’s an expression that shows an image: + +[source,text] +---- +image dataurl=https://placekitten.com/160/160 mode="cover" +---- + +But as mentioned, this doesn’t actually _render that image_, but instead it _produces some output that can be used to render that image_. That’s an important distinction, and you can see the actual output by adding in the render function and telling it to produce debug output. For example: + +[source,text] +---- +image dataurl=https://placekitten.com/160/160 mode="cover" +| render as=debug +---- + +The follow appears as JSON output: + +[source,JSON] +---- +{ + "type": "image", + "mode": "cover", + "dataurl": "https://placekitten.com/160/160" +} +---- + +NOTE: You may need to expand the element’s size to see the whole output. + +Canvas uses this output’s data type to map to a specific renderer and passes the entire output into it. It’s up to the image render function to produce an image on the workpad’s page. In this case, the expression produces some JSON output, but expressions can also produce other, simpler data, like a string or a number. Typically, useful results use JSON. + +Canvas uses the output to render an element, but other applications can use expressions to do pretty much anything. As stated previously, expressions simply execute functions, and the functions are all written in Javascript. That means if you can do something in Javascript, you can do it with an expression. + +This can include: + +* Sending emails +* Sending notifications +* Reading from a file +* Writing to a file +* Controlling devices with WebUSB or Web Bluetooth +* Consuming external APIs + +If your Javascript works in the environment where the code will run, such as in Node.js or in a browser, you can do it with an expression. + +[[canvas-expressions-compose-functions-with-subexpressions]] +=== Compose functions with sub-expressions + +You may have noticed another syntax in examples from other sections, namely expressions inside of curly brackets. These are called sub-expressions, and they can be used to provide a calculated value to another expression, instead of just a static one. + +A simple example of this is when you upload your own images to a Canvas workpad. That upload becomes an asset, and that asset can be retrieved using the `asset` function. Usually you’ll just do this from the UI, adding an image element to the page and uploading your image from the control in the sidebar, or picking an existing asset from there as well. In both cases, the system will consume that asset via the `asset` function, and you’ll end up with an expression similar to this: + +[source,text] +---- +image dataurl={asset 3cb3ec3a-84d7-48fa-8709-274ad5cc9e0b} +---- + +Sub-expressions are executed before the function that uses them is executed. In this case, `asset` will be run first, it will produce a value, the base64-encoded value of the image and that value will be used as the value for the `dataurl` argument in the <> function. After the asset function executes, you will get the following output: + +[source,text] +---- +image dataurl="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0" +---- + +Since all of the sub-expressions are now resolved into actual values, the <> function can be executed to produce its JSON output, just as it’s explained previously. In the case of images, the ability to nest sub-expressions is particularly useful to show one of several images conditionally. For example, you could swap between two images based on some calculated value by mixing in the <> function, like in this example expression: + +[source,text] +---- +demodata +| image dataurl={ + if condition={getCell price | gte 100} + then={asset 3cb3ec3a-84d7-48fa-8709-274ad5cc9e0b} + else={asset cbc11a1f-8f25-4163-94b4-2c3a060192e7} +} +---- + +NOTE: The examples in this section can’t be copy and pasted directly, since the values used throughout will not exist in your workpad. + +Here, the expression to use for the value of the `condition` argument, `getCell price | gte 100`, runs first since it is nested deeper. + +The expression does the following: + +* Retrieves the value from the *price* column in the first row of the `demodata` data table +* Inputs the value to the `gte` function +* Compares the value to `100` +* Returns `true` if the value is 100 or greater, and `false` if the value is 100 or less + +That boolean value becomes the value for the `condition` argument. The output from the `then` expression is used as the output when `condition` is `true`. The output from the `else` expression is used when `condition` is false. In both cases, a base64-encoded image will be returned, and one of the two images will be displayed. + +You might be wondering how the <> function in the sub-expression accessed the data from the <> function, even though <> was not being directly inserted into <>. The answer is simple, but important to understand. When nested sub-expressions are executed, they automatically receive the same _context_, or output of the previous function that its parent function receives. In this specific expression, demodata’s data table is automatically provided to the nested expression’s `getCell` function, which allows that expression to pull out a value and compare it to another value. + +The passing of the _context_ is automatic, and it happens no matter how deeply you nest your sub-expressions. To demonstrate this, let’s modify the expression slightly to compare the value of the price against multiple conditions using the <> function. + +[source,text] +---- +demodata +| image dataurl={ + if condition={getCell price | all {gte 100} {neq 105}} + then={asset 3cb3ec3a-84d7-48fa-8709-274ad5cc9e0b} + else={asset cbc11a1f-8f25-4163-94b4-2c3a060192e7} +} +---- + +This time, `getCell price` is run, and the result is passed into the next function as the context. Then, each sub-expression of the <> function is run, with the context given to their parent, which in this case is the result of `getCell price`. If `all` of these sub-expressions evaluate to `true`, then the `if` condition argument will be true. + +Sub-expressions can seem a little foreign, especially if you aren’t a developer, but they’re worth getting familiar with, since they provide a ton of power and flexibility. Since you can nest any expression you want, you can also use this behavior to mix data from multiple indices, or even data from multiple sources. As an example, you could query an API for a value to use as part of the query provided to <>. + +This whole section is really just scratching the surface, but hopefully after reading it, you at least understand how to read expressions and make sense of what they are doing. With a little practice, you’ll get the hang of mixing _context_ and sub-expressions together to turn any input into your desired output. + +[[canvas-handling-context-and-argument-types]] +=== Handling context and argument types +If you look through the <>, you may notice that all of them define what a function accepts and what it returns. Additionally, every argument includes a type property that specifies the kind of data that can be used. These two types of values are actually the same, and can be used as a guide for how to deal with piping to other functions and using subexpressions for argument values. + +To explain how this works, consider the following expression from the previous section: + +[source,text] +---- +image dataurl={asset 3cb3ec3a-84d7-48fa-8709-274ad5cc9e0b} +---- + +If you <> for the `image` function, you’ll see that it accepts the `null` data type and returns an `image` data type. Accepting `null` effectively means that it does not use context at all, so if you insert anything to `image`, the value that was produced previously will be ignored. When the function executes, it will produce an `image` output, which is simply an object of type `image` that contains the information required to render an image. + +NOTE: The function does not render an image itself. + +As explained in the "<>" section, the output of an expression is just data. So the `image` type here is just a specific shape of data, not an actual image. + +Next, let’s take a look at the `asset` function. Like `image`, it accepts `null`, but it returns something different, a `string` in this case. Because `asset` will produce a string, its output can be used as the input for any function or argument that accepts a string. + +<> for the `dataurl` argument, its type is `string`, meaning it will accept any kind of string. There are some rules about the value of the string that the function itself enforces, but as far as the interpreter is concerned, that expression is valid because the argument accepts a string and the output of `asset` is a string. + +The interpreter also attempts to cast some input types into others, which allows you to use a string input even when the function or argument calls for a number. Keep in mind that it’s not able to convert any string value, but if the string is a number, it can easily be cast into a `number` type. Take the following expression for example: + +[source,text] +---- +string "0.4" +| revealImage image={asset asset-06511b39-ec44-408a-a5f3-abe2da44a426} +---- + +If you <> for the `revealImage` function, you’ll see that it accepts a `number` but the `string` function returns a `string` type. In this case, because the string value is a number, it can be converted into a `number` type and used without you having to do anything else. + +Most `primitive` types can be converted automatically, as you might expect. You just saw that a `string` can be cast into a `number`, but you can also pretty easily cast things into `boolean` too, and you can cast anything to `null`. + +There are other useful type casting options available. For example, something of type `datatable` can be cast to a type `pointseries` simply by only preserving specific columns from the data (namely x, y, size, color, and text). This allows you to treat your source data, which is generally of type `datatable`, like a `pointseries` type simply by convention. + +You can fetch data from Elasticsearch using `essql`, which allows you to aggregate the data, provide a custom name for the value, and insert that data directly to another function that only accepts `pointseries` even though `essql` will output a `datatable` type. This makes the following example expression valid: + +[source,text] +---- +essql "SELECT user AS x, sum(cost) AS y FROM index GROUP BY user" +| plot +---- + +In the docs you can see that `essql` returns a `datatable` type, but `plot` expects a `pointseries` context. This works because the `datatable` output will have the columns `x` and `y` as a result of using `AS` in the sql statement to name them. Because the data follows the convention of the `pointseries` data type, casting it into `pointseries` is possible, and it can be passed directly to `plot` as a result. diff --git a/docs/developer/core/development-functional-tests.asciidoc b/docs/developer/core/development-functional-tests.asciidoc index 350a3c2a997c..77a2bfe77b4a 100644 --- a/docs/developer/core/development-functional-tests.asciidoc +++ b/docs/developer/core/development-functional-tests.asciidoc @@ -282,7 +282,7 @@ The `FunctionalTestRunner` comes with three built-in services: * Source: {blob}src/functional_test_runner/lib/lifecycle.ts[src/functional_test_runner/lib/lifecycle.ts] * Designed primary for use in services * Exposes lifecycle events for basic coordination. Handlers can return a promise and resolve/fail asynchronously -* Phases include: `beforeLoadTests`, `beforeTests`, `beforeEachTest`, `cleanup`, `phaseStart`, `phaseEnd` +* Phases include: `beforeLoadTests`, `beforeTests`, `beforeEachTest`, `cleanup` [float] ===== Kibana Services diff --git a/docs/development/core/public/kibana-plugin-public.app.approute.md b/docs/development/core/public/kibana-plugin-public.app.approute.md new file mode 100644 index 000000000000..7f35f4346b6b --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.app.approute.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [App](./kibana-plugin-public.app.md) > [appRoute](./kibana-plugin-public.app.approute.md) + +## App.appRoute property + +Override the application's routing path from `/app/${id}`. Must be unique across registered applications. Should not include the base path from HTTP. + +Signature: + +```typescript +appRoute?: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.app.md b/docs/development/core/public/kibana-plugin-public.app.md index c500c080a5fe..acf07cbf62e9 100644 --- a/docs/development/core/public/kibana-plugin-public.app.md +++ b/docs/development/core/public/kibana-plugin-public.app.md @@ -16,6 +16,7 @@ export interface App extends AppBase | Property | Type | Description | | --- | --- | --- | +| [appRoute](./kibana-plugin-public.app.approute.md) | string | Override the application's routing path from /app/${id}. Must be unique across registered applications. Should not include the base path from HTTP. | | [chromeless](./kibana-plugin-public.app.chromeless.md) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | -| [mount](./kibana-plugin-public.app.mount.md) | (context: AppMountContext, params: AppMountParameters) => AppUnmount | Promise<AppUnmount> | A mount function called when the user navigates to this app's route. | +| [mount](./kibana-plugin-public.app.mount.md) | AppMount | AppMountDeprecated | A mount function called when the user navigates to this app's route. May have signature of [AppMount](./kibana-plugin-public.appmount.md) or [AppMountDeprecated](./kibana-plugin-public.appmountdeprecated.md). | diff --git a/docs/development/core/public/kibana-plugin-public.app.mount.md b/docs/development/core/public/kibana-plugin-public.app.mount.md index dda06b035db4..151fb7baeb13 100644 --- a/docs/development/core/public/kibana-plugin-public.app.mount.md +++ b/docs/development/core/public/kibana-plugin-public.app.mount.md @@ -4,10 +4,15 @@ ## App.mount property -A mount function called when the user navigates to this app's route. +A mount function called when the user navigates to this app's route. May have signature of [AppMount](./kibana-plugin-public.appmount.md) or [AppMountDeprecated](./kibana-plugin-public.appmountdeprecated.md). Signature: ```typescript -mount: (context: AppMountContext, params: AppMountParameters) => AppUnmount | Promise; +mount: AppMount | AppMountDeprecated; ``` + +## Remarks + +When function has two arguments, it will be called with a [context](./kibana-plugin-public.appmountcontext.md) as the first argument. This behavior is \*\*deprecated\*\*, and consumers should instead use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). + diff --git a/docs/development/core/public/kibana-plugin-public.applicationsetup.md b/docs/development/core/public/kibana-plugin-public.applicationsetup.md index b53873bc0fb8..a63de399c2ec 100644 --- a/docs/development/core/public/kibana-plugin-public.applicationsetup.md +++ b/docs/development/core/public/kibana-plugin-public.applicationsetup.md @@ -16,5 +16,5 @@ export interface ApplicationSetup | Method | Description | | --- | --- | | [register(app)](./kibana-plugin-public.applicationsetup.register.md) | Register an mountable application to the system. | -| [registerMountContext(contextName, provider)](./kibana-plugin-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. | +| [registerMountContext(contextName, provider)](./kibana-plugin-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). | diff --git a/docs/development/core/public/kibana-plugin-public.applicationsetup.registermountcontext.md b/docs/development/core/public/kibana-plugin-public.applicationsetup.registermountcontext.md index f264ba500ed6..275ba431bc7e 100644 --- a/docs/development/core/public/kibana-plugin-public.applicationsetup.registermountcontext.md +++ b/docs/development/core/public/kibana-plugin-public.applicationsetup.registermountcontext.md @@ -4,12 +4,16 @@ ## ApplicationSetup.registerMountContext() method -Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. +> Warning: This API is now obsolete. +> +> + +Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). Signature: ```typescript -registerMountContext(contextName: T, provider: IContextProvider): void; +registerMountContext(contextName: T, provider: IContextProvider): void; ``` ## Parameters @@ -17,7 +21,7 @@ registerMountContext(contextName: T, provider: | Parameter | Type | Description | | --- | --- | --- | | contextName | T | The key of [AppMountContext](./kibana-plugin-public.appmountcontext.md) this provider's return value should be attached to. | -| provider | IContextProvider<App['mount'], T> | A [IContextProvider](./kibana-plugin-public.icontextprovider.md) function | +| provider | IContextProvider<AppMountDeprecated, T> | A [IContextProvider](./kibana-plugin-public.icontextprovider.md) function | Returns: diff --git a/docs/development/core/public/kibana-plugin-public.applicationstart.md b/docs/development/core/public/kibana-plugin-public.applicationstart.md index 2a60ff449e44..4baa4565ff7b 100644 --- a/docs/development/core/public/kibana-plugin-public.applicationstart.md +++ b/docs/development/core/public/kibana-plugin-public.applicationstart.md @@ -23,5 +23,5 @@ export interface ApplicationStart | --- | --- | | [getUrlForApp(appId, options)](./kibana-plugin-public.applicationstart.geturlforapp.md) | Returns a relative URL to a given app, including the global base path. | | [navigateToApp(appId, options)](./kibana-plugin-public.applicationstart.navigatetoapp.md) | Navigiate to a given app | -| [registerMountContext(contextName, provider)](./kibana-plugin-public.applicationstart.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. | +| [registerMountContext(contextName, provider)](./kibana-plugin-public.applicationstart.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). | diff --git a/docs/development/core/public/kibana-plugin-public.applicationstart.registermountcontext.md b/docs/development/core/public/kibana-plugin-public.applicationstart.registermountcontext.md index 62821fcbb92b..c15a23fe82b2 100644 --- a/docs/development/core/public/kibana-plugin-public.applicationstart.registermountcontext.md +++ b/docs/development/core/public/kibana-plugin-public.applicationstart.registermountcontext.md @@ -4,12 +4,16 @@ ## ApplicationStart.registerMountContext() method -Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. +> Warning: This API is now obsolete. +> +> + +Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). Signature: ```typescript -registerMountContext(contextName: T, provider: IContextProvider): void; +registerMountContext(contextName: T, provider: IContextProvider): void; ``` ## Parameters @@ -17,7 +21,7 @@ registerMountContext(contextName: T, provider: | Parameter | Type | Description | | --- | --- | --- | | contextName | T | The key of [AppMountContext](./kibana-plugin-public.appmountcontext.md) this provider's return value should be attached to. | -| provider | IContextProvider<App['mount'], T> | A [IContextProvider](./kibana-plugin-public.icontextprovider.md) function | +| provider | IContextProvider<AppMountDeprecated, T> | A [IContextProvider](./kibana-plugin-public.icontextprovider.md) function | Returns: diff --git a/docs/development/core/public/kibana-plugin-public.appmount.md b/docs/development/core/public/kibana-plugin-public.appmount.md new file mode 100644 index 000000000000..25faa7be30b6 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appmount.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppMount](./kibana-plugin-public.appmount.md) + +## AppMount type + +A mount function called when the user navigates to this app's route. + +Signature: + +```typescript +export declare type AppMount = (params: AppMountParameters) => AppUnmount | Promise; +``` diff --git a/docs/development/core/public/kibana-plugin-public.appmountcontext.md b/docs/development/core/public/kibana-plugin-public.appmountcontext.md index 68a1c27b1183..2f8c0553d0b3 100644 --- a/docs/development/core/public/kibana-plugin-public.appmountcontext.md +++ b/docs/development/core/public/kibana-plugin-public.appmountcontext.md @@ -4,7 +4,11 @@ ## AppMountContext interface -The context object received when applications are mounted to the DOM. +> Warning: This API is now obsolete. +> +> + +The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). Signature: diff --git a/docs/development/core/public/kibana-plugin-public.appmountdeprecated.md b/docs/development/core/public/kibana-plugin-public.appmountdeprecated.md new file mode 100644 index 000000000000..936642abcc97 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appmountdeprecated.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppMountDeprecated](./kibana-plugin-public.appmountdeprecated.md) + +## AppMountDeprecated type + +> Warning: This API is now obsolete. +> +> + +A mount function called when the user navigates to this app's route. + +Signature: + +```typescript +export declare type AppMountDeprecated = (context: AppMountContext, params: AppMountParameters) => AppUnmount | Promise; +``` + +## Remarks + +When function has two arguments, it will be called with a [context](./kibana-plugin-public.appmountcontext.md) as the first argument. This behavior is \*\*deprecated\*\*, and consumers should instead use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). + diff --git a/docs/development/core/public/kibana-plugin-public.appmountparameters.appbasepath.md b/docs/development/core/public/kibana-plugin-public.appmountparameters.appbasepath.md index 31513bda2e87..7cd709d61572 100644 --- a/docs/development/core/public/kibana-plugin-public.appmountparameters.appbasepath.md +++ b/docs/development/core/public/kibana-plugin-public.appmountparameters.appbasepath.md @@ -4,7 +4,7 @@ ## AppMountParameters.appBasePath property -The base path for configuring the application's router. +The route path for configuring navigation to the application. This string should not include the base path from HTTP. Signature: @@ -22,9 +22,10 @@ export class MyPlugin implements Plugin { setup({ application }) { application.register({ id: 'my-app', - async mount(context, params) { + appRoute: '/my-app', + async mount(params) { const { renderApp } = await import('./application'); - return renderApp(context, params); + return renderApp(params); }, }); } @@ -38,7 +39,10 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter, Route } from 'react-router-dom'; -export renderApp = (context, { appBasePath, element }) => { +import { CoreStart, AppMountParams } from 'src/core/public'; +import { MyPluginDepsStart } from './plugin'; + +export renderApp = ({ appBasePath, element }: AppMountParams) => { ReactDOM.render( // pass `appBasePath` to `basename` diff --git a/docs/development/core/public/kibana-plugin-public.appmountparameters.md b/docs/development/core/public/kibana-plugin-public.appmountparameters.md index 8733f9cd4915..aa5ca93ed8ff 100644 --- a/docs/development/core/public/kibana-plugin-public.appmountparameters.md +++ b/docs/development/core/public/kibana-plugin-public.appmountparameters.md @@ -15,6 +15,6 @@ export interface AppMountParameters | Property | Type | Description | | --- | --- | --- | -| [appBasePath](./kibana-plugin-public.appmountparameters.appbasepath.md) | string | The base path for configuring the application's router. | +| [appBasePath](./kibana-plugin-public.appmountparameters.appbasepath.md) | string | The route path for configuring navigation to the application. This string should not include the base path from HTTP. | | [element](./kibana-plugin-public.appmountparameters.element.md) | HTMLElement | The container element to render the application into. | diff --git a/docs/development/core/public/kibana-plugin-public.chromedoctitle.md b/docs/development/core/public/kibana-plugin-public.chromedoctitle.md index 3c6cfab48628..feb3b3ab966e 100644 --- a/docs/development/core/public/kibana-plugin-public.chromedoctitle.md +++ b/docs/development/core/public/kibana-plugin-public.chromedoctitle.md @@ -12,13 +12,6 @@ APIs for accessing and updating the document title. export interface ChromeDocTitle ``` -## Methods - -| Method | Description | -| --- | --- | -| [change(newTitle)](./kibana-plugin-public.chromedoctitle.change.md) | Changes the current document title. | -| [reset()](./kibana-plugin-public.chromedoctitle.reset.md) | Resets the document title to it's initial value. (meaning the one present in the title meta at application load.) | - ## Example 1 How to change the title of the document @@ -37,3 +30,10 @@ chrome.docTitle.reset() ``` +## Methods + +| Method | Description | +| --- | --- | +| [change(newTitle)](./kibana-plugin-public.chromedoctitle.change.md) | Changes the current document title. | +| [reset()](./kibana-plugin-public.chromedoctitle.reset.md) | Resets the document title to it's initial value. (meaning the one present in the title meta at application load.) | + diff --git a/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md b/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md index a34db9bb33d9..30b9a6869d1f 100644 --- a/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md +++ b/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md @@ -12,13 +12,6 @@ export interface ChromeNavControls ``` -## Methods - -| Method | Description | -| --- | --- | -| [registerLeft(navControl)](./kibana-plugin-public.chromenavcontrols.registerleft.md) | Register a nav control to be presented on the left side of the chrome header. | -| [registerRight(navControl)](./kibana-plugin-public.chromenavcontrols.registerright.md) | Register a nav control to be presented on the right side of the chrome header. | - ## Example Register a left-side nav control rendered with React. @@ -33,3 +26,10 @@ chrome.navControls.registerLeft({ ``` +## Methods + +| Method | Description | +| --- | --- | +| [registerLeft(navControl)](./kibana-plugin-public.chromenavcontrols.registerleft.md) | Register a nav control to be presented on the left side of the chrome header. | +| [registerRight(navControl)](./kibana-plugin-public.chromenavcontrols.registerright.md) | Register a nav control to be presented on the right side of the chrome header. | + diff --git a/docs/development/core/public/kibana-plugin-public.chromestart.md b/docs/development/core/public/kibana-plugin-public.chromestart.md index d5d99f3d5be6..4e44e5bf0507 100644 --- a/docs/development/core/public/kibana-plugin-public.chromestart.md +++ b/docs/development/core/public/kibana-plugin-public.chromestart.md @@ -12,6 +12,31 @@ ChromeStart allows plugins to customize the global chrome header UI and enrich t export interface ChromeStart ``` +## Remarks + +While ChromeStart exposes many APIs, they should be used sparingly and the developer should understand how they affect other plugins and applications. + +## Example 1 + +How to add a recently accessed item to the sidebar: + +```ts +core.chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234'); + +``` + +## Example 2 + +How to set the help dropdown extension: + +```tsx +core.chrome.setHelpExtension(elem => { + ReactDOM.render(, elem); + return () => ReactDOM.unmountComponentAtNode(elem); +}); + +``` + ## Properties | Property | Type | Description | @@ -43,28 +68,3 @@ export interface ChromeStart | [setIsCollapsed(isCollapsed)](./kibana-plugin-public.chromestart.setiscollapsed.md) | Set the collapsed state of the chrome navigation. | | [setIsVisible(isVisible)](./kibana-plugin-public.chromestart.setisvisible.md) | Set the temporary visibility for the chrome. This does nothing if the chrome is hidden by default and should be used to hide the chrome for things like full-screen modes with an exit button. | -## Remarks - -While ChromeStart exposes many APIs, they should be used sparingly and the developer should understand how they affect other plugins and applications. - -## Example 1 - -How to add a recently accessed item to the sidebar: - -```ts -core.chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234'); - -``` - -## Example 2 - -How to set the help dropdown extension: - -```tsx -core.chrome.setHelpExtension(elem => { - ReactDOM.render(, elem); - return () => ReactDOM.unmountComponentAtNode(elem); -}); - -``` - diff --git a/docs/development/core/public/kibana-plugin-public.contextsetup.md b/docs/development/core/public/kibana-plugin-public.contextsetup.md index a006fa7205ca..d4399b6ba70c 100644 --- a/docs/development/core/public/kibana-plugin-public.contextsetup.md +++ b/docs/development/core/public/kibana-plugin-public.contextsetup.md @@ -12,12 +12,6 @@ An object that handles registration of context providers and configuring handler export interface ContextSetup ``` -## Methods - -| Method | Description | -| --- | --- | -| [createContextContainer()](./kibana-plugin-public.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-public.icontextcontainer.md) for a service owner. | - ## Remarks A [IContextContainer](./kibana-plugin-public.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares. @@ -136,3 +130,9 @@ class VizRenderingPlugin { ``` +## Methods + +| Method | Description | +| --- | --- | +| [createContextContainer()](./kibana-plugin-public.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-public.icontextcontainer.md) for a service owner. | + diff --git a/docs/development/core/public/kibana-plugin-public.coresetup.context.md b/docs/development/core/public/kibana-plugin-public.coresetup.context.md index e56ecb92074c..f2a891c6c674 100644 --- a/docs/development/core/public/kibana-plugin-public.coresetup.context.md +++ b/docs/development/core/public/kibana-plugin-public.coresetup.context.md @@ -4,6 +4,10 @@ ## CoreSetup.context property +> Warning: This API is now obsolete. +> +> + [ContextSetup](./kibana-plugin-public.contextsetup.md) Signature: diff --git a/docs/development/core/public/kibana-plugin-public.coresetup.getstartservices.md b/docs/development/core/public/kibana-plugin-public.coresetup.getstartservices.md new file mode 100644 index 000000000000..b89d98b0a9ed --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.coresetup.getstartservices.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [CoreSetup](./kibana-plugin-public.coresetup.md) > [getStartServices](./kibana-plugin-public.coresetup.getstartservices.md) + +## CoreSetup.getStartServices() method + +Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-public.app.mount.md). Promise will not resolve until Core and plugin dependencies have completed `start`. + +Signature: + +```typescript +getStartServices(): Promise<[CoreStart, TPluginsStart]>; +``` +Returns: + +`Promise<[CoreStart, TPluginsStart]>` + diff --git a/docs/development/core/public/kibana-plugin-public.coresetup.md b/docs/development/core/public/kibana-plugin-public.coresetup.md index 8314bde7b95f..7d75782df2e3 100644 --- a/docs/development/core/public/kibana-plugin-public.coresetup.md +++ b/docs/development/core/public/kibana-plugin-public.coresetup.md @@ -9,7 +9,7 @@ Core services exposed to the `Plugin` setup lifecycle Signature: ```typescript -export interface CoreSetup +export interface CoreSetup ``` ## Properties @@ -24,3 +24,9 @@ export interface CoreSetup | [notifications](./kibana-plugin-public.coresetup.notifications.md) | NotificationsSetup | [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) | | [uiSettings](./kibana-plugin-public.coresetup.uisettings.md) | IUiSettingsClient | [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | +## Methods + +| Method | Description | +| --- | --- | +| [getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md) | Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-public.app.mount.md). Promise will not resolve until Core and plugin dependencies have completed start. | + diff --git a/docs/development/core/public/kibana-plugin-public.httpbody.md b/docs/development/core/public/kibana-plugin-public.httpbody.md deleted file mode 100644 index ab31f28b8dc3..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpbody.md +++ /dev/null @@ -1,12 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpBody](./kibana-plugin-public.httpbody.md) - -## HttpBody type - - -Signature: - -```typescript -export declare type HttpBody = BodyInit | null | any; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httperrorresponse.md b/docs/development/core/public/kibana-plugin-public.httperrorresponse.md index aa669df796a0..5b1ee898a444 100644 --- a/docs/development/core/public/kibana-plugin-public.httperrorresponse.md +++ b/docs/development/core/public/kibana-plugin-public.httperrorresponse.md @@ -8,7 +8,7 @@ Signature: ```typescript -export interface HttpErrorResponse extends HttpResponse +export interface HttpErrorResponse extends IHttpResponse ``` ## Properties diff --git a/docs/development/core/public/kibana-plugin-public.httpfetchoptions.asresponse.md b/docs/development/core/public/kibana-plugin-public.httpfetchoptions.asresponse.md new file mode 100644 index 000000000000..250cf83309b3 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpfetchoptions.asresponse.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) > [asResponse](./kibana-plugin-public.httpfetchoptions.asresponse.md) + +## HttpFetchOptions.asResponse property + +When `true` the return type of [HttpHandler](./kibana-plugin-public.httphandler.md) will be an [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) with detailed request and response information. When `false`, the return type will just be the parsed response body. Defaults to `false`. + +Signature: + +```typescript +asResponse?: boolean; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpfetchoptions.md b/docs/development/core/public/kibana-plugin-public.httpfetchoptions.md index eca29b37425e..6a0c4a8a7f13 100644 --- a/docs/development/core/public/kibana-plugin-public.httpfetchoptions.md +++ b/docs/development/core/public/kibana-plugin-public.httpfetchoptions.md @@ -16,6 +16,7 @@ export interface HttpFetchOptions extends HttpRequestInit | Property | Type | Description | | --- | --- | --- | +| [asResponse](./kibana-plugin-public.httpfetchoptions.asresponse.md) | boolean | When true the return type of [HttpHandler](./kibana-plugin-public.httphandler.md) will be an [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) with detailed request and response information. When false, the return type will just be the parsed response body. Defaults to false. | | [headers](./kibana-plugin-public.httpfetchoptions.headers.md) | HttpHeadersInit | Headers to send with the request. See [HttpHeadersInit](./kibana-plugin-public.httpheadersinit.md). | | [prependBasePath](./kibana-plugin-public.httpfetchoptions.prependbasepath.md) | boolean | Whether or not the request should automatically prepend the basePath. Defaults to true. | | [query](./kibana-plugin-public.httpfetchoptions.query.md) | HttpFetchQuery | The query string for an HTTP request. See [HttpFetchQuery](./kibana-plugin-public.httpfetchquery.md). | diff --git a/docs/development/core/public/kibana-plugin-public.httphandler.md b/docs/development/core/public/kibana-plugin-public.httphandler.md index 80fd1ea2e576..89458c4743cd 100644 --- a/docs/development/core/public/kibana-plugin-public.httphandler.md +++ b/docs/development/core/public/kibana-plugin-public.httphandler.md @@ -2,12 +2,12 @@ [Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpHandler](./kibana-plugin-public.httphandler.md) -## HttpHandler type +## HttpHandler interface -A function for making an HTTP requests to Kibana's backend. See [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) for options and [HttpBody](./kibana-plugin-public.httpbody.md) for the response. +A function for making an HTTP requests to Kibana's backend. See [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) for options and [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) for the response. Signature: ```typescript -export declare type HttpHandler = (path: string, options?: HttpFetchOptions) => Promise; +export interface HttpHandler ``` diff --git a/docs/development/core/public/kibana-plugin-public.httpinterceptor.response.md b/docs/development/core/public/kibana-plugin-public.httpinterceptor.response.md index ca43ea31f0e2..3a67dcbad311 100644 --- a/docs/development/core/public/kibana-plugin-public.httpinterceptor.response.md +++ b/docs/development/core/public/kibana-plugin-public.httpinterceptor.response.md @@ -9,17 +9,17 @@ Define an interceptor to be executed after a response is received. Signature: ```typescript -response?(httpResponse: HttpResponse, controller: IHttpInterceptController): Promise | InterceptedHttpResponse | void; +response?(httpResponse: IHttpResponse, controller: IHttpInterceptController): Promise | IHttpResponseInterceptorOverrides | void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| httpResponse | HttpResponse | | +| httpResponse | IHttpResponse | | | controller | IHttpInterceptController | | Returns: -`Promise | InterceptedHttpResponse | void` +`Promise | IHttpResponseInterceptorOverrides | void` diff --git a/docs/development/core/public/kibana-plugin-public.httpinterceptor.responseerror.md b/docs/development/core/public/kibana-plugin-public.httpinterceptor.responseerror.md index b8abd50e4546..476ceba649d4 100644 --- a/docs/development/core/public/kibana-plugin-public.httpinterceptor.responseerror.md +++ b/docs/development/core/public/kibana-plugin-public.httpinterceptor.responseerror.md @@ -9,7 +9,7 @@ Define an interceptor to be executed if a response interceptor throws an error o Signature: ```typescript -responseError?(httpErrorResponse: HttpErrorResponse, controller: IHttpInterceptController): Promise | InterceptedHttpResponse | void; +responseError?(httpErrorResponse: HttpErrorResponse, controller: IHttpInterceptController): Promise | IHttpResponseInterceptorOverrides | void; ``` ## Parameters @@ -21,5 +21,5 @@ responseError?(httpErrorResponse: HttpErrorResponse, controller: IHttpInterceptC Returns: -`Promise | InterceptedHttpResponse | void` +`Promise | IHttpResponseInterceptorOverrides | void` diff --git a/docs/development/core/public/kibana-plugin-public.httpresponse.md b/docs/development/core/public/kibana-plugin-public.httpresponse.md deleted file mode 100644 index e44515cc8a1e..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpresponse.md +++ /dev/null @@ -1,19 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpResponse](./kibana-plugin-public.httpresponse.md) - -## HttpResponse interface - - -Signature: - -```typescript -export interface HttpResponse extends InterceptedHttpResponse -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [request](./kibana-plugin-public.httpresponse.request.md) | Readonly<Request> | | - diff --git a/docs/development/core/public/kibana-plugin-public.httpresponse.request.md b/docs/development/core/public/kibana-plugin-public.httpresponse.request.md deleted file mode 100644 index 84ab1bc7af85..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpresponse.request.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpResponse](./kibana-plugin-public.httpresponse.md) > [request](./kibana-plugin-public.httpresponse.request.md) - -## HttpResponse.request property - -Signature: - -```typescript -request: Readonly; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.addloadingcount.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.addloadingcount.md deleted file mode 100644 index e984fea48625..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.addloadingcount.md +++ /dev/null @@ -1,24 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [addLoadingCount](./kibana-plugin-public.httpservicebase.addloadingcount.md) - -## HttpServiceBase.addLoadingCount() method - -Adds a new source of loading counts. Used to show the global loading indicator when sum of all observed counts are more than 0. - -Signature: - -```typescript -addLoadingCount(countSource$: Observable): void; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| countSource$ | Observable<number> | | - -Returns: - -`void` - diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.anonymouspaths.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.anonymouspaths.md deleted file mode 100644 index e94757c5eb03..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.anonymouspaths.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [anonymousPaths](./kibana-plugin-public.httpservicebase.anonymouspaths.md) - -## HttpServiceBase.anonymousPaths property - -APIs for denoting certain paths for not requiring authentication - -Signature: - -```typescript -anonymousPaths: IAnonymousPaths; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.basepath.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.basepath.md deleted file mode 100644 index 6c5f690a5c60..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.basepath.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [basePath](./kibana-plugin-public.httpservicebase.basepath.md) - -## HttpServiceBase.basePath property - -APIs for manipulating the basePath on URL segments. - -Signature: - -```typescript -basePath: IBasePath; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.delete.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.delete.md deleted file mode 100644 index 73022ef4f294..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.delete.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [delete](./kibana-plugin-public.httpservicebase.delete.md) - -## HttpServiceBase.delete property - -Makes an HTTP request with the DELETE method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -delete: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.fetch.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.fetch.md deleted file mode 100644 index 3a1ae4892a3d..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.fetch.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [fetch](./kibana-plugin-public.httpservicebase.fetch.md) - -## HttpServiceBase.fetch property - -Makes an HTTP request. Defaults to a GET request unless overriden. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -fetch: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.get.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.get.md deleted file mode 100644 index a61b3dd140e5..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.get.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [get](./kibana-plugin-public.httpservicebase.get.md) - -## HttpServiceBase.get property - -Makes an HTTP request with the GET method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -get: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.getloadingcount_.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.getloadingcount_.md deleted file mode 100644 index 0b2129330cd0..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.getloadingcount_.md +++ /dev/null @@ -1,17 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [getLoadingCount$](./kibana-plugin-public.httpservicebase.getloadingcount_.md) - -## HttpServiceBase.getLoadingCount$() method - -Get the sum of all loading count sources as a single Observable. - -Signature: - -```typescript -getLoadingCount$(): Observable; -``` -Returns: - -`Observable` - diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.head.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.head.md deleted file mode 100644 index 4624d95f03bf..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.head.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [head](./kibana-plugin-public.httpservicebase.head.md) - -## HttpServiceBase.head property - -Makes an HTTP request with the HEAD method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -head: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.intercept.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.intercept.md deleted file mode 100644 index 8cf5bf813df0..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.intercept.md +++ /dev/null @@ -1,26 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [intercept](./kibana-plugin-public.httpservicebase.intercept.md) - -## HttpServiceBase.intercept() method - -Adds a new [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) to the global HTTP client. - -Signature: - -```typescript -intercept(interceptor: HttpInterceptor): () => void; -``` - -## Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| interceptor | HttpInterceptor | | - -Returns: - -`() => void` - -a function for removing the attached interceptor. - diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.md deleted file mode 100644 index 9ea77c95b343..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.md +++ /dev/null @@ -1,37 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) - -## HttpServiceBase interface - - -Signature: - -```typescript -export interface HttpServiceBase -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [anonymousPaths](./kibana-plugin-public.httpservicebase.anonymouspaths.md) | IAnonymousPaths | APIs for denoting certain paths for not requiring authentication | -| [basePath](./kibana-plugin-public.httpservicebase.basepath.md) | IBasePath | APIs for manipulating the basePath on URL segments. | -| [delete](./kibana-plugin-public.httpservicebase.delete.md) | HttpHandler | Makes an HTTP request with the DELETE method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [fetch](./kibana-plugin-public.httpservicebase.fetch.md) | HttpHandler | Makes an HTTP request. Defaults to a GET request unless overriden. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [get](./kibana-plugin-public.httpservicebase.get.md) | HttpHandler | Makes an HTTP request with the GET method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [head](./kibana-plugin-public.httpservicebase.head.md) | HttpHandler | Makes an HTTP request with the HEAD method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [options](./kibana-plugin-public.httpservicebase.options.md) | HttpHandler | Makes an HTTP request with the OPTIONS method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [patch](./kibana-plugin-public.httpservicebase.patch.md) | HttpHandler | Makes an HTTP request with the PATCH method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [post](./kibana-plugin-public.httpservicebase.post.md) | HttpHandler | Makes an HTTP request with the POST method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | -| [put](./kibana-plugin-public.httpservicebase.put.md) | HttpHandler | Makes an HTTP request with the PUT method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | - -## Methods - -| Method | Description | -| --- | --- | -| [addLoadingCount(countSource$)](./kibana-plugin-public.httpservicebase.addloadingcount.md) | Adds a new source of loading counts. Used to show the global loading indicator when sum of all observed counts are more than 0. | -| [getLoadingCount$()](./kibana-plugin-public.httpservicebase.getloadingcount_.md) | Get the sum of all loading count sources as a single Observable. | -| [intercept(interceptor)](./kibana-plugin-public.httpservicebase.intercept.md) | Adds a new [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) to the global HTTP client. | -| [removeAllInterceptors()](./kibana-plugin-public.httpservicebase.removeallinterceptors.md) | Removes all configured interceptors. | - diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.options.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.options.md deleted file mode 100644 index 0820beb2752f..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.options.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [options](./kibana-plugin-public.httpservicebase.options.md) - -## HttpServiceBase.options property - -Makes an HTTP request with the OPTIONS method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -options: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.patch.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.patch.md deleted file mode 100644 index 00e1ffc0e16b..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.patch.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [patch](./kibana-plugin-public.httpservicebase.patch.md) - -## HttpServiceBase.patch property - -Makes an HTTP request with the PATCH method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -patch: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.post.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.post.md deleted file mode 100644 index 3771a7c91089..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.post.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [post](./kibana-plugin-public.httpservicebase.post.md) - -## HttpServiceBase.post property - -Makes an HTTP request with the POST method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -post: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.put.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.put.md deleted file mode 100644 index 6e43aafa916b..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.put.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [put](./kibana-plugin-public.httpservicebase.put.md) - -## HttpServiceBase.put property - -Makes an HTTP request with the PUT method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. - -Signature: - -```typescript -put: HttpHandler; -``` diff --git a/docs/development/core/public/kibana-plugin-public.httpservicebase.removeallinterceptors.md b/docs/development/core/public/kibana-plugin-public.httpservicebase.removeallinterceptors.md deleted file mode 100644 index 0432ec29a22b..000000000000 --- a/docs/development/core/public/kibana-plugin-public.httpservicebase.removeallinterceptors.md +++ /dev/null @@ -1,17 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) > [removeAllInterceptors](./kibana-plugin-public.httpservicebase.removeallinterceptors.md) - -## HttpServiceBase.removeAllInterceptors() method - -Removes all configured interceptors. - -Signature: - -```typescript -removeAllInterceptors(): void; -``` -Returns: - -`void` - diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.addloadingcountsource.md b/docs/development/core/public/kibana-plugin-public.httpsetup.addloadingcountsource.md new file mode 100644 index 000000000000..a2fe66bb55c7 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.addloadingcountsource.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [addLoadingCountSource](./kibana-plugin-public.httpsetup.addloadingcountsource.md) + +## HttpSetup.addLoadingCountSource() method + +Adds a new source of loading counts. Used to show the global loading indicator when sum of all observed counts are more than 0. + +Signature: + +```typescript +addLoadingCountSource(countSource$: Observable): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| countSource$ | Observable<number> | | + +Returns: + +`void` + diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.anonymouspaths.md b/docs/development/core/public/kibana-plugin-public.httpsetup.anonymouspaths.md new file mode 100644 index 000000000000..a9268ca1d8ed --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.anonymouspaths.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [anonymousPaths](./kibana-plugin-public.httpsetup.anonymouspaths.md) + +## HttpSetup.anonymousPaths property + +APIs for denoting certain paths for not requiring authentication + +Signature: + +```typescript +anonymousPaths: IAnonymousPaths; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.basepath.md b/docs/development/core/public/kibana-plugin-public.httpsetup.basepath.md new file mode 100644 index 000000000000..6b0726dc8ef2 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.basepath.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [basePath](./kibana-plugin-public.httpsetup.basepath.md) + +## HttpSetup.basePath property + +APIs for manipulating the basePath on URL segments. + +Signature: + +```typescript +basePath: IBasePath; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.delete.md b/docs/development/core/public/kibana-plugin-public.httpsetup.delete.md new file mode 100644 index 000000000000..565f0eb336d4 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.delete.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [delete](./kibana-plugin-public.httpsetup.delete.md) + +## HttpSetup.delete property + +Makes an HTTP request with the DELETE method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +delete: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.fetch.md b/docs/development/core/public/kibana-plugin-public.httpsetup.fetch.md new file mode 100644 index 000000000000..2d6447363fa9 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.fetch.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [fetch](./kibana-plugin-public.httpsetup.fetch.md) + +## HttpSetup.fetch property + +Makes an HTTP request. Defaults to a GET request unless overriden. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +fetch: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.get.md b/docs/development/core/public/kibana-plugin-public.httpsetup.get.md new file mode 100644 index 000000000000..0c484e33e9b5 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.get.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [get](./kibana-plugin-public.httpsetup.get.md) + +## HttpSetup.get property + +Makes an HTTP request with the GET method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +get: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.getloadingcount_.md b/docs/development/core/public/kibana-plugin-public.httpsetup.getloadingcount_.md new file mode 100644 index 000000000000..628b62b2ffc2 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.getloadingcount_.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [getLoadingCount$](./kibana-plugin-public.httpsetup.getloadingcount_.md) + +## HttpSetup.getLoadingCount$() method + +Get the sum of all loading count sources as a single Observable. + +Signature: + +```typescript +getLoadingCount$(): Observable; +``` +Returns: + +`Observable` + diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.head.md b/docs/development/core/public/kibana-plugin-public.httpsetup.head.md new file mode 100644 index 000000000000..e4d49c843e57 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.head.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [head](./kibana-plugin-public.httpsetup.head.md) + +## HttpSetup.head property + +Makes an HTTP request with the HEAD method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +head: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.intercept.md b/docs/development/core/public/kibana-plugin-public.httpsetup.intercept.md new file mode 100644 index 000000000000..1bda0c6166e6 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.intercept.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [intercept](./kibana-plugin-public.httpsetup.intercept.md) + +## HttpSetup.intercept() method + +Adds a new [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) to the global HTTP client. + +Signature: + +```typescript +intercept(interceptor: HttpInterceptor): () => void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| interceptor | HttpInterceptor | | + +Returns: + +`() => void` + +a function for removing the attached interceptor. + diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.md b/docs/development/core/public/kibana-plugin-public.httpsetup.md index 7ef037ea7abd..8a14d26c57ca 100644 --- a/docs/development/core/public/kibana-plugin-public.httpsetup.md +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.md @@ -2,12 +2,35 @@ [Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) -## HttpSetup type +## HttpSetup interface -See [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) Signature: ```typescript -export declare type HttpSetup = HttpServiceBase; +export interface HttpSetup ``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [anonymousPaths](./kibana-plugin-public.httpsetup.anonymouspaths.md) | IAnonymousPaths | APIs for denoting certain paths for not requiring authentication | +| [basePath](./kibana-plugin-public.httpsetup.basepath.md) | IBasePath | APIs for manipulating the basePath on URL segments. | +| [delete](./kibana-plugin-public.httpsetup.delete.md) | HttpHandler | Makes an HTTP request with the DELETE method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [fetch](./kibana-plugin-public.httpsetup.fetch.md) | HttpHandler | Makes an HTTP request. Defaults to a GET request unless overriden. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [get](./kibana-plugin-public.httpsetup.get.md) | HttpHandler | Makes an HTTP request with the GET method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [head](./kibana-plugin-public.httpsetup.head.md) | HttpHandler | Makes an HTTP request with the HEAD method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [options](./kibana-plugin-public.httpsetup.options.md) | HttpHandler | Makes an HTTP request with the OPTIONS method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [patch](./kibana-plugin-public.httpsetup.patch.md) | HttpHandler | Makes an HTTP request with the PATCH method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [post](./kibana-plugin-public.httpsetup.post.md) | HttpHandler | Makes an HTTP request with the POST method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | +| [put](./kibana-plugin-public.httpsetup.put.md) | HttpHandler | Makes an HTTP request with the PUT method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. | + +## Methods + +| Method | Description | +| --- | --- | +| [addLoadingCountSource(countSource$)](./kibana-plugin-public.httpsetup.addloadingcountsource.md) | Adds a new source of loading counts. Used to show the global loading indicator when sum of all observed counts are more than 0. | +| [getLoadingCount$()](./kibana-plugin-public.httpsetup.getloadingcount_.md) | Get the sum of all loading count sources as a single Observable. | +| [intercept(interceptor)](./kibana-plugin-public.httpsetup.intercept.md) | Adds a new [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) to the global HTTP client. | + diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.options.md b/docs/development/core/public/kibana-plugin-public.httpsetup.options.md new file mode 100644 index 000000000000..4ea5be8826bf --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.options.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [options](./kibana-plugin-public.httpsetup.options.md) + +## HttpSetup.options property + +Makes an HTTP request with the OPTIONS method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +options: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.patch.md b/docs/development/core/public/kibana-plugin-public.httpsetup.patch.md new file mode 100644 index 000000000000..ef1d50005b01 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.patch.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [patch](./kibana-plugin-public.httpsetup.patch.md) + +## HttpSetup.patch property + +Makes an HTTP request with the PATCH method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +patch: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.post.md b/docs/development/core/public/kibana-plugin-public.httpsetup.post.md new file mode 100644 index 000000000000..1c19c35ac303 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.post.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [post](./kibana-plugin-public.httpsetup.post.md) + +## HttpSetup.post property + +Makes an HTTP request with the POST method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +post: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpsetup.put.md b/docs/development/core/public/kibana-plugin-public.httpsetup.put.md new file mode 100644 index 000000000000..e5243d8c80da --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.httpsetup.put.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [HttpSetup](./kibana-plugin-public.httpsetup.md) > [put](./kibana-plugin-public.httpsetup.put.md) + +## HttpSetup.put property + +Makes an HTTP request with the PUT method. See [HttpHandler](./kibana-plugin-public.httphandler.md) for options. + +Signature: + +```typescript +put: HttpHandler; +``` diff --git a/docs/development/core/public/kibana-plugin-public.httpstart.md b/docs/development/core/public/kibana-plugin-public.httpstart.md index bb9247c63897..9abf319acf00 100644 --- a/docs/development/core/public/kibana-plugin-public.httpstart.md +++ b/docs/development/core/public/kibana-plugin-public.httpstart.md @@ -4,10 +4,10 @@ ## HttpStart type -See [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) +See [HttpSetup](./kibana-plugin-public.httpsetup.md) Signature: ```typescript -export declare type HttpStart = HttpServiceBase; +export declare type HttpStart = HttpSetup; ``` diff --git a/docs/development/core/public/kibana-plugin-public.icontextcontainer.md b/docs/development/core/public/kibana-plugin-public.icontextcontainer.md index f16c07b3d790..7a21df6b93bb 100644 --- a/docs/development/core/public/kibana-plugin-public.icontextcontainer.md +++ b/docs/development/core/public/kibana-plugin-public.icontextcontainer.md @@ -12,13 +12,6 @@ An object that handles registration of context providers and configuring handler export interface IContextContainer> ``` -## Methods - -| Method | Description | -| --- | --- | -| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-public.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. | -| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-public.icontextcontainer.registercontext.md) | Register a new context provider. | - ## Remarks A [IContextContainer](./kibana-plugin-public.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares. @@ -78,3 +71,10 @@ class MyPlugin { ``` +## Methods + +| Method | Description | +| --- | --- | +| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-public.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. | +| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-public.icontextcontainer.registercontext.md) | Register a new context provider. | + diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponse.body.md b/docs/development/core/public/kibana-plugin-public.ihttpresponse.body.md new file mode 100644 index 000000000000..2f8710ccdc60 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponse.body.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) > [body](./kibana-plugin-public.ihttpresponse.body.md) + +## IHttpResponse.body property + +Parsed body received, may be undefined if there was an error. + +Signature: + +```typescript +readonly body?: TResponseBody; +``` diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponse.md b/docs/development/core/public/kibana-plugin-public.ihttpresponse.md new file mode 100644 index 000000000000..5ddce0ba2d0f --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponse.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) + +## IHttpResponse interface + + +Signature: + +```typescript +export interface IHttpResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [body](./kibana-plugin-public.ihttpresponse.body.md) | TResponseBody | Parsed body received, may be undefined if there was an error. | +| [request](./kibana-plugin-public.ihttpresponse.request.md) | Readonly<Request> | Raw request sent to Kibana server. | +| [response](./kibana-plugin-public.ihttpresponse.response.md) | Readonly<Response> | Raw response received, may be undefined if there was an error. | + diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponse.request.md b/docs/development/core/public/kibana-plugin-public.ihttpresponse.request.md new file mode 100644 index 000000000000..12e5405eb5ed --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponse.request.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) > [request](./kibana-plugin-public.ihttpresponse.request.md) + +## IHttpResponse.request property + +Raw request sent to Kibana server. + +Signature: + +```typescript +readonly request: Readonly; +``` diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponse.response.md b/docs/development/core/public/kibana-plugin-public.ihttpresponse.response.md new file mode 100644 index 000000000000..9d0b4b59a638 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponse.response.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) > [response](./kibana-plugin-public.ihttpresponse.response.md) + +## IHttpResponse.response property + +Raw response received, may be undefined if there was an error. + +Signature: + +```typescript +readonly response?: Readonly; +``` diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.body.md b/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.body.md new file mode 100644 index 000000000000..36fcfb390617 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.body.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) > [body](./kibana-plugin-public.ihttpresponseinterceptoroverrides.body.md) + +## IHttpResponseInterceptorOverrides.body property + +Parsed body received, may be undefined if there was an error. + +Signature: + +```typescript +readonly body?: TResponseBody; +``` diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.md b/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.md new file mode 100644 index 000000000000..44f067c429e9 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) + +## IHttpResponseInterceptorOverrides interface + +Properties that can be returned by HttpInterceptor.request to override the response. + +Signature: + +```typescript +export interface IHttpResponseInterceptorOverrides +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [body](./kibana-plugin-public.ihttpresponseinterceptoroverrides.body.md) | TResponseBody | Parsed body received, may be undefined if there was an error. | +| [response](./kibana-plugin-public.ihttpresponseinterceptoroverrides.response.md) | Readonly<Response> | Raw response received, may be undefined if there was an error. | + diff --git a/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.response.md b/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.response.md new file mode 100644 index 000000000000..bcba996645ba --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.ihttpresponseinterceptoroverrides.response.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) > [response](./kibana-plugin-public.ihttpresponseinterceptoroverrides.response.md) + +## IHttpResponseInterceptorOverrides.response property + +Raw response received, may be undefined if there was an error. + +Signature: + +```typescript +readonly response?: Readonly; +``` diff --git a/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.body.md b/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.body.md deleted file mode 100644 index fc6d34c0b74f..000000000000 --- a/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.body.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [InterceptedHttpResponse](./kibana-plugin-public.interceptedhttpresponse.md) > [body](./kibana-plugin-public.interceptedhttpresponse.body.md) - -## InterceptedHttpResponse.body property - -Signature: - -```typescript -body?: HttpBody; -``` diff --git a/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.md b/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.md deleted file mode 100644 index c4a7f4d6b2af..000000000000 --- a/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.md +++ /dev/null @@ -1,20 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [InterceptedHttpResponse](./kibana-plugin-public.interceptedhttpresponse.md) - -## InterceptedHttpResponse interface - - -Signature: - -```typescript -export interface InterceptedHttpResponse -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [body](./kibana-plugin-public.interceptedhttpresponse.body.md) | HttpBody | | -| [response](./kibana-plugin-public.interceptedhttpresponse.response.md) | Response | | - diff --git a/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.response.md b/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.response.md deleted file mode 100644 index dceb55113ee7..000000000000 --- a/docs/development/core/public/kibana-plugin-public.interceptedhttpresponse.response.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [InterceptedHttpResponse](./kibana-plugin-public.interceptedhttpresponse.md) > [response](./kibana-plugin-public.interceptedhttpresponse.response.md) - -## InterceptedHttpResponse.response property - -Signature: - -```typescript -response?: Response; -``` diff --git a/docs/development/core/public/kibana-plugin-public.legacycoresetup.md b/docs/development/core/public/kibana-plugin-public.legacycoresetup.md index f704bc65d12a..803c96cd0b22 100644 --- a/docs/development/core/public/kibana-plugin-public.legacycoresetup.md +++ b/docs/development/core/public/kibana-plugin-public.legacycoresetup.md @@ -13,16 +13,16 @@ Setup interface exposed to the legacy platform via the `ui/new_platform` module. Signature: ```typescript -export interface LegacyCoreSetup extends CoreSetup +export interface LegacyCoreSetup extends CoreSetup ``` +## Remarks + +Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreSetup](./kibana-plugin-public.coresetup.md), unsupported methods will throw exceptions when called. + ## Properties | Property | Type | Description | | --- | --- | --- | | [injectedMetadata](./kibana-plugin-public.legacycoresetup.injectedmetadata.md) | InjectedMetadataSetup | | -## Remarks - -Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreSetup](./kibana-plugin-public.coresetup.md), unsupported methods will throw exceptions when called. - diff --git a/docs/development/core/public/kibana-plugin-public.legacycorestart.md b/docs/development/core/public/kibana-plugin-public.legacycorestart.md index 775c3fb1ffe3..438a3d611077 100644 --- a/docs/development/core/public/kibana-plugin-public.legacycorestart.md +++ b/docs/development/core/public/kibana-plugin-public.legacycorestart.md @@ -16,13 +16,13 @@ Start interface exposed to the legacy platform via the `ui/new_platform` module. export interface LegacyCoreStart extends CoreStart ``` +## Remarks + +Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreStart](./kibana-plugin-public.corestart.md), unsupported methods will throw exceptions when called. + ## Properties | Property | Type | Description | | --- | --- | --- | | [injectedMetadata](./kibana-plugin-public.legacycorestart.injectedmetadata.md) | InjectedMetadataStart | | -## Remarks - -Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreStart](./kibana-plugin-public.corestart.md), unsupported methods will throw exceptions when called. - diff --git a/docs/development/core/public/kibana-plugin-public.md b/docs/development/core/public/kibana-plugin-public.md index f527c92d070d..e2c2866b57b6 100644 --- a/docs/development/core/public/kibana-plugin-public.md +++ b/docs/development/core/public/kibana-plugin-public.md @@ -26,7 +26,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [AppBase](./kibana-plugin-public.appbase.md) | | | [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) | | | [ApplicationStart](./kibana-plugin-public.applicationstart.md) | | -| [AppMountContext](./kibana-plugin-public.appmountcontext.md) | The context object received when applications are mounted to the DOM. | +| [AppMountContext](./kibana-plugin-public.appmountcontext.md) | The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). | | [AppMountParameters](./kibana-plugin-public.appmountparameters.md) | | | [Capabilities](./kibana-plugin-public.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. | | [ChromeBadge](./kibana-plugin-public.chromebadge.md) | | @@ -52,18 +52,19 @@ The plugin integrates with the core system via lifecycle events: `setup` | [HttpErrorResponse](./kibana-plugin-public.httperrorresponse.md) | | | [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) | All options that may be used with a [HttpHandler](./kibana-plugin-public.httphandler.md). | | [HttpFetchQuery](./kibana-plugin-public.httpfetchquery.md) | | +| [HttpHandler](./kibana-plugin-public.httphandler.md) | A function for making an HTTP requests to Kibana's backend. See [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) for options and [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) for the response. | | [HttpHeadersInit](./kibana-plugin-public.httpheadersinit.md) | | | [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) | An object that may define global interceptor functions for different parts of the request and response lifecycle. See [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md). | | [HttpRequestInit](./kibana-plugin-public.httprequestinit.md) | Fetch API options available to [HttpHandler](./kibana-plugin-public.httphandler.md)s. | -| [HttpResponse](./kibana-plugin-public.httpresponse.md) | | -| [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) | | +| [HttpSetup](./kibana-plugin-public.httpsetup.md) | | | [I18nStart](./kibana-plugin-public.i18nstart.md) | I18nStart.Context is required by any localizable React component from @kbn/i18n and @elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree. | | [IAnonymousPaths](./kibana-plugin-public.ianonymouspaths.md) | APIs for denoting paths as not requiring authentication | | [IBasePath](./kibana-plugin-public.ibasepath.md) | APIs for manipulating the basePath on URL segments. | | [IContextContainer](./kibana-plugin-public.icontextcontainer.md) | An object that handles registration of context providers and configuring handlers with context. | | [IHttpFetchError](./kibana-plugin-public.ihttpfetcherror.md) | | | [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md) | Used to halt a request Promise chain in a [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md). | -| [InterceptedHttpResponse](./kibana-plugin-public.interceptedhttpresponse.md) | | +| [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) | | +| [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) | Properties that can be returned by HttpInterceptor.request to override the response. | | [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | Client-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | | [LegacyCoreSetup](./kibana-plugin-public.legacycoresetup.md) | Setup interface exposed to the legacy platform via the ui/new_platform module. | | [LegacyCoreStart](./kibana-plugin-public.legacycorestart.md) | Start interface exposed to the legacy platform via the ui/new_platform module. | @@ -88,6 +89,13 @@ The plugin integrates with the core system via lifecycle events: `setup` | [SavedObjectsCreateOptions](./kibana-plugin-public.savedobjectscreateoptions.md) | | | [SavedObjectsFindOptions](./kibana-plugin-public.savedobjectsfindoptions.md) | | | [SavedObjectsFindResponsePublic](./kibana-plugin-public.savedobjectsfindresponsepublic.md) | Return type of the Saved Objects find() method.\*Note\*: this type is different between the Public and Server Saved Objects clients. | +| [SavedObjectsImportConflictError](./kibana-plugin-public.savedobjectsimportconflicterror.md) | Represents a failure to import due to a conflict. | +| [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) | Represents a failure to import. | +| [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) | Represents a failure to import due to missing references. | +| [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) | The response describing the result of an import. | +| [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) | Describes a retry operation for importing a saved object. | +| [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) | Represents a failure to import due to an unknown reason. | +| [SavedObjectsImportUnsupportedTypeError](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md) | Represents a failure to import due to having an unsupported saved object type. | | [SavedObjectsMigrationVersion](./kibana-plugin-public.savedobjectsmigrationversion.md) | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | | [SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md) | | | [SavedObjectsUpdateOptions](./kibana-plugin-public.savedobjectsupdateoptions.md) | | @@ -97,6 +105,8 @@ The plugin integrates with the core system via lifecycle events: `setup` | Type Alias | Description | | --- | --- | +| [AppMount](./kibana-plugin-public.appmount.md) | A mount function called when the user navigates to this app's route. | +| [AppMountDeprecated](./kibana-plugin-public.appmountdeprecated.md) | A mount function called when the user navigates to this app's route. | | [AppUnmount](./kibana-plugin-public.appunmount.md) | A function called when an application should be unmounted from the page. This function should be synchronous. | | [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) | | | [ChromeHelpExtensionMenuCustomLink](./kibana-plugin-public.chromehelpextensionmenucustomlink.md) | | @@ -108,10 +118,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [HandlerContextType](./kibana-plugin-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md) to represent the type of the context. | | [HandlerFunction](./kibana-plugin-public.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-public.icontextcontainer.md) | | [HandlerParameters](./kibana-plugin-public.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md), excluding the [HandlerContextType](./kibana-plugin-public.handlercontexttype.md). | -| [HttpBody](./kibana-plugin-public.httpbody.md) | | -| [HttpHandler](./kibana-plugin-public.httphandler.md) | A function for making an HTTP requests to Kibana's backend. See [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) for options and [HttpBody](./kibana-plugin-public.httpbody.md) for the response. | -| [HttpSetup](./kibana-plugin-public.httpsetup.md) | See [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) | -| [HttpStart](./kibana-plugin-public.httpstart.md) | See [HttpServiceBase](./kibana-plugin-public.httpservicebase.md) | +| [HttpStart](./kibana-plugin-public.httpstart.md) | See [HttpSetup](./kibana-plugin-public.httpsetup.md) | | [IContextProvider](./kibana-plugin-public.icontextprovider.md) | A function that returns a context value for a specific key of given context type. | | [IToasts](./kibana-plugin-public.itoasts.md) | Methods for adding and removing global toast messages. See [ToastsApi](./kibana-plugin-public.toastsapi.md). | | [MountPoint](./kibana-plugin-public.mountpoint.md) | A function that should mount DOM content inside the provided container element and return a handler to unmount it. | diff --git a/docs/development/core/public/kibana-plugin-public.plugin.setup.md b/docs/development/core/public/kibana-plugin-public.plugin.setup.md index 56855b02cfba..f058bc8d86fb 100644 --- a/docs/development/core/public/kibana-plugin-public.plugin.setup.md +++ b/docs/development/core/public/kibana-plugin-public.plugin.setup.md @@ -7,14 +7,14 @@ Signature: ```typescript -setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise; +setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| core | CoreSetup | | +| core | CoreSetup<TPluginsStart> | | | plugins | TPluginsSetup | | Returns: diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md b/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md index 6033c667c186..3b916db97267 100644 --- a/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md @@ -12,6 +12,10 @@ Saved Objects is Kibana's data persisentence mechanism allowing plugins to use E export declare class SavedObjectsClient ``` +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class. + ## Properties | Property | Modifiers | Type | Description | @@ -30,7 +34,3 @@ export declare class SavedObjectsClient | [bulkUpdate(objects)](./kibana-plugin-public.savedobjectsclient.bulkupdate.md) | | Update multiple documents at once | | [update(type, id, attributes, { version, migrationVersion, references })](./kibana-plugin-public.savedobjectsclient.update.md) | | Updates an object | -## Remarks - -The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class. - diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportconflicterror.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportconflicterror.md new file mode 100644 index 000000000000..6becc3d50746 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportconflicterror.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportConflictError](./kibana-plugin-public.savedobjectsimportconflicterror.md) + +## SavedObjectsImportConflictError interface + +Represents a failure to import due to a conflict. + +Signature: + +```typescript +export interface SavedObjectsImportConflictError +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [type](./kibana-plugin-public.savedobjectsimportconflicterror.type.md) | 'conflict' | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportconflicterror.type.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportconflicterror.type.md new file mode 100644 index 000000000000..af20cc8fa8df --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportconflicterror.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportConflictError](./kibana-plugin-public.savedobjectsimportconflicterror.md) > [type](./kibana-plugin-public.savedobjectsimportconflicterror.type.md) + +## SavedObjectsImportConflictError.type property + +Signature: + +```typescript +type: 'conflict'; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.error.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.error.md new file mode 100644 index 000000000000..ece6016e8bf5 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.error.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) > [error](./kibana-plugin-public.savedobjectsimporterror.error.md) + +## SavedObjectsImportError.error property + +Signature: + +```typescript +error: SavedObjectsImportConflictError | SavedObjectsImportUnsupportedTypeError | SavedObjectsImportMissingReferencesError | SavedObjectsImportUnknownError; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.id.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.id.md new file mode 100644 index 000000000000..995fe61745a0 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) > [id](./kibana-plugin-public.savedobjectsimporterror.id.md) + +## SavedObjectsImportError.id property + +Signature: + +```typescript +id: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.md new file mode 100644 index 000000000000..dee8bb1c79a5 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) + +## SavedObjectsImportError interface + +Represents a failure to import. + +Signature: + +```typescript +export interface SavedObjectsImportError +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [error](./kibana-plugin-public.savedobjectsimporterror.error.md) | SavedObjectsImportConflictError | SavedObjectsImportUnsupportedTypeError | SavedObjectsImportMissingReferencesError | SavedObjectsImportUnknownError | | +| [id](./kibana-plugin-public.savedobjectsimporterror.id.md) | string | | +| [title](./kibana-plugin-public.savedobjectsimporterror.title.md) | string | | +| [type](./kibana-plugin-public.savedobjectsimporterror.type.md) | string | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.title.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.title.md new file mode 100644 index 000000000000..71fa13ad4a5d --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) > [title](./kibana-plugin-public.savedobjectsimporterror.title.md) + +## SavedObjectsImportError.title property + +Signature: + +```typescript +title?: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.type.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.type.md new file mode 100644 index 000000000000..fe98dc928e5f --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimporterror.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) > [type](./kibana-plugin-public.savedobjectsimporterror.type.md) + +## SavedObjectsImportError.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.blocking.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.blocking.md new file mode 100644 index 000000000000..76bd6e0939a9 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.blocking.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) > [blocking](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.blocking.md) + +## SavedObjectsImportMissingReferencesError.blocking property + +Signature: + +```typescript +blocking: Array<{ + type: string; + id: string; + }>; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.md new file mode 100644 index 000000000000..58af9e9be0cc --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) + +## SavedObjectsImportMissingReferencesError interface + +Represents a failure to import due to missing references. + +Signature: + +```typescript +export interface SavedObjectsImportMissingReferencesError +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [blocking](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.blocking.md) | Array<{
type: string;
id: string;
}> | | +| [references](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.references.md) | Array<{
type: string;
id: string;
}> | | +| [type](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.type.md) | 'missing_references' | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.references.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.references.md new file mode 100644 index 000000000000..f1dc3b454f7e --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.references.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) > [references](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.references.md) + +## SavedObjectsImportMissingReferencesError.references property + +Signature: + +```typescript +references: Array<{ + type: string; + id: string; + }>; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.type.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.type.md new file mode 100644 index 000000000000..340b36248d83 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportmissingreferenceserror.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) > [type](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.type.md) + +## SavedObjectsImportMissingReferencesError.type property + +Signature: + +```typescript +type: 'missing_references'; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.errors.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.errors.md new file mode 100644 index 000000000000..c085fd0f8c3b --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.errors.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) > [errors](./kibana-plugin-public.savedobjectsimportresponse.errors.md) + +## SavedObjectsImportResponse.errors property + +Signature: + +```typescript +errors?: SavedObjectsImportError[]; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.md new file mode 100644 index 000000000000..9733f11fd6b8 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) + +## SavedObjectsImportResponse interface + +The response describing the result of an import. + +Signature: + +```typescript +export interface SavedObjectsImportResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [errors](./kibana-plugin-public.savedobjectsimportresponse.errors.md) | SavedObjectsImportError[] | | +| [success](./kibana-plugin-public.savedobjectsimportresponse.success.md) | boolean | | +| [successCount](./kibana-plugin-public.savedobjectsimportresponse.successcount.md) | number | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.success.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.success.md new file mode 100644 index 000000000000..062b8ce3f7c7 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.success.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) > [success](./kibana-plugin-public.savedobjectsimportresponse.success.md) + +## SavedObjectsImportResponse.success property + +Signature: + +```typescript +success: boolean; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.successcount.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.successcount.md new file mode 100644 index 000000000000..c2c938592617 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportresponse.successcount.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) > [successCount](./kibana-plugin-public.savedobjectsimportresponse.successcount.md) + +## SavedObjectsImportResponse.successCount property + +Signature: + +```typescript +successCount: number; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.id.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.id.md new file mode 100644 index 000000000000..2569152f17b1 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) > [id](./kibana-plugin-public.savedobjectsimportretry.id.md) + +## SavedObjectsImportRetry.id property + +Signature: + +```typescript +id: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.md new file mode 100644 index 000000000000..e2cad52f92f2 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) + +## SavedObjectsImportRetry interface + +Describes a retry operation for importing a saved object. + +Signature: + +```typescript +export interface SavedObjectsImportRetry +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [id](./kibana-plugin-public.savedobjectsimportretry.id.md) | string | | +| [overwrite](./kibana-plugin-public.savedobjectsimportretry.overwrite.md) | boolean | | +| [replaceReferences](./kibana-plugin-public.savedobjectsimportretry.replacereferences.md) | Array<{
type: string;
from: string;
to: string;
}> | | +| [type](./kibana-plugin-public.savedobjectsimportretry.type.md) | string | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.overwrite.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.overwrite.md new file mode 100644 index 000000000000..9d1f96b2fcfc --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.overwrite.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) > [overwrite](./kibana-plugin-public.savedobjectsimportretry.overwrite.md) + +## SavedObjectsImportRetry.overwrite property + +Signature: + +```typescript +overwrite: boolean; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.replacereferences.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.replacereferences.md new file mode 100644 index 000000000000..fe587ef8134c --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.replacereferences.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) > [replaceReferences](./kibana-plugin-public.savedobjectsimportretry.replacereferences.md) + +## SavedObjectsImportRetry.replaceReferences property + +Signature: + +```typescript +replaceReferences: Array<{ + type: string; + from: string; + to: string; + }>; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.type.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.type.md new file mode 100644 index 000000000000..b84dac102483 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportretry.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) > [type](./kibana-plugin-public.savedobjectsimportretry.type.md) + +## SavedObjectsImportRetry.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.md new file mode 100644 index 000000000000..e68375717178 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) + +## SavedObjectsImportUnknownError interface + +Represents a failure to import due to an unknown reason. + +Signature: + +```typescript +export interface SavedObjectsImportUnknownError +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [message](./kibana-plugin-public.savedobjectsimportunknownerror.message.md) | string | | +| [statusCode](./kibana-plugin-public.savedobjectsimportunknownerror.statuscode.md) | number | | +| [type](./kibana-plugin-public.savedobjectsimportunknownerror.type.md) | 'unknown' | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.message.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.message.md new file mode 100644 index 000000000000..976c2817bda0 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.message.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) > [message](./kibana-plugin-public.savedobjectsimportunknownerror.message.md) + +## SavedObjectsImportUnknownError.message property + +Signature: + +```typescript +message: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.statuscode.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.statuscode.md new file mode 100644 index 000000000000..6c7255dd4b63 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.statuscode.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) > [statusCode](./kibana-plugin-public.savedobjectsimportunknownerror.statuscode.md) + +## SavedObjectsImportUnknownError.statusCode property + +Signature: + +```typescript +statusCode: number; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.type.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.type.md new file mode 100644 index 000000000000..2ef764d68322 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunknownerror.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) > [type](./kibana-plugin-public.savedobjectsimportunknownerror.type.md) + +## SavedObjectsImportUnknownError.type property + +Signature: + +```typescript +type: 'unknown'; +``` diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md new file mode 100644 index 000000000000..09ae53c03135 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportUnsupportedTypeError](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md) + +## SavedObjectsImportUnsupportedTypeError interface + +Represents a failure to import due to having an unsupported saved object type. + +Signature: + +```typescript +export interface SavedObjectsImportUnsupportedTypeError +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [type](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.type.md) | 'unsupported_type' | | + diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsimportunsupportedtypeerror.type.md b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunsupportedtypeerror.type.md new file mode 100644 index 000000000000..55ddf15058fa --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.savedobjectsimportunsupportedtypeerror.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [SavedObjectsImportUnsupportedTypeError](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md) > [type](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.type.md) + +## SavedObjectsImportUnsupportedTypeError.type property + +Signature: + +```typescript +type: 'unsupported_type'; +``` diff --git a/docs/development/core/server/kibana-plugin-server.basepath.md b/docs/development/core/server/kibana-plugin-server.basepath.md index 77f50abc6036..50a30f7c43fe 100644 --- a/docs/development/core/server/kibana-plugin-server.basepath.md +++ b/docs/development/core/server/kibana-plugin-server.basepath.md @@ -12,6 +12,10 @@ Access or manipulate the Kibana base path export declare class BasePath ``` +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BasePath` class. + ## Properties | Property | Modifiers | Type | Description | @@ -22,7 +26,3 @@ export declare class BasePath | [serverBasePath](./kibana-plugin-server.basepath.serverbasepath.md) | | string | returns the server's basePathSee [BasePath.get](./kibana-plugin-server.basepath.get.md) for getting the basePath value for a specific request | | [set](./kibana-plugin-server.basepath.set.md) | | (request: KibanaRequest<unknown, unknown, unknown, any> | LegacyRequest, requestSpecificBasePath: string) => void | sets basePath value, specific for an incoming request. | -## Remarks - -The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BasePath` class. - diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecation.md b/docs/development/core/server/kibana-plugin-server.configdeprecation.md new file mode 100644 index 000000000000..ba7e40b8dc62 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecation.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) + +## ConfigDeprecation type + +Configuration deprecation returned from [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) that handles a single deprecation from the configuration. + +Signature: + +```typescript +export declare type ConfigDeprecation = (config: Record, fromPath: string, logger: ConfigDeprecationLogger) => Record; +``` + +## Remarks + +This should only be manually implemented if [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) does not provide the proper helpers for a specific deprecation need. + diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md new file mode 100644 index 000000000000..0302797147cf --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md @@ -0,0 +1,36 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) + +## ConfigDeprecationFactory interface + +Provides helpers to generates the most commonly used [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) when invoking a [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md). + +See methods documentation for more detailed examples. + +Signature: + +```typescript +export interface ConfigDeprecationFactory +``` + +## Example + + +```typescript +const provider: ConfigDeprecationProvider = ({ rename, unused }) => [ + rename('oldKey', 'newKey'), + unused('deprecatedKey'), +] + +``` + +## Methods + +| Method | Description | +| --- | --- | +| [rename(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.rename.md) | Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. | +| [renameFromRoot(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.renamefromroot.md) | Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied.This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. | +| [unused(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unused.md) | Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. | +| [unusedFromRoot(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unusedfromroot.md) | Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied.This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. | + diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.rename.md b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.rename.md new file mode 100644 index 000000000000..5bbbad763c54 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.rename.md @@ -0,0 +1,36 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [rename](./kibana-plugin-server.configdeprecationfactory.rename.md) + +## ConfigDeprecationFactory.rename() method + +Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. + +Signature: + +```typescript +rename(oldKey: string, newKey: string): ConfigDeprecation; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| oldKey | string | | +| newKey | string | | + +Returns: + +`ConfigDeprecation` + +## Example + +Rename 'myplugin.oldKey' to 'myplugin.newKey' + +```typescript +const provider: ConfigDeprecationProvider = ({ rename }) => [ + rename('oldKey', 'newKey'), +] + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.renamefromroot.md b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.renamefromroot.md new file mode 100644 index 000000000000..d35ba25256fa --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.renamefromroot.md @@ -0,0 +1,38 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [renameFromRoot](./kibana-plugin-server.configdeprecationfactory.renamefromroot.md) + +## ConfigDeprecationFactory.renameFromRoot() method + +Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied. + +This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. + +Signature: + +```typescript +renameFromRoot(oldKey: string, newKey: string): ConfigDeprecation; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| oldKey | string | | +| newKey | string | | + +Returns: + +`ConfigDeprecation` + +## Example + +Rename 'oldplugin.key' to 'newplugin.key' + +```typescript +const provider: ConfigDeprecationProvider = ({ renameFromRoot }) => [ + renameFromRoot('oldplugin.key', 'newplugin.key'), +] + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.unused.md b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.unused.md new file mode 100644 index 000000000000..0381480e84c4 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.unused.md @@ -0,0 +1,35 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [unused](./kibana-plugin-server.configdeprecationfactory.unused.md) + +## ConfigDeprecationFactory.unused() method + +Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. + +Signature: + +```typescript +unused(unusedKey: string): ConfigDeprecation; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| unusedKey | string | | + +Returns: + +`ConfigDeprecation` + +## Example + +Flags 'myplugin.deprecatedKey' as unused + +```typescript +const provider: ConfigDeprecationProvider = ({ unused }) => [ + unused('deprecatedKey'), +] + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.unusedfromroot.md b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.unusedfromroot.md new file mode 100644 index 000000000000..ed37638b0737 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.unusedfromroot.md @@ -0,0 +1,37 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [unusedFromRoot](./kibana-plugin-server.configdeprecationfactory.unusedfromroot.md) + +## ConfigDeprecationFactory.unusedFromRoot() method + +Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied. + +This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. + +Signature: + +```typescript +unusedFromRoot(unusedKey: string): ConfigDeprecation; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| unusedKey | string | | + +Returns: + +`ConfigDeprecation` + +## Example + +Flags 'somepath.deprecatedProperty' as unused + +```typescript +const provider: ConfigDeprecationProvider = ({ unusedFromRoot }) => [ + unusedFromRoot('somepath.deprecatedProperty'), +] + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationlogger.md b/docs/development/core/server/kibana-plugin-server.configdeprecationlogger.md new file mode 100644 index 000000000000..d2bb2a4e441b --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationlogger.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationLogger](./kibana-plugin-server.configdeprecationlogger.md) + +## ConfigDeprecationLogger type + +Logger interface used when invoking a [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) + +Signature: + +```typescript +export declare type ConfigDeprecationLogger = (message: string) => void; +``` diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationprovider.md b/docs/development/core/server/kibana-plugin-server.configdeprecationprovider.md new file mode 100644 index 000000000000..f5da9e9452bb --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.configdeprecationprovider.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) + +## ConfigDeprecationProvider type + +A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md). + +See [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) for more usage examples. + +Signature: + +```typescript +export declare type ConfigDeprecationProvider = (factory: ConfigDeprecationFactory) => ConfigDeprecation[]; +``` + +## Example + + +```typescript +const provider: ConfigDeprecationProvider = ({ rename, unused }) => [ + rename('oldKey', 'newKey'), + unused('deprecatedKey'), + myCustomDeprecation, +] + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.contextsetup.md b/docs/development/core/server/kibana-plugin-server.contextsetup.md index 1f285efe92b6..1b2a1e2f1b62 100644 --- a/docs/development/core/server/kibana-plugin-server.contextsetup.md +++ b/docs/development/core/server/kibana-plugin-server.contextsetup.md @@ -12,12 +12,6 @@ An object that handles registration of context providers and configuring handler export interface ContextSetup ``` -## Methods - -| Method | Description | -| --- | --- | -| [createContextContainer()](./kibana-plugin-server.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-server.icontextcontainer.md) for a service owner. | - ## Remarks A [IContextContainer](./kibana-plugin-server.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares. @@ -136,3 +130,9 @@ class VizRenderingPlugin { ``` +## Methods + +| Method | Description | +| --- | --- | +| [createContextContainer()](./kibana-plugin-server.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-server.icontextcontainer.md) for a service owner. | + diff --git a/docs/development/core/server/kibana-plugin-server.coresetup.md b/docs/development/core/server/kibana-plugin-server.coresetup.md index 3886b6e05e65..3f7f5b727ee8 100644 --- a/docs/development/core/server/kibana-plugin-server.coresetup.md +++ b/docs/development/core/server/kibana-plugin-server.coresetup.md @@ -22,4 +22,5 @@ export interface CoreSetup | [http](./kibana-plugin-server.coresetup.http.md) | HttpServiceSetup | [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) | | [savedObjects](./kibana-plugin-server.coresetup.savedobjects.md) | SavedObjectsServiceSetup | [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) | | [uiSettings](./kibana-plugin-server.coresetup.uisettings.md) | UiSettingsServiceSetup | [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) | +| [uuid](./kibana-plugin-server.coresetup.uuid.md) | UuidServiceSetup | [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) | diff --git a/docs/development/core/server/kibana-plugin-server.coresetup.uuid.md b/docs/development/core/server/kibana-plugin-server.coresetup.uuid.md new file mode 100644 index 000000000000..2b9077735d8e --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.coresetup.uuid.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CoreSetup](./kibana-plugin-server.coresetup.md) > [uuid](./kibana-plugin-server.coresetup.uuid.md) + +## CoreSetup.uuid property + +[UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) + +Signature: + +```typescript +uuid: UuidServiceSetup; +``` diff --git a/docs/development/core/server/kibana-plugin-server.corestart.md b/docs/development/core/server/kibana-plugin-server.corestart.md index e523717a37ac..167c69d5fe32 100644 --- a/docs/development/core/server/kibana-plugin-server.corestart.md +++ b/docs/development/core/server/kibana-plugin-server.corestart.md @@ -18,4 +18,5 @@ export interface CoreStart | --- | --- | --- | | [capabilities](./kibana-plugin-server.corestart.capabilities.md) | CapabilitiesStart | [CapabilitiesStart](./kibana-plugin-server.capabilitiesstart.md) | | [savedObjects](./kibana-plugin-server.corestart.savedobjects.md) | SavedObjectsServiceStart | [SavedObjectsServiceStart](./kibana-plugin-server.savedobjectsservicestart.md) | +| [uiSettings](./kibana-plugin-server.corestart.uisettings.md) | UiSettingsServiceStart | [UiSettingsServiceStart](./kibana-plugin-server.uisettingsservicestart.md) | diff --git a/docs/development/core/server/kibana-plugin-server.corestart.uisettings.md b/docs/development/core/server/kibana-plugin-server.corestart.uisettings.md new file mode 100644 index 000000000000..323e929f2918 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.corestart.uisettings.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CoreStart](./kibana-plugin-server.corestart.md) > [uiSettings](./kibana-plugin-server.corestart.uisettings.md) + +## CoreStart.uiSettings property + +[UiSettingsServiceStart](./kibana-plugin-server.uisettingsservicestart.md) + +Signature: + +```typescript +uiSettings: UiSettingsServiceStart; +``` diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.default.md b/docs/development/core/server/kibana-plugin-server.cspconfig.default.md new file mode 100644 index 000000000000..56e6cf35cdd1 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.cspconfig.default.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CspConfig](./kibana-plugin-server.cspconfig.md) > [DEFAULT](./kibana-plugin-server.cspconfig.default.md) + +## CspConfig.DEFAULT property + +Signature: + +```typescript +static readonly DEFAULT: CspConfig; +``` diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.header.md b/docs/development/core/server/kibana-plugin-server.cspconfig.header.md new file mode 100644 index 000000000000..e3a3d5d712a4 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.cspconfig.header.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CspConfig](./kibana-plugin-server.cspconfig.md) > [header](./kibana-plugin-server.cspconfig.header.md) + +## CspConfig.header property + +Signature: + +```typescript +readonly header: string; +``` diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.md b/docs/development/core/server/kibana-plugin-server.cspconfig.md new file mode 100644 index 000000000000..7e491cb0df91 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.cspconfig.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CspConfig](./kibana-plugin-server.cspconfig.md) + +## CspConfig class + +CSP configuration for use in Kibana. + +Signature: + +```typescript +export declare class CspConfig implements ICspConfig +``` + +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `CspConfig` class. + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [DEFAULT](./kibana-plugin-server.cspconfig.default.md) | static | CspConfig | | +| [header](./kibana-plugin-server.cspconfig.header.md) | | string | | +| [rules](./kibana-plugin-server.cspconfig.rules.md) | | string[] | | +| [strict](./kibana-plugin-server.cspconfig.strict.md) | | boolean | | +| [warnLegacyBrowsers](./kibana-plugin-server.cspconfig.warnlegacybrowsers.md) | | boolean | | + diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.rules.md b/docs/development/core/server/kibana-plugin-server.cspconfig.rules.md new file mode 100644 index 000000000000..c5270c2375dc --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.cspconfig.rules.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CspConfig](./kibana-plugin-server.cspconfig.md) > [rules](./kibana-plugin-server.cspconfig.rules.md) + +## CspConfig.rules property + +Signature: + +```typescript +readonly rules: string[]; +``` diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.strict.md b/docs/development/core/server/kibana-plugin-server.cspconfig.strict.md new file mode 100644 index 000000000000..3ac48edd374c --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.cspconfig.strict.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CspConfig](./kibana-plugin-server.cspconfig.md) > [strict](./kibana-plugin-server.cspconfig.strict.md) + +## CspConfig.strict property + +Signature: + +```typescript +readonly strict: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.warnlegacybrowsers.md b/docs/development/core/server/kibana-plugin-server.cspconfig.warnlegacybrowsers.md new file mode 100644 index 000000000000..59d661593d94 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.cspconfig.warnlegacybrowsers.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [CspConfig](./kibana-plugin-server.cspconfig.md) > [warnLegacyBrowsers](./kibana-plugin-server.cspconfig.warnlegacybrowsers.md) + +## CspConfig.warnLegacyBrowsers property + +Signature: + +```typescript +readonly warnLegacyBrowsers: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md b/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md index c823da392042..2e615acfeac6 100644 --- a/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md +++ b/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md @@ -12,13 +12,6 @@ Helpers for working with errors returned from the Elasticsearch service.Since th export declare class ElasticsearchErrorHelpers ``` -## Methods - -| Method | Modifiers | Description | -| --- | --- | --- | -| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-server.elasticsearcherrorhelpers.decoratenotauthorizederror.md) | static | | -| [isNotAuthorizedError(error)](./kibana-plugin-server.elasticsearcherrorhelpers.isnotauthorizederror.md) | static | | - ## Example Handle errors @@ -33,3 +26,10 @@ try { ``` +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-server.elasticsearcherrorhelpers.decoratenotauthorizederror.md) | static | | +| [isNotAuthorizedError(error)](./kibana-plugin-server.elasticsearcherrorhelpers.isnotauthorizederror.md) | static | | + diff --git a/docs/development/core/server/kibana-plugin-server.httpservicesetup.csp.md b/docs/development/core/server/kibana-plugin-server.httpservicesetup.csp.md new file mode 100644 index 000000000000..7bf83305613e --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.httpservicesetup.csp.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) > [csp](./kibana-plugin-server.httpservicesetup.csp.md) + +## HttpServiceSetup.csp property + +The CSP config used for Kibana. + +Signature: + +```typescript +csp: ICspConfig; +``` diff --git a/docs/development/core/server/kibana-plugin-server.httpservicesetup.md b/docs/development/core/server/kibana-plugin-server.httpservicesetup.md index 25eebf1c06d0..3b1993841339 100644 --- a/docs/development/core/server/kibana-plugin-server.httpservicesetup.md +++ b/docs/development/core/server/kibana-plugin-server.httpservicesetup.md @@ -12,20 +12,6 @@ Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins d export interface HttpServiceSetup ``` -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [basePath](./kibana-plugin-server.httpservicesetup.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-server.ibasepath.md). | -| [createCookieSessionStorageFactory](./kibana-plugin-server.httpservicesetup.createcookiesessionstoragefactory.md) | <T>(cookieOptions: SessionStorageCookieOptions<T>) => Promise<SessionStorageFactory<T>> | Creates cookie based session storage factory [SessionStorageFactory](./kibana-plugin-server.sessionstoragefactory.md) | -| [createRouter](./kibana-plugin-server.httpservicesetup.createrouter.md) | () => IRouter | Provides ability to declare a handler function for a particular path and HTTP request method. | -| [isTlsEnabled](./kibana-plugin-server.httpservicesetup.istlsenabled.md) | boolean | Flag showing whether a server was configured to use TLS connection. | -| [registerAuth](./kibana-plugin-server.httpservicesetup.registerauth.md) | (handler: AuthenticationHandler) => void | To define custom authentication and/or authorization mechanism for incoming requests. | -| [registerOnPostAuth](./kibana-plugin-server.httpservicesetup.registeronpostauth.md) | (handler: OnPostAuthHandler) => void | To define custom logic to perform for incoming requests. | -| [registerOnPreAuth](./kibana-plugin-server.httpservicesetup.registeronpreauth.md) | (handler: OnPreAuthHandler) => void | To define custom logic to perform for incoming requests. | -| [registerOnPreResponse](./kibana-plugin-server.httpservicesetup.registeronpreresponse.md) | (handler: OnPreResponseHandler) => void | To define custom logic to perform for the server response. | -| [registerRouteHandlerContext](./kibana-plugin-server.httpservicesetup.registerroutehandlercontext.md) | <T extends keyof RequestHandlerContext>(contextName: T, provider: RequestHandlerContextProvider<T>) => RequestHandlerContextContainer | Register a context provider for a route handler. | - ## Example To handle an incoming request in your plugin you should: - Create a `Router` instance. @@ -91,3 +77,18 @@ async (context, request, response) => { ``` +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [basePath](./kibana-plugin-server.httpservicesetup.basepath.md) | IBasePath | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-server.ibasepath.md). | +| [createCookieSessionStorageFactory](./kibana-plugin-server.httpservicesetup.createcookiesessionstoragefactory.md) | <T>(cookieOptions: SessionStorageCookieOptions<T>) => Promise<SessionStorageFactory<T>> | Creates cookie based session storage factory [SessionStorageFactory](./kibana-plugin-server.sessionstoragefactory.md) | +| [createRouter](./kibana-plugin-server.httpservicesetup.createrouter.md) | () => IRouter | Provides ability to declare a handler function for a particular path and HTTP request method. | +| [csp](./kibana-plugin-server.httpservicesetup.csp.md) | ICspConfig | The CSP config used for Kibana. | +| [isTlsEnabled](./kibana-plugin-server.httpservicesetup.istlsenabled.md) | boolean | Flag showing whether a server was configured to use TLS connection. | +| [registerAuth](./kibana-plugin-server.httpservicesetup.registerauth.md) | (handler: AuthenticationHandler) => void | To define custom authentication and/or authorization mechanism for incoming requests. | +| [registerOnPostAuth](./kibana-plugin-server.httpservicesetup.registeronpostauth.md) | (handler: OnPostAuthHandler) => void | To define custom logic to perform for incoming requests. | +| [registerOnPreAuth](./kibana-plugin-server.httpservicesetup.registeronpreauth.md) | (handler: OnPreAuthHandler) => void | To define custom logic to perform for incoming requests. | +| [registerOnPreResponse](./kibana-plugin-server.httpservicesetup.registeronpreresponse.md) | (handler: OnPreResponseHandler) => void | To define custom logic to perform for the server response. | +| [registerRouteHandlerContext](./kibana-plugin-server.httpservicesetup.registerroutehandlercontext.md) | <T extends keyof RequestHandlerContext>(contextName: T, provider: RequestHandlerContextProvider<T>) => RequestHandlerContextContainer | Register a context provider for a route handler. | + diff --git a/docs/development/core/server/kibana-plugin-server.icontextcontainer.md b/docs/development/core/server/kibana-plugin-server.icontextcontainer.md index 114da31442ff..8235c4013153 100644 --- a/docs/development/core/server/kibana-plugin-server.icontextcontainer.md +++ b/docs/development/core/server/kibana-plugin-server.icontextcontainer.md @@ -12,13 +12,6 @@ An object that handles registration of context providers and configuring handler export interface IContextContainer> ``` -## Methods - -| Method | Description | -| --- | --- | -| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-server.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. | -| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-server.icontextcontainer.registercontext.md) | Register a new context provider. | - ## Remarks A [IContextContainer](./kibana-plugin-server.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares. @@ -78,3 +71,10 @@ class MyPlugin { ``` +## Methods + +| Method | Description | +| --- | --- | +| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-server.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. | +| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-server.icontextcontainer.registercontext.md) | Register a new context provider. | + diff --git a/docs/development/core/server/kibana-plugin-server.icspconfig.header.md b/docs/development/core/server/kibana-plugin-server.icspconfig.header.md new file mode 100644 index 000000000000..d757863fdc12 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.icspconfig.header.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ICspConfig](./kibana-plugin-server.icspconfig.md) > [header](./kibana-plugin-server.icspconfig.header.md) + +## ICspConfig.header property + +The CSP rules in a formatted directives string for use in a `Content-Security-Policy` header. + +Signature: + +```typescript +readonly header: string; +``` diff --git a/docs/development/core/server/kibana-plugin-server.icspconfig.md b/docs/development/core/server/kibana-plugin-server.icspconfig.md new file mode 100644 index 000000000000..fb8188386a37 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.icspconfig.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ICspConfig](./kibana-plugin-server.icspconfig.md) + +## ICspConfig interface + +CSP configuration for use in Kibana. + +Signature: + +```typescript +export interface ICspConfig +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [header](./kibana-plugin-server.icspconfig.header.md) | string | The CSP rules in a formatted directives string for use in a Content-Security-Policy header. | +| [rules](./kibana-plugin-server.icspconfig.rules.md) | string[] | The CSP rules used for Kibana. | +| [strict](./kibana-plugin-server.icspconfig.strict.md) | boolean | Specify whether browsers that do not support CSP should be able to use Kibana. Use true to block and false to allow. | +| [warnLegacyBrowsers](./kibana-plugin-server.icspconfig.warnlegacybrowsers.md) | boolean | Specify whether users with legacy browsers should be warned about their lack of Kibana security compliance. | + diff --git a/docs/development/core/server/kibana-plugin-server.icspconfig.rules.md b/docs/development/core/server/kibana-plugin-server.icspconfig.rules.md new file mode 100644 index 000000000000..6216e6d81713 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.icspconfig.rules.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ICspConfig](./kibana-plugin-server.icspconfig.md) > [rules](./kibana-plugin-server.icspconfig.rules.md) + +## ICspConfig.rules property + +The CSP rules used for Kibana. + +Signature: + +```typescript +readonly rules: string[]; +``` diff --git a/docs/development/core/server/kibana-plugin-server.icspconfig.strict.md b/docs/development/core/server/kibana-plugin-server.icspconfig.strict.md new file mode 100644 index 000000000000..4ab97ad9f665 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.icspconfig.strict.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ICspConfig](./kibana-plugin-server.icspconfig.md) > [strict](./kibana-plugin-server.icspconfig.strict.md) + +## ICspConfig.strict property + +Specify whether browsers that do not support CSP should be able to use Kibana. Use `true` to block and `false` to allow. + +Signature: + +```typescript +readonly strict: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-server.icspconfig.warnlegacybrowsers.md b/docs/development/core/server/kibana-plugin-server.icspconfig.warnlegacybrowsers.md new file mode 100644 index 000000000000..aea35f056944 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.icspconfig.warnlegacybrowsers.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ICspConfig](./kibana-plugin-server.icspconfig.md) > [warnLegacyBrowsers](./kibana-plugin-server.icspconfig.warnlegacybrowsers.md) + +## ICspConfig.warnLegacyBrowsers property + +Specify whether users with legacy browsers should be warned about their lack of Kibana security compliance. + +Signature: + +```typescript +readonly warnLegacyBrowsers: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-server.irenderoptions.includeusersettings.md b/docs/development/core/server/kibana-plugin-server.irenderoptions.includeusersettings.md new file mode 100644 index 000000000000..cedf3d27d088 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.irenderoptions.includeusersettings.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [IRenderOptions](./kibana-plugin-server.irenderoptions.md) > [includeUserSettings](./kibana-plugin-server.irenderoptions.includeusersettings.md) + +## IRenderOptions.includeUserSettings property + +Set whether to output user settings in the page metadata. `true` by default. + +Signature: + +```typescript +includeUserSettings?: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-server.irenderoptions.md b/docs/development/core/server/kibana-plugin-server.irenderoptions.md new file mode 100644 index 000000000000..34bed8b5e078 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.irenderoptions.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [IRenderOptions](./kibana-plugin-server.irenderoptions.md) + +## IRenderOptions interface + + +Signature: + +```typescript +export interface IRenderOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [includeUserSettings](./kibana-plugin-server.irenderoptions.includeusersettings.md) | boolean | Set whether to output user settings in the page metadata. true by default. | + diff --git a/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md b/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md index 236742006806..ff71f13466cf 100644 --- a/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md +++ b/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md @@ -9,5 +9,5 @@ Wrap a router handler to catch and converts legacy boom errors to proper custom Signature: ```typescript -handleLegacyErrors:

(handler: RequestHandler) => RequestHandler; +handleLegacyErrors: (handler: RequestHandler) => RequestHandler; ``` diff --git a/docs/development/core/server/kibana-plugin-server.irouter.md b/docs/development/core/server/kibana-plugin-server.irouter.md index 73e96191e02e..a6536d2ed676 100644 --- a/docs/development/core/server/kibana-plugin-server.irouter.md +++ b/docs/development/core/server/kibana-plugin-server.irouter.md @@ -18,7 +18,7 @@ export interface IRouter | --- | --- | --- | | [delete](./kibana-plugin-server.irouter.delete.md) | RouteRegistrar<'delete'> | Register a route handler for DELETE request. | | [get](./kibana-plugin-server.irouter.get.md) | RouteRegistrar<'get'> | Register a route handler for GET request. | -| [handleLegacyErrors](./kibana-plugin-server.irouter.handlelegacyerrors.md) | <P extends ObjectType, Q extends ObjectType, B extends ObjectType>(handler: RequestHandler<P, Q, B>) => RequestHandler<P, Q, B> | Wrap a router handler to catch and converts legacy boom errors to proper custom errors. | +| [handleLegacyErrors](./kibana-plugin-server.irouter.handlelegacyerrors.md) | <P, Q, B>(handler: RequestHandler<P, Q, B>) => RequestHandler<P, Q, B> | Wrap a router handler to catch and converts legacy boom errors to proper custom errors. | | [patch](./kibana-plugin-server.irouter.patch.md) | RouteRegistrar<'patch'> | Register a route handler for PATCH request. | | [post](./kibana-plugin-server.irouter.post.md) | RouteRegistrar<'post'> | Register a route handler for POST request. | | [put](./kibana-plugin-server.irouter.put.md) | RouteRegistrar<'put'> | Register a route handler for PUT request. | diff --git a/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.md b/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.md new file mode 100644 index 000000000000..2e6daa58db25 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [IScopedRenderingClient](./kibana-plugin-server.iscopedrenderingclient.md) + +## IScopedRenderingClient interface + + +Signature: + +```typescript +export interface IScopedRenderingClient +``` + +## Methods + +| Method | Description | +| --- | --- | +| [render(options)](./kibana-plugin-server.iscopedrenderingclient.render.md) | Generate a KibanaResponse which renders an HTML page bootstrapped with the core bundle. Intended as a response body for HTTP route handlers. | + diff --git a/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.render.md b/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.render.md new file mode 100644 index 000000000000..1bc78dd84571 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.render.md @@ -0,0 +1,41 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [IScopedRenderingClient](./kibana-plugin-server.iscopedrenderingclient.md) > [render](./kibana-plugin-server.iscopedrenderingclient.render.md) + +## IScopedRenderingClient.render() method + +Generate a `KibanaResponse` which renders an HTML page bootstrapped with the `core` bundle. Intended as a response body for HTTP route handlers. + +Signature: + +```typescript +render(options?: IRenderOptions): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| options | IRenderOptions | | + +Returns: + +`Promise` + +## Example + + +```ts +router.get( + { path: '/', validate: false }, + (context, request, response) => + response.ok({ + body: await context.core.rendering.render(), + headers: { + 'content-security-policy': context.core.http.csp.header, + }, + }) +); + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.core.md b/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.core.md index 09ebf1170715..c4c043a903d0 100644 --- a/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.core.md +++ b/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.core.md @@ -7,7 +7,5 @@ Signature: ```typescript -core: InternalCoreSetup & { - plugins: PluginsServiceSetup; - }; +core: LegacyCoreSetup; ``` diff --git a/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.md b/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.md index 4475318522df..7961cedd2c05 100644 --- a/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.md +++ b/docs/development/core/server/kibana-plugin-server.legacyservicesetupdeps.md @@ -18,6 +18,6 @@ export interface LegacyServiceSetupDeps | Property | Type | Description | | --- | --- | --- | -| [core](./kibana-plugin-server.legacyservicesetupdeps.core.md) | InternalCoreSetup & {
plugins: PluginsServiceSetup;
} | | +| [core](./kibana-plugin-server.legacyservicesetupdeps.core.md) | LegacyCoreSetup | | | [plugins](./kibana-plugin-server.legacyservicesetupdeps.plugins.md) | Record<string, unknown> | | diff --git a/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.core.md b/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.core.md index c5cf473aaa01..47018f459496 100644 --- a/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.core.md +++ b/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.core.md @@ -7,7 +7,5 @@ Signature: ```typescript -core: InternalCoreStart & { - plugins: PluginsServiceStart; - }; +core: LegacyCoreStart; ``` diff --git a/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.md b/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.md index 801138b64e46..602fe5356d52 100644 --- a/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.md +++ b/docs/development/core/server/kibana-plugin-server.legacyservicestartdeps.md @@ -18,6 +18,6 @@ export interface LegacyServiceStartDeps | Property | Type | Description | | --- | --- | --- | -| [core](./kibana-plugin-server.legacyservicestartdeps.core.md) | InternalCoreStart & {
plugins: PluginsServiceStart;
} | | +| [core](./kibana-plugin-server.legacyservicestartdeps.core.md) | LegacyCoreStart | | | [plugins](./kibana-plugin-server.legacyservicestartdeps.plugins.md) | Record<string, unknown> | | diff --git a/docs/development/core/server/kibana-plugin-server.logger.get.md b/docs/development/core/server/kibana-plugin-server.logger.get.md new file mode 100644 index 000000000000..b4a2d8a12426 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.logger.get.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [Logger](./kibana-plugin-server.logger.md) > [get](./kibana-plugin-server.logger.get.md) + +## Logger.get() method + +Returns a new [Logger](./kibana-plugin-server.logger.md) instance extending the current logger context. + +Signature: + +```typescript +get(...childContextPaths: string[]): Logger; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| childContextPaths | string[] | | + +Returns: + +`Logger` + +## Example + + +```typescript +const logger = loggerFactory.get('plugin', 'service'); // 'plugin.service' context +const subLogger = logger.get('feature'); // 'plugin.service.feature' context + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.logger.md b/docs/development/core/server/kibana-plugin-server.logger.md index 96f327a79848..068f51f409f0 100644 --- a/docs/development/core/server/kibana-plugin-server.logger.md +++ b/docs/development/core/server/kibana-plugin-server.logger.md @@ -19,6 +19,7 @@ export interface Logger | [debug(message, meta)](./kibana-plugin-server.logger.debug.md) | Log messages useful for debugging and interactive investigation | | [error(errorOrMessage, meta)](./kibana-plugin-server.logger.error.md) | Logs abnormal or unexpected errors or messages that caused a failure in the application flow | | [fatal(errorOrMessage, meta)](./kibana-plugin-server.logger.fatal.md) | Logs abnormal or unexpected errors or messages that caused an unrecoverable failure | +| [get(childContextPaths)](./kibana-plugin-server.logger.get.md) | Returns a new [Logger](./kibana-plugin-server.logger.md) instance extending the current logger context. | | [info(message, meta)](./kibana-plugin-server.logger.info.md) | Logs messages related to general application flow | | [trace(message, meta)](./kibana-plugin-server.logger.trace.md) | Log messages at the most detailed log level | | [warn(errorOrMessage, meta)](./kibana-plugin-server.logger.warn.md) | Logs abnormal or unexpected errors or messages | diff --git a/docs/development/core/server/kibana-plugin-server.md b/docs/development/core/server/kibana-plugin-server.md index fceabd123766..5e7f84c55244 100644 --- a/docs/development/core/server/kibana-plugin-server.md +++ b/docs/development/core/server/kibana-plugin-server.md @@ -18,8 +18,10 @@ The plugin integrates with the core system via lifecycle events: `setup` | --- | --- | | [BasePath](./kibana-plugin-server.basepath.md) | Access or manipulate the Kibana base path | | [ClusterClient](./kibana-plugin-server.clusterclient.md) | Represents an Elasticsearch cluster API client and allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via asScoped(...)).See [ClusterClient](./kibana-plugin-server.clusterclient.md). | +| [CspConfig](./kibana-plugin-server.cspconfig.md) | CSP configuration for use in Kibana. | | [ElasticsearchErrorHelpers](./kibana-plugin-server.elasticsearcherrorhelpers.md) | Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as body.error.header[WWW-Authenticate] | | [KibanaRequest](./kibana-plugin-server.kibanarequest.md) | Kibana specific abstraction for an incoming request. | +| [RouteValidationError](./kibana-plugin-server.routevalidationerror.md) | Error to return when the validation is not successful. | | [SavedObjectsClient](./kibana-plugin-server.savedobjectsclient.md) | | | [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) | | | [SavedObjectsRepository](./kibana-plugin-server.savedobjectsrepository.md) | | @@ -46,6 +48,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [Capabilities](./kibana-plugin-server.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. | | [CapabilitiesSetup](./kibana-plugin-server.capabilitiessetup.md) | APIs to manage the [Capabilities](./kibana-plugin-server.capabilities.md) that will be used by the application.Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the registerProvider method.Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the registerSwitcher method.Refers to the methods documentation for complete description and examples. | | [CapabilitiesStart](./kibana-plugin-server.capabilitiesstart.md) | APIs to access the application [Capabilities](./kibana-plugin-server.capabilities.md). | +| [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) | Provides helpers to generates the most commonly used [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) when invoking a [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md).See methods documentation for more detailed examples. | | [ContextSetup](./kibana-plugin-server.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. | | [CoreSetup](./kibana-plugin-server.coresetup.md) | Context passed to the plugins setup method. | | [CoreStart](./kibana-plugin-server.corestart.md) | Context passed to the plugins start method. | @@ -63,10 +66,13 @@ The plugin integrates with the core system via lifecycle events: `setup` | [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) | Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins don't have direct access to hapi server and its primitives anymore. Moreover, plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood. This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins. If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs. | | [HttpServiceStart](./kibana-plugin-server.httpservicestart.md) | | | [IContextContainer](./kibana-plugin-server.icontextcontainer.md) | An object that handles registration of context providers and configuring handlers with context. | +| [ICspConfig](./kibana-plugin-server.icspconfig.md) | CSP configuration for use in Kibana. | | [IKibanaResponse](./kibana-plugin-server.ikibanaresponse.md) | A response data object, expected to returned as a result of [RequestHandler](./kibana-plugin-server.requesthandler.md) execution | | [IKibanaSocket](./kibana-plugin-server.ikibanasocket.md) | A tiny abstraction for TCP socket. | | [IndexSettingsDeprecationInfo](./kibana-plugin-server.indexsettingsdeprecationinfo.md) | | +| [IRenderOptions](./kibana-plugin-server.irenderoptions.md) | | | [IRouter](./kibana-plugin-server.irouter.md) | Registers route handlers for specified resource path and method. See [RouteConfig](./kibana-plugin-server.routeconfig.md) and [RequestHandler](./kibana-plugin-server.requesthandler.md) for more information about arguments to route registrations. | +| [IScopedRenderingClient](./kibana-plugin-server.iscopedrenderingclient.md) | | | [IUiSettingsClient](./kibana-plugin-server.iuisettingsclient.md) | Server-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. | | [KibanaRequestRoute](./kibana-plugin-server.kibanarequestroute.md) | Request specific route information exposed to a handler. | | [LegacyRequest](./kibana-plugin-server.legacyrequest.md) | | @@ -82,16 +88,18 @@ The plugin integrates with the core system via lifecycle events: `setup` | [OnPreResponseToolkit](./kibana-plugin-server.onpreresponsetoolkit.md) | A tool set defining an outcome of OnPreAuth interceptor for incoming request. | | [PackageInfo](./kibana-plugin-server.packageinfo.md) | | | [Plugin](./kibana-plugin-server.plugin.md) | The interface that should be returned by a PluginInitializer. | -| [PluginConfigDescriptor](./kibana-plugin-server.pluginconfigdescriptor.md) | Describes a plugin configuration schema and capabilities. | +| [PluginConfigDescriptor](./kibana-plugin-server.pluginconfigdescriptor.md) | Describes a plugin configuration properties. | | [PluginInitializerContext](./kibana-plugin-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. | | [PluginManifest](./kibana-plugin-server.pluginmanifest.md) | Describes the set of required and optional properties plugin can define in its mandatory JSON manifest file. | | [PluginsServiceSetup](./kibana-plugin-server.pluginsservicesetup.md) | | | [PluginsServiceStart](./kibana-plugin-server.pluginsservicestart.md) | | -| [RequestHandlerContext](./kibana-plugin-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.Provides the following clients: - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request | +| [RequestHandlerContext](./kibana-plugin-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.Provides the following clients: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request | | [RouteConfig](./kibana-plugin-server.routeconfig.md) | Route specific configuration. | | [RouteConfigOptions](./kibana-plugin-server.routeconfigoptions.md) | Additional route options. | | [RouteConfigOptionsBody](./kibana-plugin-server.routeconfigoptionsbody.md) | Additional body options for a route | -| [RouteSchemas](./kibana-plugin-server.routeschemas.md) | RouteSchemas contains the schemas for validating the different parts of a request. | +| [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) | Validation result factory to be used in the custom validation function to return the valid data or validation errorsSee [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md). | +| [RouteValidatorConfig](./kibana-plugin-server.routevalidatorconfig.md) | The configuration object to the RouteValidator class. Set params, query and/or body to specify the validation logic to follow for that property. | +| [RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md) | Additional options for the RouteValidator class to modify its default behaviour. | | [SavedObject](./kibana-plugin-server.savedobject.md) | | | [SavedObjectAttributes](./kibana-plugin-server.savedobjectattributes.md) | The data for a Saved Object is stored as an object in the attributes property. | | [SavedObjectReference](./kibana-plugin-server.savedobjectreference.md) | A reference to another saved object. | @@ -134,7 +142,9 @@ The plugin integrates with the core system via lifecycle events: `setup` | [SessionStorageFactory](./kibana-plugin-server.sessionstoragefactory.md) | SessionStorage factory to bind one to an incoming request | | [UiSettingsParams](./kibana-plugin-server.uisettingsparams.md) | UiSettings parameters defined by the plugins. | | [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) | | +| [UiSettingsServiceStart](./kibana-plugin-server.uisettingsservicestart.md) | | | [UserProvidedValues](./kibana-plugin-server.userprovidedvalues.md) | Describes the values explicitly set by user. | +| [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) | APIs to access the application's instance uuid. | ## Variables @@ -152,6 +162,9 @@ The plugin integrates with the core system via lifecycle events: `setup` | [AuthResult](./kibana-plugin-server.authresult.md) | | | [CapabilitiesProvider](./kibana-plugin-server.capabilitiesprovider.md) | See [CapabilitiesSetup](./kibana-plugin-server.capabilitiessetup.md) | | [CapabilitiesSwitcher](./kibana-plugin-server.capabilitiesswitcher.md) | See [CapabilitiesSetup](./kibana-plugin-server.capabilitiessetup.md) | +| [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) | Configuration deprecation returned from [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) that handles a single deprecation from the configuration. | +| [ConfigDeprecationLogger](./kibana-plugin-server.configdeprecationlogger.md) | Logger interface used when invoking a [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) | +| [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) | A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md).See [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) for more usage examples. | | [ConfigPath](./kibana-plugin-server.configpath.md) | | | [ElasticsearchClientConfig](./kibana-plugin-server.elasticsearchclientconfig.md) | | | [GetAuthHeaders](./kibana-plugin-server.getauthheaders.md) | Get headers to authenticate a user against Elasticsearch. | @@ -192,10 +205,14 @@ The plugin integrates with the core system via lifecycle events: `setup` | [RouteContentType](./kibana-plugin-server.routecontenttype.md) | The set of supported parseable Content-Types | | [RouteMethod](./kibana-plugin-server.routemethod.md) | The set of common HTTP methods supported by Kibana routing. | | [RouteRegistrar](./kibana-plugin-server.routeregistrar.md) | Route handler common definition | +| [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md) | The custom validation function if @kbn/config-schema is not a valid solution for your specific plugin requirements. | +| [RouteValidationSpec](./kibana-plugin-server.routevalidationspec.md) | Allowed property validation options: either @kbn/config-schema validations or custom validation functionsSee [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md) for custom validation. | +| [RouteValidatorFullConfig](./kibana-plugin-server.routevalidatorfullconfig.md) | Route validations config and options merged into one object | | [SavedObjectAttribute](./kibana-plugin-server.savedobjectattribute.md) | Type definition for a Saved Object attribute value | | [SavedObjectAttributeSingle](./kibana-plugin-server.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-server.savedobjectattribute.md) | | [SavedObjectsClientContract](./kibana-plugin-server.savedobjectsclientcontract.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state.\#\# SavedObjectsClient errorsSince the SavedObjectsClient has its hands in everything we are a little paranoid about the way we present errors back to to application code. Ideally, all errors will be either:1. Caused by bad implementation (ie. undefined is not a function) and as such unpredictable 2. An error that has been classified and decorated appropriately by the decorators in [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md)Type 1 errors are inevitable, but since all expected/handle-able errors should be Type 2 the isXYZError() helpers exposed at SavedObjectsErrorHelpers should be used to understand and manage error responses from the SavedObjectsClient.Type 2 errors are decorated versions of the source error, so if the elasticsearch client threw an error it will be decorated based on its type. That means that rather than looking for error.body.error.type or doing substring checks on error.body.error.reason, just use the helpers to understand the meaning of the error:\`\`\`js if (SavedObjectsErrorHelpers.isNotFoundError(error)) { // handle 404 }if (SavedObjectsErrorHelpers.isNotAuthorizedError(error)) { // 401 handling should be automatic, but in case you wanted to know }// always rethrow the error unless you handle it throw error; \`\`\`\#\#\# 404s from missing indexFrom the perspective of application code and APIs the SavedObjectsClient is a black box that persists objects. One of the internal details that users have no control over is that we use an elasticsearch index for persistance and that index might be missing.At the time of writing we are in the process of transitioning away from the operating assumption that the SavedObjects index is always available. Part of this transition is handling errors resulting from an index missing. These used to trigger a 500 error in most cases, and in others cause 404s with different error messages.From my (Spencer) perspective, a 404 from the SavedObjectsApi is a 404; The object the request/call was targeting could not be found. This is why \#14141 takes special care to ensure that 404 errors are generic and don't distinguish between index missing or document missing.\#\#\# 503s from missing indexUnlike all other methods, create requests are supposed to succeed even when the Kibana index does not exist because it will be automatically created by elasticsearch. When that is not the case it is because Elasticsearch's action.auto_create_index setting prevents it from being created automatically so we throw a special 503 with the intention of informing the user that their Elasticsearch settings need to be updated.See [SavedObjectsClient](./kibana-plugin-server.savedobjectsclient.md) See [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) | | [SavedObjectsClientFactory](./kibana-plugin-server.savedobjectsclientfactory.md) | Describes the factory used to create instances of the Saved Objects Client. | | [SavedObjectsClientWrapperFactory](./kibana-plugin-server.savedobjectsclientwrapperfactory.md) | Describes the factory used to create instances of Saved Objects Client Wrappers. | +| [SharedGlobalConfig](./kibana-plugin-server.sharedglobalconfig.md) | | | [UiSettingsType](./kibana-plugin-server.uisettingstype.md) | UI element type to represent the settings. | diff --git a/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.deprecations.md b/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.deprecations.md new file mode 100644 index 000000000000..00574101838f --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.deprecations.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [PluginConfigDescriptor](./kibana-plugin-server.pluginconfigdescriptor.md) > [deprecations](./kibana-plugin-server.pluginconfigdescriptor.deprecations.md) + +## PluginConfigDescriptor.deprecations property + +Provider for the [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) to apply to the plugin configuration. + +Signature: + +```typescript +deprecations?: ConfigDeprecationProvider; +``` diff --git a/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md b/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md index 41fdcfe5df45..3d661ac66d2b 100644 --- a/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md +++ b/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md @@ -4,7 +4,7 @@ ## PluginConfigDescriptor interface -Describes a plugin configuration schema and capabilities. +Describes a plugin configuration properties. Signature: @@ -12,13 +12,6 @@ Describes a plugin configuration schema and capabilities. export interface PluginConfigDescriptor ``` -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [exposeToBrowser](./kibana-plugin-server.pluginconfigdescriptor.exposetobrowser.md) | {
[P in keyof T]?: boolean;
} | List of configuration properties that will be available on the client-side plugin. | -| [schema](./kibana-plugin-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-server.pluginconfigschema.md) | - ## Example @@ -39,7 +32,19 @@ export const config: PluginConfigDescriptor = { uiProp: true, }, schema: configSchema, + deprecations: ({ rename, unused }) => [ + rename('securityKey', 'secret'), + unused('deprecatedProperty'), + ], }; ``` +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [deprecations](./kibana-plugin-server.pluginconfigdescriptor.deprecations.md) | ConfigDeprecationProvider | Provider for the [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) to apply to the plugin configuration. | +| [exposeToBrowser](./kibana-plugin-server.pluginconfigdescriptor.exposetobrowser.md) | {
[P in keyof T]?: boolean;
} | List of configuration properties that will be available on the client-side plugin. | +| [schema](./kibana-plugin-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-server.pluginconfigschema.md) | + diff --git a/docs/development/core/server/kibana-plugin-server.pluginmanifest.md b/docs/development/core/server/kibana-plugin-server.pluginmanifest.md index 4a9498f0e9fa..9bb208a809b2 100644 --- a/docs/development/core/server/kibana-plugin-server.pluginmanifest.md +++ b/docs/development/core/server/kibana-plugin-server.pluginmanifest.md @@ -12,6 +12,10 @@ Describes the set of required and optional properties plugin can define in its m export interface PluginManifest ``` +## Remarks + +Should never be used in code outside of Core but is exported for documentation purposes. + ## Properties | Property | Type | Description | @@ -25,7 +29,3 @@ export interface PluginManifest | [ui](./kibana-plugin-server.pluginmanifest.ui.md) | boolean | Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via public/ui_plugin.js file. | | [version](./kibana-plugin-server.pluginmanifest.version.md) | string | Version of the plugin. | -## Remarks - -Should never be used in code outside of Core but is exported for documentation purposes. - diff --git a/docs/development/core/server/kibana-plugin-server.requesthandler.md b/docs/development/core/server/kibana-plugin-server.requesthandler.md index 79abfd4293e9..9fc183ffc334 100644 --- a/docs/development/core/server/kibana-plugin-server.requesthandler.md +++ b/docs/development/core/server/kibana-plugin-server.requesthandler.md @@ -9,7 +9,7 @@ A function executed when route path matched requested resource path. Request han Signature: ```typescript -export declare type RequestHandler

| Type, Method extends RouteMethod = any> = (context: RequestHandlerContext, request: KibanaRequest, TypeOf, TypeOf, Method>, response: KibanaResponseFactory) => IKibanaResponse | Promise>; +export declare type RequestHandler

= (context: RequestHandlerContext, request: KibanaRequest, response: KibanaResponseFactory) => IKibanaResponse | Promise>; ``` ## Example diff --git a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md index 2d8b27ecb6c6..d1760dafd5bb 100644 --- a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md +++ b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md @@ -8,6 +8,7 @@ ```typescript core: { + rendering: IScopedRenderingClient; savedObjects: { client: SavedObjectsClientContract; }; diff --git a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md index c9fc80596efa..7c8625a5824e 100644 --- a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md +++ b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md @@ -6,7 +6,7 @@ Plugin specific context passed to a route handler. -Provides the following clients: - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request +Provides the following clients: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request Signature: @@ -18,5 +18,5 @@ export interface RequestHandlerContext | Property | Type | Description | | --- | --- | --- | -| [core](./kibana-plugin-server.requesthandlercontext.core.md) | {
savedObjects: {
client: SavedObjectsClientContract;
};
elasticsearch: {
dataClient: IScopedClusterClient;
adminClient: IScopedClusterClient;
};
uiSettings: {
client: IUiSettingsClient;
};
} | | +| [core](./kibana-plugin-server.requesthandlercontext.core.md) | {
rendering: IScopedRenderingClient;
savedObjects: {
client: SavedObjectsClientContract;
};
elasticsearch: {
dataClient: IScopedClusterClient;
adminClient: IScopedClusterClient;
};
uiSettings: {
client: IUiSettingsClient;
};
} | | diff --git a/docs/development/core/server/kibana-plugin-server.routeconfig.md b/docs/development/core/server/kibana-plugin-server.routeconfig.md index 1970b23c7ec0..4beb12f0d056 100644 --- a/docs/development/core/server/kibana-plugin-server.routeconfig.md +++ b/docs/development/core/server/kibana-plugin-server.routeconfig.md @@ -9,7 +9,7 @@ Route specific configuration. Signature: ```typescript -export interface RouteConfig

| Type, Method extends RouteMethod> +export interface RouteConfig ``` ## Properties @@ -18,5 +18,5 @@ export interface RouteConfig

RouteConfigOptions<Method> | Additional route options [RouteConfigOptions](./kibana-plugin-server.routeconfigoptions.md). | | [path](./kibana-plugin-server.routeconfig.path.md) | string | The endpoint \_within\_ the router path to register the route. | -| [validate](./kibana-plugin-server.routeconfig.validate.md) | RouteSchemas<P, Q, B> | false | A schema created with @kbn/config-schema that every request will be validated against. | +| [validate](./kibana-plugin-server.routeconfig.validate.md) | RouteValidatorFullConfig<P, Q, B> | false | A schema created with @kbn/config-schema that every request will be validated against. | diff --git a/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md b/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md index e1ec743ae71c..23a72fc3c68b 100644 --- a/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md +++ b/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md @@ -9,7 +9,7 @@ A schema created with `@kbn/config-schema` that every request will be validated Signature: ```typescript -validate: RouteSchemas | false; +validate: RouteValidatorFullConfig | false; ``` ## Remarks diff --git a/docs/development/core/server/kibana-plugin-server.routeregistrar.md b/docs/development/core/server/kibana-plugin-server.routeregistrar.md index 0f5f49636fdd..901d260fee21 100644 --- a/docs/development/core/server/kibana-plugin-server.routeregistrar.md +++ b/docs/development/core/server/kibana-plugin-server.routeregistrar.md @@ -9,5 +9,5 @@ Route handler common definition Signature: ```typescript -export declare type RouteRegistrar =

| Type>(route: RouteConfig, handler: RequestHandler) => void; +export declare type RouteRegistrar = (route: RouteConfig, handler: RequestHandler) => void; ``` diff --git a/docs/development/core/server/kibana-plugin-server.routeschemas.body.md b/docs/development/core/server/kibana-plugin-server.routeschemas.body.md deleted file mode 100644 index 78a9d25c25d9..000000000000 --- a/docs/development/core/server/kibana-plugin-server.routeschemas.body.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteSchemas](./kibana-plugin-server.routeschemas.md) > [body](./kibana-plugin-server.routeschemas.body.md) - -## RouteSchemas.body property - -Signature: - -```typescript -body?: B; -``` diff --git a/docs/development/core/server/kibana-plugin-server.routeschemas.md b/docs/development/core/server/kibana-plugin-server.routeschemas.md deleted file mode 100644 index 77b980551a8f..000000000000 --- a/docs/development/core/server/kibana-plugin-server.routeschemas.md +++ /dev/null @@ -1,22 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteSchemas](./kibana-plugin-server.routeschemas.md) - -## RouteSchemas interface - -RouteSchemas contains the schemas for validating the different parts of a request. - -Signature: - -```typescript -export interface RouteSchemas

| Type> -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [body](./kibana-plugin-server.routeschemas.body.md) | B | | -| [params](./kibana-plugin-server.routeschemas.params.md) | P | | -| [query](./kibana-plugin-server.routeschemas.query.md) | Q | | - diff --git a/docs/development/core/server/kibana-plugin-server.routeschemas.params.md b/docs/development/core/server/kibana-plugin-server.routeschemas.params.md deleted file mode 100644 index 3dbf9fed94dc..000000000000 --- a/docs/development/core/server/kibana-plugin-server.routeschemas.params.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteSchemas](./kibana-plugin-server.routeschemas.md) > [params](./kibana-plugin-server.routeschemas.params.md) - -## RouteSchemas.params property - -Signature: - -```typescript -params?: P; -``` diff --git a/docs/development/core/server/kibana-plugin-server.routeschemas.query.md b/docs/development/core/server/kibana-plugin-server.routeschemas.query.md deleted file mode 100644 index 5be5830cb4bc..000000000000 --- a/docs/development/core/server/kibana-plugin-server.routeschemas.query.md +++ /dev/null @@ -1,11 +0,0 @@ - - -[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteSchemas](./kibana-plugin-server.routeschemas.md) > [query](./kibana-plugin-server.routeschemas.query.md) - -## RouteSchemas.query property - -Signature: - -```typescript -query?: Q; -``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md b/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md new file mode 100644 index 000000000000..551e13faaf15 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationError](./kibana-plugin-server.routevalidationerror.md) > [(constructor)](./kibana-plugin-server.routevalidationerror._constructor_.md) + +## RouteValidationError.(constructor) + +Constructs a new instance of the `RouteValidationError` class + +Signature: + +```typescript +constructor(error: Error | string, path?: string[]); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| error | Error | string | | +| path | string[] | | + diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationerror.md b/docs/development/core/server/kibana-plugin-server.routevalidationerror.md new file mode 100644 index 000000000000..71bd72dca2ea --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationerror.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationError](./kibana-plugin-server.routevalidationerror.md) + +## RouteValidationError class + +Error to return when the validation is not successful. + +Signature: + +```typescript +export declare class RouteValidationError extends SchemaTypeError +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(error, path)](./kibana-plugin-server.routevalidationerror._constructor_.md) | | Constructs a new instance of the RouteValidationError class | + diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationfunction.md b/docs/development/core/server/kibana-plugin-server.routevalidationfunction.md new file mode 100644 index 000000000000..34fa096aaae7 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationfunction.md @@ -0,0 +1,42 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md) + +## RouteValidationFunction type + +The custom validation function if @kbn/config-schema is not a valid solution for your specific plugin requirements. + +Signature: + +```typescript +export declare type RouteValidationFunction = (data: any, validationResult: RouteValidationResultFactory) => { + value: T; + error?: never; +} | { + value?: never; + error: RouteValidationError; +}; +``` + +## Example + +The validation should look something like: + +```typescript +interface MyExpectedBody { + bar: string; + baz: number; +} + +const myBodyValidation: RouteValidationFunction = (data, validationResult) => { + const { ok, badRequest } = validationResult; + const { bar, baz } = data || {}; + if (typeof bar === 'string' && typeof baz === 'number') { + return ok({ bar, baz }); + } else { + return badRequest('Wrong payload', ['body']); + } +} + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md new file mode 100644 index 000000000000..36ea6103fb35 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) > [badRequest](./kibana-plugin-server.routevalidationresultfactory.badrequest.md) + +## RouteValidationResultFactory.badRequest property + +Signature: + +```typescript +badRequest: (error: Error | string, path?: string[]) => { + error: RouteValidationError; + }; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.md b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.md new file mode 100644 index 000000000000..5f44b490e9a1 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) + +## RouteValidationResultFactory interface + +Validation result factory to be used in the custom validation function to return the valid data or validation errors + +See [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md). + +Signature: + +```typescript +export interface RouteValidationResultFactory +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [badRequest](./kibana-plugin-server.routevalidationresultfactory.badrequest.md) | (error: Error | string, path?: string[]) => {
error: RouteValidationError;
} | | +| [ok](./kibana-plugin-server.routevalidationresultfactory.ok.md) | <T>(value: T) => {
value: T;
} | | + diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md new file mode 100644 index 000000000000..eca6a31bd547 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) > [ok](./kibana-plugin-server.routevalidationresultfactory.ok.md) + +## RouteValidationResultFactory.ok property + +Signature: + +```typescript +ok: (value: T) => { + value: T; + }; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationspec.md b/docs/development/core/server/kibana-plugin-server.routevalidationspec.md new file mode 100644 index 000000000000..f5fc06544043 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidationspec.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationSpec](./kibana-plugin-server.routevalidationspec.md) + +## RouteValidationSpec type + +Allowed property validation options: either @kbn/config-schema validations or custom validation functions + +See [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md) for custom validation. + +Signature: + +```typescript +export declare type RouteValidationSpec = ObjectType | Type | RouteValidationFunction; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.body.md b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.body.md new file mode 100644 index 000000000000..8b5d2c041308 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.body.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorConfig](./kibana-plugin-server.routevalidatorconfig.md) > [body](./kibana-plugin-server.routevalidatorconfig.body.md) + +## RouteValidatorConfig.body property + +Validation logic for the body payload + +Signature: + +```typescript +body?: RouteValidationSpec; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.md b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.md new file mode 100644 index 000000000000..4637da7741d8 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorConfig](./kibana-plugin-server.routevalidatorconfig.md) + +## RouteValidatorConfig interface + +The configuration object to the RouteValidator class. Set `params`, `query` and/or `body` to specify the validation logic to follow for that property. + +Signature: + +```typescript +export interface RouteValidatorConfig +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [body](./kibana-plugin-server.routevalidatorconfig.body.md) | RouteValidationSpec<B> | Validation logic for the body payload | +| [params](./kibana-plugin-server.routevalidatorconfig.params.md) | RouteValidationSpec<P> | Validation logic for the URL params | +| [query](./kibana-plugin-server.routevalidatorconfig.query.md) | RouteValidationSpec<Q> | Validation logic for the Query params | + diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.params.md b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.params.md new file mode 100644 index 000000000000..11de25ff3b19 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.params.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorConfig](./kibana-plugin-server.routevalidatorconfig.md) > [params](./kibana-plugin-server.routevalidatorconfig.params.md) + +## RouteValidatorConfig.params property + +Validation logic for the URL params + +Signature: + +```typescript +params?: RouteValidationSpec

; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.query.md b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.query.md new file mode 100644 index 000000000000..510325c2dfff --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatorconfig.query.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorConfig](./kibana-plugin-server.routevalidatorconfig.md) > [query](./kibana-plugin-server.routevalidatorconfig.query.md) + +## RouteValidatorConfig.query property + +Validation logic for the Query params + +Signature: + +```typescript +query?: RouteValidationSpec; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatorfullconfig.md b/docs/development/core/server/kibana-plugin-server.routevalidatorfullconfig.md new file mode 100644 index 000000000000..0f3785b954a3 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatorfullconfig.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorFullConfig](./kibana-plugin-server.routevalidatorfullconfig.md) + +## RouteValidatorFullConfig type + +Route validations config and options merged into one object + +Signature: + +```typescript +export declare type RouteValidatorFullConfig = RouteValidatorConfig & RouteValidatorOptions; +``` diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.md b/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.md new file mode 100644 index 000000000000..00b029d9928e --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md) + +## RouteValidatorOptions interface + +Additional options for the RouteValidator class to modify its default behaviour. + +Signature: + +```typescript +export interface RouteValidatorOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [unsafe](./kibana-plugin-server.routevalidatoroptions.unsafe.md) | {
params?: boolean;
query?: boolean;
body?: boolean;
} | Set the unsafe config to avoid running some additional internal \*safe\* validations on top of your custom validation | + diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md b/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md new file mode 100644 index 000000000000..0406a372c4e9 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md) > [unsafe](./kibana-plugin-server.routevalidatoroptions.unsafe.md) + +## RouteValidatorOptions.unsafe property + +Set the `unsafe` config to avoid running some additional internal \*safe\* validations on top of your custom validation + +Signature: + +```typescript +unsafe?: { + params?: boolean; + query?: boolean; + body?: boolean; + }; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md b/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md index 17d29bb912c8..e68486ecff87 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md @@ -10,6 +10,10 @@ export declare class SavedObjectsClient ``` +## Remarks + +The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class. + ## Properties | Property | Modifiers | Type | Description | @@ -30,7 +34,3 @@ export declare class SavedObjectsClient | [get(type, id, options)](./kibana-plugin-server.savedobjectsclient.get.md) | | Retrieves a single object | | [update(type, id, attributes, options)](./kibana-plugin-server.savedobjectsclient.update.md) | | Updates an SavedObject | -## Remarks - -The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class. - diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md b/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md index dd97b45f590e..95bd817a43da 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md @@ -12,15 +12,6 @@ Saved Objects is Kibana's data persisentence mechanism allowing plugins to use E export interface SavedObjectsServiceSetup ``` -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [addClientWrapper](./kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md) | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory<KibanaRequest>) => void | Add a client wrapper with the given priority. | -| [createInternalRepository](./kibana-plugin-server.savedobjectsservicesetup.createinternalrepository.md) | (extraTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. | -| [createScopedRepository](./kibana-plugin-server.savedobjectsservicesetup.createscopedrepository.md) | (req: KibanaRequest, extraTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. | -| [setClientFactory](./kibana-plugin-server.savedobjectsservicesetup.setclientfactory.md) | (customClientFactory: SavedObjectsClientFactory<KibanaRequest>) => void | Set a default factory for creating Saved Objects clients. Only one client factory can be set, subsequent calls to this method will fail. | - ## Remarks Note: The Saved Object setup API's should only be used for creating and registering client wrappers. Constructing a Saved Objects client or repository for use within your own plugin won't have any of the registered wrappers applied and is considered an anti-pattern. Use the Saved Objects client from the [SavedObjectsServiceStart\#getScopedClient](./kibana-plugin-server.savedobjectsservicestart.md) method or the [route handler context](./kibana-plugin-server.requesthandlercontext.md) instead. @@ -33,3 +24,12 @@ import {SavedObjectsClient, CoreSetup} from 'src/core/server'; export class Plugin() { setup: (core: CoreSetup) => { core.savedObjects.setClientFactory(({request: KibanaRequest}) => { return new SavedObjectsClient(core.savedObjects.scopedRepository(request)); }) } } +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [addClientWrapper](./kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md) | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory<KibanaRequest>) => void | Add a client wrapper with the given priority. | +| [createInternalRepository](./kibana-plugin-server.savedobjectsservicesetup.createinternalrepository.md) | (extraTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. | +| [createScopedRepository](./kibana-plugin-server.savedobjectsservicesetup.createscopedrepository.md) | (req: KibanaRequest, extraTypes?: string[]) => ISavedObjectsRepository | Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. | +| [setClientFactory](./kibana-plugin-server.savedobjectsservicesetup.setclientfactory.md) | (customClientFactory: SavedObjectsClientFactory<KibanaRequest>) => void | Set a default factory for creating Saved Objects clients. Only one client factory can be set, subsequent calls to this method will fail. | + diff --git a/docs/development/core/server/kibana-plugin-server.sharedglobalconfig.md b/docs/development/core/server/kibana-plugin-server.sharedglobalconfig.md new file mode 100644 index 000000000000..418d406d4c89 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.sharedglobalconfig.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SharedGlobalConfig](./kibana-plugin-server.sharedglobalconfig.md) + +## SharedGlobalConfig type + + +Signature: + +```typescript +export declare type SharedGlobalConfig = RecursiveReadonly<{ + kibana: Pick; + elasticsearch: Pick; + path: Pick; +}>; +``` diff --git a/docs/development/core/server/kibana-plugin-server.uisettingsservicesetup.register.md b/docs/development/core/server/kibana-plugin-server.uisettingsservicesetup.register.md index 8091a7cec44a..0047b5275408 100644 --- a/docs/development/core/server/kibana-plugin-server.uisettingsservicesetup.register.md +++ b/docs/development/core/server/kibana-plugin-server.uisettingsservicesetup.register.md @@ -24,5 +24,17 @@ register(settings: Record): void; ## Example -setup(core: CoreSetup){ core.uiSettings.register(\[{ foo: { name: i18n.translate('my foo settings'), value: true, description: 'add some awesomeness', }, }\]); } + +```ts +setup(core: CoreSetup){ + core.uiSettings.register([{ + foo: { + name: i18n.translate('my foo settings'), + value: true, + description: 'add some awesomeness', + }, + }]); +} + +``` diff --git a/docs/development/core/server/kibana-plugin-server.uisettingsservicestart.asscopedtoclient.md b/docs/development/core/server/kibana-plugin-server.uisettingsservicestart.asscopedtoclient.md new file mode 100644 index 000000000000..072dd39faa08 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.uisettingsservicestart.asscopedtoclient.md @@ -0,0 +1,37 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [UiSettingsServiceStart](./kibana-plugin-server.uisettingsservicestart.md) > [asScopedToClient](./kibana-plugin-server.uisettingsservicestart.asscopedtoclient.md) + +## UiSettingsServiceStart.asScopedToClient() method + +Creates a [IUiSettingsClient](./kibana-plugin-server.iuisettingsclient.md) with provided \*scoped\* saved objects client. + +This should only be used in the specific case where the client needs to be accessed from outside of the scope of a [RequestHandler](./kibana-plugin-server.requesthandler.md). + +Signature: + +```typescript +asScopedToClient(savedObjectsClient: SavedObjectsClientContract): IUiSettingsClient; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| savedObjectsClient | SavedObjectsClientContract | | + +Returns: + +`IUiSettingsClient` + +## Example + + +```ts +start(core: CoreStart) { + const soClient = core.savedObjects.getScopedClient(arbitraryRequest); + const uiSettingsClient = core.uiSettings.asScopedToClient(soClient); +} + +``` + diff --git a/docs/development/core/server/kibana-plugin-server.uisettingsservicestart.md b/docs/development/core/server/kibana-plugin-server.uisettingsservicestart.md new file mode 100644 index 000000000000..ee3563552275 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.uisettingsservicestart.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [UiSettingsServiceStart](./kibana-plugin-server.uisettingsservicestart.md) + +## UiSettingsServiceStart interface + + +Signature: + +```typescript +export interface UiSettingsServiceStart +``` + +## Methods + +| Method | Description | +| --- | --- | +| [asScopedToClient(savedObjectsClient)](./kibana-plugin-server.uisettingsservicestart.asscopedtoclient.md) | Creates a [IUiSettingsClient](./kibana-plugin-server.iuisettingsclient.md) with provided \*scoped\* saved objects client.This should only be used in the specific case where the client needs to be accessed from outside of the scope of a [RequestHandler](./kibana-plugin-server.requesthandler.md). | + diff --git a/docs/development/core/server/kibana-plugin-server.uuidservicesetup.getinstanceuuid.md b/docs/development/core/server/kibana-plugin-server.uuidservicesetup.getinstanceuuid.md new file mode 100644 index 000000000000..e0b7012bea4a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.uuidservicesetup.getinstanceuuid.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) > [getInstanceUuid](./kibana-plugin-server.uuidservicesetup.getinstanceuuid.md) + +## UuidServiceSetup.getInstanceUuid() method + +Retrieve the Kibana instance uuid. + +Signature: + +```typescript +getInstanceUuid(): string; +``` +Returns: + +`string` + diff --git a/docs/development/core/server/kibana-plugin-server.uuidservicesetup.md b/docs/development/core/server/kibana-plugin-server.uuidservicesetup.md new file mode 100644 index 000000000000..f2a6cfdeac70 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.uuidservicesetup.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) + +## UuidServiceSetup interface + +APIs to access the application's instance uuid. + +Signature: + +```typescript +export interface UuidServiceSetup +``` + +## Methods + +| Method | Description | +| --- | --- | +| [getInstanceUuid()](./kibana-plugin-server.uuidservicesetup.getinstanceuuid.md) | Retrieve the Kibana instance uuid. | + diff --git a/docs/discover/context.asciidoc b/docs/discover/context.asciidoc index 9049109d6124..c402a734a16f 100644 --- a/docs/discover/context.asciidoc +++ b/docs/discover/context.asciidoc @@ -1,90 +1,66 @@ [[document-context]] -== Viewing Document Context +== Viewing a document in context -For certain applications it can be useful to inspect a window of documents -surrounding a specific event. The context view enables you to do just that for -<> that are configured to contain time-based events. +Once you've narrowed your search to a specific event, +you might want to inspect the documents that occurred +immediately before and after the event. With the Context view, +you can do just that for index patterns that contain time-based events. -To show the context surrounding an anchor document, click the *Expand* button -image:images/ExpandButton.jpg[Expand Button] to the left of the document's -table entry and then click the *View surrounding documents* link. +To open the Context view, click the expand icon (<) in the document table, and then click +*View surrounding documents.* -image::images/Expanded-Document.png[Expanded Document] -{nbsp} +The documents are sorted +by the time field specified in the index pattern and displayed using the +same set of columns as the *Discover* view from which the context was opened. +The anchor document is highlighted in blue. -The context view displays a number of documents before and after the anchor -document. The anchor document itself is highlighted in blue. The view is sorted -by the time field specified in the index pattern configuration and uses the -same set of columns as the Discover view the context was opened from. If there -are multiple documents with the same time field value, the internal document -order is used as a secondary sorting criterion by default. - -[NOTE] --- -The field used for tiebreaking in case of equal time field values can be -configured using the advanced setting `context:tieBreakerFields` in -< Advanced Settings*>>, which defaults to the -`_doc` field. The value of this setting can be a comma-separated list of field -names, which will be checked in sequence for suitability when a context is -about to be displayed. The first suitable field is then used as the tiebreaking -field. A field is suitable if the field exists and is sortable in the index -pattern the context is based on. - -While not required, it is recommended to only -use fields which have {ref}/doc-values.html[doc values] enabled to achieve -good performance and avoid unnecessary {ref}/modules-fielddata.html[field -data] usage. Common examples for suitable fields include log line numbers, -monotonically increasing counters and high-precision timestamps. --- +[role="screenshot"] image::images/Discover-ContextView.png[Context View] -NOTE: The number of documents displayed by default can be configured -via the `context:defaultSize` setting in < -Advanced Settings*>>. - [float] -[[change-context-size]] -=== Changing the Context Size - -You can change the number documents displayed before and after the anchor -document independently. - -To increase the number of displayed documents that are newer than the anchor -document, click the *Load 5 more* button above the document list or enter the -desired number into the input box right of the button. - -image::images/Discover-ContextView-SizePicker-Newer.png[] -{nbsp} - -To increase the number of displayed documents that are older than the anchor -document, click the *Load 5 more* button below the document list or enter the -desired number into the input box right of the button. +[[filter-context]] +=== Filter the context -image::images/Discover-ContextView-SizePicker-Older.png[] -{nbsp} +The +filters you applied in *Discover* are carried over to the Context view. Pinned filters remain active, while normal +filters are copied in a disabled state. You can re-enable these filters to +refine your context view. -NOTE: The default number of documents loaded with each button click can be -configured via the `context:step` setting in < -Advanced Settings*>>. +If the Context view contains a large number of documents not related to the event under +investigation, you can use filters to restrict the documents to +display. [float] -[[filter-context]] -=== Filtering the Context - -Depending on how the documents are partitioned into index patterns, the context -view might contain a large number of documents not related to the event under -investigation. In order to adapt the focus of the context view to the task at -hand, you can use filters to restrict the documents considered by Kibana for -display in the context view. - -When switching from the discover view to the context view, the previously -applied filters are carried over. Pinned filters remain active while normal -filters are copied in a disabled state. You can selectively re-enabled them to -refine your context view. +[[change-context-size]] +=== Change the number of surrounding documents -New filters can be added via the *Add a filter* link in the filter bar, by -clicking the filter icons appearing when hovering a field, or by expanding -documents and clicking the filter icons in the table. +By default, the five newest and oldest +documents are listed. To increase the number of documents that surround the anchor document, +click *Load*. Five documents are added with each click. -image::images/Discover-ContextView-FilterMontage.png[] +[float] +[[configure-context-ContextView]] +=== Configure the context view + +To configure the Context view, use these settings in <>. + +[horizontal] +`context:defaultSize`:: The number of documents to display by default. +`context:step`:: The default number of documents to load with each button click. +`context:tieBreakerFields`:: The field to use for tiebreaking in case of equal time field values. +The default is the +`_doc` field. ++ +You can enter a comma-separated list of field +names, which is checked in sequence for suitability when a context is +displayed. The first suitable field is used as the tiebreaking +field. A field is suitable if the field exists and is sortable in the index +pattern the context is based on. ++ +Although not required, it is recommended to only +use fields that have {ref}/doc-values.html[doc values] enabled to achieve +good performance and avoid unnecessary {ref}/modules-fielddata.html[field +data] usage. Common examples for suitable fields include log line numbers, +monotonically increasing counters and high-precision timestamps. diff --git a/docs/discover/document-data.asciidoc b/docs/discover/document-data.asciidoc index dc6a45dc5ad7..b45a31065aa9 100644 --- a/docs/discover/document-data.asciidoc +++ b/docs/discover/document-data.asciidoc @@ -1,69 +1,55 @@ [[document-data]] -== Viewing Document Data +== Viewing document data -When you submit a search query, the 500 most recent documents that match the query -are listed in the Documents table. You can configure the number of documents shown -in the table by setting the `discover:sampleSize` property in <>. By default, the table shows the localized version of the time -field configured for the selected <> and the document `_source`. You can -<> from the Fields list. -You can <> by any indexed field that's included -in the table. - -To view a document's field data, click the *Expand* button -image:images/ExpandButton.jpg[Expand Button] to the left of the document's table -entry. - -image::images/Expanded-Document.png[] - -To view the original JSON document (pretty-printed), click the *JSON* tab. - -To view the document data as a separate page, click the *View single document* -link. You can bookmark and share this link to provide direct access to a -particular document. - -To display or hide a field's column in the Documents table, click the -image:images/add-column-button.png[Add Column] *Toggle column in table* button. - -To collapse the document details, click the *Collapse* button -image:images/CollapseButton.jpg[Collapse Button]. +When you submit a search query in *Discover*, the most recent documents that match the query +are listed in the documents table. +By default, the table includes columns for +the time field and the document `_source`, which shows all fields and values in the document. [float] [[sorting]] -=== Sorting the Document List -You can sort the documents in the Documents table by the values in any indexed -field. If a time field is configured for the current index pattern, the -documents are sorted in reverse chronological order by default. - -To change the sort order, hover over the name of the field you want to sort by -and click the sort button. Click again to reverse the sort order. +=== Modify the document table + +Use the following commands to +tailor the documents table to suit your needs. + +[horizontal] +Add a field column:: +Hover over the list of *Available fields* and then click *add* next to each field you want include as a column in the table. +The first field you add replaces the `_source` column. +Change sort order:: By default, columns are sorted by the values in the field. +If a time field is configured for the current index pattern, +the documents are sorted in reverse chronological order. ++ +To change the sort order, hover over the column +and click image:images/sort-icon.png[]. +The first click sorts by ascending order, the second click sorts by descending order, and the third +click removes the field from the sorted fields. + +Move a field column:: Hover over the column header and click the move left (<<) or move right icon (>>). +Remove a field column :: Hover over the list of *Specified fields* +and then click *remove*. +Or, use the (x) control in the column header. [float] -[[adding-columns]] -=== Adding Field Columns to the Documents Table -By default, the Documents table shows the localized version of the time field -that's configured for the selected index pattern and the document `_source`. -You can add fields to the table from the Fields list or from a document's -field data. - -To add a field column from the Fields list, hover over the field and click its -*add* button. +=== Drill down into field-level details +To view the document data in either table or JSON format, click the expand icon (>). +The expanded view provides these options for viewing your document: -To add a field column from a document's field data, expand the document -and click the field's -image:images/add-column-button.png[Add Column] *Toggle column in table* button. +* View the events that surround your document. +For example, you might want to see the 10 documents that occurred +immediately before and after your event. -Added field columns replace the `_source` column in the Documents table. The added -fields are also added to the *Selected Fields* list. +* View the document data as a separate page. You can bookmark and +share the link for direct access to a particular document. -To rearrange the field columns, hover over the header of the column you want to move -and click the *Move left* or *Move right* button. +[role="screenshot"] +image::images/Expanded-Document.png[] -image:images/Discover-MoveColumn.jpg[Move Column] [float] -[[removing-columns]] -=== Removing Field Columns from the Documents Table -To remove a field column from the Documents table, hover over the header of the -column you want to remove and click the *Remove* button -image:images/RemoveFieldButton.jpg[Remove Field Button]. \ No newline at end of file +=== Configure the number of documents to show + +By default, the documents table includes the 500 most recent documents that +match the query. To change this number, set the `discover:sampleSize` property in <>. diff --git a/docs/discover/field-filter.asciidoc b/docs/discover/field-filter.asciidoc index 5646fe079401..49bb6078cdc5 100644 --- a/docs/discover/field-filter.asciidoc +++ b/docs/discover/field-filter.asciidoc @@ -1,127 +1,132 @@ [[field-filter]] -== Filtering by Field -You can filter the search results to display only those documents that contain -a particular value in a field. You can also create negative filters that -exclude documents that contain the specified field value. +== Filtering by field -You add field filters from the Fields list, the Documents table, or by manually -adding a filter. In addition to creating positive and negative filters, the -Documents table enables you to filter on whether or not a field is present. The -applied filters are shown below the Query bar. Negative filters are shown in red. +*Discover* offers +various types of filters, so you can restrict your documents to the exact data you want. +For example, you might look at the results for a +particular period of time. Or, you might include—or exclude— +all HTTP redirects that come from a specific IP and port. -To add a filter from the Fields list: +[float] +=== Add a filter + +A quick way to add a filter is from the fields list. -. Click the name of the field you want to filter on. This displays the top -five values for that field. +. Click the field to filter on. ++ +You'll see the number of documents that contain +the field, the top 5 values for the field, and the percentage of documents +that contain each value. + [role="screenshot"] image::images/filter-field.png[height=317] -. To add a positive filter, click the *Positive Filter* button -image:images/PositiveFilter.jpg[Positive Filter]. -This includes only those documents that contain that value in the field. -. To add a negative filter, click the *Negative Filter* button -image:images/NegativeFilter.jpg[Negative Filter]. -This excludes documents that contain that value in the field. - -To add a filter from the Documents table: - -. Expand a document in the Documents table by clicking the *Expand* button -image:images/ExpandButton.jpg[Expand Button] to the left of the document's -table entry. + +. Use the image:images/PositiveFilter.jpg[Positive Filter] icon to +show only documents that contain that value, +or image:images/NegativeFilter.jpg[Negative Filter] to exclude all documents with that value. + -image::images/Expanded-Document.png[] -. To add a positive filter, click the *Positive Filter* button -image:images/PositiveFilter.jpg[Positive Filter Button] to the right of the -field name. This includes only those documents that contain that value in the -field. -. To add a negative filter, click the *Negative Filter* button -image:images/NegativeFilter.jpg[Negative Filter Button] to the right of the -field name. This excludes documents that contain that value in the field. -. To filter on whether or not documents contain the field, click the -*Exists* button image:images/ExistsButton.jpg[Exists Button] to the right of the -field name. This includes only those documents that contain the field. - -To manually add a filter: - -. Click *Add Filter*. A popup will be displayed for you to create the filter. - -. Choose a field to filter by. This list of fields will include fields from the -index pattern you are currently querying against. +If there is no data to display, you might need to set a <>. +You can choose a time from the quick filter or choose your +own using absolute or relative times. + +. Try also these filtering options: ++ +* To limit the field +list to a particular data type, click *Filter by type*. +You can also filter for whether that type is +aggregatable or searchable. + -image::images/add_filter_field.png[] -. Choose an operation for your filter. +* To filter for whether a field is present, expand the document in +the document table, hover over the field, and click the *Filter for field present* icon. + +[float] +=== Filter by condition + +You can filter using advanced criteria, +such as if a value is equal to or in between certain values. + +. Click *Add Filter*. + +. Select a field. + +. Select an operation for your filter: + -image::images/add_filter_operator.png[] -The following operators can be selected: [horizontal] -`is`:: Filter where the value for the field matches the given value. -`is not`:: Filter where the value for the field does not match the given value. -`is one of`:: Filter where the value for the field matches one of the specified values. -`is not one of`:: Filter where the value for the field does not match any of the specified values. -`is between`:: Filter where the value for the field is in the given range. -`is not between`:: Filter where the value for the field is not in the given range. -`exists`:: Filter where any value is present for the field. -`does not exist`:: Filter where no value is present for the field. -. Choose the value(s) for your filter. Values from your indices may be suggested -as selections if you are filtering against an aggregatable field. +`is`:: The value for the field matches the given value. +`is not`:: The value for the field does not match the given value. +`is one of`:: The field matches one of the specified values. +`is not one of`:: The value for the field does not match any of the specified values. +`is between`:: The value for the field is in the given range. +`is not between`:: The value for the field is not in the given range. +`exists`:: Any value is present for the field. +`does not exist`:: No value is present for the field. +. Choose values for your filter. + -image::images/add_filter_value.png[] -. (Optional) Specify a label for the filter. If you specify a label, it will be -displayed below the query bar instead of the filter definition. -. Click *Save*. The filter will be applied to your search and be displayed below -the query bar. +Values from your indices may be suggested +as selections if you are filtering against an aggregatable field. +. (Optional) Specify a label for the filter. + +. Click *Save* to apply the filter to your search. ++ NOTE: If you are experiencing long-running queries as a result of the value suggestions, you can -turn off the suggestions by setting the advanced setting, `filterEditor:suggestValues`, to `false`. +turn off the suggestions by setting `filterEditor:suggestValues` to `false` +in <>. [float] [[filter-pinning]] -=== Managing Filters +=== Edit, disable, and delete filters + +To modify a filter, click its tag, and then select one of the following actions. + +*Pin across all apps*:: +Persist the filter +when you switch contexts in Kibana. For example, you can pin a filter +in *Discover* and it remains in place when you switch to *Visualize*. +A filter is based on a particular index field—if the indices being +searched do not contain the field in a pinned filter, it has no effect. -To modify a filter, click on it and click one of the action buttons. +*Edit filter*:: +Edit the +filter definition and label. -image::images/filter-allbuttons.png[] +*Exclude results*:: +Switch from a positive +filter to a negative filter, and vice versa. -  +*Temporarily disable*:: +Disable the filter without +removing it. Click again to reenable the filter. + +*Delete*:: +Delete the filter. + +To apply an action to all filters, +click the *Actions* icon, and then select the action. -Pin across all apps :: Pinned filters -persist when you switch contexts in Kibana. For example, you can pin a filter -in Discover and it remains in place when you switch to Visualize. -Note that a filter is based on a particular index field--if the indices being -searched don't contain the field in a pinned filter, it has no effect. -Edit Filter :: <> definition. Enables you to manually update the filter and -specify a label for the filter. -Exclude results :: Switch from a positive -filter to a negative filter and vice-versa. -Temporarily disable :: Disable the filter without -removing it. Click again to reenable the filter. Diagonal stripes indicate -that a filter is disabled. -Remove Filter :: Remove the filter. -To apply a filter action to all of the applied filters, -click *Actions* and select the action. [float] [[filter-edit]] -=== Editing a Filter -You can edit a filter by changing the field, operator, or value associated -with the filter (see the Add Filter section above), or by directly modifying -the filter query that is performed to filter your search results. This -enables you to create more complex filters that are based on multiple fields. - -. To edit the filter query, first click the edit button for the filter, then -click *Edit Query DSL*. -+ -image::images/edit_filter_query.png[] -. You can then edit the query for the filter. -+ -image::images/edit_filter_query_json.png[] +=== Modify the filter query -For example, you could use a -{ref}/query-dsl-bool-query.html[bool query] to create a filter for the -sample log data that displays the hits that originated from Canada or China that resulted in a 404 error: +You can directly modify +the query that filters your search results. This enables you +to create more complex filters using multiple fields. +. Click the filter tag, and then select *Edit > Edit Query DSL*. + +. Edit the query for the filter. ++ +//// +image::images/edit_filter_query_json.png[] ++ +//// +For example, if you are using the sample log data, you can use the +{ref}/query-dsl-bool-query.html[bool query] to create a filter +that displays the hits that originated from Canada or China that resulted in a 404 error: ++ ========== [source,json] { diff --git a/docs/discover/images/move-icon.png b/docs/discover/images/move-icon.png new file mode 100644 index 000000000000..3fa1f9e2f1a5 Binary files /dev/null and b/docs/discover/images/move-icon.png differ diff --git a/docs/discover/images/sort-icon.png b/docs/discover/images/sort-icon.png new file mode 100644 index 000000000000..7dd3719ec361 Binary files /dev/null and b/docs/discover/images/sort-icon.png differ diff --git a/docs/discover/viewing-field-stats.asciidoc b/docs/discover/viewing-field-stats.asciidoc index 96a26c78596e..3631aba73fb2 100644 --- a/docs/discover/viewing-field-stats.asciidoc +++ b/docs/discover/viewing-field-stats.asciidoc @@ -1,14 +1,14 @@ [[viewing-field-stats]] == Viewing Field Data Statistics -From the Fields list, you can see how many of the documents in the Documents +From the fields list, you can see how many of the documents in the documents table contain a particular field, what the top 5 values are, and what percentage of documents contain each value. -Data can be visualized in various ways. The quick visualize can only be -applied to aggregatable fields. The keyword fields can be visualized and -they are available in the side bar if we uncheck "Hide missing fields". +You can visualize data in various ways. You can only apply the quick visualize +to aggregatable fields. You can visualize the keyword fields, and +they are available in the side bar if you uncheck "Hide missing fields". -To view field data statistics, click the name of a field in the Fields list. +To view field data statistics, click the name of a field in the fields list. -image:images/filter-field.png[Field Statistics,height=317] \ No newline at end of file +image:images/filter-field.png[Field Statistics,height=317] diff --git a/docs/images/Discover-ContextView-SizePicker-Newer.png b/docs/images/Discover-ContextView-SizePicker-Newer.png deleted file mode 100644 index 852cb22c1f27..000000000000 Binary files a/docs/images/Discover-ContextView-SizePicker-Newer.png and /dev/null differ diff --git a/docs/images/Discover-ContextView-SizePicker-Older.png b/docs/images/Discover-ContextView-SizePicker-Older.png deleted file mode 100644 index 38cd9acd1bee..000000000000 Binary files a/docs/images/Discover-ContextView-SizePicker-Older.png and /dev/null differ diff --git a/docs/images/Discover-ContextView.png b/docs/images/Discover-ContextView.png index 11d4a59c26e5..5c2de602f6b4 100644 Binary files a/docs/images/Discover-ContextView.png and b/docs/images/Discover-ContextView.png differ diff --git a/docs/images/Discover-Start.png b/docs/images/Discover-Start.png index 680aa3767bdf..27e7a2c72859 100644 Binary files a/docs/images/Discover-Start.png and b/docs/images/Discover-Start.png differ diff --git a/docs/images/Expanded-Document.png b/docs/images/Expanded-Document.png index ad2f0db1a7ff..4fa255e79a8a 100644 Binary files a/docs/images/Expanded-Document.png and b/docs/images/Expanded-Document.png differ diff --git a/docs/images/canvas-add-pages.gif b/docs/images/canvas-add-pages.gif index 5f977c6afb10..a1fa22864583 100644 Binary files a/docs/images/canvas-add-pages.gif and b/docs/images/canvas-add-pages.gif differ diff --git a/docs/images/canvas-align-elements.gif b/docs/images/canvas-align-elements.gif index d2e2cda47575..0081308d6879 100644 Binary files a/docs/images/canvas-align-elements.gif and b/docs/images/canvas-align-elements.gif differ diff --git a/docs/images/canvas-background-color-picker-min.gif b/docs/images/canvas-background-color-picker-min.gif deleted file mode 100644 index bd22941b35f5..000000000000 Binary files a/docs/images/canvas-background-color-picker-min.gif and /dev/null differ diff --git a/docs/images/canvas-background-color-picker.gif b/docs/images/canvas-background-color-picker.gif index 37d43d987f5c..bd22941b35f5 100644 Binary files a/docs/images/canvas-background-color-picker.gif and b/docs/images/canvas-background-color-picker.gif differ diff --git a/docs/images/canvas-change-your-expression-chart-no-legend.png b/docs/images/canvas-change-your-expression-chart-no-legend.png new file mode 100644 index 000000000000..f54437c1eba3 Binary files /dev/null and b/docs/images/canvas-change-your-expression-chart-no-legend.png differ diff --git a/docs/images/canvas-change-your-expression-chart.png b/docs/images/canvas-change-your-expression-chart.png new file mode 100755 index 000000000000..4400ce4dfb2c Binary files /dev/null and b/docs/images/canvas-change-your-expression-chart.png differ diff --git a/docs/images/canvas-create-URL-min.gif b/docs/images/canvas-create-URL-min.gif deleted file mode 100644 index 0c9fbf7201d8..000000000000 Binary files a/docs/images/canvas-create-URL-min.gif and /dev/null differ diff --git a/docs/images/canvas-create-URL.gif b/docs/images/canvas-create-URL.gif index c7dfab28c681..0c9fbf7201d8 100644 Binary files a/docs/images/canvas-create-URL.gif and b/docs/images/canvas-create-URL.gif differ diff --git a/docs/images/canvas-distribute-elements.gif b/docs/images/canvas-distribute-elements.gif index 2d7eca338d27..685d76ba22e4 100644 Binary files a/docs/images/canvas-distribute-elements.gif and b/docs/images/canvas-distribute-elements.gif differ diff --git a/docs/images/canvas-element-select.gif b/docs/images/canvas-element-select.gif index 9ead1c3243ee..bd0e49377262 100644 Binary files a/docs/images/canvas-element-select.gif and b/docs/images/canvas-element-select.gif differ diff --git a/docs/images/canvas-embed_workpad-min.gif b/docs/images/canvas-embed_workpad-min.gif deleted file mode 100644 index 293792c7fbcf..000000000000 Binary files a/docs/images/canvas-embed_workpad-min.gif and /dev/null differ diff --git a/docs/images/canvas-embed_workpad.gif b/docs/images/canvas-embed_workpad.gif index 0ffbdeab2862..97a79d775fe3 100644 Binary files a/docs/images/canvas-embed_workpad.gif and b/docs/images/canvas-embed_workpad.gif differ diff --git a/docs/images/canvas-functions-can-take-arguments-donut-chart.png b/docs/images/canvas-functions-can-take-arguments-donut-chart.png new file mode 100644 index 000000000000..d126830c4fdc Binary files /dev/null and b/docs/images/canvas-functions-can-take-arguments-donut-chart.png differ diff --git a/docs/images/canvas-functions-can-take-arguments-pie-chart.png b/docs/images/canvas-functions-can-take-arguments-pie-chart.png new file mode 100644 index 000000000000..be923675bea8 Binary files /dev/null and b/docs/images/canvas-functions-can-take-arguments-pie-chart.png differ diff --git a/docs/images/canvas-generate-pdf-min.gif b/docs/images/canvas-generate-pdf-min.gif deleted file mode 100644 index 9ef16dc1e501..000000000000 Binary files a/docs/images/canvas-generate-pdf-min.gif and /dev/null differ diff --git a/docs/images/canvas-generate-pdf.gif b/docs/images/canvas-generate-pdf.gif index a51e04cb623a..9ef16dc1e501 100644 Binary files a/docs/images/canvas-generate-pdf.gif and b/docs/images/canvas-generate-pdf.gif differ diff --git a/docs/images/canvas_share_autoplay_480-min.gif b/docs/images/canvas_share_autoplay_480-min.gif deleted file mode 100644 index 84a108e58d3d..000000000000 Binary files a/docs/images/canvas_share_autoplay_480-min.gif and /dev/null differ diff --git a/docs/images/canvas_share_autoplay_480.gif b/docs/images/canvas_share_autoplay_480.gif index da6d8c74dd5c..84a108e58d3d 100644 Binary files a/docs/images/canvas_share_autoplay_480.gif and b/docs/images/canvas_share_autoplay_480.gif differ diff --git a/docs/images/canvas_share_hidetoolbar_480-min.gif b/docs/images/canvas_share_hidetoolbar_480-min.gif deleted file mode 100644 index 4706db48967b..000000000000 Binary files a/docs/images/canvas_share_hidetoolbar_480-min.gif and /dev/null differ diff --git a/docs/images/canvas_share_hidetoolbar_480.gif b/docs/images/canvas_share_hidetoolbar_480.gif index 6206714aa280..282783057776 100644 Binary files a/docs/images/canvas_share_hidetoolbar_480.gif and b/docs/images/canvas_share_hidetoolbar_480.gif differ diff --git a/docs/images/kibana-status-page-7_5_0.png b/docs/images/kibana-status-page-7_5_0.png new file mode 100644 index 000000000000..2dac4c3f94c3 Binary files /dev/null and b/docs/images/kibana-status-page-7_5_0.png differ diff --git a/docs/images/kibana-status-page.png b/docs/images/kibana-status-page.png deleted file mode 100644 index b269dbd35730..000000000000 Binary files a/docs/images/kibana-status-page.png and /dev/null differ diff --git a/docs/images/lens_data_info-min.gif b/docs/images/lens_data_info-min.gif deleted file mode 100644 index 39f9f668df4c..000000000000 Binary files a/docs/images/lens_data_info-min.gif and /dev/null differ diff --git a/docs/images/lens_data_info.gif b/docs/images/lens_data_info.gif deleted file mode 100644 index e2c565de9f6a..000000000000 Binary files a/docs/images/lens_data_info.gif and /dev/null differ diff --git a/docs/images/lens_data_info.png b/docs/images/lens_data_info.png new file mode 100644 index 000000000000..3ceb7e5e990f Binary files /dev/null and b/docs/images/lens_data_info.png differ diff --git a/docs/images/lens_drag_drop-min.gif b/docs/images/lens_drag_drop-min.gif deleted file mode 100644 index 721974211419..000000000000 Binary files a/docs/images/lens_drag_drop-min.gif and /dev/null differ diff --git a/docs/images/lens_drag_drop.gif b/docs/images/lens_drag_drop.gif index 39cde64fb97e..2a759abf0302 100644 Binary files a/docs/images/lens_drag_drop.gif and b/docs/images/lens_drag_drop.gif differ diff --git a/docs/images/lens_suggestions-min.gif b/docs/images/lens_suggestions-min.gif deleted file mode 100644 index de1d5b709686..000000000000 Binary files a/docs/images/lens_suggestions-min.gif and /dev/null differ diff --git a/docs/images/lens_suggestions.gif b/docs/images/lens_suggestions.gif index 0452207b8645..ad93a9d87d54 100644 Binary files a/docs/images/lens_suggestions.gif and b/docs/images/lens_suggestions.gif differ diff --git a/docs/images/time_range_per_panel-min.gif b/docs/images/time_range_per_panel-min.gif deleted file mode 100644 index 04d2e2f17b4f..000000000000 Binary files a/docs/images/time_range_per_panel-min.gif and /dev/null differ diff --git a/docs/images/time_range_per_panel.gif b/docs/images/time_range_per_panel.gif index aab8f68a0b50..04d2e2f17b4f 100644 Binary files a/docs/images/time_range_per_panel.gif and b/docs/images/time_range_per_panel.gif differ diff --git a/docs/limitations.asciidoc b/docs/limitations.asciidoc index 0b26a3cdcf71..9bcba3b65d66 100644 --- a/docs/limitations.asciidoc +++ b/docs/limitations.asciidoc @@ -12,7 +12,7 @@ These {stack} features also have limitations that affect {kib}: * {ref}/watcher-limitations.html[Alerting] -* {stack-ov}/ml-limitations.html[Machine learning] +* {ml-docs}/ml-limitations.html[Machine learning] * {ref}/security-limitations.html[Security] -- diff --git a/docs/maps/images/top_hits.png b/docs/maps/images/top_hits.png new file mode 100644 index 000000000000..45bbf575f10d Binary files /dev/null and b/docs/maps/images/top_hits.png differ diff --git a/docs/maps/indexing-geojson-data-tutorial.asciidoc b/docs/maps/indexing-geojson-data-tutorial.asciidoc index 5284bd9ac2ac..22b736032cb7 100644 --- a/docs/maps/indexing-geojson-data-tutorial.asciidoc +++ b/docs/maps/indexing-geojson-data-tutorial.asciidoc @@ -101,11 +101,6 @@ aggregation. The remaining default settings are good, but there are a couple of settings that you might want to change. -. Under *Source settings* > *Grid resolution*, select from the different heat map resolutions. -+ -The default "Coarse" looks -good, but feel free to select a different resolution. - . Play around with the *Layer Style* > *Color range* setting. + diff --git a/docs/maps/maps-aggregations.asciidoc b/docs/maps/maps-aggregations.asciidoc index cd01acb2df7d..627fd49dafa5 100644 --- a/docs/maps/maps-aggregations.asciidoc +++ b/docs/maps/maps-aggregations.asciidoc @@ -34,17 +34,23 @@ The point location is the weighted centroid for all geo-points in the gridded ce [role="xpack"] [[maps-top-hits-aggregation]] -=== Most recent entities +=== Top hits per entity -Most recent entities uses {es} {ref}/search-aggregations-bucket-terms-aggregation.html[terms aggregation] to group your documents by entity. -Then, {ref}/search-aggregations-metrics-top-hits-aggregation.html[top hits metric aggregation] accumulates the most recent documents for each entry. +You can display the most relevant documents per entity, for example, the most recent GPS tracks per flight. +To get this data, {es} first groups your data using a {ref}/search-aggregations-bucket-terms-aggregation.html[terms aggregation], +then accumulates the most relevant documents based on sort order for each entry using a {ref}/search-aggregations-metrics-top-hits-aggregation.html[top hits metric aggregation]. -Most recent entities is available for <> with *Documents* source. -To enable most recent entities, click "Show most recent documents by entity" and configure the following: +Top hits per entity is available for <> with *Documents* source. +To enable top hits: +. In *Sorting*, select the *Show documents per entity* checkbox. . Set *Entity* to the field that identifies entities in your documents. This field will be used in the terms aggregation to group your documents into entity buckets. . Set *Documents per entity* to configure the maximum number of documents accumulated per entity. +This setting is limited to the `index.max_inner_result_window` index setting, which defaults to 100. + +[role="screenshot"] +image::maps/images/top_hits.png[] [role="xpack"] [[point-to-point]] diff --git a/docs/maps/search.asciidoc b/docs/maps/search.asciidoc index 97b10e389963..8a93352798d2 100644 --- a/docs/maps/search.asciidoc +++ b/docs/maps/search.asciidoc @@ -89,7 +89,7 @@ The most common cause for empty layers are searches for a field that exists in o You can prevent the search bar from applying search context to a layer by configuring the following: -* In *Source settings*, clear the *Apply global filter to source* checkbox to turn off the global search context for the layer source. +* In *Filtering*, clear the *Apply global filter to layer data* checkbox to turn off the global search context for the layer source. * In *Term joins*, clear the *Apply global filter to join* checkbox to turn off the global search context for the <>. diff --git a/docs/maps/vector-layer.asciidoc b/docs/maps/vector-layer.asciidoc index 1b9d0e6556f5..1d4ba9912529 100644 --- a/docs/maps/vector-layer.asciidoc +++ b/docs/maps/vector-layer.asciidoc @@ -15,7 +15,7 @@ See map.regionmap.* in <> for details. *Documents*:: Vector data from a Kibana index pattern. The index must contain at least one field mapped as {ref}/geo-point.html[geo_point] or {ref}/geo-shape.html[geo_shape]. -NOTE: Document results are limited to the first 10000 matching documents. +NOTE: Document results are limited to the `index.max_result_window` index setting, which defaults to 10000. Use <> to plot large data sets. *Grid aggregation*:: Geospatial data grouped in grids with metrics for each gridded cell. diff --git a/docs/maps/vector-style-properties.asciidoc b/docs/maps/vector-style-properties.asciidoc index f51632218add..5656a7f04d0e 100644 --- a/docs/maps/vector-style-properties.asciidoc +++ b/docs/maps/vector-style-properties.asciidoc @@ -8,32 +8,52 @@ Point, polygon, and line features support different styling properties. [[point-style-properties]] ==== Point style properties +You can add text labels to your Point features by configuring label style properties. + +[cols="2*"] +|=== +|*Label* +|Specifies label content. +|*Label color* +|The text color. +|*Label size* +|The size of the text font, in pixels. +|=== + You can symbolize Point features as *Circle markers* or *Icons*. Use *Circle marker* to symbolize Points as circles. -*Fill color*:: The fill color of the point features. - -*Border color*:: The border color of the point features. - -*Border width*:: The border width of the point features. - -*Symbol size*:: The radius of the symbol size, in pixels. +[cols="2*"] +|=== +|*Border color* +|The border color of the point features. +|*Border width* +|The border width of the point features. +|*Fill color* +|The fill color of the point features. +|*Symbol size* +|The radius of the symbol size, in pixels. +|=== Use *Icon* to symbolize Points as icons. -*Fill color*:: The fill color of the point features. - -*Border color*:: The border color of the point features. - -*Border width*:: The border width of the point features. +[cols="2*"] +|=== +|*Border color* +|The border color of the point features. +|*Border width* +|The border width of the point features. +|*Fill color* +|The fill color of the point features. +|*Symbol orientation* +|The symbol orientation rotating the icon clockwise. +|*Symbol size* +|The radius of the symbol size, in pixels. +|=== -*Symbol orientation*:: The symbol orientation rotating the icon clockwise. - -*Symbol size*:: The radius of the symbol size, in pixels. -+ Available icons -+ + [role="screenshot"] image::maps/images/maki-icons.png[] @@ -42,17 +62,25 @@ image::maps/images/maki-icons.png[] [[polygon-style-properties]] ==== Polygon style properties -*Fill color*:: The fill color of the polygon features. - -*Border color*:: The border color of the polygon features. - -*Border width*:: The border width of the polygon features. +[cols="2*"] +|=== +|*Border color* +|The border color of the polygon features. +|*Border width* +|The border width of the polygon features. +|*Fill color* +|The fill color of the polygon features. +|=== [float] [[line-style-properties]] ==== Line style properties -*Border color*:: The color of the line features. - -*Border width*:: The width of the line features. +[cols="2*"] +|=== +|*Border color* +|The color of the line features. +|*Border width* +|The width of the line features. +|=== diff --git a/docs/settings/apm-settings.asciidoc b/docs/settings/apm-settings.asciidoc index 8cbbcdcbca3e..8d28b55a6502 100644 --- a/docs/settings/apm-settings.asciidoc +++ b/docs/settings/apm-settings.asciidoc @@ -13,6 +13,10 @@ copy and paste the relevant settings below into your `kibana.yml` configuration [[general-apm-settings-kb]] ==== General APM settings +// This content is reused in the APM app documentation. +// Any changes made in this file will be seen there as well. +// tag::general-apm-settings[] + xpack.apm.enabled:: Set to `false` to disabled the APM plugin {kib}. Defaults to `true`. @@ -37,3 +41,4 @@ apm_oss.metricsIndices:: Matcher for indices containing metric documents. Defaul apm_oss.sourcemapIndices:: Matcher for indices containing sourcemap documents. Defaults to `apm-*`. +// end::general-apm-settings[] diff --git a/docs/settings/security-settings.asciidoc b/docs/settings/security-settings.asciidoc index a2c05e4d8732..d6dd4378da1b 100644 --- a/docs/settings/security-settings.asciidoc +++ b/docs/settings/security-settings.asciidoc @@ -50,15 +50,17 @@ this to `true` if SSL is configured outside of {kib} (for example, you are routing requests through a load balancer or proxy). `xpack.security.session.idleTimeout`:: -Sets the session duration (in milliseconds). By default, sessions stay active -until the browser is closed. When this is set to an explicit idle timeout, closing -the browser still requires the user to log back in to {kib}. +Sets the session duration. The format is a string of `[ms|s|m|h|d|w|M|Y]` +(e.g. '70ms', '5s', '3d', '1Y'). By default, sessions stay active until the +browser is closed. When this is set to an explicit idle timeout, closing the +browser still requires the user to log back in to {kib}. `xpack.security.session.lifespan`:: -Sets the maximum duration (in milliseconds), also known as "absolute timeout". By -default, a session can be renewed indefinitely. When this value is set, a session -will end once its lifespan is exceeded, even if the user is not idle. NOTE: if -`idleTimeout` is not set, this setting will still cause sessions to expire. +Sets the maximum duration, also known as "absolute timeout". The format is a +string of `[ms|s|m|h|d|w|M|Y]` (e.g. '70ms', '5s', '3d', '1Y'). By default, +a session can be renewed indefinitely. When this value is set, a session will end +once its lifespan is exceeded, even if the user is not idle. NOTE: if `idleTimeout` +is not set, this setting will still cause sessions to expire. `xpack.security.loginAssistanceMessage`:: Adds a message to the login screen. Useful for displaying information about maintenance windows, links to corporate sign up pages etc. diff --git a/docs/setup/access.asciidoc b/docs/setup/access.asciidoc index 538b42781b12..a7374a37ddae 100644 --- a/docs/setup/access.asciidoc +++ b/docs/setup/access.asciidoc @@ -2,8 +2,8 @@ == Accessing Kibana Kibana is a web application that you access through port 5601. All you need to do is point your web browser at the -machine where Kibana is running and specify the port number. For example, `localhost:5601` or -`http://YOURDOMAIN.com:5601`. +machine where Kibana is running and specify the port number. For example, `localhost:5601` or `http://YOURDOMAIN.com:5601`. +If you want to allow remote users to connect, set the parameter `server.host` in `kibana.yml` to a non-loopback address. When you access Kibana, the <> page loads by default with the default index pattern selected. The time filter is set to the last 15 minutes and the search query is set to match-all (\*). @@ -15,9 +15,10 @@ If you still don't see any results, it's possible that you don't *have* any docu [[status]] === Checking Kibana Status -You can reach the Kibana server's status page by navigating to `localhost:5601/status`. The status page displays +You can reach the Kibana server's status page by navigating to the status endpoint, for example, `localhost:5601/status`. The status page displays information about the server's resource usage and lists the installed plugins. -image::images/kibana-status-page.png[] +[role="screenshot"] +image::images/kibana-status-page-7_5_0.png[] NOTE: For JSON-formatted server status details, use the API endpoint at `localhost:5601/api/status` diff --git a/docs/setup/docker.asciidoc b/docs/setup/docker.asciidoc index f3e7273adede..8fd7b0490e19 100644 --- a/docs/setup/docker.asciidoc +++ b/docs/setup/docker.asciidoc @@ -5,7 +5,7 @@ base image is https://hub.docker.com/_/centos/[centos:7]. A list of all published Docker images and tags is available at https://www.docker.elastic.co[www.docker.elastic.co]. The source code is in -https://github.com/elastic/kibana-docker/tree/{branch}[GitHub]. +https://github.com/elastic/dockerfiles/tree/{branch}/kibana[GitHub]. These images are free to use under the Elastic license. They contain open source and free commercial features and access to paid commercial features. diff --git a/docs/setup/production.asciidoc b/docs/setup/production.asciidoc index 67afe0896a0d..fed4ba4886bf 100644 --- a/docs/setup/production.asciidoc +++ b/docs/setup/production.asciidoc @@ -6,6 +6,7 @@ * <> * <> * <> +* <> How you deploy Kibana largely depends on your use case. If you are the only user, you can run Kibana on your local machine and configure it to point to whatever @@ -27,7 +28,7 @@ You can use {stack} {security-features} to control what {es} data users can access through Kibana. When {security-features} are enabled, Kibana users have to log in. They need to -have a role granting <> as well as access +have a role granting <> as well as access to the indices they will be working with in Kibana. If a user loads a Kibana dashboard that accesses data in an index that they @@ -125,4 +126,17 @@ elasticsearch.hosts: -------- Related configurations include `elasticsearch.sniffInterval`, `elasticsearch.sniffOnStart`, and `elasticsearch.sniffOnConnectionFault`. -These can be used to automatically update the list of hosts as a cluster is resized. Parameters can be found on the {kibana-ref}/settings.html[settings page]. \ No newline at end of file +These can be used to automatically update the list of hosts as a cluster is resized. Parameters can be found on the {kibana-ref}/settings.html[settings page]. + +[float] +[[memory]] +=== Memory +Kibana has a default maximum memory limit of 1.4 GB, and in most cases, we recommend leaving this unconfigured. In some scenarios, such as large reporting jobs, +it may make sense to tweak limits to meet more specific requirements. + +You can modify this limit by setting `--max-old-space-size` in the `NODE_OPTIONS` environment variable. For deb and rpm, packages this is passed in via `/etc/default/kibana` and can be appended to the bottom of the file. + +The option accepts a limit in MB: +-------- +NODE_OPTIONS="--max-old-space-size=2048" bin/kibana +-------- diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index 5605ed5c5668..01e6bd51ea50 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -7,9 +7,7 @@ if you installed {kib} from an archive distribution (`.tar.gz` or `.zip`), by default it is in `$KIBANA_HOME/config`. By default, with package distributions (Debian or RPM), it is in `/etc/kibana`. -The default settings configure Kibana to run on `localhost:5601`. To change the -host or port number, or connect to Elasticsearch running on a different machine, -you'll need to update your `kibana.yml` file. You can also enable SSL and set a +The default host and port settings configure {kib} to run on `localhost:5601`. To change this behavior and allow remote users to connect, you'll need to update your `kibana.yml` file. You can also enable SSL and set a variety of other options. Finally, environment variables can be injected into configuration using `${MY_ENV_VAR}` syntax. @@ -32,7 +30,7 @@ strongly recommend that you keep the default CSP rules that ship with Kibana. `csp.strict:`:: *Default: `true`* Blocks access to Kibana to any browser that does not enforce even rudimentary CSP rules. In practice, this will disable -support for older, less safe browsers like Internet Explorer. +support for older, less safe browsers like Internet Explorer. See <> for more information. `csp.warnLegacyBrowsers:`:: *Default: `true`* Shows a warning message after @@ -65,6 +63,8 @@ connects to this Kibana instance. `elasticsearch.requestHeadersWhitelist:`:: *Default: `[ 'authorization' ]`* List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side headers, set this value to [] (an empty list). +Removing the `authorization` header from being whitelisted means that you cannot +use <> in Kibana. `elasticsearch.requestTimeout:`:: *Default: 30000* Time in milliseconds to wait for responses from the back end or Elasticsearch. This value must be a positive @@ -147,6 +147,36 @@ will default to `true`. `logging.quiet:`:: *Default: false* Set the value of this setting to `true` to suppress all logging output other than error messages. +`logging.rotate:`:: [experimental] Specifies the options for the logging rotate feature. +When not defined, all the sub options defaults would be applied. +The following example shows a valid logging rotate configuration: ++ +-- + logging.rotate: + enabled: true + everyBytes: 10485760 + keepFiles: 10 +-- + +`logging.rotate.enabled:`:: [experimental] *Default: false* Set the value of this setting to `true` to +enable log rotation. If you do not have a `logging.dest` set that is different from `stdout` +that feature would not take any effect. + +`logging.rotate.everyBytes:`:: [experimental] *Default: 10485760* The maximum size of a log file (that is `not an exact` limit). After the +limit is reached, a new log file is generated. The default size limit is 10485760 (10 MB) and +this option should be in the range of 102400 (100KB) to 1073741824 (1GB). + +`logging.rotate.keepFiles:`:: [experimental] *Default: 7* The number of most recent rotated log files to keep +on disk. Older files are deleted during log rotation. The default value is 7. The `logging.rotate.keepFiles` +option has to be in the range of 2 to 1024 files. + +`logging.rotate.pollingInterval:`:: [experimental] *Default: 10000* The number of milliseconds for the polling strategy in case +the `logging.rotate.usePolling` is enabled. That option has to be in the range of 5000 to 3600000 milliseconds. + +`logging.rotate.usePolling:`:: [experimental] *Default: false* By default we try to understand the best way to monitoring +the log file. However, there is some systems where it could not be always accurate. In those cases, if needed, +the `polling` method could be used enabling that option. + `logging.silent:`:: *Default: false* Set the value of this setting to `true` to suppress all logging output. @@ -272,7 +302,7 @@ This setting may not be used when `server.compression.enabled` is set to `false` send on all responses to the client from the Kibana server. `server.host:`:: *Default: "localhost"* This setting specifies the host of the -back end server. +back end server. To allow remote users to connect, set the value to the IP address or DNS name of the {kib} server. `server.keepaliveTimeout:`:: *Default: "120000"* The number of milliseconds to wait for additional data before restarting the `server.socketTimeout` counter. @@ -322,19 +352,31 @@ all http requests to https over the port configured as `server.port`. `server.ssl.supportedProtocols:`:: *Default: TLSv1.1, TLSv1.2* An array of supported protocols with versions. Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2` +`server.xsrf.whitelist:`:: It is not recommended to disable protections for +arbitrary API endpoints. Instead, supply the `kbn-xsrf` header. There are some +scenarios where whitelisting is required, however, such as +<>. +The `server.xsrf.whitelist` setting requires the following format: + +[source,text] + +---- +*Default: [ ]* An array of API endpoints which should be exempt from Cross-Site Request Forgery ("XSRF") protections. +---- + `status.allowAnonymous:`:: *Default: false* If authentication is enabled, setting this to `true` enables unauthenticated users to access the Kibana server status API and status page. -`telemetry.allowChangingOptInStatus`:: *Default: true*. If `true`, -users are able to change the telemetry setting at a later time in -<>. If `false`, -{kib} looks at the value of `telemetry.optIn` to determine whether to send +`telemetry.allowChangingOptInStatus`:: *Default: true*. If `true`, +users are able to change the telemetry setting at a later time in +<>. If `false`, +{kib} looks at the value of `telemetry.optIn` to determine whether to send telemetry data or not. `telemetry.allowChangingOptInStatus` and `telemetry.optIn` cannot be `false` at the same time. -`telemetry.optIn`:: *Default: true* If `true`, telemetry data is sent to Elastic. - If `false`, collection of telemetry data is disabled. +`telemetry.optIn`:: *Default: true* If `true`, telemetry data is sent to Elastic. + If `false`, collection of telemetry data is disabled. To enable telemetry and prevent users from disabling it, set `telemetry.allowChangingOptInStatus` to `false` and `telemetry.optIn` to `true`. @@ -348,6 +390,15 @@ Rollup user interface. `i18n.locale`:: *Default: en* Set this value to change the Kibana interface language. Valid locales are: `en`, `zh-CN`, `ja-JP`. +`xpack.actions.enabledActionTypes:`:: *Default: +[ {asterisk} ]+* Set this value +to an array of action types that are enabled. An element of `*` indicates all +action types registered are enabled. The action types provided by Kibana are: +`.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, `.webhook`. + +`xpack.actions.whitelistedHosts:`:: *Default: +[ {asterisk} ]+* Set this value +to an array of host names which actions such as email, slack, pagerduty, and +webhook can connect to. An element of `*` indicates any host can be connected +to. An empty array indicates no hosts can be connected to. include::{docdir}/settings/apm-settings.asciidoc[] include::{docdir}/settings/dev-settings.asciidoc[] diff --git a/docs/user/canvas.asciidoc b/docs/user/canvas.asciidoc index c58635ba9776..5c5f5c2f80bf 100644 --- a/docs/user/canvas.asciidoc +++ b/docs/user/canvas.asciidoc @@ -37,6 +37,8 @@ include::{kib-repo-dir}/canvas/canvas-present-workpad.asciidoc[] include::{kib-repo-dir}/canvas/canvas-share-workpad.asciidoc[] +include::{kib-repo-dir}/canvas/canvas-expression-lifecycle.asciidoc[] + include::{kib-repo-dir}/canvas/canvas-function-reference.asciidoc[] -include::{kib-repo-dir}/canvas/canvas-tinymath-functions.asciidoc[] +include::{kib-repo-dir}/canvas/canvas-tinymath-functions.asciidoc[] \ No newline at end of file diff --git a/docs/user/discover.asciidoc b/docs/user/discover.asciidoc index fa583918703f..36d6b0a6e473 100644 --- a/docs/user/discover.asciidoc +++ b/docs/user/discover.asciidoc @@ -3,15 +3,100 @@ [partintro] -- -*Discover* enables you to explore your data with {kib}'s data discovery functions. -You have access to every document in every index that matches the selected <>. -You can submit search queries, filter the search results, and view document data. -You can also see the number of documents that match the search query and get field value statistics. -If a time field is configured for the selected index pattern, the distribution of -documents over time is displayed in a histogram at the top of the page. +When you know what your data includes, you can create visualizations +that best display that data and build better dashboards. +*Discover* enables you to explore your data, find +hidden insights and relationships, and get answers to your questions. + +With *Discover*, you can: + +* Access every document in every index that matches your selected index pattern +* Search your data and filter the search results +* Get field-level details about the documents that match your search +* View the events that occurred just before and after a document [role="screenshot"] image::images/Discover-Start.png[Discover] + + +[float] +=== Set up your index pattern + +The first thing to do in *Discover* is to select an <>, which +defines the data you want to explore and visualize. The current index pattern is in the upper left. +If you haven't yet created an index pattern, you can add a <>, +which has a pre-built index pattern. + +[float] +=== Set a time filter + +By default, *Discover* shows data for the last 15 minutes. +If you have a time-based index, and no data displays, +you might need to increase the time range. Using the <> in the upper right, +you can specify a common or recently-used time range, a relative time +from now, or an absolute time range. + +[float] +=== Search your data + +Now that you have your data and set the time span, you can start asking your questions. +You can search your data using the <>, +which offers a simplified query syntax. +For example, if +you search for `day_of_week : Friday`, you'll get a list of all documents +in which `day_of_week` is set to `Friday`. If you prefer +<>, you can access it from the KQL menu. + +[float] +=== Filter your search results + +Next, you'll want narrow your search results to a more manageable data set. +When you click on a name in the field list, you'll see +the top five values for the field, the number of documents that contain the field, +and the percentage of documents that contain each value. From this view, you can +use the (+) magnifier icon to quickly find all +documents that have that value, or (-) to exclude all +documents with that value. For more filter options, see <>. + +[role="screenshot"] +image::images/filter-field.png[height=317] + + +[float] +=== Add and remove fields + +The sortable documents table +lists the documents that match your search. +By default, the table includes columns for the time field and the document `_source`. +To zero in on a specific field, click *add* next to the field name in the left sidebar. +For example, if you add the `currency`, `customer_last_name`, and `day_of_week` fields, +the document table includes columns for those three fields. + +[float] +=== Examine document contents + +From the documents table, you can expand a document to +examine its field data in either table or JSON format. +The table view provides yet another filtering option—filtering for whether the field +is present. See <> for details. + +[float] +=== View a document in context + +Suppose you're troubleshooting your data, and you've narrowed down your results to a single document. +Now you want to to see the events that occurred just before and after the +document that you are looking at. You can do that by expanding the document and +clicking <>. + +[float] +=== Save and share your search + +Finally, its time to save and share your data. You can export your data as a CSV file +or create a direct link to share. The *Save* and *Share* actions are in the menu bar. + + + + -- include::{kib-repo-dir}/discover/set-time-filter.asciidoc[] diff --git a/docs/user/ml/index.asciidoc b/docs/user/ml/index.asciidoc index a2c23aad98d5..cca0dc5e4530 100644 --- a/docs/user/ml/index.asciidoc +++ b/docs/user/ml/index.asciidoc @@ -50,8 +50,8 @@ pane: image::user/ml/images/ml-job-management.jpg[Job Management] You can use the *Settings* pane to create and edit -{stack-ov}/ml-calendars.html[calendars] and the filters that are used in -{stack-ov}/ml-rules.html[custom rules]: +{ml-docs}/ml-calendars.html[calendars] and the filters that are used in +{ml-docs}/ml-rules.html[custom rules]: [role="screenshot"] image::user/ml/images/ml-settings.jpg[Calendar Management] @@ -73,7 +73,7 @@ image::user/ml/images/ml-annotations-list.jpg[Single Metric Viewer with annotati In some circumstances, annotations are also added automatically. For example, if the {anomaly-job} detects that there is missing data, it annotates the affected time period. For more information, see -{stack-ov}/ml-delayed-data-detection.html[Handling delayed data]. The +{ml-docs}/ml-delayed-data-detection.html[Handling delayed data]. The *Job Management* pane shows the full list of annotations for each job. NOTE: The {kib} {ml-features} use pop-ups. You must configure your web @@ -82,7 +82,7 @@ browser so that it does not block pop-up windows or create an exception for your For more information about the {anomaly-detect} feature, see https://www.elastic.co/what-is/elastic-stack-machine-learning[{ml-cap} in the {stack}] -and {stack-ov}/xpack-ml.html[{ml-cap} {anomaly-detect}]. +and {ml-docs}/xpack-ml.html[{ml-cap} {anomaly-detect}]. [[xpack-ml-dfanalytics]] == {dfanalytics-cap} @@ -99,4 +99,4 @@ in {kib}. For example: image::user/ml/images/outliers.jpg[{oldetection-cap} results in {kib}] For more information about the {dfanalytics} feature, see -{stack-ov}/ml-dfanalytics.html[{ml-cap} {dfanalytics}]. \ No newline at end of file +{ml-docs}/ml-dfanalytics.html[{ml-cap} {dfanalytics}]. \ No newline at end of file diff --git a/docs/user/reporting/reporting-troubleshooting.asciidoc b/docs/user/reporting/reporting-troubleshooting.asciidoc index 92464c24b45e..ca7fa6abcc9d 100644 --- a/docs/user/reporting/reporting-troubleshooting.asciidoc +++ b/docs/user/reporting/reporting-troubleshooting.asciidoc @@ -17,6 +17,7 @@ dependencies for Chromium. Make sure Kibana server OS has the appropriate packages installed for the distribution. If you are using CentOS/RHEL systems, install the following packages: + * `ipa-gothic-fonts` * `xorg-x11-fonts-100dpi` * `xorg-x11-fonts-75dpi` @@ -28,6 +29,7 @@ If you are using CentOS/RHEL systems, install the following packages: * `freetype` If you are using Ubuntu/Debian systems, install the following packages: + * `fonts-liberation` * `libfontconfig1` @@ -105,9 +107,10 @@ has its own command-line method to generate its own debug logs, which can someti caused by Kibana or Chromium. See more at https://github.com/GoogleChrome/puppeteer/blob/v1.19.0/README.md#debugging-tips Using Puppeteer's debug method when launching Kibana would look like: -> Enable verbose logging - internal DevTools protocol traffic will be logged via the debug module under the puppeteer namespace. -> ``` -> env DEBUG="puppeteer:*" ./bin/kibana -> ``` +``` +env DEBUG="puppeteer:*" ./bin/kibana +``` +The internal DevTools protocol traffic will be logged via the `debug` module under the `puppeteer` namespace. + The Puppeteer logs are very verbose and could possibly contain sensitive information. Handle the generated output with care. diff --git a/docs/user/reporting/watch-example.asciidoc b/docs/user/reporting/watch-example.asciidoc index 4c769c85975c..627e31017230 100644 --- a/docs/user/reporting/watch-example.asciidoc +++ b/docs/user/reporting/watch-example.asciidoc @@ -56,7 +56,16 @@ report from the Kibana UI. //For more information, see <>. //<>. -NOTE: Reporting is integrated with Watcher only as an email attachment type. +[NOTE] +==== +Reporting is integrated with Watcher only as an email attachment type. + +The report Generation URL might contain date-math expressions +that cause the watch to fail with a `parse_exception`. +Remove curly braces `{` `}` from date-math expressions and +URL-encode characters to avoid this. +For example: `...(range:(%27@timestamp%27:(gte:now-15m%2Fd,lte:now%2Fd))))...` For more information about configuring watches, see {ref}/how-watcher-works.html[How Watcher works]. +==== diff --git a/docs/user/security/authentication/index.asciidoc b/docs/user/security/authentication/index.asciidoc index 32f341a9c1b7..2e2aaf688e8b 100644 --- a/docs/user/security/authentication/index.asciidoc +++ b/docs/user/security/authentication/index.asciidoc @@ -163,7 +163,7 @@ required by {kib}. If you want to use Third Party initiated SSO , then you must + [source,yaml] -------------------------------------------------------------------------------- -server.xsrf.whitelist: [/api/security/v1/oidc] +server.xsrf.whitelist: [/api/security/oidc/initiate_login] -------------------------------------------------------------------------------- [float] diff --git a/docs/user/security/images/reporting-privileges-example.png b/docs/user/security/images/reporting-privileges-example.png new file mode 100644 index 000000000000..d108fe6634fa Binary files /dev/null and b/docs/user/security/images/reporting-privileges-example.png differ diff --git a/docs/user/security/reporting.asciidoc b/docs/user/security/reporting.asciidoc index aaba60ca4b3c..86599be9af37 100644 --- a/docs/user/security/reporting.asciidoc +++ b/docs/user/security/reporting.asciidoc @@ -9,19 +9,60 @@ To use {reporting} with {security} enabled, you need to <>. If you are automatically generating reports with {ref}/xpack-alerting.html[{watcher}], you also need to configure {watcher} -to trust the {kib} server's certificate. For more information, see +to trust the {kib} server's certificate. +//// +For more information, see <>. +//// [[reporting-app-users]] -To enable users to generate reports, assign them the built-in `reporting_user` -role. Users will also need the appropriate <> to access the objects +To enable users to generate reports, you must assign them the built-in `reporting_user` +role. Users will also need the appropriate <> to access the objects to report on and the {es} indices. -* If you're using the `native` realm, you can assign roles through -**Management > Users** UI in Kibana or with the `user` API. For example, -the following request creates a `reporter` user that has the -`reporting_user` role and the `kibana_user` role: +[float] +[[reporting-roles-management-ui]] +=== If you are using the `native` realm + +You can assign roles through the +*Management* app in Kibana or with the <>. +This example shows how to use *Management* to create a user who has a custom role and the +`reporting_user` role. + +. Go to *Management > Roles*, and click *Create role*. + +. Give the new role a name, for example, `custom_reporting_user`. + +. Specify the indices and privileges. + +Access to data is an index-level privilege, so in *Create role*, +add a line for each index that contains the data for the report and give each +index `read` and `view_index_metadata` privileges. +For more information, see {ref}/security-privileges.html[Security privileges]. ++ +[role="screenshot"] +image::user/security/images/reporting-privileges-example.png["Reporting privileges"] + +. Add space privileges. ++ +Reporting users typically save searches, create +visualizations, and build dashboards. They require a space +that provides read and write privileges in +*Discover*, *Visualize*, and *Dashboard*. + +. Save your new role. + +. Create a user account with the proper roles. ++ +Go to *Management > Users*, add a new user, and assign the user the built-in +`reporting_user` role and your new custom role, `custom_reporting_user`. + +[float] +[[reporting-roles-user-api]] +==== With the user API +This example uses the {ref}/security-api-put-user.html[user API] to create a user who has the +`reporting_user` role and the `kibana_user` role: + [source, sh] --------------------------------------------------------------- POST /_security/user/reporter @@ -32,13 +73,17 @@ POST /_security/user/reporter } --------------------------------------------------------------- -* If you are using an LDAP or Active Directory realm, you can either assign +[float] +=== If you are using an external identity provider + +If you are using an external identity provider, such as +LDAP or Active Directory, you can either assign roles on a per user basis, or assign roles to groups of users. By default, role mappings are configured in {ref}/mapping-roles.html[`config/shield/role_mapping.yml`]. For example, the following snippet assigns the user named Bill Murray the `kibana_user` and `reporting_user` roles: -+ + [source,yaml] -------------------------------------------------------------------------------- kibana_user: diff --git a/docs/user/security/securing-kibana.asciidoc b/docs/user/security/securing-kibana.asciidoc index 60f5473f43b9..a68a2ee285ee 100644 --- a/docs/user/security/securing-kibana.asciidoc +++ b/docs/user/security/securing-kibana.asciidoc @@ -59,13 +59,14 @@ For more information, see <>. . Optional: Set a timeout to expire idle sessions. By default, a session stays active until the browser is closed. To define a sliding session expiration, set the `xpack.security.session.idleTimeout` property in the `kibana.yml` -configuration file. The idle timeout is specified in milliseconds. For example, -set the idle timeout to 600000 to expire idle sessions after 10 minutes: +configuration file. The idle timeout is formatted as a duration of +`[ms|s|m|h|d|w|M|Y]` (e.g. '70ms', '5s', '3d', '1Y'). For example, set +the idle timeout to expire idle sessions after 10 minutes: + -- [source,yaml] -------------------------------------------------------------------------------- -xpack.security.session.idleTimeout: 600000 +xpack.security.session.idleTimeout: "10m" -------------------------------------------------------------------------------- -- @@ -74,13 +75,14 @@ the "absolute timeout". By default, a session stays active until the browser is closed. If an idle timeout is defined, a session can still be extended indefinitely. To define a maximum session lifespan, set the `xpack.security.session.lifespan` property in the `kibana.yml` configuration -file. The lifespan is specified in milliseconds. For example, set the lifespan -to 28800000 to expire sessions after 8 hours: +file. The lifespan is formatted as a duration of `[ms|s|m|h|d|w|M|Y]` +(e.g. '70ms', '5s', '3d', '1Y'). For example, set the lifespan to expire +sessions after 8 hours: + -- [source,yaml] -------------------------------------------------------------------------------- -xpack.security.session.lifespan: 28800000 +xpack.security.session.lifespan: "8h" -------------------------------------------------------------------------------- -- diff --git a/docs/visualize/lens.asciidoc b/docs/visualize/lens.asciidoc index 086f88c636c8..e61895a29891 100644 --- a/docs/visualize/lens.asciidoc +++ b/docs/visualize/lens.asciidoc @@ -60,7 +60,7 @@ The summary shows the distribution of values in the time range. To view the data information, navigate to a data field, then click *i*. [role="screenshot"] -image::images/lens_data_info.gif[] +image::images/lens_data_info.png[] [float] [[change-the-visualization-type]] diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000000..7cade0b35f82 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,8 @@ +## Example plugins + +This folder contains example plugins. To run the plugins in this folder, use the `--run-examples` flag, via + +``` +yarn start --run-examples +``` + diff --git a/examples/demo_search/README.md b/examples/demo_search/README.md new file mode 100644 index 000000000000..f0b461e3287b --- /dev/null +++ b/examples/demo_search/README.md @@ -0,0 +1,8 @@ +## Demo search strategy + +This example registers a custom search strategy that simply takes a name string in the request and returns the +string `Hello {name}` + +To see the demo search strategy in action, navigate to the `Search explorer` app. + +To run these examples, use the command `yarn start --run-examples`. \ No newline at end of file diff --git a/examples/demo_search/common/index.ts b/examples/demo_search/common/index.ts new file mode 100644 index 000000000000..6587ee96ef61 --- /dev/null +++ b/examples/demo_search/common/index.ts @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IKibanaSearchRequest, IKibanaSearchResponse } from '../../../src/plugins/data/public'; + +export const DEMO_SEARCH_STRATEGY = 'DEMO_SEARCH_STRATEGY'; + +export interface IDemoRequest extends IKibanaSearchRequest { + mood: string | 'sad' | 'happy'; + name: string; +} + +export interface IDemoResponse extends IKibanaSearchResponse { + greeting: string; +} diff --git a/test/plugin_functional/plugins/demo_search/kibana.json b/examples/demo_search/kibana.json similarity index 100% rename from test/plugin_functional/plugins/demo_search/kibana.json rename to examples/demo_search/kibana.json diff --git a/examples/demo_search/package.json b/examples/demo_search/package.json new file mode 100644 index 000000000000..d29ad55b32db --- /dev/null +++ b/examples/demo_search/package.json @@ -0,0 +1,17 @@ +{ + "name": "demo_data_search", + "version": "1.0.0", + "main": "target/examples/demo_data_search", + "kibana": { + "version": "kibana", + "templateVersion": "1.0.0" + }, + "license": "Apache-2.0", + "scripts": { + "kbn": "node ../../scripts/kbn.js", + "build": "rm -rf './target' && tsc" + }, + "devDependencies": { + "typescript": "3.7.2" + } +} diff --git a/examples/demo_search/public/demo_search_strategy.ts b/examples/demo_search/public/demo_search_strategy.ts new file mode 100644 index 000000000000..d2854151e14c --- /dev/null +++ b/examples/demo_search/public/demo_search_strategy.ts @@ -0,0 +1,68 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Observable } from 'rxjs'; +import { + ISearchContext, + SYNC_SEARCH_STRATEGY, + ISearchGeneric, +} from '../../../src/plugins/data/public'; +import { TSearchStrategyProvider, ISearchStrategy } from '../../../src/plugins/data/public'; + +import { DEMO_SEARCH_STRATEGY, IDemoResponse } from '../common'; + +/** + * This demo search strategy provider simply provides a shortcut for calling the DEMO_SEARCH_STRATEGY + * on the server side, without users having to pass it in explicitly, and it takes advantage of the + * already registered SYNC_SEARCH_STRATEGY that exists on the client. + * + * so instead of callers having to do: + * + * ``` + * context.search( + * { ...request, serverStrategy: DEMO_SEARCH_STRATEGY }, + * options, + * SYNC_SEARCH_STRATEGY + * ) as Observable, + *``` + + * They can instead just do + * + * ``` + * context.search(request, options, DEMO_SEARCH_STRATEGY); + * ``` + * + * and are ensured type safety in regard to the request and response objects. + * + * @param context - context supplied by other plugins. + * @param search - a search function to access other strategies that have already been registered. + */ +export const demoClientSearchStrategyProvider: TSearchStrategyProvider = ( + context: ISearchContext, + search: ISearchGeneric +): ISearchStrategy => { + return { + search: (request, options) => + search( + { ...request, serverStrategy: DEMO_SEARCH_STRATEGY }, + options, + SYNC_SEARCH_STRATEGY + ) as Observable, + }; +}; diff --git a/test/plugin_functional/plugins/demo_search/public/index.ts b/examples/demo_search/public/index.ts similarity index 100% rename from test/plugin_functional/plugins/demo_search/public/index.ts rename to examples/demo_search/public/index.ts diff --git a/examples/demo_search/public/plugin.ts b/examples/demo_search/public/plugin.ts new file mode 100644 index 000000000000..81ba585b9919 --- /dev/null +++ b/examples/demo_search/public/plugin.ts @@ -0,0 +1,61 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { DataPublicPluginSetup } from '../../../src/plugins/data/public'; +import { Plugin, CoreSetup, PluginInitializerContext } from '../../../src/core/public'; +import { DEMO_SEARCH_STRATEGY } from '../common'; +import { demoClientSearchStrategyProvider } from './demo_search_strategy'; +import { IDemoRequest, IDemoResponse } from '../common'; + +interface DemoDataSearchSetupDependencies { + data: DataPublicPluginSetup; +} + +/** + * Add the typescript mappings for our search strategy to the request and + * response types. This allows typescript to require the right shapes if + * making the call: + * const response = context.search.search(request, {}, DEMO_SEARCH_STRATEGY); + * + * If the caller does not pass in the right `request` shape, typescript will + * complain. The caller will also get a typed response. + */ +declare module '../../../src/plugins/data/public' { + export interface IRequestTypesMap { + [DEMO_SEARCH_STRATEGY]: IDemoRequest; + } + + export interface IResponseTypesMap { + [DEMO_SEARCH_STRATEGY]: IDemoResponse; + } +} + +export class DemoDataPlugin implements Plugin { + constructor(private initializerContext: PluginInitializerContext) {} + public setup(core: CoreSetup, deps: DemoDataSearchSetupDependencies) { + deps.data.search.registerSearchStrategyProvider( + this.initializerContext.opaqueId, + DEMO_SEARCH_STRATEGY, + demoClientSearchStrategyProvider + ); + } + + public start() {} + public stop() {} +} diff --git a/examples/demo_search/server/demo_search_strategy.ts b/examples/demo_search/server/demo_search_strategy.ts new file mode 100644 index 000000000000..5b0883be1fc5 --- /dev/null +++ b/examples/demo_search/server/demo_search_strategy.ts @@ -0,0 +1,34 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { TSearchStrategyProvider } from '../../../src/plugins/data/server'; +import { DEMO_SEARCH_STRATEGY } from '../common'; + +export const demoSearchStrategyProvider: TSearchStrategyProvider = () => { + return { + search: request => { + return Promise.resolve({ + greeting: + request.mood === 'happy' + ? `Lovely to meet you, ${request.name}` + : `Hope you feel better, ${request.name}`, + }); + }, + }; +}; diff --git a/test/plugin_functional/plugins/demo_search/server/index.ts b/examples/demo_search/server/index.ts similarity index 100% rename from test/plugin_functional/plugins/demo_search/server/index.ts rename to examples/demo_search/server/index.ts diff --git a/examples/demo_search/server/plugin.ts b/examples/demo_search/server/plugin.ts new file mode 100644 index 000000000000..23c82225563c --- /dev/null +++ b/examples/demo_search/server/plugin.ts @@ -0,0 +1,61 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Plugin, CoreSetup, PluginInitializerContext } from 'kibana/server'; +import { DataPluginSetup } from 'src/plugins/data/server/plugin'; +import { demoSearchStrategyProvider } from './demo_search_strategy'; +import { DEMO_SEARCH_STRATEGY, IDemoRequest, IDemoResponse } from '../common'; + +interface IDemoSearchExplorerDeps { + data: DataPluginSetup; +} + +/** + * Add the typescript mappings for our search strategy to the request and + * response types. This allows typescript to require the right shapes if + * making the call: + * const response = context.search.search(request, DEMO_SEARCH_STRATEGY); + * + * If the caller does not pass in the right `request` shape, typescript will + * complain. The caller will also get a typed response. + */ +declare module '../../../src/plugins/data/server' { + export interface IRequestTypesMap { + [DEMO_SEARCH_STRATEGY]: IDemoRequest; + } + + export interface IResponseTypesMap { + [DEMO_SEARCH_STRATEGY]: IDemoResponse; + } +} + +export class DemoDataPlugin implements Plugin { + constructor(private initializerContext: PluginInitializerContext) {} + + public setup(core: CoreSetup, deps: IDemoSearchExplorerDeps) { + deps.data.search.registerSearchStrategyProvider( + this.initializerContext.opaqueId, + DEMO_SEARCH_STRATEGY, + demoSearchStrategyProvider + ); + } + + public start() {} + public stop() {} +} diff --git a/examples/demo_search/tsconfig.json b/examples/demo_search/tsconfig.json new file mode 100644 index 000000000000..7fa03739119b --- /dev/null +++ b/examples/demo_search/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./target", + "skipLibCheck": true + }, + "include": [ + "index.ts", + "common/**/*.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../typings/**/*" + ], + "exclude": [] +} diff --git a/examples/embeddable_examples/kibana.json b/examples/embeddable_examples/kibana.json new file mode 100644 index 000000000000..c70bc7009ff5 --- /dev/null +++ b/examples/embeddable_examples/kibana.json @@ -0,0 +1,10 @@ +{ + "id": "embeddableExamples", + "version": "0.0.1", + "kibanaVersion": "kibana", + "configPath": ["embeddable_examples"], + "server": false, + "ui": true, + "requiredPlugins": ["embeddable"], + "optionalPlugins": [] +} diff --git a/examples/embeddable_examples/package.json b/examples/embeddable_examples/package.json new file mode 100644 index 000000000000..055ee6d73151 --- /dev/null +++ b/examples/embeddable_examples/package.json @@ -0,0 +1,17 @@ +{ + "name": "embeddable_examples", + "version": "1.0.0", + "main": "target/examples/embeddable_examples", + "kibana": { + "version": "kibana", + "templateVersion": "1.0.0" + }, + "license": "Apache-2.0", + "scripts": { + "kbn": "node ../../scripts/kbn.js", + "build": "rm -rf './target' && tsc" + }, + "devDependencies": { + "typescript": "3.7.2" + } +} diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx b/examples/embeddable_examples/public/hello_world/hello_world_embeddable.tsx similarity index 92% rename from src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx rename to examples/embeddable_examples/public/hello_world/hello_world_embeddable.tsx index dc41eb037caf..f2839f1bc984 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx +++ b/examples/embeddable_examples/public/hello_world/hello_world_embeddable.tsx @@ -16,14 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -import { Embeddable, EmbeddableInput, IContainer } from '../../..'; +import { Embeddable, EmbeddableInput, IContainer } from '../../../../src/plugins/embeddable/public'; -export const HELLO_WORLD_EMBEDDABLE_TYPE = 'HELLO_WORLD_EMBEDDABLE_TYPE'; +export const HELLO_WORLD_EMBEDDABLE = 'HELLO_WORLD_EMBEDDABLE'; export class HelloWorldEmbeddable extends Embeddable { // The type of this embeddable. This will be used to find the appropriate factory // to instantiate this kind of embeddable. - public readonly type = HELLO_WORLD_EMBEDDABLE_TYPE; + public readonly type = HELLO_WORLD_EMBEDDABLE; constructor(initialInput: EmbeddableInput, parent?: IContainer) { super( diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts b/examples/embeddable_examples/public/hello_world/hello_world_embeddable_factory.ts similarity index 80% rename from src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts rename to examples/embeddable_examples/public/hello_world/hello_world_embeddable_factory.ts index 6007d5a0aca6..de5a3d9380de 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts +++ b/examples/embeddable_examples/public/hello_world/hello_world_embeddable_factory.ts @@ -18,11 +18,15 @@ */ import { i18n } from '@kbn/i18n'; -import { IContainer, EmbeddableInput, EmbeddableFactory } from '../../..'; -import { HelloWorldEmbeddable, HELLO_WORLD_EMBEDDABLE_TYPE } from './hello_world_embeddable'; +import { + IContainer, + EmbeddableInput, + EmbeddableFactory, +} from '../../../../src/plugins/embeddable/public'; +import { HelloWorldEmbeddable, HELLO_WORLD_EMBEDDABLE } from './hello_world_embeddable'; export class HelloWorldEmbeddableFactory extends EmbeddableFactory { - public readonly type = HELLO_WORLD_EMBEDDABLE_TYPE; + public readonly type = HELLO_WORLD_EMBEDDABLE; /** * In our simple example, we let everyone have permissions to edit this. Most @@ -38,7 +42,7 @@ export class HelloWorldEmbeddableFactory extends EmbeddableFactory { } public getDisplayName() { - return i18n.translate('embeddableApi.samples.helloworld.displayName', { + return i18n.translate('embeddableExamples.helloworld.displayName', { defaultMessage: 'hello world', }); } diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/index.ts b/examples/embeddable_examples/public/hello_world/index.ts similarity index 100% rename from src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/index.ts rename to examples/embeddable_examples/public/hello_world/index.ts diff --git a/examples/embeddable_examples/public/index.ts b/examples/embeddable_examples/public/index.ts new file mode 100644 index 000000000000..1c2c3911d100 --- /dev/null +++ b/examples/embeddable_examples/public/index.ts @@ -0,0 +1,34 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { PluginInitializer } from 'kibana/public'; +export { + HELLO_WORLD_EMBEDDABLE, + HelloWorldEmbeddable, + HelloWorldEmbeddableFactory, +} from './hello_world'; +export { ListContainer, LIST_CONTAINER } from './list_container'; +export { TODO_EMBEDDABLE } from './todo'; + +import { EmbeddableExamplesPlugin } from './plugin'; + +export { SearchableListContainer, SEARCHABLE_LIST_CONTAINER } from './searchable_list_container'; +export { MULTI_TASK_TODO_EMBEDDABLE } from './multi_task_todo'; + +export const plugin: PluginInitializer = () => new EmbeddableExamplesPlugin(); diff --git a/examples/embeddable_examples/public/list_container/embeddable_list_item.tsx b/examples/embeddable_examples/public/list_container/embeddable_list_item.tsx new file mode 100644 index 000000000000..2c80cef8a636 --- /dev/null +++ b/examples/embeddable_examples/public/list_container/embeddable_list_item.tsx @@ -0,0 +1,64 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { EuiPanel, EuiLoadingSpinner, EuiFlexItem } from '@elastic/eui'; +import { IEmbeddable } from '../../../../src/plugins/embeddable/public'; + +interface Props { + embeddable: IEmbeddable; +} + +export class EmbeddableListItem extends React.Component { + private embeddableRoot: React.RefObject; + private rendered = false; + + constructor(props: Props) { + super(props); + this.embeddableRoot = React.createRef(); + } + + public componentDidMount() { + if (this.embeddableRoot.current && this.props.embeddable) { + this.props.embeddable.render(this.embeddableRoot.current); + this.rendered = true; + } + } + + public componentDidUpdate() { + if (this.embeddableRoot.current && this.props.embeddable && !this.rendered) { + this.props.embeddable.render(this.embeddableRoot.current); + this.rendered = true; + } + } + + public render() { + return ( + + + {this.props.embeddable ? ( +

+ ) : ( + + )} + + + ); + } +} diff --git a/examples/embeddable_examples/public/list_container/index.ts b/examples/embeddable_examples/public/list_container/index.ts new file mode 100644 index 000000000000..581739f6b545 --- /dev/null +++ b/examples/embeddable_examples/public/list_container/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { ListContainer, LIST_CONTAINER } from './list_container'; +export { ListContainerFactory } from './list_container_factory'; diff --git a/examples/embeddable_examples/public/list_container/list_container.tsx b/examples/embeddable_examples/public/list_container/list_container.tsx new file mode 100644 index 000000000000..35a674a03573 --- /dev/null +++ b/examples/embeddable_examples/public/list_container/list_container.tsx @@ -0,0 +1,57 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { + Container, + ContainerInput, + GetEmbeddableFactory, +} from '../../../../src/plugins/embeddable/public'; +import { ListContainerComponent } from './list_container_component'; + +export const LIST_CONTAINER = 'LIST_CONTAINER'; + +export class ListContainer extends Container<{}, ContainerInput> { + public readonly type = LIST_CONTAINER; + private node?: HTMLElement; + + constructor(input: ContainerInput, getEmbeddableFactory: GetEmbeddableFactory) { + super(input, { embeddableLoaded: {} }, getEmbeddableFactory); + } + + // This container has no input itself. + getInheritedInput(id: string) { + return {}; + } + + public render(node: HTMLElement) { + this.node = node; + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + ReactDOM.render(, node); + } + + public destroy() { + super.destroy(); + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + } +} diff --git a/examples/embeddable_examples/public/list_container/list_container_component.tsx b/examples/embeddable_examples/public/list_container/list_container_component.tsx new file mode 100644 index 000000000000..f6e04933ee89 --- /dev/null +++ b/examples/embeddable_examples/public/list_container/list_container_component.tsx @@ -0,0 +1,74 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; + +import { EuiFlexGroup, EuiSpacer, EuiFlexItem, EuiText, EuiPanel } from '@elastic/eui'; +import { + IContainer, + withEmbeddableSubscription, + ContainerInput, + ContainerOutput, +} from '../../../../src/plugins/embeddable/public'; +import { EmbeddableListItem } from './embeddable_list_item'; + +interface Props { + embeddable: IContainer; + input: ContainerInput; + output: ContainerOutput; +} + +function renderList(embeddable: IContainer, panels: ContainerInput['panels']) { + let number = 0; + const list = Object.values(panels).map(panel => { + const child = embeddable.getChild(panel.explicitInput.id); + number++; + return ( + + + + +

{number}

+
+
+ + + +
+
+ ); + }); + return list; +} + +export function ListContainerComponentInner(props: Props) { + return ( +
+

{props.embeddable.getTitle()}

+ + {renderList(props.embeddable, props.input.panels)} +
+ ); +} + +// You don't have to use this helper wrapper, but it handles a lot of the React boilerplate for +// embeddables, like setting up the subscriptions to cause the component to refresh whenever +// anything on input or output state changes. If you don't want that to happen (for example +// if you expect something on input or output state to change frequently that your react +// component does not care about, then you should probably hook this up manually). +export const ListContainerComponent = withEmbeddableSubscription(ListContainerComponentInner); diff --git a/examples/embeddable_examples/public/list_container/list_container_factory.ts b/examples/embeddable_examples/public/list_container/list_container_factory.ts new file mode 100644 index 000000000000..de6b7d5f5e50 --- /dev/null +++ b/examples/embeddable_examples/public/list_container/list_container_factory.ts @@ -0,0 +1,49 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@kbn/i18n'; +import { + EmbeddableFactory, + GetEmbeddableFactory, + ContainerInput, +} from '../../../../src/plugins/embeddable/public'; +import { LIST_CONTAINER, ListContainer } from './list_container'; + +export class ListContainerFactory extends EmbeddableFactory { + public readonly type = LIST_CONTAINER; + public readonly isContainerType = true; + + constructor(private getEmbeddableFactory: GetEmbeddableFactory) { + super(); + } + + public isEditable() { + return true; + } + + public async create(initialInput: ContainerInput) { + return new ListContainer(initialInput, this.getEmbeddableFactory); + } + + public getDisplayName() { + return i18n.translate('embeddableExamples.searchableListContainer.displayName', { + defaultMessage: 'List container', + }); + } +} diff --git a/examples/embeddable_examples/public/multi_task_todo/index.ts b/examples/embeddable_examples/public/multi_task_todo/index.ts new file mode 100644 index 000000000000..2063bf2c0622 --- /dev/null +++ b/examples/embeddable_examples/public/multi_task_todo/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './multi_task_todo_embeddable'; +export * from './multi_task_todo_embeddable_factory'; diff --git a/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_component.tsx b/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_component.tsx new file mode 100644 index 000000000000..e33dfab0eaf4 --- /dev/null +++ b/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_component.tsx @@ -0,0 +1,94 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; + +import { + EuiText, + EuiAvatar, + EuiIcon, + EuiFlexGrid, + EuiListGroup, + EuiListGroupItem, +} from '@elastic/eui'; +import { withEmbeddableSubscription } from '../../../../src/plugins/embeddable/public'; +import { + MultiTaskTodoEmbeddable, + MultiTaskTodoOutput, + MultiTaskTodoInput, +} from './multi_task_todo_embeddable'; + +interface Props { + embeddable: MultiTaskTodoEmbeddable; + input: MultiTaskTodoInput; + output: MultiTaskTodoOutput; +} + +function wrapSearchTerms(task: string, search?: string) { + if (!search) return task; + const parts = task.split(new RegExp(`(${search})`, 'g')); + return parts.map((part, i) => + part === search ? ( + + {part} + + ) : ( + part + ) + ); +} + +function renderTasks(tasks: MultiTaskTodoOutput['tasks'], search?: string) { + return tasks.map(task => ( + + )); +} + +export function MultiTaskTodoEmbeddableComponentInner({ + input: { title, icon, search }, + output: { tasks }, +}: Props) { + return ( + + + {icon ? : } + + + + + +

{wrapSearchTerms(title, search)}

+
+
+ + {renderTasks(tasks, search)} + +
+
+
+ ); +} + +export const MultiTaskTodoEmbeddableComponent = withEmbeddableSubscription( + MultiTaskTodoEmbeddableComponentInner +); diff --git a/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_embeddable.tsx b/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_embeddable.tsx new file mode 100644 index 000000000000..a2197c9c06fe --- /dev/null +++ b/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_embeddable.tsx @@ -0,0 +1,99 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Subscription } from 'rxjs'; +import { + Embeddable, + EmbeddableInput, + IContainer, + EmbeddableOutput, +} from '../../../../src/plugins/embeddable/public'; +import { MultiTaskTodoEmbeddableComponent } from './multi_task_todo_component'; + +export const MULTI_TASK_TODO_EMBEDDABLE = 'MULTI_TASK_TODO_EMBEDDABLE'; + +export interface MultiTaskTodoInput extends EmbeddableInput { + tasks: string[]; + icon?: string; + search?: string; + title: string; +} + +// This embeddable has output! It's the tasks list that is filtered. +// Output state is something only the embeddable itself can update. It +// can be something completely internal, or it can be state that is +// derived from input state and updates when input does. +export interface MultiTaskTodoOutput extends EmbeddableOutput { + tasks: string[]; +} + +function getFilteredTasks(tasks: string[], search?: string) { + const filteredTasks: string[] = []; + if (search === undefined) return tasks; + + tasks.forEach(task => { + if (task.match(search)) { + filteredTasks.push(task); + } + }); + + return filteredTasks; +} + +function getOutput(input: MultiTaskTodoInput) { + const tasks = getFilteredTasks(input.tasks, input.search); + return { tasks, hasMatch: tasks.length > 0 || (input.search && input.title.match(input.search)) }; +} + +export class MultiTaskTodoEmbeddable extends Embeddable { + public readonly type = MULTI_TASK_TODO_EMBEDDABLE; + private subscription: Subscription; + private node?: HTMLElement; + + constructor(initialInput: MultiTaskTodoInput, parent?: IContainer) { + super(initialInput, getOutput(initialInput), parent); + + // If you have any output state that changes as a result of input state changes, you + // should use an subcription. Here, any time input tasks list, or the input filter + // changes, we want to update the output tasks list as well as whether a match has + // been found. + this.subscription = this.getInput$().subscribe(() => { + this.updateOutput(getOutput(this.input)); + }); + } + + public render(node: HTMLElement) { + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + this.node = node; + ReactDOM.render(, node); + } + + public reload() {} + + public destroy() { + super.destroy(); + this.subscription.unsubscribe(); + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + } +} diff --git a/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_embeddable_factory.ts b/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_embeddable_factory.ts new file mode 100644 index 000000000000..37ac63e380f9 --- /dev/null +++ b/examples/embeddable_examples/public/multi_task_todo/multi_task_todo_embeddable_factory.ts @@ -0,0 +1,44 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@kbn/i18n'; +import { IContainer, EmbeddableFactory } from '../../../../src/plugins/embeddable/public'; +import { + MultiTaskTodoEmbeddable, + MULTI_TASK_TODO_EMBEDDABLE, + MultiTaskTodoInput, +} from './multi_task_todo_embeddable'; + +export class MultiTaskTodoEmbeddableFactory extends EmbeddableFactory { + public readonly type = MULTI_TASK_TODO_EMBEDDABLE; + + public isEditable() { + return true; + } + + public async create(initialInput: MultiTaskTodoInput, parent?: IContainer) { + return new MultiTaskTodoEmbeddable(initialInput, parent); + } + + public getDisplayName() { + return i18n.translate('embeddableExamples.multiTaskTodo.displayName', { + defaultMessage: 'Multi-task todo item', + }); + } +} diff --git a/examples/embeddable_examples/public/plugin.ts b/examples/embeddable_examples/public/plugin.ts new file mode 100644 index 000000000000..e75165bfbef1 --- /dev/null +++ b/examples/embeddable_examples/public/plugin.ts @@ -0,0 +1,72 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IEmbeddableSetup, IEmbeddableStart } from '../../../src/plugins/embeddable/public'; +import { Plugin, CoreSetup, CoreStart } from '../../../src/core/public'; +import { HelloWorldEmbeddableFactory, HELLO_WORLD_EMBEDDABLE } from './hello_world'; +import { TODO_EMBEDDABLE, TodoEmbeddableFactory } from './todo'; +import { MULTI_TASK_TODO_EMBEDDABLE, MultiTaskTodoEmbeddableFactory } from './multi_task_todo'; +import { + SEARCHABLE_LIST_CONTAINER, + SearchableListContainerFactory, +} from './searchable_list_container'; +import { LIST_CONTAINER, ListContainerFactory } from './list_container'; + +interface EmbeddableExamplesSetupDependencies { + embeddable: IEmbeddableSetup; +} + +interface EmbeddableExamplesStartDependencies { + embeddable: IEmbeddableStart; +} + +export class EmbeddableExamplesPlugin + implements + Plugin { + public setup(core: CoreSetup, deps: EmbeddableExamplesSetupDependencies) { + deps.embeddable.registerEmbeddableFactory( + HELLO_WORLD_EMBEDDABLE, + new HelloWorldEmbeddableFactory() + ); + + deps.embeddable.registerEmbeddableFactory(TODO_EMBEDDABLE, new TodoEmbeddableFactory()); + + deps.embeddable.registerEmbeddableFactory( + MULTI_TASK_TODO_EMBEDDABLE, + new MultiTaskTodoEmbeddableFactory() + ); + } + + public start(core: CoreStart, deps: EmbeddableExamplesStartDependencies) { + // These are registered in the start method because `getEmbeddableFactory ` + // is only available in start. We could reconsider this I think and make it + // available in both. + deps.embeddable.registerEmbeddableFactory( + SEARCHABLE_LIST_CONTAINER, + new SearchableListContainerFactory(deps.embeddable.getEmbeddableFactory) + ); + + deps.embeddable.registerEmbeddableFactory( + LIST_CONTAINER, + new ListContainerFactory(deps.embeddable.getEmbeddableFactory) + ); + } + + public stop() {} +} diff --git a/examples/embeddable_examples/public/searchable_list_container/index.ts b/examples/embeddable_examples/public/searchable_list_container/index.ts new file mode 100644 index 000000000000..c422fdba5835 --- /dev/null +++ b/examples/embeddable_examples/public/searchable_list_container/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { SearchableListContainer, SEARCHABLE_LIST_CONTAINER } from './searchable_list_container'; +export { SearchableListContainerFactory } from './searchable_list_container_factory'; diff --git a/examples/embeddable_examples/public/searchable_list_container/searchable_list_container.tsx b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container.tsx new file mode 100644 index 000000000000..3079abb867c3 --- /dev/null +++ b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container.tsx @@ -0,0 +1,70 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { + Container, + ContainerInput, + GetEmbeddableFactory, + EmbeddableInput, +} from '../../../../src/plugins/embeddable/public'; +import { SearchableListContainerComponent } from './searchable_list_container_component'; + +export const SEARCHABLE_LIST_CONTAINER = 'SEARCHABLE_LIST_CONTAINER'; + +export interface SearchableContainerInput extends ContainerInput { + search?: string; +} + +interface ChildInput extends EmbeddableInput { + search?: string; +} + +export class SearchableListContainer extends Container { + public readonly type = SEARCHABLE_LIST_CONTAINER; + private node?: HTMLElement; + + constructor(input: SearchableContainerInput, getEmbeddableFactory: GetEmbeddableFactory) { + super(input, { embeddableLoaded: {} }, getEmbeddableFactory); + } + + // TODO: add a more advanced example here where inherited child input is derived from container + // input and not just an exact pass through. + getInheritedInput(id: string) { + return { + id, + search: this.getInput().search, + }; + } + + public render(node: HTMLElement) { + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + this.node = node; + ReactDOM.render(, node); + } + + public destroy() { + super.destroy(); + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + } +} diff --git a/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx new file mode 100644 index 000000000000..b79f86e2a019 --- /dev/null +++ b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_component.tsx @@ -0,0 +1,188 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { Component } from 'react'; + +import { + EuiLoadingSpinner, + EuiButton, + EuiFormRow, + EuiFlexGroup, + EuiSpacer, + EuiFlexItem, + EuiFieldText, + EuiPanel, + EuiCheckbox, +} from '@elastic/eui'; +import * as Rx from 'rxjs'; +import { + withEmbeddableSubscription, + ContainerOutput, + EmbeddableOutput, +} from '../../../../src/plugins/embeddable/public'; +import { EmbeddableListItem } from '../list_container/embeddable_list_item'; +import { SearchableListContainer, SearchableContainerInput } from './searchable_list_container'; + +interface Props { + embeddable: SearchableListContainer; + input: SearchableContainerInput; + output: ContainerOutput; +} + +interface State { + checked: { [key: string]: boolean }; + hasMatch: { [key: string]: boolean }; +} + +interface HasMatchOutput { + hasMatch: boolean; +} + +function hasHasMatchOutput(output: EmbeddableOutput | HasMatchOutput): output is HasMatchOutput { + return (output as HasMatchOutput).hasMatch !== undefined; +} + +export class SearchableListContainerComponentInner extends Component { + private subscriptions: { [id: string]: Rx.Subscription } = {}; + constructor(props: Props) { + super(props); + + const checked: { [id: string]: boolean } = {}; + const hasMatch: { [id: string]: boolean } = {}; + props.embeddable.getChildIds().forEach(id => { + checked[id] = false; + const output = props.embeddable.getChild(id).getOutput(); + hasMatch[id] = hasHasMatchOutput(output) && output.hasMatch; + }); + props.embeddable.getChildIds().forEach(id => (checked[id] = false)); + this.state = { + checked, + hasMatch, + }; + } + + componentDidMount() { + this.props.embeddable.getChildIds().forEach(id => { + this.subscriptions[id] = this.props.embeddable + .getChild(id) + .getOutput$() + .subscribe(output => { + if (hasHasMatchOutput(output)) { + this.setState(prevState => ({ + hasMatch: { + ...prevState.hasMatch, + [id]: output.hasMatch, + }, + })); + } + }); + }); + } + + componentWillUnmount() { + Object.values(this.subscriptions).forEach(sub => sub.unsubscribe()); + } + + private updateSearch = (search: string) => { + this.props.embeddable.updateInput({ search }); + }; + + private deleteChecked = () => { + Object.values(this.props.input.panels).map(panel => { + if (this.state.checked[panel.explicitInput.id]) { + this.props.embeddable.removeEmbeddable(panel.explicitInput.id); + this.subscriptions[panel.explicitInput.id].unsubscribe(); + } + }); + }; + + private toggleCheck = (isChecked: boolean, id: string) => { + this.setState(prevState => ({ checked: { ...prevState.checked, [id]: isChecked } })); + }; + + public renderControls() { + return ( + + + + this.deleteChecked()}> + Delete checked + + + + + + this.updateSearch(ev.target.value)} + /> + + + + + ); + } + + public render() { + const { embeddable } = this.props; + return ( +
+

{embeddable.getTitle()}

+ + {this.renderControls()} + + {this.renderList()} +
+ ); + } + + private renderList() { + let id = 0; + const list = Object.values(this.props.input.panels).map(panel => { + const embeddable = this.props.embeddable.getChild(panel.explicitInput.id); + if (this.props.input.search && !this.state.hasMatch[panel.explicitInput.id]) return; + id++; + return embeddable ? ( + + + + this.toggleCheck(e.target.checked, embeddable.id)} + /> + + + + + + + ) : ( + + ); + }); + return list; + } +} + +export const SearchableListContainerComponent = withEmbeddableSubscription( + SearchableListContainerComponentInner +); diff --git a/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_factory.ts b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_factory.ts new file mode 100644 index 000000000000..359878857eeb --- /dev/null +++ b/examples/embeddable_examples/public/searchable_list_container/searchable_list_container_factory.ts @@ -0,0 +1,49 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@kbn/i18n'; +import { EmbeddableFactory, GetEmbeddableFactory } from '../../../../src/plugins/embeddable/public'; +import { + SEARCHABLE_LIST_CONTAINER, + SearchableListContainer, + SearchableContainerInput, +} from './searchable_list_container'; + +export class SearchableListContainerFactory extends EmbeddableFactory { + public readonly type = SEARCHABLE_LIST_CONTAINER; + public readonly isContainerType = true; + + constructor(private getEmbeddableFactory: GetEmbeddableFactory) { + super(); + } + + public isEditable() { + return true; + } + + public async create(initialInput: SearchableContainerInput) { + return new SearchableListContainer(initialInput, this.getEmbeddableFactory); + } + + public getDisplayName() { + return i18n.translate('embeddableExamples.searchableListContainer.displayName', { + defaultMessage: 'Searchable list container', + }); + } +} diff --git a/examples/embeddable_examples/public/todo/index.ts b/examples/embeddable_examples/public/todo/index.ts new file mode 100644 index 000000000000..cac0b85b40d5 --- /dev/null +++ b/examples/embeddable_examples/public/todo/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './todo_embeddable'; +export * from './todo_embeddable_factory'; diff --git a/examples/embeddable_examples/public/todo/todo_component.tsx b/examples/embeddable_examples/public/todo/todo_component.tsx new file mode 100644 index 000000000000..fbebfc98627b --- /dev/null +++ b/examples/embeddable_examples/public/todo/todo_component.tsx @@ -0,0 +1,74 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; + +import { EuiText } from '@elastic/eui'; +import { EuiAvatar } from '@elastic/eui'; +import { EuiIcon } from '@elastic/eui'; +import { EuiFlexGrid } from '@elastic/eui'; +import { + withEmbeddableSubscription, + EmbeddableOutput, +} from '../../../../src/plugins/embeddable/public'; +import { TodoEmbeddable, TodoInput } from './todo_embeddable'; + +interface Props { + embeddable: TodoEmbeddable; + input: TodoInput; + output: EmbeddableOutput; +} + +function wrapSearchTerms(task: string, search?: string) { + if (!search) return task; + const parts = task.split(new RegExp(`(${search})`, 'g')); + return parts.map((part, i) => + part === search ? ( + + {part} + + ) : ( + part + ) + ); +} + +export function TodoEmbeddableComponentInner({ input: { icon, title, task, search } }: Props) { + return ( + + + {icon ? : } + + + + + +

{wrapSearchTerms(title || '', search)}

+
+
+ + {wrapSearchTerms(task, search)} + +
+
+
+ ); +} + +export const TodoEmbeddableComponent = withEmbeddableSubscription(TodoEmbeddableComponentInner); diff --git a/examples/embeddable_examples/public/todo/todo_embeddable.tsx b/examples/embeddable_examples/public/todo/todo_embeddable.tsx new file mode 100644 index 000000000000..b081253d8634 --- /dev/null +++ b/examples/embeddable_examples/public/todo/todo_embeddable.tsx @@ -0,0 +1,88 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Subscription } from 'rxjs'; +import { + Embeddable, + EmbeddableInput, + IContainer, + EmbeddableOutput, +} from '../../../../src/plugins/embeddable/public'; +import { TodoEmbeddableComponent } from './todo_component'; + +export const TODO_EMBEDDABLE = 'TODO_EMBEDDABLE'; + +export interface TodoInput extends EmbeddableInput { + task: string; + icon?: string; + search?: string; +} + +export interface TodoOutput extends EmbeddableOutput { + hasMatch: boolean; +} + +function getOutput(input: TodoInput): TodoOutput { + return { + hasMatch: input.search + ? Boolean(input.task.match(input.search) || (input.title && input.title.match(input.search))) + : true, + }; +} + +export class TodoEmbeddable extends Embeddable { + // The type of this embeddable. This will be used to find the appropriate factory + // to instantiate this kind of embeddable. + public readonly type = TODO_EMBEDDABLE; + private subscription: Subscription; + private node?: HTMLElement; + + constructor(initialInput: TodoInput, parent?: IContainer) { + super(initialInput, getOutput(initialInput), parent); + + // If you have any output state that changes as a result of input state changes, you + // should use an subcription. Here, we use output to indicate whether this task + // matches the search string. + this.subscription = this.getInput$().subscribe(() => { + this.updateOutput(getOutput(this.input)); + }); + } + + public render(node: HTMLElement) { + this.node = node; + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + ReactDOM.render(, node); + } + + /** + * Not relevant. + */ + public reload() {} + + public destroy() { + super.destroy(); + this.subscription.unsubscribe(); + if (this.node) { + ReactDOM.unmountComponentAtNode(this.node); + } + } +} diff --git a/examples/embeddable_examples/public/todo/todo_embeddable_factory.ts b/examples/embeddable_examples/public/todo/todo_embeddable_factory.ts new file mode 100644 index 000000000000..386b3f296d99 --- /dev/null +++ b/examples/embeddable_examples/public/todo/todo_embeddable_factory.ts @@ -0,0 +1,40 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@kbn/i18n'; +import { IContainer, EmbeddableFactory } from '../../../../src/plugins/embeddable/public'; +import { TodoEmbeddable, TODO_EMBEDDABLE, TodoInput } from './todo_embeddable'; + +export class TodoEmbeddableFactory extends EmbeddableFactory { + public readonly type = TODO_EMBEDDABLE; + + public isEditable() { + return true; + } + + public async create(initialInput: TodoInput, parent?: IContainer) { + return new TodoEmbeddable(initialInput, parent); + } + + public getDisplayName() { + return i18n.translate('embeddableExamples.todo.displayName', { + defaultMessage: 'Todo item', + }); + } +} diff --git a/examples/embeddable_examples/tsconfig.json b/examples/embeddable_examples/tsconfig.json new file mode 100644 index 000000000000..091130487791 --- /dev/null +++ b/examples/embeddable_examples/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./target", + "skipLibCheck": true + }, + "include": [ + "index.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../typings/**/*" + ], + "exclude": [] +} diff --git a/examples/embeddable_explorer/kibana.json b/examples/embeddable_explorer/kibana.json new file mode 100644 index 000000000000..4ca63e1a3624 --- /dev/null +++ b/examples/embeddable_explorer/kibana.json @@ -0,0 +1,10 @@ +{ + "id": "embeddableExplorer", + "version": "0.0.1", + "kibanaVersion": "kibana", + "configPath": ["embeddable_explorer"], + "server": false, + "ui": true, + "requiredPlugins": ["embeddable", "embeddableExamples"], + "optionalPlugins": [] +} diff --git a/examples/embeddable_explorer/package.json b/examples/embeddable_explorer/package.json new file mode 100644 index 000000000000..771c5c9be9c0 --- /dev/null +++ b/examples/embeddable_explorer/package.json @@ -0,0 +1,17 @@ +{ + "name": "embeddable_explorer", + "version": "1.0.0", + "main": "target/examples/embeddable_explorer", + "kibana": { + "version": "kibana", + "templateVersion": "1.0.0" + }, + "license": "Apache-2.0", + "scripts": { + "kbn": "node ../../scripts/kbn.js", + "build": "rm -rf './target' && tsc" + }, + "devDependencies": { + "typescript": "3.7.2" + } +} diff --git a/examples/embeddable_explorer/public/app.tsx b/examples/embeddable_explorer/public/app.tsx new file mode 100644 index 000000000000..be27fd04556e --- /dev/null +++ b/examples/embeddable_explorer/public/app.tsx @@ -0,0 +1,126 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { BrowserRouter as Router, Route, withRouter, RouteComponentProps } from 'react-router-dom'; + +import { EuiPage, EuiPageSideBar, EuiSideNav } from '@elastic/eui'; + +import { IEmbeddableStart } from 'src/plugins/embeddable/public'; +import { AppMountContext, AppMountParameters, CoreStart } from '../../../src/core/public'; +import { HelloWorldEmbeddableExample } from './hello_world_embeddable_example'; +import { TodoEmbeddableExample } from './todo_embeddable_example'; +import { ListContainerExample } from './list_container_example'; + +interface PageDef { + title: string; + id: string; + component: React.ReactNode; +} + +type NavProps = RouteComponentProps & { + navigateToApp: AppMountContext['core']['application']['navigateToApp']; + pages: PageDef[]; +}; + +const Nav = withRouter(({ history, navigateToApp, pages }: NavProps) => { + const navItems = pages.map(page => ({ + id: page.id, + name: page.title, + onClick: () => history.push(`/${page.id}`), + 'data-test-subj': page.id, + })); + + return ( + + ); +}); + +const EmbeddableExplorerApp = ({ + basename, + navigateToApp, + embeddableApi, +}: { + basename: string; + navigateToApp: CoreStart['application']['navigateToApp']; + embeddableApi: IEmbeddableStart; +}) => { + const pages: PageDef[] = [ + { + title: 'Hello world embeddable', + id: 'helloWorldEmbeddableSection', + component: ( + + ), + }, + { + title: 'Todo embeddable', + id: 'todoEmbeddableSection', + component: ( + + ), + }, + { + title: 'List container embeddable', + id: 'listContainerSection', + component: , + }, + ]; + + const routes = pages.map((page, i) => ( + page.component} /> + )); + + return ( + + + +