* Add server routes for Workplace Search Security page * Initial copy/paste of component tree Also update lodash imports and fix default exports * Update paths * Remove conditional and passed in flash messages This is no longer needed with the Kibana syntax. Flash messages are set globally and only render when present. * Replace removed ConfirmModal In Kibana, we use the Eui components directly * Remove legacy AppView and sidenav * Clear flash messages globally * Update server routes * Replace Rails http with kibana http * Add setSourceRestriction action to app_logic It is used in security_logic * Add missing typings * Add route and update nav * Use internal tools for determining license * Remove Prompt as it doesn't work in Kibana There is an error that recommends using AppMountParameters.onAppLeave instead, but it doesn't cover the case where a user navigates within the app. We'll revisit this problem later. * Add i18n Also refactor PrivateSourcesTable to use static i18n strings. Before we were using 'remote' and 'standard' as both enums and parts of copy, i.e. "Enable {sourceType} private sources". But with i18n we can no longer do this. So I made a refactoring to separate these concerns. Now 'remote' and 'standard' are only used as enums. What i18n string to show is defined based on isRemote variable. * Add components unit tests * Add logic unit tests * Remove redundant imports * Use nextTick instead of awaiting for promises * Update logic tests to use new mockHelpers |
||
---|---|---|
.. | ||
common | ||
public | ||
server | ||
jest.config.js | ||
jest.sh | ||
kibana.json | ||
README.md | ||
tsconfig.json |
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
- When developing locally, Enterprise Search should be running locally alongside Kibana on
localhost:3002
. - Update
config/kibana.dev.yml
withenterpriseSearch.host: 'http://localhost:3002'
- 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_case
d 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 folder and only get coverage numbers for that 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