-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Onboarding] Introduce search index details page locator and update all reference #205005
base: main
Are you sure you want to change the base?
[Onboarding] Introduce search index details page locator and update all reference #205005
Conversation
…saarikabhasi/kibana into onboarding/search-index-details-locator
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7628[✅] x-pack/test/functional_search/config.ts: 25/25 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7627[✅] x-pack/test/api_integration/apis/search/config.ts: 25/25 tests passed. |
…saarikabhasi/kibana into onboarding/search-index-details-locator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x-pack/test/functional/page_objects/index.ts
changes LGTM
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tests are going to collide with Yan's changes. They are broadly similar but theres likely slight differences in approach.
I suggest we wait until @yansavitski changes are merged in then we can rebase the FTR tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…saarikabhasi/kibana into onboarding/search-index-details-locator
💔 Build Failed
Failed CI StepsHistory
|
[share] | ||
); | ||
|
||
const SearchIndicesLinkProps = useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This is not a good way to use useCallback()
. That should be used if you want to create a onClick handler for the EuiLink
. This is being used to generate props at render time, which feels like a code smell to me.
What you likely want is something more like this:
const onSearchIndicesClick = useCallback(
(event: React.MouseEvent<HTMLAnchorElement>, indexName: string) => {
if (!searchIndicesLocator) return;
e.prevenDefault();
searchIndicesLocator.getUrl({ indexName }).then((url) => {
navigateToUrl(url, {
shouldNotCreateHref: true,
shouldNotPrepend: true,
});
});
},
[navigateToUrl, searchIndicesLocator]
);
...
health === 'unknown' ? name : <EuiLink data-test-subj='search-application-index-link' href={searchIndicesLocator.getRedirectUrl({})} onClick={(e) => onSearchIndicesClick(e, name)}>{name}</EuiLink>
but the promise in the useCallback
is problematic, but likely the best option if we do this here. A plus would be this function could be shared between the link and and the action instead of having two handlers.
BUT a better option might be to create a link component that takes the index name as a prop and handles all this logic with the locator and share plugin start in that component which is rendered in the column render()
it could then be used in this file and the flyout
() => share?.url.locators.get('SEARCH_INDEX_DETAILS_LOCATOR_ID'), | ||
[share] | ||
); | ||
const SearchIndicesLinkProps = useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see other comment.
const searchIndexDetailsUrl = share?.url.locators | ||
.get('SEARCH_INDEX_DETAILS_LOCATOR_ID') | ||
?.useUrl({ indexName: connector?.index_name }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this usage of the locator so different from the others? if we can make a sync call that returns the value or undefined
we should likely prefer this pattern.
Summary
search_indices
plugin index details page -SEARCH_INDEX_DETAILS_LOCATOR_ID
.search - Elasticsearch solution nav
demo.mov
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.