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
* Fix screen reader still reading out bullet bullet bullet
* Even out horizontal spacing
* Break long password text
* Make EUI table cell full width on mobile
* Remove logic preventing Crawler from being used on sample engines
* Remove check around crawler button in DocumentCreationButtons
- primarily a UI thing - ideally we always want to show 4 buttons
* Rename variables
This will make reviewing later commits easier
* Use internal routing instead of history.push
Also updates path to Loading
* Move state from component to logic
* Add tests
* Add ApiCodeExample modal component
- Previously lived in EngineOverview / Onboarding
* Add basic PasteJsonText component
* Add basic UploadJsonFile component
* [Refactor] Have all modal components manage their own ModalHeader & ModalFooters
- Per feedback from Casey
+ Update DocumentCreationModal to use switch
* Set basic empty/disabled validation on ModalFooter continue buttons
* Update x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/creation_mode_components/api_code_example.tsx
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
* [PR feedback] Typescript improvements
* [PR feedback] Remove need for hasFile reducer
- by storing either 1 file or null
- which gets around the stored FileList reference not triggering a rerender/change
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Remove missed action calls
These were missed in the PR that split apart add_source_logic from source_logic. These 2 mthods aren’t even in this file. My mistake
* Change order of method calls
For some reason the test would not pass with the order of the methods the way they were. Changing the order to where the error callback is called first somehow made the test pass
* Fix bug where query params never set
Uncovered a bug while writing this test. After moving from ent-search to Kibana, it was discovered that the Kibana server did not work well with an empty question mark in the URL. The fix attempted to use lodash’s isEmpty metthod. The problem is that the URLSearchParams class instance created is not an object but has getter/setter functionality so isEmpty always returned true. This fixes it to actually work.
* Remove throw blocks
In ent-search we had to account for edge cases where the error state wasn’t bubbling up. One of these has been covered with global flash messages. The other will be tested at later date. A tech-debt item has been created.
Reference PRs:
https://github.com/elastic/ent-search/pull/394https://github.com/elastic/ent-search/pull/701
* Export interfaces for use in tests
* Add tests for add_source_logic
* Remove weird import
I guess the IDE autocompleted that. Should not have been there
* Remove redundant test
This test was added before this comit when trying to get coverage for the throw blocks
7ca9c2b244
* Lint fixes
* Update Jest config to automatically report coverage
- No more super intricate yarn commands! Hooray
* Add handy shell script for running tests & coverage on specific folders/subdirectories
* Add mocks
* Make mergeServerAndStaticData available to tests
This method is needed to combine the 3 types of data to use in the logic files. Exporting this so that the mock data can be combined for testing in components.
It was discovered that the serverData had the wrong typings. This was only discovered when actully mocking the real server data, so it was changed here.
* Add tests for AddSourceHeader
* Add tests for AddSourceList
* Add tests for AvailableSourcesList
* Add tests for ConfigCompleted
* Add tests for ConfigDocsLinks
* Add tests for ConfigurationIntro
* Add tests for ConfigureCustom
* Add tests for ConfigureOauth
* Fix typo
* Add coverage for missing functions
The converage tool was complaining and this change assures formSubmitSuccess and handleFormSubmitError are covered
* Fix mocks
Needed an accountOnly source in this test so changed and update other tests where used
* Add tests for ConfiguredSourcesList
* Add tests for ReAuthenticate
Also changes the syntax of the redirect to use the replace method for easier testing
* Add sourceConfigData mock
* Add tests for SaveConfig
* Add tests for SaveCustom
* Add tests for SourceFeatures
* Add tests for ConnectInstance
As with the ReAuthenticate component, changes the syntax of the redirect to use the replace method for easier testing.
* [Setup] Add EuiCardTo helper
* Set up very basic DocumentCreationLogic file modal management
* Create buttons and modal components
* Update EngineOverviewEmpty to use only DocumentCreationButtons
- Remove API section/example/constants for now: per design discussion, we'll be moving this section into the document creation modal
- Move preceding DOCUMENT_CREATION_DESCRIPTION paragraph directly into DocumentCreationButtons, since the Documents view will just use this verbatim
* Update Documents view Index Documents button to show DocumentsCreationModal
- with some extra logic to add a new creationStep view
+ some minor test cleanup / clarification for openDocumentCreation
* Update Crawler button with conditional check
- Forgot to port this over initially
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Copy SourceLogic to AddSourceLogic
This commit merely copies SourceLogic and renames it to AddSourceLogic with the name of the component and interfaces changed. This will make reviewing the changes easier later
* Delete duplicated logic data
* Update component paths
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* 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>
* 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>
* Initial copy/paste of component tree
Only does linting changes and:
- lodash imports
- Replace unescaped apostrophes with '
- 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
* 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
* 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
* 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>
* 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>
* 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
* 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>
* 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
* 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
* 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
* 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>
* 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>
* 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
* 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 ‘'’ 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 ‘!!’
* [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
* 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>
* 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:
* 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
* Move source icons into subfolder
* Copy over new icons
* Update SourceIcon to account for full bleed images
* Remove unused file
* Fix broken icon path
* 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
* 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
* 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
* 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
* 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
* 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>
* 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
* [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
* Set up required types
- creating new schema types for now as part of engine details
+ update shared IEngine type
* Migrate EngineLogic file
- w/ basic Kea updates & http call update
* Opinionated cleanup / changes
- | {} is needed for typescript to stop linting but will result in significant code changes / requirements for existence checks downstream
- setIsLoading and dataLoading were previously not being used in ent-search but I plan to change that so that it is used.
- move some reducers to selectors as more applicable
- add hasSchemaConflicts in preparation for upcoming view conditional
* Update EngineLogic w/ recent ent-search changes
* Write tests for EngineLogic
* [PR feedback] Kea best practices
* [All] Remove prefixes on simple self-contained type defs
- Types should not be exported
- Types should not be used outside each affected file
* [All][kea] Remove ts prefixes and unnecessary exports
Kea now takes care of type checking for us, so there should virtually never be a need to export our values and actions interfaces going forward
* [shared] Remove createHref type prefixes
* [shared] Remove breadcrumb prefixes
* [shared] Remove telemetry prefixes
* [shared] remove types.ts
Opionionated change: it was only being used for IFlashMessage, and at this point I think it's more useful to go in one level deeper to grab the type you need
* [server] remove route dependencies prefixes
* [server] Various type cleanups
- plugin.ts - remove unnecessary export
- MockRouter - remove prefix for request type, change IMockRouter to match Kibana's IRouter
- check_access - remove prefixes
- callEnterpriseSearchConfigAPI - remove prefixes
- EnterpriseSearchRequestHandler - remove prefixes
* [common] Remove InitialAppData prefix
+ remove unnecessary export from public/plugin.ts
* [common] Remove Meta prefixes
* [common] Remove configured limits prefixes
* [AS] Remove Account and Role prefixes
* [AS] Remove Engine prefixes
* [AS] Remove credentials prefixes
* [AS] Remove log settings prefixes
* [WS] Remove account/organization/initial data prefixes
* [WS] Remove group(s), user, & content source prefixes
+ GroupLogic and GroupsLogic refactor - remove unnecessary defs in actions, it's already defined in the Actions interface above and in some cases (e.g. old History param) is causing out of date issues
* [WS] Misc type fixes
- TSpacerSize -> SpaceSizeTypes
- SourcePriority - remove prefixes
- IComponentLoader - this isn't used anywhere else and appears to be component props so it probably should live only within component_loader.tsx
- Remove recent feed activity prefix
* [WS][Opinionated] Move interfaces not used in server/ out of common/ and to public/
* Fix recently rebased types
* [All] Remove prefixes on simple self-contained type defs
- Types should not be exported
- Types should not be used outside each affected file
* [All][kea] Remove ts prefixes and unnecessary exports
Kea now takes care of type checking for us, so there should virtually never be a need to export our values and actions interfaces going forward
* [shared] Remove createHref type prefixes
* [shared] Remove breadcrumb prefixes
* [shared] Remove telemetry prefixes
* [shared] remove types.ts
Opionionated change: it was only being used for IFlashMessage, and at this point I think it's more useful to go in one level deeper to grab the type you need
* [server] remove route dependencies prefixes
* [server] Various type cleanups
- plugin.ts - remove unnecessary export
- MockRouter - remove prefix for request type, change IMockRouter to match Kibana's IRouter
- check_access - remove prefixes
- callEnterpriseSearchConfigAPI - remove prefixes
- EnterpriseSearchRequestHandler - remove prefixes
* [common] Remove InitialAppData prefix
+ remove unnecessary export from public/plugin.ts
* [common] Remove Meta prefixes
* [common] Remove configured limits prefixes
* [AS] Remove Account and Role prefixes
* [AS] Remove Engine prefixes
* [AS] Remove credentials prefixes
* [AS] Remove log settings prefixes
* [WS] Remove account/organization/initial data prefixes
* [WS] Remove group(s), user, & content source prefixes
+ GroupLogic and GroupsLogic refactor - remove unnecessary defs in actions, it's already defined in the Actions interface above and in some cases (e.g. old History param) is causing out of date issues
* [WS] Misc type fixes
- TSpacerSize -> SpaceSizeTypes
- SourcePriority - remove prefixes
- IComponentLoader - this isn't used anywhere else and appears to be component props so it probably should live only within component_loader.tsx
- Remove recent feed activity prefix
* [WS][Opinionated] Move interfaces not used in server/ out of common/ and to public/
* [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
* Rename `engine_overview` folder to `engines`
- To better match ent-search folder structure
- Also rename/clarify pluralization of "Engines" where possible, to distinguish between individual Engine Overview pages
* DRY out Engines and Meta Engines titles
* DRY out Credentials title
* DRY out Settings title
* DRY out Role Mappings title
* Update localization keys to match changes
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Fix tests failing for route files that have more than 2 router registrations of the same method
- This fix allows us to specify the route call we're testing via a path param
* Update all existing uses of MockRouter to pass path param
* Add helpful error messaging
- e.g., in case a path gets typoed
* [Setup] Update routes + role privileges
Routes: use generatePath to better match ent-search
Roles: We're using "Search UI" in the nav copy now, so we should update our vars accordingly
* Add new EngineNav and EngineRouter components
* Update existing components to use new EngineRouter/EngineNav
* Add App Search engine label & new SideNavItem component
* Add EngineRouter breadcrumbs
* [Refactor] DRY out i18n constants
* Move NAV constants to top level
This was only needed locally in Groups but we can to store all nav constants in the global constants file
* Extract remaining nav constants
* Fix links to NAV in routers
* Use constant for path
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Remove validation from groups route responses
Since this is a migration of known good endpoints, these aren’t necessary.
* Add tests for groups routes
* Remove unused types
* Remove registerWSGroupRoutes from groups test
This was removed in another commit and is no longer needed
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Refactor all AS & WS route registrations to their own file/folders
* Remove WS in route registrations since the main fn is already specific
* Cover index.ts files
- super basic, leaves out assertions to avoid brittleness
* Move WS group routes to index.ts
* Add new TelemetryLogic helpers
- DRYs out need to import/pass http lib
- adds product-specific helpers which DRYs out an extra line
* Update all previous sendTelemetry fns to use new logic actions
* Update unit tests for updated components
- Create reusable mocks
- Update overview_logic.ts to use new Kea mock helpers (required for recent_activity.test to pass)
* Cleanup: Remove old sendTelemetry fn
+ update tests
* [PR feedback] Correctly assert the async thrown error
* [Enterprise Search] Migrate shared LicenseBadge component
* Move files to Workplace Search dir
I mistakenly thought these were shared at the Enterprise Search level
* Add fullEngineAccessChecked logic
* Add onEngineSelect logic
* [Refactor] DRY out/simplify http mocks
Note: import reorder is required in for mocks to work correctly
* Add onApiTokenChange logic
* Update flyout footer to use onApiTokenChange
* Add new POST/PUT server routes
+ some opinionated comments
* [PR feedback] tests copy, extra data tests
* [PR feedback] Reuse fullEngineAccessChecked, fix fullEngineAccessChecked being undefined vs a bool
* Added an empty Flyout
* Refactor CredentialsFlyout to its own component folder
+ split out child sub components for easier testing/reading
* Add initial FlashMessages setup
- mostly just DELETE_MESSAGE currently, since that's what's already wired up
- CREATE_MESSAGE and UPDATE_MESSAGE will be used in an upcoming commit
+ adds FlashMessages in flyout, which will show returned form errors from the API
* Fix flash messages appearing on flyout open
e.g. deletion success messages
+ incidental linting/cleanup
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
* Update id of second sources mock to be unique
Both were originally set to ‘123’
* Remove unused types from interface
These were never used and were only uncovered while testing. These both exist on `group` but not at the top level.
* Add group mock
* Fix typo in reducer name
* Add tests for group_logic
* Remove redundant messages check
This is not needed with global flash messages, as the component will not render with no messages.
* Add tests for group_router
* Add group mock
* Add tests for groups_logic
* Convert groups_router to use children
This allow for testing the component visiblity and aligns with other usage of React Router
* Add tests for groups_router
* Refactor pagination logic
This commit removes the useDidUpdateEffect custom hook and moves the logic to fetch the search results to a listener inside of Kea.
* dd tests for main groups container
* Lint fixes
* Fix broken test and remove comment
The issue was that the delay needed to be in the catch block to properly execute.
* Add comments and make test explicit
In other places in the tests, we explicitly test for an error string in the catch block. Changing this to match.
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>