fix(gui): wire create modal onSuccess callbacks and fix short-lived profile UX

- All 5 create modals (Profiles, Teams, Owners, Policies, Agent Groups)
  had no-op onSuccess callbacks — API call fired but modal never closed
  and list never refreshed. Wired invalidateQueries + setShowCreate.
- Removed silent try/catch error swallowing so API errors surface in UI.
- Profile create: auto-set TTL to 300s when short-lived checkbox enabled
  with TTL >= 3600, added validation hint and warning text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shankar0123
2026-03-28 14:28:56 -04:00
parent 1f98f31f83
commit 78c7bc16b0
5 changed files with 73 additions and 66 deletions
+7 -8
View File
@@ -29,8 +29,7 @@ function CreateAgentGroupModal({ isOpen, onClose, onSuccess, isLoading, error }:
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!name.trim()) return;
try {
await createAgentGroup({
await createAgentGroup({
name: name.trim(),
description: description.trim(),
match_os: matchOs.trim() || undefined,
@@ -45,11 +44,8 @@ function CreateAgentGroupModal({ isOpen, onClose, onSuccess, isLoading, error }:
setMatchArch('');
setMatchIpCidr('');
setMatchVersion('');
setEnabled(true);
onSuccess();
} catch (err) {
console.error('Create agent group error:', err);
}
setEnabled(true);
onSuccess();
};
if (!isOpen) return null;
@@ -249,7 +245,10 @@ export default function AgentGroupsPage() {
<CreateAgentGroupModal
isOpen={showCreate}
onClose={() => setShowCreate(false)}
onSuccess={() => {}}
onSuccess={() => {
queryClient.invalidateQueries({ queryKey: ['agent-groups'] });
setShowCreate(false);
}}
isLoading={createMutation.isPending}
error={createMutation.error ? (createMutation.error as Error).message : null}
/>