mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-30 12:59:55 +00:00
Remove refresh button when all nodes are selected (#3690)
This commit is contained in:
@@ -99,18 +99,6 @@ test.describe('Selection Toolbox', () => {
|
||||
).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('displays refresh button in toolbox when all nodes are selected', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
// Select all nodes
|
||||
await comfyPage.page.focus('canvas')
|
||||
await comfyPage.page.keyboard.press('Control+A')
|
||||
|
||||
await expect(
|
||||
comfyPage.page.locator('.selection-toolbox .pi-refresh')
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('displays bypass button in toolbox when nodes are selected', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import type { IWidget } from '@comfyorg/litegraph'
|
||||
import type { IWidget, LGraphNode } from '@comfyorg/litegraph'
|
||||
import { computed, ref, watchEffect } from 'vue'
|
||||
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useCanvasStore } from '@/stores/graphStore'
|
||||
import { isLGraphNode } from '@/utils/litegraphUtil'
|
||||
|
||||
@@ -20,14 +18,10 @@ const isRefreshableWidget = (widget: IWidget): widget is RefreshableWidget =>
|
||||
*/
|
||||
export const useRefreshableSelection = () => {
|
||||
const graphStore = useCanvasStore()
|
||||
const commandStore = useCommandStore()
|
||||
const selectedNodes = ref<LGraphNode[]>([])
|
||||
const isAllNodesSelected = ref(false)
|
||||
|
||||
watchEffect(() => {
|
||||
selectedNodes.value = graphStore.selectedItems.filter(isLGraphNode)
|
||||
isAllNodesSelected.value =
|
||||
graphStore.canvas?.graph?.nodes?.every((node) => !!node.selected) ?? false
|
||||
})
|
||||
|
||||
const refreshableWidgets = computed(() =>
|
||||
@@ -36,18 +30,12 @@ export const useRefreshableSelection = () => {
|
||||
)
|
||||
)
|
||||
|
||||
const isRefreshable = computed(
|
||||
() => refreshableWidgets.value.length > 0 || isAllNodesSelected.value
|
||||
)
|
||||
const isRefreshable = computed(() => refreshableWidgets.value.length > 0)
|
||||
|
||||
async function refreshSelected() {
|
||||
if (!isRefreshable.value) return
|
||||
|
||||
if (isAllNodesSelected.value) {
|
||||
await commandStore.execute('Comfy.RefreshNodeDefinitions')
|
||||
} else {
|
||||
await Promise.all(refreshableWidgets.value.map((item) => item.refresh()))
|
||||
}
|
||||
await Promise.all(refreshableWidgets.value.map((item) => item.refresh()))
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user