Add executionStore (#827)

* Extract execution store

* Fix executing nodes highlight

* nit

* nit

* nit
This commit is contained in:
Chenlei Hu
2024-09-14 15:15:15 +09:00
committed by GitHub
parent fef780a72f
commit f983f42c45
6 changed files with 136 additions and 100 deletions

View File

@@ -71,17 +71,6 @@ export class ComfyWorkflowsMenu {
})
}
#updateProgress = () => {
const prompt = this.app.workflowManager.activePrompt
let percent = 0
if (this.app.workflowManager.activeWorkflow === prompt?.workflow) {
const total = Object.values(prompt.nodes)
const done = total.filter(Boolean)
percent = (done.length / total.length) * 100
}
this.buttonProgress.style.width = percent + '%'
}
#updateActive = () => {
const active = this.app.workflowManager.activeWorkflow
this.button.tooltip = active.path
@@ -93,8 +82,6 @@ export class ComfyWorkflowsMenu {
this.#first = false
this.content.load()
}
this.#updateProgress()
}
#bindEvents() {
@@ -109,10 +96,6 @@ export class ComfyWorkflowsMenu {
this.unsaved = this.app.workflowManager.activeWorkflow.unsaved
})
this.app.workflowManager.addEventListener('execute', (e) => {
this.#updateProgress()
})
api.addEventListener('graphChanged', () => {
this.unsaved = true
})
@@ -371,9 +354,6 @@ export class ComfyWorkflowsContent {
app.workflowManager.addEventListener(e, () => this.updateOpen())
}
this.app.workflowManager.addEventListener('rename', () => this.load())
this.app.workflowManager.addEventListener('execute', (e) =>
this.#updateActive()
)
}
async load() {