Config page tasks 1-4: dropdowns, key props, inactive jail full GUI, banaction fix
Task 1: Backend/LogEncoding/DatePattern dropdowns in JailConfigDetail
- Added BACKENDS, LOG_ENCODINGS, DATE_PATTERN_PRESETS constants
- Backend and Log Encoding: <Input readOnly> → <Select> (editable, auto-saves)
- Date Pattern: <Input> → <Combobox freeform> with presets
- Extended JailConfigUpdate model (backend, log_encoding) and service
- Added readOnly prop to JailConfigDetail (all fields, toggles, buttons)
- Extended RegexList with readOnly prop
Task 2: Fix raw action/filter config always blank
- Added key={selectedAction.name} to ActionDetail in ActionsTab
- Added key={selectedFilter.name} to FilterDetail in FiltersTab
Task 3: Inactive jail full GUI same as active jails
- Extended InactiveJail Pydantic model with all config fields
- Added _parse_time_to_seconds helper to config_file_service
- Updated _build_inactive_jail to populate all extended fields
- Extended InactiveJail TypeScript type to match
- Rewrote InactiveJailDetail to reuse JailConfigDetail (readOnly=true)
Task 4: Fix banaction interpolation error when activating jails
- _write_local_override_sync now includes banaction=iptables-multiport
and banaction_allports=iptables-allports in every .local file
This commit is contained in:
@@ -17,6 +17,8 @@ export interface RegexListProps {
|
||||
patterns: string[];
|
||||
/** Called when the list changes (add, delete, or edit). */
|
||||
onChange: (next: string[]) => void;
|
||||
/** When true, patterns are displayed read-only with no add/delete controls. */
|
||||
readOnly?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,6 +31,7 @@ export function RegexList({
|
||||
label,
|
||||
patterns,
|
||||
onChange,
|
||||
readOnly = false,
|
||||
}: RegexListProps): React.JSX.Element {
|
||||
const styles = useConfigStyles();
|
||||
const [newPattern, setNewPattern] = useState("");
|
||||
@@ -64,6 +67,7 @@ export function RegexList({
|
||||
<Input
|
||||
className={styles.regexInput}
|
||||
value={p}
|
||||
readOnly={readOnly}
|
||||
aria-label={`${label} pattern ${String(i + 1)}`}
|
||||
onChange={(_e, d) => {
|
||||
const next = [...patterns];
|
||||
@@ -71,33 +75,37 @@ export function RegexList({
|
||||
onChange(next);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
appearance="subtle"
|
||||
icon={<Dismiss24Regular />}
|
||||
size="small"
|
||||
aria-label={`Remove ${label} pattern ${String(i + 1)}`}
|
||||
onClick={() => {
|
||||
handleDelete(i);
|
||||
}}
|
||||
/>
|
||||
{!readOnly && (
|
||||
<Button
|
||||
appearance="subtle"
|
||||
icon={<Dismiss24Regular />}
|
||||
size="small"
|
||||
aria-label={`Remove ${label} pattern ${String(i + 1)}`}
|
||||
onClick={() => {
|
||||
handleDelete(i);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
<div className={styles.regexItem}>
|
||||
<Input
|
||||
className={styles.regexInput}
|
||||
placeholder="New pattern…"
|
||||
value={newPattern}
|
||||
onChange={(_e, d) => {
|
||||
setNewPattern(d.value);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") handleAdd();
|
||||
}}
|
||||
/>
|
||||
<Button size="small" onClick={handleAdd}>
|
||||
Add
|
||||
</Button>
|
||||
</div>
|
||||
{!readOnly && (
|
||||
<div className={styles.regexItem}>
|
||||
<Input
|
||||
className={styles.regexInput}
|
||||
placeholder="New pattern…"
|
||||
value={newPattern}
|
||||
onChange={(_e, d) => {
|
||||
setNewPattern(d.value);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") handleAdd();
|
||||
}}
|
||||
/>
|
||||
<Button size="small" onClick={handleAdd}>
|
||||
Add
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user