-
Notifications
You must be signed in to change notification settings - Fork 490
feat(manager): add Try Update button for nightly packs #7610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1be4463
bf457ea
dcae929
b997eb6
a6d13af
2da4399
7339abf
69fe5b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,63 @@ | ||||||||||||||
| <template> | ||||||||||||||
| <IconTextButton | ||||||||||||||
| v-tooltip.top="$t('manager.tryUpdateTooltip')" | ||||||||||||||
| v-bind="$attrs" | ||||||||||||||
| type="transparent" | ||||||||||||||
| :label="computedLabel" | ||||||||||||||
| :border="true" | ||||||||||||||
| :size="size" | ||||||||||||||
| :disabled="isUpdating" | ||||||||||||||
| @click="tryUpdate" | ||||||||||||||
| > | ||||||||||||||
| <template v-if="isUpdating" #icon> | ||||||||||||||
| <DotSpinner duration="1s" :size="size === 'sm' ? 12 : 16" /> | ||||||||||||||
| </template> | ||||||||||||||
| </IconTextButton> | ||||||||||||||
| </template> | ||||||||||||||
|
|
||||||||||||||
| <script setup lang="ts"> | ||||||||||||||
| import { computed, ref } from 'vue' | ||||||||||||||
| import { useI18n } from 'vue-i18n' | ||||||||||||||
|
|
||||||||||||||
| import IconTextButton from '@/components/button/IconTextButton.vue' | ||||||||||||||
| import DotSpinner from '@/components/common/DotSpinner.vue' | ||||||||||||||
| import type { ButtonSize } from '@/types/buttonTypes' | ||||||||||||||
| import type { components } from '@/types/comfyRegistryTypes' | ||||||||||||||
| import { useComfyManagerStore } from '@/workbench/extensions/manager/stores/comfyManagerStore' | ||||||||||||||
|
|
||||||||||||||
| type NodePack = components['schemas']['Node'] | ||||||||||||||
|
|
||||||||||||||
| const { nodePack, size = 'sm' } = defineProps<{ | ||||||||||||||
| nodePack: NodePack | ||||||||||||||
| size?: ButtonSize | ||||||||||||||
| }>() | ||||||||||||||
|
|
||||||||||||||
| const { t } = useI18n() | ||||||||||||||
| const managerStore = useComfyManagerStore() | ||||||||||||||
|
|
||||||||||||||
| const isUpdating = ref(false) | ||||||||||||||
|
|
||||||||||||||
| async function tryUpdate() { | ||||||||||||||
| if (!nodePack.id) { | ||||||||||||||
| console.warn('Pack missing required id:', nodePack) | ||||||||||||||
| return | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| isUpdating.value = true | ||||||||||||||
| try { | ||||||||||||||
| await managerStore.updatePack.call({ | ||||||||||||||
| id: nodePack.id, | ||||||||||||||
| version: 'nightly' | ||||||||||||||
| }) | ||||||||||||||
| managerStore.updatePack.clear() | ||||||||||||||
| } catch (error) { | ||||||||||||||
| console.error('Nightly update failed:', error) | ||||||||||||||
| } finally { | ||||||||||||||
| isUpdating.value = false | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const computedLabel = computed(() => | ||||||||||||||
| isUpdating.value ? t('g.updating') : t('manager.tryUpdate') | ||||||||||||||
| ) | ||||||||||||||
|
Comment on lines
+60
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Localization key Looking at 🔎 Fix the interpolation: const computedLabel = computed(() =>
- isUpdating.value ? t('g.updating') : t('manager.tryUpdate')
+ isUpdating.value ? t('g.updating', { id: nodePack.name || nodePack.id }) : t('manager.tryUpdate')
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| </script> | ||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,12 +18,27 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div v-if="isMixed" class="text-sm text-neutral-500"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ $t('manager.mixedSelectionMessage') }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <!-- All installed: Show uninstall button --> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PackUninstallButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <!-- All installed: Show update (if nightly) and uninstall buttons --> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-else-if="isAllInstalled" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="md" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :node-packs="installedPacks" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class="flex w-full justify-center gap-2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <IconTextButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-if="hasNightlyPacks" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-tooltip.top="$t('manager.tryUpdateTooltip')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type="transparent" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :label="updateSelectedLabel" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :border="true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="md" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :disabled="isUpdatingSelected" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click="updateSelectedNightlyPacks" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <template v-if="isUpdatingSelected" #icon> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <DotSpinner duration="1s" :size="16" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </IconTextButton> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PackUninstallButton size="md" :node-packs="installedPacks" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <!-- None installed: Show install button --> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PackInstallButton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-else-if="isNoneInstalled" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -55,8 +70,11 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <script setup lang="ts"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useAsyncState } from '@vueuse/core' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { computed, onUnmounted, provide, toRef } from 'vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { computed, onUnmounted, provide, ref, toRef } from 'vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useI18n } from 'vue-i18n' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import IconTextButton from '@/components/button/IconTextButton.vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import DotSpinner from '@/components/common/DotSpinner.vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useComfyRegistryStore } from '@/stores/comfyRegistryStore' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { components } from '@/types/comfyRegistryTypes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import PackStatusMessage from '@/workbench/extensions/manager/components/manager/PackStatusMessage.vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -68,13 +86,16 @@ import PackIconStacked from '@/workbench/extensions/manager/components/manager/p | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { usePacksSelection } from '@/workbench/extensions/manager/composables/nodePack/usePacksSelection' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { usePacksStatus } from '@/workbench/extensions/manager/composables/nodePack/usePacksStatus' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useConflictDetection } from '@/workbench/extensions/manager/composables/useConflictDetection' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useComfyManagerStore } from '@/workbench/extensions/manager/stores/comfyManagerStore' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { ConflictDetail } from '@/workbench/extensions/manager/types/conflictDetectionTypes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ImportFailedKey } from '@/workbench/extensions/manager/types/importFailedTypes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { nodePacks } = defineProps<{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nodePacks: components['schemas']['Node'][] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { t } = useI18n() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const managerStore = useComfyManagerStore() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const nodePacksRef = toRef(() => nodePacks) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Use new composables for cleaner code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -83,11 +104,40 @@ const { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| notInstalledPacks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isAllInstalled, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isNoneInstalled, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isMixed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isMixed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nightlyPacks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasNightlyPacks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } = usePacksSelection(nodePacksRef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { hasImportFailed, overallStatus } = usePacksStatus(nodePacksRef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Batch update state for nightly packs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isUpdatingSelected = ref(false) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async function updateSelectedNightlyPacks() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (nightlyPacks.value.length === 0) return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isUpdatingSelected.value = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const pack of nightlyPacks.value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!pack.id) continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await managerStore.updatePack.call({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: pack.id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| version: 'nightly' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| managerStore.updatePack.clear() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.error('Batch nightly update failed:', error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } finally { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+130
to
+132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider surfacing batch update errors to the user. Currently, errors are only logged to the console. Users may not realize an update failed. Consider using a toast notification or similar feedback mechanism to inform users when a batch update fails. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isUpdatingSelected.value = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+117
to
+135
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move If an error occurs during the batch update loop, 🔎 Apply this diff to ensure consistent cleanup: async function updateSelectedNightlyPacks() {
if (nightlyPacks.value.length === 0) return
isUpdatingSelected.value = true
try {
for (const pack of nightlyPacks.value) {
if (!pack.id) continue
await managerStore.updatePack.call({
id: pack.id,
version: 'nightly'
})
}
- managerStore.updatePack.clear()
} catch (error) {
console.error('Batch nightly update failed:', error)
} finally {
+ managerStore.updatePack.clear()
isUpdatingSelected.value = false
}
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const updateSelectedLabel = computed(() => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isUpdatingSelected.value ? t('g.updating') : t('manager.updateSelected') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { checkNodeCompatibility } = useConflictDetection() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { getNodeDefs } = useComfyRegistryStore() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Error handling could provide user feedback.
The
tryUpdatefunction catches errors but only logs to console. Consider showing a toast notification to inform users when the update fails.🔎 Suggested improvement for user feedback:
🤖 Prompt for AI Agents