-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-9111] Extension: persist add/edit form (#12236)
* remove todo * Retrieve cache cipher for add-edit form * user prefilled cipher for add-edit form * add listener for clearing view cache * clear local cache when clearing global state * track initial value of cache for down stream logic that should only occur on non-cached values * add feature flag for edit form persistence * add tests for cipher form cache service * fix optional initialValues * add services to cipher form storybook * fix strict types * rename variables to be platform agnostic * use deconstructed collectionIds variable to avoid them be overwritten * use the originalCipherView for initial values * add comment about signal equality * prevent events from being emitted when adding uris to the existing form - This stops other values from being overwrote in the initialization process * add check for cached cipher when adding initial uris
- Loading branch information
1 parent
1dfae06
commit 5c32e50
Showing
22 changed files
with
459 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { importProvidersFrom } from "@angular/core"; | ||
// FIXME: Update this file to be type safe and remove this and next line | ||
// @ts-strict-ignore | ||
import { importProvidersFrom, signal } from "@angular/core"; | ||
import { action } from "@storybook/addon-actions"; | ||
import { | ||
applicationConfig, | ||
|
@@ -10,6 +12,7 @@ import { | |
import { BehaviorSubject } from "rxjs"; | ||
|
||
import { CollectionView } from "@bitwarden/admin-console/common"; | ||
import { ViewCacheService } from "@bitwarden/angular/platform/abstractions/view-cache.service"; | ||
import { AuditService } from "@bitwarden/common/abstractions/audit.service"; | ||
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service"; | ||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; | ||
|
@@ -18,6 +21,7 @@ import { AutofillSettingsServiceAbstraction } from "@bitwarden/common/autofill/s | |
import { DomainSettingsService } from "@bitwarden/common/autofill/services/domain-settings.service"; | ||
import { ClientType } from "@bitwarden/common/enums"; | ||
import { UriMatchStrategy } from "@bitwarden/common/models/domain/domain-service"; | ||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; | ||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; | ||
import { CipherType } from "@bitwarden/common/vault/enums"; | ||
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; | ||
|
@@ -39,6 +43,7 @@ import { CipherFormService } from "./abstractions/cipher-form.service"; | |
import { TotpCaptureService } from "./abstractions/totp-capture.service"; | ||
import { CipherFormModule } from "./cipher-form.module"; | ||
import { CipherFormComponent } from "./components/cipher-form.component"; | ||
import { CipherFormCacheService } from "./services/default-cipher-form-cache.service"; | ||
|
||
const defaultConfig: CipherFormConfig = { | ||
mode: "add", | ||
|
@@ -192,6 +197,25 @@ export default { | |
activeAccount$: new BehaviorSubject({ email: "[email protected]" }), | ||
}, | ||
}, | ||
{ | ||
provide: CipherFormCacheService, | ||
useValue: { | ||
getCachedCipherView: (): null => null, | ||
initializedWithValue: false, | ||
}, | ||
}, | ||
{ | ||
provide: ViewCacheService, | ||
useValue: { | ||
signal: () => signal(null), | ||
}, | ||
}, | ||
{ | ||
provide: ConfigService, | ||
useValue: { | ||
getFeatureFlag: () => Promise.resolve(false), | ||
}, | ||
}, | ||
], | ||
}), | ||
componentWrapperDecorator( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.