Enhanced notification & configure default queue action

This commit is contained in:
space-nuko
2023-05-09 16:01:41 -05:00
parent 30198c3808
commit e107b65db7
19 changed files with 412 additions and 103 deletions

View File

@@ -0,0 +1,47 @@
import layoutState from "$lib/stores/layoutState"
import { BuiltInSlotType, LGraphNode, LiteGraph, type ITextWidget, type OptionalSlots, type PropertyLayout, type SlotLayout, type Vector2 } from "@litegraph-ts/core"
export interface ComfyConfigureQueuePromptButtonProperties extends Record<string, any> {
}
export default class ComfyConfigureQueuePromptButton extends LGraphNode {
override properties: ComfyConfigureQueuePromptButtonProperties = {
}
static slotLayout: SlotLayout = {
inputs: [
{ name: "config", type: BuiltInSlotType.ACTION },
],
}
static propertyLayout: PropertyLayout = [
]
static optionalSlots: OptionalSlots = {
}
override size: Vector2 = [60, 30];
constructor(title?: string) {
super(title)
}
override onAction(action: any, param: any, options: { action_call?: string }) {
if (action === "config" && param != null) {
layoutState.update(state => {
if (typeof param === "string")
state.attrs.queuePromptButtonName = param || ""
else if (typeof param === "object" && "buttonName" in param)
state.attrs.queuePromptButtonName = param.buttonName || ""
return state
})
}
}
}
LiteGraph.registerNodeType({
class: ComfyConfigureQueuePromptButton,
title: "Comfy.ConfigureQueuePromptButton",
desc: "Sets the properties of the global queue prompt button",
type: "workflow/configure_queue_prompt_button"
})