Redesign FiltersTab with active/inactive layout and assign/create dialogs (Tasks 2.3/2.4)
- Rewrite FiltersTab: use fetchFilters() for FilterConfig[] with embedded active
status; show 'Active — sshd, apache-auth' badge labels; FilterDetail sub-
component with source_file/override badges, FilterForm, Assign button, raw
config section
- New AssignFilterDialog: selects jail from enabled-jails list, calls
POST /config/jails/{name}/filter with optional fail2ban reload
- New CreateFilterDialog: name+failregex+ignoreregex form, calls
POST /config/filters, closes and selects new filter on success
- Extend ConfigListDetail: add listHeader (for Create button) and
itemBadgeLabel (for custom badge text) optional props
- Fix updateFilterFile bug: was PUT /config/filters/{name} (structured
endpoint), now correctly PUT /config/filters/{name}/raw
- Fix createFilterFile bug: was POST /config/filters, now POST /config/filters/raw
- Add updateFilter, createFilter, deleteFilter, assignFilterToJail to api/config.ts
- Add FilterUpdateRequest, FilterCreateRequest, AssignFilterRequest to types/config.ts
- Add configFiltersRaw, configJailFilter endpoints
- Tests: 24 new tests across FiltersTab, AssignFilterDialog, CreateFilterDialog
(all 89 frontend tests passing)
This commit is contained in:
@@ -460,3 +460,45 @@ export interface JailActivationResponse {
|
||||
/** Human-readable result message. */
|
||||
message: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Filter write requests (Task 2.3)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Payload for ``PUT /api/config/filters/{name}``.
|
||||
*
|
||||
* Only the user-editable ``[Definition]`` fields are accepted.
|
||||
* Fields set to ``null`` or omitted leave the existing value unchanged.
|
||||
*/
|
||||
export interface FilterUpdateRequest {
|
||||
failregex?: string[] | null;
|
||||
ignoreregex?: string[] | null;
|
||||
datepattern?: string | null;
|
||||
journalmatch?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payload for ``POST /api/config/filters``.
|
||||
*
|
||||
* Creates a new user-defined filter at ``filter.d/{name}.local``.
|
||||
*/
|
||||
export interface FilterCreateRequest {
|
||||
/** Base name without extension (e.g. ``my-custom-filter``). */
|
||||
name: string;
|
||||
failregex?: string[];
|
||||
ignoreregex?: string[];
|
||||
prefregex?: string | null;
|
||||
datepattern?: string | null;
|
||||
journalmatch?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payload for ``POST /api/config/jails/{jail_name}/filter``.
|
||||
*
|
||||
* Assigns a filter to a jail by writing ``filter = {filter_name}`` to the
|
||||
* jail's ``.local`` config file.
|
||||
*/
|
||||
export interface AssignFilterRequest {
|
||||
filter_name: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user