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