Commit graph

524 commits

Author SHA1 Message Date
Constance 9b2d0c3354
[App Search] Fix error connecting state (#98234)
* Fix ErrorConnecting state to be caught/returned earlier

- This fixes AppSearch crashing when in an error connecting state and missing props required for AppSearchConfigured

- This also fixes the error connecting page not showing up for engine routes

- The SetupGuide route was moved to a top-level route, so that all views always have access to it no matter what

* [Extra] Simplify engine route/path

- Move engine/route path under the main <Layout>

- Change <AppSearchNav> behavior to pass subNavs based on route matches, rather than requiring a prop passed to it

+ add useRouteMatch mock

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-26 16:09:31 -04:00
Scotty Bollinger 4efbe8d1e7
[Workplace Search] Fix an issue where lack of host hid chrome (#98315) 2021-04-26 12:20:38 -05:00
Jason Stoltzfus 1351510ce8
Creating a stub page for Search UI (#98069) 2021-04-26 12:53:23 -04:00
Scotty Bollinger f0a3244f54
[Workplace Search] Redirect to correct route for form created sources (#98215)
* [Workplace Search] Redirect to correct route for form created sources

* Remove unnecessary passing of query params

This is no longer needed with the new route

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-26 11:52:27 -04:00
Scotty Bollinger fec07b766f
[Workplace Search] PR#3362 to Kibana (#98207)
* Add StatusItem component

* Replace tooltip with new popover

* Consistant spacing

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-26 11:49:29 -04:00
Constance a510c27565
[App Search] Synonyms: initial logic, cards, & pagination (#98101)
* Set up initial SynonymsLogic

* Set up SynonymCard & Icon components

* Set up EmptyState component

* Update Synonyms view with new components
2021-04-23 17:14:51 -07:00
Davey Holler 4eb6c22bcc
[App Search] UI polish - empty states (#97875)
* Empty State in Curations

* Adds Empty State to Documents View

* Updates Empty State in Engines Overview

* Updates Relevance Tuning empty state

* Updates the Result Settings empty state

* Updating test files.

* Display the empty state in the table only

* Copy changes

Small copy changes to bring it more inline with Elastic guidelines

* Update api_logs_table test

* Copy adjustments

* Fixing failing type check

* Copy adjustments on credentials empty state

* Copy changes on meta engines table

* Removes emptyState__prompt class

* Removes emptyState__prompt class

Forgot to save a file

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/empty_state.tsx

* Adding the popout icon to docs links

* Removes the need  for the engineIcon class

Also allows EuiIcon props to be passed to metaEngineIcon

* Updates meta engine empty state button to docs link

* Adds a separate constant for the empty meta engine button

* Meta Engines empty state refactor

- pull it out to its own component
- simplify tests
- simplify constants, they're only in 1 location so prob don't need to be in DRY'd out
- fix some i18n IDs

* Curations refactor

* Documents empty state refactor

 - create components/ folder, move document creation button to there (feels like it belongs)
 - move empty state there
 - remove other empty state prompt from SearchExperienceContent??? Not sure why that wasn't showing up, but fixed tests/returns

* Relevance Tuning refactor

- create components/ folder
- move empty state + shared boost icon & value badge to it
- write test for missing value badge coverage

MISC
- Fix loading screen to an early return (matches UI of all other views)
- Remove extra EuiSpacer in layout (matches UI of all other views)

Sorry for the extra noise in your PR Davey!

* Result Settings refactor

- move empty state to its own component
- fix broken .html.html link

* Fix missing popout icon on documentation button link

* EnginesOverview cleanup

- Remove unnecessary CSS
- fix responsive behavior of icons
- standardize responsive behavior of create button actions
- standardize spacing between content headers & tables
- Tweak gap between 2 tables

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
2021-04-22 21:43:14 -04:00
Jason Stoltzfus fc45de9fd0
Don't hungry mock within mocks (#98040) 2021-04-22 16:25:07 -04:00
Constance 94e5acd147
Update synonyms API routes (#98046)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-22 16:24:36 -04:00
Jason Stoltzfus 8bbf9c0e28
[App Search] Disabled Save button when nothing selected (#97896) 2021-04-22 11:50:38 -04:00
Scotty Bollinger 65287dffad
[Enterprise Search] Fix unstyled UI for Schema Errors (#97776)
* Refactor main component

* Refactor faux view button

The original design called for a button-looking component on the accordion header so it looks clickable to reveal the error underneath. Using a button element caused the console to error because the entire header is a button and this is a child. Adding an href fixes the error and allows for styling as a button

* Use empty button rather than styles components for view button

* Remove extra classNames and fix layout to stretch cells

* Add stylesheet

Without the width: 100% on .euiIEFlexWrapFix, the header table does not stretch across the screen. Couldn’t find another way around this and happy to take suggestions of a better idea.

* Add prop to prevent line break on IDs

Existing implementation was causing multi-character IDs to break to a new line. So for 12, its was:

1
2
2021-04-22 09:43:53 -05:00
Scotty Bollinger 649a2e01fc
[Workplace Search] PR#3358 to Kibana (#97921)
* Render flash message when server sends back an error

* Fetch data on all route changes

This produced a bug where the nav and loading states were triggered between route changes. Added conditional to prevent resetting between in-source changes
2021-04-22 08:01:45 -05:00
Jason Stoltzfus 6e64e15f95
[App Search] Remove unknowns: 'allow' from enterprise_search routes (#97510)
* Remove unknown allows from enterprisesearch routes

It is a best practice to avoid `unknowns: allow` in request
body validations.

Usage of `unknowns: allow` in the App Search plugin has primarily
been to avoid creating full validation schemas, as they can often
be complex.

Rather than have a half-baked validation that uses `unknowns: allow`,
we have the option to skip parsing and validating a JSON body entirely,
and simply pass it through "as-is" to the enterprise_search server
for validation.

* Move to helper

* Swap comment block style

* PR feedback

* Update x-pack/plugins/enterprise_search/server/lib/route_config_helpers.test.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Update x-pack/plugins/enterprise_search/server/lib/route_config_helpers.test.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Update x-pack/plugins/enterprise_search/server/lib/route_config_helpers.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Update x-pack/plugins/enterprise_search/server/lib/enterprise_search_request_handler.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Better TS

* Change to TS validations

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2021-04-21 16:53:08 -07:00
Constance 1985e0a1c0
Improve focus UX of MultiInputRows (#97695) 2021-04-21 10:28:25 -07:00
Scotty Bollinger 216304b0bd
[Workplace Search] Add target _blank to search link (#97702) 2021-04-20 16:20:50 -04:00
Jason Stoltzfus b57abad9dc
[App Search] 2 fixes for Result Settings (#97179) 2021-04-20 08:12:53 -04:00
Constance 283e2ca798
[App Search] Synonyms set up (#97187)
* Add barebones Synonyms view

* Update Synonyms route+nav link

* Add server API routes

- will be used in upcoming PRs, may change

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-19 13:35:22 -04:00
Scotty Bollinger 08b5f0db2f
[Workplace Search] Fix doc link, remove shadows on panels and fix source id bug (#97482)
* Fix private source docs link

* Add a whole bunch of missed shadow/background changes to panels

* Add success messages to Role mappings

* Fix bug where sourceId still in memory

If you were on an org source and then clicked to view your Personal dashboard, the subnav was visible because the source Id was still in the logic file. This resets it on unmount.

As a part of this fix, dataLoading was set to true on reset. Because of this, some places that were resettings state, but not fetching new data, were left in a loading state. This commit also removes the redundant `resetSourceState` calls around the components that don’t fetch a fresh copy of the source data
2021-04-19 12:27:37 -05:00
Scotty Bollinger 3a32817a7a
[Workplace Search] Add ErrorReasons fix from ent-search (#97299)
Ports https://github.com/elastic/ent-search/pull/3393 to Kibana
2021-04-15 16:23:59 -04:00
Constance 2a281c99c6
[App Search] Refactor out a shared MultiInputRows component (#96881)
* Add new reusable MultiInputRows component

- basically the CurationQuery component, but with a generic values var & allows passing in custom text for every string

* Update CurationQueries with MultiInputRows

* Update MultiInputRows to support on change behavior

- for upcoming Relevance Tuning usage

* Update Relevance Tuning value boost form to use new component

- relevance_tuning_form.test.tsx fix: was getting test errors with mount(), so I switched to shallow()

* Change submitOnChange to onChange fn

- more flexible - allows for either an onSubmit or onChange, or even potentially both

* Convert MultiInputRowsLogic to keyed Kea logic

- so that we can have multiple instances on the same page - primarily the value boosts use case

* Update LogicMounter helper & tests to handle keyed logic w/ props

* [Misc] LogicMounter helper - fix typing, perf

- Use Kea's types instead of trying to rewrite my own LogicFile
- Add an early return for tests that pass `{}` to values as well for performance

* PR feedback: Change values prop to initialValues

+ bonus - add a fallback for initially empty components
+ add a test to check that the logic was mounted correctly

* PR feedback: Remove useRef/on mount onChange catch for now

- We don't currently need the extra catch for any live components, and it's confusing
2021-04-14 18:11:25 -04:00
Jason Stoltzfus e9eff7181a
Fixed relevance tuning (#97172) 2021-04-14 16:50:42 -04:00
Scotty Bollinger af9129b584
[Workplace Search] Source row and Group Manager Modal bugfixes (#97166)
* Add spacing to group manager modal

* Add error state to source row

This mimics the design pattern from the overview page
2021-04-14 16:25:59 -04:00
Scotty Bollinger 3bc2952216
[Workplace Search] Bypass UnsavedChangesPrompt for tab changes in Display Settings (#97062)
* Move redirect logic into logic file

* Add logic to prevent prompt from triggering when changing tabs

The idea here is to set a boolean flag that sends false for unsavedChanges when switching between tabs and then sets it back after a successful tab change

* Keep sidebar nav item active for both tabs

* Add tests
2021-04-14 13:28:00 -04:00
Jason Stoltzfus ec6f652cc5
[App Search] Remaining Result Settings work (#96974) 2021-04-14 12:14:57 -04:00
Scotty Bollinger fe00b68aa2
[Workplace Search] Update ID label to Source Identifier (#96970) 2021-04-14 11:39:56 -04:00
Scotty Bollinger 366a537d37
[Workplace Search] Add breadcrumbs to Role mappings (#97051)
* Update Workplace Search nav to align with App Search

* Add constants to shared

* [App Search] Use shared constants

* [Workplace Search] Add breadcrumbs to Role mappings

* Enable shouldShowActiveForSubroutes
2021-04-14 08:25:18 -05:00
Scotty Bollinger 1630c14a15
[Workplace Search] Remove shadows from Source overview panels (#97055) 2021-04-14 10:14:12 -03:00
Byron Hulcher 71672c4c38
[App Search] Migrate expanded rows for meta engines table in Engines Overview (#96251)
* Pull out columns to be re-used for MetaEnginesTable

* Add route to get source engines for meta engines

* New MetaEnginesTableLogic

* New MetaEnginesTable component

* Remove isMeta prop from EnginesTable

* Swap EnginesTable with MetaEnginesTable in EnginesOverview for meta engines

* Missing test for MetaEnginesTableNameColumnContent

* Created new /app_search/components/engines/components/tables directory

* Moving columns to shared_columns.tsx file

* Updates to MetaEnginesTableExpandedRow and MetaEnginesTableNameColumnContent

* Fixes to EnginesTable, MetaEnginesTable, MetaEnginesTableLogic

* Remove flatten import

* Fix i18n

* PR Feedback

* DRY out shared engine link helpers

* DRY out shared ACTIONS_COLUMN

* Tests: DRY out shared columns/props tests

+ update to account for 2 previous DRY commits (e.g. deleteEngine mock)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
2021-04-13 21:15:37 -04:00
Scotty Bollinger 448562f758
[Workplace Search] Hide Kibana chrome on 3rd party connector redirects (#97028) 2021-04-13 16:57:38 -04:00
Constance d774a41aef
[App Search] Add small engine breadcrumb utility helper (#96917)
* Add new getEngineBreadcrumbs utility helper

* Update all routes passing engineBreadcrumb as a prop to use new helper
2021-04-13 12:56:22 -07:00
Scotty Bollinger 93e270e60a
[Enterprise Search] Design Pass: Role mappings (#96882)
* Update shared button color and panel shading

* Vertically align table cells to top

* [App Search] Update panels to have backgrounds not borders

* [Workplace Search] Update panels to have backgrounds not borders

* re-align last cell to right

Accidentally deleted it refactoring

* Conditionally have border for App Search

Requested to remove for empty state
2021-04-13 10:31:00 -03:00
Constance f4bc0d61a1
Update create meta engine button to match create engine (#96884) 2021-04-12 18:55:04 -04:00
Scotty Bollinger 4d593bbc08
[Workplace Search] Design polish: Groups, Security and Custom source (#96870)
* Add missing i18n

Oops

* Change button color

* Fix custom source created screen

* Add better empty state to groups

* Align toggle to right side of table

* Update design for security page
2021-04-12 18:27:23 -04:00
Scotty Bollinger 31c1a08384
[Workplace Search] Design polish: Configure and connect source (#96851)
* Update ‘How to add’ view

* Update config completed view

* Update add source connect page

* Remove padding on how to add card

Original had no padding.
2021-04-12 15:28:12 -04:00
Constance 171f39821a
[App Search] Results follow-up (#96709)
* CSS cleanup

* Refactor ResultActions component + DRY out link behavior

- Create new separate ResultActions component
- Pass actions array through to header and have haeder in charge of conditional visibility / FlexItem wrapper (this matches the other header items)
- shouldLinkToDetailPage: instead of generating custom JSX, just have it be a standard action and append it to the actions array

Link behavior:
- ResultHeaderItem - switch to EuiLinkTo, no need for extra wrapper
- ResultHeader - DRY out unnecessary extra path generation - instead pass down a conditional documentLink instead of a bool

* PR feedback: Fix test name

* PR feedback: unshift

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-12 15:12:33 -04:00
Jason Stoltzfus b4d330219a
[App Search] Add header details to the Result Settings page (#96623) 2021-04-12 13:38:44 -04:00
Jason Stoltzfus baac478ff3
[Enterprise Search] Allow jest script to run on individual files (#96589) 2021-04-12 13:33:45 -04:00
Vadim Yakhin 47df866223
[Enterprise Search] Add missing and remove redundant breadcrumbs (#96636)
* Workplace Search: Remove redundant Overview breadcrumb from Sources

There is "Source name" breadcrumb that is used for Overview page

* App Search: remove "Overview" breadcrumb from Engine page

So instead of `engines / national-parks-demo / overview (greyed)`
we will have just
`engines / national-parks-demo (greyed)`

* App Search: Add "Engines" breadcrumb to the main App Search page

This needs to be added to 3 states of the page: Normal, Empty and Loading

* Fix failing WS test

* App Search: DRY out SetPageChrome declaration by putting it in header

* Fix failed test "ShallowWrapper::dive() can only be called on components"

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-12 13:04:06 -04:00
Davey Holler 0bf57a2447
App Search: Result Component Updates (#96184)
* Starting work on result component

* Write tests

* Fix types

* Cleanup

* Fix type errors

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-08 15:51:39 -07:00
Constance e6e3b16ee1
[Enterprise Search] Change last breadcrumb to inactive/non-linked breadcrumb (#96489)
* Update our EUI breadcrumb helper to skip generating links for the last breadcrumb in the list

* Fix useEuiBreadcrumbs tests

- add a describe block to make it clear we're testing link behavior in non-last breadcrumbs
- add a helper that automatically adds a last breadcrumb so that link generation still works

* Add comment/note as to why I didn't add last-breadcrumb-specific logic to useGenerateBreadcrumbs
2021-04-07 17:18:36 -04:00
Davey Holler 8e1bd9ccf3
App Search Polish (#96345)
* Button adjustments to Engine Overview page

* Subdued preview panel color

* Vertically aligns "manage fields" and "preview"

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-07 10:37:14 -07:00
Scotty Bollinger 92b659dae0
[Workplace Search] Add AccountHeader to Personal dashboard (#96353)
* Revert change to wrap setContext in useEffect

A recommendation was made to wrap the setContext call in a previous PR, which lets the app know if the context is org or account, in a useEffect call, for potential performance reasons. Unfortunately, this causes the lifecycle to change so that changing routes from org to personal dashboard does not register the change in time. This commit changes it back to a working state.

* Add constants and routes for Account nav

* Add AccountHeader component

* Add header to layout and fix height

The main layout stylesheet, https://github.com/elastic/kibana/blob/master/x-pack/plugins/enterprise_search/public/applications/shared/layout/layout.scss gives a static height that includes the main Kibana navigation. The height with the account nav only is added to the existing privateSourcesLayout css class

* Refactor test
2021-04-07 13:01:26 -04:00
Jason Stoltzfus 818a740033
[App Search] Added a query performance rating to the Result Settings page (#96230) 2021-04-07 11:56:31 -04:00
James Rucker 4610764426
Fix reauthenticate links for OneDrive and SharePoint (#96271)
For both OneDrive and SharePoint we define a service_type that has an
underscore in the middle (one_drive and share_point). This fixes the
route definitions so sources of these connector types can be
reauthenticated.
2021-04-06 12:19:23 -07:00
Constance 56d9f3d968
[App Search] API logs: Add log detail flyout (#96162)
* Set up helper for showing JSON request/response bodies

* Set up mock API log obj for tests to use

* Add ApiLogLogic file for flyout handling

* Add ApiLogFlyout component

* Update views to load flyout

* Update table to open flyout

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/utils.ts

* PR feedback: comments

Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>

Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-05 16:48:00 -04:00
Mikhail Shustov e457f212c4
Revert "TS Incremental build exclude test files (#95610)" (#96223)
This reverts commit b6e582c53e.
2021-04-05 11:59:26 -07:00
Jason Stoltzfus ad5f83a362
[App Search] Added Sample Response section to Result Settings (#95971) 2021-04-05 13:49:54 -04:00
Scotty Bollinger ea03eb1bab
[Enterprise Search] Expose core.chrome.setIsVisible for use in Workplace Search (#95984)
* Hide chrome for Workplace Search by default

The Workplace Search Personal dashboard needs the chrome hidden. We hide it globally here first to prevent a flash of chrome on the Personal dashboard and unhide it for admin routes, which will be in a future commit

* Add core.chrome.setIsVisible to KibanaLogic

* Toggle chrome visibility for Workplace Search

* Add test

* Refactor to set context and chrome when pathname changes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-05 11:27:05 -04:00
Scotty Bollinger 123f3400a8
[Workplace Search] Add sub nav and fix rendering bugs in Personal dashboard (#96100)
* Fix route for private deferated source summary

* Make schema types nullable

Federated sources don’t have counts and the server returns null so our routes have to expect that sometimes these values will be null

* Add SourceSubNav to Personal dashboard

We are able to leverage the existing component with a couple a small change; the existing componet is a subnav in the larger Enterprise Search shared navigation component and does not include its styles. This caused the list items to render with bullet points next to them. Adding this class and displaying the nav items as block elements fixes this issue.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-05 11:19:32 -04:00
Constance c97c51876e
Remove incorrect error toast on successful poll (#96159) 2021-04-02 17:28:18 -04:00
Jason Stoltzfus 82f7b2127e
Move trs to be under tbody in ResultSettings (#96132)
This was causing console errors.

I factored out the column headers to their own component, and moved
all table rows to be under a tbody. This alleviates the console
warnings.
2021-04-02 13:24:04 -04:00
Constance 1d58266559
[Enterprise Search] Add toasts support to FlashMessages component (#95981)
* Add toasts to FlashMessagesLogic

+ Tests cleanup:

- Group actions by their reducer blocks (since flashMessages has such specific logic) - recommend viewing with whitespace changes off for this
- Do not reset context between each test, but instead by mount(), which allows tests to maintain state between adding/removing/resetting
- Remove '()' from test names (feedback from previous PRs)

* Add toast message helpers

+ refactor FLASH_MESSAGE_TYPES to constants, so that both callouts & toasts can use it effectively

* Update FlashMessages to display toasts as well as callouts

- This means we can automatically use toasts alongside callouts in all views that already have FlashMessages

+ a11y enhancement! update callouts to also announce new messages to screenreaders

* [Example] Update ApiLogsLogic to flash an error toast on poll

+ update copy to better match EUI guidelines (shorter)

* Fix test caused by new FlashMessages structure

* PR suggestion - destructure

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>

* PR feedback: implicit return

* Fix color types

- adding our own string enum fixes the typescript errors that both EuiCallout & EuiToast emit when passing color props to the base EUI types

* PR feedback: Update flashToast API to match callout helper API

- accepts a string title with optional args, creates a unique ID automatically if missing

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
2021-04-02 09:50:39 -07:00
Scotty Bollinger fb681d9062
[Workplace Search] Fix broken reauthenticate URLs and fix spelling (#96140)
* Remove kebabCase

Kibana routes are snake case, which matches the existing serviceType, so this is no longer needed

* Fix route segment

The word reauthenticate is not hyphenated

* Fix all misspelling of reauthenticate

Renames files too
2021-04-02 12:41:27 -04:00
Constance 3237fd0637
[Enterprise Search] Fix eslint import rule not ordering sibling mocks with parent mocks (#96070)
* Enterprise Search eslint import order rule fix
- mocks in current folder should be grouped with mocks from parent folders

* Run --fix/update instances of importing ./__mocks__
2021-04-02 09:05:53 -04:00
Constance 7db838e0b8
[App Search] API Logs: Add ApiLogsTable and NewApiEventsPrompt components (#96008)
* Set up getStatusColor util for upcoming EuiHealth components

* Add ApiLogsTable component

* Add NewApiEventsPrompt component

* Update ApiLogs view with new components

+ add EuiPageContent wrapper (missed this originally)

* Update EngineOverview with new components

* PR feedback: Comments + mock FormattedRelative

* Fix type error
2021-04-02 08:49:12 -04:00
Constance df8166f20e
[App Search] Update instances of EuiPanel/EuiPageContent to bordered or filled panels (#96090)
* Add hasBorder to all EuiPageContent panels

* EngineCreation: switch EuiPageBody to EuiPageContent
+ add hasBorder

* Credentials: update EuiPanels w/ hasBorder

* ApiCodeExample: switch to hasBorder

* DataPanel: update to take & pass hasBorder prop

* Analytics & EngineOverview: use hasBorder

* Relevance Tuning: update EuiPanels

- switch to hasBorder for top level panels
- switch to color="subdued" for boost accordion
- tweak padding of boost panel
- CSS cleanup

* Role Mappings: switch to hasBorder

+ remove unused class - `euiPanel--disabled` was not applying any styles
+ remove random 'export' string

* Sample engine CTA: switch to subdued panel
+ fix sizing - when loading button pops in, it was causing text to overflow
2021-04-01 17:54:53 -04:00
Mikhail Shustov b6e582c53e
TS Incremental build exclude test files (#95610)
* add base config for all the TS projects

* all the project use new tsconfig.project.json

* compile test files in the high-level tsconfig.json

* fix TS error in maps plugin

* fix TS error in infra plugin

* exclude mote test and test until folders

* uptime. do not import test code within prod code

* expressions. do not import test code within prod code

* data: export mocks from high level folder

* task_manager: comply with es client typings

* infra: remove unused enzyme_helpers

* check_ts_project requires "include" key

* ts_check should handle parent configs

* all ts configs should extend base one

* exclude test folders from plugins

* update patterns to fix ts_check errors

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* uptime: MountWithReduxProvider to test helpers

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-01 14:40:47 +02:00
Ryan Keairns b301d416b7
Update Cloud plugin to handle new config in kibana.yml (#95569)
* Handle cloud urls from kibana.yml

* Add types to utils params

* Update utils

* address nits

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-31 07:49:50 -05:00
Jason Stoltzfus 80a19a86d7
[App Search] Result settings form (#95462) 2021-03-30 17:07:16 -04:00
Constance 53d4fa7052
[App Search] API logs: Server route + ApiLogsLogic + useEffects (#95732)
* Set up API route

* Set up API types

* Set up date util needed by filters dates

* Add ApiLogsLogic

* Update ApiLogs and EngineOverview views with polling behavior

* Add API type notes - maybe serves as a TODO to clean up our API data some day
2021-03-30 14:35:54 -04:00
Scotty Bollinger c6b37dec70
[Workplace Search] Add download diagnostics button to source settings (#95726)
* Add routes

* Add button to UI
2021-03-30 10:07:58 -03:00
Byron Hulcher e91d0d4a76
[App Search] Add a Sample Engine CTA panel to the engines table when empty (#94647)
* Added new onboarding complete route for App Search

* Allow responses without JSON bodies in Enterprise Search

* New SampleEngineCreationCtaLogic

* New SampleEngineCreationCta component

* Add SampleEngineCreationCTA to engines EmptyState

* Improve SampleEngineCreationCta

* Fix spelling error in Enterprise Search request handler test

* Improve SampleEngineCreationCtaLogic

* Fix types

* Fix tests after origin/master merge

* Turns out I 'fixed' my tests by removing this test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-30 06:49:02 -04:00
James Rucker 4c89da2b45
[Workplace Search] Send kibana_host when calling /reauth_prepare (#95529)
* WIP almost there?

* Fix server route validation

* fix account route

* Fix test expectations

Co-authored-by: scottybollinger <scotty.bollinger@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-29 21:49:16 -04:00
Scotty Bollinger 73f60e132d
[Enterprise Search] Fix bug in indexing status (#95719)
* Add interface

The component was already passing the props the logic file needed, they just aren’t listed in the interface

* Pass props to logic file

Also destructures from props to prevent collision with the local logic values that are repopulated when data is fetched.

* Update logic file to use props for default values

* Fix test and use spy

* Remove resetContext

No longer needed!
2021-03-29 20:59:21 -04:00
Constance 35d0ac8d1c
[App Search] Remove API logs/Analytics-specific unavailable logic (#95601)
* EngineOverview: Remove apiLogsUnavailable logic & UnavailablePrompt

* Analytics: Remove analyticsUnavailable logic & AnalyticsUnavailable

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-29 14:00:32 -04:00
Constance 04340d3ad1
[Enterprise Search] DRY out various repeated action button copy (#95114)
* DRY out repeated button/table/modal actions copy to a shared file

* DRY out 'Edit' copy

* DRY out 'Delete' copy

* DRY out 'Save' copy

* DRY out 'Cancel' copy

* DRY out 'Continue' copy

* DRY out 'Close' copy

* DRY out 'Manage' copy

* DRY out 'Update' copy

* [WS] DRY repeated 'Update'/'Save'/'Cancel' copy

* [AS] DRY out 'Restore defaults' button

- used on 2 pages so far, and will also be used on result settings

* PR feedback: Add _BUTTON_LABEL specificity
2021-03-29 13:57:25 -04:00
Jason Stoltzfus 3f86bab334
[App Search] Refactor Result Settings logic (#95531) 2021-03-29 12:54:20 -04:00
Larry Gregory 31ea160fc7
Move production dependencies out of devDependencies (#93997)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-26 15:23:45 -04:00
John Barrier Wilson 593b03fc60
[Workplace Search] Design polish: overview page (#95363)
* Rework panels to subdued style

* Fix button when source has been onboarded

* Update content_section test for EuiSpacer

* Update content_section test for EuiSpacer Length

* Lint fix for onboarding_card

* Remove spacer size due to default

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>

* Remove test line for Spacer now that size=default

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-26 14:09:45 -05:00
Constance 6b59fe3d01
[App Search] Refactor EuiPageHeader components to use new props instead of children (#95454)
* Update EuiPageHeaders with basic titles

* Update engine creation views

- meta engine - move to description
+ misc fix - non-heading EuiTitles that do not match the standalone UI

* Update EuiPageHeaders with simpler actions

* Update Documents page header

+ test reorg - move DocumentCreationButton tests to its own test block

* Update EnginesOverviewHeader (+ refactors)

- Switch from FormattedMessage to i18n to match rest of repo
- Switch to eslint-disbable instead of doing a buttonProps workaround (this will get deleted anyway post-migration)

* whoops
2021-03-26 14:17:00 -04:00
Scotty Bollinger 21192222fd
Add button on non-MVP pages to link to personal dashboard (#95441) 2021-03-26 11:46:01 -05:00
Scotty Bollinger c5fb8ab8c2
[Workplace Search] Update global state when org nane changes (#95448)
Currently we instantiate the Workplace Search app with server props passed in from the server on initial page load. This data includes the organization name. In our settings section, we poll the server to get update information, but once the data is change, the global state does not get updated on a route change. This is only a problem in the case where a user has changed their org name and returns to the overview page before reloading the page. When this happens, the onboarding step asking the user to change thier org name is still visible.
2021-03-26 10:19:36 -05:00
Constance b9ef084130
[App Search] API Logs - set up basic view & routing (#95369)
* Add basic API Logs view

* Update engine router + nav link
2021-03-25 09:19:39 -07:00
Scotty Bollinger 50d7cea812
[Workplace Search] Add UI logic for GitHub Configure Step (#95254)
* Fix typo

This was mis-copied from ent-search

* No longer store preContentSourceId in query param

In ent-search, we had the Rails server redirect with this param. Now, it is contained in the server response as JSON and is persisted in the logic file

* Pass query params to SourceAdded component

The entire state is stored in query params now and must be passed when doing a manual redirect

* Redirect to config view if config needed

* Don’t redirect if the config has already been completed

This was really tricky and could use a refactor in the future, perhaps. The issue is that the persisted query params will contain the `preContentSourceId` even after the config has been completed. This caused the UI to attempt to navigate back to the config screen after it had been completed. This sets a prop once that has been completed and bypasses the redirect.

* Use correct key to determine if config needed

* Update tests
2021-03-25 11:12:53 -05:00
Constance 983c3a0139
[App Search] Log retention role fix (#95227)
* LogRetentionCallout - add ability check to API call

- on non-admin users, we're otherwise getting a forbidden error

- remove now-unnecessary canManageLogSettings wrapping check around the link CTA, since the entire callout is now essentially gated behind the check

* LogRententionTooltip - add ability check to API call

- on non-admin users, we're otherwise getting a forbidden error

- tests now require a ...values spread for myRole

* [MISC] Refactor previous isLogRetentionUpdating check in favor of a Kea breakpoint

- both dedupe calls for the commented use case, but breakpoint feels simpler & more Kea-y

* PR feedback: Increase breakpoint speed
2021-03-24 15:37:02 -04:00
Constance ec3926433c
[App Search] Various engines fixes (#95127)
* [Misc] Update trash icon color

- should be danger/red to match other tables in Kibana

* Engine table - fix incorrect conditional around when users can delete engines

- The check for that should be around Dev/Editor/Analyst roles, not around whether the account has a platinum license

- Tests - DRY out reset mock
- ideally would be in a beforeEach, but mount/beforeAll perf makes that difficult

* Create engine button - wrap with canManageEngines check

- prevents Dev/Editor/Analyst roles from hitting a 404 page

- test cleanup - use describe blocks to convey conditional branching, combine 2 tests into 1

* Empty engines prompt - add canManageEngines check

+ switch from FormattedMessage to i18n (this view was created a long time ago before we settled on generally preferring i18n)

+ provide a more helpful body text when the user cannot create engines

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/engines_overview.test.tsx

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
2021-03-24 13:23:07 -04:00
Constance 759a52c74d
[App Search] Add describe('listeners') blocks to older logic tests (#95215)
* Add describe('listener') blocks to older logic tests

* [Misc] LogRetentionLogic - move 2 it() blocks not within a describe() to its parent listener
2021-03-24 08:36:23 -07:00
Scotty Bollinger 80b05b914a
[Workplace Search] Add missing tests to get 100% coverage (#95240) 2021-03-23 18:39:57 -04:00
Scotty Bollinger 3ff76fd022
[Workplace Search] Fix redirect and state for personal oAuth plugin (#95238)
* Move source added route to top-level index component

* Use state passed back from oAuth app to determine context

The previous tests weren’t actually using this state so they have been updated with actual state data for proper testing
2021-03-23 18:02:36 -04:00
Scotty Bollinger 29ee309dd8
[App Search] Role mappings migration part 3 (#94763)
* Remove validaition of ID property in route body

The ID is inferred from the param in the URL. This was fixed in the logic file but the server route was never updated

* Add RoleMappings component

- ROLE_MAPPINGS_TITLE was moved to a shared constant in an earlier PR
- Also removing redundant exports of interface

* Add RoleMapping component

- Also removing redundant export of interface from AppLogic

* Add RoleMappingsRouter

ROLE_MAPPINGS_TITLE was moved to a shared constant in an earlier PR

# Conflicts:
#	x-pack/plugins/enterprise_search/public/applications/app_search/components/role_mappings/index.ts

* Add route and update link in navigation

* Remove unused translations

* Change casing

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Change casing

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Change casing

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Add ability test

* Refactor conditional constants

* Refactor role type constants

* Remove EuiPageContent

* Refactor action mocks

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-23 15:18:11 -04:00
Jason Stoltzfus 97a03479e3
[App Search] Fix Relevance Tuning bugs (#95069) 2021-03-23 13:37:17 -04:00
James Rucker f3b71bce2a
Change the type of content source errorReason to match ent-search (#95098)
A recent refactor of content source jobs models unintentionally
changed this API. This change restores the functionality of the
re-authentication "Fix" link.
2021-03-23 08:04:22 -07:00
Byron Hulcher 4dec429fc9
Use string values for EngineTypes instead of int (#94823)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-23 10:09:11 -04:00
Jason Stoltzfus 19aeb99dc3
[App Search] Remaining Result Settings logic and routes (#94947) 2021-03-22 15:58:32 -04:00
Constance ab0f45c053
[Curation] Add Result Manually flyout/search (#94887)
* Set up curation search server route

- not really sure which API endpoint to use, hedging my bets

* Set up AddResultLogic

- fairly simple, mostly concerned with flyout behavior & search query
- could likely be reused (or replaced with??) query tester logic in the future

* Add main AddResultFlyout component

- with custom isPromoted / isHidden logic & actions

* Update AddResultButton to open flyout

* Update Curation page to render the flyout

* PR feedback: reset search query on flyout re-open
2021-03-18 14:53:46 -07:00
Constance 704d22b699
Improve responsiveness of promoted/hidden panel button actions (#94888) 2021-03-18 08:47:04 -07:00
Jason Stoltzfus 49aef21bd4
[App Search] Result settings logic - actions and reducers (#94629) 2021-03-18 09:27:16 -04:00
Constance f4da06349d
[Curation] Add promoted/hidden documents section & logic + Restore defaults button (#94769)
* Set up promoted & hidden documents logic

* Set up result utility for converting CurationResult to Result

* Set up AddResultButton in documents sections

- not hooked up to anything right now, but will be in the next PR

* Add HiddenDocuments section

* Add PromotedDocuments section w/ draggable results

* Update OrganicDocuments results with promote/hide actions

* Add the Restore Defaults button+logic

* PR feedback: key ID

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-17 20:01:50 -07:00
Scotty Bollinger e1371b3d33
[Workplace Search] Fix confirm modal (#94844)
This PR addresses an issue where the confirmation modal when removing a content source connector was brokedn. The issue was that the component was not passed the props to render correctly
2021-03-17 19:55:35 -04:00
Vadim Yakhin 1b65ea91e5
Remove custom styles (#94839)
* Replace custom margin style with EuiFlexGroup gutter

* Replace custom padding style with EuiFlexGroup gutter

* Remove custom wrapper around Loading on Overview page (alpha)

* Replace custom range value output with EuiRange's showInput prop

* Remove custom style

I'll refer the correct handling of this to design pass

* Remove "euiPanel--inset" className, as it doesn't do anything in Amsterdam theme

* Remove unused className `euiPanel--noShadow`

We're already using hasShadow={false} prop that does the same

* Remove `euiPanel--outline` className, as it doesn't do anything in Amsterdam theme

* Inline classNames declaration with the goal to remove them later

They don't do anything in Amsterdam theme, but I'm not removing them to keep context for design pass.

* Remove `eui-textNoWrap` className from buttons, as it's already included in button styles

* Remove classNames with no styles attached

* Replace custom padding in content_section with EuiSpacer

* Remove source-row styles

Most of the classNames were redundant and not needed anymore. The ones that were actually used were either replaced with EUI props or deleted, so we could apply EUI styles during design pass.

* Replace source_icon styles with EUI components and props

* Replace source-card icon styles with EUI prop

* Remove className declarations with no styles attached to classes

* Fix tests

* Increase space between source overview panels

* Use smaller icons on source prioritization and connectors pages

* Invert SourceIcon default size and size provided via props

The default size was "xxl", now it's "m". "m" size is default in EUI, so it's more consistent.

* Get rid of &nbsp; as horizontal spacer
2021-03-17 18:26:50 -04:00
Scotty Bollinger 74b604608a
[Workplace Search] Add conditional props for Gmail (#94855)
THis PR adds conditional query params that gmail sends when doing an oauth redirect.
2021-03-17 18:22:59 -04:00
Scotty Bollinger 4aa7036d77
[App Search] Role mappings migration part 2 (#94461)
* Add engines mock and fix mock role mapping

The original asRoleMapping was merely for a smoke test in the shared component. Refactored to work better in App Search component

* Add RoleMappingsLogic

* Fix test description

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>

* Fix test description

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>

* Add flash messages when creating, updating or deleting

* Add path and resetState calls

Refactoring the tests showed me that some parts of the state weren’t being reset.

* Refactor handleAuthProviderChange logic

I some how got the test coverage at 100% with my wrong way of doing tests before (scary). When I fixed it I noticed that noting I could do would trigger the fallback of just returning the `[ANY_AUTH_PROVIDER]` array. After talking with Constance, we could not come up with a way to trigger it either, given the conditions.

She had suggested removing the first return statement but that caused an empty array being returned sometimes.

Ultimately, I was able to get it working and covered with these changes.

* Refactor tests per PR feedback

The places where `role: 'superuser’` was deleted in the listeners was a side effect of using `setRoleMappingData` and not `mount`

* Add back deleted assertion

* Copy nit

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2021-03-16 17:06:21 -04:00
Constance badf38b0cd
[Curation] Add support for a custom drag handle to the Result component (#94652)
* Update Result component to render a custom drag handle

* Update Result library with a draggable example

- note: this doesn't actually handle reorder logic, it's purely a UI/UX example

* Update CurationResult to pass dragHandleProps through to Result
2021-03-16 08:30:32 -07:00
Vadim Yakhin c9d1dbf599
[Workplace Search] Misc bugfixes (#94612)
* Fix incorrect copy

* Fix incorrect copy

* Update Box icon to match other icon sizes

* Add missing spacer on connector configuration screen

* Add missing spacer to Manage Source modal on Group page

* Remove shadows on Security page

* Align the last column content in tables to the right

* Fix colors on save custom source page

"Secondary" is greenish in new version is EUI, we need "subdued"

* Fix link to personal dashboard

* Add missing breadcrumbs to Security and Settings pages

* Deduplicate Security tests on Basic and Platinum licenses

* Prevent range slider from shifting to left when priority is 10

When priority is 10, the number become wider and it pushes the range slider to the left. This commit is a quick fix for that. We could improve it later by adding a proper input.

* Fix i18n duplicate ID

* Revert "Fix link to personal dashboard"

This reverts commit 5fc3ad2937.
2021-03-16 10:48:07 -04:00
Constance 5396d27043
[App Search] Curation: Add query management UX & organic documents list (#94488)
* Update CurationLogic to handle queries management

- updating the active query
- adding queriesLoading and organicDocumentsLoading state
- clean up / refactor updateCurations slightly - instead of taking a {queries} param, we should opt for a separate updateQueries action and storing a queries state
  - this allows us to more granularly hook into activeQuery when queries is updated without the current activeQuery and correct for that

* Add ActiveQuerySelect component

- used for switching the currently active query

* Add ManageQueriesModal component

- used for editing/adding/removing the queries a curation manages
- primarily a light wrapper around the existing reusable CurationQueries component (also used in the create new curation view)

* Add OrganicDocuments and CurationResult components

* Update Curation view with new components

+ update breadcrumb to pull from queries instead of curation.queries, mostly for consistency w/ other usages & slightly faster responsiveness when updating queries

* Fix unnecessary import

* Meeting feedback: organic documents title copy tweak

* PR feedback - test assertion
2021-03-15 15:39:26 -07:00
Constance 521c336df2
[App Search] Curation: set up server routes, API calls, & bare-bones view (#94341)
* Add server side API routes & update types expected from server

* Create CurationLogic with GET and PUT listeners

- PUT is mostly placeholder for now, we'll actually use it later in future Curation PRs

* Create Curation view component & page load effect

* Update CurationsRouter to use new view + remove add_result route

- Per design discussion w/ Davey, we'll be removing the standalone add result route in favor of an in-page flyout
2021-03-11 09:34:28 -08:00
Constance 8be1dd7c54
[App Search] Add custom actions prop to Result component (#94378)
* Add custom actions prop to Result component

- will be used by upcoming Curations work to promote and hide documents

* Add Result custom actions to library

+ [misc] export main Result component from index
2021-03-11 08:40:31 -08:00
Jason Stoltzfus dee1272dd6
Created a stub page for result settings (#94334) 2021-03-11 08:38:34 -08:00
James Rucker 0e1fa8d50a
Small changes to callback params for Atlassian OAuth1 flows (#94395) 2021-03-11 09:26:21 -06:00
Scotty Bollinger 26603620a4
[App Search] Role mappings migration part 1 (#94346)
* Fix test suite name

https://github.com/elastic/kibana/pull/94038/files#r590545670

* Move types out of AttributeSelector component to shared types

* Fix random typo

* Add routes and path generator util

* Move constants to shared

* Fix types in mock

* Fix routes

* Fix failing tests
2021-03-10 17:16:46 -05:00
Vadim Yakhin 5acf15dccd
[Workplace Search] Deduplicate icons (#94359)
* Remove redundant "_" from icon names

* Move all icons from sources_full_bleed to source_icons

Overwrite existing icons in case of conflicts

* Remove fullbleed prop from source_icon

* Minimize the only unminimized icon

* Remove unused icons
2021-03-10 16:46:14 -05:00
Jason Stoltzfus a198744553
[App Search] Fixed 2 relevance tuning bugs (#94312) 2021-03-10 11:36:23 -08:00
Scotty Bollinger 672bd95a48
[App Search] Add routes for Role Mappings (#94221)
* [App Search] Add routes for Role Mappings

* Add registering of routes

Forgot to port this when cherry picking from another branch.

* Add validation
2021-03-10 13:55:58 -05:00
Constance dcaa3f6464
[App Search] DataPanel & LoadingOverlay component tweaks (#94251)
* DataPanel: fix icons showing unaligned & w/ too much flex space

* LoadingOverlay: add new loading component w/ overlay

- should have an opacity'd overlay to hide content underneath
- specify z-index

* DataPanel: add flag to display a LoadingOverlay

- update CSS to contain LoadingOverlay
- add isLoading prop
2021-03-10 08:40:27 -08:00
Vadim Yakhin 2d60d238fc
[Workplace Search] Add Prompt to Security and Display Settings pages (#93838)
* Add UnsavedChangesPrompt to Security page

* Add UnsavedChangesPrompt to DisplaySettings page

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-10 07:40:22 -04:00
Constance 89b23c06da
[Enterprise Search] Upgrade Kea to 2.3, update LogicMounter helper w/ props support (#94232)
* Enhance our LogicMounter helper to accept and build props

* Update logic tests in AS that require props to now use LogicMounter

* Upgrade Kea to 2.3.0 for future BindLogic use
2021-03-09 17:09:50 -08:00
Scotty Bollinger 89a43555f8
[Workplace Search] Make session_state optional (#94219)
Some OAuth plugins don’t send this key so we make it optional to prevent server errors.
2021-03-09 19:12:38 -05:00
Constance ee2ec0aded
[App Search] Add roleHasScopedEngines helper + small roles/ cleanup (#94038)
* Split out roles/ into separate files

- in preparation for new scoped engines helper

* Add new roleHasScopedEngines helper
2021-03-09 08:54:05 -08:00
Byron Hulcher cceed8ddd6
[App Search] Add delete action to EnginesTable component (#92844)
* Add delete engine route to App Search

* Add new deleteEngine listener to EnginesLogic

* Convert EnginesTable Manage into a proper EuiBasicTable action

* Call EnginesLogic.actions.deleteEngine using new action in EnginesTable

* Manage action on EnginesTable should use eye icon

* Confirmation alert for delete action on EnginesTable

* Only display manage/delete actions to users with canManageEngines

* Add success message and reload after successful engine delete

* Jest tests for EngineTable actions

* Copy change for engine delete success message

* Fixing EnginesTable tests

* Adding more tests for DELETE engine route

* engineNameLink -> EngineNameLink

* Remove redundant test

* Convert Engine.type to enum EngineTypes

* Must use mountWithIntl

* Use platinum license instead of role ability check
2021-03-09 09:49:52 -05:00
James Rucker add02f13e8
[Workplace Search] Persist OAuth token package during OAuth connect flow (#93210)
* Store session data sent from Enterprise Search server

This modifies the EnterpriseSearchRequestHandler to remove any data in a
response under the _sessionData key and instead persist it on the server
side.

Ultimately, this data will be persisted in the login session, but for
now we'll just store it in a cookie. https://github.com/elastic/kibana/issues/92558

Also uses this functionality to persist Workplace Search's OAuth token
package.

* Only return a modified response body if _sessionData was found

The destructuring I'm doing to remove _sessionData from the response is
breaking routes that currently expect an empty response body. This
change just leaves those response bodies alone.

* Refactor from initial feedback & add tests

* Decrease levity

* Changes from PR feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-08 16:17:35 -08:00
Scotty Bollinger a0e88ece91
[Enterprise Search] Fix bug where special chars breaks UI (#94000)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-08 18:27:17 -05:00
Scotty Bollinger 5755d7907c
[Workplace Search] Port RoleMappings changes (#93458)
This PR ports changes from the ent-search RoleMappings to Kibana

Reference PR: https://github.com/elastic/ent-search/pull/3148
2021-03-05 13:18:10 -04:00
Jason Stoltzfus 8381fdd60e
Hide Value and Funtional boost for geolocation (#93683) 2021-03-04 17:06:03 -05:00
Jason Stoltzfus 6ab3fc0107
[App Search] Added relevance tuning search preview (#93054) 2021-03-04 11:47:10 -08:00
Davey Holler c0aa199759
App Search - Polishing Analytics Views (#92939)
* WIP analytics polish

* Working on tests.

* Finishing up tests.

* Updating the engine overview page.

* eslint fixes

* i18n fixes

* Icons feedback

- Remove unused svg file
- Add TODO comment
- Add test coverage

* linting - unnecessary ternaries

* EnginesOverview feedback

TotalCharts
- adjust chart height
- tests: simplify / convert back to shallow

RecentApiLogs
- switch to DataPanel

* DataPanel feedback

Component
- move CSS table bg override out from being an AnalyticsTable concern to a DataPanel concern
  + bem naming, todo comment
- add responsive={false} for better mobile UX
- add className and data-test-subj prop passing
- change title to pass full heading tags rather than a string
- move subtitle below title for better screen reader order
- add index.ts export

Tests
- capitalization for consistency, ordering/describe
- remove data-test-subjs on source code (simpler to grab & inspect tags directly so we can more easily call .text() on passed content)
- add new tests for props (fliled/className/data-test-subj)

Usage
- update other files using DataPanel to start passing heading tags + use index export
- fix RecentApiLogs tests
- change RecentQueries section to use a DataPanel (per Davey)

* Analytics tags - updates & responsive tweaks

Tags
- Rename to more general tags.tsx file
- Add CSS limiting width of variable length tags
- Break up into two separate components for easier readability & testing
- Split up tags column constants so that the wider tables can use the old tags list component

Tables
- add isSmall flag to AnalyticsTable to use new tag count  component
- reduce actions column width
- revert unnecessary table test changes

Analytics
- add custom CSS that switches tables/panels into full-width earlier

* AnalyticsSection fixes

- fix responsive behavior with icon
- add missing AnalyticsSection branch coverage

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
2021-03-03 11:26:05 -08:00
Constance fd3b3eb8cd
[App Search] Refactor AppLogic to initialize data via props rather than action (#92841)
* [Misc cleanup] Move Access type to common

- it was being duplicated in server/check_access and InitialAppData

+ add mock access data to DEFAULT_INITIAL_APP_DATA
+ update server/ tests to account for access in DEFAULT_INITIAL_APP_DATA

* Update AppSearchConfigured to pass props to AppLogic vs calling initializeAppData

+ update tests to rerender a wrapper rather than doing {...DEFAULT_INITIAL_APP_DATA} repeatedly

* Update AppLogic to set values from props rather than a listener

- main goal of this PR is to prevent the flash of state between mount and initializeX being called

- note: I recommend turning off whitespace changes in the test file

* Update AppLogic typing so that app data is always expected

- which it should be in any case in a production environment

- note: I could have changed InitialAppData to remove the ? optional notation, but decided on this route instead since InitialAppData affects more than just App Search (e.g. server, WS), and I didn't want this to have potential far-reaching side effects

* Update type scenarios where AppLogic values were previously thought potentially undefined

- which is mostly just configuredLimits it looks like

* [PR feedback] Type name
2021-03-02 11:25:01 -08:00
Scotty Bollinger 5788a6bd78
[Workplace Search] Role Mappings to Kibana (#93123)
* Add routes for role mapings

* Initial copy/paste

* Update RoleMappingsRouter

- Update all paths
- Change router to use children instead of render props
- Remove legacy app chrome

* Update RoleMappings

- Update all paths
- Use global flash messages

* Update RoleMapping

- Update all paths
- Use global flash messages
- Add types to fix errors
- Use React Router Hooks instead of legacy withRouter HOC

* Fix path in index and add route helper

* Update paths in RoleMappingsLogic

* Remove history in favor of KibanaLogic.navigateToUrl

* Add Role type

* Remove ID prop

This is not needed because the ID is actually passed in the URL itself and is not a requirement in the body of the request

* Replace contextual flash messages with global

It appeared that the server sometimes sent flash messages with the API response, but I checked the Rails server code and there is no `flashMessages` sent back from the server so I am omitting that from the `RoleMappingsServerDetails` interface as well.

* Replace Rails http with kibana http

* Fix route path

* Add route and update global navigation

* Add breadcrumb/page title

* Update flash messages in RoleMapping

I did this for RoleMappings but forgot this one

* Use explicit AttributeName type instead of string

* Add i18n

* Fix type issue

Because the shared role mapping components work for both App Search and Workplace Search, the more generic string is used here because App Search has different role names.

* Add tests for components and router

* Add optional to interface

In the case of a new role mapping, the server is called at the ‘/new’ route and the server responds without a roleMapping prop, as it has not yet been created.

* Add tests for RoleMappingsLogic

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-03-02 11:22:20 -06:00
Byron Hulcher 3d065739ea
[App Search] Migrate Create Meta Engine View (#92127)
* New empty MetaEngineCreation component

* Added MetaEngineCreation to AppSearchConfigured router

* Empty MetaEngineCreationLogic

* Add rawName value and setRawName action to MetaEngineCreationLogic

* Add indexedEngineNames value and setIndexedEngineNames action to MEtaEngineCreationLogic

* Add selectedIndexedEngineNames value and setIndexedEngineNames action to MetaEngineCreationLogic

* Add description to MetaEngineCreation

* Add name selector to MetaEngineCreationLogic

* Added MetaEngineCreationNameInput to MetaEngineCreation

* Add fetchIndexedEngineNames listener to MetaEngineCreationLogic

* Call fetchIndexedEngineNames when MetaEngineCreation first renders

* Add EuiComboBox for selectedEngineNames to MetaEngineCreation

* WIP Add meta engine source engine limit warning to MetaEngineCreation

* Add submitEngine listener to MetaEngineCreationLogic

* Add onEngineCreationSuccess to MetaEngineCreationLogic

* Fixing tests for MetaEngineCreationLogic

* Fix tests for MetaEngineCreation

* Add Create a meta engine button to EnginesOverview

* Use DEFAULT_META for fetching indexed engine names in MetaEngineCreationLogic

* Copy fixes

* Updating POST /api/engines tests

* Add noItemsMessage prop to EnginesTable

* Add empty prompt to Meta Engines table in EnginesOverview

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Better form functionality in MetaEngineCreation

* Fix errors from github

* More MetaEngineCreation coverage

* Meta MetaEngineCreationLogic coverage

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/meta_engine_creation/meta_engine_creation_logic.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/constants.ts

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2021-03-02 08:20:27 -08:00
Jason Stoltzfus 16a3780021
Updated doc links (#92968) 2021-03-02 07:39:04 -05:00
Jason Stoltzfus 892d44cafd
[App Search] Implement various Relevance Tuning states and form actions (#92644) 2021-03-01 16:49:57 -05:00
Constance 0198607eb3
[App Search] Create Curation view/functionality (#92560)
* Add server route and logic listener

* [Misc] Remove 'Set' from 'deleteCurationSet'
- to match createCuration

- IMO, this language isn't necessary if we're splitting up Curations and CurationLogic - the context is fairly evident within a smaller and more modular logic file

* Add CurationQueries component

+ accompanying CurationQueriesLogic & CurationQuery row

* Add CurationCreation view
2021-02-25 17:07:05 -05:00
Jason Stoltzfus d9d0790966
[App Search] Add relevance tuning boost forms (#91912) 2021-02-24 08:58:01 -08:00
Scotty Bollinger 4619f02189
[Enterprise Search] Change icon for error in EuiCallouts (#92527) 2021-02-23 18:47:20 -05:00
Constance 301df28a66
[App Search] Standardize table pagination logic/UX (#92293)
* Create table pagination helpers

* Update Curations table to use new pagination helpers

* Update Credentials table to use new helpers

+ update to use DEFAULT_META and pass page[size] customization
+ update useEffect to manually call fetchCredentials on current page change
+ update table to pass empty prompt within table (rather than instead of), and add a loading indicator
- update deleteApiKey to re-fetch credentials from API rather than modify the in-memory array (which more correctly handles pagination)

* Update Engines table to use new helpers

Server:
+ update server route to take page[current] (consistent w/ other routes) and page[size]
- remove custom param translation (passing as-is)
- remove ENGINES_PAGE_SIZE constant, basically stored within DEFAULT_META now and page size is passed from client-side
- remove misc header cruft from engines table

EnginesLogic:
- Update http calls to send page[current] & page[size] (same as other files)
- Change individual *Total/*Page vars to store the meta obj coming back from the API (same as other logic files)
- Change on*Load actions to simply pass the API response (update typing to clarify)
- Add new individual enginesLoading/metaEnginesLoading vars so that tables can show individual loading indicators between pagination
- Change dataLoading to a selector (should only show on initial page load, and should use table loading indicators after)

EnginesTable:
- Update props to more closely match EuiBasicTable (items, onChange, add loading) so users can do a simple pass-through
- Reorganize tests so that language block doesn't need its own custom wrapper vars
- Remove empty data test (no longer really testing anything meaningful) and add loading test

EnginesOverview:
- Update to use new helpers, values, props, etc.
- Add new test for onPaginate handlers
2021-02-23 10:41:35 -08:00
Constance 5ab2d25006
[App Search] Standardize date/timestamps displayed in tables (#92287)
* Add new reusable FormattedDateTime helper

* Update Analytics RecentQueriesTable to use helper

* Update CurationsTable to use new helper

- requires adding a utility fn to convert the server-sent string to a Date-parseable string

* Update EnginesTable to use FormattedDateTime

- mostly to standardize/DRY out the FormattedDate display style
- adds a new hasTime flag since the EnginesTable does not display time

* [PR feedback] hasTime -> hideTime
2021-02-23 13:26:27 -05:00
Jason Stoltzfus e1166999e0
[Enterprise Search] Shared unsaved changes prompt component (#92277) 2021-02-23 12:55:42 -05:00
Constance 80f697d91f
Remove external/popout icon from Create Engine CTA (#92272)
- now that create engine is no longer linking out to standalone UI
2021-02-23 08:43:37 -05:00
Constance f2002e7c2c
[App Search] Add Curations overview table (#91565)
* Add server API routes

* Add CurationsLogic file

- w/ listeners for overview table only
+ types/constants setup

* Add Curations overview + table

& update router to show view

* Test feedback

- test names, unnecessary beforeAll mocks

* i18n feedback
2021-02-22 12:32:59 -08:00
Scotty Bollinger 9477df10d0
[Enterprise Search] Migrate shared role mapping components (#91723)
* Initial copy/paste of components

* Add types

* Add constants

* Replace EUI toSentenceCase with lodash startCase

EUI has not updated their types to include this util and no one else in Kibana uses it so falling back to the lodash equivalent

* Update paths

* Fix test

* Fix TypeScript issues

* Remove ability check for non-federated users

* Use Kibana React Router helpers

Also cleaned up shared type import

* Update comments

* Fix failing test

Also added new lines to match other places in Kibana

* Add i18n

* Add tests for smaller components

- AddRoleMappingButton
- DeleteMappingCallout
- RoleSelector

* Fix fallbacks

When trying to achieve coverage it was impossible to create a state that these fallbacks were ever triggered. It’s my assumption that these were added in ent-search to get around TypeScript  errors. Added typings instead.

* Add tests for AttributeSelector

* Add mocks and testSubj attrs

* Add tests for RoleMappingsTable

* Fix types

When actually implementing these I found that these types were wrong

* Refactor for better typing

* Remove return type

This was causing a TypeScript error and is not needed

* Rename interface

* Rename more interfaces

* PR feedback

* Add test for radio checked state

* Add false radio assertion to

* Update className

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-22 10:50:07 -05:00
Alejandro Fernández Haro 5342877a32
[HTTP] Apply the same behaviour to all 500 errors (except from custom responses) (#85541)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-18 17:31:18 +00:00
Jason Stoltzfus 8c9eaa2fba
[App Search] First cut of the Relevance Tuning UI (#90621) 2021-02-18 08:07:14 -05:00
Vadim Yakhin f0be78d7fc
Personal dashboard tests (#91555)
* Add unit tests for PrivateSourcesLayout

* Add unit tests for PrivateSources

* Extract groups sentence into separate utility function

* Add test for toSentenceSerial

* Move 'and' constant to WS-level constants file

* Use strings to find components in tests

* Revert "Use strings to find components in tests"

This reverts commit 50caf46b3a.

* Use imports to find components in tests

* Return only the first array element in toSentenceSerial

Convering the entire array with one element to string also works,
but it's less clear.
2021-02-17 10:26:47 -05:00
Scotty Bollinger 16d089acfd
[Workplace Search] Implement Source Connect redesign (#91578)
* Add missing icon

* Add styles

* Add/remove spacers

* Add/remove constants

* Port main component changes

* Remove shadows

* Update tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-17 08:26:27 -06:00
Greg Thompson 8126488021
Upgrade EUI to v31.7.0 (#91210)
* eui to 31.6.0

* flyout, collapsible snapshot updates

* initial overlaymask removal

* undo jest

* overlaymask src snapshot updates

* more overlaymask removals

* overlaymask removal xpack test updates

* saved objects modal form

* eui to 31.7.0

* code, codeblock types

* snapshot update

* tooltip

* remove ownFocus from ConfirmModal

* remove fragments
2021-02-16 14:06:25 -06:00
Constance f2e4cce0a2
[App Search] Set up Curations routes & complete 'Edit Query' action in Analytics tables (#91052)
* Set up Curations routes

* Update EngineRouter/Nav with Curations

* Set up Curations find_or_create API

* [bug] Fix view action not working correctly for "" query

* Add Edit query action
- to call find_or_create curation API & navigate to curation page

+ fix copy string, only just noticed this :doh:

* Add/update unit tests for action column

- Refactor out into a single shared test helper file that both AnalyticsTable and RecentQueriesTable simply calls & runs (instead of copying and pasting the same tests twice into 2 diff files)
- note: test file can't be `.test.tsx` or Jest tries to automatically run it, which we don't want

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-16 10:00:29 -08:00
Vadim Yakhin 7da7b100d2
[Workplace Search] Update personal dashboard (#91136)
* Remove "Add a private content source" sidebar link

* Update groupsSentence to cover different number of groups

Different cases:
1 group: You have access to the following sources through the group Default.
2 groups: You have access to the following sources through the groups Default and Engineering. (no comma before 'and')
3+ groups: You have access to the following sources through the groups Default, Marketing, and Engineering. (comma before 'and')

* Create PrivateSourcesLayout as a copy of Layout

In this commit PrivateSourcesLayout is a full copy of Layout.
It's going to be updated in later commits.

* Remove unused code from PrivateSourcesLayout

* Update read-only mode warning copy for end-users

* Move copy to constants file

* Add width styles to new sidebar

Also moved private_sources_layout styles to sources.scss file. Having separate files for that little amount of custom styles is unnecessary.

* Move top-level header to sidebar

* Add missing padding to sidebar

* Replace ViewContentHeader with ContentSection props

* Move variables over the components

* Remove unused classnames

* DRY out privateSourcesTable and privateSourcesEmptyState

by extracting privateSourcesSection that contains common markup.

* DRY out sharedSourcesTable and sharedSourcesEmptyState

by extracting sharedSourcesSection that contains common markup.

* Reorder code blocks inside the file

To match the order the components appear in UI

* Add newline to the groups enumeration sentence

So it looks good with any number of groups

* Update x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources_layout.tsx

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-11 16:36:41 -05:00
Scotty Bollinger b4368bde14
[Workplace Search] Port bugfix to handle duplicate schema (#91055)
Ports https://github.com/elastic/ent-search/pull/3040

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-11 12:33:22 -06:00
Scotty Bollinger 1ba3d6776a
[Workplace Search] Break out MVP from in-progress app (#91034)
* Create a copy of the existing overview as mvp

No files were changed here; only a copy

* Update index to point to MVP copy

* Wrap server calls in try/catch

Jest was complaining about this and it’s a good practice to have anyway

* Remove MVP temp EuiPage wrapper

* Add route and link in navigation

* Remove Launch Workplace Search button

This not needed in a post-MVP world. We have had discussions about giving the users the ability to relaunch the legacy app in the beta (pre-8.0) world, but that will be in a callout or some other element.

* Refactor onboarding card to use internal routing

I simplified this by not trying to recreate shared props and typecast them, but just create 2 variable components that fall back to an unclickable button that is disabled in the UI

* Refactor onboarding steps to use internal routing

* Refactor statistic card to use internal routing

* Refactor recent activity to use internal routing
2021-02-11 10:29:24 -06:00
Byron Hulcher 57e619be07
[App Search] Migrate Create Engine view (#89816)
* New CreateEngine view component

* Add CreateEngine to index router

* Add Layout-level components for CreateEngine

* Static create engine view

* Add new POST route for engines API endpoint

* Logic for Create Engine view WIP tests failing

* Fix enterpriseSearchRequestHandler path

* Use setQueuedSuccessMessage after engine has been created

* Use exact path for CREATE_ENGINES_PATH (but EngineRouter logic is still firing??)

* Add TODO note

* Put CreateEngine inside the common App Search Layout

* Fix CreateEngineLogic jest tests

* Move create engine view to /create_engine from /engines/new

* Add Create an Engine button to Engines Overview

* Missing FlashMessages on EngineOverview

* Fix test for CreateEngine route

* Fix strong'd text in santized name note

* Use local constant for Supported Languages

* Disable submit button when name is empty

* Bad conflict fix

* Lint nits

* Improve CreateEngineLogic tests

* Improve EngineOverview tests

* Disable EnginesOverview header responsiveness

* Moving CreateEngine route

* create_engine/CreateEngine -> engine_creation/EngineCreation

* Use static values for tests

* Fixing constants, better casing, better ID names, i18ning dropdown labels

* Removing unused imports

* Fix EngineCreation tests

* Fix Engines EmptyState tests

* Fix EnginesOverview tests

* Lint fixes

* Reset mocks after tests

* Update MockRouter properties

* Revert newline change

* Lint fix
2021-02-11 08:38:30 -05:00
Jason Stoltzfus a9e6cff88d
[App Search] Relevance Tuning logic listeners (#89461) 2021-02-10 15:35:56 -05:00
Scotty Bollinger 4aabf358b0
[Workplace Search] Fix error message in Schema (#90869)
In SchemaErrors, we have an edge case where a user navigates to a non-existent error message state. When migrating I took a stab at passing the custom message to the `flashAPIErrors` helper. It turns out that since we don’t have to parse an error object, we can just set the error message directly
2021-02-10 09:08:59 -06:00
Scotty Bollinger ad2f5d7918
[Workplace Search] Fix paths to nest correctly (#90831)
We have serveral places that I went up one level too many when getting shared components. This refactors that to align with other usages.
2021-02-09 16:19:08 -05:00
Constance f3399620cf
[Enterprise Search] Add eslint import/order rules (#90530)
* Add import rules

- newlines between each group
- mocks in test files before everything else
- React before all other externals

* Run --fix on public/applications/workplace_search

* Manually fix errors still present in WS public files

- these appear to be mostly due to jest.mock() or const mixed in with imports, which confuses the autofixer

* Run --fix on public/applications/app_search

+ some manual fixes/tweaks along the way

* Run --fix on public/applications/shared

- some opinionated changes, particularly around IFlashMessages and grouping together types coming from Kibana (src->../../src)

* Run --fix on public/applications/enterprise_search

- mostly straightforward

* Run --fix on public/applications/__mocks__

* Fix remaining top-level public files

- Some opinionated changes (src/core -> ../../src/core) to keep types/mocks together

* Run --fix on server/ files

- same opinionated src->../src changes to keep deps grouped together

- opinionated require->import fetch change in enterprise_esarch_config_api.test.ts

- opinionated [] inclusion of builtins & external imports together (mostly for enterprise_search_request_handler.ts)
2021-02-09 09:33:39 -08:00
Pierre Gayvallet 3b3327dbc3
Migrate most plugins to synchronous lifecycle (#89562)
* first pass

* migrate more plugins

* migrate yet more plugins

* more oss plugins

* fix test file

* change Plugin signature on the client-side too

* fix test types

* migrate OSS client-side plugins

* migrate OSS client-side test plugins

* migrate xpack client-side plugins

* revert fix attempt on fleet plugin

* fix presentation start signature

* fix yet another signature

* add warnings for server-side async plugins in dev mode

* remove unused import

* fix isPromise

* Add client-side deprecations

* update migration examples

* update generated doc

* fix xpack unit tests

* nit

* (will be reverted) explicitly await for license to be ready in the auth hook

* Revert "(will be reverted) explicitly await for license to be ready in the auth hook"

This reverts commit fdf73feb

* restore await on on promise contracts

* Revert "(will be reverted) explicitly await for license to be ready in the auth hook"

This reverts commit fdf73feb

* Revert "restore await on on promise contracts"

This reverts commit c5f2fe51

* add delay before starting tests in FTR

* update deprecation ts doc

* add explicit contract for monitoring setup

* migrate monitoring plugin to sync

* change plugin timeout to 10sec

* use delay instead of silence
2021-02-08 10:19:54 +01:00
Constance 0c0a74b364
[Enterprise Search] eslint rule override: catch unnecessary backticks (#90347)
* Add eslint rule for linting unnecessary backticks

This needs to be below the Prettier overrides at the bottom of the file to override Prettier

* Run --fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-05 10:38:37 -08:00
Constance 3166ff3761
[Enterprise Search] eslint rule update: react/jsx-boolean-value (#90345)
* [Setup] Split rule that explicitly allows `any` in test/mock files into its own section

- so that the rules we're about to add apply correctly to all files

* Add react/jsx-boolean-value rule

* Run --fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-05 09:01:01 -08:00
Scotty Bollinger 284842dc88
[Workplace Search] Fix Source Settings bug (#90242)
* Remove comment

Verified that this works as expected

* Replaces usage from SourceLogic to AddSourceLogic

* Remove unused duplicate code

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-04 13:58:44 -06:00
Constance 2955d65a18
[Enterprise Search] Refactor MockRouter test helper to not store payload (#90206)
* Update MockRouter to not pass/set a this.payload

- but instead intelligently validate payloads based on the request keys

* Fix relevance tuning API routes to not need a separate mock router for validating query & body

* Update all remaining tests to no longer pass a payload param to MockRouter
2021-02-04 11:46:47 -08:00
Jason Stoltzfus 82df009fd1
[App Search] Relevance Tuning logic - actions and selectors only, no listeners (#89313) 2021-02-04 14:40:19 -05:00
Brandon Kobel 4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00
Scotty Bollinger 72fb9ce22b
[Workplace Search] Refactor oauth redirect to persist state params from plugin (#90067)
* Add routes

Also adds validation for the Kibana way of handling query params

* Add route for oauth params

* Add logic to save oauth redirect query params

* Refactor source added template to keep all logic in logic file

* Add tests for component and logic

* Add optional param to interface

Atlassian flows may also send back an oauth_verifier param that we’ll need. This was added to the server validation, but I forgot to add it to the interface

* Remove failing test

This was not needed for coverage and it appears that the helper doesn’t validate query params so removing it

* Remove index_permissions from account params

* Rename variable

* Update param syntax

* Update account route test

* Refactor params
2021-02-03 14:40:12 -06:00
Jason Stoltzfus a839889187
[App Search] Relevance Tuning stub page and server routes (#89308) 2021-02-03 07:21:45 -05:00
Constance 977fc6c464
[App Search] DRY helper for encoding/decoding routes that can have special characters in params (#89811)
* Add encodePathParam helper + update components that need it

- Primarily document URLs & analytics queries (which uses generateEnginePath)

* Add useDecodedParams helper + update components that need it

- Documents titles & Analytics queries

* [Misc] Change popout icon to eye

- Feedback from Davey - the pages don't open in a new window, so shouldn't use the popout icon
- Not strictly related but since we're touching these links anyway, I'm shoving it in (sorry)

* Remove document detail decode test

- now handled/tested by useDecodedParams helper

* Add new generateEncodedPath helper

- Should be used in place of generatePath

* Update all instances of generatePath to generateEncodedPath

for consistency across the App Search codebase

* Fix failing tests due to extra encodeURI() done by generatePath

* Add missing branch test for analytics query titles

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-02 09:41:02 -08:00
Scotty Bollinger 0d5554591f
[Workplace Search] Add remaining i18n support for the Content Sources tree (#89910)
* Add i18n for Org Sources

Refactored a bit as well.
- Removed unnecessary variable declarations for constants.
- Removed empty strings for optional props passed to ContentSection

* Add i18n for private sources

* Add router i18n

* Add i18n to SourcesView

* Fix duplicate IDd

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-01 16:55:00 -06:00
Vadim Yakhin e866db7de0
Migrate security page (#89720)
* 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
2021-01-29 16:31:06 -04:00
Constance 4f6de5a407
[App Search] Add final Analytics table components (#89233)
* Add new AnalyticsSection component

* Update views that use AnalyticsSection

* [Setup] Update types + final API logic data

- export query types so that new table components can use them
- reorganize type keys by their (upcoming) table column order, remove unused tags from document obj

* [Setup] Migrate InlineTagsList component

- used for tags columns in all tables

* Create basic AnalyticsTable component

- there's a lot of logic separated out into constants.tsx right now, I promise it will make more sense when the one-off tables get added

* Update all views that use AnalyticsTable

+ add 'view all' button links to overview tables

* Add RecentQueriesTable component

- Why is the API for this specific table so different? who knows, but it do be that way

* Update views with RecentQueryTable

* Add QueryClicksTable component to QueryDetails view

* Create AnalyticsSearch bar for queries subpages

* [Polish] Add some space to the bottom of analytics pages

* [Design feedback] Tweak header + search form layout

- Have analytics filter form be on its own row separate from page title
- Change AnalyticsSearch to stretch to full width + add placeholder text + match header gutter + remain one line on mobile

* [PR feedback] Type clarification

* [PR feedback] Clear mocks

* [PR suggestion] File rename

constants.tsx -> shared_columns.tsx

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-29 11:42:37 -08:00
Jason Stoltzfus 8780a2de6e
Better async (#89636) 2021-01-29 12:55:06 -05:00
Scotty Bollinger 5feca52dea
[Enterprise Search] Migrate Kibana plugin to TS project references (#87683)
* [Enterprise Search] Migrate Kibana plugin to TS project references

Part of #80508

* Add charts and un-comment added ‘features’

Also alphabetize.

* Uncomment recently added security and spaces

* Add last remaining reference

* Add shared typings to cover svgs

* Include package.json for version.ts

* REvery adding package.json to include

This did not fix the issue

* Add correct references
2021-01-29 11:43:34 -06:00
Constance 6a0f97fca7
[Enterprise Search] Minor Elastic Cloud setup guide instructions fixes (#89620)
* Fix Cloud instructions copy when cloudDeploymentLink is missing

* Fix missing i18n translations on copy nested within links

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-29 09:35:20 -08:00
Scotty Bollinger 67014a7970
[Enterprise Search] Update apps to use a service for docs links (#89425)
* Create DocLinksService

* Set docLinks on app start

* Update routes modules to use service

* Update component and test to use service

* Remove legacy files

* Add comment

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Add new line

Co-authored-by: Constance <constancecchen@users.noreply.github.com>

* Refactor test

* Rename class and remove extra route segments

* Update test names

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2021-01-28 18:14:04 -06:00
Scotty Bollinger af88e024fa
[Workplace Search] Add i18n sources components (#89571)
* Refactor Cancel button constant to shared

* Add i18n for DisplaySettings section

* Moves more shared constants to correct files

Also fixes duplicate text in ConnectInstance (was left alongside translated text below it)

* Add source overview i18n

* More refactoring of shared constants

* Add i18n to remaining shared sources components

* Fix failing test

* Fix duplicate i18n id

* Remove unused translations
2021-01-28 12:55:29 -06:00
Scotty Bollinger 7bb8d3a7b2
[Workplace Search] Fix Private Dashboard routes (#88985)
* Add index route for personal dashboard

* Fix links to personal source flow

In ent-search, the base route was /sources so the getSourcesPath helper was not needed. In Kibana, we use the ‘/p’ route to differentiate personal from org so the helper is needed and we pass false as the isOrganization flag

* Remove legacy sidebar text

When I first migrated this, I left the sidebar copy in so that it was not aboandoned before the design pass. After talking with John we decided to just use the copy to the right of the sidebar so this drops that legacy copy.

* Remove constants

* Remove legacy sidebar link

* Revert "Remove legacy sidebar text"

This reverts commit 8c8a3fb63c.

* Revert "Remove constants"

This reverts commit a88723ec90.

* Revert "Remove legacy sidebar link"

This reverts commit 5d08a12a7d.

* Update TODO

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-26 13:09:53 -06:00
Scotty Bollinger 110e880fbf
[Workplace Search] Add source logic and sources logic unit tests (#89247)
* Move shared data to mock

* Change name of mock

Everywhere else we don’t use the “mock” prefix for mocked data so I’m changing here to match.

Also added missing “size” prop from mock.

* Remove unused actions

These were missed on the migration to the new add_source_logic file. All of that logic lives there now

* Add tests for source logic

* REmove resetFlashMessages

This is no longer used as Kibana resets its own. This was removed from the component already.

* Export items for use in tests

* Remove unnecessary condition

It’s literally not possible for this function to receive an empty contentSources parameter. Not sure why this was added. Even if the server sends response with no privateContentSources, the reducer falls back to an empty array.

* Add tests for sources logic

* Fix typo
2021-01-26 10:06:38 -06:00
Constance a31c3eba13
[App Search] Add AnalyticsCards & AnalyticsChart components to analytics pages (#88930)
* Create reusable AnalyticsCards component

* Update EngineOverview to use new AnalyticsCards component

* Update Analytics overview with AnalyticsCards + data

* Update QueryDetail with AnalyticsCards + data

* Update Analytics overview with AnalyticsChart + data

- turns out we do need startDate after all for charts, so I added it back to types

* Update QueryDetail with AnalyticsChart + data

* [Polish] Dash click and no result lines to match standalone UI

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-25 12:24:04 -08:00
Constance 474af9f3eb
[Enterprise Search] Add Kea test helper for directly accessing listeners (#89061)
* Add getListeners to Kea test helpers

* Update TelemetryLogic to use new getListeners helper

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-25 11:56:42 -08:00
Scotty Bollinger 4281a347c6
[Workplace Search] Add tests for remaining Sources components (#89026)
* Remove history params

We already replace the history.push functionality with KibanaLogic.values.navigateToUrl but the history object was still being passed around.

* Add org sources container tests

* Add tests for source router

* Clean up leftover history imports

* Add tests for SourcesRouter

* Quick refactor for cleaner existence check

Optional chaining FTW

* Refactor to simplify setInterval logic

This commit does a refactor to move the logic for polling for status to the logic file. In doing this I realized that we were intializing sources in the SourcesView, when we are actually already initializing sources in the components that use this, which are OrganizationSources and PrivateSources, the top-level containers.

Because of this, I was able to remove the useEffect entireley, as the flash messages are cleared between page transitions in Kibana and the initialization of the sources ahppens in the containers.

* Add tests for SourcesView

* Fix type issue
2021-01-21 17:32:18 -06:00
Constance c495093f76
[App Search] Move generateEnginePath out from EngineLogic values to its own helper (#89022)
* [Feedback] Move generateEnginePath to its own standalone helper

- instead of living inside EngineLogic.values
- I forgot Kea lets us do this now!

* Update all components using generateEngineRouter to import helper directly
2021-01-21 14:39:14 -08:00
Constance 440238b051
[App Search] Add generatePath helper for generating engine links (#88782)
* Add a generatePath engineName helper to EngineLogic

* Create mockEngineValues reusable mock

* Update routes + EngineNav & EngineRouter to include ENGINE_PATH in all urls

- routes: remove get*Route fns in here as all routes should prefer to use generatePath from EngineLogic moving forward

- EngineRouter - add missing canViewEngineDocuments checks

- Engine tests - import base mock values +  update tests to point directly at files to work around the auto mock

* Update AnalyticsRouter to use new routes+generatePath

* Update DocumentDetailLogic to use new generatePath

+ Misc cleanup:
  - organize imports by shared > AS specific > docs specific
  - move delete-specific const's to directly before they're used, since they're only used in one place
  - deconstruct KibanaLogic.values

* Update all components using getEngineRoute to use new generatePath

+ misc import order cleanup - prefer shared > specific groupings

* [PR feedback] Change components that override the engineName param to just use default generatePath

* [PR feedback] Rename instances of EngineLogic's generatePath to generateEnginePath
2021-01-21 10:55:48 -08:00
Scotty Bollinger eaab783410
[Workplace Search] Add unit tests for top-level Sources components (#88918)
* Add full source mocks

The overview page recieves heavily annotated source data for display. This extends the existing mocks

* Refactor for easier readability

Uses optional chaining. Hide whitespace changes for easier reviewing of this commit

* Remove conditionals

The false case will never be true here because the line above only renders when there is a summary. Around line 109:

```
{!!summary &&
```

* Refactor GroupsSummary to variable

It was challenging to test the null in the original implementation so I refactored to cloer match the way we do this in other places by making the conditional rendering inline, rather than `null` in a function.

* Remove unused const

* Add overview test-subj attrs

* Add overview unit tests

* Add tests for SourceAdded

* Move meta to shared mock

* Add tests for SourceContent

* Add tests for SourceInfoCard

* Move redirect logic from component to logic file

We had this weird callback passing to trigger a redirect and we are already redirecting in the logic file for other things so I simplified this to have the logic file do the redirecting and not have to pass the callback around, which is hard to test and unnecessary complexity.

Also using the KibanaLogic navigateToUrl instead of history.push

# Conflicts:
#	x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_logic.ts

* Add tests for SourceSettings

* Add tests for SourceSubNav

* I am the typo king

🤴🏼Prove me wrong.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-21 12:41:51 -06:00
Constance ed811e332d
[Workplace Search] Update routes to use new encodePathParams helper (#88899)
* Fix createRequest typing to correctly report errors if incorrect args are passed

+ simplify out generic which was causing problems w/ checking - I'd rather check for unnecessary args than hasValidData, which we're not using much anymore

* Update WS settings routes

* Update WS groups routes

* Update WS sources routes
2021-01-21 09:01:42 -08:00
Scotty Bollinger 8008261060
[Workplace Search] Add tests for Custom Source Schema (#88785)
* Add tests for Schema components

* Convert components to use clearFlashMessages helper

* Remove unused action types

These aren’t actually used anymore

* Fix type

This is actually a string from the server

* Move mock to shared mocks

* Add tests for logic file

* Fix App Search tests

Server actually sends back a string for `activeReindexJobId`

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-20 21:15:47 -06:00
Jason Stoltzfus 15f05b51ff
[App Search] Wired up configurable Sort and Facets in Documents View (#88764) 2021-01-20 14:57:37 -05:00
Constance f4f6cb687c
[App Search] Add new encodePathParams helper (fixes unencoded document IDs) (#88648)
* Add encodePathParams helper to EnterpriseSearchRequestHandler

This helper accomplishes two things:

- Fixes 404s from the Enterprise Search server for user-generated IDs with special characters (e.g. ? char)

- Allows us to simplify some of our createRequest calls - no longer will we have to grab request.params to create paths, this helper will do so for us

* Update AS document route to use new helper

- This was the primary view/API I was testing to fix this bug

* Update remaining AS routes to use new helper

- shorter, saves us a few lines
+ remove unnecessary payload: params that doesn't actually validate params

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-20 11:07:32 -08:00
Constance 3168b7d851
[App Search] Analytics - add reusable Layout & Header + basic subroute view components (#88552)
* Add AnalyticsUnavailable component

* Add AnalyticsHeader component

+ update AnalyticsLogic to store allTags prop passed by API

+ convertTagsToSelectOptions util helper

* Add AnalyticsLayout that all subroutes will utilize

- Handles shared concerns of:
  - Loading state & unavailable state
  - Flash messages & log retention callout
  - Reusing the header component
  - Fetching data
  - Reloading data based on filter updates

* Add very basic subroute views that utilize AnalyticsLayout

* Update QueryDetail pages to set breadcrumbs

* Fix QueryDetail breadcrumbs to not 404 on the 'Query' crumb

Redirect to the /analytics overview since we don't actually have a /query_details overview

* [PR feedback] Enforce date range defaults on the client side

- instead of using coincidence to sync our client side default range & server default range

- tags remain ''/undefined as default

* [PR feedback] Add explicit query vs analytics view prop

- to help devs more quickly distinguish at a glance whether a view will fetch analytics data or query data

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-19 15:20:01 -08:00
Constance eb4cb3d1dc
[Enterprise Search] Miscellaneous test cleanups (#88525)
* Update older tests mocking useValues to setMockValues

* Update older logic tests to use newer LogicMounter helper

- NOTE: shared logic files are still using resetContext however, in order to not accidentally override/mock kea + since they should be testing their own mount helpers

* Merge/DRY kea.mock helpers into a single import

* Remove unnecessary kea.mock file imports

- the automock already happens when you import something from the kea.mock file
- in some cases in WS the mock just wasn't needed

* Newline linting

- Do I need a hobby? yes
- Is this my hobby? ...maybe

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-19 07:49:10 -08:00
Scotty Bollinger 5f0e9f4248
[Workplace Search] Migrates Org Settings tree (#88092)
* Initial copy/paste of component tree

Only does linting changes and lodash import

* Replace withRouter HOC with hooks

Use useLocation and no longer pass around history, using the KibanaLogic navigateToUrl method instead

* Migrate LicenseCallout component

* Update paths

Also change name of component to OauthApplication as the default import was named that before

* 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

* Use internal tools for determining license

* Fix a bunch of type issues

* Remove telemetry settings section

We no longer control telemetry in Workplace Search. It is handled by Kibana itself

* Add SettingsSubNav component

* Add route and update nav

* Remove legacy AppView and sidenav

* Clear flash messages globally

* Remove global name change method call

The global org name is not used anywhere outside of this section so we no longer need to update the global organization object as it is re-fetched when this section is entered.

Previously, we displayed the org name in the sidebar but that has been removed in Kibana

* Refactor saveUpdatedConfig

We recently split out the logic from SourceLogic to the new AddSourceLogic and in settings, we were calling the saveSourceConfig method from the SourceLogic (now in AddSourceLogic) file and passing a callback that set the flash messages from that component’s state.

Now, we set the flash messages globally and no longer need to have a saveUpdatedConfig method in the logic file, but can call it directly in the component and the flash messages will be set globally.

* Update logic file to use global flash messages

* Update server routes

* Replace Rails http with kibana http

* Fix subnav

* Update routes to use consistent syntax

We use this method across both Enterprise Search products in Kibana

* Shorten nav item copy

This would be the only place in the sidebar with a nav item breaking to a second line.

* Fix some random typos

* Replace React Router Link with helper

* Add i18n

* Remove redundant clearing of flash messages

This happens automatically now in the global flash messages logic; route changes trigger clearing of messages

* Add unit tests for components

* Add tests for router

* Store oauthApplication in mock for reuse

* Add tests for SettingsLogic

* Fix typo

* Remove unncessary imports

Copied from this PR:
https://github.com/elastic/kibana/pull/88525

* Refactor to use new helpers when mocking

See https://github.com/elastic/kibana/pull/88494

* Update logic test to use error helper

See https://github.com/elastic/kibana/pull/88422

* Fix type issue

* Fix whitespace lint issue

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-18 14:14:42 -06:00
Scotty Bollinger 33084df3ad
[Workplace Search] Add tests for Custom Source Display Settings (#88547)
* Add type

Our code allows for an array but the type did not.

* Add exampleResult mock

* Add test-subj attrs

* Remove FIXMEs for linter errors

The linter was complaining when these were initially migrated, stating that a11y required all mouse events to have focus and blur events. This commit uses the hover events for those. EuiColorPicker was added in error and removing them does not disrupt the linter.

* Add tests for components

* Add test for router

Also updates routes to use consistent syntax and remove the render prop

* Use helper instead of history.push

* Remove redundant resetDisplaySettingsState method

Since all this does is wrap the clearFlashMessages function, we can just call it directly. Also use the new clearFlashMessages helper instead of using FlashMessageLogic directly insideof toggleFieldEditorModal

* Add tests for DisplaySettings container

* Fix a typo and associated tests

Also adds ‘subtitleField’ that is needed in a future test

* Add constants from PR to test

https://github.com/elastic/kibana/pull/88477

* Add tests for DisplaySettingsLogic

* Remove unused imports and use new mocks

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-18 11:28:37 -06:00
Vadim Yakhin fbb8238f57
Porting fixes 1 (#88477)
* Remove Manage button from Source overview page

* Replace empty select option with "Leave unassigned"

* Replace content source key with id

* Update Google icons

* Replace anchor with EuiLink

* Add Folders as one of the synced items for Box

* Add DLP feature UI to Jira and Confluence cloud pages

* Fix the "Fix" link path

Also updated TS types to match ent-search

* Fix copy and button color on "Content source is disabled" callout

* Remove incorrect copy from Private sources empty state

* Move constants from logic file to a separate file, rename a constant

* Fix i18n path to not include file name

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-15 16:04:45 -06:00
Constance 5b38816a97
[Enterprise Search] Automatically mock shared logic files (#88494)
* Update shared logic mocks to automatically mock their exports

* Update FlashMessages to also mock its helper fns

* Fix tests that were relying on component exports from shared logic files

* Fix broken flash_messages tests

- Caused by leaking auto mocks - work around this by importing from files directly and not from index.ts

- Also clean up / use new auto mocks (e.g. for kibana)

- Convert old instances of useValues mock to setMockValues

* [AS] Update AnalyticsLogic test to use new auto mockers

+ move LogicMounter and destructured mock values to top of describe block

* [AS] Update CredentialsLogic

+ udpate to use new clearFlashMessages helper

* [AS] Update documents logic tests

* [AS] Update engines logic tests

* [AS] Update log retention logic test

* [Shared] Update IndexingStatus tests

+ update to use LogicMounter

* [Shared] Update telemetry logic test

* [WS] Update AddSourceLogic

+ update to use new clearFlashMessages helper

* [WS] Update groups logic files

+ update to use new flash message helpers

* [WS] Update OverviewLogic test

* [WS] Update AddSource component test

+ consolidate mocks imports

* [Shared] Clean up KibanaLogic imports

- all jest.mocks come along from the ride when the __mocks__ folder is imported, so HttpLogic is now automatically already mocked

* [AS] Update EngineRouter test
2021-01-15 12:39:26 -08:00
Jonathan Budzenski 51ba94d3e5
[dev] Replace sass-lint with stylelint (#86177)
Co-authored-by: Tyler Smalley <tylersmalley@me.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dave Snider <dave.snider@gmail.com>
2021-01-15 11:52:29 -06:00
Constance d2de5d0383
[Enterprise Search] Small test helper for expected async errors (#88422)
* Add small helper to reduce boilerplate on async tests expected to throw

- Also hopefully a bit more descriptive on what's happening

* Update all test files using the previous try/catch do nothing blocks to use new helper
2021-01-15 09:26:07 -08:00
Jason Stoltzfus 329a5a3f21
[App Search] Add configurable Filter and Sort modal to Documents View (#88066) 2021-01-15 11:45:24 -05:00
Scotty Bollinger 86218a46af
[Workplace Search] Remove user icon from source details (#88218)
* [Workplace Search] Remove user icon from source details

Removes user icons from source details group list, since the users don't exist in Kibana.

* Refactor to remove entire GroupAvatars component

* Remove unused interface

* Remove flex group

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-14 21:04:08 -06:00
Constance ca42e9a59f
[App Search] New log retention components + major i18n refactors (#88237)
* Add remaining log retention components

- Will shortly be used by Analytics view

* [i18n] Change log retention date from moment to react-intl FormattedDate

- this correctly localizes the dates when Kibana is in different languages, e.g. zh-CN, ja-JP

* Refactor log_retention/messaging

- Convert to all JSX/React vs plain strings (makes it easier to deal with FormattedDate/FormattedMessages)

- Consolidate to single component that takes various log types (e.g. analytics, api)

- This is important for adding future switches & toggles - there is *significantly* less complex strings to localize this way (2 short strings vs 5+ long sentences)

* Update existing instances to use new LogRetentionMessage

* Update translation strings
- to account for new i18n logs type values & IDs

* Attempt to fix test timezone shenanigans

* [PR feedback] Types

* [PR feedback] i18n pluralization

* Update LogRetentionTooltip and LogRetentionCallout to manage fetching log retention

+ change ILM to LogRetention per PR feedback

* Update LogRetentionLogic to prevent duplicate fetches

- e.g. if both LogRetentionTooltip and LogRetentionCallout are on the same page (which they will be)
2021-01-14 16:01:24 -08:00
Constance 53efccbc3b
[App Search] Analytics - initial logic file & server API routes (#88250)
* Set up server API routes

* Set up very basic AnalyticsLogic file

- mostly just contains API call & basic loading/error state for now - actual usable vars will be defined in a future PR

* [PR feedback] Unnecessary exports

* [PR feedback] Clean up analyticsAvailable reducer

* [PR feedback] Types order

* [PR feedback] Unnecessary API validation
2021-01-14 13:15:39 -08:00
Constance c1e21deac6
[App Search] Set up Analytics router (#88095)
* [Setup] Analytics routes & page title consts

* Add AnalyticsRouter
- with TODO views

* Update EngineRouter to use AnalyticsRouter

+ minor rearranging of import order

+ update EngineNav to show active flag for subroutes

* [Polish] Add 404 fallback to Analytics subroutes

+ add custom breadcrumb trail prop to NotFound component

* [PR feedback] DRY out typing
2021-01-13 11:08:20 -08:00
Constance 0e118c2099
[App Search] EnginesLogic + minor UX fix (#87561)
* [Misc cleanup] DRY out type def

EnginesTableData was made before we started importing more types over from ent-search; we should reuse the more complete EngineDetails instead of re-declaring our own

* Add EnginesLogic file + tests
- based on current state inside EnginesOverview

- Not a 1:1 translation from ent-search's EnginesLogic b/c the table component/view is different
- also missing engine creation which will be a separate PR

* Update EnginesOverview to use EnginesLogic

- should be significantly simpler
- tests no longer need mountAsync

* [Extra] Make up for lost icon.tsx coverage

- because we no longer use mount() in the engines overview tests, I'm adding an extra set of quick shallow render tests to cover the icon .tsx lines

* [Misc] Rename fetchX to loadY (copying Kea)
2021-01-13 10:24:04 -08:00
Constance 64275cd11a
[App Search] Minor log retention refactors (#88140)
* Move reused log retention components to own folder

- e.g., logic file, helpers used by other views & not just settings

* Update settings-specific views to reference top-level folder

- I'm leaving the panel and the confirmation modal within settings as that isn't used anywhere outside the settings page, but we can revisit this if needed or if people think it makes more sense to keep everything log related together

* [bug] Fix nested <p> error in log retention confirmation modal
2021-01-13 08:23:56 -08:00
Constance 04739d851c
[App Search] Add AnalyticsChart component to EnginesOverview (#87752)
* Set up Kibana charts plugin dependency

- required for using shared colors/themes/etc.
- see https://github.com/elastic/kibana/tree/master/src/plugins/charts

* Add reusable AnalyticsChart component

+ util for converting data from our server API to data that Elastic Charts can use

* Update EngineOverview to use AnalyticsChart

+ remove now-unnecessary endDate value (we don't really need it just IMO)

* [PR feedback] Return type

* [Self feedback] naming - remove pluralization
2021-01-12 11:43:01 -08:00
Constance cf086b678b
[App Search] Minor const cleanup (#87885)
* DRY out repeated DOCUMENTS_TITLE

* Move temporary title const's in engine folder to their own respective folders

- might as well get it set up early + prevents us from forgetting to clean this up later

* Update engine nav & engine router files
2021-01-11 13:52:24 -08:00
Constance 8c74bb3345
Also reset engineName and engineNotFound on clearEngine (#87259) 2021-01-06 10:04:58 -08:00
Constance b4f3a15458
[Enterprise Search] Kea mount test helper (#87247)
* Add Kea logic mount helper

* Update existing mount() helpers to use new DRY helper

* Add additional unmount helper + example test update
2021-01-06 09:48:44 -08:00
Scotty Bollinger 3e3a809b4f
[Enterprise Search] Add a helper for clearFlashMessages (#87383)
This PR adds a convenience function for clearing flash messages to align with others.
2021-01-05 16:54:44 -06:00
Constance 3fba4763fb
[App Search] Minor var names follow-up (#87258)
* Var rename

- so it doesn't sound negative or like a bug, but is instead an anticipated load/use case
- remove unncessary function
- move declaration down to right before it's used

* [Proposal] Other misc cleanup

- Rename engineNameParam to engineNameFromUrl to make reading flow a little bit more nicely + hopefully make the var source a bit clearer

- Change other references back to engineName for simplicity (they should really only be running after engineName has already been set, so there shouldn't be any race conditions there - moving engineBreadcrumb to after Loading should also solve that)
2021-01-05 08:36:40 -08:00
Scotty Bollinger 24748bff77
[Workplace Search] Add routes for settings (#87239) 2021-01-05 10:12:49 -06:00
Scotty Bollinger c69eaf872a
[Workplace Search] Move Personal Dashboard link to header (#87244)
* Remove comment

We aren’t going to use icons like we have in ent-search

* Add new constant

* Use constant instead of inline i18n

* Add link to top bar

The external href to sources will be changed once that component is built

* Remove link from sidebar

* Update i18n translation key names

CI was failing and this should fix it

* Alphabetize items
2021-01-05 10:12:03 -06:00
Jason Stoltzfus 0f04a8ee60
Fixed links to meta engine documents (#86702) 2021-01-04 14:56:09 -05:00
Constance 5241603297
[App Search] Final Document Creation API, Logic, & Summary/Error views (#86822)
* [Setup] Server API route

* [Cleanup] Remove unnecessary DocumentCreationSteps

- errors can/should be shown in the EuiFlyoutBody banner (better UX since the JSON/file is right there for reference) vs its own page
- No need to distinguish between ShowErrorSummary and ShowSuccessSummary

+ placeholder Summary view for now

* Add DocumentCreationLogic file upload logic

* Update creation form components to show error/warning feedback

* Add final post-upload summary view

- split up into subcomponents for easier reading/testing

* [lint] oops, double licenses

* [PR feedback] map -> forEach

* [PR feedback] Reset form state on flyout close

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-04 11:09:43 -08:00
Constance b66bf2b2db
[Enterprise Search] Misc test branch coverage (#86847)
* Remove unnecessary || {} branch

schema is always required / should never be undefined

* Cover if (addFieldFormErrors) branch

* Increase coverage of determineTooltipContent by simplifying branching

- most of these checks aren't necessary due to early returns

* Cover branch in WS source_icon

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-04 10:34:40 -08:00
Constance 2cc2312f6d
[App Search] Result component - a11y enhancements (#86841)
* Refactor Result card layout

- Move toggle action to the bottom of the card content
- [TODO] Action button to the right will be used for new link button (separate for accessibility/screen readers)
- Use grid to get the layout we want without extra div wrappers

* Add action button link to document detail

+ remove <a> tag on article content - should have onClick only
- this allows screenreaders to granularly navigate through the card content while allowing mouse users the entire card to click
- the new actionButton details link is accessible to both keyboard & screen reader users

* [Polish] Hover effects to help guide mouse users

* [i18n] Add pluralization to fields copy

* Update tests

* [Cleanup] Remove unneeded wrapper

* [??] More specific title for result group

- since the aria-label for the new detail button link is basically that
2020-12-23 10:39:21 -08:00