From 9721fdbd0aca12ad18feafaa89eafafcea959bfe Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Sun, 17 May 2026 05:31:06 +0200 Subject: [PATCH] refactor(web): extract renderSearchControls method and expose search UI alongside download source Move the inline search-control HTML block into a dedicated renderSearchControls() method on LinkerManagerDialog so the search bar can be reused from multiple code paths. Previously, the search controls were only rendered when no download source was known. Now they are also shown when a download URL exists, giving users the ability to run a search alongside the resolved download source. Also normalises line endings on one affected line. --- web/linker.js | 72 +++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/web/linker.js b/web/linker.js index d125eda..bcad3d0 100644 --- a/web/linker.js +++ b/web/linker.js @@ -244,7 +244,7 @@ class LinkerManagerDialog extends ComfyDialog { this.syncSearchSourceUi(missing, container); } - renderDownloadSourceSection(missing, downloadSource) { + renderDownloadSourceSection(missing, downloadSource) { const filename = missing.original_path?.split('/').pop()?.split('\\').pop() || ''; const isFromWorkflow = downloadSource.url_source === 'workflow'; const isCivitaiSource = downloadSource.source === 'civitai'; @@ -346,6 +346,30 @@ class LinkerManagerDialog extends ComfyDialog { return html; } + renderSearchControls(missing) { + const searchSourcesId = `search-sources-${missing.node_id}-${missing.widget_index}`; + const searchSourceSelectId = `search-source-select-${missing.node_id}-${missing.widget_index}`; + + let html = `
`; + html += ``; + html += `
`; + html += ``; + html += ``; + html += `
`; + html += `
`; + return html; + } + renderProgressWithAction({ percent = 0, leftText = '', @@ -3842,37 +3866,23 @@ class LinkerManagerDialog extends ComfyDialog { html += `Exact local match available`; html += ``; html += ``; - } else if (downloadSource && downloadSource.url) { - html += this.renderDownloadSourceSection(missing, downloadSource); - } else if (missing.is_urn) { - html += `
`; - html += `
Resolving CivitAI download for this URN...
`; + } else if (downloadSource && downloadSource.url) { + html += this.renderDownloadSourceSection(missing, downloadSource); + html += `
`; + html += this.renderSearchControls(missing); + html += `
`; + html += `
`; + } else if (missing.is_urn) { + html += `
`; + html += `
Resolving CivitAI download for this URN...
`; html += `
`; - } else { - // No known download - offer search - html += `
`; - const searchSourcesId = `search-sources-${missing.node_id}-${missing.widget_index}`; - const searchSourceSelectId = `search-source-select-${missing.node_id}-${missing.widget_index}`; - html += `
`; - html += ``; - html += `
`; - html += ``; - html += ``; - html += `
`; - html += `
`; - html += this.renderDownloadTargetControls(missing, missing.category || 'checkpoints'); - html += `
`; - html += `
`; + } else { + // No known download - offer search + html += `
`; + html += this.renderSearchControls(missing); + html += this.renderDownloadTargetControls(missing, missing.category || 'checkpoints'); + html += `
`; + html += `
`; } // Progress container (for downloads)