|
@@ -102,60 +102,47 @@ export default function ApiHealth() {
|
|
|
</span>
|
|
</span>
|
|
|
)}
|
|
)}
|
|
|
</div>
|
|
</div>
|
|
|
- <div className="text-sm font-medium text-gray-400">
|
|
|
|
|
- {isRestarting ? "Restarting..." : "API Health"}
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div className="text-sm font-medium text-gray-400">API Health</div>
|
|
|
{responseTime !== null && !isRestarting && (
|
|
{responseTime !== null && !isRestarting && (
|
|
|
<div className="text-xs text-gray-500 mt-1">
|
|
<div className="text-xs text-gray-500 mt-1">
|
|
|
{responseTime}ms response
|
|
{responseTime}ms response
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
|
|
|
+ {isRestarting && (
|
|
|
|
|
+ <div className="text-xs text-blue-400 mt-1">Restarting...</div>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <button
|
|
|
|
|
- onClick={() => setShowRestartConfirm(true)}
|
|
|
|
|
- disabled={restartMutation.isPending || isRestarting}
|
|
|
|
|
- className="px-3 py-1 rounded text-xs font-medium transition-colors bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1"
|
|
|
|
|
- title="Restart API service"
|
|
|
|
|
- >
|
|
|
|
|
- <ArrowPathIcon
|
|
|
|
|
- className={`h-3 w-3 ${restartMutation.isPending || isRestarting ? "animate-spin" : ""}`}
|
|
|
|
|
- />
|
|
|
|
|
- Restart
|
|
|
|
|
- </button>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- {/* Restart Confirmation Dialog */}
|
|
|
|
|
- {showRestartConfirm && (
|
|
|
|
|
- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
|
|
|
|
|
- <div className="bg-white dark:bg-gray-900 rounded-lg shadow-lg p-6 max-w-sm mx-4">
|
|
|
|
|
- <h2 className="text-lg font-semibold mb-2">Restart API Service?</h2>
|
|
|
|
|
- <p className="text-gray-600 dark:text-gray-400 text-sm mb-6">
|
|
|
|
|
- This will gracefully restart the API service. The service will be
|
|
|
|
|
- temporarily unavailable.
|
|
|
|
|
- </p>
|
|
|
|
|
- <div className="flex justify-end gap-3">
|
|
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
|
|
+ {!showRestartConfirm ? (
|
|
|
|
|
+ <button
|
|
|
|
|
+ onClick={() => setShowRestartConfirm(true)}
|
|
|
|
|
+ disabled={isRestarting}
|
|
|
|
|
+ className="flex items-center gap-1.5 rounded-lg bg-blue-500/20 px-3 py-1.5 text-xs font-medium text-blue-400 ring-1 ring-blue-500/30 transition-all hover:bg-blue-500/30 hover:ring-blue-500/50 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
|
|
|
+ title="Restart API service"
|
|
|
|
|
+ >
|
|
|
|
|
+ <ArrowPathIcon className="h-4 w-4" />
|
|
|
|
|
+ Restart
|
|
|
|
|
+ </button>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
<button
|
|
<button
|
|
|
- onClick={() => setShowRestartConfirm(false)}
|
|
|
|
|
- disabled={restartMutation.isPending}
|
|
|
|
|
- className="px-4 py-2 rounded border border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-50 transition-colors"
|
|
|
|
|
|
|
+ onClick={() => restartMutation.mutate()}
|
|
|
|
|
+ disabled={isRestarting}
|
|
|
|
|
+ className="rounded-lg bg-red-500/20 px-3 py-1.5 text-xs font-medium text-red-400 ring-1 ring-red-500/30 transition-all hover:bg-red-500/30 hover:ring-red-500/50 disabled:opacity-50"
|
|
|
>
|
|
>
|
|
|
- Cancel
|
|
|
|
|
|
|
+ Confirm
|
|
|
</button>
|
|
</button>
|
|
|
<button
|
|
<button
|
|
|
- onClick={() => restartMutation.mutate()}
|
|
|
|
|
- disabled={restartMutation.isPending}
|
|
|
|
|
- className="px-4 py-2 rounded bg-red-600 hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-800 text-white disabled:opacity-50 transition-colors flex items-center gap-2"
|
|
|
|
|
|
|
+ onClick={() => setShowRestartConfirm(false)}
|
|
|
|
|
+ className="rounded-lg bg-gray-500/20 px-3 py-1.5 text-xs font-medium text-gray-400 ring-1 ring-gray-500/30 transition-all hover:bg-gray-500/30 hover:ring-gray-500/50"
|
|
|
>
|
|
>
|
|
|
- {restartMutation.isPending && (
|
|
|
|
|
- <ArrowPathIcon className="w-4 h-4 animate-spin" />
|
|
|
|
|
- )}
|
|
|
|
|
- Restart
|
|
|
|
|
|
|
+ Cancel
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
- )}
|
|
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|