Skip to content

Commit ad4ae1c

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] WebAuthn empty state update
Before: https://i.imgur.com/lXgNqVa.png After: https://i.imgur.com/sm7ia2V.png Bug: 325443331 Change-Id: I42dc39b7a0583d592731d53ed2891a1c9e0a7482 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6263812 Reviewed-by: Kateryna Prokopenko <[email protected]> Commit-Queue: Kim-Anh Tran <[email protected]>
1 parent 8da4ba0 commit ad4ae1c

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

front_end/panels/webauthn/WebauthnPane.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,13 @@ describeWithMockConnection('WebAuthn pane', () => {
362362

363363
describe('in scope', () => tests(true));
364364
describe('out of scope', () => tests(false));
365+
366+
it('shows the placeholder', () => {
367+
const panel = new Webauthn.WebauthnPane.WebauthnPaneImpl();
368+
assert.exists(panel.contentElement.querySelector('.empty-state'));
369+
assert.deepEqual(panel.contentElement.querySelector('.empty-state-header')?.textContent, 'No authenticator set up');
370+
assert.deepEqual(
371+
panel.contentElement.querySelector('.empty-state-description > span')?.textContent,
372+
'Use WebAuthn for phishing-resistant authentication.');
373+
});
365374
});

front_end/panels/webauthn/WebauthnPane.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import '../../ui/legacy/legacy.js';
77
import * as Common from '../../core/common/common.js';
88
import * as Host from '../../core/host/host.js';
99
import * as i18n from '../../core/i18n/i18n.js';
10+
import type * as Platform from '../../core/platform/platform.js';
1011
import * as SDK from '../../core/sdk/sdk.js';
1112
import * as Protocol from '../../generated/protocol.js';
1213
import type * as Buttons from '../../ui/components/buttons/buttons.js';
@@ -64,13 +65,13 @@ const UIStrings = {
6465
*/
6566
credentials: 'Credentials',
6667
/**
67-
*@description Label for the learn more link that is shown before the virtual environment is enabled.
68+
*@description Text that shows before the virtual environment is enabled.
6869
*/
69-
useWebauthnForPhishingresistant: 'Use WebAuthn for phishing-resistant authentication',
70+
noAuthenticator: 'No authenticator set up',
7071
/**
71-
*@description Text that is usually a hyperlink to more documentation
72+
*@description That that shows before virtual environment is enabled explaining the panel.
7273
*/
73-
learnMore: 'Learn more',
74+
useWebauthnForPhishingresistant: 'Use WebAuthn for phishing-resistant authentication.',
7475
/**
7576
*@description Title for section of interface that allows user to add a new virtual authenticator.
7677
*/
@@ -151,6 +152,9 @@ const UIStrings = {
151152
const str_ = i18n.i18n.registerUIStrings('panels/webauthn/WebauthnPane.ts', UIStrings);
152153
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
153154

155+
const WEB_AUTHN_EXPLANATION_URL =
156+
'https://developer.chrome.com/docs/devtools/webauthn' as Platform.DevToolsPath.UrlString;
157+
154158
const enum Events {
155159
EXPORT_CREDENTIAL = 'ExportCredential',
156160
REMOVE_CREDENTIAL = 'RemoveCredential',
@@ -249,7 +253,7 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
249253
#authenticatorsView: HTMLElement;
250254
#topToolbarContainer: HTMLElement|undefined;
251255
#topToolbar: UI.Toolbar.Toolbar|undefined;
252-
#learnMoreView: HTMLElement|undefined;
256+
#learnMoreView: UI.EmptyWidget.EmptyWidget|undefined;
253257
#newAuthenticatorSection: HTMLElement|undefined;
254258
#newAuthenticatorForm: HTMLElement|undefined;
255259
#protocolSelect: HTMLSelectElement|undefined;
@@ -561,16 +565,11 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
561565
}
562566

563567
#createNewAuthenticatorSection(): void {
564-
const learnMoreLink = UI.XLink.XLink.create(
565-
'https://developers.google.com/web/updates/2018/05/webauthn', i18nString(UIStrings.learnMore), undefined,
566-
undefined, 'learn-more');
567-
this.#learnMoreView = this.contentElement.createChild('div', 'learn-more');
568-
this.#learnMoreView.appendChild(UI.Fragment.html`
569-
<div>
570-
${i18nString(UIStrings.useWebauthnForPhishingresistant)}<br /><br />
571-
${learnMoreLink}
572-
</div>
573-
`);
568+
this.#learnMoreView = new UI.EmptyWidget.EmptyWidget(
569+
i18nString(UIStrings.noAuthenticator), i18nString(UIStrings.useWebauthnForPhishingresistant));
570+
this.#learnMoreView.element.classList.add('learn-more');
571+
this.#learnMoreView.appendLink(WEB_AUTHN_EXPLANATION_URL);
572+
this.#learnMoreView.show(this.contentElement);
574573

575574
this.#newAuthenticatorSection = this.contentElement.createChild('div', 'new-authenticator-container');
576575
const newAuthenticatorTitle =

0 commit comments

Comments
 (0)