mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 13:23:34 +00:00
[PM-26366] Refactor BasePolicyEditDefinition (#16756)
* refactor BasePoliicyEditDefinition * fix circular dep
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user