From 02440390bcc7b058075428d0f6e8cf046356d29e Mon Sep 17 00:00:00 2001 From: jaeone94 <89377375+jaeone94@users.noreply.github.com> Date: Mon, 5 Oct 2026 16:09:40 +0900 Subject: [PATCH 01/10] feat(templates): state what the bulk download will actually fetch `Download models & open` now carries the size it is about to transfer, taken from the rows that click will really start: downloadable models sitting at idle or failed. Installed, active, complete, unavailable and manual rows are not counted, and neither are input assets, because none of them are what the button requests. If any startable row has no declared size the figure is withdrawn rather than approximated. A partial total reads as a complete one and understates what the user is approving, so the plain label is the honest answer. `modelSetupState` is replaced by the four questions it was compressing - is setup wired up, is availability still resolving, is everything already satisfied, is anything startable now - plus the size. The union could render these states, but it could not say which question any of them answered, and it had no room for a value that only exists once availability settles. Availability and the size derive from one candidate list so they cannot disagree. The bulk action stays visible but disabled while resolving: its presence tells the user downloads are part of this flow before we know the cost, and the footer does not reflow when metadata lands. Footer actions grow from sm to lg. Each new case fails under its own mutation - dropping `requirementsMet` from the gate, or collapsing the sized label, each breaks exactly one. --- .../widget/WorkflowTemplateDetail.stories.ts | 17 +++- .../widget/WorkflowTemplateDetail.test.ts | 74 ++++++++++++++-- .../custom/widget/WorkflowTemplateDetail.vue | 85 +++++++++++-------- ...kflowTemplateSelectorDialog.detail.test.ts | 2 +- .../widget/WorkflowTemplateSelectorDialog.vue | 63 ++++++++++++-- src/locales/en/main.json | 1 + .../templates/types/templateDetail.ts | 2 - 7 files changed, 186 insertions(+), 58 deletions(-) diff --git a/src/components/custom/widget/WorkflowTemplateDetail.stories.ts b/src/components/custom/widget/WorkflowTemplateDetail.stories.ts index 9edcdc66e5c..d332f5829b6 100644 --- a/src/components/custom/widget/WorkflowTemplateDetail.stories.ts +++ b/src/components/custom/widget/WorkflowTemplateDetail.stories.ts @@ -98,7 +98,11 @@ export const OpenNow: Story = { '6.77 GB' ) ], - modelSetupState: 'none' + // Detail only opens when something is missing, so the reachable 'no bulk + // action' state is an unmet requirement nothing can start automatically. + modelSetupEnabled: true, + requirementsMet: false, + modelDownloadsAvailable: false }, render: withPreview } @@ -119,7 +123,9 @@ export const Resolving: Story = { { ...unsizedVae, status: installed } ]) ], - modelSetupState: 'resolving' + modelSetupEnabled: true, + requirementsMet: false, + setupPending: true }, render: withPreview } @@ -143,7 +149,12 @@ export const DownloadableRow: Story = { '6.77 GB' ) ], - modelSetupState: 'downloadable' + modelSetupEnabled: true, + requirementsMet: false, + modelDownloadsAvailable: true, + // The checkpoint alone; the installed VAE is not part of what this click + // fetches, which is why this differs from the group's 6.77 GB declaration. + remainingModelDownloadSize: '6.46 GB' }, render: withPreview } diff --git a/src/components/custom/widget/WorkflowTemplateDetail.test.ts b/src/components/custom/widget/WorkflowTemplateDetail.test.ts index 4f604646503..2a55529dd57 100644 --- a/src/components/custom/widget/WorkflowTemplateDetail.test.ts +++ b/src/components/custom/widget/WorkflowTemplateDetail.test.ts @@ -5,10 +5,7 @@ import { describe, expect, it } from 'vitest' import { createI18n } from 'vue-i18n' import enMessages from '@/locales/en/main.json' with { type: 'json' } -import type { - TemplateDetailGroup, - TemplateModelSetupState -} from '@/platform/workflow/templates/types/templateDetail' +import type { TemplateDetailGroup } from '@/platform/workflow/templates/types/templateDetail' import WorkflowTemplateDetail from './WorkflowTemplateDetail.vue' @@ -45,16 +42,28 @@ function renderDetail({ cloudUrl, isPartnerNode = false, openPending = false, - modelSetupState = 'none' + modelSetupEnabled = false, + setupPending = false, + requirementsMet = false, + modelDownloadsAvailable = false, + remainingModelDownloadSize }: { renderedGroups?: readonly TemplateDetailGroup[] cloudUrl?: string isPartnerNode?: boolean openPending?: boolean - modelSetupState?: TemplateModelSetupState + modelSetupEnabled?: boolean + setupPending?: boolean + requirementsMet?: boolean + modelDownloadsAvailable?: boolean + remainingModelDownloadSize?: string } = {}) { const modelSetupProps = { - modelSetupState + modelSetupEnabled, + setupPending, + requirementsMet, + modelDownloadsAvailable, + remainingModelDownloadSize } return render(WorkflowTemplateDetail, { @@ -152,7 +161,10 @@ describe('WorkflowTemplateDetail', () => { it('keeps Open now available while offering Download models & open', async () => { const user = userEvent.setup() - const result = renderDetail({ modelSetupState: 'downloadable' }) + const result = renderDetail({ + modelSetupEnabled: true, + modelDownloadsAvailable: true + }) await user.click(screen.getByRole('button', { name: 'Open now' })) await user.click( @@ -167,7 +179,7 @@ describe('WorkflowTemplateDetail', () => { }) it('does not block Open now while model metadata is pending', () => { - renderDetail({ modelSetupState: 'resolving' }) + renderDetail({ modelSetupEnabled: true, setupPending: true }) expect(screen.getByRole('button', { name: 'Open now' })).toBeEnabled() expect( @@ -492,4 +504,48 @@ describe('WorkflowTemplateDetail', () => { screen.getByRole('status', { name: 'Downloaded' }) ).toHaveTextContent('Downloaded') }) + it('states the cost on the bulk action when every startable row declares one', () => { + renderDetail({ + modelSetupEnabled: true, + modelDownloadsAvailable: true, + remainingModelDownloadSize: '6.46 GB' + }) + + expect( + screen.getByRole('button', { name: 'Download models & open (6.46 GB)' }) + ).toBeInTheDocument() + }) + + it('drops the cost rather than stating a partial one', () => { + renderDetail({ + modelSetupEnabled: true, + modelDownloadsAvailable: true + }) + + expect( + screen.getByRole('button', { name: 'Download models & open' }) + ).toBeInTheDocument() + }) + + it('offers the bulk action disabled while availability is still resolving', () => { + renderDetail({ modelSetupEnabled: true, setupPending: true }) + + expect( + screen.getByRole('button', { name: 'Download models & open' }) + ).toBeDisabled() + expect(screen.getByRole('button', { name: 'Open now' })).toBeEnabled() + }) + + it('offers only Open now once every requirement is met', () => { + renderDetail({ + modelSetupEnabled: true, + requirementsMet: true, + modelDownloadsAvailable: true + }) + + expect( + screen.queryByRole('button', { name: /Download models & open/ }) + ).not.toBeInTheDocument() + expect(screen.getByRole('button', { name: 'Open now' })).toBeInTheDocument() + }) }) diff --git a/src/components/custom/widget/WorkflowTemplateDetail.vue b/src/components/custom/widget/WorkflowTemplateDetail.vue index 64104580c83..c0e2f33ddfc 100644 --- a/src/components/custom/widget/WorkflowTemplateDetail.vue +++ b/src/components/custom/widget/WorkflowTemplateDetail.vue @@ -4,10 +4,7 @@ import { useI18n } from 'vue-i18n' import WorkflowTemplateDetailGroup from '@/components/custom/widget/WorkflowTemplateDetailGroup.vue' import Button from '@/components/ui/button/Button.vue' -import type { - TemplateDetailGroup, - TemplateModelSetupState -} from '@/platform/workflow/templates/types/templateDetail' +import type { TemplateDetailGroup } from '@/platform/workflow/templates/types/templateDetail' const { title, @@ -16,7 +13,11 @@ const { cloudUrl, isPartnerNode = false, openPending = false, - modelSetupState = 'none' + modelSetupEnabled = false, + setupPending = false, + requirementsMet = false, + modelDownloadsAvailable = false, + remainingModelDownloadSize } = defineProps<{ title: string description: string @@ -24,7 +25,11 @@ const { cloudUrl?: string isPartnerNode?: boolean openPending?: boolean - modelSetupState?: TemplateModelSetupState + modelSetupEnabled?: boolean + setupPending?: boolean + requirementsMet?: boolean + modelDownloadsAvailable?: boolean + remainingModelDownloadSize?: string }>() const emit = defineEmits<{ @@ -38,7 +43,19 @@ const detailRoot = ref(null) const detailId = useId() const cloudTitleId = `${detailId}-cloud-title` const groupTitleId = (groupId: string) => `${detailId}-group-${groupId}` -const offerDownloadAndOpen = computed(() => modelSetupState !== 'none') +const offerDownloadAndOpen = computed( + () => + modelSetupEnabled && + !requirementsMet && + (setupPending || modelDownloadsAvailable) +) +const downloadModelsAndOpenLabel = computed(() => + remainingModelDownloadSize + ? t('templateWorkflows.detail.downloadModelsAndOpenWithSize', { + size: remainingModelDownloadSize + }) + : t('templateWorkflows.detail.downloadModelsAndOpen') +) defineExpose({ focus: () => detailRoot.value?.focus() @@ -135,34 +152,34 @@ defineExpose({ diff --git a/src/components/custom/widget/WorkflowTemplateSelectorDialog.detail.test.ts b/src/components/custom/widget/WorkflowTemplateSelectorDialog.detail.test.ts index 96ab2fca978..03cc34379a8 100644 --- a/src/components/custom/widget/WorkflowTemplateSelectorDialog.detail.test.ts +++ b/src/components/custom/widget/WorkflowTemplateSelectorDialog.detail.test.ts @@ -436,7 +436,7 @@ describe('WorkflowTemplateSelectorDialog detail routing', () => { }) const { user } = await clickTemplateCardAfterRender() await user.click( - await screen.findByRole('button', { name: 'Download models & open' }) + await screen.findByRole('button', { name: /^Download models & open/ }) ) await waitFor(() => { diff --git a/src/components/custom/widget/WorkflowTemplateSelectorDialog.vue b/src/components/custom/widget/WorkflowTemplateSelectorDialog.vue index 7f0010b2172..e2d4101c426 100644 --- a/src/components/custom/widget/WorkflowTemplateSelectorDialog.vue +++ b/src/components/custom/widget/WorkflowTemplateSelectorDialog.vue @@ -408,7 +408,11 @@ :cloud-url="activeDetailCloudUrl" :is-partner-node="activeDetail.template.openSource === false" :open-pending="openPending" - :model-setup-state="activeDetailModelSetupState" + model-setup-enabled + :setup-pending="activeDetail.modelSetup.pending" + :requirements-met="activeDetailModelRequirementsMet" + :model-downloads-available="activeDetailModelDownloadsAvailable" + :remaining-model-download-size="activeDetailRemainingModelDownloadSize" @open-template="onOpenTemplate" @download-models-and-open="onDownloadModelsAndOpen" @download-model="onDownloadModel" @@ -488,8 +492,7 @@ import type { import { TemplateIncludeOnDistributionEnum } from '@/platform/workflow/templates/types/template' import type { TemplateDetailGroup, - TemplateDetailRow, - TemplateModelSetupState + TemplateDetailRow } from '@/platform/workflow/templates/types/templateDetail' import { useWorkflowTemplatesStore } from '@/platform/workflow/templates/repositories/workflowTemplatesStore' import { @@ -1100,15 +1103,57 @@ function isModelDownloadCandidate( return state.status === 'idle' || state.status === 'failed' } -const activeDetailModelSetupState = computed(() => { +function isModelRowComplete( + row: TemplateModelSetupRow, + rowDownloads: TemplateModelRowDownloads +): boolean { + if (row.status === 'installed') return true + return rowDownloads.stateFor(row.model).status === 'done' +} + +/** + * The rows this click would start. `modelDownloadsAvailable` and the remaining + * size both read it, so they cannot disagree about what is being offered. + */ +const activeDetailModelDownloadCandidates = computed< + readonly TemplateModelSetupRow[] +>(() => { const setup = activeDetail.value?.modelSetup - if (!setup) return 'none' - if (setup.pending) return 'resolving' - return setup.result.rows.some((row) => + if (!setup || setup.pending) return [] + return setup.result.rows.filter((row) => isModelDownloadCandidate(row, setup.rowDownloads) ) - ? 'downloadable' - : 'none' +}) + +const activeDetailModelDownloadsAvailable = computed( + () => activeDetailModelDownloadCandidates.value.length > 0 +) + +const activeDetailModelRequirementsMet = computed(() => { + const setup = activeDetail.value?.modelSetup + return Boolean( + setup && + setup.result.rows.every((row) => + isModelRowComplete(row, setup.rowDownloads) + ) + ) +}) + +/** + * Only what this click starts, and only when every one of those rows declares a + * size. A partial total reads as complete and understates the download, so an + * unknown size withdraws the figure rather than approximating it. + */ +const activeDetailRemainingModelDownloadSize = computed(() => { + const rows = activeDetailModelDownloadCandidates.value + if (rows.length === 0) return undefined + + let totalBytes = 0 + for (const row of rows) { + if (row.fileSize === null) return undefined + totalBytes += row.fileSize + } + return formatSize(totalBytes) }) function applyTemplateModelMetadata( diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 86f96c7223c..c993d61fd27 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -1261,6 +1261,7 @@ "getItManually": "Get it manually", "usedBy": "Used by {nodes}", "downloadModelsAndOpen": "Download models & open", + "downloadModelsAndOpenWithSize": "Download models & open ({size})", "openNow": "Open now", "backToTemplates": "Back to {category}", "breadcrumbLabel": "Template navigation" diff --git a/src/platform/workflow/templates/types/templateDetail.ts b/src/platform/workflow/templates/types/templateDetail.ts index 97f1fd13898..4a3bccfa40c 100644 --- a/src/platform/workflow/templates/types/templateDetail.ts +++ b/src/platform/workflow/templates/types/templateDetail.ts @@ -27,8 +27,6 @@ export interface TemplateDetailRow { status?: TemplateDetailRowStatus } -export type TemplateModelSetupState = 'none' | 'resolving' | 'downloadable' - export interface TemplateDetailGroup { id: string label: string From 3c3b3a764d8d8b921e9cee2ca2e4739259b010ae Mon Sep 17 00:00:00 2001 From: jaeone94 <89377375+jaeone94@users.noreply.github.com> Date: Mon, 5 Oct 2026 16:16:47 +0900 Subject: [PATCH 02/10] feat(templates): give the row a grid so progress stops fighting metadata Requirement rows were a flex line, so a download's track and byte count had to share space with the model name and its type/size/used-by text. The row is now `grid-cols-[2.5rem_minmax(0,1fr)_auto]`: thumbnail, text, trailing action. Progress moves to `col-[2/-1] row-start-2` and spans the width, which is what the flex row could not give it. The track grows with that space instead of sitting at a fixed `w-24`, and the byte label holds its size beside it. The trailing cell is a fixed 32px rail for the two states that are pure icons - the idle download button and the installed check - so rows stop shifting as downloads complete. Manual links, the done badge, Retry and the unavailable and unknown badges keep their natural width; forcing them into 32px would collapse their content. Placement sits on each rendered branch rather than on the components that delegate. `ModelStatus` hands downloadable rows to `DownloadStatus`, which hands failures to `DownloadFailure`, and it is those roots that become grid items - a class on the delegating component would leave progress auto-placed in row 1. The model icon becomes `comfy--ai-model`, matching how the sidebar names the same thing. --- .../widget/WorkflowTemplateDetailGroup.vue | 8 +++---- .../WorkflowTemplateDownloadFailure.vue | 2 +- .../widget/WorkflowTemplateDownloadStatus.vue | 24 +++++++++++++------ .../widget/WorkflowTemplateModelStatus.vue | 9 ++++--- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/components/custom/widget/WorkflowTemplateDetailGroup.vue b/src/components/custom/widget/WorkflowTemplateDetailGroup.vue index 876d8377934..f071b0d481f 100644 --- a/src/components/custom/widget/WorkflowTemplateDetailGroup.vue +++ b/src/components/custom/widget/WorkflowTemplateDetailGroup.vue @@ -32,17 +32,17 @@ const emit = defineEmits<{ 'download-model': [rowId: string] }>() :key="row.id" :class=" cn( - 'flex min-h-14 items-center gap-3 rounded-md p-2', + 'grid min-h-14 grid-cols-[2.5rem_minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 rounded-md p-2', row.status?.kind === 'installed' && 'opacity-60' ) " > -