Commit graph

256 commits

Author SHA1 Message Date
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