mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
[AC-2268] - migrate toast to CL service for admin-console (#10663)
* migrate toast to CL service for admin-console * fix spec * add missing dep for toastService * fix toastService args * fix toastService args * fix toastService args
This commit is contained in:
@@ -14,7 +14,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||
import { TableDataSource, NoItemsModule } from "@bitwarden/components";
|
||||
import { TableDataSource, NoItemsModule, ToastService } from "@bitwarden/components";
|
||||
import { Devices } from "@bitwarden/web-vault/app/admin-console/icons";
|
||||
import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared";
|
||||
import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module";
|
||||
@@ -54,6 +54,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
private logService: LogService,
|
||||
private validationService: ValidationService,
|
||||
private configService: ConfigService,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -84,17 +85,17 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
authRequest,
|
||||
);
|
||||
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("loginRequestApproved"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("loginRequestApproved"),
|
||||
});
|
||||
} catch (error) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("resetPasswordDetailsError"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("resetPasswordDetailsError"),
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -109,18 +110,22 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
this.organizationId,
|
||||
this.tableDataSource.data,
|
||||
);
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("allLoginRequestsApproved"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("allLoginRequestsApproved"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async denyRequest(requestId: string) {
|
||||
await this.performAsyncAction(async () => {
|
||||
await this.organizationAuthRequestService.denyPendingRequests(this.organizationId, requestId);
|
||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("loginRequestDenied"));
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("loginRequestDenied"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -134,11 +139,11 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
this.organizationId,
|
||||
...this.tableDataSource.data.map((r) => r.id),
|
||||
);
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("allLoginRequestsDenied"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("allLoginRequestsDenied"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitw
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { domainNameValidator } from "./validators/domain-name.validator";
|
||||
import { uniqueInArrayValidator } from "./validators/unique-in-array.validator";
|
||||
@@ -66,6 +66,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
private orgDomainService: OrgDomainServiceAbstraction,
|
||||
private validationService: ValidationService,
|
||||
private dialogService: DialogService,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
// Angular Method Implementations
|
||||
@@ -112,7 +113,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
// Creates a new domain record. The DNS TXT Record will be generated server-side and returned in the response.
|
||||
saveDomain = async (): Promise<void> => {
|
||||
if (this.domainForm.invalid) {
|
||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("domainFormInvalid"));
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainFormInvalid"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,7 +131,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
this.data.orgDomain = await this.orgDomainApiService.post(this.data.organizationId, request);
|
||||
// Patch the DNS TXT Record that was generated server-side
|
||||
this.domainForm.controls.txt.patchValue(this.data.orgDomain.txt);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainSaved"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainSaved"),
|
||||
});
|
||||
} catch (e) {
|
||||
this.handleDomainSaveError(e);
|
||||
}
|
||||
@@ -177,7 +186,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
verifyDomain = async (): Promise<void> => {
|
||||
if (this.domainForm.invalid) {
|
||||
// Note: shouldn't be possible, but going to leave this to be safe.
|
||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("domainFormInvalid"));
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainFormInvalid"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -188,7 +201,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
|
||||
if (this.data.orgDomain.verifiedDate) {
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainVerified"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainVerified"),
|
||||
});
|
||||
this.dialogRef.close();
|
||||
} else {
|
||||
this.domainNameCtrl.setErrors({
|
||||
@@ -250,7 +267,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
await this.orgDomainApiService.delete(this.data.organizationId, this.data.orgDomain.id);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainRemoved"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainRemoved"),
|
||||
});
|
||||
|
||||
this.dialogRef.close();
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ErrorResponse } from "@bitwarden/common/models/response/error.response"
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import {
|
||||
DomainAddEditDialogComponent,
|
||||
@@ -37,6 +37,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
private orgDomainService: OrgDomainServiceAbstraction,
|
||||
private dialogService: DialogService,
|
||||
private validationService: ValidationService,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
@@ -110,13 +111,17 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
|
||||
if (orgDomain.verifiedDate) {
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainVerified"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainVerified"),
|
||||
});
|
||||
} else {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("domainNotVerified", domainName),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainNotVerified", domainName),
|
||||
});
|
||||
// Update this item so the last checked date gets updated.
|
||||
await this.updateOrgDomain(orgDomainId);
|
||||
}
|
||||
@@ -138,11 +143,11 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
switch (errorResponse.statusCode) {
|
||||
case HttpStatusCode.Conflict:
|
||||
if (errorResponse.message.includes("The domain is not available to be claimed")) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("domainNotAvailable", domainName),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainNotAvailable", domainName),
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -166,7 +171,11 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
|
||||
await this.orgDomainApiService.delete(this.organizationId, orgDomainId);
|
||||
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("domainRemoved"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("domainRemoved"),
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { OrganizationConnectionResponse } from "@bitwarden/common/admin-console/
|
||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||
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";
|
||||
|
||||
@Component({
|
||||
selector: "app-org-manage-scim",
|
||||
@@ -46,6 +46,7 @@ export class ScimComponent implements OnInit {
|
||||
private environmentService: EnvironmentService,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private dialogService: DialogService,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -104,7 +105,11 @@ export class ScimComponent implements OnInit {
|
||||
endpointUrl: await this.getScimEndpointUrl(),
|
||||
clientSecret: response.apiKey,
|
||||
});
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("scimApiKeyRotated"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("scimApiKeyRotated"),
|
||||
});
|
||||
};
|
||||
|
||||
copyScimKey = async () => {
|
||||
@@ -131,7 +136,11 @@ export class ScimComponent implements OnInit {
|
||||
}
|
||||
|
||||
await this.setConnectionFormValues(response);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("scimSettingsSaved"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("scimSettingsSaved"),
|
||||
});
|
||||
};
|
||||
|
||||
async getScimEndpointUrl() {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Provider } from "@bitwarden/common/admin-console/models/domain/provider
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
import { WebProviderService } from "../services/web-provider.service";
|
||||
|
||||
@@ -32,6 +32,7 @@ export class AddOrganizationComponent implements OnInit {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private validationService: ValidationService,
|
||||
private dialogService: DialogService,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -73,11 +74,11 @@ export class AddOrganizationComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("organizationJoinedProvider"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("organizationJoinedProvider"),
|
||||
});
|
||||
|
||||
this.dialogRef.close(true);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ProviderService } from "@bitwarden/common/admin-console/abstractions/pr
|
||||
import { ProviderUserType } from "@bitwarden/common/admin-console/enums";
|
||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ToastService } from "@bitwarden/components";
|
||||
|
||||
import { providerPermissionsGuard } from "./provider-permissions.guard";
|
||||
|
||||
@@ -39,7 +39,7 @@ describe("Provider Permissions Guard", () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: ProviderService, useValue: providerService },
|
||||
{ provide: PlatformUtilsService, useValue: mock<PlatformUtilsService>() },
|
||||
{ provide: ToastService, useValue: mock<ToastService>() },
|
||||
{ provide: I18nService, useValue: mock<I18nService>() },
|
||||
{ provide: Router, useValue: mock<Router>() },
|
||||
],
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service";
|
||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ToastService } from "@bitwarden/components";
|
||||
|
||||
/**
|
||||
* `CanActivateFn` that asserts the logged in user has permission to access
|
||||
@@ -36,8 +36,8 @@ export function providerPermissionsGuard(
|
||||
return async (route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {
|
||||
const providerService = inject(ProviderService);
|
||||
const router = inject(Router);
|
||||
const platformUtilsService = inject(PlatformUtilsService);
|
||||
const i18nService = inject(I18nService);
|
||||
const toastService = inject(ToastService);
|
||||
|
||||
const provider = await providerService.get(route.params.providerId);
|
||||
if (provider == null) {
|
||||
@@ -45,14 +45,22 @@ export function providerPermissionsGuard(
|
||||
}
|
||||
|
||||
if (!provider.isProviderAdmin && !provider.enabled) {
|
||||
platformUtilsService.showToast("error", null, i18nService.t("providerIsDisabled"));
|
||||
toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: i18nService.t("providerIsDisabled"),
|
||||
});
|
||||
return router.createUrlTree(["/"]);
|
||||
}
|
||||
|
||||
const hasSpecifiedPermissions = permissionsCallback == null || permissionsCallback(provider);
|
||||
|
||||
if (!hasSpecifiedPermissions) {
|
||||
platformUtilsService.showToast("error", null, i18nService.t("accessDenied"));
|
||||
toastService.showToast({
|
||||
variant: "error",
|
||||
title: null,
|
||||
message: i18nService.t("accessDenied"),
|
||||
});
|
||||
return router.createUrlTree(["/providers", provider.id]);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil
|
||||
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 { ToastService } from "@bitwarden/components";
|
||||
import { BaseEventsComponent } from "@bitwarden/web-vault/app/admin-console/common/base.events.component";
|
||||
import { EventService } from "@bitwarden/web-vault/app/core";
|
||||
import { EventExportService } from "@bitwarden/web-vault/app/tools/event-export";
|
||||
@@ -37,6 +38,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
||||
logService: LogService,
|
||||
private userNamePipe: UserNamePipe,
|
||||
fileDownloadService: FileDownloadService,
|
||||
toastService: ToastService,
|
||||
) {
|
||||
super(
|
||||
eventService,
|
||||
@@ -45,6 +47,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
||||
platformUtilsService,
|
||||
logService,
|
||||
fileDownloadService,
|
||||
toastService,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
import { BasePeopleComponent } from "@bitwarden/web-vault/app/admin-console/common/base.people.component";
|
||||
import { openEntityEventsDialog } from "@bitwarden/web-vault/app/admin-console/organizations/manage/entity-events.component";
|
||||
import { BulkStatusComponent } from "@bitwarden/web-vault/app/admin-console/organizations/members/components/bulk/bulk-status.component";
|
||||
@@ -75,6 +75,7 @@ export class PeopleComponent
|
||||
dialogService: DialogService,
|
||||
organizationManagementPreferencesService: OrganizationManagementPreferencesService,
|
||||
private configService: ConfigService,
|
||||
protected toastService: ToastService,
|
||||
) {
|
||||
super(
|
||||
apiService,
|
||||
@@ -89,6 +90,7 @@ export class PeopleComponent
|
||||
userNamePipe,
|
||||
dialogService,
|
||||
organizationManagementPreferencesService,
|
||||
toastService,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -213,11 +215,11 @@ export class PeopleComponent
|
||||
const filteredUsers = users.filter((u) => u.status === ProviderUserStatusType.Invited);
|
||||
|
||||
if (filteredUsers.length <= 0) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("noSelectedUsersApplicable"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: this.i18nService.t("errorOccurred"),
|
||||
message: this.i18nService.t("noSelectedUsersApplicable"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ProviderUserUpdateRequest } from "@bitwarden/common/admin-console/model
|
||||
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 { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
/**
|
||||
* @deprecated Please use the {@link MembersDialogComponent} instead.
|
||||
@@ -42,6 +42,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private logService: LogService,
|
||||
private dialogService: DialogService,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -80,11 +81,11 @@ export class UserAddEditComponent implements OnInit {
|
||||
this.formPromise = this.apiService.postProviderUserInvite(this.providerId, request);
|
||||
}
|
||||
await this.formPromise;
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name),
|
||||
});
|
||||
this.savedUser.emit();
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
@@ -109,11 +110,11 @@ export class UserAddEditComponent implements OnInit {
|
||||
try {
|
||||
this.deletePromise = this.apiService.deleteProviderUser(this.providerId, this.providerUserId);
|
||||
await this.deletePromise;
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("removedUserId", this.name),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("removedUserId", this.name),
|
||||
});
|
||||
this.deletedUser.emit();
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
import { DialogService, ToastService } from "@bitwarden/components";
|
||||
|
||||
@Component({
|
||||
selector: "provider-account",
|
||||
@@ -49,6 +49,7 @@ export class AccountComponent implements OnDestroy, OnInit {
|
||||
private providerApiService: ProviderApiServiceAbstraction,
|
||||
private formBuilder: FormBuilder,
|
||||
private router: Router,
|
||||
private toastService: ToastService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -86,7 +87,11 @@ export class AccountComponent implements OnDestroy, OnInit {
|
||||
await this.providerApiService.putProvider(this.providerId, request);
|
||||
await this.syncService.fullSync(true);
|
||||
this.provider = await this.providerApiService.getProvider(this.providerId);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("providerUpdated"));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t("providerUpdated"),
|
||||
});
|
||||
};
|
||||
|
||||
async deleteProvider() {
|
||||
@@ -110,11 +115,11 @@ export class AccountComponent implements OnDestroy, OnInit {
|
||||
|
||||
try {
|
||||
await this.providerApiService.deleteProvider(this.providerId);
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
this.i18nService.t("providerDeleted"),
|
||||
this.i18nService.t("providerDeletedDesc"),
|
||||
);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: this.i18nService.t("providerDeleted"),
|
||||
message: this.i18nService.t("providerDeletedDesc"),
|
||||
});
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil
|
||||
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 { ToastService } from "@bitwarden/components";
|
||||
import { BaseEventsComponent } from "@bitwarden/web-vault/app/admin-console/common/base.events.component";
|
||||
import { EventService } from "@bitwarden/web-vault/app/core";
|
||||
import { EventExportService } from "@bitwarden/web-vault/app/tools/event-export";
|
||||
@@ -33,6 +34,7 @@ export class ServiceAccountEventsComponent
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
logService: LogService,
|
||||
fileDownloadService: FileDownloadService,
|
||||
toastService: ToastService,
|
||||
) {
|
||||
super(
|
||||
eventService,
|
||||
@@ -41,6 +43,7 @@ export class ServiceAccountEventsComponent
|
||||
platformUtilsService,
|
||||
logService,
|
||||
fileDownloadService,
|
||||
toastService,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user