1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 05:13:29 +00:00

[PM-26366] Refactor BasePolicyEditDefinition (#16756)

* refactor BasePoliicyEditDefinition

* fix circular dep
This commit is contained in:
Brandon Treston
2025-10-07 09:59:57 -04:00
committed by GitHub
parent ddc840027a
commit c0d15c19d4
2 changed files with 11 additions and 1 deletions

View File

@@ -9,6 +9,8 @@ import { PolicyRequest } from "@bitwarden/common/admin-console/models/request/po
import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import type { PolicyEditDialogComponent } from "./policy-edit-dialog.component";
/**
* A metadata class that defines how a policy is displayed in the Admin Console Policies page for editing.
* Add this to the `ossPolicyRegister` or `bitPolicyRegister` file to register it in the application.
@@ -32,6 +34,13 @@ export abstract class BasePolicyEditDefinition {
*/
abstract component: Constructor<BasePolicyEditComponent>;
/**
* The dialog component that will be opened when editing this policy.
* This allows customizing the look and feel of each policy's dialog contents.
* If not specified, defaults to {@link PolicyEditDialogComponent}.
*/
editDialogComponent?: typeof PolicyEditDialogComponent;
/**
* If true, the {@link description} will be reused in the policy edit modal. Set this to false if you
* have more complex requirements that you will implement in your template instead.

View File

@@ -127,7 +127,8 @@ export class PoliciesComponent implements OnInit {
}
async edit(policy: BasePolicyEditDefinition) {
const dialogRef = PolicyEditDialogComponent.open(this.dialogService, {
const dialogComponent = policy.editDialogComponent ?? PolicyEditDialogComponent;
const dialogRef = dialogComponent.open(this.dialogService, {
data: {
policy: policy,
organizationId: this.organizationId,