Commit 1b9eb71c authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

Settings: Use default search box and move sort box.

Currently a custom search box is used, however the ctrl+F is not
working, updated to use the default search box (with UI permission) and
move the sort box.

BUG=931969,835712

Change-Id: Ibabc3a3dbfa67f6d38b481126f0983a20dd3aa9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1491156
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarPatti <patricialor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637616}
parent 53382a4b
...@@ -207,8 +207,10 @@ ...@@ -207,8 +207,10 @@
</template> </template>
<template is="dom-if" route-path="/content/all" no-search> <template is="dom-if" route-path="/content/all" no-search>
<settings-subpage page-title="$i18n{siteSettingsAllSites}"> <settings-subpage page-title="$i18n{siteSettingsAllSites}"
<all-sites></all-sites> search-label="$i18n{siteSettingsAllSitesSearch}"
search-term="{{searchFilter_}}">
<all-sites filter="[[searchFilter_]]"></all-sites>
</settings-subpage> </settings-subpage>
</template> </template>
<template is="dom-if" route-path="/content/automaticDownloads" no-search> <template is="dom-if" route-path="/content/automaticDownloads" no-search>
......
...@@ -13,11 +13,9 @@ ...@@ -13,11 +13,9 @@
<dom-module id="all-sites"> <dom-module id="all-sites">
<template> <template>
<style include="settings-shared md-select"> <style include="settings-shared md-select">
/* Align the search box search icon with the site-entry icons. */ #sort {
#searchAndSort {
align-items: center; align-items: center;
display: flex; display: flex;
justify-content: space-between;
margin: 0 var(--cr-icon-button-margin-start); margin: 0 var(--cr-icon-button-margin-start);
margin-bottom: 50px; margin-bottom: 50px;
padding: 0 var(--settings-box-row-padding); padding: 0 var(--settings-box-row-padding);
...@@ -33,28 +31,20 @@ ...@@ -33,28 +31,20 @@
padding-inline-start: var(--settings-box-row-padding); padding-inline-start: var(--settings-box-row-padding);
} }
</style> </style>
<div id="searchAndSort"> <div id="sort">
<div> <label id="sortLabel">$i18n{siteSettingsAllSitesSort}</label>
<cr-search-field label="$i18n{siteSettingsAllSitesSearch}" <select id="sortMethod" class="md-select" aria-labelledby="sortLabel"
on-search-changed="onSearchChanged_"> on-change="onSortMethodChanged_">
</cr-search-field> <option value="[[sortMethods_.MOST_VISITED]]">
</div> $i18n{siteSettingsAllSitesSortMethodMostVisited}
</option>
<div> <option value="[[sortMethods_.STORAGE]]">
<label id="sortLabel">$i18n{siteSettingsAllSitesSort}</label> $i18n{siteSettingsAllSitesSortMethodStorage}
<select id="sortMethod" class="md-select" aria-labelledby="sortLabel" </option>
on-change="onSortMethodChanged_"> <option value="[[sortMethods_.NAME]]">
<option value="[[sortMethods_.MOST_VISITED]]"> $i18n{siteSettingsAllSitesSortMethodName}
$i18n{siteSettingsAllSitesSortMethodMostVisited} </option>
</option> </select>
<option value="[[sortMethods_.STORAGE]]">
$i18n{siteSettingsAllSitesSortMethodStorage}
</option>
<option value="[[sortMethods_.NAME]]">
$i18n{siteSettingsAllSitesSortMethodName}
</option>
</select>
</div>
</div> </div>
<div class="list-frame" hidden$="[[!siteGroupMapEmpty_(siteGroupMap)]]"> <div class="list-frame" hidden$="[[!siteGroupMapEmpty_(siteGroupMap)]]">
<div class="list-item secondary">$i18n{emptyAllSitesPage}</div> <div class="list-item secondary">$i18n{emptyAllSitesPage}</div>
......
...@@ -54,7 +54,7 @@ Polymer({ ...@@ -54,7 +54,7 @@ Polymer({
* filter the All Sites list. * filter the All Sites list.
* @private * @private
*/ */
searchQuery_: { filter: {
type: String, type: String,
value: '', value: '',
observer: 'forceListUpdate_', observer: 'forceListUpdate_',
...@@ -300,15 +300,6 @@ Polymer({ ...@@ -300,15 +300,6 @@ Polymer({
return siteGroup1.etldPlus1.localeCompare(siteGroup2.etldPlus1); return siteGroup1.etldPlus1.localeCompare(siteGroup2.etldPlus1);
}, },
/**
* Called when the input text in the search textbox is updated.
* @private
*/
onSearchChanged_: function() {
const searchElement = this.$$('cr-search-field');
this.searchQuery_ = searchElement.getSearchInput().value.toLowerCase();
},
/** /**
* Called when the user chooses a different sort method to the default. * Called when the user chooses a different sort method to the default.
* @private * @private
...@@ -328,7 +319,7 @@ Polymer({ ...@@ -328,7 +319,7 @@ Polymer({
*/ */
forceListUpdate_: function() { forceListUpdate_: function() {
this.filteredList_ = this.filteredList_ =
this.filterPopulatedList_(this.siteGroupMap, this.searchQuery_); this.filterPopulatedList_(this.siteGroupMap, this.filter);
this.$.allSitesList.fire('iron-resize'); this.$.allSitesList.fire('iron-resize');
}, },
......
...@@ -149,7 +149,7 @@ suite('AllSites', function() { ...@@ -149,7 +149,7 @@ suite('AllSites', function() {
testElement.$.listContainer.querySelectorAll('site-entry'); testElement.$.listContainer.querySelectorAll('site-entry');
assertEquals(3, siteEntries.length); assertEquals(3, siteEntries.length);
testElement.searchQuery_ = SEARCH_QUERY; testElement.filter = SEARCH_QUERY;
}) })
.then(() => { .then(() => {
Polymer.dom.flush(); Polymer.dom.flush();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment