mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-09 01:20:09 +00:00
Add reroute migration toast (#3286)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
46
src/components/toast/RerouteMigrationToast.vue
Normal file
46
src/components/toast/RerouteMigrationToast.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<Toast group="reroute-migration">
|
||||
<template #message>
|
||||
<div class="flex flex-col items-start flex-auto">
|
||||
<div class="font-medium text-lg my-4">
|
||||
{{ t('toastMessages.migrateToLitegraphReroute') }}
|
||||
</div>
|
||||
<Button
|
||||
class="self-end"
|
||||
size="small"
|
||||
:label="t('g.migrate')"
|
||||
severity="warn"
|
||||
@click="migrateToLitegraphReroute"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</Toast>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useToast } from 'primevue'
|
||||
import Button from 'primevue/button'
|
||||
import Toast from 'primevue/toast'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import type { WorkflowJSON04 } from '@/schemas/comfyWorkflowSchema'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useWorkflowStore } from '@/stores/workflowStore'
|
||||
import { migrateLegacyRerouteNodes } from '@/utils/migration/migrateReroute'
|
||||
|
||||
const { t } = useI18n()
|
||||
const toast = useToast()
|
||||
|
||||
const workflowStore = useWorkflowStore()
|
||||
const migrateToLitegraphReroute = () => {
|
||||
const workflowJSON = app.serializeGraph() as unknown as WorkflowJSON04
|
||||
const migratedWorkflowJSON = migrateLegacyRerouteNodes(workflowJSON)
|
||||
app.loadGraphData(
|
||||
migratedWorkflowJSON,
|
||||
false,
|
||||
false,
|
||||
workflowStore.activeWorkflow
|
||||
)
|
||||
toast.removeGroup('reroute-migration')
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user