mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
46 lines
1.1 KiB
Vue
46 lines
1.1 KiB
Vue
<template>
|
|
<TextButton
|
|
v-bind="$attrs"
|
|
type="transparent"
|
|
:label="
|
|
nodePacks.length > 1
|
|
? $t('manager.uninstallSelected')
|
|
: $t('manager.uninstall')
|
|
"
|
|
:border="true"
|
|
:size="size"
|
|
class="border-red-500"
|
|
@click="uninstallItems"
|
|
/>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import TextButton from '@/components/button/TextButton.vue'
|
|
import { useComfyManagerStore } from '@/stores/comfyManagerStore'
|
|
import { ButtonSize } from '@/types/buttonTypes'
|
|
import type { components } from '@/types/comfyRegistryTypes'
|
|
|
|
type NodePack = components['schemas']['Node']
|
|
|
|
const { nodePacks, size } = defineProps<{
|
|
nodePacks: NodePack[]
|
|
size?: ButtonSize
|
|
}>()
|
|
|
|
const managerStore = useComfyManagerStore()
|
|
|
|
const uninstallPack = (item: NodePack) => {
|
|
if (!item.id) {
|
|
throw new Error('Node ID is required for uninstallation')
|
|
}
|
|
return managerStore.uninstallPack({
|
|
id: item.id,
|
|
version: item.latest_version?.version ?? ''
|
|
})
|
|
}
|
|
|
|
const uninstallItems = async () => {
|
|
if (!nodePacks?.length) return
|
|
await Promise.all(nodePacks.map(uninstallPack))
|
|
}
|
|
</script>
|