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

[App Search] Update EngineRouter & EngineNav to use EngineLogic #83138

Merged
merged 6 commits into from
Nov 11, 2020

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Nov 11, 2020

Summary

  • Adds server-side route for HTTP API call
  • Updates EngineRouter & EngineNav with EngineLogic instead of previously static setup.

Screencaps

Screen Shot 2020-11-10 at 5 08 37 PM

QA

Router tests

  • Engine initialization
    • Open devtools and track XHR calls
    • Click on any engine in the engines table
    • Confirm you see a call to (e.g.) http://localhost:5601/api/app_search/engines/{ENGINE} in your logs and that its response returns the JSON you'd expect to see from our internal engine API
  • 404 testing

Engine nav tests

  • Invalid boosts
    • [Enterprise Search] Create a sample engine. Then go to Schema and change the Visitors field from "number" to "text"
    • [Kibana] Click into the sample engine/refresh.
    • Confirm you see the "SAMPLE ENGINE" badge underneath the engine name
    • Confirm you see a yellow alert icon next to Relevance Tuning nav link. Hovering over the icon should reveal the title "Invalid boosts"
  • Unconfirmed schema fields
    • [Enterprise Search] Create a brand new engine. Populate it with documents from the paste sample JSON prompt
    • [Kibana] Click into the new engine/refresh
    • Confirm you see a blue info icon next to the Schema nav link. Hovering over the icon should reveal the title "New unconfirmed fields"
  • Unsearched unconfirmed schema fields
    • [Enterprise Search] Go back to the sample engine and go to Documents. Index a new document with a new JSON field, e.g. add "test": "test", in the sample JSON
    • [Kibana] Click into the sample engine/refresh
    • Confirm you see a new yellow alert icon in the Relevance Tuning nav link (it should stack with the invalid boosts icon).
  • Meta engine schema conflicts
    • [Enterprise Search] Start a platinum trial (can be done in /ent/select). Then create a meta engine with the sample engine and your new engine as sources
    • [Kibana] Click into the meta engine/refresh.
    • Confirm you see the "META ENGINE" badge under the engine name
    • Confirm you see a yellow alert icon in the Schema nav link.

Checklist

- useEffect init
- redirect/data loading
- setQueuedErrorMessage helper
- logic values
- icon alerts

- update tests w/ real conditional testing
+ remove use of mount, mount combined with shallow_useeffect leads to weirdness
@cee-chen cee-chen added Feature:Plugins release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Nov 11, 2020
@cee-chen cee-chen requested a review from JasonStoltz November 11, 2020 01:26
Comment on lines +231 to +233
<EuiFlexGroup justifyContent="spaceBetween" gutterSize="none">
<EuiFlexItem>{RELEVANCE_TUNING_TITLE}</EuiFlexItem>
<EuiFlexItem className="appSearchNavIcons">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I debated pulling this out into a separate component called EngineNavAlerts or something, but eventually decided against it for now - it felt like a pre-optimization and tests felt easier to write and more clear w/o it. We can definitely do so if we start adding more engine nav icons in the future though.

@@ -107,4 +107,30 @@ describe('engine routes', () => {
});
});
});

describe('GET /api/app_search/engines/{name}', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought this made sense in the same file as the collective/plural /api/app_search/engines, but lmk if you disagree!

/>
)}
{unsearchedUnconfirmedFields && (
<EuiIcon
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI - I don't super love the screen reader effect of these icons since it reads out (e.g.) "Relevance Tuning Invalid Boosts" all together without much pause, but I'm not 100% sure how to fix this without a lot more code. Happy to investigate later as tech debt though!

const label = wrapper.find('[data-test-subj="EngineLabel"]').last();
expect(label.text()).toEqual(expect.stringContaining('SOME-ENGINE'));
setMockValues({ ...values, isSampleEngine: true });
wrapper.setProps({}); // Re-render
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a PR coming immediately after this one that creates a new rerender(wrapper); test helper so we don't need all these clarification comments.

@JasonStoltz
Copy link
Member

[Enterprise Search] Create a brand new engine. Populate it with documents from the paste sample JSON prompt
[Kibana] Click into the new engine/refresh
Confirm you see a "Crawler" nav link (not present in sample or meta engines)
Confirm you see a blue info icon next to the Schema nav link. Hovering over the icon should reveal the title "New unconfirmed fields"

When I create a new engine and populate it with documents... i see neither of these things. I see neither a Crawler link nor a Schema icon

@JasonStoltz
Copy link
Member

JasonStoltz commented Nov 11, 2020

Confirm you see a new yellow alert icon in the Relevance Tuning nav link (it should stack with the invalid boosts icon).

Shouldn't this be next the the "Schema" nav item, not the "Relevance tuning" tab?

Copy link
Member

@JasonStoltz JasonStoltz left a comment

Choose a reason for hiding this comment

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

Just a couple of QA related concerns. Otherwise, I really like how this turned out, it looks and works great.

@cee-chen
Copy link
Contributor Author

cee-chen commented Nov 11, 2020

Aside: I wish GitHub let you thread remarks not just on code comments

Crawler link

Shoot sorry - I forgot to mention you need to have started ent-search locally with CRAWLER=true bin/enterprise-search locally to have the server send back the correct permission. I've been starting my local dev that way for a while since I've been helping Byron w/ code review so that totally slipped my mind, apologies.

Schema info icon

Make sure your local ent-search is on latest master. It should at the very minimum have https://github.com/elastic/ent-search/pull/2457 merged in

Shouldn't this be next the the "Schema" nav item, not the "Relevance tuning" tab?

No, this was moved in https://github.com/elastic/ent-search/pull/2457 as a UX enhancement - check out the screencaps in that thread for more context on the new callouts being shown. The reason is that the place to actually fix unsearched fields is in Relevance Tuning, not in Schema, so the icon should be shown over Relevance Tuning. That being said, Schema should still show an info icon and warning callout as well.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
enterpriseSearch 463 464 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
enterpriseSearch 691.6KB 695.7KB +4.1KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@JasonStoltz
Copy link
Member

Ah ok, I was able to confirm now, finally.

@cee-chen cee-chen merged commit e607078 into elastic:master Nov 11, 2020
@cee-chen cee-chen deleted the engine-logic branch November 11, 2020 19:58
cee-chen pushed a commit that referenced this pull request Nov 11, 2020
…) (#83207)

* Add server-side route

* Add EngineRouter logic
- useEffect init
- redirect/data loading
- setQueuedErrorMessage helper

* Add EngineNav logic
- logic values
- icon alerts

- update tests w/ real conditional testing
+ remove use of mount, mount combined with shallow_useeffect leads to weirdness

* Split out EngineRouter and EngineNav into separate files

* [PR feedback] More explicit test cases
gmmorris added a commit to gmmorris/kibana that referenced this pull request Nov 12, 2020
…ts-public

* upstream/master: (57 commits)
  Remove unused asciidoc file (elastic#83228)
  [Lens] Remove background from lens embeddable (elastic#83061)
  [Discover] Unskip flaky tests based on discover fixture index pattern (elastic#82991)
  Removing unnecessary trailing slash in CODEOWNERS
  Trying to fix CODEOWNERS again, where was a non-existent team prior (elastic#83236)
  Trying to fix CODEOWERS, missing a starting slash (elastic#83233)
  skip flaky suite (elastic#83231)
  Add enzyme rerender test helper (elastic#83208)
  Move Elasticsearch type definitions out of APM (elastic#83081)
  [ts/checkTsProjects] produce a more useful error message (elastic#83209)
  [kbnClient] retry updating config if necessary (elastic#83205)
  I accidentally removed this line in a recent PR (elastic#83201)
  Don't make the caller do work the function can do (elastic#83180)
  [App Search] Update EngineRouter & EngineNav to use EngineLogic (elastic#83138)
  [Workplace Search] Add routes for Sources (elastic#83125)
  Update logstash pipeline management to use system index APIs (elastic#80405)
  [ML] Replace EuiBasicTable with EuiInMemoryTable (elastic#83057)
  [Metrics UI] Add basic interaction and shell for node details overlay (elastic#82013)
  [App Search] Added the log retention confirmation modal to the Settings page (elastic#83009)
  [docs] Fix create map title in import geospatial page (elastic#83172)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Plugins release_note:skip Skip the PR/issue when compiling release notes v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants