1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00
Files
browser/bitwarden_license/bit-web/src/app/secrets-manager/shared/dialogs/bulk-confirmation-dialog.component.ts
Thomas Avery 208e3f30b4 [SM-670] Restrict UI actions based on user permission (#5090)
* Restrict UI actions based on user permission

* Swap to hiding bulk option without permission

* Fix read/write assignment in project service

* Filter projects based on permission in dialog

* Fix encryption error for updating secret result

* Fix spinner (#5182)

* Swap to bit-no-items

* [SM-699] Projects bulk delete - add bulk confirmation dialog (#5200)

* Add bulk confirmation dialog

* Code review updates

* Code review - load projects

* code review - swap to observable

* Code review - remove oninit
2023-04-26 13:09:30 -05:00

49 lines
1.2 KiB
TypeScript

import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
import { Component, Inject, OnInit } from "@angular/core";
export interface BulkConfirmationDetails {
title: string;
columnTitle: string;
message: string;
details: BulkConfirmationStatus[];
}
export interface BulkConfirmationStatus {
id: string;
name: string;
description: string;
}
export enum BulkConfirmationResult {
Continue,
Cancel,
}
@Component({
selector: "sm-bulk-confirmation-dialog",
templateUrl: "./bulk-confirmation-dialog.component.html",
})
export class BulkConfirmationDialogComponent implements OnInit {
constructor(
public dialogRef: DialogRef,
@Inject(DIALOG_DATA) public data: BulkConfirmationDetails
) {}
protected bulkConfirmationResult = BulkConfirmationResult;
ngOnInit(): void {
// TODO remove null checks once strictNullChecks in TypeScript is turned on.
if (
!this.data.title ||
!this.data.columnTitle ||
!this.data.message ||
!(this.data.details?.length >= 1)
) {
this.dialogRef.close();
throw new Error(
"The bulk confirmation dialog was not called with the appropriate operation values."
);
}
}
}