mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
SM-281: Secrets Manager Trash (#4730)
* SM-281: Initial commit with trash component setup * SM-281: Customize secrets list component, add ability to hard delete secrets * SM-281: Add support for restoring secrets in SM * SM-281: restoreSecret emit values as an array * SM-281: Fix bug caused by mistake when doing merge conflict resolution * SM-281: Clean up TrashService and move more functionality to TrashApiService * Cleanup responses * Merge TrashService and SecretService * Remove tw-text-sm from dialogs * Split delete into two components * Change secrets table to have a single boolean for trash * SM-281: Rename component to secret-hard-delete * Remove unused organizationId * Remove duplicate buttons --------- Co-authored-by: Hinton <hinton@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
|
||||
import { Component, Inject } from "@angular/core";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
|
||||
import { SecretService } from "../../secrets/secret.service";
|
||||
|
||||
export interface SecretHardDeleteOperation {
|
||||
secretIds: string[];
|
||||
organizationId: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: "sm-secret-hard-delete-dialog",
|
||||
templateUrl: "./secret-hard-delete.component.html",
|
||||
})
|
||||
export class SecretHardDeleteDialogComponent {
|
||||
constructor(
|
||||
public dialogRef: DialogRef,
|
||||
private secretService: SecretService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
@Inject(DIALOG_DATA) public data: SecretHardDeleteOperation
|
||||
) {}
|
||||
|
||||
get title() {
|
||||
return this.data.secretIds.length === 1 ? "hardDeleteSecret" : "hardDeleteSecrets";
|
||||
}
|
||||
|
||||
get submitButtonText() {
|
||||
return this.data.secretIds.length === 1 ? "deleteSecret" : "deleteSecrets";
|
||||
}
|
||||
|
||||
delete = async () => {
|
||||
await this.secretService.deleteTrashed(this.data.organizationId, this.data.secretIds);
|
||||
const message =
|
||||
this.data.secretIds.length === 1 ? "hardDeleteSuccessToast" : "hardDeletesSuccessToast";
|
||||
this.dialogRef.close(this.data.secretIds);
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t(message));
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user