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

Add unbelievably terrible search #165

Conversation

Mr0grog
Copy link
Member

@Mr0grog Mr0grog commented Dec 18, 2017

This is not very good and should probably be totally rewritten, but I’m realizing just having something for this would be really useful. Pertains to #64 but is in no a way a well-thought-through or even full solution.

This lets you search by URL only (though you can include * as a wildcard anywhere in the URL).

Depends on #164.

screen shot 2017-12-18 at 2 19 51 pm

@Mr0grog Mr0grog force-pushed the 64-if-you-have-a-url-or-even-just-part-of-one-we-can-find-your-page branch 2 times, most recently from 5ecc971 to 1d3b358 Compare December 21, 2017 03:47
Copy link
Collaborator

@lightandluck lightandluck left a comment

Choose a reason for hiding this comment

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

Looks good as a quick solution. One suggestion would be to hide/not render the search on /assignedPages. I was confused for a second why it wasn't working there. Maybe with something equally terrible like

{(this.props.match.url === '/assignedPages') ? null :
    <div className="row search-bar">
         <input
              type="text"
              placeholder="Search for a URL..."
              onChange={this._didSearch}
          />
    </div>
 }

=P

if (!/^(\*|\/\/|(h|ht|htt|https?|https?\/|https?\/\/))/.test(url)) {
url = url = `*//${url}`;
}
// If the search is for a domain + TLD, return all paths under it
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious what TLD means?

Copy link
Member Author

Choose a reason for hiding this comment

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

Top Level Domain — e.g. .com, .gov, etc.

This does not fully handle #64, but is a start and is a quick-and-dirty way to search by URL. It should probably be totally rewritten if we want to do a good job.
@Mr0grog Mr0grog force-pushed the 64-if-you-have-a-url-or-even-just-part-of-one-we-can-find-your-page branch from 1d3b358 to ad10093 Compare December 22, 2017 03:21
@Mr0grog
Copy link
Member Author

Mr0grog commented Dec 22, 2017

@lightandluck would it be better to just make it work on both views by removing the bone-headed hard-coded argument here? https://github.com/edgi-govdata-archiving/web-monitoring-ui/pull/165/files#diff-ff4ff84c13b0f2bc72a520d104382c74R78

@lightandluck
Copy link
Collaborator

lightandluck commented Dec 22, 2017

I tried changing that to use this.props.pageFilter but it didn't work immediately for me. I figured because api.getPages and localApi.getPagesForUser are using different services there was more to it, but didn't dig into it. Also, realized that the search would have to be reset when switching between the two, which is when I decided to stop =D

I assumed you didn't want to futz around with it and just made it work for the /pages. Ha! If it doesn't take too much time, it would be nice. But analysts shouldn't be making use of the list view too much yet, so we could just tell them to stick to /pages. Up to you.

@Mr0grog
Copy link
Member Author

Mr0grog commented Dec 22, 2017

I tried changing that to use this.props.pageFilter but it didn't work immediately for me.

Is that exactly what you tried? I’m guessing it didn’t work because that’s state, not a prop. It works for me (this.state.pageFilter).

@lightandluck
Copy link
Collaborator

Doh! Yea, if it's that simple, let's change it

@Mr0grog
Copy link
Member Author

Mr0grog commented Jan 4, 2018

Ugh, sorry this took me so long to come back around to. How is this now?

@lightandluck
Copy link
Collaborator

Np, looks good, works on both views now. 👍

@Mr0grog Mr0grog merged commit 2804b6f into master Jan 6, 2018
@Mr0grog Mr0grog deleted the 64-if-you-have-a-url-or-even-just-part-of-one-we-can-find-your-page branch January 6, 2018 19:11
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.

2 participants