* Fix ErrorConnecting state to be caught/returned earlier
- This fixes AppSearch crashing when in an error connecting state and missing props required for AppSearchConfigured
- This also fixes the error connecting page not showing up for engine routes
- The SetupGuide route was moved to a top-level route, so that all views always have access to it no matter what
* [Extra] Simplify engine route/path
- Move engine/route path under the main <Layout>
- Change <AppSearchNav> behavior to pass subNavs based on route matches, rather than requiring a prop passed to it
+ add useRouteMatch mock
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [Workplace Search] Redirect to correct route for form created sources
* Remove unnecessary passing of query params
This is no longer needed with the new route
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Empty State in Curations
* Adds Empty State to Documents View
* Updates Empty State in Engines Overview
* Updates Relevance Tuning empty state
* Updates the Result Settings empty state
* Updating test files.
* Display the empty state in the table only
* Copy changes
Small copy changes to bring it more inline with Elastic guidelines
* Update api_logs_table test
* Copy adjustments
* Fixing failing type check
* Copy adjustments on credentials empty state
* Copy changes on meta engines table
* Removes emptyState__prompt class
* Removes emptyState__prompt class
Forgot to save a file
* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/empty_state.tsx
* Adding the popout icon to docs links
* Removes the need for the engineIcon class
Also allows EuiIcon props to be passed to metaEngineIcon
* Updates meta engine empty state button to docs link
* Adds a separate constant for the empty meta engine button
* Meta Engines empty state refactor
- pull it out to its own component
- simplify tests
- simplify constants, they're only in 1 location so prob don't need to be in DRY'd out
- fix some i18n IDs
* Curations refactor
* Documents empty state refactor
- create components/ folder, move document creation button to there (feels like it belongs)
- move empty state there
- remove other empty state prompt from SearchExperienceContent??? Not sure why that wasn't showing up, but fixed tests/returns
* Relevance Tuning refactor
- create components/ folder
- move empty state + shared boost icon & value badge to it
- write test for missing value badge coverage
MISC
- Fix loading screen to an early return (matches UI of all other views)
- Remove extra EuiSpacer in layout (matches UI of all other views)
Sorry for the extra noise in your PR Davey!
* Result Settings refactor
- move empty state to its own component
- fix broken .html.html link
* Fix missing popout icon on documentation button link
* EnginesOverview cleanup
- Remove unnecessary CSS
- fix responsive behavior of icons
- standardize responsive behavior of create button actions
- standardize spacing between content headers & tables
- Tweak gap between 2 tables
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
* Refactor main component
* Refactor faux view button
The original design called for a button-looking component on the accordion header so it looks clickable to reveal the error underneath. Using a button element caused the console to error because the entire header is a button and this is a child. Adding an href fixes the error and allows for styling as a button
* Use empty button rather than styles components for view button
* Remove extra classNames and fix layout to stretch cells
* Add stylesheet
Without the width: 100% on .euiIEFlexWrapFix, the header table does not stretch across the screen. Couldn’t find another way around this and happy to take suggestions of a better idea.
* Add prop to prevent line break on IDs
Existing implementation was causing multi-character IDs to break to a new line. So for 12, its was:
1
2
* Render flash message when server sends back an error
* Fetch data on all route changes
This produced a bug where the nav and loading states were triggered between route changes. Added conditional to prevent resetting between in-source changes
* Remove unknown allows from enterprisesearch routes
It is a best practice to avoid `unknowns: allow` in request
body validations.
Usage of `unknowns: allow` in the App Search plugin has primarily
been to avoid creating full validation schemas, as they can often
be complex.
Rather than have a half-baked validation that uses `unknowns: allow`,
we have the option to skip parsing and validating a JSON body entirely,
and simply pass it through "as-is" to the enterprise_search server
for validation.
* Move to helper
* Swap comment block style
* PR feedback
* Update x-pack/plugins/enterprise_search/server/lib/route_config_helpers.test.ts
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* Update x-pack/plugins/enterprise_search/server/lib/route_config_helpers.test.ts
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* Update x-pack/plugins/enterprise_search/server/lib/route_config_helpers.ts
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* Update x-pack/plugins/enterprise_search/server/lib/enterprise_search_request_handler.ts
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* Better TS
* Change to TS validations
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
* Add barebones Synonyms view
* Update Synonyms route+nav link
* Add server API routes
- will be used in upcoming PRs, may change
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Fix private source docs link
* Add a whole bunch of missed shadow/background changes to panels
* Add success messages to Role mappings
* Fix bug where sourceId still in memory
If you were on an org source and then clicked to view your Personal dashboard, the subnav was visible because the source Id was still in the logic file. This resets it on unmount.
As a part of this fix, dataLoading was set to true on reset. Because of this, some places that were resettings state, but not fetching new data, were left in a loading state. This commit also removes the redundant `resetSourceState` calls around the components that don’t fetch a fresh copy of the source data
* Add new reusable MultiInputRows component
- basically the CurationQuery component, but with a generic values var & allows passing in custom text for every string
* Update CurationQueries with MultiInputRows
* Update MultiInputRows to support on change behavior
- for upcoming Relevance Tuning usage
* Update Relevance Tuning value boost form to use new component
- relevance_tuning_form.test.tsx fix: was getting test errors with mount(), so I switched to shallow()
* Change submitOnChange to onChange fn
- more flexible - allows for either an onSubmit or onChange, or even potentially both
* Convert MultiInputRowsLogic to keyed Kea logic
- so that we can have multiple instances on the same page - primarily the value boosts use case
* Update LogicMounter helper & tests to handle keyed logic w/ props
* [Misc] LogicMounter helper - fix typing, perf
- Use Kea's types instead of trying to rewrite my own LogicFile
- Add an early return for tests that pass `{}` to values as well for performance
* PR feedback: Change values prop to initialValues
+ bonus - add a fallback for initially empty components
+ add a test to check that the logic was mounted correctly
* PR feedback: Remove useRef/on mount onChange catch for now
- We don't currently need the extra catch for any live components, and it's confusing
* Move redirect logic into logic file
* Add logic to prevent prompt from triggering when changing tabs
The idea here is to set a boolean flag that sends false for unsavedChanges when switching between tabs and then sets it back after a successful tab change
* Keep sidebar nav item active for both tabs
* Add tests
* Update Workplace Search nav to align with App Search
* Add constants to shared
* [App Search] Use shared constants
* [Workplace Search] Add breadcrumbs to Role mappings
* Enable shouldShowActiveForSubroutes
* Pull out columns to be re-used for MetaEnginesTable
* Add route to get source engines for meta engines
* New MetaEnginesTableLogic
* New MetaEnginesTable component
* Remove isMeta prop from EnginesTable
* Swap EnginesTable with MetaEnginesTable in EnginesOverview for meta engines
* Missing test for MetaEnginesTableNameColumnContent
* Created new /app_search/components/engines/components/tables directory
* Moving columns to shared_columns.tsx file
* Updates to MetaEnginesTableExpandedRow and MetaEnginesTableNameColumnContent
* Fixes to EnginesTable, MetaEnginesTable, MetaEnginesTableLogic
* Remove flatten import
* Fix i18n
* PR Feedback
* DRY out shared engine link helpers
* DRY out shared ACTIONS_COLUMN
* Tests: DRY out shared columns/props tests
+ update to account for 2 previous DRY commits (e.g. deleteEngine mock)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
* Update shared button color and panel shading
* Vertically align table cells to top
* [App Search] Update panels to have backgrounds not borders
* [Workplace Search] Update panels to have backgrounds not borders
* re-align last cell to right
Accidentally deleted it refactoring
* Conditionally have border for App Search
Requested to remove for empty state
* Add missing i18n
Oops
* Change button color
* Fix custom source created screen
* Add better empty state to groups
* Align toggle to right side of table
* Update design for security page
* Update ‘How to add’ view
* Update config completed view
* Update add source connect page
* Remove padding on how to add card
Original had no padding.
* CSS cleanup
* Refactor ResultActions component + DRY out link behavior
- Create new separate ResultActions component
- Pass actions array through to header and have haeder in charge of conditional visibility / FlexItem wrapper (this matches the other header items)
- shouldLinkToDetailPage: instead of generating custom JSX, just have it be a standard action and append it to the actions array
Link behavior:
- ResultHeaderItem - switch to EuiLinkTo, no need for extra wrapper
- ResultHeader - DRY out unnecessary extra path generation - instead pass down a conditional documentLink instead of a bool
* PR feedback: Fix test name
* PR feedback: unshift
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Workplace Search: Remove redundant Overview breadcrumb from Sources
There is "Source name" breadcrumb that is used for Overview page
* App Search: remove "Overview" breadcrumb from Engine page
So instead of `engines / national-parks-demo / overview (greyed)`
we will have just
`engines / national-parks-demo (greyed)`
* App Search: Add "Engines" breadcrumb to the main App Search page
This needs to be added to 3 states of the page: Normal, Empty and Loading
* Fix failing WS test
* App Search: DRY out SetPageChrome declaration by putting it in header
* Fix failed test "ShallowWrapper::dive() can only be called on components"
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Update our EUI breadcrumb helper to skip generating links for the last breadcrumb in the list
* Fix useEuiBreadcrumbs tests
- add a describe block to make it clear we're testing link behavior in non-last breadcrumbs
- add a helper that automatically adds a last breadcrumb so that link generation still works
* Add comment/note as to why I didn't add last-breadcrumb-specific logic to useGenerateBreadcrumbs
* Revert change to wrap setContext in useEffect
A recommendation was made to wrap the setContext call in a previous PR, which lets the app know if the context is org or account, in a useEffect call, for potential performance reasons. Unfortunately, this causes the lifecycle to change so that changing routes from org to personal dashboard does not register the change in time. This commit changes it back to a working state.
* Add constants and routes for Account nav
* Add AccountHeader component
* Add header to layout and fix height
The main layout stylesheet, https://github.com/elastic/kibana/blob/master/x-pack/plugins/enterprise_search/public/applications/shared/layout/layout.scss gives a static height that includes the main Kibana navigation. The height with the account nav only is added to the existing privateSourcesLayout css class
* Refactor test
For both OneDrive and SharePoint we define a service_type that has an
underscore in the middle (one_drive and share_point). This fixes the
route definitions so sources of these connector types can be
reauthenticated.
* Set up helper for showing JSON request/response bodies
* Set up mock API log obj for tests to use
* Add ApiLogLogic file for flyout handling
* Add ApiLogFlyout component
* Update views to load flyout
* Update table to open flyout
* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/api_logs/utils.ts
* PR feedback: comments
Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Hide chrome for Workplace Search by default
The Workplace Search Personal dashboard needs the chrome hidden. We hide it globally here first to prevent a flash of chrome on the Personal dashboard and unhide it for admin routes, which will be in a future commit
* Add core.chrome.setIsVisible to KibanaLogic
* Toggle chrome visibility for Workplace Search
* Add test
* Refactor to set context and chrome when pathname changes
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Fix route for private deferated source summary
* Make schema types nullable
Federated sources don’t have counts and the server returns null so our routes have to expect that sometimes these values will be null
* Add SourceSubNav to Personal dashboard
We are able to leverage the existing component with a couple a small change; the existing componet is a subnav in the larger Enterprise Search shared navigation component and does not include its styles. This caused the list items to render with bullet points next to them. Adding this class and displaying the nav items as block elements fixes this issue.
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
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.
* 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>
* 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
* 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__
* 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
* 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>
* 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
* 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>
* 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!
* 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
* 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>
* 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
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.
* 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
* 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
* [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>
* 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
* 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>
A recent refactor of content source jobs models unintentionally
changed this API. This change restores the functionality of the
re-authentication "Fix" link.
* 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
* 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>
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
* 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 as horizontal spacer
* 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>
* 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
* 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.
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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>
* 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>
* [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
* 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>
* 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>
* 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
* 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
* 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
* 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>
* 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.
* 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>
* 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>
* 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
* 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
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
* 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)
* 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
* 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>
* [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>
* 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>
* 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
* 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
* 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>
* 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
* 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>
* [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
* 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>
* 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
* 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>
* 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
* 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>
* Add getListeners to Kea test helpers
* Update TelemetryLogic to use new getListeners helper
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* 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
* [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
* 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
* 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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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
* 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
* [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>
* 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)
* 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
* [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
* [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)
* 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
* 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
* 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
* 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)
* 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
* [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>
* 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>
* 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