Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

feat(svelte): Add support for creating search jobs from search results#64308

Merged
fkling merged 2 commits intomainfrom
fkling-srch-838-unable-to-create-search-jobs-from-the-svelte-prototype-need
Aug 7, 2024
Merged

feat(svelte): Add support for creating search jobs from search results#64308
fkling merged 2 commits intomainfrom
fkling-srch-838-unable-to-create-search-jobs-from-the-svelte-prototype-need

Conversation

@fkling
Copy link
Contributor

@fkling fkling commented Aug 6, 2024

Closes srch-838

This commit extends the search progress popover and adds the search jobs section.

In the React version the UI for the popover differs slightly when search jobs are enabled vs not enabled.

I decided to ignore the differences and only impolemented the style used for the 'search jobs enabled' version, which makes the popover a bit more compact.

The logic for validating and creating a search job is encapsulated in a class which makes it easy to conditionally show the search jobs UI.

Additional changes:

  • Skipped items is now a list and uses <details> elements which is semantically more correct. We loose the styling of the chevron but I think that's OK.
  • LoadingSpinner was updated to work inline.
  • Logging was fixed (?) in the React version to send the correct meta-data.
  • Added integration tests for the search job popover behavior
S2 dotcom
2024-08-06_18-09 2024-08-06_20-09

Test plan

Integration tests and manual testing.

This commit extends the search progress popover and adds the search jobs
section.

In the React version the UI for the popover differs slightly when search
jobs are enabled vs not enabled.

I decided to ignore the differences and only impolemented the style used
for the 'search jobs enabled' version, which makes the popover a bit
more compact.

The logic for validating and creating a search job is encapsulated in a
class which makes it easy to conditionally show the search jobs UI.

Additional changes:

- Skipped items is now a list and uses `<details>` elements which is
  semantically more correct. We loose the styling of the chevron but I
  think that's OK.
- LoadingSpinner was updated to work inline.
- Logging was fixed (?) in the React version to send the correct
  meta-data.
- Added integration tests for the search job popover behavior
@cla-bot cla-bot bot added the cla-signed label Aug 6, 2024
telemetryService.log('SearchJobsSearchFormShown', { validState }, { validState })
telemetryRecorder.recordEvent('search.exhaustiveJobs', 'view', {
metadata: { validState: validState ? 1 : 0 },
metadata: { validState: validState === 'valid' ? 1 : 0 },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seemed like a bug to me since validState is always a non-empty string.

Copy link
Member

Choose a reason for hiding this comment

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

Nice catch!

sentryDNS: undefined,
},
// Playwright specific overwrites
window.playwrightContext
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out we have to merge playwright specific overwrites last because when running tests against a local, proxied instance, the injected window.context will overwrite the playwright specific settings.

offset,
shift: { padding: 4 },
flip: {
flip: flip ? {
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 didn't like how the popover would switch from the bottom to the left side when expanding a section would grow the popover beyond the viewport.
In other words: The click target shouldn't move unexpectedly.

// Must be a root query. We resolve the query here to make sure we
// resolve operation-specific overrides correctly.
if (info.parentType.name === 'Query') {
if (info.parentType.name === 'Query' || info.parentType.name === 'Mutation') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was necessary to make mutation overwrites work in playwright tests.

Copy link
Member

@stefanhengl stefanhengl left a comment

Choose a reason for hiding this comment

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

Thanks for getting this in so quickly!! 🙇

One minor concern is the way we handle errors. Felix and I chatted about this on Slack a bit. In the current version we surface the [GraphQL] prefix to the user, which is an artifact of the client we use and the fact that ValidateSearchJob returns a "raw" GraphQL error. Either we decide to handle this in general or we have to update the API in the next release. I am fine with either, but it would be nice to define a general approach we want to follow, not just for Search Jobs.

@fkling fkling self-assigned this Aug 7, 2024
@fkling fkling merged commit ebaab12 into main Aug 7, 2024
@fkling fkling deleted the fkling-srch-838-unable-to-create-search-jobs-from-the-svelte-prototype-need branch August 7, 2024 12:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants