Commit b0600054 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Add empty state for ongoing print jobs

- Displays a message to indicate users that no print jobs are currently
  printing.

Screen shot: https://screenshot.googleplex.com/YSGD579DA0U

Bug: 1053704
Test: browser_tests
Change-Id: I62ce23ac6cafc805e31a153cea4e847b49c3d619
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2244123Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779351}
parent 9ec27692
...@@ -179,6 +179,7 @@ function getHistoryPrintJobEntries(page) { ...@@ -179,6 +179,7 @@ function getHistoryPrintJobEntries(page) {
* @return {!Array<!HTMLElement>} * @return {!Array<!HTMLElement>}
*/ */
function getOngoingPrintJobEntries(page) { function getOngoingPrintJobEntries(page) {
assertTrue(page.$$('#ongoingEmptyState').hidden);
const entryList = page.$$('#ongoingList'); const entryList = page.$$('#ongoingList');
return Array.from( return Array.from(
entryList.querySelectorAll('print-job-entry:not([hidden])')); entryList.querySelectorAll('print-job-entry:not([hidden])'));
...@@ -694,6 +695,20 @@ suite('PrintManagementTest', () => { ...@@ -694,6 +695,20 @@ suite('PrintManagementTest', () => {
}); });
}); });
test('OngoingPrintJobEmptyState', () => {
return initializePrintManagementApp(/*expectedArr=*/[])
.then(() => {
return mojoApi_.whenCalled('getPrintJobs');
})
.then(() => {
flush();
// Assert that ongoing list is empty and the empty state message is
// not hidden.
assertTrue(!page.$$('#ongoingList'));
assertTrue(!page.$$('#ongoingEmptyState').hidden);
});
});
test('CancelOngoingPrintJob', () => { test('CancelOngoingPrintJob', () => {
const kId = 'fileA'; const kId = 'fileA';
const kTitle = 'titleA'; const kTitle = 'titleA';
......
...@@ -394,6 +394,9 @@ Try tapping the mic to ask me anything. ...@@ -394,6 +394,9 @@ Try tapping the mic to ask me anything.
<message name="IDS_PRINT_MANAGEMENT_UNKNOWN_ERROR_STATUS" desc="The error status displayed next to a print job to indicate to users that their print job failed due to an unknown error."> <message name="IDS_PRINT_MANAGEMENT_UNKNOWN_ERROR_STATUS" desc="The error status displayed next to a print job to indicate to users that their print job failed due to an unknown error.">
Failed - Unknown error Failed - Unknown error
</message> </message>
<message name="IDS_PRINT_MANAGEMENT_NO_PRINT_JOBS_IN_PROGRESS_MESSAGE" desc="The message shown to users if they do not have any print jobs in progress i.e. being printed.">
No print jobs in progress
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
38cd8a71d8f061e914b0a94aed7c38b6124251c1
\ No newline at end of file
...@@ -56,6 +56,8 @@ void AddPrintManagementStrings(content::WebUIDataSource* html_source) { ...@@ -56,6 +56,8 @@ void AddPrintManagementStrings(content::WebUIDataSource* html_source) {
{"stopped", IDS_PRINT_MANAGEMENT_STOPPED_ERROR_STATUS}, {"stopped", IDS_PRINT_MANAGEMENT_STOPPED_ERROR_STATUS},
{"filterFailed", IDS_PRINT_MANAGEMENT_FILTERED_FAILED_ERROR_STATUS}, {"filterFailed", IDS_PRINT_MANAGEMENT_FILTERED_FAILED_ERROR_STATUS},
{"unknownPrinterError", IDS_PRINT_MANAGEMENT_UNKNOWN_ERROR_STATUS}, {"unknownPrinterError", IDS_PRINT_MANAGEMENT_UNKNOWN_ERROR_STATUS},
{"noPrintJobInProgress",
IDS_PRINT_MANAGEMENT_NO_PRINT_JOBS_IN_PROGRESS_MESSAGE},
}; };
for (const auto& str : kLocalizedStrings) { for (const auto& str : kLocalizedStrings) {
......
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
margin-inline-start: 8px; margin-inline-start: 8px;
} }
#ongoingEmptyState {
color: var(--google-grey-600);
margin-inline-start: 12px;
padding-bottom: 24px;
padding-top: 24px;
}
h1 { h1 {
font-size: 200%; font-size: 200%;
font-weight: 500; font-weight: 500;
...@@ -88,6 +95,10 @@ ...@@ -88,6 +95,10 @@
</iron-list> </iron-list>
</template> </template>
<div id="ongoingEmptyState" hidden="[[ongoingPrintJobs_.length]]">
[[i18n('noPrintJobInProgress')]]
</div>
<template is="dom-if" if="[[printJobs_.length]]" restamp> <template is="dom-if" if="[[printJobs_.length]]" restamp>
<div id="historyHeaderContainer" class="column-headers flex-center"> <div id="historyHeaderContainer" class="column-headers flex-center">
<div aria-label$="[[i18n('historyToolTip')]]"> <div aria-label$="[[i18n('historyToolTip')]]">
......
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