Line data Source code
1 : <script setup lang="ts">
2 : import { useI18n } from 'vue-i18n'
3 : import { cn } from '@comfyorg/tailwind-utils'
4 :
5 : import Button from '@comfyorg/design-system/button/Button'
6 : import { useErrorOverlayState } from '@/platform/workflowErrors/overlay/useErrorOverlayState'
7 : import { useViewErrorsInGraph } from '@/composables/useViewErrorsInGraph'
8 : import { LINEAR_RUN_ERROR_WARNING_DESCRIPTION_ID } from '@/renderer/extensions/linearMode/linearRunErrorWarningIds'
9 :
10 2355 : const { t } = useI18n()
11 73 : const { viewErrorsInGraph } = useViewErrorsInGraph()
12 73 : const { hasError, overlayMessage, overlayTitle, overlayGroupKeys } =
13 : useErrorOverlayState()
14 73 : </script>
15 :
16 : <template>
17 75 : <div
18 : role="status"
19 : data-testid="linear-validation-warning"
20 : :class="
21 : cn(
22 : 'mb-3 flex w-full flex-col gap-2 overflow-hidden rounded-lg border border-l-4 bg-background p-3 shadow-md transition-colors duration-200 ease-in-out',
23 : hasError ? 'border-l-destructive' : 'border-l-warning'
24 : )
25 : "
26 : >
27 : <div
28 : :id="LINEAR_RUN_ERROR_WARNING_DESCRIPTION_ID"
29 : data-testid="linear-validation-warning-description"
30 : class="flex flex-col gap-2"
31 : >
32 : <div class="flex w-full items-start gap-2">
33 : <i
34 : aria-hidden="true"
35 : :class="
36 : cn(
37 : 'mt-0.5',
38 : hasError
39 : ? 'icon-[lucide--circle-x] text-destructive'
40 : : 'icon-[lucide--triangle-alert] text-warning'
41 : )
42 : "
43 : />
44 : <span class="sr-only">{{ t(hasError ? 'g.error' : 'g.warning') }}</span>
45 : <span
46 : class="min-w-0 flex-1 truncate text-sm text-foreground"
47 : :title="overlayTitle"
48 : >
49 : {{ overlayTitle }}
50 : </span>
51 : </div>
52 :
53 : <div
54 : class="flex w-full items-start gap-2"
55 : data-testid="linear-validation-warning-message"
56 : >
57 : <span class="size-4 shrink-0" aria-hidden="true" />
58 : <p
59 : class="m-0 line-clamp-3 min-w-0 flex-1 text-sm/snug wrap-break-word whitespace-pre-wrap text-muted-foreground"
60 : >
61 : {{ overlayMessage }}
62 : </p>
63 : </div>
64 : </div>
65 :
66 : <div class="flex w-full items-center justify-end pt-2">
67 : <Button
68 : variant="secondary"
69 : size="unset"
70 : class="min-h-8 rounded-lg px-3 py-2 text-xs font-normal"
71 : data-testid="linear-view-errors"
72 : @click="viewErrorsInGraph(overlayGroupKeys)"
73 : >
74 : {{ t('linearMode.error.goto') }}
75 : </Button>
76 : </div>
77 : </div>
78 : </template>
|