Skip to content

Commit

Permalink
Merge branch 'master' into apm-70440-anomaly-detection-setup-link
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 10, 2020
2 parents b2bc73b + c00359e commit e7857ea
Show file tree
Hide file tree
Showing 1,142 changed files with 21,926 additions and 7,289 deletions.
1 change: 1 addition & 0 deletions .ci/Jenkinsfile_visual_baseline
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ kibanaPipeline(timeoutMinutes: 120) {
}

kibanaPipeline.sendMail()
slackNotifications.onFailure()
}
}
2 changes: 1 addition & 1 deletion .ci/packer_cache_for_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ echo "Creating bootstrap_cache archive"
# archive cacheable directories
mkdir -p "$HOME/.kibana/bootstrap_cache"
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
x-pack/plugins/reporting/.chromium \
.chromium \
.es \
.chromedriver \
.geckodriver;
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/*.js.snap
**/graphql/types.ts
/.es
/.chromium
/build
/built_assets
/config/apm.dev.js
Expand Down
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,18 @@ module.exports = {
},
},

/**
* Enterprise Search overrides
*/
{
files: ['x-pack/plugins/enterprise_search/**/*.{ts,tsx}'],
excludedFiles: ['x-pack/plugins/enterprise_search/**/*.{test,mock}.{ts,tsx}'],
rules: {
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/no-explicit-any': 'error',
},
},

/**
* disable jsx-a11y for kbn-ui-framework
*/
Expand Down
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
# Design
**/*.scss @elastic/kibana-design

# Enterprise Search
/x-pack/plugins/enterprise_search/ @elastic/app-search-frontend @elastic/workplace-search-frontend
/x-pack/test/functional_enterprise_search/ @elastic/app-search-frontend @elastic/workplace-search-frontend
/x-pack/plugins/enterprise_search/**/*.scss @elastic/ent-search-design

# Elasticsearch UI
/src/plugins/dev_tools/ @elastic/es-ui
/src/plugins/console/ @elastic/es-ui
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.signing-config.json
.ackrc
/.es
/.chromium
.DS_Store
.node_binaries
.native_modules
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions docs/developer/testing/interpreting-ci-failures.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Clicking the link next to the check in the conversation tab of a pull request wi

To view the results of a job execution in Jenkins, either click the link in the comment left by `@elasticmachine` or search for the `kibana-ci` check in the list at the bottom of the PR. This link will take you to the top-level page for the specific job execution that failed.

image::images/jenkins/job_view.png[]
image::images/job_view.png[]

1. *Git Changes:* the list of commits that were in this build which weren't in the previous build. For Pull Requests this list is calculated by comparing against the most recent Pull Request which was tested, it is not limited to build for this specific Pull Request, so it's not very useful.
2. *Test Results:* A link to the test results screen, and shortcuts to the failed tests. Functional tests capture and store the log output from each specific test, and make it visible at these links. For other test runners only the error message is visible and log output must be tracked down in the *Pipeline Steps*.
Expand All @@ -29,6 +29,6 @@ image::images/jenkins/job_view.png[]

To view the logs for a failed specific ciGroup, jest, mocha, type checkers, linters, etc., click on the *Pipeline Steps* link in from the Job page.

image::images/jenkins/pipeline_steps_view.png[]
image::images/pipeline_steps_view.png[]

Scroll down the page until you find a failed step *(1)*, and then look up a few lines for the `Branch:` step to see which specific job this is. If this is the job you're looking for click the little terminal icon next to the failed step *(1)* to view the logs for that specific step in the Pipeline.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export interface DiscoveredPlugin
| [configPath](./kibana-plugin-core-server.discoveredplugin.configpath.md) | <code>ConfigPath</code> | Root configuration path used by the plugin, defaults to "id" in snake\_case format. |
| [id](./kibana-plugin-core-server.discoveredplugin.id.md) | <code>PluginName</code> | Identifier of the plugin. |
| [optionalPlugins](./kibana-plugin-core-server.discoveredplugin.optionalplugins.md) | <code>readonly PluginName[]</code> | An optional list of the other plugins that if installed and enabled \*\*may be\*\* leveraged by this plugin for some additional functionality but otherwise are not required for this plugin to work properly. |
| [requiredBundles](./kibana-plugin-core-server.discoveredplugin.requiredbundles.md) | <code>readonly PluginName[]</code> | List of plugin ids that this plugin's UI code imports modules from that are not in <code>requiredPlugins</code>. |
| [requiredPlugins](./kibana-plugin-core-server.discoveredplugin.requiredplugins.md) | <code>readonly PluginName[]</code> | An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DiscoveredPlugin](./kibana-plugin-core-server.discoveredplugin.md) &gt; [requiredBundles](./kibana-plugin-core-server.discoveredplugin.requiredbundles.md)

## DiscoveredPlugin.requiredBundles property

List of plugin ids that this plugin's UI code imports modules from that are not in `requiredPlugins`<!-- -->.

<b>Signature:</b>

```typescript
readonly requiredBundles: readonly PluginName[];
```

## Remarks

The plugins listed here will be loaded in the browser, even if the plugin is disabled. Required by `@kbn/optimizer` to support cross-plugin imports. "core" and plugins already listed in `requiredPlugins` do not need to be duplicated here.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Should never be used in code outside of Core but is exported for documentation p
| [id](./kibana-plugin-core-server.pluginmanifest.id.md) | <code>PluginName</code> | Identifier of the plugin. Must be a string in camelCase. Part of a plugin public contract. Other plugins leverage it to access plugin API, navigate to the plugin, etc. |
| [kibanaVersion](./kibana-plugin-core-server.pluginmanifest.kibanaversion.md) | <code>string</code> | The version of Kibana the plugin is compatible with, defaults to "version". |
| [optionalPlugins](./kibana-plugin-core-server.pluginmanifest.optionalplugins.md) | <code>readonly PluginName[]</code> | An optional list of the other plugins that if installed and enabled \*\*may be\*\* leveraged by this plugin for some additional functionality but otherwise are not required for this plugin to work properly. |
| [requiredBundles](./kibana-plugin-core-server.pluginmanifest.requiredbundles.md) | <code>readonly string[]</code> | List of plugin ids that this plugin's UI code imports modules from that are not in <code>requiredPlugins</code>. |
| [requiredPlugins](./kibana-plugin-core-server.pluginmanifest.requiredplugins.md) | <code>readonly PluginName[]</code> | An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. |
| [server](./kibana-plugin-core-server.pluginmanifest.server.md) | <code>boolean</code> | Specifies whether plugin includes some server-side specific functionality. |
| [ui](./kibana-plugin-core-server.pluginmanifest.ui.md) | <code>boolean</code> | Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via <code>public/ui_plugin.js</code> file. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [PluginManifest](./kibana-plugin-core-server.pluginmanifest.md) &gt; [requiredBundles](./kibana-plugin-core-server.pluginmanifest.requiredbundles.md)

## PluginManifest.requiredBundles property

List of plugin ids that this plugin's UI code imports modules from that are not in `requiredPlugins`<!-- -->.

<b>Signature:</b>

```typescript
readonly requiredBundles: readonly string[];
```

## Remarks

The plugins listed here will be loaded in the browser, even if the plugin is disabled. Required by `@kbn/optimizer` to support cross-plugin imports. "core" and plugins already listed in `requiredPlugins` do not need to be duplicated here.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed docs/images/AddFieldButton.jpg
Diff not rendered.
Binary file removed docs/images/CollapseButton.jpg
Diff not rendered.
Binary file removed docs/images/Dashboard_Resize_Menu.png
Diff not rendered.
Binary file removed docs/images/Dashboard_visualization_data.png
Diff not rendered.
Binary file removed docs/images/Discover-ContextView-FilterMontage.png
Diff not rendered.
Binary file removed docs/images/Discover-FieldStats.jpg
Diff not rendered.
Binary file removed docs/images/Discover-MoveColumn.jpg
Diff not rendered.
Binary file removed docs/images/EditVis.png
Diff not rendered.
Binary file removed docs/images/ExistsButton.jpg
Diff not rendered.
Binary file removed docs/images/ExpandButton.jpg
Diff not rendered.
Binary file removed docs/images/NYCTA-Table.jpg
Diff not rendered.
Binary file removed docs/images/NewDashboard.png
Diff not rendered.
Binary file removed docs/images/RemoveFieldButton.jpg
Diff not rendered.
Binary file removed docs/images/Start-Page.png
Diff not rendered.
Binary file removed docs/images/TimeFilter.jpg
Diff not rendered.
Binary file removed docs/images/VizEditor.jpg
Diff not rendered.
Binary file removed docs/images/add-column-button.png
Diff not rendered.
Binary file removed docs/images/add_filter_field.png
Diff not rendered.
Binary file removed docs/images/add_filter_operator.png
Diff not rendered.
Binary file removed docs/images/add_filter_value.png
Diff not rendered.
Binary file removed docs/images/auto_format_after.png
Diff not rendered.
Binary file removed docs/images/auto_format_before.png
Diff not rendered.
Binary file removed docs/images/auto_format_bulk.png
Diff not rendered.
Binary file removed docs/images/autorefresh-intervals.png
Diff not rendered.
Binary file removed docs/images/autorefresh-pause.png
Diff not rendered.
Binary file removed docs/images/autorefresh.png
Diff not rendered.
Binary file removed docs/images/bar-terms-agg.png
Diff not rendered.
Binary file removed docs/images/bar-terms-subagg.png
Diff not rendered.
Binary file removed docs/images/canvas-align-elements.gif
Diff not rendered.
Binary file removed docs/images/canvas-background-color-picker.gif
Diff not rendered.
Binary file removed docs/images/canvas-click-drag-element.gif
Diff not rendered.
Binary file removed docs/images/canvas-distribute-elements.gif
Diff not rendered.
Binary file removed docs/images/canvas-download-json.gif
Diff not rendered.
Binary file removed docs/images/canvas-ecommerce.png
Diff not rendered.
Binary file removed docs/images/canvas-element-order.gif
Diff not rendered.
Binary file removed docs/images/canvas-embed_workpad.gif
Diff not rendered.
Binary file removed docs/images/canvas-fullscreen.gif
Diff not rendered.
Binary file removed docs/images/canvas-move-pixel.gif
Diff not rendered.
Binary file removed docs/images/canvas-resize-element.gif
Diff not rendered.
Binary file removed docs/images/canvas-zoom.gif
Diff not rendered.
Binary file removed docs/images/canvas_create_image.png
Diff not rendered.
Binary file removed docs/images/canvas_map-time-filter.gif
Diff not rendered.
Binary file removed docs/images/canvas_share_autoplay_480.gif
Diff not rendered.
Binary file removed docs/images/canvas_share_hidetoolbar_480.gif
Diff not rendered.
Binary file removed docs/images/canvas_workpad_3_page.png
Diff not rendered.
Binary file removed docs/images/canvas_workpad_edit_style.png
Diff not rendered.
Binary file removed docs/images/canvas_workpad_weblog.png
Diff not rendered.
Binary file removed docs/images/controls/controls_options.png
Diff not rendered.
Binary file removed docs/images/controls/dropdown_control_editor.png
Diff not rendered.
Binary file removed docs/images/controls/range_slider_editor.png
Diff not rendered.
Binary file removed docs/images/discover-compass.png
Diff not rendered.
Binary file removed docs/images/edit_filter_query.png
Diff not rendered.
Binary file removed docs/images/filter-actions.png
Diff not rendered.
Binary file removed docs/images/filter-allbuttons.png
Diff not rendered.
Binary file removed docs/images/filter-sample.png
Diff not rendered.
Binary file removed docs/images/goal.png
Diff not rendered.
Binary file removed docs/images/history.png
Diff not rendered.
Binary file removed docs/images/labelbutton.png
Diff not rendered.
Binary file removed docs/images/lens_remove_layer.png
Diff not rendered.
Binary file removed docs/images/management-index-management.png
Diff not rendered.
Binary file removed docs/images/management-license.png
Diff not rendered.
Binary file removed docs/images/management-upgrade-assistant-8.0.png
Diff not rendered.
Binary file removed docs/images/management-watcher-buttons.png
Diff not rendered.
Binary file removed docs/images/management_rolled_dashboard.png
Diff not rendered.
Binary file removed docs/images/management_rollups_visualization.png
Diff not rendered.
Binary file removed docs/images/markdown-example.png
Diff not rendered.
Binary file removed docs/images/multiple_requests.png
Diff not rendered.
Binary file removed docs/images/regionmap.png
Diff not rendered.
Binary file removed docs/images/search-button.jpg
Diff not rendered.
Binary file removed docs/images/security_base_all.png
Diff not rendered.
Binary file removed docs/images/share-short-link.png
Diff not rendered.
Binary file removed docs/images/time-filter-absolute.jpg
Diff not rendered.
Binary file removed docs/images/time-filter-relative.jpg
Diff not rendered.
Binary file removed docs/images/time-filter.jpg
Diff not rendered.
Binary file removed docs/images/time-picker-step.jpg
Diff not rendered.
Binary file removed docs/images/time-picker.jpg
Diff not rendered.
Binary file removed docs/images/timelion-arg-help.jpg
Diff not rendered.
Binary file removed docs/images/timelion-read-only-badge.png
Diff not rendered.
Binary file removed docs/images/timelion-save01.png
Diff not rendered.
Binary file removed docs/images/timelion-save02.png
Diff not rendered.
Binary file removed docs/images/tsvb-annotations.png
Diff not rendered.
Binary file removed docs/images/tsvb-data-tab-derivative-example.png
Diff not rendered.
Binary file removed docs/images/tsvb-data-tab-label.png
Diff not rendered.
Diff not rendered.
Binary file removed docs/images/tsvb-data-tab-series-options.png
Diff not rendered.
Binary file removed docs/images/tutorial-full-inspect2.png
Diff not rendered.
Binary file removed docs/images/tutorial-sample-discover-2.png
Diff not rendered.
Binary file removed docs/images/tutorial-sample-inspect2.png
Diff not rendered.
Binary file removed docs/images/tutorial-visualize-pie-1.png
Diff not rendered.
Binary file removed docs/images/visualize-flow.png
Diff not rendered.
Binary file removed docs/images/visualize-icon.png
Diff not rendered.
Binary file removed docs/images/visualize_coordinate_map_example.png
Diff not rendered.
Binary file removed docs/images/visualize_region_map_example.png
Diff not rendered.
Binary file removed docs/images/viz-fit-bounds.png
Diff not rendered.
Binary file removed docs/images/viz-lat-long-filter.png
Diff not rendered.
Binary file removed docs/images/viz-zoom.png
Diff not rendered.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added docs/management/images/management-license.png
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
21 changes: 10 additions & 11 deletions docs/management/managing-licenses.asciidoc
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
[[managing-licenses]]
== License Management

When you install the default distribution of {kib}, you receive a basic license
with no expiration date. For the full list of free features that are included in
the basic license, refer to https://www.elastic.co/subscriptions[the subscription page].
When you install the default distribution of {kib}, you receive free features
with no expiration date. For the full list of features, refer to
{subscriptions}.

If you want to try out the full set of platinum features, you can activate a
30-day trial license. To view the
status of your license, start a trial, or install a new license, open the menu, then go to *Stack Management > {es} > License Management*.
If you want to try out the full set of features, you can activate a free 30-day
trial. To view the status of your license, start a trial, or install a new
license, open the menu, then go to *Stack Management > {es} > License Management*.

NOTE: You can start a trial only if your cluster has not already activated a
trial license for the current major product version. For example, if you have
already activated a trial for 6.0, you cannot start a new trial until
7.0. You can, however, contact `[email protected]` to request an extended trial
license.
7.0. You can, however, request an extended trial at {extendtrial}.

When you activate a new license level, new features appear in *Stack Management*.

[role="screenshot"]
image::images/management-license.png[]

At the end of the trial period, the platinum features operate in a
<<license-expiration,degraded mode>>. You can revert to a basic license,
extend the trial, or purchase a subscription.
At the end of the trial period, some features operate in a
<<license-expiration,degraded mode>>. You can revert to Basic, extend the trial,
or purchase a subscription.

TIP: If {security-features} are enabled, unless you have a trial license,
you must configure Transport Layer Security (TLS) in {es}.
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions docs/user/alerting/action-types/pagerduty.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ Then, select the *Integrations* tab and click the *New Integration* button.
* If you are creating a new service for your integration,
go to
https://support.pagerduty.com/docs/services-and-integrations#section-configuring-services-and-integrations[Configuring Services and Integrations]
and follow the steps outlined in the *Create a New Service* section, selecting *Elastic* as the *Integration Type* in step 4.
and follow the steps outlined in the *Create a New Service* section, selecting *Elastic Alerts* as the *Integration Type* in step 4.
Continue with the <<pagerduty-in-elastic, In Elastic>> section once you have finished these steps.

. Enter an *Integration Name* in the format Elastic-service-name (for example, Elastic-Alerting or Kibana-APM-Alerting)
and select Elastic from the *Integration Type* menu.
and select *Elastic Alerts* from the *Integration Type* menu.
. Click *Add Integration* to save your new integration.
+
You will be redirected to the *Integrations* tab for your service. An Integration Key is generated on this screen.
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion docs/user/reporting/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ image::user/reporting/images/share-button.png["Share"]
[float]
== Setup

{reporting} is automatically enabled in {kib}. The first time {kib} runs, it extracts a custom build for the Chromium web browser, which
{reporting} is automatically enabled in {kib}. It runs a custom build of the Chromium web browser, which
runs on the server in headless mode to load {kib} and capture the rendered {kib} charts as images.

Chromium is an open-source project not related to Elastic, but the Chromium binary for {kib} has been custom-built by Elastic to ensure it
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion examples/bfetch_explorer/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"server": true,
"ui": true,
"requiredPlugins": ["bfetch", "developerExamples"],
"optionalPlugins": []
"optionalPlugins": [],
"requiredBundles": ["kibanaReact"]
}
3 changes: 2 additions & 1 deletion examples/dashboard_embeddable_examples/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"server": false,
"ui": true,
"requiredPlugins": ["embeddable", "embeddableExamples", "dashboard", "developerExamples"],
"optionalPlugins": []
"optionalPlugins": [],
"requiredBundles": ["esUiShared"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 { SavedObjectAttributes } from '../../../src/core/types';

export const BOOK_SAVED_OBJECT = 'book';

export interface BookSavedObjectAttributes extends SavedObjectAttributes {
title: string;
author?: string;
readIt?: boolean;
}
1 change: 1 addition & 0 deletions examples/embeddable_examples/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
*/

export { TodoSavedObjectAttributes } from './todo_saved_object_attributes';
export { BookSavedObjectAttributes, BOOK_SAVED_OBJECT } from './book_saved_object_attributes';
5 changes: 3 additions & 2 deletions examples/embeddable_examples/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["embeddable"],
"requiredPlugins": ["embeddable", "uiActions"],
"optionalPlugins": [],
"extraPublicDirs": ["public/todo", "public/hello_world", "public/todo/todo_ref_embeddable"]
"extraPublicDirs": ["public/todo", "public/hello_world", "public/todo/todo_ref_embeddable"],
"requiredBundles": ["kibanaReact"]
}
90 changes: 90 additions & 0 deletions examples/embeddable_examples/public/book/book_component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* 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, EuiIcon } from '@elastic/eui';

import { EuiText } from '@elastic/eui';
import { EuiFlexGrid } from '@elastic/eui';
import { withEmbeddableSubscription } from '../../../../src/plugins/embeddable/public';
import { BookEmbeddableInput, BookEmbeddableOutput, BookEmbeddable } from './book_embeddable';

interface Props {
input: BookEmbeddableInput;
output: BookEmbeddableOutput;
embeddable: BookEmbeddable;
}

function wrapSearchTerms(task?: string, search?: string) {
if (!search || !task) return task;
const parts = task.split(new RegExp(`(${search})`, 'g'));
return parts.map((part, i) =>
part === search ? (
<span key={i} style={{ backgroundColor: 'yellow' }}>
{part}
</span>
) : (
part
)
);
}

export function BookEmbeddableComponentInner({ input: { search }, output: { attributes } }: Props) {
const title = attributes?.title;
const author = attributes?.author;
const readIt = attributes?.readIt;

return (
<EuiFlexGroup gutterSize="s">
<EuiFlexItem>
<EuiFlexGrid columns={1} gutterSize="none">
{title ? (
<EuiFlexItem>
<EuiText data-test-subj="bookEmbeddableTitle">
<h3>{wrapSearchTerms(title, search)},</h3>
</EuiText>
</EuiFlexItem>
) : null}
{author ? (
<EuiFlexItem>
<EuiText data-test-subj="bookEmbeddableAuthor">
<h5>-{wrapSearchTerms(author, search)}</h5>
</EuiText>
</EuiFlexItem>
) : null}
{readIt ? (
<EuiFlexItem>
<EuiIcon type="check" />
</EuiFlexItem>
) : (
<EuiFlexItem>
<EuiIcon type="cross" />
</EuiFlexItem>
)}
</EuiFlexGrid>
</EuiFlexItem>
</EuiFlexGroup>
);
}

export const BookEmbeddableComponent = withEmbeddableSubscription<
BookEmbeddableInput,
BookEmbeddableOutput,
BookEmbeddable,
{}
>(BookEmbeddableComponentInner);
Loading

0 comments on commit e7857ea

Please sign in to comment.