Remove RecoveryBanner component and dead onCrashDetected code
- Delete RecoveryBanner.tsx component and its test - Remove RecoveryBanner from MainLayout - Remove onCrashDetected prop from ActivateJailDialog, JailsTab - Remove fetchPendingRecovery, rollbackJail API functions - Remove configJailRollback, configPendingRecovery endpoints - Remove PendingRecovery type
This commit is contained in:
@@ -5,12 +5,8 @@
|
||||
* findtime, maxretry, port and logpath. Calls the activate endpoint on
|
||||
* confirmation and propagates the result via callbacks.
|
||||
*
|
||||
* Task 3 additions:
|
||||
* - Runs pre-activation validation when the dialog opens and displays any
|
||||
* warnings or blocking errors before the user confirms.
|
||||
* - Extended spinner text during the post-reload probe phase.
|
||||
* - Calls `onCrashDetected` when the activation response signals that
|
||||
* fail2ban stopped responding after the reload.
|
||||
* Runs pre-activation validation when the dialog opens and displays any
|
||||
* warnings or blocking errors before the user confirms.
|
||||
*/
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
@@ -52,11 +48,6 @@ export interface ActivateJailDialogProps {
|
||||
onClose: () => void;
|
||||
/** Called after the jail has been successfully activated. */
|
||||
onActivated: () => void;
|
||||
/**
|
||||
* Called when fail2ban stopped responding after the jail was activated.
|
||||
* The recovery banner will surface this to the user.
|
||||
*/
|
||||
onCrashDetected?: () => void;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -77,7 +68,6 @@ export function ActivateJailDialog({
|
||||
open,
|
||||
onClose,
|
||||
onActivated,
|
||||
onCrashDetected,
|
||||
}: ActivateJailDialogProps): React.JSX.Element {
|
||||
const [bantime, setBantime] = useState("");
|
||||
const [findtime, setFindtime] = useState("");
|
||||
@@ -173,9 +163,6 @@ export function ActivateJailDialog({
|
||||
setValidationWarnings(result.validation_warnings);
|
||||
}
|
||||
resetForm();
|
||||
if (!result.fail2ban_running) {
|
||||
onCrashDetected?.();
|
||||
}
|
||||
onActivated();
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
@@ -339,9 +326,10 @@ export function ActivateJailDialog({
|
||||
style={{ marginTop: tokens.spacingVerticalS }}
|
||||
>
|
||||
<MessageBarBody>
|
||||
<MessageBarTitle>Activation Failed — System Recovered</MessageBarTitle>
|
||||
Activation of jail “{jail.name}” failed. The server
|
||||
has been automatically recovered.
|
||||
<MessageBarTitle>Activation Failed — Configuration Rolled Back</MessageBarTitle>
|
||||
The configuration for jail “{jail.name}” has been
|
||||
rolled back to its previous state and fail2ban is running
|
||||
normally. Review the configuration and try activating again.
|
||||
</MessageBarBody>
|
||||
</MessageBar>
|
||||
)}
|
||||
@@ -351,10 +339,12 @@ export function ActivateJailDialog({
|
||||
style={{ marginTop: tokens.spacingVerticalS }}
|
||||
>
|
||||
<MessageBarBody>
|
||||
<MessageBarTitle>Activation Failed — Manual Intervention Required</MessageBarTitle>
|
||||
Activation of jail “{jail.name}” failed and
|
||||
automatic recovery was unsuccessful. Manual intervention is
|
||||
required.
|
||||
<MessageBarTitle>Activation Failed — Rollback Unsuccessful</MessageBarTitle>
|
||||
Activation of jail “{jail.name}” failed and the
|
||||
automatic rollback did not complete. The file{" "}
|
||||
<code>jail.d/{jail.name}.local</code> may still contain{" "}
|
||||
<code>enabled = true</code>. Check the fail2ban logs, correct
|
||||
the file manually, and restart fail2ban.
|
||||
</MessageBarBody>
|
||||
</MessageBar>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user