Commit graph

524 commits

Author SHA1 Message Date
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
Constance e3896050fc
[App Search] Misc credentials key UI enhancements (#81817)
* Fix screen reader still reading out bullet bullet bullet

* Even out horizontal spacing

* Break long password text

* Make EUI table cell full width on mobile
2020-12-22 17:53:07 -08:00
Constance 62b5ef9459
Minor responsive text overflow tweaks to ApiCodeExample POST (#86848) 2020-12-22 17:52:32 -08:00
Jason Stoltzfus 8527b6cbe3
Fixed Result engine display (#86559) 2020-12-22 07:48:59 -05:00
Jason Stoltzfus 563fa6de22
[App Search] Updates to results on the documents view (#86181) 2020-12-18 17:01:05 -05:00
Constance 122f1e199b
[App Search] Convert DocumentCreationModal to DocumentCreationFlyout (#86508)
* Convert DocumentCreationModal to a Flyout

- Per discussion w/ Davey - it handles longer/detailed content better

* Update instances referencing DocumentCreationFlyout

* Update flyout children

- modal->flyout
- add hasBorder, set EuiTitle sizes, add flexgroup to footer buttons
2020-12-18 13:31:21 -08:00
Constance 8e71720502
[App Search] Sample Engines should have access to the Crawler (#86502)
* Remove logic preventing Crawler from being used on sample engines

* Remove check around crawler button in DocumentCreationButtons

- primarily a UI thing - ideally we always want to show 4 buttons
2020-12-18 13:25:35 -08:00
Scotty Bollinger 3379763965
[Workplace Search] Refactor AddSource component state and add tests (#86482)
* Rename variables

This will make reviewing later commits easier

* Use internal routing instead of history.push

Also updates path to Loading

* Move state from component to logic

* Add tests
2020-12-18 12:54:59 -06:00
Constance d73af3282f
[Enterprise Search] Basic DocumentCreation creation mode modal views (#86056)
* Add ApiCodeExample modal component

- Previously lived in EngineOverview / Onboarding

* Add basic PasteJsonText component

* Add basic UploadJsonFile component

* [Refactor] Have all modal components manage their own ModalHeader & ModalFooters

- Per feedback from Casey
+ Update DocumentCreationModal to use switch

* Set basic empty/disabled validation on ModalFooter continue buttons

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/api_code_example.tsx

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

* [PR feedback] Typescript improvements

* [PR feedback] Remove need for hasFile reducer

- by storing either 1 file or null
- which gets around the stored FileList reference not triggering a rerender/change

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-18 10:16:27 -08:00
Scotty Bollinger 62833a35df
[Workplace Search] Add AddSourceLogic tests (#86334)
* Remove missed action calls

These were missed in the PR that split apart add_source_logic from source_logic. These 2 mthods aren’t even in this file. My mistake

* Change order of method calls

For some reason the test would not pass with the order of the methods the way they were. Changing the order to where the error callback is called first somehow made the test pass

* Fix bug where query params never set

Uncovered a bug while writing this test. After moving from ent-search to Kibana, it was discovered that the Kibana server did not work well with an empty question mark in the URL. The fix attempted to use lodash’s isEmpty metthod. The problem is that the URLSearchParams class instance created is not an object but has getter/setter functionality so isEmpty always returned true. This fixes it to actually work.

* Remove throw blocks

In ent-search we had to account for edge cases where the error state wasn’t bubbling up. One of these has been covered with global flash messages. The other will be tested at later date. A tech-debt item has been created.

Reference PRs:
https://github.com/elastic/ent-search/pull/394
https://github.com/elastic/ent-search/pull/701

* Export interfaces for use in tests

* Add tests for add_source_logic

* Remove weird import

I guess the IDE autocompleted that. Should not have been there

* Remove redundant test

This test was added before this comit when trying to get coverage for the throw blocks
7ca9c2b244

* Lint fixes
2020-12-18 10:32:13 -06:00
Constance 694bbd42dd
[Enterprise Search] Jest config & handy Jest script (#84839)
* Update Jest config to automatically report coverage

- No more super intricate yarn commands! Hooray

* Add handy shell script for running tests & coverage on specific folders/subdirectories
2020-12-17 08:19:33 -08:00
Constance 7cbc295d76
Revert "[App Search] Temporarily remove sidebar layout and internal engine links for 7.11 release (#85820)" (#86138)
This reverts commit 4d398f2461.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-16 14:28:22 -08:00
Scotty Bollinger 0ad88af894
[Workplace Search] Add unit tests for Add Source components (#86020)
* Add mocks

* Make mergeServerAndStaticData available to tests

This method is needed to combine the 3 types of data to use in the logic files. Exporting this so that the mock data can be combined for testing in components.

It was discovered that the serverData had the wrong typings. This was only discovered when actully mocking the real server data, so it was changed here.

* Add tests for AddSourceHeader

* Add tests for AddSourceList

* Add tests for AvailableSourcesList

* Add tests for ConfigCompleted

* Add tests for ConfigDocsLinks

* Add tests for ConfigurationIntro

* Add tests for ConfigureCustom

* Add tests for ConfigureOauth

* Fix typo

* Add coverage for missing functions

The converage tool was complaining and this change assures formSubmitSuccess and  handleFormSubmitError are covered

* Fix mocks

Needed an accountOnly source in this test so changed and update other tests where used

* Add tests for ConfiguredSourcesList

* Add tests for ReAuthenticate

Also changes the syntax of the redirect to use the replace method for easier testing

* Add sourceConfigData mock

* Add tests for SaveConfig

* Add tests for SaveCustom

* Add tests for SourceFeatures

* Add tests for ConnectInstance

As with the ReAuthenticate component, changes the syntax of the redirect to use the replace method for easier testing.
2020-12-16 14:25:16 -06:00
Constance 2a71d41a60
[App Search] Document Creation Buttons & bare-bones modal/logic (#85902)
* [Setup] Add EuiCardTo helper

* Set up very basic DocumentCreationLogic file modal management

* Create buttons and modal components

* Update EngineOverviewEmpty to use only DocumentCreationButtons

- Remove API section/example/constants for now: per design discussion, we'll be moving this section into the document creation modal
- Move preceding DOCUMENT_CREATION_DESCRIPTION paragraph directly into DocumentCreationButtons, since the Documents view will just use this verbatim

* Update Documents view Index Documents button to show DocumentsCreationModal

- with some extra logic to add a new creationStep view
+ some minor test cleanup / clarification for openDocumentCreation

* Update Crawler button with conditional check

- Forgot to port this over initially

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 13:34:19 -08:00
Scotty Bollinger 15876f85b1
[Workplace Search] Split out logic between Source and AddSource (#85658)
* Copy SourceLogic to AddSourceLogic

This commit merely copies SourceLogic and renames it to AddSourceLogic with the name of the component and interfaces changed. This will make reviewing the changes easier later

* Delete duplicated logic data

* Update component paths

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 14:22:11 -06:00
Scotty Bollinger 7c6f1b8a0a
[Workplace Search] Add i18n to Add Source component tree (#85590)
* Add i18n for AddSourceList

* Add i18n for AvailableSourcesList

* Replace all instances of interal Link

This was missed during the migration. We need to use the components we wrap Eui components with internally.

Also fixes some imports that were unnecessarily going up one level and back down for imports.

* Add i18n for ConfigCompleted

* Add i18n for ConfigDocsLinks

* Add i18n for ConfigurationIntro

* Add i18n for ConfigureCustom

* Add i18n for ConfigureOauth

* Add i18n for ConfiguredSourcesList

* Add i18n for ReAuthenticate

* Add i18n for shared field labels

Also includea shared SourceConfigFields

* Add i18n for SaveConfig

* Add i18n for SaveCustom

* Add i18n for SourceFeatures

* Add i18n for ConnectInstance

* Fix duplicate i18n ID

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 11:44:18 -06:00
Constance 07f395f7dd
Misc responsive tweaks to Documents view (#85440)
+ misc cleanup - extra div, true

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 09:02:12 -08:00
Tyler Smalley 504c8739de
test:jest improvements to better support our monorepo (#84848)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-12-14 14:07:50 -08:00
Constance 4d398f2461
[App Search] Temporarily remove sidebar layout and internal engine links for 7.11 release (#85820)
* Hide layout/sidebar for main Engines Overview

* Remove internal links to Engine pages

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-14 13:02:49 -08:00
Jason Stoltzfus 31a1cc0541
[App Search] Add a Result Component (#85046) 2020-12-11 14:00:38 -05:00
John Barrier Wilson 30611f431a
[Workplace Search] Polish Workplace Search Sources & Groups UI (#85071)
* Add spacer to sources page title

* Add space to source list description

* Remove sidebar content from headers

* Polish inner source overview content

* Polish source content loading state and view

* Hide sources header / remove spacers

* Formatting fix

* Fix lint issues

* Add align right to schema table

* Remove rendom EmptyPrompt

WTF

* Make SourceIcon take a variable size

* Add back SourceInfoCard with update design

Co-authored-by: scottybollinger <scotty.bollinger@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-08 15:30:41 -06:00
Scotty Bollinger 62e79eec70
Add EuiButtonEmptyTo components (#85213)
This PR adds another wrapper component for internal routing, the EuiButtonEmptyTo component.
2020-12-07 21:03:10 -06:00
Scotty Bollinger 7310ea7f3c
[Workplace Search] Cleanup a couple of minor sources issues. (#84961)
* Set queued message instead of immediate message

After being redirected from an oauth configuration, a redirect occurs to show the flash message. A queued message is needed here because the message is lost before the redirect happens otherwise

* Don’t pass empty query params

The kibana server didn’t like the empty param so this commit removes it

Before:
/status?

After
/status

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-04 11:38:03 -06:00
Jason Stoltzfus 40e206e587
[App Search] Added the Documents View (#83947) 2020-12-04 11:17:10 -05:00
Scotty Bollinger 235f786c3e
[Workplace Search] Migrate Sources Schema tree (#84847)
* Initial copy/paste of component tree

Only does linting changes and:
- lodash imports
- Replace unescaped apostrophes with &apos;
- Fix ternary function call to if block:

 if (isAdding) {
  actions.onSchemaSetFormErrors(errors);
} else {
  actions.onSchemaSetError({ flashMessages: { error: errors } });
}

* Remove local flash messages from component

* Update paths

- Adds getReindexJobRoute method to routes
- Repalces legacy Rails routes helper with hard-coded paths

* Add types and constants

* Update paths

* Replace local flash message logic with gobal

* Update with newly added types

Added here: https://github.com/elastic/kibana/pull/84822

* Update server routes

* Replace Rails http with kibana http

* Set percentage to 0 when updating

Without this, the IndexingStatus never shows.

* Fix route paths

* Fix server route validation

The empty object was breaking the UI since `schema.object({})` is actually an empty object. This is more explicit and correct.

* Add i18n

* Make sure i18n key is unique

* Lint
2020-12-03 10:13:22 -06:00
Scotty Bollinger 9cbf971427
[Enterprise Search] Fix schema errors button (#84842)
* Fix schema errors button

When migrated, the button was wrapping the link and it should be the other way around. This caused a blue link color.

* Remove redundant true value

* TIL EuiButtonTo
2020-12-02 21:19:52 -06:00
Scotty Bollinger 4f3d72b413
[Enterprise Search] Move schema types to shared (#84822)
* Move schema types to shared

We use the Schema types in Workplace Search as well, so moving these to shared. Also, we have a component called IndexingStatus so reverting to the prefixed IIndexingStatus interface name

* Fix misspelled interface
2020-12-02 15:34:19 -06:00
Tyler Smalley b593781009
Jest multi-project configuration (#77894)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-12-02 11:42:23 -08:00
Scotty Bollinger b6913a3d2e
[Enterprise Search] Convert IndexingStatus to use logic for fetching (#84710)
* Add IndexingStatusLogic

* Replace IndexingStatusFetcher with logic

* Refactor out unnecessary conditional

onComplete is not optional so these if blocks can be consolidated

* Misc styling - destructuring and typing

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

* Misc styling - imports

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

* Remove div

* Refactor test

* Replace method with string for statusPath

In ent-search, we use Rails helpers to generate paths. These were in the form of routes.whateverPath(). We passed these method to the IndexingStatus component to generate the app-specific rotues in the shared component.

In Kibana, we will not have these generators and should instead pass the path strings directly

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2020-12-02 13:34:07 -06:00
Scotty Bollinger ae9df69028
[Enterprise Search] Migrate shared Indexing Status component (#84571)
* Add react-motion package

This is needed to animate the loading progress bar in the Enterprise Search schema views

* Add shared interface

* Migrate IndexingStatusContent component

This is a straight copy/paste with only linting changes and tests added

* Migrate IndexingStatusErrors component

This is a copy/paste with linting changes and tests added. Also changed out the Link component to our EuiLinkTo component for internal routing

* Migrate IndexingStatus component

This is a straight copy/paste with only linting changes and tests added

* Migrate IndexingStatusFetcher component

This is a copy/paste with some modifications. The http/axios code has been removed in favor of the HTTPLogic in Kibana.

This is a WIP that I am merging to master until I can get it working in the UI. Without either Schema component in the UIs for App Search or Workplace Search this is only a POC. Will not backport until this is verified working and have written tests.

* Add i18n

* Revert "Add react-motion package"

This reverts commit 92db929d2a.

* Remove motion dependency

* Update copy

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

* Refactor per code review

- Remove stui classes
- Inline status

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2020-12-01 14:24:02 -06:00
Scotty Bollinger 78faa107aa
Add routes for use in Sources Schema (#84579) 2020-12-01 12:47:57 -06:00
Rudolf Meijering 4507865d10
SavedObjectsRepository.incrementCounter supports array of fields (#84326)
* SavedObjectsRepository.incrementCounter supports array of fields

* Fix TS errors

* Fix failing test

* Ensure all the remarks make it into our documentation

* SavedObjectsRepository.incrementCounter initialize option

* Move usage collection-specific docs out of repository into usage collection plugins readme

* Update api docs

* Polish generated docs
2020-12-01 11:28:45 +01:00
Constance 5ed39f2fe1
[Enterprise Search] Minor update to Elastic Cloud instructions copy per feedback (#84584)
* Update Elastic Cloud instructions copy

* this is what happens when you go OOO for a week

* Update tests
2020-11-30 15:30:05 -08:00
Scotty Bollinger eee05ad82a
[Enterprise Search] Migrate shared Schema components (#84381)
* Migrate shared Schema components

These components were not changed, with the exception of lint fixes and TypeScript changes (adding types). The only exceptions are:

1. The `formatFieldName` in `SchemaAddFieldModal`. In `ent-search`, this was a shared util, but since it was not used anywhere else, I just added the method as a function in this component.

2. The `IFieldCoercionErrors` interface is only used here so I did not add it to the shared types file and instead jut added it to this component.

* Use EuiLinkTo instead of Link

* Add unit tests

* Better test for `hideName`

Coverage was fine but wasn’t actually testing correctly

* Add i18n

* FIx test that didn’t pass eslint

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-30 10:03:47 -06:00
Scotty Bollinger 0fe8a65a23
[Workplace Search] Migrate DisplaySettings tree (#84283)
* Initial copy/paste of components

Changes for pre-commit hooks were:

- Linting
- Lodash imports
- Fixed warnings for `jsx-a11y/mouse-events-have-key-events` with stubbed onFocus and onBlue events with FIXME comments

* Add server routes

* Remove reference to shared lib

This one-liner appears only once in ent-search so adding it here in the logic file`

* Fix paths

* Add types and fix TypeScript issues

* Replace FlashMessages with global component

* More explicit Result type

* Remove routes/http in favor of HttpLogic

* Fix server routes

`urlFieldIsLinkable` was missing and `detailFields` can either be an object or an array of objects

* Add base styles

These were ported from ent-search. Decided to use spacers where some global styles were missing.

* Kibana prefers underscores in URLs

Was only going to do display-settings and result-details but decided to YOLO all of them
2020-11-25 09:00:10 -06:00
Scotty Bollinger a12bb04438
[Workplace Search] Initial rendering of Org Sources (#84164)
* Fix broken routes

Didn’t have a way to test these when created

* Get context from global state

No need to do this in 2 places now. There was a race condition where the default logic value for `isOrganization` was set to `false` We don’t need a useEffect call here because the value is synchronous and has no side effects. Calling the method directly fixes the race condition.

* Add the ‘path’ to the logic files for easier debugging

* Add SourceSubNav component

* Flip routes to match new convention

It was decided by Product that instead of keying off of `/org` to determine context, that we would now flip it where we key of provate with `/p`.

This means that /sources is now organization where before it was personal

* Convert routers to use children instead of props

This aligns with App Search and allows for easier telemtry and breadcrumbs

* Add breadcrumbs and basic telemetry

* Add in and refactor subnavigation

As a part of this commit, the approach for rendering subnavs was refactored to align with App Search.

There was a bug where some components weren’t rendering properly because the SourceLogic and GroupsLogic files were never unmounting. The reason for this is the subnav components use their respective logic files to get the IDs needed for rendering the subnav links. That is, SourceSubNav would call SourceLogic to get the ID to render the links and would stay rendered for the duration of the user’s time in the app. The result is that users would leave the source details page and navigate to add a new source and the logic file would never reset to a loading state and the UI would break.

The fix was to borrow from the pattern App Search uses and pass the subnavs as props. Because App Search only uses a single engines subnav, they only needed one prop. We use multiple props for each subnav.

Also, the subnav should not be rendered on the root routes (/sources, /p/sources, and /groups) so conditionals were added to only render the subnavs when not on those root routes.

* Add FlashMessages

* Fix some failed tests

Missed this in first commit

* Update SourceIcon to use EuiIcon

Before this change, the legacy styles were not ported over. This gives a uniform size for both wrapped and unwrapped icons. The icons are a bit smaller on the add source page but Eui has lowered it’s largest size ‘xxl’ and we would need to write manual overrides. IMO the change is not significant enough to override.

* Fix broken icons

* Replace legacy div with component

The eui.css file in ent-search is no longer up to date with current EUI and this was broken. The best fix was to use the component that renders as expected

* Add base styles for Sources

More in a future PR but this makes the majority of things look correct.

* Cleanup

Fix some type errors and rename constants

* Couple more failing tests

We have multiple `Layouts` now with the new subnavs

* Fix prepare routes

Like the first commit, missed these when porting over routes with no UI.

* Clean up the desgin of the source connect screen

The columns were way off in Kibana

* Remove ORG_PATH const

No longer needed since ‘/org’ is gone
2020-11-24 10:16:33 -06:00
Constance 61fb7eb219
[Enterprise Search] Add Cloud-specific setup guide instructions (#84008)
* Add cloud plugin detection

* Add cloud plugin value to KibanaLogic

* [Setup] DRY out Setup Guide title const

* [Misc] Rename shared SetupGuide to SetupGuideLayout for explicitness

- So we're not renaming it anyway when importing it per-product
- From a previous piece of PR feedback

* [Misc cleanup] Fix non-versioned Workplace Search documentation link

* [Setup] Pull out versioned Cloud/Enterprise Search doc links to shared/

* Add new Cloud setup instructions

* Update SetupGuideLayout to deliver either cloud or self-managed instructions
2020-11-23 13:09:59 -08:00
Davey Holler 18e0476ebb
Adds a column for engine language to the engines table. (#84004)
* Adds a column for engine language to the engines table.

* Handle Meta Engines and Universal language types

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 11:58:55 -08:00
Scotty Bollinger c45fe18fd5
[Workplace Search] Migrate Source containers and routers (#83954)
* Initial copy/paste of components

No changes other than linting and the removal of the underscore.toSentenceSerial method in favor of the following:

new Intl.ListFormat().format(groups)

which does the same thing

* Redo groups sentence with more accepted solution

Turns out the previos commit’s solution is not widely accepted:

https://caniuse.com/?search=ListFormat

* Add placeholders for future components

Schema and DisplaySettings are Custom Source components that will be added later. These are stubs so the containers will render.

* Update component paths

* Remove AppView, SidebarNavigation and FlashMessages

Sidebar copy and breadcrumbs will be recreated at the top level in a separate PR

* Use Kibana’s hasPlatinumLicense over minimumPlatinumLicense

Also renames fpAccount to account, as it’s called in Kibana

* Fix typings

* Move sidebar content temporarily to top of page

This is temporary as noted by comments

* Fix missing images

* Fix routes

Had the base route and not the status route in the fetchSourceStatuses method

* Clean up last Sidebar with temp copy placement

This is so that CI will pass and we can get this merged in and do the actual wiring up of everything in a separate PR.

* Remove unused links

For CI to pass. Will add back in future PR

* Minify SVG illustration

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-23 13:04:31 -06:00
Jason Stoltzfus 26e9dbf06a
[App Search] Added the Document Detail View (#83564) 2020-11-23 08:38:43 -05:00
Scotty Bollinger 5beb47a1f7
[Workplace Search] Migrate additional shared source components (#83850)
* Initial copy/paste of components

Changes for pre-commit hooks were:

- Linting
- Lodash imports
- remove `any` type in favor of React.ReactNode
- Move setState to top of component

* Add image

* Update component paths

* Remove reference to ConfirmModal

Since all the legacy component does it wrap the EUI component we decided to drop it.

Legacy:
https://github.com/elastic/ent-search/blob/master/app/javascript/shared/components/ConfirmModal/ConfirmModal.tsx

* Remove local flash messages in favor of global flash messages

* Various type fixes

* Fix image location
2020-11-19 16:43:18 -06:00
Scotty Bollinger ad5cf9e78b
[Workplace Search] Migrate AddSource tree (#83799)
* Initial copy/paste of components

Changes for pre-commit hooks were:

- Linting
- Lodash imports
- changed enum names in add_source because there were collistions with component names. So SaveConfig becomes SaveConfigStep because there is a component by the same name
- replaced apostrophe’s with ‘&apos;’ per lint rule

Finally, the linter didn’t like this expression:

asOauthRedirect ? onOauthFormSubmit() : onCredentialsFormSubmit();

… so I changed it to:

const onSubmit = hasOauthRedirect
  ? onOauthFormSubmit
  : onCredentialsFormSubmit;

 onSubmit();

* Add route helper

* Remove AppView, Sidebar navigation and FlashMessages

Sidebar copy and breadcrumbs will be recreated at the top level in a separate PR

* Update component paths

* Use Kibana’s hasPlatinumLicense over minimumPlatinumLicense

* Various TypeScript lint fixes

* Fix index paths

* Remove in-page breadcrumbs and move sidebar copy

In Kibana, breadcrumbs will be at the top-level and not in the view

Also, we have no sidebar with contextual copy. The Figma designs call for this copy to be above the main content. For now I am placing this in the existing ViewContentHeader component.

This will be slightly broken because of the structure of ViewContentHeader but that is expected for now since it cannot be rendered in the browser yet to fix

* Temporarily add parseQueryParams

This is a placeholder until https://github.com/elastic/kibana/pull/83750 lands

* Remove optional from isOrganization

Looks like the value is always passed

* Remove ‘!!’
2020-11-19 13:32:29 -06:00
Scotty Bollinger 40d4787620
[Enterprise Search] Add parseQueryParams helper (#83750)
* [Enterprise Search] Add parseQueryParams helper

This PR migrates part of the ent-search queryParams util, `parseQueryParams` for use in Workplace Search.

`setQueryParams` was no a part of this PR because it is only used one time in App Search and a better alternative might be available for that use-case

* Remove mock

* Actually test functionality of query-string

* Add test for array

* Better test name
2020-11-19 12:47:37 -06:00
Larry Gregory 7f962e5839
Removing circular dependency between spaces and security (#81891)
* Removing circular dependency between spaces and security

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* Tests refactor

- Reorganize top level describes into 3 space-based blocks into based on spaces:
  - space disabled
  - spaces plugin unavailable
  - space enabled (most previous tests go under this new block) with new beforeEach

- wrote new tests for uncovered lines 58, 66-69

* Review1: address PR feedback

* changing fake requests for alerts/actions

* Fixing tests

* fixing more tests

* Additional testing and refactoring

* Apply suggestions from code review

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* Review 2: Address feedback

* Make ESLint happy again

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
2020-11-19 13:41:13 -05:00
Constance 44eba4f953
[Enterprise Search] Engine overview layout stub (#83756)
* Set up Overview file

* Finish Overview page logic, stub out empty/metric views

* Stub in basic empty engine overview
- Minus document creation button & API code example

* Stub out EngineOverviewMetrics and unavailable empty prompt

* Stub out EngineOverMetrics components (stats, charts, logs)

* [Refactor] Pull out some document creation i18n strings to constants

- They're repeated/reused by the DocumentCreationPopover component

* PR feedback: Drop the regex

* PR feedback: RecentLogs -> RecentApiLogs

* PR feedback: Copy

* PR feedback: Copy, sentence-casing

* I forgot to rebase against my own PR :dead_inside:
2020-11-19 08:21:40 -08:00
spalger 92acf4586e Revert "[App Search] Engine overview layout stub (#83504)"
This reverts commit 71f972dc83.
2020-11-18 18:35:36 -07:00
Constance 71f972dc83
[App Search] Engine overview layout stub (#83504)
* Set up Overview file

* Finish Overview page logic, stub out empty/metric views

* Stub in basic empty engine overview
- Minus document creation button & API code example

* Stub out EngineOverviewMetrics and unavailable empty prompt

* Stub out EngineOverMetrics components (stats, charts, logs)

* [Refactor] Pull out some document creation i18n strings to constants

- They're repeated/reused by the DocumentCreationPopover component

* PR feedback: Drop the regex

* PR feedback: RecentLogs -> RecentApiLogs

* PR feedback: Copy

* PR feedback: Copy, sentence-casing
2020-11-18 15:53:45 -08:00
Scotty Bollinger b819287ce3
[Workplace Search] Update SourceIcon to match latest changes in ent-search (#83714)
* Move source icons into subfolder

* Copy over new icons

* Update SourceIcon to account for full bleed images

* Remove unused file

* Fix broken icon path
2020-11-18 16:50:14 -06:00
Constance 640a7b9b7f
[Enterprise Search] Rename React Router helpers (#83718)
* Rename EUI React Router components

- Instead of bogarting the EUI component names, use EuiLinkTo instead of EuiLink

Other misc renaming
- eui_link.tsx to eui_components.tsx for clearer file name
- EuiReactRouterHelper to ReactRouterHelper, to make the distinction between EUI and React Router clearer (in theory you could use this helper for non-EUI components)
- other misc type renaming

* Update simple instances of previous EUI RR components to Eui*To

* Clean up complex/renamed instances of Eui*To
(hopefully much more straightforward now)

- unfortunately side_nav requires an eslint disable
2020-11-18 14:49:14 -08:00
Scotty Bollinger e7ff3a6f33
[Workplace Search] Migrate SourceLogic from ent-search (#83593)
* Initial copy/paste of source logic

Only changed lodash imports and import order for linting

* Add types and route

* Update paths and typings

Renamed IMeta -> Meta
Used object instead of IObject

* Remove internal flash messages in favor of globals

- All instances of flashAPIErrors(e) are only placeholders until the later commit removing axios.

- buttonLoading was set to false when the error flash messages were set. For now I added a `setButtonNotLoading` action to do this manually in a finally block. This will be refactored once axios is removed.

- SourcesLogic is no longer needed because we set a queued flash message instead of trying to set it in SourcesLogic, which no longer has local flash messages

* Add return types to callback definitions

* Update routes

According to the API info getSourceReConnectData is supposed to send the source ID and not the service type. In the template, we are actually sending the ID but the logic file parameterizes it as serviceType. This is fixed here.

Usage: https://github.com/elastic/ent-search/blob/master/app/javascript/workplace_search/ContentSources/components/AddSource/ReAuthenticate.tsx#L38

* Replace axios with HttpLogic

Also removes using history in favor of KibanaLogic’s navigateToUrl

* Fix incorrect type

This selector is actually an array of strings

* Create GenericObject to satisfy TypeScript

Previously in `ent-search`, we had a generic `IObject` interface that we could use on keyed objects. It was not migrated over since it uses `any` and Kibana has a generic `object` type we can use in most situations. However, when we are checking for keys in our code, `object` does not work. This commit is an attempt at making a generic interface we can use.

* More strict object typing

Removes GenericObject from last commit and adds stricter local typing

* Add i18n

Also added for already-merged SourcesLogic

* Move button loading action to finally block

* Move route strings to inline
2020-11-18 13:05:36 -06:00
Scotty Bollinger b63830f105
[Workplace Search] Port Box changes from ent-search (#83675) 2020-11-18 13:05:14 -06:00
Scotty Bollinger 46d587a19f
[Workplace Search] Migrate SourcesLogic from ent-search (#83544)
* Copy and paste sources logic

This is simply a copy & paste of the sources_logic file from ent-search. The only changes were adding the comment at the top and changing how lodash imports, per linting requirements

* Add types

The “I” prefix has been removed, per agreed-upon standard

* Add type declaration to staticSourceData

Yay TypeScript  🙄

* Update route path

For all other routes, we use the account/org syntax. For this one, I missed it and forgot to add ‘account’ for the route path. This fixes it

* Update SourcesLogic to work with Kibana

- Remove routes/http in favor of HttpLogic
- Remove local flash messages in favor of global messages
- Update paths to imports
- Remove "I"s from interface names
- Varions type fixes
2020-11-17 10:28:44 -06:00
Scotty Bollinger e4516ee0e9
[Workplace Search] Enable check for org context based on URL (#83487)
* Add regex check to determine whether url is org

As a part of the Kibana migration, we are switching the URL structure to put the prefix on the personal dashboard. In ent-search, org routes were prefixed with `/org`. In Kibana the prefix switches to non-org routes and they will be prefixed with`/p`

* Add isOrganization boolean to logic
2020-11-17 07:37:46 -06:00
Jason Stoltzfus 9b5605f4c4
[App Search] Added all Document related routes and logic (#83324) 2020-11-17 08:09:21 -05:00
Scotty Bollinger 2286c50dc5
[Workplace Search] Migrate sourceData from ent-search (#83459)
* Add types and missing routes

Salesforce Sandbox routes had been added since the routes were migrated.

* Migrate source_data

This is a direct port from `ent-search` with no changes other than linting.

* Adds i18n to strings in sourceData

Shared items were extracted to constants. Others were done inline

* Fix typo

* Another typo

* Rename ONE_DIVE

* Rename SERVICE_NOW

* Remove redundant variable

* Rename SHARE_POINT

* Update routes to remove hyphens
2020-11-16 15:53:04 -06:00
Constance bc3bb2afa8
[App Search] Engine Overview server route & Logic file (#83353)
* Add overview server route

* Add EngineOverviewLogic

* tfw when you forget index.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-16 11:33:30 -08:00
Jason Stoltzfus af65e139f7
[Enterprise Search] Added a shouldShowActiveForSubroutes option (#83338) 2020-11-16 12:17:25 -05:00
John Schulz 380fa5b3f6
[bundle optimization] Update to semver 7.x to get tree-shaking (#83020)
## What's changed in this PR
### Update to latest available `semver`: `7.3.2`
 * `semver` 5.x pulls in the entire library in one large file (~38k uncompressed / ~9k gz), when we might only use 1-2K.
 * `semver` 7.0+ supports tree-shaking: https://github.com/npm/node-semver/blob/master/CHANGELOG.md#700

### Update paths to only import individual function(s) used instead of the entire library
  * Getting the smaller bundle requires a different import style [as shown in the docs](https://github.com/npm/node-semver#usage)
  * Only changed code in `public` & `common` folders; not `server`. We could also update `server` as well for consistency, but I skipped because the new import style is more verbose and the filesize didn't seem as important on the server

### Results
The build stats show a 10K+ improvement for initial page bundles https://github.com/elastic/kibana/pull/83020#issuecomment-724724432

| id | [before](c6afc47f32) | [after](213bb52a8c) | diff |
| --- | --- | --- | --- |
| `ingestManager` | 386.2KB | 373.9KB | -12.3KB |
| `telemetry` | 63.5KB | 50.1KB | -13.5KB |
| `upgradeAssistant` | 74.5KB | 60.5KB | -14.0KB |
| total |  |  | -39.7KB |

### The import paths look odd. Are they required?
I agree and, no, they're not strictly required. If you'd like me to revert to the prior style just drop a comment and I'll undo them.

The caveat is that the current style (in `master` & this PR) pulls in the entire `semver` library. In 7.x that added ~15K to the initial size. Some more details in the comments: https://github.com/elastic/kibana/pull/83020#issuecomment-724859130

### Possible issues
Moving 2 major versions. We're currently on 5.7 and the latest available is 7.3. 
  * changelog says 5.x (our current) to 6.0 should be safe: https://github.com/npm/node-semver/blob/master/CHANGELOG.md#60
  * There 6.x & 7.x changes all appear to be new features or bugfixes around the `includePrerelease` flag added in 5.6, but I'm not sure if those "fixes" will break existing code
    * https://github.com/npm/node-semver/blob/master/CHANGELOG.md#613
    * https://github.com/npm/node-semver/blob/master/CHANGELOG.md#722

### Stats / screenshots
generated with `node scripts/build_kibana_platform_plugins.js --profile --focus=ingestManager`
<details><summary><b>Ingest Manager in `master`</b>: imports entire `semver` lib, totals 40k+, only 1 large file (orange arc below)</summary>

<img width="972" alt="Screen Shot 2020-11-09 at 6 50 23 PM" src="https://user-images.githubusercontent.com/57655/98666188-a50ac380-231a-11eb-9b8a-6ca784752714.png">
</details>

<details><summary><b>Ingest Manager in PR after upgrade to 7</b>: still imports entire lib. file size *increased* to ~60k, but now individual files are imported (orange arcs below)</summary>
<img width="825" alt="Screen Shot 2020-11-09 at 5 46 30 PM" src="https://user-images.githubusercontent.com/57655/98666355-e602d800-231a-11eb-803f-bc04beb4eaf1.png">
<img width="963" alt="Screen Shot 2020-11-09 at 5 47 06 PM" src="https://user-images.githubusercontent.com/57655/98666357-e69b6e80-231a-11eb-92d3-c66904f92c30.png">
</details>

<details><summary><b>Ingest Manager in PR after changing `import`s:</b> total imported size down to ~20k. Can see individual imported files</summary>
<img width="926" alt="Screen Shot 2020-11-10 at 6 10 23 AM" src="https://user-images.githubusercontent.com/57655/98667058-e64fa300-231b-11eb-9690-5e36ed6475e0.png">
<img width="895" alt="Screen Shot 2020-11-10 at 6 10 53 AM" src="https://user-images.githubusercontent.com/57655/98667059-e780d000-231b-11eb-8abf-98d8bdbcf061.png">
</details>

### Checklist

- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2020-11-14 07:32:02 -05:00
Constance 35faf8c6ca
[Enterprise Search] Share Loading component (#83246)
* Add basic Loading component

- for pages with shifting layouts or where skeletal loading doesn't make sense

* Move Loading to shared components

* Update WS to use new shared Loading component

* Fix for non-Layout WS Overview page

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.tsx

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

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
2020-11-12 17:02:47 -08:00
Constance bd99b19bd8
[App Search] Version documentation links (#83245)
* Fix CURRENT_MAJOR_VERSION for use in Elastic docs links

- Was previously just sending (e.g.) "7". instead of "7.9"

* Add App Search DOCS_PREFIX constant

- follow WS's example

* Update all App Search doc links to use prefixed URLs

- except for Enterprise Search setup guide, which should be updated to use a shared URL at some point in any case
2020-11-12 07:42:41 -08:00
Scotty Bollinger 35656b9921
Add additional sources routes (#83227)
These were missed in #83125
2020-11-12 08:28:35 -06:00
Constance c27422fdc8
Add enzyme rerender test helper (#83208)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-11 15:43:47 -08:00
Constance e6070782d6
[App Search] Update EngineRouter & EngineNav to use EngineLogic (#83138)
* Add server-side route

* Add EngineRouter logic
- useEffect init
- redirect/data loading
- setQueuedErrorMessage helper

* Add EngineNav logic
- logic values
- icon alerts

- update tests w/ real conditional testing
+ remove use of mount, mount combined with shallow_useeffect leads to weirdness

* Split out EngineRouter and EngineNav into separate files

* [PR feedback] More explicit test cases
2020-11-11 11:57:52 -08:00
Scotty Bollinger 877853add0
[Workplace Search] Add routes for Sources (#83125)
* [Workplace Search] Consolidate groups routes

This PR consolidates all of the groups route resgistration functions into a single export so that the `registerWorkplaceSearchRoutes` function only has to call the top-level routes

* Remove redundant test

* [Workplace Search] Add routes for Sources
2020-11-11 12:46:35 -06:00
Jason Stoltzfus 83b52bfd38
[App Search] Added the log retention confirmation modal to the Settings page (#83009) 2020-11-11 11:46:14 -05:00
Constance 9992950855
[App Search] Add EngineLogic (#82992)
* Set up required types

- creating new schema types for now as part of engine details

+ update shared IEngine type

* Migrate EngineLogic file

- w/ basic Kea updates & http call update

* Opinionated cleanup / changes

- | {} is needed for typescript to stop linting but will result in significant code changes / requirements for existence checks downstream
- setIsLoading and dataLoading were previously not being used in ent-search but I plan to change that so that it is used.
- move some reducers to selectors as more applicable
- add hasSchemaConflicts in preparation for upcoming view conditional

* Update EngineLogic w/ recent ent-search changes

* Write tests for EngineLogic

* [PR feedback] Kea best practices
2020-11-10 16:57:12 -08:00
Constance 2d5de2b3bd
[Enterprise Search] Tech debt/cleanup: remove I/E/T Typescript prefixes (#83099)
* [All] Remove prefixes on simple self-contained type defs

- Types should not be exported
- Types should not be used outside each affected file

* [All][kea] Remove ts prefixes and unnecessary exports

Kea now takes care of type checking for us, so there should virtually never be a need to export our values and actions interfaces going forward

* [shared] Remove createHref type prefixes

* [shared] Remove breadcrumb prefixes

* [shared] Remove telemetry prefixes

* [shared] remove types.ts

Opionionated change: it was only being used for IFlashMessage, and at this point I think it's more useful to go in one level deeper to grab the type you need

* [server] remove route dependencies prefixes

* [server] Various type cleanups

- plugin.ts - remove unnecessary export
- MockRouter - remove prefix for request type, change IMockRouter to match Kibana's IRouter
- check_access - remove prefixes
- callEnterpriseSearchConfigAPI - remove prefixes
- EnterpriseSearchRequestHandler - remove prefixes

* [common] Remove InitialAppData prefix

+ remove unnecessary export from public/plugin.ts

* [common] Remove Meta prefixes

* [common] Remove configured limits prefixes

* [AS] Remove Account and Role prefixes

* [AS] Remove Engine prefixes

* [AS] Remove credentials prefixes

* [AS] Remove log settings prefixes

* [WS] Remove account/organization/initial data prefixes

* [WS] Remove group(s), user, & content source prefixes

+ GroupLogic and GroupsLogic refactor - remove unnecessary defs in actions, it's already defined in the Actions interface above and in some cases (e.g. old History param) is causing out of date issues

* [WS] Misc type fixes

- TSpacerSize -> SpaceSizeTypes
- SourcePriority - remove prefixes
- IComponentLoader - this isn't used anywhere else and appears to be component props so it probably should live only within component_loader.tsx
- Remove recent feed activity prefix

* [WS][Opinionated] Move interfaces not used in server/ out of common/ and to public/

* Fix recently rebased types
2020-11-10 14:00:53 -08:00
Tyler Smalley f8d74e240b Revert "[Enterprise Search] Tech debt/cleanup: remove I/E/T Typescript prefixes (#83027)"
This reverts commit c7f085ff0b.
2020-11-10 11:24:02 -08:00
Constance c7f085ff0b
[Enterprise Search] Tech debt/cleanup: remove I/E/T Typescript prefixes (#83027)
* [All] Remove prefixes on simple self-contained type defs

- Types should not be exported
- Types should not be used outside each affected file

* [All][kea] Remove ts prefixes and unnecessary exports

Kea now takes care of type checking for us, so there should virtually never be a need to export our values and actions interfaces going forward

* [shared] Remove createHref type prefixes

* [shared] Remove breadcrumb prefixes

* [shared] Remove telemetry prefixes

* [shared] remove types.ts

Opionionated change: it was only being used for IFlashMessage, and at this point I think it's more useful to go in one level deeper to grab the type you need

* [server] remove route dependencies prefixes

* [server] Various type cleanups

- plugin.ts - remove unnecessary export
- MockRouter - remove prefix for request type, change IMockRouter to match Kibana's IRouter
- check_access - remove prefixes
- callEnterpriseSearchConfigAPI - remove prefixes
- EnterpriseSearchRequestHandler - remove prefixes

* [common] Remove InitialAppData prefix

+ remove unnecessary export from public/plugin.ts

* [common] Remove Meta prefixes

* [common] Remove configured limits prefixes

* [AS] Remove Account and Role prefixes

* [AS] Remove Engine prefixes

* [AS] Remove credentials prefixes

* [AS] Remove log settings prefixes

* [WS] Remove account/organization/initial data prefixes

* [WS] Remove group(s), user, & content source prefixes

+ GroupLogic and GroupsLogic refactor - remove unnecessary defs in actions, it's already defined in the Actions interface above and in some cases (e.g. old History param) is causing out of date issues

* [WS] Misc type fixes

- TSpacerSize -> SpaceSizeTypes
- SourcePriority - remove prefixes
- IComponentLoader - this isn't used anywhere else and appears to be component props so it probably should live only within component_loader.tsx
- Remove recent feed activity prefix

* [WS][Opinionated] Move interfaces not used in server/ out of common/ and to public/
2020-11-10 10:52:20 -08:00
Scotty Bollinger 8ff92f2b40
[Workplace Search] Consolidate groups routes (#83015)
* [Workplace Search] Consolidate groups routes

This PR consolidates all of the groups route resgistration functions into a single export so that the `registerWorkplaceSearchRoutes` function only has to call the top-level routes

* Remove redundant test
2020-11-10 10:30:45 -06:00
Jason Stoltzfus 291c34c84c
[App Search] Added the log retention panel to the Settings page (#82982)
* Added LogRententionPanel

* i18n

* fix axe failure

* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts

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

* Apply suggestions from code review

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

* PR Feeback: interpolation

* Apply suggestions from code review

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

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
2020-11-10 10:25:59 -05:00
Constance 04c583e2b0
[App Search] Misc naming tech debt (#82770)
* Rename `engine_overview` folder to `engines`

- To better match ent-search folder structure
- Also rename/clarify pluralization of "Engines" where possible, to distinguish between individual Engine Overview pages

* DRY out Engines and Meta Engines titles

* DRY out Credentials title

* DRY out Settings title

* DRY out Role Mappings title

* Update localization keys to match changes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-09 14:10:22 -08:00
Jason Stoltzfus d5736b10a9
[Enterprise Search] Log retention settings logic (#82364) 2020-11-09 10:46:19 -05:00
Constance 4a8f42603b
[Enterprise Search] Fix/update MockRouter helper to return specific routes/paths (#82682)
* Fix tests failing for route files that have more than 2 router registrations of the same method

- This fix allows us to specify the route call we're testing via a path param

* Update all existing uses of MockRouter to pass path param

* Add helpful error messaging

- e.g., in case a path gets typoed
2020-11-05 12:18:06 -08:00
Constance 074ef6f4d8
[App Search] Implement initial Engine routing/navigation (#82549)
* [Setup] Update routes + role privileges

Routes: use generatePath to better match ent-search
Roles: We're using "Search UI" in the nav copy now, so we should update our vars accordingly

* Add new EngineNav and EngineRouter components

* Update existing components to use new EngineRouter/EngineNav

* Add App Search engine label & new SideNavItem component

* Add EngineRouter breadcrumbs

* [Refactor] DRY out i18n constants
2020-11-05 09:51:41 -08:00
Scotty Bollinger ccc3e23620
[Workplace Search] Refactor nav constants (#82646)
* Move NAV constants to top level

This was only needed locally in Groups but we can to store all  nav constants in the global constants file

* Extract remaining nav constants

* Fix links to NAV in routers

* Use constant for path

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-05 11:48:43 -06:00
Scotty Bollinger 894e76f79e
[Enterprise Search] Write tests groups routes (#82669)
* Remove validation from groups route responses

Since this is a migration of known good endpoints, these aren’t necessary.

* Add tests for groups routes

* Remove unused types

* Remove registerWSGroupRoutes from groups test

This was removed in another commit and is no longer needed

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-05 10:01:00 -06:00
Scotty Bollinger 7e5ca2944e
[Enterprise Search] Migrate shared SourceConfigFields component (#82608) 2020-11-05 10:00:43 -06:00
Constance b264498c1e
[Enterprise Search] Refactor product server route registrations to their own files/folders (#82663)
* Refactor all AS & WS route registrations to their own file/folders

* Remove WS in route registrations since the main fn is already specific

* Cover index.ts files

- super basic, leaves out assertions to avoid brittleness

* Move WS group routes to index.ts
2020-11-04 17:43:09 -08:00
Constance c59ad36dc6
[Enterprise Search] Trivial API fixes (#82552)
* Fix embarrassing typo

* Fix uncovered line
2020-11-04 08:17:18 -08:00
Scotty Bollinger ae992bad64
[Enterprise Search] Migrate shared ComponentLoader component (#82504) 2020-11-04 08:24:20 -06:00
Scotty Bollinger 5a9fc25dc8
[Enterprise Search] Migrate shared ApiKey component (#82511) 2020-11-04 08:24:10 -06:00
Scotty Bollinger 39ce0cdd11
[Enterprise Search] Migrate shared CredentialItem component (#82471) 2020-11-03 14:30:28 -06:00
Constance adf0e249c7
[Enterprise Search] Telemetry: refactor to Kea logic file (#81926)
* Add new TelemetryLogic helpers

- DRYs out need to import/pass http lib
- adds product-specific helpers which DRYs out an extra line

* Update all previous sendTelemetry fns to use new logic actions

* Update unit tests for updated components

- Create reusable mocks
- Update overview_logic.ts to use new Kea mock helpers (required for recent_activity.test to pass)

* Cleanup: Remove old sendTelemetry fn
+ update tests

* [PR feedback] Correctly assert the async thrown error
2020-11-03 10:48:44 -08:00
Jason Stoltzfus 9259b1f61a
[Enterprise Search] Added App Search log settings routes (#82162) 2020-11-03 12:57:50 -05:00
Scotty Bollinger 77f56a239f
[Workplace Search] Migrate shared LicenseBadge component (#82372)
* [Enterprise Search] Migrate shared LicenseBadge component

* Move files to Workplace Search dir

I mistakenly thought these were shared at the Enterprise Search level
2020-11-03 11:28:48 -06:00
Jason Stoltzfus 0317fd8137
Added Settings page to App Search (#82061) 2020-11-03 09:45:48 -05:00
Greg Thompson 6fdc7eb1fa
Upgrade EUI to v30.1.1 (#81499)
* eui to v30.0.0

* removed unused RecentLinks component

* update compressed -> display prop

* euiformrow compressed -> display

* euipopover remove withtitle

* euibuttongroup prop updates

* remove euibuttontoggle

* src snapshot updates

* tutorial euibuttongroup update

* x-pack snapshot updates

* euibuttongroup test updates

* TODO

* misc. js file updates

* remove euinavdrawer scss references

* translation removals

* more x-pack snapshot updates

* update data-test-subj lookup

* icons logoAMP -> logoObservability

* cypress selector updates

* update euibuttontoggle onchange, test interaction

* Fix auto-update toggle in Visualize

* some more change -> click test updates

* idtoselectedmap change

* Fix feature table button group

* Remove empty SASS file

* Fix feature table button group II

* Using `compressed` to also dictate dual range row

* Fix a few security labels

* An ML fix

* Apply suggestions from code review

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>

* remove unused translation

* update view_type_toggle snapshot

* more snapshot updates

* eui to 30.1.0

* undo temp ts-ignore

* more x-pack snapshot updates

* eui to 30.1.1

* update feature privilege text

* Update x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.tsx

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* reuse i18n token

* Adapt log entry action button to new `minWidth` prop

* clean up label

* Combine auto apply strings into one

* ternary fix

* cases status useCallback

Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>
Co-authored-by: Felix Stürmer <stuermer@weltenwort.de>
2020-10-30 16:18:27 -06:00
Thomas Watson 1407f713e5
Update KibanaRequest to use the new WHATWG URL API (#80713) 2020-10-29 14:35:48 +01:00
Constance eb30e9513d
[Enterprise Search] Add missing Enterprise Search Overview telemetry collectors/schema (#81858)
* Add Enterprise Search cannot connect telemetry event

* Add missing server-side telemetry collectors & schema
2020-10-28 09:23:35 -07:00
Constance 7508321284
[App Search] Credentials: implement working flyout form (#81541)
* Add key name field

* Add key type field

* Add key read/write fields

* Add key engine access / selection

* Add key update warning callout

* Update flyout body with form components

* [PR feedback] i18n - change appSearch.tokens to appSearch.credentials

* [PR feedback] Remove unnecessary conditional
2020-10-26 11:30:06 -07:00
Constance 7934c9105a
[App Search] Credentials: Add final Logic and server routes (#81519)
* Add fullEngineAccessChecked logic

* Add onEngineSelect logic

* [Refactor] DRY out/simplify http mocks

Note: import reorder is required in for mocks to work correctly

* Add onApiTokenChange logic

* Update flyout footer to use onApiTokenChange

* Add new POST/PUT server routes

+ some opinionated comments

* [PR feedback] tests copy, extra data tests

* [PR feedback] Reuse fullEngineAccessChecked, fix fullEngineAccessChecked being undefined vs a bool
2020-10-22 14:52:35 -07:00
Constance c9d4dc30a3
[App Search] Credentials: add FlashMessages, stub out credentials flyout (#81391)
* Added an empty Flyout

* Refactor CredentialsFlyout to its own component folder
+ split out child sub components for easier testing/reading

* Add initial FlashMessages setup

- mostly just DELETE_MESSAGE currently, since that's what's already wired up
- CREATE_MESSAGE and UPDATE_MESSAGE will be used in an upcoming commit

+ adds FlashMessages in flyout, which will show returned form errors from the API

* Fix flash messages appearing on flyout open
e.g. deletion success messages

+ incidental linting/cleanup

Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
2020-10-22 11:05:21 -07:00
Constance aa2427b3c0
[Enterprise Search] Overview - add missing setup guide CTAs (#81420)
* Misc enterprise search overview cleanup

- remove extra comment block
- tests
  - use setMockValues
  - remove unused EuiPage
  - error connecting test - clarify assertion

* Add Setup Guide CTA component

* Update Product Selector to show Setup Guide CTAs

+ tests clean up - use setMockValues, import reorder

* Add EuiPanel RR link to setup guide
2020-10-22 08:50:54 -07:00
Scotty Bollinger b2fc892906
[Workplace Search] Add top-level tests for Groups (#81215)
* Update id of second sources mock to be unique

Both were originally set to ‘123’

* Remove unused types from interface

These were never used and were only uncovered while testing. These both exist on `group` but not at the top level.

* Add group mock

* Fix typo in reducer name

* Add tests for group_logic

* Remove redundant messages check

This is not needed with global flash messages, as the component will not render with no messages.

* Add tests for group_router

* Add group mock

* Add tests for groups_logic

* Convert groups_router to use children

This allow for testing the component visiblity and aligns with other usage of React Router

* Add tests for groups_router

* Refactor pagination logic

This commit removes the useDidUpdateEffect custom hook and moves the logic to fetch the search results to a listener inside of Kea.

* dd tests for main groups container

* Lint fixes

* Fix broken test and remove comment

The issue was that the delay needed to be in the catch block to properly execute.

* Add comments and make test explicit

In other places in the tests, we explicitly test for an error string in the catch block. Changing this to match.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-21 21:22:45 -04:00
Larry Gregory bf0f8bbb42
Cleanup feature registration (#80909) 2020-10-20 12:53:43 -04:00
Scotty Bollinger cf13fe2b7c
[Workplace Search] Fix Group Prioritization route and clean up design (#80903)
* Update route path for prioritizations

* Update prioritization spacing

* Lint fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-19 17:08:34 -04:00
Jason Stoltzfus e74613a45f
[Enterprise Search] Added reusable HiddenText component to Credentials (#80033) 2020-10-19 17:06:14 -04:00
Jason Stoltzfus 4c81b1a64b
[Enterprise Search] Handle loading state on Credentials page (#80035) 2020-10-19 15:10:27 -04:00
Jason Stoltzfus 67ec846549
[Enterprise Search] Added an EuiEmptyState to Credentials page #2 (#80034) 2020-10-19 15:09:52 -04:00
Constance 02d850f4a8
Move renderHeaderActions back into mount useEffect + update tests (#80861) 2020-10-16 10:47:05 -07:00