MCPcopy Create free account
hub / github.com/ComfyWorkflows/ComfyUI-Launcher / ProjectCard

Function ProjectCard

web/src/components/ProjectCard.tsx:48–251  ·  view source on GitHub ↗
({ item, settings }: ProjectCardProps)

Source from the content-addressed store, hash-verified

46}
47
48function ProjectCard({ item, settings }: ProjectCardProps) {
49 const queryClient = useQueryClient()
50
51 const [deleteProjectDialogOpen, setDeleteProjectDialogOpen] =
52 React.useState(false)
53
54 const [projectOperation, setProjectOperation] = React.useState<
55 'launch' | 'stop' | 'delete'
56 >()
57 const [projectStatusDialogOpen, setProjectStatusDialogOpen] =
58 React.useState(false)
59
60 const launchProjectMutation = useMutation({
61 mutationFn: async () => {
62 const response = await fetch(`/api/projects/${item.id}/start`, {
63 method: 'POST',
64 headers: {
65 'Content-Type': 'application/json',
66 },
67 })
68 const data = await response.json()
69 return data
70 },
71 onSettled: () => {
72 queryClient.invalidateQueries({ queryKey: ['projects'] })
73 },
74 })
75
76 const stopProjectMutation = useMutation({
77 mutationFn: async () => {
78 const response = await fetch(`/api/projects/${item.id}/stop`, {
79 method: 'POST',
80 headers: {
81 'Content-Type': 'application/json',
82 },
83 })
84 const data = await response.json()
85 return data
86 },
87 onSettled: () => {
88 queryClient.invalidateQueries({ queryKey: ['projects'] })
89 },
90 })
91
92 const deleteProjectMutation = useMutation({
93 mutationFn: async () => {
94 const response = await fetch(`/api/projects/${item.id}/delete`, {
95 method: 'POST',
96 headers: {
97 'Content-Type': 'application/json',
98 },
99 })
100 const data = await response.json()
101 return data
102 },
103 onSettled: () => {
104 queryClient.invalidateQueries({ queryKey: ['projects'] })
105 },

Callers

nothing calls this directly

Calls 1

getProjectURLFunction · 0.85

Tested by

no test coverage detected