MCPcopy
hub / github.com/AgentOps-AI/agentops / BranchModal

Function BranchModal

app/dashboard/components/time-travel/BranchModal.tsx:41–151  ·  view source on GitHub ↗
({
  // llmEvents,
  setBranchModalOpen,
  project_id,
  session_id,
})

Source from the content-addressed store, hash-verified

39const TTD_QUERY_KEY = 'ttds';
40
41export const BranchModal: React.FC<BranchModalProps> = ({
42 // llmEvents,
43 setBranchModalOpen,
44 project_id,
45 session_id,
46}) => {
47 const [branchState, setBranchState] = useState<BranchState>(BranchState.EnterBranchName);
48 const [cliCommand, _] = useState<string>(``);
49 // const [showBranchModal, setShowBranchModal] = useState<boolean>(false);
50 const [branchName, setBranchName] = useState('');
51 const queryClient = useQueryClient();
52
53 const handleSaveBranch = async () => {
54 if (!branchName.trim()) {
55 toast({
56 title: 'Error',
57 description: 'Branch name cannot be empty.',
58 variant: 'destructive',
59 });
60 return;
61 }
62 setBranchState(BranchState.Loading);
63 try {
64 await fetchAuthenticatedApi('/timetravel', {
65 method: 'POST',
66 body: JSON.stringify({
67 name: branchName,
68 projectId: project_id,
69 sessionId: session_id,
70 }),
71 });
72 toast({ title: '✅ Branch Created', description: `Snapshot "${branchName}" saved.` });
73 queryClient.invalidateQueries({ queryKey: [TTD_QUERY_KEY] });
74 setBranchModalOpen(false);
75 } catch (error: any) {
76 console.error('Error saving branch:', error);
77 toast({
78 title: '❌ Error Saving Branch',
79 description: error.message,
80 variant: 'destructive',
81 });
82 } finally {
83 setBranchState(BranchState.BranchSucceeded);
84 }
85 };
86
87 return (
88 <AlertDialog>
89 <AlertDialogTrigger asChild>
90 <Button variant="outline">Create Branch</Button>
91 </AlertDialogTrigger>
92 <AlertDialogContent>
93 <AlertDialogHeader>
94 <AlertDialogTitle>Create Branch</AlertDialogTitle>
95 <AlertDialogDescription>
96 Enter a name for your branch to save your changes.
97 </AlertDialogDescription>
98 </AlertDialogHeader>

Callers

nothing calls this directly

Calls 1

toastFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…