Skip to content
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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

saarikabhasi
Copy link
Member

@saarikabhasi saarikabhasi commented Dec 19, 2024

Summary

  • Introducing new locator for onboarding search_indices plugin index details page - SEARCH_INDEX_DETAILS_LOCATOR_ID.
  • In stack, Updated view index details usage(connector table, connector details page, search application & web crawler) to use this locator to navigate to onboarding index details page ONLY when its search - Elasticsearch solution nav
  • Index management view index details would use extensionService with active solution id check in search_indices plugin
  • verified locally existing FTR & unit tests
  • Added FTR for index management in functional_search tests for search solution nav and classic nav
demo.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

@saarikabhasi saarikabhasi added release_note:skip Skip the PR/issue when compiling release notes v9.0.0 labels Dec 19, 2024
@saarikabhasi saarikabhasi requested a review from a team as a code owner December 19, 2024 20:00
@saarikabhasi saarikabhasi added the backport:skip This commit does not require backporting label Dec 19, 2024
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7628

[✅] x-pack/test/functional_search/config.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group1.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/functional/test_suites/search/common_configs/config.group1.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/functional/test_suites/search/config.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/functional/test_suites/security/common_configs/config.group1.ts: 25/25 tests passed.

see run history

@kibanamachine
Copy link
Contributor

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.
[✅] x-pack/test/functional_search/config.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts: 25/25 tests passed.
[✅] x-pack/test_serverless/functional/test_suites/search/config.ts: 25/25 tests passed.

see run history

@saarikabhasi saarikabhasi requested a review from a team as a code owner January 6, 2025 19:16
Copy link
Member

@pheyos pheyos left a 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';
Copy link
Member

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.

Copy link
Contributor

@yansavitski yansavitski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

History

[share]
);

const SearchIndicesLinkProps = useCallback(
Copy link
Contributor

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see other comment.

Comment on lines +102 to +104
const searchIndexDetailsUrl = share?.url.locators
.get('SEARCH_INDEX_DETAILS_LOCATOR_ID')
?.useUrl({ indexName: connector?.index_name });
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants