Quick Actions
Overview
A quick action is a shortcut the backend contributes to the dashboard's command palette: a labelled entry, grouped under a category, that points at a registered page, a table creation form, a table toolbar button, or an event. Actions register at import time. Access follows the target page and, for a form or a button, the permission of what it opens.
Both functions live in @antelopejs/interface-dms/quick-actions.
Declare a Category and Its Actions
QuickActionCategory(id, info) registers the group; QuickAction(id, info) registers an entry in it. Both return the registered record. Create the category first: registering an action whose category is unknown throws.
This example assumes your application exports a registered TasksPage from ./pages/tasks.
import { TasksPage } from "./pages/tasks";
import {
QuickAction,
QuickActionCategory,
} from "@antelopejs/interface-dms/quick-actions";
const tasks = QuickActionCategory("tasks", {
displayName: "$my_app.quick_actions.tasks",
icon: "i-ph-check-square",
order: 10,
});
QuickAction("tasks-new", {
category: tasks,
displayName: "$my_app.quick_actions.tasks_new",
icon: "i-ph-plus",
target: { type: "navigate", page: TasksPage },
});
Actions are keyed by their category id and their own id, so the same action id may appear under two categories. Registering an id that is already taken keeps the first registration.
QuickActionCategoryInfo
| Field | Type | Description |
|---|---|---|
id | string | Category id. Supplied as the first argument of QuickActionCategory, not inside info. |
displayName | string | Group label. Required. |
icon | string | Icon name. |
order | number | Sort order among categories. |
QuickActionInfo
| Field | Type | Description |
|---|---|---|
id | string | Action id. Supplied as the first argument of QuickAction, not inside info. |
category | QuickActionCategoryInfo | The record returned by QuickActionCategory. Required. |
displayName | string | Entry label. Required. |
icon | string | Icon name. Required. |
order | number | Sort order within the category. |
target | QuickActionTarget | What running the action does. Required. |
Access is computed per caller from the registered target page, including its permission and tenant access gate (Permissions). An openForm target also checks the selected table's create action; a button target checks the button's own permission. Configure access on the destination rather than adding a separate permission property to the quick action.
QuickActionTarget
Every target requires page, the registered page controller class. The frontend URL derives from that page, so renaming a route does not leave a stale URL in the action.
| Variant | Fields | Meaning |
|---|---|---|
"navigate" | page, optional query | Navigate to the page with optional string query parameters. |
"openForm" | page, optional component | Open a table's creation form. Select the component explicitly if the page has more than one eligible table. |
"button" | page, button, optional component | Open the page and press the table toolbar button whose id is button, e.g. to open the modal it opens. Select the component explicitly if several components of the page declare that button id. |
"event" | page, name, optional payload | Navigate to the page and emit the named event. |
The following examples assume an existing registered BooksPage with a TableView stored in its static table field. For a nested table, pass a target such as BooksPage.content.targetChild("table") instead.
import { BooksPage } from "./pages/books";
import {
QuickAction,
QuickActionCategory,
} from "@antelopejs/interface-dms/quick-actions";
const catalog = QuickActionCategory("catalog", {
displayName: "$my_app.quick_actions.catalog",
icon: "i-ph-books",
});
QuickAction("catalog-new-book", {
category: catalog,
displayName: "$my_app.quick_actions.new_book",
icon: "i-ph-plus",
target: { type: "openForm", page: BooksPage, component: BooksPage.table },
});
// BooksPage.table declares customButtons: [{ id: "import", permission: "add", … }]
QuickAction("catalog-import", {
category: catalog,
displayName: "$my_app.quick_actions.import_books",
icon: "i-ph-upload",
target: { type: "button", page: BooksPage, button: "import" },
});
QuickAction("catalog-refresh", {
category: catalog,
displayName: "$my_app.quick_actions.refresh",
icon: "i-ph-arrows-clockwise",
target: { type: "event", page: BooksPage, name: "catalog:refresh", payload: { force: true } },
});
Declare quick actions in a file imported by your module so the registrations run at import time, next to the pages they point at.
Layout Banners covers the other global surface a backend module contributes to: messages under the dashboard header.
Realtime
Publish events on topics from the backend, and how page-bound topics reach the browsers viewing the page.
Layout Banners
A layout banner is a global message the backend adds under the dashboard header: a colored strip carrying a line of text and its link buttons, or a component of your frontend layer.