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

Function ImportWorkflowUI

web/src/components/ImportWorkflowUI.tsx:64–587  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64function ImportWorkflowUI() {
65 const [isServerSide, setIsServerSide] = React.useState(true)
66 const [importJson, setImportJson] = React.useState<string>()
67
68 const queryClient = useQueryClient()
69 const navigate = useNavigate()
70
71 React.useEffect(() => {
72 setIsServerSide(false)
73 }, [])
74
75 const getSettingsQuery = useQuery({
76 queryKey: ['settings'],
77 queryFn: async () => {
78 const response = await fetch(`/api/settings`)
79 const data = await response.json()
80 return data as Settings
81 },
82 })
83
84 const [projectName, setProjectName] = React.useState('')
85 const [importProjectDialogOpen, setImportProjectDialogOpen] =
86 React.useState(false)
87 const [projectStatusDialogOpen, setProjectStatusDialogOpen] =
88 React.useState(false)
89 const [useFixedPort, setUseFixedPort] = React.useState(false)
90 const [fixedPort, setFixedPort] = React.useState(4001)
91
92 const [missingModels, setMissingModels] = React.useState<MissingModel[]>([])
93 const [resolvedMissingModels, setResolvedMissingModels] = React.useState<
94 ResolvedMissingModelFile[]
95 >([])
96 const [resolvedAllModels, setResolvedAllModels] = useState(false)
97 const [
98 confirmOnlyPartiallyResolvingOpen,
99 setConfirmOnlyPartiallyResolvingOpen,
100 ] = useState(false)
101
102 const importProjectMutation = useMutation({
103 mutationFn: async ({
104 import_json,
105 name,
106 partiallyResolved,
107 useFixedPort,
108 port,
109 }: {
110 import_json: string
111 name: string
112 partiallyResolved?: boolean
113 useFixedPort: boolean
114 port: number
115 }) => {
116 const final_import_json = JSON.parse(import_json)
117 const uniqueFilenames = new Set()
118 const uniqueResolvedMissingModels = resolvedMissingModels.filter(
119 (model) => {
120 if (uniqueFilenames.has(model.filename)) {
121 return false

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected