-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToast.vue
More file actions
165 lines (153 loc) · 4.01 KB
/
Copy pathToast.vue
File metadata and controls
165 lines (153 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<script setup lang="ts">
const toast = useToast()
const colors = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'neutral'] as const
function showColor(color: typeof colors[number]) {
toast.add({
title: `${color.charAt(0).toUpperCase() + color.slice(1)} notification`,
description: 'Agent runtime event dispatched.',
icon: 'i-material-symbols-notifications-outline',
color,
duration: 4000,
})
}
function showJobAccepted() {
toast.add({
title: 'Job accepted',
description: 'Runtime lease granted — job-7f3a is now executing.',
icon: 'i-material-symbols-check-circle-outline',
color: 'success',
duration: 5000,
})
}
function showLeaseExpiring() {
toast.add({
title: 'Lease expiring',
description: 'Session lease for agent-42 expires in 30 s.',
icon: 'i-material-symbols-timer-outline',
color: 'warning',
duration: 0,
actions: [
{ label: 'Renew', color: 'warning' },
{ label: 'Dismiss', variant: 'ghost', color: 'neutral' },
],
})
}
function showSessionError() {
toast.add({
title: 'Session terminated',
description: 'Unhandled exception in trace span trace-c9d1.',
icon: 'i-material-symbols-error-outline',
color: 'error',
duration: 6000,
actions: [
{ label: 'View logs', color: 'error', variant: 'outline' },
],
})
}
function showHorizontal() {
toast.add({
title: 'Event stream connected',
description: 'Receiving runtime events from cluster-east-1.',
icon: 'i-material-symbols-stream-outline',
color: 'info',
orientation: 'horizontal',
duration: 5000,
})
}
function showNoProgress() {
toast.add({
title: 'Agent queued',
description: 'Waiting for an available runtime slot.',
icon: 'i-material-symbols-hourglass-outline',
color: 'neutral',
progress: false,
duration: 4000,
})
}
function showNoClose() {
toast.add({
title: 'Trace recorded',
description: 'Span data written to the observability store.',
icon: 'i-material-symbols-account-tree-outline',
color: 'secondary',
close: false,
duration: 3000,
})
}
</script>
<template>
<div class="flex flex-col gap-8">
<GallerySection title="Colors">
<div class="flex flex-wrap gap-2">
<UButton
v-for="c in colors"
:key="c"
:color="c"
variant="soft"
class="capitalize"
@click="showColor(c)"
>
{{ c }}
</UButton>
</div>
</GallerySection>
<GallerySection title="With actions">
<div class="flex flex-wrap gap-2">
<UButton
icon="i-material-symbols-check-circle-outline"
color="success"
variant="soft"
@click="showJobAccepted"
>
Job accepted
</UButton>
<UButton
icon="i-material-symbols-timer-outline"
color="warning"
variant="soft"
@click="showLeaseExpiring"
>
Lease expiring (sticky)
</UButton>
<UButton
icon="i-material-symbols-error-outline"
color="error"
variant="soft"
@click="showSessionError"
>
Session error
</UButton>
</div>
</GallerySection>
<GallerySection title="Orientation">
<UButton
icon="i-material-symbols-stream-outline"
color="info"
variant="soft"
@click="showHorizontal"
>
Horizontal layout
</UButton>
</GallerySection>
<GallerySection title="States">
<div class="flex flex-wrap gap-2">
<UButton
icon="i-material-symbols-hourglass-outline"
color="neutral"
variant="outline"
@click="showNoProgress"
>
No progress bar
</UButton>
<UButton
icon="i-material-symbols-account-tree-outline"
color="secondary"
variant="outline"
@click="showNoClose"
>
No close button
</UButton>
</div>
</GallerySection>
</div>
</template>