kibana/x-pack/plugins/enterprise_search
Constance 9744de2a1a
[Workplace Search] Fix download diagnostics button (#104792)
* EnterpriseSearchRequestHandler: Create new hasJsonResponse param
- in place of try/catch previously added for an empty response

- we should instead attempt to handle all non-JSON responses manually, as they're (currently) the outlier

* Update AS sample engine/onboarding route with hasJsonResponse: false

- as this was the original route that added the try/catch
- should still work without it now

* Update WS source download diagnostic route with hasJsonResponse: false

- this was the original impetus for the non-JSON feature request - WS needs the ability to download JSON files directly

* Update Download Diagnostics filename to match standalone UI

* Fix misc routing issues in Source Settings

- `/api` route is missing Kibana basepaths (affects both dev modes and users who have Kibana canonically set to a non-root URL)

- We shouldn't be using RR's native <Link>, but instead our RR helpers which use Kibana's instance of RR history
2021-07-08 08:16:49 -07:00
..
common [Enterprise Search] Distinguish between error connecting vs. 5xx responses from Enterprise Search in UI (#103555) 2021-06-28 18:56:03 -04:00
public [Workplace Search] Fix download diagnostics button (#104792) 2021-07-08 08:16:49 -07:00
server [Workplace Search] Fix download diagnostics button (#104792) 2021-07-08 08:16:49 -07: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] Set up initial KibanaPageTemplate (#102170) 2021-06-16 18:23:13 -04:00
README.md [Enterprise Search] Allow jest script to run on individual files (#96589) 2021-04-12 13:33:45 -04:00
tsconfig.json Revert "TS Incremental build exclude test files (#95610)" (#96223) 2021-04-05 11:59:26 -07:00

Enterprise Search

Overview

This plugin's goal is to provide a Kibana user interface to the Enterprise Search solution's products (App Search and Workplace Search). In it's current MVP state, the plugin provides the following with the goal of gathering user feedback and raising product awareness:

  • App Search: A basic engines overview with links into the product.
  • Workplace Search: A simple app overview with basic statistics, links to the sources, users (if standard auth), and product settings.

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'
  3. For faster QA/development, run Enterprise Search on elasticsearch-native auth and log in as the elastic superuser on Kibana.

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.