mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-22313] Refactor organization vault component (#16017)
* refactor organization, userId, and filter * refactor collections * refactor allGroups to observable * Refactor ciphers WIP * fix filter$ * refactor collections$, refresh$, isEmpty$, proccesingEvents$ * resolve remaining ts-strict errors * refactor *ngIf to @if syntax * rename function * clean up * fix issues from merge conflict * better error handling, clean up * wip add feature flag * refactor org vault: improve null safety & loading * add take(2) to firstLoadComplete observable * add real feature flag * cleanup * fix icon * Add comments * refactor org vault with null checks, update util function * fix type --------- Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
This commit is contained in:
@@ -51,6 +51,9 @@ export function canAccessOrgAdmin(org: Organization): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use the general `getById` custom rxjs operator instead.
|
||||
*/
|
||||
export function getOrganizationById(id: string) {
|
||||
return map<Organization[], Organization | undefined>((orgs) => orgs.find((o) => o.id === id));
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ServerConfig } from "../platform/abstractions/config/server-config";
|
||||
export enum FeatureFlag {
|
||||
/* Admin Console Team */
|
||||
CreateDefaultLocation = "pm-19467-create-default-location",
|
||||
CollectionVaultRefactor = "pm-25030-resolve-ts-upgrade-errors",
|
||||
|
||||
/* Auth */
|
||||
PM14938_BrowserExtensionLoginApproval = "pm-14938-browser-extension-login-approvals",
|
||||
@@ -71,6 +72,7 @@ const FALSE = false as boolean;
|
||||
export const DefaultFeatureFlagValue = {
|
||||
/* Admin Console Team */
|
||||
[FeatureFlag.CreateDefaultLocation]: FALSE,
|
||||
[FeatureFlag.CollectionVaultRefactor]: FALSE,
|
||||
|
||||
/* Autofill */
|
||||
[FeatureFlag.NotificationRefresh]: FALSE,
|
||||
|
||||
@@ -80,6 +80,18 @@ export class CipherViewLikeUtils {
|
||||
return cipher.isDeleted;
|
||||
};
|
||||
|
||||
/** @returns `true` when the cipher is not assigned to a collection, `false` otherwise. */
|
||||
static isUnassigned = (cipher: CipherViewLike): boolean => {
|
||||
if (this.isCipherListView(cipher)) {
|
||||
return (
|
||||
cipher.organizationId != null &&
|
||||
(cipher.collectionIds == null || cipher.collectionIds.length === 0)
|
||||
);
|
||||
}
|
||||
|
||||
return cipher.isUnassigned;
|
||||
};
|
||||
|
||||
/** @returns `true` when the user can assign the cipher to a collection, `false` otherwise. */
|
||||
static canAssignToCollections = (cipher: CipherViewLike): boolean => {
|
||||
if (this.isCipherListView(cipher)) {
|
||||
|
||||
Reference in New Issue
Block a user