|
| 1 | +<template> |
| 2 | + <div |
| 3 | + class="relative w-full text-xs min-h-[28px] max-h-[200px] rounded-lg px-4 py-2 overflow-y-auto" |
| 4 | + > |
| 5 | + <div class="flex items-center gap-2"> |
| 6 | + <div class="flex-1 break-all flex items-center gap-2"> |
| 7 | + <span v-html="formattedText"></span> |
| 8 | + <Skeleton v-if="isParentNodeExecuting" class="!flex-1 !h-4" /> |
| 9 | + </div> |
| 10 | + </div> |
| 11 | + </div> |
| 12 | +</template> |
| 13 | + |
| 14 | +<script setup lang="ts"> |
| 15 | +import { NodeId } from '@comfyorg/litegraph' |
| 16 | +import Skeleton from 'primevue/skeleton' |
| 17 | +import { computed, onMounted, ref, watch } from 'vue' |
| 18 | +
|
| 19 | +import { useExecutionStore } from '@/stores/executionStore' |
| 20 | +import { linkifyHtml, nl2br } from '@/utils/formatUtil' |
| 21 | +
|
| 22 | +const modelValue = defineModel<string>({ required: true }) |
| 23 | +defineProps<{ |
| 24 | + widget?: object |
| 25 | +}>() |
| 26 | +
|
| 27 | +const executionStore = useExecutionStore() |
| 28 | +const isParentNodeExecuting = ref(true) |
| 29 | +const formattedText = computed(() => nl2br(linkifyHtml(modelValue.value))) |
| 30 | +
|
| 31 | +let executingNodeId: NodeId | null = null |
| 32 | +onMounted(() => { |
| 33 | + executingNodeId = executionStore.executingNodeId |
| 34 | +}) |
| 35 | +
|
| 36 | +// Watch for either a new node has starting execution or overall execution ending |
| 37 | +const stopWatching = watch( |
| 38 | + [() => executionStore.executingNode, () => executionStore.isIdle], |
| 39 | + () => { |
| 40 | + if ( |
| 41 | + executionStore.isIdle || |
| 42 | + (executionStore.executingNode && |
| 43 | + executionStore.executingNode.id !== executingNodeId) |
| 44 | + ) { |
| 45 | + isParentNodeExecuting.value = false |
| 46 | + stopWatching() |
| 47 | + } |
| 48 | + if (!executingNodeId) { |
| 49 | + executingNodeId = executionStore.executingNodeId |
| 50 | + } |
| 51 | + } |
| 52 | +) |
| 53 | +</script> |
0 commit comments