kibana/x-pack/plugins/enterprise_search
Constance bc4928fd0b
[Enterprise Search] Create reusable EntSearchLogStream component (#105804)
* Set up Kibana dependencies required by LogStream component

- notably, `infra` and `data` - @see https://github.com/elastic/kibana/blob/master/x-pack/plugins/infra/public/components/log_stream/log_stream.stories.mdx#prerequisites

- tsconfig.json note - I believe I missed kibana_react from when we previously started requiring it for KibanaPageTemplate. Because LogStream requires it for KibanaContextProvider anyway I decided to add as a reference just in case

* Set up log source configuration for ent search logs

@see https://github.com/elastic/kibana/blob/master/x-pack/plugins/infra/public/components/log_stream/log_stream.stories.mdx#with-a-source-configuration

or, monitoring plugin also has example usage

* Set up providers required by the LogStream component

@see https://github.com/elastic/kibana/blob/master/x-pack/plugins/infra/public/components/log_stream/log_stream.stories.mdx#prerequisites

Note: there's some overlap in KibanaContextProvider with KibanaLogic that may be worth investigating/DRYing out in the future

* Create reusable EntSearchLogStream component

- light wrapper over LogStream with certain prepopulated defaults

+ Update LogStreamProps from infra team to be exported publicly for reuse (eslint will error otherwise)

* Fix bad type export

- thanks @afgomez!!

* Fix failing security_only nav_links test

- which was caused by `spaces` being required by infra but optional for our plugin. I moved `spaces` to required by `enterprise_search for clarity.

- I'm still not sure I actually fixed the nav_links test correctly. I have almost no memory of adding those lines 12 months ago 🙈

* Fix spaces typing

- remove `?` notation now that it's a required and non-optional plugin
+ reorder required plugins slightly

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-07-20 13:58:57 -04:00
..
common [Enterprise Search] Create reusable EntSearchLogStream component (#105804) 2021-07-20 13:58:57 -04:00
public [Enterprise Search] Create reusable EntSearchLogStream component (#105804) 2021-07-20 13:58:57 -04:00
server [Enterprise Search] Create reusable EntSearchLogStream component (#105804) 2021-07-20 13:58:57 -04:00
jest.config.js [Enterprise Search] Test coverage pass (#103406) 2021-06-27 21:45:39 -07:00
jest.sh Update jest.sh file to strip leading './' dir (#103507) 2021-06-28 14:21:54 -04:00
kibana.json [Enterprise Search] Create reusable EntSearchLogStream component (#105804) 2021-07-20 13:58:57 -04:00
README.md [Enterprise Search] Update README/description (#105151) 2021-07-12 13:51:38 -04:00
tsconfig.json [Enterprise Search] Create reusable EntSearchLogStream component (#105804) 2021-07-20 13:58:57 -04:00

Enterprise Search

Overview

This plugin provides beta Kibana user interfaces for managing the Enterprise Search solution and its products, App Search and Workplace Search.

⚠️ The Kibana interface for Enterprise Search is a beta feature. It is subject to change and is not covered by the same level of support as generally available features. This interface will become the sole management panel for Enterprise Search with the 8.0 release. Until then, the standalone Enterprise Search UI remains available and supported.

Add rich, relevant search to your apps and websites. https://www.elastic.co/app-search/

Unify all your team's content into a personalized search experience. https://www.elastic.co/workplace-search/

Development

  1. When developing locally, Enterprise Search should be running locally alongside Kibana on localhost:3002.
  2. Update config/kibana.dev.yml with enterpriseSearch.host: 'http://localhost:3002'

Problems? If you're an Elastic Enterprise Search engineer, please reach out to @elastic/enterprise-search-frontend for questions or our in-depth Getting Started developer guide.

Don't forget to read Kibana's contributing documentation and developer guides for more general info on the Kibana ecosystem.

Kea

Enterprise Search uses Kea.js to manage our React/Redux state for us. Kea state is handled in our *Logic files and exposes values and actions for our components to get and set state with.

Advanced Kea usage

For the most part, we stick to the functionality described in Kea's core concepts. However, in some files, we also take advantage of props and events, as well as manually mounting some shared logic files on plugin init outside of React.

Debugging Kea

To debug Kea state in-browser, Kea recommends Redux Devtools. To facilitate debugging, we use the path key with snake_cased paths. The path key should always end with the logic filename (e.g. ['enterprise_search', 'some_logic']) to make it easy for devs to quickly find/jump to files via IDE tooling.

Testing

Unit tests

Documentation: https://www.elastic.co/guide/en/kibana/current/development-tests.html#_unit_testing

Jest tests can be run directly from the x-pack/plugins/enterprise_search folder. This also works for any subfolders or subcomponents.

yarn test:jest
yarn test:jest --watch

Unfortunately coverage collection does not work as automatically, and requires using our handy jest.sh script if you want to run tests on a specific file or folder and only get coverage numbers for that file or folder:

# Running the jest.sh script from the `x-pack/plugins/enterprise_search` folder (vs. kibana root)
# will save you time and allow you to Tab to complete folder dir names
sh jest.sh {YOUR_COMPONENT_DIR}
sh jest.sh public/applications/shared/kibana
sh jest.sh server/routes/app_search
# When testing an individual file, remember to pass the path of the test file, not the source file.
sh jest.sh public/applications/shared/flash_messages/flash_messages_logic.test.ts

E2E tests

See our functional test runner README.