Workflow tabs

This commit is contained in:
space-nuko
2023-05-20 17:34:13 -05:00
parent a29afab9a7
commit a631d97efb
4 changed files with 32 additions and 32 deletions

View File

@@ -390,6 +390,11 @@ export default class ComfyApp {
} }
saveStateToLocalStorage() { saveStateToLocalStorage() {
if (this.activeWorkflow == null) {
notify("No active workflow!", { type: "error" })
return;
}
try { try {
uiState.update(s => { s.isSavingToLocalStorage = true; return s; }) uiState.update(s => { s.isSavingToLocalStorage = true; return s; })
const savedWorkflow = this.serialize(); const savedWorkflow = this.serialize();
@@ -738,6 +743,11 @@ export default class ComfyApp {
} }
querySave() { querySave() {
if (this.activeWorkflow == null) {
notify("No active workflow!", { type: "error" })
return;
}
const promptFilename = get(configState).promptForWorkflowName; const promptFilename = get(configState).promptForWorkflowName;
let filename = "workflow.json"; let filename = "workflow.json";
@@ -931,7 +941,13 @@ export default class ComfyApp {
/** /**
* Refresh combo list on whole nodes * 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 defs = await this.api.getNodeDefs();
const isComfyComboNode = (node: LGraphNode): node is ComfyComboNode => { const isComfyComboNode = (node: LGraphNode): node is ComfyComboNode => {

View File

@@ -41,7 +41,7 @@
} }
async function doRefreshCombos() { async function doRefreshCombos() {
await app.refreshComboInNodes(true) await app.refreshComboInNodes(undefined, true)
} }
function refreshView(event?: Event) { function refreshView(event?: Event) {
@@ -120,14 +120,11 @@
} }
function doSave(): void { function doSave(): void {
if (!app?.lGraph)
return;
app.querySave() app.querySave()
} }
function doLoad(): void { function doLoad(): void {
if (!app?.lGraph || !fileInput) if (!fileInput)
return; return;
fileInput.click(); fileInput.click();
@@ -139,9 +136,6 @@
} }
function doSaveLocal(): void { function doSaveLocal(): void {
if (!app?.lGraph)
return;
app.saveStateToLocalStorage(); app.saveStateToLocalStorage();
} }
@@ -184,22 +178,11 @@
</Pane> </Pane>
</Splitpanes> </Splitpanes>
<div id="workflow-tabs"> <div id="workflow-tabs">
<div class="workflow-tab selected"> {#each app.openedWorkflows as workflow, index}
txt2img <button class="workflow-tab" class:selected={index === app.activeWorkflowIdx}>
<!-- <Image /> --> {workflow.title}
</div> </button>
<div class="workflow-tab"> {/each}
img2img
<!-- <Image /> -->
</div>
<div class="workflow-tab">
asdflkj
<!-- <Image /> -->
</div>
<div class="workflow-tab">
asdkajw
<!-- <Image /> -->
</div>
</div> </div>
<div id="bottombar"> <div id="bottombar">
<div class="bottombar-content"> <div class="bottombar-content">

View File

@@ -162,6 +162,10 @@
position: relative; position: relative;
flex: 1 1 0%; flex: 1 1 0%;
max-width: 30vw; max-width: 30vw;
> :global(.block) {
height: 100%;
}
} }
.copy-button { .copy-button {

View File

@@ -21,13 +21,13 @@
app.runDefaultQueueAction() app.runDefaultQueueAction()
} }
function refreshCombos() { async function refreshCombos() {
navigator.vibrate(20) navigator.vibrate(20)
app.refreshComboInNodes() await app.refreshComboInNodes()
} }
function doSave(): void { function doSave(): void {
if (!app?.lGraph || !fileInput) if (!fileInput)
return; return;
navigator.vibrate(20) navigator.vibrate(20)
@@ -35,7 +35,7 @@
} }
function doLoad(): void { function doLoad(): void {
if (!app?.lGraph || !fileInput) if (!fileInput)
return; return;
navigator.vibrate(20) navigator.vibrate(20)
@@ -48,9 +48,6 @@
} }
function doSaveLocal(): void { function doSaveLocal(): void {
if (!app?.lGraph)
return;
navigator.vibrate(20) navigator.vibrate(20)
app.saveStateToLocalStorage(); app.saveStateToLocalStorage();
} }