File

src/app/core/entity-details/entity-actions-menu/entity-action.interface.ts

Description

Details of an action that users can trigger for a specific entity, displayed in the context menu.

Index

Properties

Properties

action
action: string
Type : string

ID for identifying this action in analytics, etc.

availableFor
availableFor: "all" | "bulk-only" | "individual-only"
Type : "all" | "bulk-only" | "individual-only"
Optional

Determines where this action is available:

  • 'all': available for both individual and bulk actions (default)
  • 'bulk-only': only available as a bulk action
  • 'individual-only': only available for single entity actions
execute
execute: function
Type : function

The method being executed when the action is triggered.

icon
icon: string
Type : string
label
label: string
Type : string

human-readable label displayed in menu

permission
permission: EntityActionPermission
Type : EntityActionPermission
Optional

The "operation" for Entity Permissions checks that the user needs permission for executing this action.

primaryAction
primaryAction: boolean
Type : boolean
Optional

If marked as primary action, it will be displayed directly rather than hidden in the three-dot menu in some contexts.

tooltip
tooltip: string
Type : string
Optional
visible
visible: function
Type : function
Optional

Controls visibility of the action based on the given entity. Should return a Promise resolving to true if visible.

import { Entity } from "../../entity/model/entity";
import { EntityActionPermission } from "../../permissions/permission-types";

/**
 * Details of an action that users can trigger for a specific entity, displayed in the context menu.
 */
export interface EntityAction {
  /**
   * Determines where this action is available:
   * - 'all': available for both individual and bulk actions (default)
   * - 'bulk-only': only available as a bulk action
   * - 'individual-only': only available for single entity actions
   */
  availableFor?: "all" | "bulk-only" | "individual-only";

  /**
   * ID for identifying this action in analytics, etc.
   */
  action: string;

  /**
   * human-readable label displayed in menu
   */
  label: string;
  icon: string;
  tooltip?: string;

  /**
   * If marked as primary action, it will be displayed directly rather than hidden in the three-dot menu in some contexts.
   */
  primaryAction?: boolean;

  /**
   * The "operation" for Entity Permissions checks that the user needs permission for executing this action.
   */
  permission?: EntityActionPermission;

  /**
   * The method being executed when the action is triggered.
   * @param e The entity on which the action is executed
   */
  execute: (
    entity: Entity | Entity[],
    navigateOnDelete?: boolean,
  ) => Promise<boolean>;

  /**
   * Controls visibility of the action based on the given entity.
   * Should return a Promise resolving to true if visible.
   */
  visible?: (entity: Entity | Entity[]) => Promise<boolean>;
}

results matching ""

    No results matching ""