Commit 01689329 authored by xdai's avatar xdai Committed by Commit Bot

CUPS: Add the "No Search Results Found" message.

Bug: 761288
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I0630b778aa8b758c7742af15541e83162f13d431
Reviewed-on: https://chromium-review.googlesource.com/875165Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532541}
parent c0e35c82
...@@ -46,6 +46,14 @@ ...@@ -46,6 +46,14 @@
width: 350px; width: 350px;
} }
#noSearchResultsMessage {
color: var(--md-loading-message-color);
font-size: 16px;
font-weight: 500;
margin-top: 80px;
text-align: center;
}
#addPrinterErrorMessage { #addPrinterErrorMessage {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
...@@ -88,6 +96,11 @@ ...@@ -88,6 +96,11 @@
search-term="[[searchTerm]]"> search-term="[[searchTerm]]">
</settings-cups-printers-list> </settings-cups-printers-list>
<div id="noSearchResultsMessage"
hidden="[[!showNoSearchResultsMessage_(searchTerm)]]">
$i18n{noSearchResults}
</div>
<div id="message"> <div id="message">
<div class="center" id="addPrinterDoneMessage" hidden> <div class="center" id="addPrinterDoneMessage" hidden>
$i18n{printerAddedSuccessfulMessage} $i18n{printerAddedSuccessfulMessage}
......
...@@ -186,4 +186,18 @@ Polymer({ ...@@ -186,4 +186,18 @@ Polymer({
}); });
}, },
/**
* @param {string} searchTerm
* @return {boolean} If the 'no-search-results-found' string should be shown.
* @private
*/
showNoSearchResultsMessage_: function(searchTerm) {
if (!searchTerm || !this.printers.length)
return false;
searchTerm = searchTerm.toLowerCase();
return !this.printers.some(printer => {
return printer.printerName.toLowerCase().includes(searchTerm);
});
},
}); });
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
</head> </head>
<body> <body>
<settings-ui></settings-ui> <settings-ui></settings-ui>
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"> <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="settings_ui/settings_ui.html"> <link rel="import" href="settings_ui/settings_ui.html">
......
...@@ -1572,6 +1572,7 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) { ...@@ -1572,6 +1572,7 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
{"editPrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_EDIT}, {"editPrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_EDIT},
{"removePrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_REMOVE}, {"removePrinter", IDS_SETTINGS_PRINTING_CUPS_PRINTERS_REMOVE},
{"searchLabel", IDS_SETTINGS_PRINTING_CUPS_SEARCH_LABEL}, {"searchLabel", IDS_SETTINGS_PRINTING_CUPS_SEARCH_LABEL},
{"noSearchResults", IDS_SEARCH_NO_RESULTS},
{"printerDetailsTitle", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_TITLE}, {"printerDetailsTitle", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_TITLE},
{"printerName", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_NAME}, {"printerName", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_NAME},
{"printerModel", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_MODEL}, {"printerModel", IDS_SETTINGS_PRINTING_CUPS_PRINTER_DETAILS_MODEL},
......
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