1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

add autofill blocked domain indicators to autofill suggestions section header

This commit is contained in:
Jonathan Prusik
2024-11-15 17:54:59 -05:00
parent 2f8d2ac3cb
commit 05b0dc0b2f
6 changed files with 33 additions and 14 deletions

View File

@@ -3,6 +3,7 @@
[ciphers]="ciphers" [ciphers]="ciphers"
[title]="'autofillSuggestions' | i18n" [title]="'autofillSuggestions' | i18n"
[showRefresh]="showRefresh" [showRefresh]="showRefresh"
[sectionIndicators]="sectionIndicators"
(onRefresh)="refreshCurrentTab()" (onRefresh)="refreshCurrentTab()"
[description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null" [description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null"
showAutofillButton showAutofillButton

View File

@@ -1,16 +1,11 @@
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, OnInit } from "@angular/core"; import { Component, Input, OnInit } from "@angular/core";
import { combineLatest, firstValueFrom, map, Observable } from "rxjs"; import { combineLatest, firstValueFrom, map, Observable } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module"; import { JslibModule } from "@bitwarden/angular/jslib.module";
import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service"; import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service";
import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherType } from "@bitwarden/common/vault/enums";
import { import { IconButtonModule, TypographyModule } from "@bitwarden/components";
IconButtonModule,
SectionComponent,
SectionHeaderComponent,
TypographyModule,
} from "@bitwarden/components";
import BrowserPopupUtils from "../../../../../platform/popup/browser-popup-utils"; import BrowserPopupUtils from "../../../../../platform/popup/browser-popup-utils";
import { VaultPopupAutofillService } from "../../../services/vault-popup-autofill.service"; import { VaultPopupAutofillService } from "../../../services/vault-popup-autofill.service";
@@ -22,11 +17,9 @@ import { VaultListItemsContainerComponent } from "../vault-list-items-container/
standalone: true, standalone: true,
imports: [ imports: [
CommonModule, CommonModule,
SectionComponent,
TypographyModule, TypographyModule,
VaultListItemsContainerComponent, VaultListItemsContainerComponent,
JslibModule, JslibModule,
SectionHeaderComponent,
IconButtonModule, IconButtonModule,
], ],
selector: "app-autofill-vault-list-items", selector: "app-autofill-vault-list-items",
@@ -48,6 +41,11 @@ export class AutofillVaultListItemsComponent implements OnInit {
clickItemsToAutofillVaultView = false; clickItemsToAutofillVaultView = false;
/**
* Indicators for the section.
*/
@Input() sectionIndicators: string[];
/** /**
* Observable that determines whether the empty autofill tip should be shown. * Observable that determines whether the empty autofill tip should be shown.
* The tip is shown when there are no login ciphers to autofill, no filter is applied, and autofill is allowed in * The tip is shown when there are no login ciphers to autofill, no filter is applied, and autofill is allowed in

View File

@@ -3,6 +3,11 @@
<bit-section-header> <bit-section-header>
<h2 bitTypography="h6"> <h2 bitTypography="h6">
{{ title }} {{ title }}
<i
*ngIf="showAutofillBlockedIndicator"
class="bwi bwi-info-circle"
[appA11yTitle]="'autofillBlockedTooltip' | i18n"
></i>
</h2> </h2>
<button <button
*ngIf="showRefresh" *ngIf="showRefresh"

View File

@@ -12,7 +12,7 @@ import {
Output, Output,
signal, signal,
} from "@angular/core"; } from "@angular/core";
import { Router, RouterLink } from "@angular/router"; import { Router } from "@angular/router";
import { map } from "rxjs"; import { map } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module"; import { JslibModule } from "@bitwarden/angular/jslib.module";
@@ -50,7 +50,6 @@ import { ItemMoreOptionsComponent } from "../item-more-options/item-more-options
TypographyModule, TypographyModule,
JslibModule, JslibModule,
SectionHeaderComponent, SectionHeaderComponent,
RouterLink,
ItemCopyActionsComponent, ItemCopyActionsComponent,
ItemMoreOptionsComponent, ItemMoreOptionsComponent,
OrgIconDirective, OrgIconDirective,
@@ -81,6 +80,8 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
map((enabled) => (enabled ? 53 : 59)), map((enabled) => (enabled ? 53 : 59)),
); );
protected showAutofillBlockedIndicator = false;
/** /**
* Timeout used to add a small delay when selecting a cipher to allow for double click to launch * Timeout used to add a small delay when selecting a cipher to allow for double click to launch
* @private * @private
@@ -99,6 +100,11 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
@Input() @Input()
title: string; title: string;
/**
* Indicators for the section.
*/
@Input() sectionIndicators: string[];
/** /**
* Optional description for the vault list item section. Will be shown below the title even when * Optional description for the vault list item section. Will be shown below the title even when
* no ciphers are available. * no ciphers are available.
@@ -170,6 +176,10 @@ export class VaultListItemsContainerComponent implements AfterViewInit {
this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`); this.autofillShortcutTooltip.set(`${autofillTitle} ${autofillShortcut}`);
} }
this.showAutofillBlockedIndicator = !!this.sectionIndicators?.find(
(i) => i === "autofillDisabled",
);
} }
/** /**

View File

@@ -70,7 +70,9 @@
cdkVirtualScrollingElement cdkVirtualScrollingElement
class="tw-h-full tw-p-3 bit-compact:tw-p-2 tw-styled-scrollbar" class="tw-h-full tw-p-3 bit-compact:tw-p-2 tw-styled-scrollbar"
> >
<app-autofill-vault-list-items></app-autofill-vault-list-items> <app-autofill-vault-list-items
[sectionIndicators]="sectionIndicators"
></app-autofill-vault-list-items>
<app-vault-list-items-container <app-vault-list-items-container
[title]="'favorites' | i18n" [title]="'favorites' | i18n"
[ciphers]="favoriteCiphers$ | async" [ciphers]="favoriteCiphers$ | async"

View File

@@ -2,7 +2,6 @@ import { ScrollingModule } from "@angular/cdk/scrolling";
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, OnDestroy, OnInit } from "@angular/core"; import { Component, OnDestroy, OnInit } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { RouterLink } from "@angular/router";
import { combineLatest, firstValueFrom, Observable, shareReplay, switchMap } from "rxjs"; import { combineLatest, firstValueFrom, Observable, shareReplay, switchMap } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module"; import { JslibModule } from "@bitwarden/angular/jslib.module";
@@ -49,7 +48,6 @@ enum VaultState {
VaultListItemsContainerComponent, VaultListItemsContainerComponent,
BannerModule, BannerModule,
ButtonModule, ButtonModule,
RouterLink,
NewItemDropdownV2Component, NewItemDropdownV2Component,
ScrollingModule, ScrollingModule,
VaultHeaderV2Component, VaultHeaderV2Component,
@@ -65,6 +63,7 @@ export class VaultV2Component implements OnInit, OnDestroy {
protected scriptInjectionIsBlocked = false; protected scriptInjectionIsBlocked = false;
protected showScriptInjectionIsBlockedBanner = false; protected showScriptInjectionIsBlockedBanner = false;
protected autofillTabHostname: string = null; protected autofillTabHostname: string = null;
protected sectionIndicators: string[] = [];
protected newItemItemValues$: Observable<NewItemInitialValues> = protected newItemItemValues$: Observable<NewItemInitialValues> =
this.vaultPopupListFiltersService.filters$.pipe( this.vaultPopupListFiltersService.filters$.pipe(
@@ -134,6 +133,10 @@ export class VaultV2Component implements OnInit, OnDestroy {
this.scriptInjectionIsBlocked = autofillTabIsBlocked; this.scriptInjectionIsBlocked = autofillTabIsBlocked;
if (autofillTabIsBlocked) {
this.sectionIndicators.push("autofillDisabled");
}
this.showScriptInjectionIsBlockedBanner = this.showScriptInjectionIsBlockedBanner =
autofillTabIsBlocked && autofillTabIsBlocked &&
!blockedInteractionsUris[autofillTabURL.hostname]?.bannerIsDismissed; !blockedInteractionsUris[autofillTabURL.hostname]?.bannerIsDismissed;