feat: frontend Actions Tab with structured API, assign/create/remove dialogs (Task 3.3)
- ActionsTab rewritten with master/detail layout (mirrors FiltersTab) - New AssignActionDialog and CreateActionDialog components - ActionConfig type extended with active, used_by_jails, source_file, has_local_override - New API functions: fetchActions, fetchAction, updateAction, createAction, deleteAction, assignActionToJail, removeActionFromJail - useActionConfig updated to use new structured endpoints - index.ts barrel exports updated
This commit is contained in:
@@ -348,6 +348,74 @@ export interface ActionConfig {
|
||||
definition_vars: Record<string, string>;
|
||||
/** [Init] section key-value pairs. */
|
||||
init_vars: Record<string, string>;
|
||||
/**
|
||||
* True when this action is referenced by at least one currently running jail.
|
||||
*/
|
||||
active: boolean;
|
||||
/**
|
||||
* Names of currently enabled jails that reference this action.
|
||||
* Empty when active is false.
|
||||
*/
|
||||
used_by_jails: string[];
|
||||
/** Absolute path to the .conf source file. Empty string when not computed. */
|
||||
source_file: string;
|
||||
/** True when a .local override file exists alongside the base .conf. */
|
||||
has_local_override: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response for GET /api/config/actions.
|
||||
* Lists all discovered actions with active/inactive status.
|
||||
*/
|
||||
export interface ActionListResponse {
|
||||
actions: ActionConfig[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payload for ``PUT /api/config/actions/{name}``.
|
||||
*
|
||||
* Only editable lifecycle fields are accepted.
|
||||
* Fields set to ``null`` or omitted leave the existing value unchanged.
|
||||
*/
|
||||
export interface ActionUpdateRequest {
|
||||
actionstart?: string | null;
|
||||
actionstop?: string | null;
|
||||
actioncheck?: string | null;
|
||||
actionban?: string | null;
|
||||
actionunban?: string | null;
|
||||
actionflush?: string | null;
|
||||
definition_vars?: Record<string, string> | null;
|
||||
init_vars?: Record<string, string> | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payload for ``POST /api/config/actions``.
|
||||
*
|
||||
* Creates a new user-defined action at ``action.d/{name}.local``.
|
||||
*/
|
||||
export interface ActionCreateRequest {
|
||||
/** Base name without extension (e.g. ``my-action``). */
|
||||
name: string;
|
||||
actionstart?: string | null;
|
||||
actionstop?: string | null;
|
||||
actioncheck?: string | null;
|
||||
actionban?: string | null;
|
||||
actionunban?: string | null;
|
||||
actionflush?: string | null;
|
||||
definition_vars?: Record<string, string> | null;
|
||||
init_vars?: Record<string, string> | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payload for ``POST /api/config/jails/{jail_name}/action``.
|
||||
*
|
||||
* Adds an action to a jail's action list.
|
||||
*/
|
||||
export interface AssignActionRequest {
|
||||
action_name: string;
|
||||
/** Optional parameters for the action (e.g. ``{ port: "ssh" }``). */
|
||||
params?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user