mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-14 01:01:31 +01:00
[PM-2014] feat: finish up list UI
This commit is contained in:
parent
7446f1c680
commit
524288df77
@ -3,12 +3,12 @@ import { BaseResponse } from "@bitwarden/common/models/response/base.response";
|
|||||||
export class WebauthnCredentialResponse extends BaseResponse {
|
export class WebauthnCredentialResponse extends BaseResponse {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
prf: "active" | "inactive" | "unsupported";
|
prfSupport: boolean;
|
||||||
|
|
||||||
constructor(response: unknown) {
|
constructor(response: unknown) {
|
||||||
super(response);
|
super(response);
|
||||||
this.id = this.getResponseProperty("id");
|
this.id = this.getResponseProperty("id");
|
||||||
this.name = this.getResponseProperty("name");
|
this.name = this.getResponseProperty("name");
|
||||||
this.prf = this.getResponseProperty("prf");
|
this.prfSupport = this.getResponseProperty("prfSupport");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export class WebauthnCredentialView {
|
export class WebauthnCredentialView {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
prf: "active" | "inactive" | "unsupported";
|
prfSupport: boolean;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,53 @@
|
|||||||
<h2 bitTypography="h2">
|
<h2 bitTypography="h2">
|
||||||
{{ "loginWithPasskey" | i18n }} <span bitBadge badgeType="secondary">Not implemented</span>
|
{{ "loginWithPasskey" | i18n }}
|
||||||
<i *ngIf="loading" class="bwi bwi-spinner bwi-spin tw-ml-1" aria-hidden="true"></i>
|
<ng-container *ngIf="hasData">
|
||||||
|
<span *ngIf="hasCredentials" bitBadge badgeType="success">{{ "on" | i18n }}</span>
|
||||||
|
<span *ngIf="!hasCredentials" bitBadge badgeType="secondary">{{ "off" | i18n }}</span>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="loading">
|
||||||
|
<i class="bwi bwi-spinner bwi-spin tw-ml-1" aria-hidden="true"></i>
|
||||||
|
</ng-container>
|
||||||
</h2>
|
</h2>
|
||||||
<p bitTypography="body1">
|
<p bitTypography="body1">
|
||||||
{{ "loginWithPasskeyInfo" | i18n }}
|
{{ "loginWithPasskeyInfo" | i18n }}
|
||||||
<a bitLink href="???">{{ "learnMoreAboutPasswordless" | i18n }}</a>
|
<a bitLink href="???">{{ "learnMoreAboutPasswordless" | i18n }}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<table *ngIf="hasCredentials" class="tw-mb-5">
|
||||||
<li *ngFor="let credential of credentials$ | async">{{ credential.name }}</li>
|
<tr *ngFor="let credential of credentials">
|
||||||
</ul>
|
<td class="tw-p-2 tw-pl-0 tw-font-semibold">{{ credential.name }}</td>
|
||||||
|
<td class="tw-p-2 tw-pr-0">
|
||||||
|
<ng-container *ngIf="credential.prfSupport">
|
||||||
|
<i class="bwi bwi-lock-encrypted"></i>
|
||||||
|
{{ "supportsEncryption" | i18n }}
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="!credential.prfSupport">-</ng-container>
|
||||||
|
</td>
|
||||||
|
<td class="tw-py-2 tw-pl-20 tw-pr-0">
|
||||||
|
<button type="button" bitLink [disabled]="loading">{{ "remove" | i18n }}</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<button
|
<ng-container *ngIf="hasData">
|
||||||
type="button"
|
<button
|
||||||
bitButton
|
*ngIf="hasCredentials"
|
||||||
[attr.aria-label]="'enableLoginWithPasskey' | i18n"
|
type="button"
|
||||||
(click)="createCredential()"
|
bitButton
|
||||||
>
|
[disabled]="loading"
|
||||||
{{ "enable" | i18n }}
|
(click)="createCredential()"
|
||||||
</button>
|
>
|
||||||
|
{{ "newPasskey" | i18n }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
*ngIf="!hasCredentials"
|
||||||
|
type="button"
|
||||||
|
bitButton
|
||||||
|
[attr.aria-label]="'enableLoginWithPasskey' | i18n"
|
||||||
|
[disabled]="loading"
|
||||||
|
(click)="createCredential()"
|
||||||
|
>
|
||||||
|
{{ "enable" | i18n }}
|
||||||
|
</button>
|
||||||
|
</ng-container>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, HostBinding, OnDestroy, OnInit } from "@angular/core";
|
import { Component, HostBinding, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Observable, Subject, takeUntil } from "rxjs";
|
import { Subject, takeUntil } from "rxjs";
|
||||||
|
|
||||||
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
|
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ import { openCreateCredentialDialog } from "./create-credential-dialog/create-cr
|
|||||||
export class Fido2LoginSettingsComponent implements OnInit, OnDestroy {
|
export class Fido2LoginSettingsComponent implements OnInit, OnDestroy {
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
protected credentials$: Observable<WebauthnCredentialView[]>;
|
protected credentials?: WebauthnCredentialView[];
|
||||||
protected loading = true;
|
protected loading = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -31,8 +31,18 @@ export class Fido2LoginSettingsComponent implements OnInit, OnDestroy {
|
|||||||
return this.loading ? "true" : "false";
|
return this.loading ? "true" : "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasCredentials() {
|
||||||
|
return this.credentials && this.credentials.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasData() {
|
||||||
|
return this.credentials !== undefined;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.credentials$ = this.webauthnService.credentials$;
|
this.webauthnService.credentials$
|
||||||
|
.pipe(takeUntil(this.destroy$))
|
||||||
|
.subscribe((credentials) => (this.credentials = credentials));
|
||||||
|
|
||||||
this.webauthnService.loading$
|
this.webauthnService.loading$
|
||||||
.pipe(takeUntil(this.destroy$))
|
.pipe(takeUntil(this.destroy$))
|
||||||
|
@ -664,6 +664,9 @@
|
|||||||
"customPasskeyNameInfo": {
|
"customPasskeyNameInfo": {
|
||||||
"message": "Name your passkey to help you identify it."
|
"message": "Name your passkey to help you identify it."
|
||||||
},
|
},
|
||||||
|
"supportsEncryption": {
|
||||||
|
"message": "supports encryption"
|
||||||
|
},
|
||||||
"tryAgain": {
|
"tryAgain": {
|
||||||
"message": "Try again"
|
"message": "Try again"
|
||||||
},
|
},
|
||||||
@ -5759,6 +5762,9 @@
|
|||||||
"on": {
|
"on": {
|
||||||
"message": "On"
|
"message": "On"
|
||||||
},
|
},
|
||||||
|
"off": {
|
||||||
|
"message": "Off"
|
||||||
|
},
|
||||||
"members": {
|
"members": {
|
||||||
"message": "Members"
|
"message": "Members"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user