Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove question mark badge on folders in model library tree
  • Loading branch information
huchenlei committed Oct 10, 2024
commit 1f2bd4e2e94dcbba9755784e4255e4918a141afc
15 changes: 13 additions & 2 deletions src/components/common/TreeExplorerTreeNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<slot name="after-label" :node="props.node"></slot>
</span>
<Badge
v-if="!props.node.leaf"
:value="props.node.badgeText ?? props.node.totalLeaves"
v-if="showNodeBadgeText"
:value="nodeBadgeText"
severity="secondary"
class="leaf-count-badge"
/>
Expand Down Expand Up @@ -62,6 +62,17 @@ const emit = defineEmits<{
(e: 'dragEnd', node: RenderedTreeExplorerNode): void
}>()

const nodeBadgeText = computed<string>(() => {
if (props.node.leaf) {
return ''
}
if (props.node.badgeText !== undefined && props.node.badgeText !== null) {
return props.node.badgeText
}
return props.node.totalLeaves.toString()
})
const showNodeBadgeText = computed<boolean>(() => nodeBadgeText.value !== '')

const labelEditable = computed<boolean>(() => !!props.node.handleRename)
const renameEditingNode =
inject<Ref<TreeExplorerNode | null>>('renameEditingNode')
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar/tabs/ModelLibrarySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const renderedRoot = computed<TreeExplorerNode<ComfyModelDef>>(() => {
if (onlyChild.data.file_name === '(No Content)') {
return '0'
} else if (onlyChild.data.file_name === 'Loading') {
return '?'
return ''
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/treeExplorerTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface RenderedTreeExplorerNode<T = any> extends TreeExplorerNode<T> {
type: 'folder' | 'node'
/** Total number of leaves in the subtree */
totalLeaves: number
/** Text to display on the leaf-count badge */
/** Text to display on the leaf-count badge. Empty string means no badge. */
badgeText?: string
}

Expand Down