Restore parameters from modal

This commit is contained in:
space-nuko
2023-06-05 13:05:46 -05:00
parent 7e4af6e22f
commit 2dcf5de074
3 changed files with 28 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
import JsonView from "./JsonView.svelte";
import type { ZodError } from "zod";
import { concatRestoreParams, getWorkflowRestoreParams, getWorkflowRestoreParamsUsingLayout, type RestoreParamTargets, type RestoreParamWorkflowNodeTargets } from "$lib/restoreParameters";
import notify from "$lib/notify";
const splitLength = 50;
@@ -38,9 +39,12 @@
$: {
restoreParams = {}
// TODO exclude from both history and journey patch
const noExclude = true;
// TODO other sources than serialized workflow
if (workflow != null) {
const workflowParams = getWorkflowRestoreParamsUsingLayout(workflow.workflow, workflow.layout)
const workflowParams = getWorkflowRestoreParamsUsingLayout(workflow.workflow, workflow.layout, noExclude)
console.error("GETPARMS", workflowParams)
restoreParams = concatRestoreParams(restoreParams, workflowParams);
}
@@ -158,6 +162,24 @@
}
function doRestoreParams(e: CustomEvent) {
const activeWorkflow = workflowState.getActiveWorkflow();
if (activeWorkflow == null) {
notify("No active workflow!", { type: "error" })
}
// TODO other param sources
const patch: RestoreParamWorkflowNodeTargets = {};
for (const [nodeID, sources] of Object.entries(restoreParams)) {
for (const source of sources) {
if (source.type === "workflow") {
patch[nodeID] = source;
}
}
}
activeWorkflow.applyParamsPatch(patch);
closeModal();
}
</script>

View File

@@ -62,7 +62,7 @@ function convertEntry(entry: QueueEntry, status: QueueUIEntryStatus): QueueUIEnt
const subgraphs: string[] | null = entry.extraData?.extra_pnginfo?.comfyBoxPrompt?.subgraphs;
let message = "Prompt";
let message = `#${entry.number}: Prompt`;
if (entry.extraData?.workflowTitle != null) {
message = `${entry.extraData.workflowTitle}`
}

View File

@@ -13,6 +13,10 @@ body {
height: 100%;
margin: 0px;
font-family: Arial;
display: block;
position: absolute;
top: 0;
left: 0;
}
:root {