mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-05 05:17:40 +02:00
[PM-6568][PM-8820][Tech-Debt] Migrate all tools owned toasts to use CL ToastService instead of PlatformUtilsService (#9405)
* Migrate all tools owned toasts to use CL ToastService instead of PlatformUtilsService * Fix test that was missing a mock * Fix double checking file and file-content selection --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
88cc37e37f
commit
8d04731633
@ -13,6 +13,7 @@ import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/ge
|
|||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
import { AddEditCipherInfo } from "@bitwarden/common/vault/types/add-edit-cipher-info";
|
import { AddEditCipherInfo } from "@bitwarden/common/vault/types/add-edit-cipher-info";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-generator",
|
selector: "app-generator",
|
||||||
@ -34,6 +35,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
@ -45,6 +47,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
|
|||||||
route,
|
route,
|
||||||
ngZone,
|
ngZone,
|
||||||
window,
|
window,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
this.cipherService = cipherService;
|
this.cipherService = cipherService;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import { PasswordGeneratorHistoryComponent as BasePasswordGeneratorHistoryCompon
|
|||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-password-generator-history",
|
selector: "app-password-generator-history",
|
||||||
@ -16,8 +17,9 @@ export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHist
|
|||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(passwordGenerationService, platformUtilsService, i18nService, window);
|
super(passwordGenerationService, platformUtilsService, i18nService, window, toastService);
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
@ -15,7 +15,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag
|
|||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
||||||
import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service";
|
import { BrowserStateService } from "../../../platform/services/abstractions/browser-state.service";
|
||||||
@ -53,6 +53,7 @@ export class SendAddEditComponent extends BaseAddEditComponent {
|
|||||||
private filePopoutUtilsService: FilePopoutUtilsService,
|
private filePopoutUtilsService: FilePopoutUtilsService,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
i18nService,
|
i18nService,
|
||||||
@ -69,6 +70,7 @@ export class SendAddEditComponent extends BaseAddEditComponent {
|
|||||||
formBuilder,
|
formBuilder,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
|||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
|
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
|
import { BrowserSendComponentState } from "../../../models/browserSendComponentState";
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
||||||
@ -49,6 +49,7 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
sendApiService: SendApiService,
|
sendApiService: SendApiService,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
sendService,
|
sendService,
|
||||||
@ -61,6 +62,7 @@ export class SendGroupingsComponent extends BaseSendComponent {
|
|||||||
logService,
|
logService,
|
||||||
sendApiService,
|
sendApiService,
|
||||||
dialogService,
|
dialogService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
super.onSuccessfulLoad = async () => {
|
super.onSuccessfulLoad = async () => {
|
||||||
this.selectAll();
|
this.selectAll();
|
||||||
|
@ -15,7 +15,7 @@ import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
|||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { BrowserComponentState } from "../../../models/browserComponentState";
|
import { BrowserComponentState } from "../../../models/browserComponentState";
|
||||||
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
import BrowserPopupUtils from "../../../platform/popup/browser-popup-utils";
|
||||||
@ -51,6 +51,7 @@ export class SendTypeComponent extends BaseSendComponent {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
sendApiService: SendApiService,
|
sendApiService: SendApiService,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
sendService,
|
sendService,
|
||||||
@ -63,6 +64,7 @@ export class SendTypeComponent extends BaseSendComponent {
|
|||||||
logService,
|
logService,
|
||||||
sendApiService,
|
sendApiService,
|
||||||
dialogService,
|
dialogService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
super.onSuccessfulLoad = async () => {
|
super.onSuccessfulLoad = async () => {
|
||||||
this.selectType(this.type);
|
this.selectType(this.type);
|
||||||
|
@ -11,6 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||||
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
|
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { GeneratorComponent } from "./generator.component";
|
import { GeneratorComponent } from "./generator.component";
|
||||||
|
|
||||||
@ -59,6 +60,10 @@ describe("GeneratorComponent", () => {
|
|||||||
provide: AccountService,
|
provide: AccountService,
|
||||||
useValue: mock<AccountService>(),
|
useValue: mock<AccountService>(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: ToastService,
|
||||||
|
useValue: mock<ToastService>(),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@ -8,6 +8,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
|||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||||
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
|
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-generator",
|
selector: "app-generator",
|
||||||
@ -23,6 +24,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
|
|||||||
route: ActivatedRoute,
|
route: ActivatedRoute,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
@ -34,6 +36,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
|
|||||||
route,
|
route,
|
||||||
ngZone,
|
ngZone,
|
||||||
window,
|
window,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { PasswordGeneratorHistoryComponent as BasePasswordGeneratorHistoryCompon
|
|||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-password-generator-history",
|
selector: "app-password-generator-history",
|
||||||
@ -14,7 +15,8 @@ export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHist
|
|||||||
passwordGenerationService: PasswordGenerationServiceAbstraction,
|
passwordGenerationService: PasswordGenerationServiceAbstraction,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(passwordGenerationService, platformUtilsService, i18nService, window);
|
super(passwordGenerationService, platformUtilsService, i18nService, window, toastService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-send-add-edit",
|
selector: "app-send-add-edit",
|
||||||
@ -36,6 +36,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
formBuilder: FormBuilder,
|
formBuilder: FormBuilder,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
i18nService,
|
i18nService,
|
||||||
@ -52,6 +53,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
formBuilder,
|
formBuilder,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,11 +72,11 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
super.copyLinkToClipboard(link);
|
super.copyLinkToClipboard(link);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("valueCopied", this.i18nService.t("sendLink")),
|
message: this.i18nService.t("valueCopied", this.i18nService.t("sendLink")),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async resetAndLoad() {
|
async resetAndLoad() {
|
||||||
|
@ -11,7 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { invokeMenu, RendererMenuItem } from "../../../utils";
|
import { invokeMenu, RendererMenuItem } from "../../../utils";
|
||||||
import { SearchBarService } from "../../layout/search/search-bar.service";
|
import { SearchBarService } from "../../layout/search/search-bar.service";
|
||||||
@ -49,6 +49,7 @@ export class SendComponent extends BaseSendComponent implements OnInit, OnDestro
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
sendApiService: SendApiService,
|
sendApiService: SendApiService,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
sendService,
|
sendService,
|
||||||
@ -61,6 +62,7 @@ export class SendComponent extends BaseSendComponent implements OnInit, OnDestro
|
|||||||
logService,
|
logService,
|
||||||
sendApiService,
|
sendApiService,
|
||||||
dialogService,
|
dialogService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
this.searchBarService.searchText$.subscribe((searchText) => {
|
this.searchBarService.searchText$.subscribe((searchText) => {
|
||||||
|
@ -9,8 +9,7 @@ import { EventType } from "@bitwarden/common/enums";
|
|||||||
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
import { DialogService } from "@bitwarden/components";
|
|
||||||
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";
|
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";
|
||||||
|
|
||||||
import { ExportComponent } from "../../../../tools/vault-export/export.component";
|
import { ExportComponent } from "../../../../tools/vault-export/export.component";
|
||||||
@ -23,7 +22,7 @@ import { ExportComponent } from "../../../../tools/vault-export/export.component
|
|||||||
export class OrganizationVaultExportComponent extends ExportComponent {
|
export class OrganizationVaultExportComponent extends ExportComponent {
|
||||||
constructor(
|
constructor(
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
toastService: ToastService,
|
||||||
exportService: VaultExportServiceAbstraction,
|
exportService: VaultExportServiceAbstraction,
|
||||||
eventCollectionService: EventCollectionService,
|
eventCollectionService: EventCollectionService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
@ -36,7 +35,7 @@ export class OrganizationVaultExportComponent extends ExportComponent {
|
|||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
toastService,
|
||||||
exportService,
|
exportService,
|
||||||
eventCollectionService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
|
@ -8,7 +8,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
|||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||||
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
|
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { PasswordGeneratorHistoryComponent } from "./password-generator-history.component";
|
import { PasswordGeneratorHistoryComponent } from "./password-generator-history.component";
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
|
|||||||
route: ActivatedRoute,
|
route: ActivatedRoute,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
@ -38,6 +39,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
|
|||||||
route,
|
route,
|
||||||
ngZone,
|
ngZone,
|
||||||
window,
|
window,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
if (platformUtilsService.isSelfHost()) {
|
if (platformUtilsService.isSelfHost()) {
|
||||||
// Allow only valid email forwarders for self host
|
// Allow only valid email forwarders for self host
|
||||||
|
@ -4,6 +4,7 @@ import { PasswordGeneratorHistoryComponent as BasePasswordGeneratorHistoryCompon
|
|||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-password-generator-history",
|
selector: "app-password-generator-history",
|
||||||
@ -14,7 +15,8 @@ export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHist
|
|||||||
passwordGenerationService: PasswordGenerationServiceAbstraction,
|
passwordGenerationService: PasswordGenerationServiceAbstraction,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(passwordGenerationService, platformUtilsService, i18nService, window);
|
super(passwordGenerationService, platformUtilsService, i18nService, window, toastService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import { ConfigService } from "@bitwarden/common/platform/abstractions/config/co
|
|||||||
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
|
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
|
||||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
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 { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
||||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||||
@ -18,7 +17,7 @@ import { SendAccessResponse } from "@bitwarden/common/tools/send/models/response
|
|||||||
import { SendAccessView } from "@bitwarden/common/tools/send/models/view/send-access.view";
|
import { SendAccessView } from "@bitwarden/common/tools/send/models/view/send-access.view";
|
||||||
import { SEND_KDF_ITERATIONS } from "@bitwarden/common/tools/send/send-kdf";
|
import { SEND_KDF_ITERATIONS } from "@bitwarden/common/tools/send/send-kdf";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { NoItemsModule } from "@bitwarden/components";
|
import { NoItemsModule, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SharedModule } from "../../shared";
|
import { SharedModule } from "../../shared";
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ export class AccessComponent implements OnInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private cryptoService: CryptoService,
|
private cryptoService: CryptoService,
|
||||||
private sendApiService: SendApiService,
|
private sendApiService: SendApiService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private toastService: ToastService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
protected formBuilder: FormBuilder,
|
protected formBuilder: FormBuilder,
|
||||||
@ -142,11 +141,11 @@ export class AccessComponent implements OnInit {
|
|||||||
} else if (e.statusCode === 404) {
|
} else if (e.statusCode === 404) {
|
||||||
this.unavailable = true;
|
this.unavailable = true;
|
||||||
} else if (e.statusCode === 400) {
|
} else if (e.statusCode === 400) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
e.message,
|
message: e.message,
|
||||||
);
|
});
|
||||||
} else {
|
} else {
|
||||||
this.error = true;
|
this.error = true;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-send-add-edit",
|
selector: "app-send-add-edit",
|
||||||
@ -42,6 +42,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
protected dialogRef: DialogRef,
|
protected dialogRef: DialogRef,
|
||||||
@Inject(DIALOG_DATA) params: { sendId: string },
|
@Inject(DIALOG_DATA) params: { sendId: string },
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
i18nService,
|
i18nService,
|
||||||
@ -58,6 +59,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
formBuilder,
|
formBuilder,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.sendId = params.sendId;
|
this.sendId = params.sendId;
|
||||||
|
@ -3,13 +3,13 @@ import { Component, Input } from "@angular/core";
|
|||||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||||
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
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 { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer";
|
import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer";
|
||||||
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
|
||||||
import { SendAccessRequest } from "@bitwarden/common/tools/send/models/request/send-access.request";
|
import { SendAccessRequest } from "@bitwarden/common/tools/send/models/request/send-access.request";
|
||||||
import { SendAccessView } from "@bitwarden/common/tools/send/models/view/send-access.view";
|
import { SendAccessView } from "@bitwarden/common/tools/send/models/view/send-access.view";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SharedModule } from "../../shared";
|
import { SharedModule } from "../../shared";
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ export class SendAccessFileComponent {
|
|||||||
@Input() accessRequest: SendAccessRequest;
|
@Input() accessRequest: SendAccessRequest;
|
||||||
constructor(
|
constructor(
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private toastService: ToastService,
|
||||||
private cryptoService: CryptoService,
|
private cryptoService: CryptoService,
|
||||||
private fileDownloadService: FileDownloadService,
|
private fileDownloadService: FileDownloadService,
|
||||||
private sendApiService: SendApiService,
|
private sendApiService: SendApiService,
|
||||||
@ -42,13 +42,21 @@ export class SendAccessFileComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (Utils.isNullOrWhitespace(downloadData.url)) {
|
if (Utils.isNullOrWhitespace(downloadData.url)) {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("missingSendFile"));
|
this.toastService.showToast({
|
||||||
|
variant: "error",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("missingSendFile"),
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(new Request(downloadData.url, { cache: "no-store" }));
|
const response = await fetch(new Request(downloadData.url, { cache: "no-store" }));
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("errorOccurred"));
|
this.toastService.showToast({
|
||||||
|
variant: "error",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("errorOccurred"),
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +69,11 @@ export class SendAccessFileComponent {
|
|||||||
downloadMethod: "save",
|
downloadMethod: "save",
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("errorOccurred"));
|
this.toastService.showToast({
|
||||||
|
variant: "error",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("errorOccurred"),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import { FormBuilder } from "@angular/forms";
|
|||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { SendAccessView } from "@bitwarden/common/tools/send/models/view/send-access.view";
|
import { SendAccessView } from "@bitwarden/common/tools/send/models/view/send-access.view";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SharedModule } from "../../shared";
|
import { SharedModule } from "../../shared";
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ export class SendAccessTextComponent {
|
|||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
get send(): SendAccessView {
|
get send(): SendAccessView {
|
||||||
@ -46,11 +48,11 @@ export class SendAccessTextComponent {
|
|||||||
|
|
||||||
protected copyText() {
|
protected copyText() {
|
||||||
this.platformUtilsService.copyToClipboard(this.send.text.text);
|
this.platformUtilsService.copyToClipboard(this.send.text.text);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("valueCopied", this.i18nService.t("sendTypeText")),
|
message: this.i18nService.t("valueCopied", this.i18nService.t("sendTypeText")),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected toggleText() {
|
protected toggleText() {
|
||||||
|
@ -12,7 +12,13 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService, NoItemsModule, SearchModule, TableDataSource } from "@bitwarden/components";
|
import {
|
||||||
|
DialogService,
|
||||||
|
NoItemsModule,
|
||||||
|
SearchModule,
|
||||||
|
TableDataSource,
|
||||||
|
ToastService,
|
||||||
|
} from "@bitwarden/components";
|
||||||
|
|
||||||
import { HeaderModule } from "../../layouts/header/header.module";
|
import { HeaderModule } from "../../layouts/header/header.module";
|
||||||
import { SharedModule } from "../../shared";
|
import { SharedModule } from "../../shared";
|
||||||
@ -56,6 +62,7 @@ export class SendComponent extends BaseSendComponent {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
sendApiService: SendApiService,
|
sendApiService: SendApiService,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
sendService,
|
sendService,
|
||||||
@ -68,6 +75,7 @@ export class SendComponent extends BaseSendComponent {
|
|||||||
logService,
|
logService,
|
||||||
sendApiService,
|
sendApiService,
|
||||||
dialogService,
|
dialogService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ import { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli
|
|||||||
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
import { DialogService } from "@bitwarden/components";
|
|
||||||
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";
|
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";
|
||||||
import { ExportComponent as BaseExportComponent } from "@bitwarden/vault-export-ui";
|
import { ExportComponent as BaseExportComponent } from "@bitwarden/vault-export-ui";
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ import { ExportComponent as BaseExportComponent } from "@bitwarden/vault-export-
|
|||||||
export class ExportComponent extends BaseExportComponent {
|
export class ExportComponent extends BaseExportComponent {
|
||||||
constructor(
|
constructor(
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
toastService: ToastService,
|
||||||
exportService: VaultExportServiceAbstraction,
|
exportService: VaultExportServiceAbstraction,
|
||||||
eventCollectionService: EventCollectionService,
|
eventCollectionService: EventCollectionService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
@ -31,7 +30,7 @@ export class ExportComponent extends BaseExportComponent {
|
|||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
i18nService,
|
i18nService,
|
||||||
platformUtilsService,
|
toastService,
|
||||||
exportService,
|
exportService,
|
||||||
eventCollectionService,
|
eventCollectionService,
|
||||||
policyService,
|
policyService,
|
||||||
@ -45,6 +44,10 @@ export class ExportComponent extends BaseExportComponent {
|
|||||||
|
|
||||||
protected saved() {
|
protected saved() {
|
||||||
super.saved();
|
super.saved();
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("exportSuccess"));
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("exportSuccess"),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import {
|
|||||||
UsernameGeneratorOptions,
|
UsernameGeneratorOptions,
|
||||||
} from "@bitwarden/common/tools/generator/username";
|
} from "@bitwarden/common/tools/generator/username";
|
||||||
import { EmailForwarderOptions } from "@bitwarden/common/tools/models/domain/email-forwarder-options";
|
import { EmailForwarderOptions } from "@bitwarden/common/tools/models/domain/email-forwarder-options";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class GeneratorComponent implements OnInit, OnDestroy {
|
export class GeneratorComponent implements OnInit, OnDestroy {
|
||||||
@ -67,6 +68,7 @@ export class GeneratorComponent implements OnInit, OnDestroy {
|
|||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected ngZone: NgZone,
|
protected ngZone: NgZone,
|
||||||
private win: Window,
|
private win: Window,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
this.typeOptions = [
|
this.typeOptions = [
|
||||||
{ name: i18nService.t("password"), value: "password" },
|
{ name: i18nService.t("password"), value: "password" },
|
||||||
@ -317,11 +319,14 @@ export class GeneratorComponent implements OnInit, OnDestroy {
|
|||||||
password ? this.password : this.username,
|
password ? this.password : this.username,
|
||||||
copyOptions,
|
copyOptions,
|
||||||
);
|
);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"info",
|
variant: "info",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("valueCopied", this.i18nService.t(password ? "password" : "username")),
|
message: this.i18nService.t(
|
||||||
);
|
"valueCopied",
|
||||||
|
this.i18nService.t(password ? "password" : "username"),
|
||||||
|
),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
GeneratedPasswordHistory,
|
GeneratedPasswordHistory,
|
||||||
PasswordGenerationServiceAbstraction,
|
PasswordGenerationServiceAbstraction,
|
||||||
} from "@bitwarden/common/tools/generator/password";
|
} from "@bitwarden/common/tools/generator/password";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class PasswordGeneratorHistoryComponent implements OnInit {
|
export class PasswordGeneratorHistoryComponent implements OnInit {
|
||||||
@ -16,6 +17,7 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
|
|||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
private win: Window,
|
private win: Window,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -29,10 +31,10 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
|
|||||||
copy(password: string) {
|
copy(password: string) {
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"info",
|
variant: "info",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("valueCopied", this.i18nService.t("password")),
|
message: this.i18nService.t("valueCopied", this.i18nService.t("password")),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import { SendTextView } from "@bitwarden/common/tools/send/models/view/send-text
|
|||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
// Value = hours
|
// Value = hours
|
||||||
enum DatePreset {
|
enum DatePreset {
|
||||||
@ -120,6 +120,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
protected formBuilder: FormBuilder,
|
protected formBuilder: FormBuilder,
|
||||||
protected billingAccountProfileStateService: BillingAccountProfileStateService,
|
protected billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
protected accountService: AccountService,
|
protected accountService: AccountService,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
this.typeOptions = [
|
this.typeOptions = [
|
||||||
{ name: i18nService.t("sendTypeFile"), value: SendType.File, premium: true },
|
{ name: i18nService.t("sendTypeFile"), value: SendType.File, premium: true },
|
||||||
@ -269,11 +270,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
this.formGroup.markAllAsTouched();
|
this.formGroup.markAllAsTouched();
|
||||||
|
|
||||||
if (this.disableSend) {
|
if (this.disableSend) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("sendDisabledWarning"),
|
message: this.i18nService.t("sendDisabledWarning"),
|
||||||
);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,11 +290,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
this.send.type = this.type;
|
this.send.type = this.type;
|
||||||
|
|
||||||
if (Utils.isNullOrWhitespace(this.send.name)) {
|
if (Utils.isNullOrWhitespace(this.send.name)) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("nameRequired"),
|
message: this.i18nService.t("nameRequired"),
|
||||||
);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,22 +303,22 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
const fileEl = document.getElementById("file") as HTMLInputElement;
|
const fileEl = document.getElementById("file") as HTMLInputElement;
|
||||||
const files = fileEl.files;
|
const files = fileEl.files;
|
||||||
if (files == null || files.length === 0) {
|
if (files == null || files.length === 0) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("selectFile"),
|
message: this.i18nService.t("selectFile"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = files[0];
|
file = files[0];
|
||||||
if (files[0].size > 524288000) {
|
if (files[0].size > 524288000) {
|
||||||
// 500 MB
|
// 500 MB
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("maxFileSize"),
|
message: this.i18nService.t("maxFileSize"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,11 +341,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
await this.handleCopyLinkToClipboard();
|
await this.handleCopyLinkToClipboard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t(this.editMode ? "editedSend" : "createdSend"),
|
message: this.i18nService.t(this.editMode ? "editedSend" : "createdSend"),
|
||||||
);
|
});
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
@ -377,7 +378,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
try {
|
try {
|
||||||
this.deletePromise = this.sendApiService.delete(this.send.id);
|
this.deletePromise = this.sendApiService.delete(this.send.id);
|
||||||
await this.deletePromise;
|
await this.deletePromise;
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("deletedSend"));
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("deletedSend"),
|
||||||
|
});
|
||||||
await this.load();
|
await this.load();
|
||||||
this.onDeletedSend.emit(this.send);
|
this.onDeletedSend.emit(this.send);
|
||||||
return true;
|
return true;
|
||||||
@ -470,11 +475,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
private async handleCopyLinkToClipboard() {
|
private async handleCopyLinkToClipboard() {
|
||||||
const copySuccess = await this.copyLinkToClipboard(this.link);
|
const copySuccess = await this.copyLinkToClipboard(this.link);
|
||||||
if (copySuccess ?? true) {
|
if (copySuccess ?? true) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t(this.editMode ? "editedSend" : "createdSend"),
|
message: this.i18nService.t(this.editMode ? "editedSend" : "createdSend"),
|
||||||
);
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.dialogService.openSimpleDialog({
|
await this.dialogService.openSimpleDialog({
|
||||||
title: "",
|
title: "",
|
||||||
|
@ -20,7 +20,7 @@ import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
|||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class SendComponent implements OnInit, OnDestroy {
|
export class SendComponent implements OnInit, OnDestroy {
|
||||||
@ -76,6 +76,7 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
protected sendApiService: SendApiService,
|
protected sendApiService: SendApiService,
|
||||||
protected dialogService: DialogService,
|
protected dialogService: DialogService,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -186,7 +187,11 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||||||
this.onSuccessfulRemovePassword();
|
this.onSuccessfulRemovePassword();
|
||||||
} else {
|
} else {
|
||||||
// Default actions
|
// Default actions
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("removedPassword"));
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("removedPassword"),
|
||||||
|
});
|
||||||
await this.load();
|
await this.load();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -220,7 +225,11 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||||||
this.onSuccessfulDelete();
|
this.onSuccessfulDelete();
|
||||||
} else {
|
} else {
|
||||||
// Default actions
|
// Default actions
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("deletedSend"));
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("deletedSend"),
|
||||||
|
});
|
||||||
await this.refresh();
|
await this.refresh();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -234,11 +243,11 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||||||
const env = await firstValueFrom(this.environmentService.environment$);
|
const env = await firstValueFrom(this.environmentService.environment$);
|
||||||
const link = env.getSendUrl() + s.accessId + "/" + s.urlB64Key;
|
const link = env.getSendUrl() + s.accessId + "/" + s.urlB64Key;
|
||||||
this.platformUtilsService.copyToClipboard(link);
|
this.platformUtilsService.copyToClipboard(link);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("valueCopied", this.i18nService.t("sendLink")),
|
message: this.i18nService.t("valueCopied", this.i18nService.t("sendLink")),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTextChanged() {
|
searchTextChanged() {
|
||||||
|
@ -48,6 +48,7 @@ import {
|
|||||||
IconButtonModule,
|
IconButtonModule,
|
||||||
RadioButtonModule,
|
RadioButtonModule,
|
||||||
SelectModule,
|
SelectModule,
|
||||||
|
ToastService,
|
||||||
} from "@bitwarden/components";
|
} from "@bitwarden/components";
|
||||||
|
|
||||||
import { ImportOption, ImportResult, ImportType } from "../models";
|
import { ImportOption, ImportResult, ImportType } from "../models";
|
||||||
@ -191,6 +192,7 @@ export class ImportComponent implements OnInit, OnDestroy {
|
|||||||
@Inject(ImportCollectionServiceAbstraction)
|
@Inject(ImportCollectionServiceAbstraction)
|
||||||
@Optional()
|
@Optional()
|
||||||
protected importCollectionService: ImportCollectionServiceAbstraction,
|
protected importCollectionService: ImportCollectionServiceAbstraction,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
protected get importBlockedByPolicy(): boolean {
|
protected get importBlockedByPolicy(): boolean {
|
||||||
@ -336,22 +338,22 @@ export class ImportComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (importer === null) {
|
if (importer === null) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("selectFormat"),
|
message: this.i18nService.t("selectFormat"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const importContents = await this.setImportContents();
|
const importContents = await this.setImportContents();
|
||||||
|
|
||||||
if (importContents == null || importContents === "") {
|
if (importContents == null || importContents === "") {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("selectFile"),
|
message: this.i18nService.t("selectFile"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,11 +504,11 @@ export class ImportComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.importBlockedByPolicy && this.organizationId == null) {
|
if (this.importBlockedByPolicy && this.organizationId == null) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("personalOwnershipPolicyInEffectImports"),
|
message: this.i18nService.t("personalOwnershipPolicyInEffectImports"),
|
||||||
);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,14 +519,6 @@ export class ImportComponent implements OnInit, OnDestroy {
|
|||||||
const fileEl = document.getElementById("import_input_file") as HTMLInputElement;
|
const fileEl = document.getElementById("import_input_file") as HTMLInputElement;
|
||||||
const files = fileEl.files;
|
const files = fileEl.files;
|
||||||
let fileContents = this.formGroup.controls.fileContents.value;
|
let fileContents = this.formGroup.controls.fileContents.value;
|
||||||
if ((files == null || files.length === 0) && (fileContents == null || fileContents === "")) {
|
|
||||||
this.platformUtilsService.showToast(
|
|
||||||
"error",
|
|
||||||
this.i18nService.t("errorOccurred"),
|
|
||||||
this.i18nService.t("selectFile"),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (files != null && files.length > 0) {
|
if (files != null && files.length > 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -15,7 +15,6 @@ import { EventType } from "@bitwarden/common/enums";
|
|||||||
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { EncryptedExportType } from "@bitwarden/common/tools/enums/encrypted-export-type.enum";
|
import { EncryptedExportType } from "@bitwarden/common/tools/enums/encrypted-export-type.enum";
|
||||||
import {
|
import {
|
||||||
@ -28,6 +27,7 @@ import {
|
|||||||
IconButtonModule,
|
IconButtonModule,
|
||||||
RadioButtonModule,
|
RadioButtonModule,
|
||||||
SelectModule,
|
SelectModule,
|
||||||
|
ToastService,
|
||||||
} from "@bitwarden/components";
|
} from "@bitwarden/components";
|
||||||
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";
|
import { VaultExportServiceAbstraction } from "@bitwarden/vault-export-core";
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ export class ExportComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected toastService: ToastService,
|
||||||
protected exportService: VaultExportServiceAbstraction,
|
protected exportService: VaultExportServiceAbstraction,
|
||||||
protected eventCollectionService: EventCollectionService,
|
protected eventCollectionService: EventCollectionService,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
@ -222,11 +222,11 @@ export class ExportComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
submit = async () => {
|
submit = async () => {
|
||||||
if (this.isFileEncryptedExport && this.filePassword != this.confirmFilePassword) {
|
if (this.isFileEncryptedExport && this.filePassword != this.confirmFilePassword) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("filePasswordAndConfirmFilePasswordDoNotMatch"),
|
message: this.i18nService.t("filePasswordAndConfirmFilePasswordDoNotMatch"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,11 +236,11 @@ export class ExportComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.disabledByPolicy) {
|
if (this.disabledByPolicy) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("personalVaultExportPolicyInEffect"),
|
message: this.i18nService.t("personalVaultExportPolicyInEffect"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user