mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-14 07:08:52 +00:00
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:
+11
-12
@@ -23,17 +23,13 @@ function CreateTeamModal({ isOpen, onClose, onSuccess, isLoading, error }: Creat
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim()) return;
|
||||
try {
|
||||
await createTeam({
|
||||
name: name.trim(),
|
||||
description: description.trim(),
|
||||
});
|
||||
setName('');
|
||||
setDescription('');
|
||||
onSuccess();
|
||||
} catch (err) {
|
||||
console.error('Create team error:', err);
|
||||
}
|
||||
await createTeam({
|
||||
name: name.trim(),
|
||||
description: description.trim(),
|
||||
});
|
||||
setName('');
|
||||
setDescription('');
|
||||
onSuccess();
|
||||
};
|
||||
|
||||
if (!isOpen) return null;
|
||||
@@ -167,7 +163,10 @@ export default function TeamsPage() {
|
||||
<CreateTeamModal
|
||||
isOpen={showCreate}
|
||||
onClose={() => setShowCreate(false)}
|
||||
onSuccess={() => {}}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({ queryKey: ['teams'] });
|
||||
setShowCreate(false);
|
||||
}}
|
||||
isLoading={createMutation.isPending}
|
||||
error={createMutation.error ? (createMutation.error as Error).message : null}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user