mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
Feat/plugin instance actions (#2209)
* feat(shared): scope plugin action descriptors * feat(plugin-sdk): instance-scoped settings actions * feat(plugins): run instance-scoped actions from the admin settings dialog * feat(admin): instance-scoped plugin actions in the settings dialog * fix(plugins): surface instance actions without instance fields and harden the action gate * docs(plugin-sdk): note that hosts before 4.2.0 ignore action scope * fix(admin): open the dialog for instance actions, explain inactive 404s, guard the save window * docs(wiki): plugin pages for instance actions and the admin panel changes
This commit is contained in:
@@ -705,13 +705,15 @@ export interface PluginDefinition {
|
||||
* JSON-serialisable value the host aggregates. Userless. Needs `hook:user-data`. */
|
||||
exportUserData?(input: { userId: number }, ctx: PluginContext): Promise<unknown> | unknown;
|
||||
/**
|
||||
* Buttons on the plugin's own settings page ("Test connection", "Sync now"). The key
|
||||
* must match an entry in the manifest's `actions`.
|
||||
* Buttons on the plugin's settings forms ("Test connection", "Sync now", "Purge
|
||||
* cache"). The key must match an entry in the manifest's `actions`; that entry's
|
||||
* `scope` decides WHERE the button renders — `'user'` (default) on the user Settings
|
||||
* tab, `'instance'` in the admin instance-settings dialog.
|
||||
*
|
||||
* USER-INITIATED, so unlike the notificationChannel hook there IS an acting user — the
|
||||
* person who clicked. `ctx.settings.get()` returns THEIR value and trip reads are
|
||||
* membership-checked against them, which is what makes a "test my credentials" button
|
||||
* possible at all.
|
||||
* USER-INITIATED either way, so unlike the notificationChannel hook there IS an acting
|
||||
* user — the person who clicked (a user, or an admin for an instance action).
|
||||
* `ctx.settings.get()` returns THEIR value, `ctx.config` is the instance config, and
|
||||
* trip reads are membership-checked against them.
|
||||
*/
|
||||
actions?: Record<string, (ctx: PluginContext) => Promise<PluginActionResult | void> | PluginActionResult | void>;
|
||||
events?: PluginEventSubscription[];
|
||||
|
||||
Reference in New Issue
Block a user