From a631d97efba8cb993a51662c776c0efb5b82bec9 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Sat, 20 May 2023 17:34:13 -0500 Subject: [PATCH] Workflow tabs --- src/lib/components/ComfyApp.ts | 18 +++++++++++- src/lib/components/ComfyWorkflowsView.svelte | 31 +++++--------------- src/lib/components/PromptDisplay.svelte | 4 +++ src/mobile/GenToolbar.svelte | 11 +++---- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/lib/components/ComfyApp.ts b/src/lib/components/ComfyApp.ts index 7a78573..d611768 100644 --- a/src/lib/components/ComfyApp.ts +++ b/src/lib/components/ComfyApp.ts @@ -390,6 +390,11 @@ export default class ComfyApp { } saveStateToLocalStorage() { + if (this.activeWorkflow == null) { + notify("No active workflow!", { type: "error" }) + return; + } + try { uiState.update(s => { s.isSavingToLocalStorage = true; return s; }) const savedWorkflow = this.serialize(); @@ -738,6 +743,11 @@ export default class ComfyApp { } querySave() { + if (this.activeWorkflow == null) { + notify("No active workflow!", { type: "error" }) + return; + } + const promptFilename = get(configState).promptForWorkflowName; let filename = "workflow.json"; @@ -931,7 +941,13 @@ export default class ComfyApp { /** * Refresh combo list on whole nodes */ - async refreshComboInNodes(workflow: ComfyWorkflow, flashUI: boolean = false) { + async refreshComboInNodes(workflow?: ComfyWorkflow, flashUI: boolean = false) { + workflow ||= this.activeWorkflow; + if (workflow == null) { + notify("No active workflow!", { type: "error" }) + return + } + const defs = await this.api.getNodeDefs(); const isComfyComboNode = (node: LGraphNode): node is ComfyComboNode => { diff --git a/src/lib/components/ComfyWorkflowsView.svelte b/src/lib/components/ComfyWorkflowsView.svelte index 8604dcc..92fee8d 100644 --- a/src/lib/components/ComfyWorkflowsView.svelte +++ b/src/lib/components/ComfyWorkflowsView.svelte @@ -41,7 +41,7 @@ } async function doRefreshCombos() { - await app.refreshComboInNodes(true) + await app.refreshComboInNodes(undefined, true) } function refreshView(event?: Event) { @@ -120,14 +120,11 @@ } function doSave(): void { - if (!app?.lGraph) - return; - app.querySave() } function doLoad(): void { - if (!app?.lGraph || !fileInput) + if (!fileInput) return; fileInput.click(); @@ -139,9 +136,6 @@ } function doSaveLocal(): void { - if (!app?.lGraph) - return; - app.saveStateToLocalStorage(); } @@ -184,22 +178,11 @@
-
- txt2img - -
-
- img2img - -
-
- asdflkj - -
-
- asdkajw - -
+ {#each app.openedWorkflows as workflow, index} + + {/each}
diff --git a/src/lib/components/PromptDisplay.svelte b/src/lib/components/PromptDisplay.svelte index 9bb539e..a11e245 100644 --- a/src/lib/components/PromptDisplay.svelte +++ b/src/lib/components/PromptDisplay.svelte @@ -162,6 +162,10 @@ position: relative; flex: 1 1 0%; max-width: 30vw; + + > :global(.block) { + height: 100%; + } } .copy-button { diff --git a/src/mobile/GenToolbar.svelte b/src/mobile/GenToolbar.svelte index fb2c9ac..38ca67d 100644 --- a/src/mobile/GenToolbar.svelte +++ b/src/mobile/GenToolbar.svelte @@ -21,13 +21,13 @@ app.runDefaultQueueAction() } - function refreshCombos() { + async function refreshCombos() { navigator.vibrate(20) - app.refreshComboInNodes() + await app.refreshComboInNodes() } function doSave(): void { - if (!app?.lGraph || !fileInput) + if (!fileInput) return; navigator.vibrate(20) @@ -35,7 +35,7 @@ } function doLoad(): void { - if (!app?.lGraph || !fileInput) + if (!fileInput) return; navigator.vibrate(20) @@ -48,9 +48,6 @@ } function doSaveLocal(): void { - if (!app?.lGraph) - return; - navigator.vibrate(20) app.saveStateToLocalStorage(); }