This commit is contained in:
pythongosssss 2024-02-18 12:17:56 +00:00
parent 895141e1ae
commit d293e5d067
6 changed files with 28 additions and 11 deletions

View File

@ -7,7 +7,7 @@ import { ComfyButtonGroup } from "../components/buttonGroup.js";
import { ComfySplitButton } from "../components/splitButton.js";
import { ComfyViewHistoryButton } from "./viewHistory.js";
import { ComfyQueueButton } from "./queueButton.js";
import { ComfyWorkflows } from "./workflows.js";
import { ComfyWorkflowsMenu } from "./workflows.js";
import { ComfyViewQueueButton } from "./viewQueue.js";
import { getInteruptButton } from "./interruptButton.js";
@ -38,7 +38,7 @@ export class ComfyAppMenu {
});
this.logo = $el("h1.comfyui-logo.sm-hide", { title: "ComfyUI" }, "ComfyUI");
this.workflows = new ComfyWorkflows();
this.workflows = new ComfyWorkflowsMenu();
this.element = $el("nav.comfyui-menu", { parent: document.body }, [
this.logo,
this.workflows.element,
@ -141,7 +141,7 @@ export class ComfyAppMenu {
* @param {string} defaultName
*/
getFilename(defaultName) {
if (this.app.ui.settings.getSettingValue("Comfy.PromptFilename")) {
if (this.app.ui.settings.getSettingValue("Comfy.PromptFilename", true)) {
defaultName = prompt("Save workflow as:", defaultName);
if (!defaultName) return;
if (!defaultName.toLowerCase().endsWith(".json")) {

View File

@ -50,8 +50,9 @@
left: var(--left);
right: var(--right);
top: var(--top);
z-index: 1000;
z-index: 2000;
max-height: calc(100vh - var(--top) - 10px);
box-shadow: 3px 3px 5px 0px rgba(0, 0, 0, 0.3);
}
.comfyui-popup:not(.open) {
@ -270,6 +271,10 @@
flex-direction: row-reverse;
}
.comfyui-workflows-button.popup-open {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.comfyui-workflows-button.unsaved {
font-style: italic;
}

View File

@ -88,9 +88,5 @@ export class ComfyQueueButton {
}
}
});
setTimeout(() => {
btn.popup.open = true;
}, 500);
}
}

View File

@ -147,7 +147,7 @@ export class ComfyViewList {
return await api.getItems(this.type);
}
getRow = (item, section) => {
getRow(item, section) {
return {
text: item.prompt[0] + "",
actions: [

View File

@ -5,7 +5,7 @@ import { prop } from "../../utils.js";
import { $el } from "../../ui.js";
import { ComfyPopup } from "../components/popup.js";
export class ComfyWorkflows {
export class ComfyWorkflowsMenu {
element = $el("div.comfyui-workflows");
get open() {
@ -32,7 +32,7 @@ export class ComfyWorkflows {
this.popup = new ComfyPopup(
{ target: this.element, classList: "comfyui-workflows-popup" },
$el("button", { style: { height: "300px" } }, "aaa")
new ComfyWorkflowsPopup().element
);
this.popup.addEventListener("change", () => {
this.button.icon = "chevron-" + (this.popup.open ? "up" : "down");
@ -43,5 +43,18 @@ export class ComfyWorkflows {
classList.unsaved = v;
this.button.classList = classList;
});
setTimeout(() => {
this.popup.open = true;
}, 500);
}
}
export class ComfyWorkflowsPopup {
element = $el("div.comfyui-workflows-panel");
constructor() {
this.element.append(new ComfyButton({ content: "New Workflow" }).element);
this.element.append(new ComfyButton({ content: "Default Workflow" }).element);
}
}

3
web/scripts/workflows.js Normal file
View File

@ -0,0 +1,3 @@
export class ComfyWorkflows {
}