mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 07:19:41 +00:00
feat(manager): add Try Update button for nightly packs (#7610)
## Summary - Add "Try Update" button in InfoPanel for installed nightly packs - Allows users to pull latest changes from repository for nightly versions - Nightly updates cannot be auto-detected (git hashes vs semver), so users trigger manually ## Test plan - [x] Install a nightly version of any pack - [x] Select the pack in Manager - [x] Verify "Try Update" button appears in InfoPanel - [x] Click "Try Update" and verify update request is sent https://github.com/user-attachments/assets/87443eb2-adc6-4d1c-afc9-171d301cca92 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7610-feat-manager-add-Try-Update-button-for-nightly-packs-2cd6d73d36508167adcbc07c6a07938c) by [Unito](https://www.unito.io)
This commit is contained in:
committed by
GitHub
parent
0a7515b757
commit
8d37e48849
@@ -1,19 +1,26 @@
|
||||
import { toValue } from '@vueuse/core'
|
||||
import { compare, valid } from 'semver'
|
||||
import type { MaybeRefOrGetter } from 'vue'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import type { components } from '@/types/comfyRegistryTypes'
|
||||
import { useComfyManagerStore } from '@/workbench/extensions/manager/stores/comfyManagerStore'
|
||||
|
||||
export const usePackUpdateStatus = (
|
||||
nodePack: components['schemas']['Node']
|
||||
nodePackSource: MaybeRefOrGetter<components['schemas']['Node']>
|
||||
) => {
|
||||
const { isPackInstalled, getInstalledPackVersion } = useComfyManagerStore()
|
||||
const { isPackInstalled, isPackEnabled, getInstalledPackVersion } =
|
||||
useComfyManagerStore()
|
||||
|
||||
const isInstalled = computed(() => isPackInstalled(nodePack?.id))
|
||||
// Use toValue to unwrap the source reactively inside computeds
|
||||
const nodePack = computed(() => toValue(nodePackSource))
|
||||
|
||||
const isInstalled = computed(() => isPackInstalled(nodePack.value?.id))
|
||||
const isEnabled = computed(() => isPackEnabled(nodePack.value?.id))
|
||||
const installedVersion = computed(() =>
|
||||
getInstalledPackVersion(nodePack.id ?? '')
|
||||
getInstalledPackVersion(nodePack.value?.id ?? '')
|
||||
)
|
||||
const latestVersion = computed(() => nodePack.latest_version?.version)
|
||||
const latestVersion = computed(() => nodePack.value?.latest_version?.version)
|
||||
|
||||
const isNightlyPack = computed(
|
||||
() => !!installedVersion.value && !valid(installedVersion.value)
|
||||
@@ -31,9 +38,19 @@ export const usePackUpdateStatus = (
|
||||
return compare(latestVersion.value, installedVersion.value) > 0
|
||||
})
|
||||
|
||||
/**
|
||||
* Nightly packs can always "try update" since we cannot compare git hashes
|
||||
* to determine if an update is actually available. This allows users to
|
||||
* pull the latest changes from the repository.
|
||||
*/
|
||||
const canTryNightlyUpdate = computed(
|
||||
() => isInstalled.value && isEnabled.value && isNightlyPack.value
|
||||
)
|
||||
|
||||
return {
|
||||
isUpdateAvailable,
|
||||
isNightlyPack,
|
||||
canTryNightlyUpdate,
|
||||
installedVersion,
|
||||
latestVersion
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { valid } from 'semver'
|
||||
import { computed } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
@@ -41,12 +42,30 @@ export function usePacksSelection(nodePacks: Ref<NodePack[]>) {
|
||||
return 'mixed'
|
||||
})
|
||||
|
||||
/**
|
||||
* Nightly packs are installed packs with a non-semver version (git hash)
|
||||
* that are also enabled
|
||||
*/
|
||||
const nightlyPacks = computed(() =>
|
||||
installedPacks.value.filter((pack) => {
|
||||
if (!pack.id) return false
|
||||
const version = managerStore.getInstalledPackVersion(pack.id)
|
||||
const isNightly = !!version && !valid(version)
|
||||
const isEnabled = managerStore.isPackEnabled(pack.id)
|
||||
return isNightly && isEnabled
|
||||
})
|
||||
)
|
||||
|
||||
const hasNightlyPacks = computed(() => nightlyPacks.value.length > 0)
|
||||
|
||||
return {
|
||||
installedPacks,
|
||||
notInstalledPacks,
|
||||
isAllInstalled,
|
||||
isNoneInstalled,
|
||||
isMixed,
|
||||
selectionState
|
||||
selectionState,
|
||||
nightlyPacks,
|
||||
hasNightlyPacks
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user