Commit graph

160 commits

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