From ea5a56161715e03c332258aa6f4286ae4110ca58 Mon Sep 17 00:00:00 2001 From: xiangdong kong Date: Fri, 25 Mar 2022 00:00:04 +0000 Subject: [PATCH] feedback: Show popular help content when no match or as cold start Show popular help content for the following situations: - When the feedback tool is opened and no text has been entered [1]. - When some text has been entered but no match found [3]. Screenshots: [1] https://screenshot.googleplex.com/BSji3GZwnD5CFpg. [2] https://screenshot.googleplex.com/AttSxNW4bSebCVL (normal case). [3] https://screenshot.googleplex.com/8cktCLtJqZm6BVF Bug: b:185624798 Test: browser_tests --gtest_filter=OSFeedbackBrowserTest.* Change-Id: I40fdf2b7a8f4ee4d27ef74ef1daf98c2363d6505 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3544317 Commit-Queue: Xiangdong Kong Auto-Submit: Xiangdong Kong Reviewed-by: Gavin Williams Commit-Queue: Gavin Williams Cr-Commit-Position: refs/heads/main@{#985088} --- .../os_feedback_ui/resources/fake_data.js | 14 +++ .../resources/feedback_types.js | 14 +++ .../resources/help_content.html | 5 +- .../os_feedback_ui/resources/help_content.js | 38 ++++++-- .../os_feedback_ui/resources/search_page.js | 86 +++++++++++------ .../untrusted_resources/untrusted_index.js | 6 +- .../os_feedback_ui/help_content_test.js | 93 ++++++++++++++++--- .../os_feedback_ui/search_page_test.js | 4 +- 8 files changed, 206 insertions(+), 54 deletions(-) diff --git a/ash/webui/os_feedback_ui/resources/fake_data.js b/ash/webui/os_feedback_ui/resources/fake_data.js index c3e51dca33895d..42fc8ed6820188 100644 --- a/ash/webui/os_feedback_ui/resources/fake_data.js +++ b/ash/webui/os_feedback_ui/resources/fake_data.js @@ -10,6 +10,20 @@ import {HelpContentList, HelpContentType, SearchRequest, SearchResponse} from '. * Fake data used for testing purpose. */ +/** @type {!HelpContentList} */ +export const fakePopularHelpContentList = [ + { + title: stringToMojoString16('fake article'), + url: {url: 'https://support.google.com/chromebook/?q=article'}, + contentType: HelpContentType.kArticle + }, + { + title: stringToMojoString16('fake forum'), + url: {url: 'https://support.google.com/chromebook/?q=forum'}, + contentType: HelpContentType.kForum + } +]; + /** @type {!HelpContentList} */ export const fakeHelpContentList = [ { diff --git a/ash/webui/os_feedback_ui/resources/feedback_types.js b/ash/webui/os_feedback_ui/resources/feedback_types.js index 1790e161206507..4720aae5491e35 100644 --- a/ash/webui/os_feedback_ui/resources/feedback_types.js +++ b/ash/webui/os_feedback_ui/resources/feedback_types.js @@ -41,6 +41,20 @@ export const SearchRequest = ash.osFeedbackUi.mojom.SearchRequest; */ export const SearchResponse = ash.osFeedbackUi.mojom.SearchResponse; +/** + * Type alias for search result. When isPopularContent is true, the contentList + * contains top popular help contents, i.e. returned where the search query is + * empty. The isQueryEmpty is true when the current query is empty. The + * isPopularContent is true when the current query is not empty and no matches + * are found. + * @typedef {{ + * contentList: HelpContentList, + * isQueryEmpty: boolean, + * isPopularContent: boolean + * }} + */ +export let SearchResult; + /** * Type alias for the HelpContentProviderInterface. * @typedef {ash.osFeedbackUi.mojom.HelpContentProviderInterface} diff --git a/ash/webui/os_feedback_ui/resources/help_content.html b/ash/webui/os_feedback_ui/resources/help_content.html index 29034ec195e8b4..c7b09e69acde40 100644 --- a/ash/webui/os_feedback_ui/resources/help_content.html +++ b/ash/webui/os_feedback_ui/resources/help_content.html @@ -13,9 +13,8 @@ }
- -

Suggested help content:

- +

[[getLabel_(searchResult)]]

+