Commit 9c63850f authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Management WebUI: Add settings search to the toolbar

Add a search field to the toolbar that redirects to the settings page
on each search.

Bug: 948259
Change-Id: I5c81ef285fdb2f9042d5d1d843129589af428937
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1548137
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649309}
parent d21ddb01
......@@ -159,8 +159,9 @@
}
</style>
<cr-toolbar page-name="$i18n{toolbarTitle}"
show-search="[[showSearchInToolbar_]]">
<cr-toolbar page-name="$i18n{toolbarTitle}" role="banner"
on-search-changed="onSearchChanged_" clear-label="$i18n{clearSearch}"
search-prompt="$i18n{searchPrompt}">
</cr-toolbar>
<main id="mainContent">
<div class="sections-container">
......
......@@ -55,15 +55,6 @@ Polymer({
/** @private {?management.ManagedInfo} */
accountManagedInfo_: Object,
/**
* Indicates if the search field in visible in the toolbar.
* @private
*/
showSearchInToolbar_: {
type: Boolean,
value: false,
},
/** @private */
subtitle_: String,
......@@ -244,6 +235,19 @@ Polymer({
}
},
/**
* Handles the 'search-changed' event fired from the toolbar.
* Redirects to the settings page initialized the the current
* search query.
* @param {!CustomEvent<string>} e
* @private
*/
onSearchChanged_: function(e) {
const query = e.detail;
window.location.href =
`chrome://settings?search=${encodeURIComponent(query)}`;
},
/** @private */
updateManagedFields_() {
this.subtitle_ = loadTimeData.getString('subtitle');
......
......@@ -15,10 +15,10 @@
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/safe_browsing/common/safebrowsing_constants.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
#include "extensions/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
......@@ -93,6 +93,8 @@ content::WebUIDataSource* CreateManagementUIHtmlSource() {
IDS_MANAGEMENT_TRUST_ROOTS_NOT_CONFIGURED},
{"title", IDS_MANAGEMENT_TITLE},
{"toolbarTitle", IDS_MANAGEMENT_TOOLBAR_TITLE},
{"searchPrompt", IDS_SETTINGS_SEARCH_PROMPT},
{"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH},
#if BUILDFLAG(ENABLE_EXTENSIONS)
{kManagementExtensionReportMachineName,
IDS_MANAGEMENT_EXTENSION_REPORT_MACHINE_NAME},
......
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