delete agent flow
This commit is contained in:
1 parent
3053009a7e
commit
28dda76ee8
13 files changed
+295
-20
No files matched your search
+14
-1
@@ -10,6 +10,7 @@ import {
|
||||
fetchAlertHistory,
|
||||
fetchAlerts,
|
||||
fetchAudit,
|
||||
revokeAgent,
|
||||
} from "@/api";
|
||||
import { AppLayout } from "@/layout/AppLayout";
|
||||
import { AgentsPage } from "@/pages/AgentsPage";
|
||||
@@ -47,7 +48,12 @@ export function App() {
|
||||
setAlerts(nextAlerts);
|
||||
setHistory(nextHistory);
|
||||
setAudit(nextAudit);
|
||||
if (!selectedAgentId && nextAgents[0]) {
|
||||
if (!nextAgents.length) {
|
||||
setSelectedAgentId("");
|
||||
} else if (
|
||||
!selectedAgentId ||
|
||||
!nextAgents.some((agent) => agent.agent_id === selectedAgentId)
|
||||
) {
|
||||
setSelectedAgentId(nextAgents[0].agent_id);
|
||||
}
|
||||
setState("ready");
|
||||
@@ -57,6 +63,12 @@ export function App() {
|
||||
}
|
||||
}
|
||||
|
||||
async function onRevokeAgent(agentId: string): Promise<boolean> {
|
||||
const result = await revokeAgent(agentId);
|
||||
await loadAll();
|
||||
return result.revoked;
|
||||
}
|
||||
|
||||
async function refreshAlertsAndHistory() {
|
||||
const [nextAlerts, nextHistory] = await Promise.all([
|
||||
fetchAlerts(),
|
||||
@@ -132,6 +144,7 @@ export function App() {
|
||||
agents={agents}
|
||||
selectedAgentId={selectedAgentId}
|
||||
onSelectAgent={setSelectedAgentId}
|
||||
onRevokeAgent={onRevokeAgent}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user