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

rename cipehrs component to vault items component (#4081)

This commit is contained in:
Jake Fink
2022-11-22 08:30:33 -05:00
committed by GitHub
parent a6226c7c90
commit a6ce83d9e0
25 changed files with 110 additions and 106 deletions

View File

@@ -34,12 +34,12 @@ import { SyncComponent } from "./settings/sync.component";
import { TabsComponent } from "./tabs.component";
import { AddEditComponent } from "./vault/add-edit.component";
import { AttachmentsComponent } from "./vault/attachments.component";
import { CiphersComponent } from "./vault/ciphers.component";
import { CollectionsComponent } from "./vault/collections.component";
import { CurrentTabComponent } from "./vault/current-tab.component";
import { PasswordHistoryComponent } from "./vault/password-history.component";
import { ShareComponent } from "./vault/share.component";
import { VaultFilterComponent } from "./vault/vault-filter.component";
import { VaultItemsComponent } from "./vault/vault-items.component";
import { ViewComponent } from "./vault/view.component";
const routes: Routes = [
@@ -120,7 +120,7 @@ const routes: Routes = [
},
{
path: "ciphers",
component: CiphersComponent,
component: VaultItemsComponent,
canActivate: [AuthGuard],
data: { state: "ciphers" },
},

View File

@@ -276,7 +276,7 @@ export class AppComponent implements OnInit, OnDestroy {
await Promise.all([
this.stateService.setBrowserGroupingComponentState(null),
this.stateService.setBrowserCipherComponentState(null),
this.stateService.setBrowserVaultItemsComponentState(null),
this.stateService.setBrowserSendComponentState(null),
this.stateService.setBrowserSendTypeComponentState(null),
]);

View File

@@ -108,12 +108,12 @@ import { TabsComponent } from "./tabs.component";
import { AddEditCustomFieldsComponent } from "./vault/add-edit-custom-fields.component";
import { AddEditComponent } from "./vault/add-edit.component";
import { AttachmentsComponent } from "./vault/attachments.component";
import { CiphersComponent } from "./vault/ciphers.component";
import { CollectionsComponent } from "./vault/collections.component";
import { CurrentTabComponent } from "./vault/current-tab.component";
import { PasswordHistoryComponent } from "./vault/password-history.component";
import { ShareComponent } from "./vault/share.component";
import { VaultFilterComponent } from "./vault/vault-filter.component";
import { VaultItemsComponent } from "./vault/vault-items.component";
import { VaultSelectComponent } from "./vault/vault-select.component";
import { ViewCustomFieldsComponent } from "./vault/view-custom-fields.component";
import { ViewComponent } from "./vault/view.component";
@@ -200,7 +200,7 @@ registerLocaleData(localeZhTw, "zh-TW");
AppComponent,
AttachmentsComponent,
CipherRowComponent,
CiphersComponent,
VaultItemsComponent,
CollectionsComponent,
CurrentTabComponent,
EnvironmentComponent,

View File

@@ -94,7 +94,7 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
this.showLeftHeader = !(
this.popupUtils.inSidebar(window) && this.platformUtilsService.isFirefox()
);
await this.browserStateService.setBrowserCipherComponentState(null);
await this.browserStateService.setBrowserVaultItemsComponentState(null);
this.broadcasterService.subscribe(ComponentId, (message: any) => {
this.ngZone.run(async () => {

View File

@@ -3,7 +3,7 @@ import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit } from "@angula
import { ActivatedRoute, Router } from "@angular/router";
import { first } from "rxjs/operators";
import { CiphersComponent as BaseCiphersComponent } from "@bitwarden/angular/components/ciphers.component";
import { VaultItemsComponent as BaseVaultItemsComponent } from "@bitwarden/angular/components/vault-items.component";
import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model";
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
@@ -25,13 +25,13 @@ import { StateService } from "../../services/abstractions/state.service";
import { VaultFilterService } from "../../services/vaultFilter.service";
import { PopupUtilsService } from "../services/popup-utils.service";
const ComponentId = "CiphersComponent";
const ComponentId = "VaultItemsComponent";
@Component({
selector: "app-vault-ciphers",
templateUrl: "ciphers.component.html",
selector: "app-vault-items",
templateUrl: "vault-items.component.html",
})
export class CiphersComponent extends BaseCiphersComponent implements OnInit, OnDestroy {
export class VaultItemsComponent extends BaseVaultItemsComponent implements OnInit, OnDestroy {
groupingTitle: string;
state: BrowserComponentState;
folderId: string = null;
@@ -82,7 +82,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
this.route.queryParams.pipe(first()).subscribe(async (params) => {
if (this.applySavedState) {
this.state = await this.stateService.getBrowserCipherComponentState();
this.state = await this.stateService.getBrowserVaultItemsComponentState();
if (this.state?.searchText) {
this.searchText = this.state.searchText;
}
@@ -161,7 +161,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
0
);
}
await this.stateService.setBrowserCipherComponentState(null);
await this.stateService.setBrowserVaultItemsComponentState(null);
});
this.broadcasterService.subscribe(ComponentId, (message: any) => {
@@ -291,6 +291,6 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
scrollY: this.popupUtils.getContentScrollY(window, this.scrollingContainer),
searchText: this.searchText,
};
await this.stateService.setBrowserCipherComponentState(this.state);
await this.stateService.setBrowserVaultItemsComponentState(this.state);
}
}

View File

@@ -18,8 +18,8 @@ export abstract class StateService extends BaseStateServiceAbstraction<Account>
value: BrowserGroupingsComponentState,
options?: StorageOptions
) => Promise<void>;
getBrowserCipherComponentState: (options?: StorageOptions) => Promise<BrowserComponentState>;
setBrowserCipherComponentState: (
getBrowserVaultItemsComponentState: (options?: StorageOptions) => Promise<BrowserComponentState>;
setBrowserVaultItemsComponentState: (
value: BrowserComponentState,
options?: StorageOptions
) => Promise<void>;

View File

@@ -107,14 +107,14 @@ describe("Browser State Service", () => {
});
});
describe("getBrowserCipherComponentState", () => {
describe("getBrowserVaultItemsComponentState", () => {
it("should return a BrowserComponentState", async () => {
const componentState = new BrowserComponentState();
componentState.scrollY = 0;
componentState.searchText = "test";
state.accounts[userId].ciphers = componentState;
const actual = await sut.getBrowserCipherComponentState();
const actual = await sut.getBrowserVaultItemsComponentState();
expect(actual).toStrictEqual(componentState);
});
});

View File

@@ -68,13 +68,15 @@ export class StateService
}
@withPrototype(BrowserComponentState)
async getBrowserCipherComponentState(options?: StorageOptions): Promise<BrowserComponentState> {
async getBrowserVaultItemsComponentState(
options?: StorageOptions
): Promise<BrowserComponentState> {
return (
await this.getAccount(this.reconcileOptions(options, await this.defaultInMemoryOptions()))
)?.ciphers;
}
async setBrowserCipherComponentState(
async setBrowserVaultItemsComponentState(
value: BrowserComponentState,
options?: StorageOptions
): Promise<void> {