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

basic search functionality from probe search service #594

Closed
wants to merge 1 commit into from

Conversation

spasovski
Copy link
Contributor

This continues from hamilton's draft PR. Does not include updated styling considerations.

@spasovski spasovski requested review from hamilton and openjck June 9, 2020 16:29
Copy link
Contributor

@hamilton hamilton 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 filing @spasovski. I left some comments inline to get you started. They boil down to:

(1) let's filter out events from the postgrest query
(2) fix the ilike statement
(3) move the search API stuff into api.js as we discussed
(4) the probe type labels should be right-aligned and not identical width necessarily – is that a change from what's on dev?
(5) we need a little spinner at the top right of the search results header when we're awaiting a query to finish running. This can easily be done with a boolean that turns on / off while waiting for a search query
(6) if no results are present, we should say that instead of the "getting the probes – one second!" text
(7) the 400 error should probably be something in the search results body, not a yellow note to the right of everything

}

const domain = (str, product = 'desktop') => {
Copy link
Contributor

Choose a reason for hiding this comment

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

just to note what we discussed over zoom:

  1. let's move this + the probeSearchService function over to api.js
  2. let's decompose the domain function into its constituent parts so it is easier to reason about it

}

const domain = (str, product = 'desktop') => {
const formattedStr = str.replace(' ', '%20');
return `https://dev.probe-search.nonprod.dataops.mozgcp.net/probes?limit=15&select=name,definition,type&product=eq.${product}&or=(name.eq.${formattedStr},index.phfts(english).${formattedStr},description.phfts(english).${formattedStr},name.ilike.${formattedStr}%)`;
Copy link
Contributor

Choose a reason for hiding this comment

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

more follow-up from chatting:

(1) the ilike is technically not doing anything. Moving it to name.ilike.*${formattedStr}* will fix it
(2) adding &type=neq.event after the product-eq statement will filter out events, which I think we need here (we should not be returning events)

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest making the base URL for the probe-search service to be configurable in some way. At some point we may have multiple instances for dev & prod.

on:input={handleSearchInput}
/>
{#if results.status}
<div
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I would expect the error message in the search results area, not off to the side specifically. I would also expect it to be probably not yellow but kind of more in-line with our other error message.

{#if results.length}
<div class="header header--loaded" in:fly={{ x: -5, duration: 200 }}>
<div>found {results.length} probes</div>
</div>
{:else}
Copy link
Contributor

Choose a reason for hiding this comment

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

as this is now, I get a getting the probes – one second! when there are no search results. If not results.length, then we should be saying "no search results found for "____"`

getting the probes – one second!
</div>
</div>
<div>getting the probes – one second!</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm noticing that when I am waiting for the search service to return something, I'm actually not seeing any kind of spinner or anything in the title bar. We know when we're awaiting results – we could just set a flag somewhere in thsi file that is like isCurrentlyFetching and pop up the spinner on the right side of the search results header when that is true.

on:click={() => {
page.show(`/firefox/probe/${results[focusedItem].name.toLowerCase()}/explore?${$currentQuery}`);
}}
on:mouseover={() => { focusedItem = i; }}>
<div class="name body-text--short-01">{name}</div>
<div class="probe-type label label-text--01 label--{type}">{type}</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a bit off. The label sizing for scalar is the same as it is for histogram, so the padding looks a little strange. I would expect the label to be right-aligned and not all the same width.

Screen Shot 2020-06-09 at 1 54 24 PM

@openjck
Copy link
Contributor

openjck commented Jun 10, 2020

Superseded by #602

@openjck openjck closed this Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants