|
53 | 53 | <script setup lang="ts"> |
54 | 54 | import Button from 'primevue/button' |
55 | 55 | import ListBox from 'primevue/listbox' |
56 | | -import { computed } from 'vue' |
| 56 | +import { computed, nextTick, watch } from 'vue' |
| 57 | +import { useI18n } from 'vue-i18n' |
57 | 58 |
|
58 | 59 | import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue' |
59 | 60 | import MissingCoreNodesMessage from '@/components/dialog/content/MissingCoreNodesMessage.vue' |
60 | 61 | import { useMissingNodes } from '@/composables/nodePack/useMissingNodes' |
61 | 62 | import { useManagerState } from '@/composables/useManagerState' |
62 | 63 | import { useComfyManagerStore } from '@/stores/comfyManagerStore' |
| 64 | +import { useDialogStore } from '@/stores/dialogStore' |
| 65 | +import { useToastStore } from '@/stores/toastStore' |
63 | 66 | import type { MissingNodeType } from '@/types/comfy' |
64 | 67 | import { ManagerTab } from '@/types/comfyManagerTypes' |
65 | 68 |
|
@@ -121,6 +124,35 @@ const openManager = async () => { |
121 | 124 | showToastOnLegacyError: true |
122 | 125 | }) |
123 | 126 | } |
| 127 | +
|
| 128 | +const { t } = useI18n() |
| 129 | +const dialogStore = useDialogStore() |
| 130 | +
|
| 131 | +// Computed to check if all missing nodes have been installed |
| 132 | +const allMissingNodesInstalled = computed(() => { |
| 133 | + return ( |
| 134 | + !isLoading.value && |
| 135 | + !isInstalling.value && |
| 136 | + missingNodePacks.value?.length === 0 |
| 137 | + ) |
| 138 | +}) |
| 139 | +// Watch for completion and close dialog |
| 140 | +watch(allMissingNodesInstalled, async (allInstalled) => { |
| 141 | + if (allInstalled) { |
| 142 | + // Use nextTick to ensure state updates are complete |
| 143 | + await nextTick() |
| 144 | +
|
| 145 | + dialogStore.closeDialog({ key: 'global-load-workflow-warning' }) |
| 146 | +
|
| 147 | + // Show success toast |
| 148 | + useToastStore().add({ |
| 149 | + severity: 'success', |
| 150 | + summary: t('g.success'), |
| 151 | + detail: t('manager.allMissingNodesInstalled'), |
| 152 | + life: 3000 |
| 153 | + }) |
| 154 | + } |
| 155 | +}) |
124 | 156 | </script> |
125 | 157 |
|
126 | 158 | <style scoped> |
|
0 commit comments