mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-06 16:10:09 +00:00
workaround placeholder filename
This commit is contained in:
@@ -218,10 +218,7 @@ const renderTreeNode = (
|
||||
node: TreeNode,
|
||||
type: WorkflowTreeType
|
||||
): TreeExplorerNode<ComfyWorkflow> => {
|
||||
const children = node.children
|
||||
?.filter((child) => !child.data?.isFolderPlaceholder)
|
||||
?.map((child) => renderTreeNode(child, type))
|
||||
|
||||
const children = node.children?.map((child) => renderTreeNode(child, type))
|
||||
const workflow: ComfyWorkflow = node.data
|
||||
|
||||
function handleClick(this: TreeExplorerNode<ComfyWorkflow>, e: MouseEvent) {
|
||||
@@ -232,7 +229,7 @@ const renderTreeNode = (
|
||||
}
|
||||
}
|
||||
|
||||
const actions = node.leaf
|
||||
const actions: Partial<TreeExplorerNode<ComfyWorkflow>> = node.leaf
|
||||
? {
|
||||
handleClick,
|
||||
async handleRename(newName: string) {
|
||||
@@ -262,7 +259,14 @@ const renderTreeNode = (
|
||||
},
|
||||
draggable: true
|
||||
}
|
||||
: { handleClick }
|
||||
: {
|
||||
handleClick,
|
||||
async handleAddFolder(folderName: string) {
|
||||
const parentPath = this.key.replace(/^root\//, '')
|
||||
const folderPath = parentPath + '/' + folderName
|
||||
await workflowStore.createFolder(folderPath)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
key: node.key,
|
||||
|
||||
@@ -13,6 +13,7 @@ import { UserFile } from './userFileStore'
|
||||
|
||||
export class ComfyWorkflow extends UserFile {
|
||||
static readonly basePath = 'workflows/'
|
||||
static readonly folderPlaceholderFilename = 'folder.index'
|
||||
|
||||
/**
|
||||
* The change tracker for the workflow. Non-reactive raw object.
|
||||
@@ -32,7 +33,9 @@ export class ComfyWorkflow extends UserFile {
|
||||
}
|
||||
|
||||
get key() {
|
||||
return this.path.substring(ComfyWorkflow.basePath.length)
|
||||
const key = this.isFolderPlaceholder ? this.directory + '/' : this.path
|
||||
|
||||
return key.substring(ComfyWorkflow.basePath.length)
|
||||
}
|
||||
|
||||
get activeState(): ComfyWorkflowJSON | null {
|
||||
@@ -59,7 +62,7 @@ export class ComfyWorkflow extends UserFile {
|
||||
* Whether the workflow is a folder placeholder.
|
||||
*/
|
||||
get isFolderPlaceholder(): boolean {
|
||||
return this.filename === '.index'
|
||||
return this.fullFilename === ComfyWorkflow.folderPlaceholderFilename
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,7 +444,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
|
||||
: folderPath
|
||||
|
||||
// Create the full path including the reserved index file
|
||||
const indexFilePath = `${ComfyWorkflow.basePath}${normalizedPath}/.index`
|
||||
const indexFilePath = `${ComfyWorkflow.basePath}${normalizedPath}/${ComfyWorkflow.folderPlaceholderFilename}`
|
||||
|
||||
// Create an empty file to represent the folder
|
||||
const resp = await api.storeUserData(indexFilePath, '', {
|
||||
|
||||
Reference in New Issue
Block a user