mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 14:27:40 +00:00
Adds a workflow progress panel component underneath the `actionbar-container`. I suggest starting a review at the extraneous changes that were needed. Including but not limited to: - `get createTime()` in queueStore - `promptIdToWorkflowId`, `initializingPromptIds`, and `nodeProgressStatesByPrompt` in executionStore - `create_time` handling in v2ToV1Adapter - `pointer-events-auto` on ComfyActionbar.vue The rest of the changes should be contained under `QueueProgressOverlay.vue`, and has less of a blast radius in case something goes wrong. --------- Co-authored-by: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Jin Yi <jin12cc@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Comfy Org PR Bot <snomiao+comfy-pr@gmail.com> Co-authored-by: christian-byrne <72887196+christian-byrne@users.noreply.github.com>
28 lines
830 B
TypeScript
28 lines
830 B
TypeScript
import { clamp } from 'es-toolkit/math'
|
|
|
|
/**
|
|
* Clamp a numeric value to an integer percent in the range [0, 100].
|
|
*
|
|
* @param value Numeric value expected to be a percentage (0-100)
|
|
* @returns Integer percent between 0 and 100
|
|
*/
|
|
export const clampPercentInt = (value?: number): number => {
|
|
const v = Math.round(value ?? 0)
|
|
return clamp(v, 0, 100)
|
|
}
|
|
|
|
/**
|
|
* Format a percentage (0-100) using the provided locale with 0 fraction digits.
|
|
*
|
|
* @param locale BCP-47 locale string
|
|
* @param value0to100 Percent value in [0, 100]
|
|
* @returns Localized percent string, e.g. "42%"
|
|
*/
|
|
export const formatPercent0 = (locale: string, value0to100: number): string => {
|
|
const v = clampPercentInt(value0to100)
|
|
return new Intl.NumberFormat(locale, {
|
|
style: 'percent',
|
|
maximumFractionDigits: 0
|
|
}).format((v || 0) / 100)
|
|
}
|