mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 10:13:31 +00:00
[PM-6565] migrate vault toasts to CL toastService (#10664)
* migrate vault toasts to CL toastService * update component args * add missing toastService deps * add missing i18 key * remove moved files * remove duplicate args
This commit is contained in:
@@ -29,7 +29,7 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
import { BitValidators, DialogService } from "@bitwarden/components";
|
||||
import { BitValidators, DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { GroupApiService, GroupView } from "../../../admin-console/organizations/core";
|
||||
import { PermissionMode } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.component";
|
||||
@@ -110,6 +110,7 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||
private organizationUserApiService: OrganizationUserApiService,
|
||||
private dialogService: DialogService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.tabIndex = params.initialTab ?? CollectionDialogTabType.Info;
|
||||
}
|
||||
@@ -274,17 +275,20 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||
const accessTabError = this.formGroup.controls.access.hasError("managePermissionRequired");
|
||||
|
||||
if (this.tabIndex === CollectionDialogTabType.Access && !accessTabError) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("collectionInfo")),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t(
|
||||
"fieldOnTabRequiresAttention",
|
||||
this.i18nService.t("collectionInfo"),
|
||||
),
|
||||
});
|
||||
} else if (this.tabIndex === CollectionDialogTabType.Info && accessTabError) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("access")),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("access")),
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -309,14 +313,14 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
const savedCollection = await this.collectionAdminService.save(collectionView);
|
||||
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t(
|
||||
this.editMode ? "editedCollectionId" : "createdCollectionId",
|
||||
collectionView.name,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
this.close(CollectionDialogAction.Saved, savedCollection);
|
||||
};
|
||||
@@ -339,11 +343,11 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
await this.collectionAdminService.delete(this.params.organizationId, this.params.collectionId);
|
||||
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("deletedCollectionId", this.collection?.name),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("deletedCollectionId", this.collection?.name),
|
||||
});
|
||||
|
||||
this.close(CollectionDialogAction.Deleted, this.collection);
|
||||
};
|
||||
|
||||
@@ -194,11 +194,11 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
|
||||
}
|
||||
|
||||
this.platformUtilsService.copyToClipboard(value, { window: window });
|
||||
this.platformUtilsService.showToast(
|
||||
"info",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t(typeI18nKey)),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "info",
|
||||
title: null,
|
||||
message: this.i18nService.t("valueCopied", this.i18nService.t(typeI18nKey)),
|
||||
});
|
||||
|
||||
if (this.editMode) {
|
||||
if (typeI18nKey === "password") {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { CipherBulkDeleteRequest } from "@bitwarden/common/vault/models/request/cipher-bulk-delete.request";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
export interface BulkDeleteDialogParams {
|
||||
cipherIds?: string[];
|
||||
@@ -60,6 +60,7 @@ export class BulkDeleteDialogComponent {
|
||||
private i18nService: I18nService,
|
||||
private apiService: ApiService,
|
||||
private collectionService: CollectionService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.cipherIds = params.cipherIds ?? [];
|
||||
this.permanent = params.permanent;
|
||||
@@ -95,19 +96,19 @@ export class BulkDeleteDialogComponent {
|
||||
await Promise.all(deletePromises);
|
||||
|
||||
if (this.cipherIds.length || this.unassignedCiphers.length) {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.permanent ? "permanentlyDeletedItems" : "deletedItems"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t(this.permanent ? "permanentlyDeletedItems" : "deletedItems"),
|
||||
});
|
||||
}
|
||||
if (this.collections.length) {
|
||||
await this.collectionService.delete(this.collections.map((c) => c.id));
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("deletedCollections"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("deletedCollections"),
|
||||
});
|
||||
}
|
||||
this.close(BulkDeleteDialogResult.Deleted);
|
||||
};
|
||||
@@ -134,11 +135,11 @@ export class BulkDeleteDialogComponent {
|
||||
// From org vault
|
||||
if (this.organization) {
|
||||
if (this.collections.some((c) => !c.canDelete(this.organization))) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("missingPermissions"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: this.i18nService.t("errorOccurred"),
|
||||
message: this.i18nService.t("missingPermissions"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
return await this.apiService.deleteManyCollections(
|
||||
@@ -151,11 +152,11 @@ export class BulkDeleteDialogComponent {
|
||||
for (const organization of this.organizations) {
|
||||
const orgCollections = this.collections.filter((o) => o.organizationId === organization.id);
|
||||
if (orgCollections.some((c) => !c.canDelete(organization))) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("missingPermissions"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: this.i18nService.t("errorOccurred"),
|
||||
message: this.i18nService.t("missingPermissions"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const orgCollectionIds = orgCollections.map((c) => c.id);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
||||
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
export interface BulkMoveDialogParams {
|
||||
cipherIds?: string[];
|
||||
@@ -58,6 +58,7 @@ export class BulkMoveDialogComponent implements OnInit {
|
||||
private i18nService: I18nService,
|
||||
private folderService: FolderService,
|
||||
private formBuilder: FormBuilder,
|
||||
private toastService: ToastService,
|
||||
private accountService: AccountService,
|
||||
) {
|
||||
this.cipherIds = params.cipherIds ?? [];
|
||||
@@ -81,7 +82,11 @@ export class BulkMoveDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
await this.cipherService.moveManyWithServer(this.cipherIds, this.formGroup.value.folderId);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("movedItems"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("movedItems"),
|
||||
});
|
||||
this.close(BulkMoveDialogResult.Moved);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,11 +10,10 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { Checkable, isChecked } from "@bitwarden/common/types/checkable";
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
export interface BulkShareDialogParams {
|
||||
ciphers: CipherView[];
|
||||
@@ -59,12 +58,12 @@ export class BulkShareDialogComponent implements OnInit, OnDestroy {
|
||||
@Inject(DIALOG_DATA) params: BulkShareDialogParams,
|
||||
private dialogRef: DialogRef<BulkShareDialogResult>,
|
||||
private cipherService: CipherService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private collectionService: CollectionService,
|
||||
private organizationService: OrganizationService,
|
||||
private logService: LogService,
|
||||
private accountService: AccountService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.ciphers = params.ciphers ?? [];
|
||||
this.organizationId = params.organizationId;
|
||||
@@ -114,11 +113,11 @@ export class BulkShareDialogComponent implements OnInit, OnDestroy {
|
||||
const orgName =
|
||||
this.organizations.find((o) => o.id === this.organizationId)?.name ??
|
||||
this.i18nService.t("organization");
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("movedItemsToOrg", orgName),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("movedItemsToOrg", orgName),
|
||||
});
|
||||
this.close(BulkShareDialogResult.Shared);
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
|
||||
@@ -45,6 +45,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent {
|
||||
logService,
|
||||
dialogService,
|
||||
formBuilder,
|
||||
toastService,
|
||||
);
|
||||
// FIXME: Remove when updating file. Eslint update
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
@@ -89,11 +90,11 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent {
|
||||
const folder = await this.folderService.encrypt(this.folder, userKey);
|
||||
this.formPromise = this.folderApiService.save(folder, activeAccountId);
|
||||
await this.formPromise;
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode ? "editedFolder" : "addedFolder"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t(this.editMode ? "editedFolder" : "addedFolder"),
|
||||
});
|
||||
this.onSavedFolder.emit(this.folder);
|
||||
this.dialogRef.close(FolderAddEditDialogResult.Saved);
|
||||
} catch (e) {
|
||||
|
||||
@@ -146,7 +146,11 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
||||
return this.syncService.fullSync(true);
|
||||
});
|
||||
await this.actionPromise;
|
||||
this.platformUtilsService.showToast("success", null, "Unlinked SSO");
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("unlinkedSso"),
|
||||
});
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
@@ -166,7 +170,11 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
||||
try {
|
||||
this.actionPromise = this.organizationApiService.leave(org.id);
|
||||
await this.actionPromise;
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("leftOrganization"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("leftOrganization"),
|
||||
});
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
@@ -199,11 +207,11 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
try {
|
||||
await this.actionPromise;
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("withdrawPasswordResetSuccess"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("withdrawPasswordResetSuccess"),
|
||||
});
|
||||
await this.syncService.fullSync(true);
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { TrialFlowService } from "../../../../billing/services/trial-flow.service";
|
||||
import { VaultFilterService } from "../services/abstractions/vault-filter.service";
|
||||
@@ -98,6 +98,7 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
|
||||
protected policyService: PolicyService,
|
||||
protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected toastService: ToastService,
|
||||
protected billingApiService: BillingApiServiceAbstraction,
|
||||
protected dialogService: DialogService,
|
||||
protected configService: ConfigService,
|
||||
@@ -122,11 +123,11 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
|
||||
|
||||
applyOrganizationFilter = async (orgNode: TreeNode<OrganizationFilter>): Promise<void> => {
|
||||
if (!orgNode?.node.enabled) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("disabledOrganizationFilterError"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("disabledOrganizationFilterError"),
|
||||
});
|
||||
const metadata = await this.billingApiService.getOrganizationBillingMetadata(orgNode.node.id);
|
||||
await this.trialFlowService.handleUnpaidSubscriptionDialog(orgNode.node, metadata);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { GroupApiService, GroupView } from "../../../admin-console/organizations/core";
|
||||
import {
|
||||
@@ -68,6 +68,7 @@ export class BulkCollectionsDialogComponent implements OnDestroy {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private collectionAdminService: CollectionAdminService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.numCollections = this.params.collections.length;
|
||||
const organization$ = this.organizationService.get$(this.params.organizationId);
|
||||
@@ -119,7 +120,11 @@ export class BulkCollectionsDialogComponent implements OnDestroy {
|
||||
groups,
|
||||
);
|
||||
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("editedCollections"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("editedCollections"),
|
||||
});
|
||||
|
||||
this.dialogRef.close(BulkCollectionsDialogResult.Saved);
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ConfigService } from "@bitwarden/common/platform/abstractions/config/co
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { VaultFilterComponent as BaseVaultFilterComponent } from "../../individual-vault/vault-filter/components/vault-filter.component"; //../../vault/vault-filter/components/vault-filter.component";
|
||||
import { VaultFilterService } from "../../individual-vault/vault-filter/services/abstractions/vault-filter.service";
|
||||
@@ -43,6 +43,7 @@ export class VaultFilterComponent
|
||||
protected policyService: PolicyService,
|
||||
protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected toastService: ToastService,
|
||||
protected billingApiService: BillingApiServiceAbstraction,
|
||||
protected dialogService: DialogService,
|
||||
protected configService: ConfigService,
|
||||
@@ -52,6 +53,7 @@ export class VaultFilterComponent
|
||||
policyService,
|
||||
i18nService,
|
||||
platformUtilsService,
|
||||
toastService,
|
||||
billingApiService,
|
||||
dialogService,
|
||||
configService,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Verification } from "@bitwarden/common/auth/types/verification";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
export interface PurgeVaultDialogData {
|
||||
organizationId: string;
|
||||
@@ -37,6 +37,7 @@ export class PurgeVaultComponent {
|
||||
private userVerificationService: UserVerificationService,
|
||||
private router: Router,
|
||||
private syncService: SyncService,
|
||||
private toastService: ToastService,
|
||||
) {
|
||||
this.organizationId = data && data.organizationId ? data.organizationId : null;
|
||||
}
|
||||
@@ -46,7 +47,11 @@ export class PurgeVaultComponent {
|
||||
.buildRequest(this.formGroup.value.masterPassword)
|
||||
.then((request) => this.apiService.postPurgeCiphers(request, this.organizationId));
|
||||
await response;
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("vaultPurged"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("vaultPurged"),
|
||||
});
|
||||
await this.syncService.fullSync(true);
|
||||
if (this.organizationId != null) {
|
||||
await this.router.navigate(["organizations", this.organizationId, "vault"]);
|
||||
|
||||
@@ -3789,6 +3789,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"unlinkedSso": {
|
||||
"message": "Unlinked SSO."
|
||||
},
|
||||
"unlinkedSsoUser": {
|
||||
"message": "Unlinked SSO for user $ID$.",
|
||||
"placeholders": {
|
||||
|
||||
Reference in New Issue
Block a user