mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +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:
@@ -12,6 +12,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 { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-collections",
|
selector: "app-vault-collections",
|
||||||
@@ -30,6 +31,7 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
configService: ConfigService,
|
configService: ConfigService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
collectionService,
|
collectionService,
|
||||||
@@ -40,6 +42,7 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On
|
|||||||
logService,
|
logService,
|
||||||
configService,
|
configService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,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 { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-collections",
|
selector: "app-vault-collections",
|
||||||
@@ -24,6 +25,7 @@ export class CollectionsComponent extends BaseCollectionsComponent {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
configService: ConfigService,
|
configService: ConfigService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
collectionService,
|
collectionService,
|
||||||
@@ -34,6 +36,7 @@ export class CollectionsComponent extends BaseCollectionsComponent {
|
|||||||
logService,
|
logService,
|
||||||
configService,
|
configService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { EventService } from "../../core";
|
import { EventService } from "../../core";
|
||||||
import { EventExportService } from "../../tools/event-export";
|
import { EventExportService } from "../../tools/event-export";
|
||||||
@@ -34,6 +35,7 @@ export abstract class BaseEventsComponent {
|
|||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected logService: LogService,
|
protected logService: LogService,
|
||||||
protected fileDownloadService: FileDownloadService,
|
protected fileDownloadService: FileDownloadService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
const defaultDates = this.eventService.getDefaultDateFilters();
|
const defaultDates = this.eventService.getDefaultDateFilters();
|
||||||
this.start = defaultDates[0];
|
this.start = defaultDates[0];
|
||||||
@@ -164,11 +166,11 @@ export abstract class BaseEventsComponent {
|
|||||||
try {
|
try {
|
||||||
dates = this.eventService.formatDateFilters(this.start, this.end);
|
dates = this.eventService.formatDateFilters(this.start, this.end);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("invalidDateRange"),
|
message: this.i18nService.t("invalidDateRange"),
|
||||||
);
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return dates;
|
return dates;
|
||||||
|
|||||||
@@ -22,7 +22,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 { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { OrganizationUserView } from "../organizations/core/views/organization-user.view";
|
import { OrganizationUserView } from "../organizations/core/views/organization-user.view";
|
||||||
import { UserConfirmComponent } from "../organizations/manage/user-confirm.component";
|
import { UserConfirmComponent } from "../organizations/manage/user-confirm.component";
|
||||||
@@ -127,6 +127,7 @@ export abstract class BasePeopleComponent<
|
|||||||
protected userNamePipe: UserNamePipe,
|
protected userNamePipe: UserNamePipe,
|
||||||
protected dialogService: DialogService,
|
protected dialogService: DialogService,
|
||||||
protected organizationManagementPreferencesService: OrganizationManagementPreferencesService,
|
protected organizationManagementPreferencesService: OrganizationManagementPreferencesService,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
abstract edit(user: UserType): void;
|
abstract edit(user: UserType): void;
|
||||||
@@ -251,11 +252,11 @@ export abstract class BasePeopleComponent<
|
|||||||
this.actionPromise = this.deleteUser(user.id);
|
this.actionPromise = this.deleteUser(user.id);
|
||||||
try {
|
try {
|
||||||
await this.actionPromise;
|
await this.actionPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("removedUserId", this.userNamePipe.transform(user)),
|
message: this.i18nService.t("removedUserId", this.userNamePipe.transform(user)),
|
||||||
);
|
});
|
||||||
this.removeUser(user);
|
this.removeUser(user);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
@@ -282,11 +283,11 @@ export abstract class BasePeopleComponent<
|
|||||||
this.actionPromise = this.revokeUser(user.id);
|
this.actionPromise = this.revokeUser(user.id);
|
||||||
try {
|
try {
|
||||||
await this.actionPromise;
|
await this.actionPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("revokedUserId", this.userNamePipe.transform(user)),
|
message: this.i18nService.t("revokedUserId", this.userNamePipe.transform(user)),
|
||||||
);
|
});
|
||||||
await this.load();
|
await this.load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
@@ -298,11 +299,11 @@ export abstract class BasePeopleComponent<
|
|||||||
this.actionPromise = this.restoreUser(user.id);
|
this.actionPromise = this.restoreUser(user.id);
|
||||||
try {
|
try {
|
||||||
await this.actionPromise;
|
await this.actionPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("restoredUserId", this.userNamePipe.transform(user)),
|
message: this.i18nService.t("restoredUserId", this.userNamePipe.transform(user)),
|
||||||
);
|
});
|
||||||
await this.load();
|
await this.load();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
@@ -318,11 +319,11 @@ export abstract class BasePeopleComponent<
|
|||||||
this.actionPromise = this.reinviteUser(user.id);
|
this.actionPromise = this.reinviteUser(user.id);
|
||||||
try {
|
try {
|
||||||
await this.actionPromise;
|
await this.actionPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("hasBeenReinvited", this.userNamePipe.transform(user)),
|
message: this.i18nService.t("hasBeenReinvited", this.userNamePipe.transform(user)),
|
||||||
);
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
}
|
}
|
||||||
@@ -344,11 +345,11 @@ export abstract class BasePeopleComponent<
|
|||||||
this.actionPromise = this.confirmUser(user, publicKey);
|
this.actionPromise = this.confirmUser(user, publicKey);
|
||||||
await this.actionPromise;
|
await this.actionPromise;
|
||||||
updateUser(this);
|
updateUser(this);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("hasBeenConfirmed", this.userNamePipe.transform(user)),
|
message: this.i18nService.t("hasBeenConfirmed", this.userNamePipe.transform(user)),
|
||||||
);
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||||
import { DialogService, TableDataSource } from "@bitwarden/components";
|
import { DialogService, TableDataSource, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { EventService } from "../../../core";
|
import { EventService } from "../../../core";
|
||||||
import { SharedModule } from "../../../shared";
|
import { SharedModule } from "../../../shared";
|
||||||
@@ -63,6 +63,7 @@ export class EntityEventsComponent implements OnInit {
|
|||||||
private organizationUserService: OrganizationUserService,
|
private organizationUserService: OrganizationUserService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -109,11 +110,11 @@ export class EntityEventsComponent implements OnInit {
|
|||||||
this.filterFormGroup.value.end,
|
this.filterFormGroup.value.end,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("invalidDateRange"),
|
message: this.i18nService.t("invalidDateRange"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { FileDownloadService } from "@bitwarden/common/platform/abstractions/fil
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { EventService } from "../../../core";
|
import { EventService } from "../../../core";
|
||||||
import { EventExportService } from "../../../tools/event-export";
|
import { EventExportService } from "../../../tools/event-export";
|
||||||
@@ -51,6 +52,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
|
|||||||
private organizationUserService: OrganizationUserService,
|
private organizationUserService: OrganizationUserService,
|
||||||
private providerService: ProviderService,
|
private providerService: ProviderService,
|
||||||
fileDownloadService: FileDownloadService,
|
fileDownloadService: FileDownloadService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
eventService,
|
eventService,
|
||||||
@@ -59,6 +61,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
|
|||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
logService,
|
logService,
|
||||||
fileDownloadService,
|
fileDownloadService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { UserId } from "@bitwarden/common/types/guid";
|
import { UserId } from "@bitwarden/common/types/guid";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { CollectionAdminService } from "../../../vault/core/collection-admin.service";
|
import { CollectionAdminService } from "../../../vault/core/collection-admin.service";
|
||||||
import { CollectionAdminView } from "../../../vault/core/views/collection-admin.view";
|
import { CollectionAdminView } from "../../../vault/core/views/collection-admin.view";
|
||||||
@@ -213,6 +213,7 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
|||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private collectionAdminService: CollectionAdminService,
|
private collectionAdminService: CollectionAdminService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
this.tabIndex = params.initialTab ?? GroupAddEditTabType.Info;
|
this.tabIndex = params.initialTab ?? GroupAddEditTabType.Info;
|
||||||
}
|
}
|
||||||
@@ -280,11 +281,14 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (this.groupForm.invalid) {
|
if (this.groupForm.invalid) {
|
||||||
if (this.tabIndex !== GroupAddEditTabType.Info) {
|
if (this.tabIndex !== GroupAddEditTabType.Info) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("groupInfo")),
|
message: this.i18nService.t(
|
||||||
);
|
"fieldOnTabRequiresAttention",
|
||||||
|
this.i18nService.t("groupInfo"),
|
||||||
|
),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -300,11 +304,14 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
await this.groupService.save(groupView);
|
await this.groupService.save(groupView);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t(this.editMode ? "editedGroupId" : "createdGroupId", formValue.name),
|
message: this.i18nService.t(
|
||||||
);
|
this.editMode ? "editedGroupId" : "createdGroupId",
|
||||||
|
formValue.name,
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
this.dialogRef.close(GroupAddEditDialogResultType.Saved);
|
this.dialogRef.close(GroupAddEditDialogResultType.Saved);
|
||||||
};
|
};
|
||||||
@@ -325,11 +332,11 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
await this.groupService.delete(this.organizationId, this.groupId);
|
await this.groupService.delete(this.organizationId, this.groupId);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("deletedGroupId", this.group.name),
|
message: this.i18nService.t("deletedGroupId", this.group.name),
|
||||||
);
|
});
|
||||||
this.dialogRef.close(GroupAddEditDialogResultType.Deleted);
|
this.dialogRef.close(GroupAddEditDialogResultType.Deleted);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-conso
|
|||||||
import { OrganizationVerifyDeleteRecoverRequest } from "@bitwarden/common/admin-console/models/request/organization-verify-delete-recover.request";
|
import { OrganizationVerifyDeleteRecoverRequest } from "@bitwarden/common/admin-console/models/request/organization-verify-delete-recover.request";
|
||||||
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 { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SharedModule } from "../../../shared/shared.module";
|
import { SharedModule } from "../../../shared/shared.module";
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ export class VerifyRecoverDeleteOrgComponent implements OnInit {
|
|||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -44,11 +46,11 @@ export class VerifyRecoverDeleteOrgComponent implements OnInit {
|
|||||||
submit = async () => {
|
submit = async () => {
|
||||||
const request = new OrganizationVerifyDeleteRecoverRequest(this.token);
|
const request = new OrganizationVerifyDeleteRecoverRequest(this.token);
|
||||||
await this.apiService.deleteUsingToken(this.orgId, request);
|
await this.apiService.deleteUsingToken(this.orgId, request);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
this.i18nService.t("organizationDeleted"),
|
title: this.i18nService.t("organizationDeleted"),
|
||||||
this.i18nService.t("organizationDeletedDesc"),
|
message: this.i18nService.t("organizationDeletedDesc"),
|
||||||
);
|
});
|
||||||
await this.router.navigate(["/"]);
|
await this.router.navigate(["/"]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Component, Inject, OnInit } from "@angular/core";
|
|||||||
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
|
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { DialogService, TableDataSource } from "@bitwarden/components";
|
import { DialogService, TableDataSource, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { OrganizationUserView } from "../../../core";
|
import { OrganizationUserView } from "../../../core";
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ export class BulkEnableSecretsManagerDialogComponent implements OnInit {
|
|||||||
private organizationUserService: OrganizationUserService,
|
private organizationUserService: OrganizationUserService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@@ -35,11 +36,11 @@ export class BulkEnableSecretsManagerDialogComponent implements OnInit {
|
|||||||
this.data.orgId,
|
this.data.orgId,
|
||||||
this.dataSource.data.map((u) => u.id),
|
this.dataSource.data.map((u) => u.id),
|
||||||
);
|
);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("activatedAccessToSecretsManager"),
|
message: this.i18nService.t("activatedAccessToSecretsManager"),
|
||||||
);
|
});
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { ProductTierType } from "@bitwarden/common/billing/enums";
|
|||||||
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 { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { CollectionAdminService } from "../../../../../vault/core/collection-admin.service";
|
import { CollectionAdminService } from "../../../../../vault/core/collection-admin.service";
|
||||||
import { CollectionAdminView } from "../../../../../vault/core/views/collection-admin.view";
|
import { CollectionAdminView } from "../../../../../vault/core/views/collection-admin.view";
|
||||||
@@ -143,6 +143,7 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
organizationService: OrganizationService,
|
organizationService: OrganizationService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
this.organization$ = organizationService
|
this.organization$ = organizationService
|
||||||
.get$(this.params.organizationId)
|
.get$(this.params.organizationId)
|
||||||
@@ -376,11 +377,11 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
) {
|
) {
|
||||||
this.permissionsGroup.value.manageUsers = true;
|
this.permissionsGroup.value.manageUsers = true;
|
||||||
(document.getElementById("manageUsers") as HTMLInputElement).checked = true;
|
(document.getElementById("manageUsers") as HTMLInputElement).checked = true;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"info",
|
variant: "info",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("accountRecoveryManageUsers"),
|
message: this.i18nService.t("accountRecoveryManageUsers"),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,11 +390,11 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
|
|
||||||
if (this.formGroup.invalid) {
|
if (this.formGroup.invalid) {
|
||||||
if (this.tabIndex !== MemberDialogTab.Role) {
|
if (this.tabIndex !== MemberDialogTab.Role) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("role")),
|
message: this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("role")),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -401,11 +402,11 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
const organization = await firstValueFrom(this.organization$);
|
const organization = await firstValueFrom(this.organization$);
|
||||||
|
|
||||||
if (!organization.useCustomPermissions && this.customUserTypeSelected) {
|
if (!organization.useCustomPermissions && this.customUserTypeSelected) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("customNonEnterpriseError"),
|
message: this.i18nService.t("customNonEnterpriseError"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,11 +453,14 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
await this.userService.invite(emails, userView);
|
await this.userService.invite(emails, userView);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.params.name),
|
message: this.i18nService.t(
|
||||||
);
|
this.editMode ? "editedUserId" : "invitedUsers",
|
||||||
|
this.params.name,
|
||||||
|
),
|
||||||
|
});
|
||||||
this.close(MemberDialogResult.Saved);
|
this.close(MemberDialogResult.Saved);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -492,11 +496,11 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
this.params.organizationUserId,
|
this.params.organizationUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("removedUserId", this.params.name),
|
message: this.i18nService.t("removedUserId", this.params.name),
|
||||||
);
|
});
|
||||||
this.close(MemberDialogResult.Deleted);
|
this.close(MemberDialogResult.Deleted);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -529,11 +533,11 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
this.params.organizationUserId,
|
this.params.organizationUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("revokedUserId", this.params.name),
|
message: this.i18nService.t("revokedUserId", this.params.name),
|
||||||
);
|
});
|
||||||
this.isRevoked = true;
|
this.isRevoked = true;
|
||||||
this.close(MemberDialogResult.Revoked);
|
this.close(MemberDialogResult.Revoked);
|
||||||
};
|
};
|
||||||
@@ -548,11 +552,11 @@ export class MemberDialogComponent implements OnDestroy {
|
|||||||
this.params.organizationUserId,
|
this.params.organizationUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("restoredUserId", this.params.name),
|
message: this.i18nService.t("restoredUserId", this.params.name),
|
||||||
);
|
});
|
||||||
this.isRevoked = false;
|
this.isRevoked = false;
|
||||||
this.close(MemberDialogResult.Restored);
|
this.close(MemberDialogResult.Restored);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
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 { 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 { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
|
||||||
|
|
||||||
import { OrganizationUserResetPasswordService } from "../services/organization-user-reset-password/organization-user-reset-password.service";
|
import { OrganizationUserResetPasswordService } from "../services/organization-user-reset-password/organization-user-reset-password.service";
|
||||||
@@ -50,6 +50,7 @@ export class ResetPasswordComponent implements OnInit, OnDestroy {
|
|||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -88,30 +89,30 @@ export class ResetPasswordComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.copyToClipboard(value, { window: window });
|
this.platformUtilsService.copyToClipboard(value, { window: window });
|
||||||
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")),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
// Validation
|
// Validation
|
||||||
if (this.newPassword == null || this.newPassword === "") {
|
if (this.newPassword == null || this.newPassword === "") {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("masterPasswordRequired"),
|
message: this.i18nService.t("masterPasswordRequired"),
|
||||||
);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.newPassword.length < Utils.minimumPasswordLength) {
|
if (this.newPassword.length < Utils.minimumPasswordLength) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("masterPasswordMinlength", Utils.minimumPasswordLength),
|
message: this.i18nService.t("masterPasswordMinlength", Utils.minimumPasswordLength),
|
||||||
);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,11 +124,11 @@ export class ResetPasswordComponent implements OnInit, OnDestroy {
|
|||||||
this.enforcedPolicyOptions,
|
this.enforcedPolicyOptions,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("masterPasswordPolicyRequirementsNotMet"),
|
message: this.i18nService.t("masterPasswordPolicyRequirementsNotMet"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,11 +152,11 @@ export class ResetPasswordComponent implements OnInit, OnDestroy {
|
|||||||
this.organizationId,
|
this.organizationId,
|
||||||
);
|
);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("resetPasswordSuccess"),
|
message: this.i18nService.t("resetPasswordSuccess"),
|
||||||
);
|
});
|
||||||
this.passwordReset.emit();
|
this.passwordReset.emit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { PolicyRequest } from "@bitwarden/common/admin-console/models/request/po
|
|||||||
import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response";
|
import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response";
|
||||||
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 { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { BasePolicy, BasePolicyComponent } from "../policies";
|
import { BasePolicy, BasePolicyComponent } from "../policies";
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ export class PolicyEditComponent implements AfterViewInit {
|
|||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private dialogRef: DialogRef<PolicyEditDialogResult>,
|
private dialogRef: DialogRef<PolicyEditDialogResult>,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
get policy(): BasePolicy {
|
get policy(): BasePolicy {
|
||||||
return this.data.policy;
|
return this.data.policy;
|
||||||
@@ -95,7 +96,7 @@ export class PolicyEditComponent implements AfterViewInit {
|
|||||||
try {
|
try {
|
||||||
request = await this.policyComponent.buildRequest(this.data.policiesEnabledMap);
|
request = await this.policyComponent.buildRequest(this.data.policiesEnabledMap);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast("error", null, e.message);
|
this.toastService.showToast({ variant: "error", title: null, message: e.message });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.formPromise = this.policyApiService.putPolicy(
|
this.formPromise = this.policyApiService.putPolicy(
|
||||||
@@ -104,11 +105,11 @@ export class PolicyEditComponent implements AfterViewInit {
|
|||||||
request,
|
request,
|
||||||
);
|
);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("editedPolicyId", this.i18nService.t(this.data.policy.name)),
|
message: this.i18nService.t("editedPolicyId", this.i18nService.t(this.data.policy.name)),
|
||||||
);
|
});
|
||||||
this.dialogRef.close(PolicyEditDialogResult.Saved);
|
this.dialogRef.close(PolicyEditDialogResult.Saved);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.se
|
|||||||
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 { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { ApiKeyComponent } from "../../../auth/settings/security/api-key.component";
|
import { ApiKeyComponent } from "../../../auth/settings/security/api-key.component";
|
||||||
import { PurgeVaultComponent } from "../../../vault/settings/purge-vault.component";
|
import { PurgeVaultComponent } from "../../../vault/settings/purge-vault.component";
|
||||||
@@ -77,6 +77,7 @@ export class AccountComponent implements OnInit, OnDestroy {
|
|||||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -167,7 +168,11 @@ export class AccountComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
await this.organizationApiService.save(this.organizationId, request);
|
await this.organizationApiService.save(this.organizationId, request);
|
||||||
|
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("organizationUpdated"));
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("organizationUpdated"),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
submitCollectionManagement = async () => {
|
submitCollectionManagement = async () => {
|
||||||
@@ -184,11 +189,11 @@ export class AccountComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
await this.organizationApiService.updateCollectionManagement(this.organizationId, request);
|
await this.organizationApiService.updateCollectionManagement(this.organizationId, request);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("updatedCollectionManagement"),
|
message: this.i18nService.t("updatedCollectionManagement"),
|
||||||
);
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
async deleteOrganization() {
|
async deleteOrganization() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { Utils } from "@bitwarden/common/platform/misc/utils";
|
|||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { UserVerificationModule } from "../../../../auth/shared/components/user-verification";
|
import { UserVerificationModule } from "../../../../auth/shared/components/user-verification";
|
||||||
import { SharedModule } from "../../../../shared/shared.module";
|
import { SharedModule } from "../../../../shared/shared.module";
|
||||||
@@ -94,6 +94,7 @@ export class DeleteOrganizationDialogComponent implements OnInit, OnDestroy {
|
|||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
@@ -121,11 +122,11 @@ export class DeleteOrganizationDialogComponent implements OnInit, OnDestroy {
|
|||||||
.buildRequest(this.formGroup.value.secret)
|
.buildRequest(this.formGroup.value.secret)
|
||||||
.then((request) => this.organizationApiService.delete(this.organization.id, request));
|
.then((request) => this.organizationApiService.delete(this.organization.id, request));
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
this.i18nService.t("organizationDeleted"),
|
title: this.i18nService.t("organizationDeleted"),
|
||||||
this.i18nService.t("organizationDeletedDesc"),
|
message: this.i18nService.t("organizationDeletedDesc"),
|
||||||
);
|
});
|
||||||
this.dialogRef.close(DeleteOrganizationDialogResult.Deleted);
|
this.dialogRef.close(DeleteOrganizationDialogResult.Deleted);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||||
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 { OrganizationPlansComponent } from "../../../billing";
|
import { OrganizationPlansComponent } from "../../../billing";
|
||||||
import { SharedModule } from "../../../shared";
|
import { SharedModule } from "../../../shared";
|
||||||
@@ -68,6 +68,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
|
|||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -76,12 +77,12 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
|
|||||||
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
|
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
|
||||||
const error = qParams.token == null;
|
const error = qParams.token == null;
|
||||||
if (error) {
|
if (error) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("sponsoredFamiliesAcceptFailed"),
|
message: this.i18nService.t("sponsoredFamiliesAcceptFailed"),
|
||||||
{ timeout: 10000 },
|
timeout: 10000,
|
||||||
);
|
});
|
||||||
// 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
|
||||||
this.router.navigate(["/"]);
|
this.router.navigate(["/"]);
|
||||||
@@ -139,11 +140,11 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy {
|
|||||||
request.sponsoredOrganizationId = organizationId;
|
request.sponsoredOrganizationId = organizationId;
|
||||||
|
|
||||||
await this.apiService.postRedeemSponsorship(this.token, request);
|
await this.apiService.postRedeemSponsorship(this.token, request);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("sponsoredFamiliesOfferRedeemed"),
|
message: this.i18nService.t("sponsoredFamiliesOfferRedeemed"),
|
||||||
);
|
});
|
||||||
await this.syncService.fullSync(true);
|
await this.syncService.fullSync(true);
|
||||||
|
|
||||||
// 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.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
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 { OrganizationUserResetPasswordService } from "../members/services/organization-user-reset-password/organization-user-reset-password.service";
|
import { OrganizationUserResetPasswordService } from "../members/services/organization-user-reset-password/organization-user-reset-password.service";
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ export class EnrollMasterPasswordReset {
|
|||||||
syncService: SyncService,
|
syncService: SyncService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
userVerificationService: UserVerificationService,
|
userVerificationService: UserVerificationService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
const result = await UserVerificationDialogComponent.open(dialogService, {
|
const result = await UserVerificationDialogComponent.open(dialogService, {
|
||||||
title: "enrollAccountRecovery",
|
title: "enrollAccountRecovery",
|
||||||
@@ -71,7 +72,11 @@ export class EnrollMasterPasswordReset {
|
|||||||
|
|
||||||
// Enrollment succeeded
|
// Enrollment succeeded
|
||||||
try {
|
try {
|
||||||
platformUtilsService.showToast("success", null, i18nService.t("enrollPasswordResetSuccess"));
|
toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: i18nService.t("enrollPasswordResetSuccess"),
|
||||||
|
});
|
||||||
await syncService.fullSync(true);
|
await syncService.fullSync(true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logService.error(e);
|
logService.error(e);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { ProviderVerifyRecoverDeleteRequest } from "@bitwarden/common/admin-cons
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-verify-recover-delete-provider",
|
selector: "app-verify-recover-delete-provider",
|
||||||
@@ -27,6 +28,7 @@ export class VerifyRecoverDeleteProviderComponent implements OnInit {
|
|||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -48,11 +50,11 @@ export class VerifyRecoverDeleteProviderComponent implements OnInit {
|
|||||||
request,
|
request,
|
||||||
);
|
);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
this.i18nService.t("providerDeleted"),
|
title: this.i18nService.t("providerDeleted"),
|
||||||
this.i18nService.t("providerDeletedDesc"),
|
message: this.i18nService.t("providerDeletedDesc"),
|
||||||
);
|
});
|
||||||
await this.router.navigate(["/"]);
|
await this.router.navigate(["/"]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
|
||||||
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-collections",
|
selector: "app-vault-collections",
|
||||||
@@ -29,6 +29,7 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On
|
|||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
protected dialogRef: DialogRef,
|
protected dialogRef: DialogRef,
|
||||||
@Inject(DIALOG_DATA) params: CollectionsDialogParams,
|
@Inject(DIALOG_DATA) params: CollectionsDialogParams,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
collectionService,
|
collectionService,
|
||||||
@@ -39,6 +40,7 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On
|
|||||||
logService,
|
logService,
|
||||||
configService,
|
configService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
this.cipherId = params?.cipherId;
|
this.cipherId = params?.cipherId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { OrganizationUserResetPasswordService } from "../../../../admin-console/organizations/members/services/organization-user-reset-password/organization-user-reset-password.service";
|
import { OrganizationUserResetPasswordService } from "../../../../admin-console/organizations/members/services/organization-user-reset-password/organization-user-reset-password.service";
|
||||||
import { EnrollMasterPasswordReset } from "../../../../admin-console/organizations/users/enroll-master-password-reset.component";
|
import { EnrollMasterPasswordReset } from "../../../../admin-console/organizations/users/enroll-master-password-reset.component";
|
||||||
@@ -50,6 +50,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
|||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private resetPasswordService: OrganizationUserResetPasswordService,
|
private resetPasswordService: OrganizationUserResetPasswordService,
|
||||||
private userVerificationService: UserVerificationService,
|
private userVerificationService: UserVerificationService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -158,6 +159,7 @@ export class OrganizationOptionsComponent implements OnInit, OnDestroy {
|
|||||||
this.syncService,
|
this.syncService,
|
||||||
this.logService,
|
this.logService,
|
||||||
this.userVerificationService,
|
this.userVerificationService,
|
||||||
|
this.toastService,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Remove reset password
|
// Remove reset password
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data";
|
|||||||
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
||||||
import { CipherCollectionsRequest } from "@bitwarden/common/vault/models/request/cipher-collections.request";
|
import { CipherCollectionsRequest } from "@bitwarden/common/vault/models/request/cipher-collections.request";
|
||||||
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CollectionsComponent as BaseCollectionsComponent,
|
CollectionsComponent as BaseCollectionsComponent,
|
||||||
@@ -41,6 +41,7 @@ export class CollectionsComponent extends BaseCollectionsComponent {
|
|||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
protected dialogRef: DialogRef,
|
protected dialogRef: DialogRef,
|
||||||
@Inject(DIALOG_DATA) params: OrgVaultCollectionsDialogParams,
|
@Inject(DIALOG_DATA) params: OrgVaultCollectionsDialogParams,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
collectionService,
|
collectionService,
|
||||||
@@ -53,6 +54,7 @@ export class CollectionsComponent extends BaseCollectionsComponent {
|
|||||||
accountService,
|
accountService,
|
||||||
dialogRef,
|
dialogRef,
|
||||||
params,
|
params,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
this.allowSelectNone = true;
|
this.allowSelectNone = true;
|
||||||
this.collectionIds = params?.collectionIds;
|
this.collectionIds = params?.collectionIds;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||||||
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.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 { Devices } from "@bitwarden/web-vault/app/admin-console/icons";
|
||||||
import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared";
|
import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared";
|
||||||
import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module";
|
import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module";
|
||||||
@@ -54,6 +54,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
|||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -84,17 +85,17 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
|||||||
authRequest,
|
authRequest,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("loginRequestApproved"),
|
message: this.i18nService.t("loginRequestApproved"),
|
||||||
);
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("resetPasswordDetailsError"),
|
message: this.i18nService.t("resetPasswordDetailsError"),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -109,18 +110,22 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
|||||||
this.organizationId,
|
this.organizationId,
|
||||||
this.tableDataSource.data,
|
this.tableDataSource.data,
|
||||||
);
|
);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("allLoginRequestsApproved"),
|
message: this.i18nService.t("allLoginRequestsApproved"),
|
||||||
);
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async denyRequest(requestId: string) {
|
async denyRequest(requestId: string) {
|
||||||
await this.performAsyncAction(async () => {
|
await this.performAsyncAction(async () => {
|
||||||
await this.organizationAuthRequestService.denyPendingRequests(this.organizationId, requestId);
|
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.organizationId,
|
||||||
...this.tableDataSource.data.map((r) => r.id),
|
...this.tableDataSource.data.map((r) => r.id),
|
||||||
);
|
);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("allLoginRequestsDenied"),
|
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 { 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 { ValidationService } from "@bitwarden/common/platform/abstractions/validation.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 { domainNameValidator } from "./validators/domain-name.validator";
|
||||||
import { uniqueInArrayValidator } from "./validators/unique-in-array.validator";
|
import { uniqueInArrayValidator } from "./validators/unique-in-array.validator";
|
||||||
@@ -66,6 +66,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
private orgDomainService: OrgDomainServiceAbstraction,
|
private orgDomainService: OrgDomainServiceAbstraction,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
// Angular Method Implementations
|
// 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.
|
// Creates a new domain record. The DNS TXT Record will be generated server-side and returned in the response.
|
||||||
saveDomain = async (): Promise<void> => {
|
saveDomain = async (): Promise<void> => {
|
||||||
if (this.domainForm.invalid) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +131,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
this.data.orgDomain = await this.orgDomainApiService.post(this.data.organizationId, request);
|
this.data.orgDomain = await this.orgDomainApiService.post(this.data.organizationId, request);
|
||||||
// Patch the DNS TXT Record that was generated server-side
|
// Patch the DNS TXT Record that was generated server-side
|
||||||
this.domainForm.controls.txt.patchValue(this.data.orgDomain.txt);
|
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) {
|
} catch (e) {
|
||||||
this.handleDomainSaveError(e);
|
this.handleDomainSaveError(e);
|
||||||
}
|
}
|
||||||
@@ -177,7 +186,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
verifyDomain = async (): Promise<void> => {
|
verifyDomain = async (): Promise<void> => {
|
||||||
if (this.domainForm.invalid) {
|
if (this.domainForm.invalid) {
|
||||||
// Note: shouldn't be possible, but going to leave this to be safe.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +201,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (this.data.orgDomain.verifiedDate) {
|
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();
|
this.dialogRef.close();
|
||||||
} else {
|
} else {
|
||||||
this.domainNameCtrl.setErrors({
|
this.domainNameCtrl.setErrors({
|
||||||
@@ -250,7 +267,11 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.orgDomainApiService.delete(this.data.organizationId, this.data.orgDomain.id);
|
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();
|
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 { 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 { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DomainAddEditDialogComponent,
|
DomainAddEditDialogComponent,
|
||||||
@@ -37,6 +37,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
|||||||
private orgDomainService: OrgDomainServiceAbstraction,
|
private orgDomainService: OrgDomainServiceAbstraction,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
@@ -110,13 +111,17 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (orgDomain.verifiedDate) {
|
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 {
|
} else {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("domainNotVerified", domainName),
|
message: this.i18nService.t("domainNotVerified", domainName),
|
||||||
);
|
});
|
||||||
// Update this item so the last checked date gets updated.
|
// Update this item so the last checked date gets updated.
|
||||||
await this.updateOrgDomain(orgDomainId);
|
await this.updateOrgDomain(orgDomainId);
|
||||||
}
|
}
|
||||||
@@ -138,11 +143,11 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
|||||||
switch (errorResponse.statusCode) {
|
switch (errorResponse.statusCode) {
|
||||||
case HttpStatusCode.Conflict:
|
case HttpStatusCode.Conflict:
|
||||||
if (errorResponse.message.includes("The domain is not available to be claimed")) {
|
if (errorResponse.message.includes("The domain is not available to be claimed")) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("domainNotAvailable", domainName),
|
message: this.i18nService.t("domainNotAvailable", domainName),
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -166,7 +171,11 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
await this.orgDomainApiService.delete(this.organizationId, orgDomainId);
|
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 {
|
ngOnDestroy(): void {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { OrganizationConnectionResponse } from "@bitwarden/common/admin-console/
|
|||||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-org-manage-scim",
|
selector: "app-org-manage-scim",
|
||||||
@@ -46,6 +46,7 @@ export class ScimComponent implements OnInit {
|
|||||||
private environmentService: EnvironmentService,
|
private environmentService: EnvironmentService,
|
||||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -104,7 +105,11 @@ export class ScimComponent implements OnInit {
|
|||||||
endpointUrl: await this.getScimEndpointUrl(),
|
endpointUrl: await this.getScimEndpointUrl(),
|
||||||
clientSecret: response.apiKey,
|
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 () => {
|
copyScimKey = async () => {
|
||||||
@@ -131,7 +136,11 @@ export class ScimComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.setConnectionFormValues(response);
|
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() {
|
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 { 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 { ValidationService } from "@bitwarden/common/platform/abstractions/validation.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";
|
import { WebProviderService } from "../services/web-provider.service";
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@ export class AddOrganizationComponent implements OnInit {
|
|||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -73,11 +74,11 @@ export class AddOrganizationComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("organizationJoinedProvider"),
|
message: this.i18nService.t("organizationJoinedProvider"),
|
||||||
);
|
});
|
||||||
|
|
||||||
this.dialogRef.close(true);
|
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 { ProviderUserType } from "@bitwarden/common/admin-console/enums";
|
||||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||||
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 { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { providerPermissionsGuard } from "./provider-permissions.guard";
|
import { providerPermissionsGuard } from "./provider-permissions.guard";
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ describe("Provider Permissions Guard", () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ProviderService, useValue: providerService },
|
{ provide: ProviderService, useValue: providerService },
|
||||||
{ provide: PlatformUtilsService, useValue: mock<PlatformUtilsService>() },
|
{ provide: ToastService, useValue: mock<ToastService>() },
|
||||||
{ provide: I18nService, useValue: mock<I18nService>() },
|
{ provide: I18nService, useValue: mock<I18nService>() },
|
||||||
{ provide: Router, useValue: mock<Router>() },
|
{ provide: Router, useValue: mock<Router>() },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service";
|
import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service";
|
||||||
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
import { Provider } from "@bitwarden/common/admin-console/models/domain/provider";
|
||||||
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 { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `CanActivateFn` that asserts the logged in user has permission to access
|
* `CanActivateFn` that asserts the logged in user has permission to access
|
||||||
@@ -36,8 +36,8 @@ export function providerPermissionsGuard(
|
|||||||
return async (route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {
|
return async (route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {
|
||||||
const providerService = inject(ProviderService);
|
const providerService = inject(ProviderService);
|
||||||
const router = inject(Router);
|
const router = inject(Router);
|
||||||
const platformUtilsService = inject(PlatformUtilsService);
|
|
||||||
const i18nService = inject(I18nService);
|
const i18nService = inject(I18nService);
|
||||||
|
const toastService = inject(ToastService);
|
||||||
|
|
||||||
const provider = await providerService.get(route.params.providerId);
|
const provider = await providerService.get(route.params.providerId);
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
@@ -45,14 +45,22 @@ export function providerPermissionsGuard(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!provider.isProviderAdmin && !provider.enabled) {
|
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(["/"]);
|
return router.createUrlTree(["/"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasSpecifiedPermissions = permissionsCallback == null || permissionsCallback(provider);
|
const hasSpecifiedPermissions = permissionsCallback == null || permissionsCallback(provider);
|
||||||
|
|
||||||
if (!hasSpecifiedPermissions) {
|
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]);
|
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 { 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 { 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 { BaseEventsComponent } from "@bitwarden/web-vault/app/admin-console/common/base.events.component";
|
||||||
import { EventService } from "@bitwarden/web-vault/app/core";
|
import { EventService } from "@bitwarden/web-vault/app/core";
|
||||||
import { EventExportService } from "@bitwarden/web-vault/app/tools/event-export";
|
import { EventExportService } from "@bitwarden/web-vault/app/tools/event-export";
|
||||||
@@ -37,6 +38,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
private userNamePipe: UserNamePipe,
|
private userNamePipe: UserNamePipe,
|
||||||
fileDownloadService: FileDownloadService,
|
fileDownloadService: FileDownloadService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
eventService,
|
eventService,
|
||||||
@@ -45,6 +47,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
|||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
logService,
|
logService,
|
||||||
fileDownloadService,
|
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 { 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 { ValidationService } from "@bitwarden/common/platform/abstractions/validation.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 { 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 { 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";
|
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,
|
dialogService: DialogService,
|
||||||
organizationManagementPreferencesService: OrganizationManagementPreferencesService,
|
organizationManagementPreferencesService: OrganizationManagementPreferencesService,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
apiService,
|
apiService,
|
||||||
@@ -89,6 +90,7 @@ export class PeopleComponent
|
|||||||
userNamePipe,
|
userNamePipe,
|
||||||
dialogService,
|
dialogService,
|
||||||
organizationManagementPreferencesService,
|
organizationManagementPreferencesService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,11 +215,11 @@ export class PeopleComponent
|
|||||||
const filteredUsers = users.filter((u) => u.status === ProviderUserStatusType.Invited);
|
const filteredUsers = users.filter((u) => u.status === ProviderUserStatusType.Invited);
|
||||||
|
|
||||||
if (filteredUsers.length <= 0) {
|
if (filteredUsers.length <= 0) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("noSelectedUsersApplicable"),
|
message: this.i18nService.t("noSelectedUsersApplicable"),
|
||||||
);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { ProviderUserUpdateRequest } from "@bitwarden/common/admin-console/model
|
|||||||
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 { 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.
|
* @deprecated Please use the {@link MembersDialogComponent} instead.
|
||||||
@@ -42,6 +42,7 @@ export class UserAddEditComponent implements OnInit {
|
|||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -80,11 +81,11 @@ export class UserAddEditComponent implements OnInit {
|
|||||||
this.formPromise = this.apiService.postProviderUserInvite(this.providerId, request);
|
this.formPromise = this.apiService.postProviderUserInvite(this.providerId, request);
|
||||||
}
|
}
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name),
|
message: this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name),
|
||||||
);
|
});
|
||||||
this.savedUser.emit();
|
this.savedUser.emit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
@@ -109,11 +110,11 @@ export class UserAddEditComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.deletePromise = this.apiService.deleteProviderUser(this.providerId, this.providerUserId);
|
this.deletePromise = this.apiService.deleteProviderUser(this.providerId, this.providerUserId);
|
||||||
await this.deletePromise;
|
await this.deletePromise;
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
null,
|
title: null,
|
||||||
this.i18nService.t("removedUserId", this.name),
|
message: this.i18nService.t("removedUserId", this.name),
|
||||||
);
|
});
|
||||||
this.deletedUser.emit();
|
this.deletedUser.emit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(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 { 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 { 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";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "provider-account",
|
selector: "provider-account",
|
||||||
@@ -49,6 +49,7 @@ export class AccountComponent implements OnDestroy, OnInit {
|
|||||||
private providerApiService: ProviderApiServiceAbstraction,
|
private providerApiService: ProviderApiServiceAbstraction,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -86,7 +87,11 @@ export class AccountComponent implements OnDestroy, OnInit {
|
|||||||
await this.providerApiService.putProvider(this.providerId, request);
|
await this.providerApiService.putProvider(this.providerId, request);
|
||||||
await this.syncService.fullSync(true);
|
await this.syncService.fullSync(true);
|
||||||
this.provider = await this.providerApiService.getProvider(this.providerId);
|
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() {
|
async deleteProvider() {
|
||||||
@@ -110,11 +115,11 @@ export class AccountComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await this.providerApiService.deleteProvider(this.providerId);
|
await this.providerApiService.deleteProvider(this.providerId);
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"success",
|
variant: "success",
|
||||||
this.i18nService.t("providerDeleted"),
|
title: this.i18nService.t("providerDeleted"),
|
||||||
this.i18nService.t("providerDeletedDesc"),
|
message: this.i18nService.t("providerDeletedDesc"),
|
||||||
);
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(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 { 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 { 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 { BaseEventsComponent } from "@bitwarden/web-vault/app/admin-console/common/base.events.component";
|
||||||
import { EventService } from "@bitwarden/web-vault/app/core";
|
import { EventService } from "@bitwarden/web-vault/app/core";
|
||||||
import { EventExportService } from "@bitwarden/web-vault/app/tools/event-export";
|
import { EventExportService } from "@bitwarden/web-vault/app/tools/event-export";
|
||||||
@@ -33,6 +34,7 @@ export class ServiceAccountEventsComponent
|
|||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
fileDownloadService: FileDownloadService,
|
fileDownloadService: FileDownloadService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
eventService,
|
eventService,
|
||||||
@@ -41,6 +43,7 @@ export class ServiceAccountEventsComponent
|
|||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
logService,
|
logService,
|
||||||
fileDownloadService,
|
fileDownloadService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { CollectionService } from "@bitwarden/common/vault/abstractions/collecti
|
|||||||
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
||||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||||
|
import { ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class CollectionsComponent implements OnInit {
|
export class CollectionsComponent implements OnInit {
|
||||||
@@ -39,6 +40,7 @@ export class CollectionsComponent implements OnInit {
|
|||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -82,11 +84,11 @@ export class CollectionsComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
.map((c) => c.id);
|
.map((c) => c.id);
|
||||||
if (!this.allowSelectNone && selectedCollectionIds.length === 0) {
|
if (!this.allowSelectNone && selectedCollectionIds.length === 0) {
|
||||||
this.platformUtilsService.showToast(
|
this.toastService.showToast({
|
||||||
"error",
|
variant: "error",
|
||||||
this.i18nService.t("errorOccurred"),
|
title: this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("selectOneCollection"),
|
message: this.i18nService.t("selectOneCollection"),
|
||||||
);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.cipherDomain.collectionIds = selectedCollectionIds;
|
this.cipherDomain.collectionIds = selectedCollectionIds;
|
||||||
@@ -94,10 +96,18 @@ export class CollectionsComponent implements OnInit {
|
|||||||
this.formPromise = this.saveCollections();
|
this.formPromise = this.saveCollections();
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.onSavedCollections.emit();
|
this.onSavedCollections.emit();
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("editedItem"));
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("editedItem"),
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast("error", this.i18nService.t("errorOccurred"), e.message);
|
this.toastService.showToast({
|
||||||
|
variant: "error",
|
||||||
|
title: this.i18nService.t("errorOccurred"),
|
||||||
|
message: e.message,
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user