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 a unified search component. #5997

Merged
merged 10 commits into from
Feb 14, 2017

Conversation

zinigor
Copy link
Member

@zinigor zinigor commented Dec 27, 2016

This adds a new component that will include all tabs and pass search terms into them. That will allow us to get rid of a dedicated search view and use existing ones instead.

Changes proposed in this Pull Request:

  • Adds searchable settings view.
  • Changes the composing view inside the Writing tab to respect search terms.

Testing instructions:

  • Try to search for something related to markdown and after-the-deadline modules.
  • Observe the respective configuration settings

What else to look at

  • Make sure that when you try to search, and there's no search term yet, settings are not empty.

@zinigor
Copy link
Member Author

zinigor commented Dec 28, 2016

#5461

@zinigor zinigor requested review from oskosk and eliorivero December 28, 2016 08:54
@zinigor zinigor added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Dec 30, 2016
@zinigor
Copy link
Member Author

zinigor commented Dec 30, 2016

Needs more work on Writing once it's done, but still marking it as Needs Review for general direction review.

@eliorivero
Copy link
Contributor

Rebased after merging #6020
Conflicts fixed in writing/index.jsx and writing/composing.jsx

@eliorivero eliorivero force-pushed the add/unified-search branch 3 times, most recently from 1b418dd to da24867 Compare January 4, 2017 13:37
@eliorivero
Copy link
Contributor

Some things I found in this branch (tested before rebasing to make sure I wasn't altering anything):

  1. The first time you click on search the setting cards of the current tab continue to be displayed. However, after you type something and later clear the field they're not longer displayed. Either they should not be displayed to begin with or they should be displayed after clearing the field.
    hidden

  2. If you reload while you're searching, after reloading, the app ends up in search state and nothing is displayed. In current JPR when you reload you end up in search too but the list of modules is displayed so it doesn't look like there's something missing.
    hidden

  3. The definition of lists such as let list = [ markdown, atd ].map( function( m ) { is right now inconsistent since some definitions are in a top component like traffic/index.jsx and others in a sub component like writing/composing.jsx. They should be standardized and defined all in top components and when needed passed down to sub components. This could be a helper function, it uses the same code structure every time is added.

@jeherve jeherve added this to the 4.6 milestone Jan 9, 2017
@zinigor
Copy link
Member Author

zinigor commented Jan 18, 2017

Thanks for the detailed review, Elio! I have fixed the first problem, but I'm not sure what to do about the second. @MichaelArestad can we have your advice on the UX here? Refreshing during search is quite an edge case, what should we do about it?

@MichaelArestad
Copy link
Contributor

@zinigor If they refresh, show the search and list everything until they exit the search or start typing.

@zinigor
Copy link
Member Author

zinigor commented Jan 23, 2017

This is now ready for testing. Several caveats:

  • Scan and Antispam settings show up even if you search for Protect or SSO because we don't have descriptions for them in the API response yet. This will be handled separately in an effort to start moving settings to a module-agnostic endpoint.
  • The refresh problem is not handled yet, @MichaelArestad are you sure that showing everything is a good way to handle the situation? Maybe it's better to display a message that says something like: "Please enter a search term."?
  • The search bar now tracks user input focus, that's intentional. It shows up either if you have activated search and have #/search in the URL, or if you have navigated back, but still have focus inside the input. That solves the problem of blank search results when deleting a search term.

@MichaelArestad
Copy link
Contributor

The refresh problem is not handled yet, @MichaelArestad are you sure that showing everything is a good way to handle the situation? Maybe it's better to display a message that says something like: "Please enter a search term."?

I am not. What other options do we have?

We could show an encouraging message to get someone to search. (I don't think we do this anywhere else, but if we do, lets do it.)

@MichaelArestad
Copy link
Contributor

@jeffgolenski @rickybanister ideas/thoughts? ^

@rickybanister
Copy link

I don't think we need any placeholder text or anything. If search is focused, we should hide the current settings cards and just leave the rest of the page blank until something is typed. At most we could show a message below the search box—

Something like

Find a setting by name or keyword that then changes to 3 features matching 'writing'

Like /people

screen shot 2017-01-24 at 10 12 40 am

And if no results we could do something like this

screen shot 2017-01-24 at 10 13 33 am

@eliorivero eliorivero modified the milestones: Settings UI, 2/17 - February Jan 30, 2017
@eliorivero
Copy link
Contributor

Needs a nice rebase. Labeling as In Progress and moving it accordingly in project board.

@eliorivero eliorivero added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels Feb 1, 2017
@zinigor zinigor force-pushed the add/unified-search branch from 5f76ab3 to a0f72ec Compare February 3, 2017 09:28
* Passed searchTerm from Main to all settings tabs.
* Added search functionality for the Writing tab.
* Properly added tabs to searchable settings and added discussion search terms.
* Added search terms to traffic tab.
* Added search terms for Security tab.
* Making sure the page doesn't disappear when a user first clicks Search.
* Made sure the empty Composing section isn't shown.
Search will no longer show an empty page on clearing the term, but will rather go back to the previous page.
It will help determine if a module matches the current search.

* Made the writing tab use the new search selector.
* Made the traffic tab use the new found selector.
* Added new search functionality to the security tab.
* Added general settings to the new search.
* Also removed unused imports in Main.
* Fixed several eslint warnings.
* Fixed the writing settings tab.
@zinigor
Copy link
Member Author

zinigor commented Feb 14, 2017

Rebased, now ready to test!

@zinigor zinigor added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Feb 14, 2017
@zinigor
Copy link
Member Author

zinigor commented Feb 14, 2017

This has grown too huge, let's merge it into the feature branch and move further with smaller changes.

Copy link
Contributor

@eliorivero eliorivero left a comment

Choose a reason for hiding this comment

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

@zinigor

  1. there's a change that ended up being lost, I guess while rebasing. It's this and all its subsequent usages:
    https://github.com/Automattic/jetpack/pull/5997/files#diff-b90f6848452ec5e1c5bcb466b4628d12L168

    I noticed this when I clicked the Sharing nav tab, it tried to go to http://example.org/wp-admin/undefinedoptions-general.php?page=sharing

  2. when you click the x to close the search, if the field is empty, you exit the search mode, as can be seen here
    cantdisable

  3. there's a jump when you clear the field. Happens when you do it by keyboard or by mouse
    jump

  4. finally, the first time I reviewed this I mentioned that it was inconsistent that when you started searching, all setting cards were visible, but if you for some reason reloaded or followed a link straight to #search, no setting cards were visible. To make it consistent, we should never display any card while in search mode and when the field is empty. This is how the settings search in iPhone and Android works so some people will be familiar.

@zinigor
Copy link
Member Author

zinigor commented Feb 14, 2017

@eliorivero thanks for thorough testngi! What do you say I fix number 1 and we merge, while creating issues for everything else? This PR is too heavy to rebase each time stuff gets modified in the feature branch.

@eliorivero
Copy link
Contributor

ok cool, yeah, the first one is why I blocked this. The others can be improved later, specially 2 and 3.

@zinigor
Copy link
Member Author

zinigor commented Feb 14, 2017

OK, done. @eliorivero can you please take a look again at the last commit and merge if it's OK?

@@ -174,36 +182,22 @@ const Main = React.createClass( {
pageComponent = <Apps siteRawUrl={ this.props.siteRawUrl } />;
break;
case '/plans':
pageComponent = <Plans siteRawUrl={ this.props.siteRawUrl } siteAdminUrl={ this.props.siteAdminUrl } />;
pageComponent = <Plans siteRawUrl={ this.props.siteRawUrl } siteAdminUrl={ this } />;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not ok, should still have the props.siteAdminUrl otherwise the URL for example for "View your spam stats" ends up like http://example.tld/wp-admin/[object%20Object]admin.php?page=akismet-key-config

Copy link
Contributor

@eliorivero eliorivero left a comment

Choose a reason for hiding this comment

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

Will merge this for now. The one concern I have is that we're connecting all these middle components when it's not necessary. This introduces a slight overhead in performance and is harder to maintain so they should be removed and get props from their parent component which is already connected.

@eliorivero eliorivero merged commit 6e8c6f2 into feature/settings-overhaul Feb 14, 2017
@eliorivero eliorivero deleted the add/unified-search branch February 14, 2017 21:45
@eliorivero eliorivero removed the [Status] Needs Review This PR is ready for review. label Feb 14, 2017
jeherve pushed a commit that referenced this pull request Nov 16, 2018
Remove unused file modules-per-tab-page.jsx.


The only file using this component was removed in #5997
#### Changes proposed in this Pull Request:
<!--- Explain what functional changes your PR includes -->

* Removes _inc/client/components/module-settings/modules-per-tab-page.jsx

#### Testing instructions:

1. Standing on the jetpack directory.
2. Run `grep -r AllModuleSettings *`. (The file removed by this PR exports a named export so usages of it can be greppable.
2. Confirm that no result comes up.

#### Proposed changelog entry for your changes:

* None needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants