@nvent-addon/app 0.5.14 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -2
- package/dist/runtime/app/components/DashboardCard.d.vue.ts +1 -1
- package/dist/runtime/app/components/DashboardCard.vue.d.ts +1 -1
- package/dist/runtime/app/composables/useWorkers.d.ts +57 -0
- package/dist/runtime/app/composables/useWorkers.js +42 -0
- package/dist/runtime/app/pages/dashboard.vue +1 -654
- package/dist/runtime/app/pages/index.vue +25 -41
- package/dist/runtime/app/pages/workers.vue +458 -0
- package/dist/runtime/server/api/_workers/index.get.d.ts +8 -0
- package/dist/runtime/server/api/_workers/index.get.js +14 -0
- package/package.json +12 -11
- package/dist/runtime/app/components/ComponentRouter.d.vue.ts +0 -46
- package/dist/runtime/app/components/ComponentRouter.vue +0 -26
- package/dist/runtime/app/components/ComponentRouter.vue.d.ts +0 -46
- package/dist/runtime/app/components/ComponentShell.d.vue.ts +0 -23
- package/dist/runtime/app/components/ComponentShell.vue +0 -97
- package/dist/runtime/app/components/ComponentShell.vue.d.ts +0 -23
- package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
- package/dist/runtime/app/components/ConfirmDialog.vue +0 -120
- package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
- package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -46
- package/dist/runtime/app/composables/useComponentRouter.js +0 -248
- package/dist/runtime/app/pages/flows/[name].vue +0 -750
- package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/flows/index.vue +0 -381
- package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/index.vue +0 -236
- package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/job.vue +0 -261
- package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.vue +0 -595
- package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
- package/dist/runtime/app/pages/settings/scheduler.d.vue.ts +0 -3
- package/dist/runtime/app/pages/settings/scheduler.vue +0 -310
- package/dist/runtime/app/pages/settings/scheduler.vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name]/edit.d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name]/edit.vue +0 -429
- package/dist/runtime/app/pages/triggers/[name]/edit.vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name].d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name].vue +0 -870
- package/dist/runtime/app/pages/triggers/[name].vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/index.vue +0 -525
- package/dist/runtime/app/pages/triggers/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/new.d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/new.vue +0 -610
- package/dist/runtime/app/pages/triggers/new.vue.d.ts +0 -3
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.d.ts +0 -10
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +0 -49
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +0 -21
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/restart.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/restart.post.js +0 -21
- package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +0 -17
- package/dist/runtime/server/api/_flows/[name]/runs.get.js +0 -64
- package/dist/runtime/server/api/_flows/[name]/start.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/start.post.js +0 -9
- package/dist/runtime/server/api/_flows/index.get.d.ts +0 -7
- package/dist/runtime/server/api/_flows/index.get.js +0 -5
- package/dist/runtime/server/api/_flows/recent-runs.get.d.ts +0 -15
- package/dist/runtime/server/api/_flows/recent-runs.get.js +0 -67
- package/dist/runtime/server/api/_flows/ws.d.ts +0 -80
- package/dist/runtime/server/api/_flows/ws.js +0 -309
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +0 -14
- package/dist/runtime/server/api/_queues/[name]/job/index.get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/[name]/job/index.get.js +0 -39
- package/dist/runtime/server/api/_queues/index.get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/index.get.js +0 -106
- package/dist/runtime/server/api/_queues/ws.d.ts +0 -48
- package/dist/runtime/server/api/_queues/ws.js +0 -215
- package/dist/runtime/server/api/_scheduler/jobs.get.d.ts +0 -19
- package/dist/runtime/server/api/_scheduler/jobs.get.js +0 -36
- package/dist/runtime/server/api/_triggers/[name]/events.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/[name]/events.get.js +0 -43
- package/dist/runtime/server/api/_triggers/[name]/index.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/[name]/index.get.js +0 -76
- package/dist/runtime/server/api/_triggers/[name].delete.d.ts +0 -7
- package/dist/runtime/server/api/_triggers/[name].delete.js +0 -37
- package/dist/runtime/server/api/_triggers/[name].patch.d.ts +0 -7
- package/dist/runtime/server/api/_triggers/[name].patch.js +0 -117
- package/dist/runtime/server/api/_triggers/index.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/index.get.js +0 -44
- package/dist/runtime/server/api/_triggers/index.post.d.ts +0 -7
- package/dist/runtime/server/api/_triggers/index.post.js +0 -124
- package/dist/runtime/server/api/_triggers/stats.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/stats.get.js +0 -41
- package/dist/runtime/server/api/_triggers/ws.d.ts +0 -74
- package/dist/runtime/server/api/_triggers/ws.js +0 -315
- /package/dist/runtime/app/pages/{flows/[name].d.vue.ts → workers.d.vue.ts} +0 -0
- /package/dist/runtime/app/pages/{flows/[name].vue.d.ts → workers.vue.d.ts} +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|
|
@@ -1,525 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="h-full flex flex-col overflow-hidden">
|
|
3
|
-
<!-- Header -->
|
|
4
|
-
<div class="border-b border-gray-200 dark:border-gray-800 px-6 py-3 shrink-0">
|
|
5
|
-
<div class="flex items-center justify-between">
|
|
6
|
-
<div class="flex items-center gap-4">
|
|
7
|
-
<h1 class="text-lg font-semibold">
|
|
8
|
-
Triggers
|
|
9
|
-
</h1>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="flex items-center gap-3">
|
|
12
|
-
<LiveIndicator
|
|
13
|
-
:is-connected="triggerWs.connected.value"
|
|
14
|
-
:is-reconnecting="triggerWs.reconnecting.value"
|
|
15
|
-
/>
|
|
16
|
-
<UButton
|
|
17
|
-
icon="i-lucide-plus"
|
|
18
|
-
label="Create Trigger"
|
|
19
|
-
color="primary"
|
|
20
|
-
size="sm"
|
|
21
|
-
@click="router.push('/triggers/new')"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<!-- Main Content -->
|
|
28
|
-
<div class="flex-1 min-h-0 overflow-y-auto">
|
|
29
|
-
<div class="max-w-7xl mx-auto p-6">
|
|
30
|
-
<!-- Stats Overview -->
|
|
31
|
-
<div
|
|
32
|
-
v-if="stats"
|
|
33
|
-
class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6"
|
|
34
|
-
>
|
|
35
|
-
<StatCard
|
|
36
|
-
icon="i-lucide-zap"
|
|
37
|
-
:count="stats.total"
|
|
38
|
-
label="Total Triggers"
|
|
39
|
-
variant="gray"
|
|
40
|
-
/>
|
|
41
|
-
<StatCard
|
|
42
|
-
icon="i-lucide-check-circle"
|
|
43
|
-
:count="stats.active"
|
|
44
|
-
label="Active"
|
|
45
|
-
variant="emerald"
|
|
46
|
-
/>
|
|
47
|
-
<StatCard
|
|
48
|
-
icon="i-lucide-users"
|
|
49
|
-
:count="stats.totalSubscriptions"
|
|
50
|
-
label="Subscriptions"
|
|
51
|
-
variant="blue"
|
|
52
|
-
/>
|
|
53
|
-
<StatCard
|
|
54
|
-
icon="i-lucide-activity"
|
|
55
|
-
:count="stats.totalFires"
|
|
56
|
-
label="Total Fires"
|
|
57
|
-
variant="purple"
|
|
58
|
-
/>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<!-- Filters -->
|
|
62
|
-
<div class="mb-4 flex items-center gap-3">
|
|
63
|
-
<div class="flex-1">
|
|
64
|
-
<UInput
|
|
65
|
-
v-model="searchQuery"
|
|
66
|
-
icon="i-lucide-search"
|
|
67
|
-
placeholder="Search triggers..."
|
|
68
|
-
size="sm"
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
<USelectMenu
|
|
72
|
-
v-model="typeFilter"
|
|
73
|
-
:items="typeFilterOptions"
|
|
74
|
-
value-key="value"
|
|
75
|
-
placeholder="All Types"
|
|
76
|
-
size="sm"
|
|
77
|
-
class="w-44"
|
|
78
|
-
>
|
|
79
|
-
<template #label>
|
|
80
|
-
<span v-if="typeFilter === 'all'">All Types</span>
|
|
81
|
-
<div
|
|
82
|
-
v-else
|
|
83
|
-
class="flex items-center gap-2"
|
|
84
|
-
>
|
|
85
|
-
<UIcon
|
|
86
|
-
:name="getTriggerIcon(typeFilter)"
|
|
87
|
-
class="w-4 h-4"
|
|
88
|
-
/>
|
|
89
|
-
<span class="capitalize">{{ typeFilter }}</span>
|
|
90
|
-
</div>
|
|
91
|
-
</template>
|
|
92
|
-
</USelectMenu>
|
|
93
|
-
<USelectMenu
|
|
94
|
-
v-model="scopeFilter"
|
|
95
|
-
:items="scopeFilterOptions"
|
|
96
|
-
value-key="value"
|
|
97
|
-
placeholder="All Scopes"
|
|
98
|
-
size="sm"
|
|
99
|
-
class="w-40"
|
|
100
|
-
>
|
|
101
|
-
<template #label>
|
|
102
|
-
<span v-if="scopeFilter === 'all'">All Scopes</span>
|
|
103
|
-
<div
|
|
104
|
-
v-else
|
|
105
|
-
class="flex items-center gap-2"
|
|
106
|
-
>
|
|
107
|
-
<UIcon
|
|
108
|
-
:name="scopeFilter === 'flow' ? 'i-lucide-git-branch' : 'i-lucide-play-circle'"
|
|
109
|
-
class="w-4 h-4"
|
|
110
|
-
/>
|
|
111
|
-
<span class="capitalize">{{ scopeFilter }}</span>
|
|
112
|
-
</div>
|
|
113
|
-
</template>
|
|
114
|
-
</USelectMenu>
|
|
115
|
-
<USelectMenu
|
|
116
|
-
v-model="statusFilter"
|
|
117
|
-
:items="statusFilterOptions"
|
|
118
|
-
value-key="value"
|
|
119
|
-
placeholder="All Status"
|
|
120
|
-
size="sm"
|
|
121
|
-
class="w-40"
|
|
122
|
-
>
|
|
123
|
-
<template #label>
|
|
124
|
-
<span v-if="statusFilter === 'all'">All Status</span>
|
|
125
|
-
<div
|
|
126
|
-
v-else
|
|
127
|
-
class="flex items-center gap-2"
|
|
128
|
-
>
|
|
129
|
-
<UIcon
|
|
130
|
-
:name="statusFilter === 'active' ? 'i-lucide-check-circle' : statusFilter === 'inactive' ? 'i-lucide-pause-circle' : 'i-lucide-archive'"
|
|
131
|
-
class="w-4 h-4"
|
|
132
|
-
/>
|
|
133
|
-
<span class="capitalize">{{ statusFilter }}</span>
|
|
134
|
-
</div>
|
|
135
|
-
</template>
|
|
136
|
-
</USelectMenu>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<!-- Triggers List -->
|
|
140
|
-
<div
|
|
141
|
-
v-if="!filteredTriggers || filteredTriggers.length === 0"
|
|
142
|
-
class="bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 p-8 text-center text-gray-500"
|
|
143
|
-
>
|
|
144
|
-
<div v-if="loading">
|
|
145
|
-
<UIcon
|
|
146
|
-
name="i-lucide-loader-2"
|
|
147
|
-
class="w-12 h-12 animate-spin mx-auto mb-3 opacity-50"
|
|
148
|
-
/>
|
|
149
|
-
<p>Loading triggers...</p>
|
|
150
|
-
</div>
|
|
151
|
-
<div v-else-if="searchQuery || typeFilter !== 'all' || scopeFilter !== 'all' || statusFilter !== 'all'">
|
|
152
|
-
<UIcon
|
|
153
|
-
name="i-lucide-search-x"
|
|
154
|
-
class="w-12 h-12 mx-auto mb-3 opacity-50"
|
|
155
|
-
/>
|
|
156
|
-
<p>No triggers match your filters</p>
|
|
157
|
-
<UButton
|
|
158
|
-
size="xs"
|
|
159
|
-
color="neutral"
|
|
160
|
-
variant="ghost"
|
|
161
|
-
class="mt-2"
|
|
162
|
-
@click="clearFilters"
|
|
163
|
-
>
|
|
164
|
-
Clear Filters
|
|
165
|
-
</UButton>
|
|
166
|
-
</div>
|
|
167
|
-
<div v-else>
|
|
168
|
-
<UIcon
|
|
169
|
-
name="i-lucide-zap-off"
|
|
170
|
-
class="w-12 h-12 mx-auto mb-3 opacity-50"
|
|
171
|
-
/>
|
|
172
|
-
<p>No triggers registered</p>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
<div
|
|
176
|
-
v-else
|
|
177
|
-
class="bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden"
|
|
178
|
-
>
|
|
179
|
-
<div class="divide-y divide-gray-100 dark:divide-gray-800">
|
|
180
|
-
<div
|
|
181
|
-
v-for="trigger in paginatedTriggers"
|
|
182
|
-
:key="trigger.name"
|
|
183
|
-
class="px-6 py-4 hover:bg-gray-50 dark:hover:bg-gray-900/50 transition-colors cursor-pointer"
|
|
184
|
-
@click="selectTrigger(trigger.name)"
|
|
185
|
-
>
|
|
186
|
-
<div class="flex items-start justify-between gap-4">
|
|
187
|
-
<!-- Left: Trigger Info -->
|
|
188
|
-
<div class="flex-1 min-w-0">
|
|
189
|
-
<div class="flex items-center gap-2 mb-1">
|
|
190
|
-
<UIcon
|
|
191
|
-
:name="getTriggerIcon(trigger.type)"
|
|
192
|
-
class="w-4 h-4 shrink-0"
|
|
193
|
-
:class="getTriggerIconColor(trigger.type)"
|
|
194
|
-
/>
|
|
195
|
-
<h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100 truncate">
|
|
196
|
-
{{ trigger.displayName || trigger.name }}
|
|
197
|
-
</h3>
|
|
198
|
-
<UBadge
|
|
199
|
-
:label="trigger.type"
|
|
200
|
-
:color="getTriggerTypeColor(trigger.type)"
|
|
201
|
-
variant="subtle"
|
|
202
|
-
size="xs"
|
|
203
|
-
/>
|
|
204
|
-
<UBadge
|
|
205
|
-
:label="trigger.scope"
|
|
206
|
-
color="neutral"
|
|
207
|
-
variant="subtle"
|
|
208
|
-
size="xs"
|
|
209
|
-
/>
|
|
210
|
-
</div>
|
|
211
|
-
|
|
212
|
-
<p
|
|
213
|
-
v-if="trigger.description"
|
|
214
|
-
class="text-xs text-gray-500 dark:text-gray-400 mb-2 line-clamp-1"
|
|
215
|
-
>
|
|
216
|
-
{{ trigger.description }}
|
|
217
|
-
</p>
|
|
218
|
-
|
|
219
|
-
<div class="flex items-center gap-4 text-xs text-gray-500 dark:text-gray-400">
|
|
220
|
-
<div class="flex items-center gap-1">
|
|
221
|
-
<UIcon
|
|
222
|
-
name="i-lucide-git-branch"
|
|
223
|
-
class="w-3 h-3"
|
|
224
|
-
/>
|
|
225
|
-
<span>{{ trigger.subscriptionCount }} flow{{ trigger.subscriptionCount === 1 ? "" : "s" }}</span>
|
|
226
|
-
</div>
|
|
227
|
-
<div
|
|
228
|
-
v-if="trigger.stats.totalFires > 0"
|
|
229
|
-
class="flex items-center gap-1"
|
|
230
|
-
>
|
|
231
|
-
<UIcon
|
|
232
|
-
name="i-lucide-zap"
|
|
233
|
-
class="w-3 h-3"
|
|
234
|
-
/>
|
|
235
|
-
<span>{{ formatNumber(trigger.stats.totalFires) }} fires</span>
|
|
236
|
-
</div>
|
|
237
|
-
<div
|
|
238
|
-
v-if="trigger.lastActivityAt"
|
|
239
|
-
class="flex items-center gap-1"
|
|
240
|
-
>
|
|
241
|
-
<UIcon
|
|
242
|
-
name="i-lucide-clock"
|
|
243
|
-
class="w-3 h-3"
|
|
244
|
-
/>
|
|
245
|
-
<span>{{ formatTime(trigger.lastActivityAt) }}</span>
|
|
246
|
-
</div>
|
|
247
|
-
<div
|
|
248
|
-
v-if="trigger.source"
|
|
249
|
-
class="flex items-center gap-1"
|
|
250
|
-
>
|
|
251
|
-
<UIcon
|
|
252
|
-
name="i-lucide-package"
|
|
253
|
-
class="w-3 h-3"
|
|
254
|
-
/>
|
|
255
|
-
<span>{{ trigger.source }}</span>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
|
|
260
|
-
<!-- Right: Stats & Status -->
|
|
261
|
-
<div class="flex items-center gap-3">
|
|
262
|
-
<!-- Status Badge -->
|
|
263
|
-
<UBadge
|
|
264
|
-
:label="trigger.status"
|
|
265
|
-
:color="trigger.status === 'active' ? 'success' : trigger.status === 'inactive' ? 'warning' : 'neutral'"
|
|
266
|
-
variant="subtle"
|
|
267
|
-
/>
|
|
268
|
-
|
|
269
|
-
<!-- Actions -->
|
|
270
|
-
<UButton
|
|
271
|
-
icon="i-lucide-arrow-right"
|
|
272
|
-
size="xs"
|
|
273
|
-
color="neutral"
|
|
274
|
-
variant="ghost"
|
|
275
|
-
square
|
|
276
|
-
/>
|
|
277
|
-
</div>
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
</div>
|
|
281
|
-
|
|
282
|
-
<!-- Pagination -->
|
|
283
|
-
<div
|
|
284
|
-
v-if="totalPages > 1"
|
|
285
|
-
class="border-t border-gray-200 dark:border-gray-800 px-6 py-4 flex items-center justify-center"
|
|
286
|
-
>
|
|
287
|
-
<UPagination
|
|
288
|
-
v-model:page="currentPage"
|
|
289
|
-
:items-per-page="itemsPerPage"
|
|
290
|
-
:total="filteredTriggers.length"
|
|
291
|
-
/>
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
|
|
295
|
-
<!-- Footer Info -->
|
|
296
|
-
<div
|
|
297
|
-
v-if="filteredTriggers && filteredTriggers.length > 0"
|
|
298
|
-
class="mt-4 text-center text-sm text-gray-500 dark:text-gray-400"
|
|
299
|
-
>
|
|
300
|
-
Showing {{ startIndex + 1 }}-{{ endIndex }} of {{ filteredTriggers.length }} trigger{{ filteredTriggers.length === 1 ? "" : "s" }}
|
|
301
|
-
</div>
|
|
302
|
-
</div>
|
|
303
|
-
</div>
|
|
304
|
-
</div>
|
|
305
|
-
</template>
|
|
306
|
-
|
|
307
|
-
<script setup>
|
|
308
|
-
import { ref, computed, onMounted, onBeforeUnmount } from "#imports";
|
|
309
|
-
import { useComponentRouter } from "../../composables/useComponentRouter";
|
|
310
|
-
import { useTriggerWebSocket } from "../../composables/useTriggerWebSocket";
|
|
311
|
-
import StatCard from "../../components/StatCard.vue";
|
|
312
|
-
import LiveIndicator from "../../components/LiveIndicator.vue";
|
|
313
|
-
const router = useComponentRouter();
|
|
314
|
-
const triggers = ref([]);
|
|
315
|
-
const loading = ref(true);
|
|
316
|
-
const triggerWs = useTriggerWebSocket();
|
|
317
|
-
async function fetchTriggers() {
|
|
318
|
-
try {
|
|
319
|
-
const data = await $fetch("/api/_triggers");
|
|
320
|
-
triggers.value = data;
|
|
321
|
-
} catch (err) {
|
|
322
|
-
console.error("Error fetching triggers:", err);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
function updateTriggerStats(data) {
|
|
326
|
-
const triggerName = data?.id;
|
|
327
|
-
if (!triggerName || !triggers.value)
|
|
328
|
-
return;
|
|
329
|
-
const triggerIndex = triggers.value.findIndex((t) => t.name === triggerName);
|
|
330
|
-
if (triggerIndex === -1) {
|
|
331
|
-
console.warn("[Trigger Index] Trigger not found in list:", triggerName);
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
const metadata = data?.metadata;
|
|
335
|
-
if (!metadata) {
|
|
336
|
-
console.warn("[Trigger Index] No metadata in update:", data);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const stats2 = {
|
|
340
|
-
totalFires: metadata.stats?.totalFires || metadata.totalFires || metadata["stats.totalFires"] || triggers.value[triggerIndex].stats?.totalFires || 0,
|
|
341
|
-
totalFlowsStarted: metadata.stats?.totalFlowsStarted || metadata.totalFlowsStarted || metadata["stats.totalFlowsStarted"] || triggers.value[triggerIndex].stats?.totalFlowsStarted || 0,
|
|
342
|
-
activeSubscribers: metadata.stats?.activeSubscribers || metadata.activeSubscribers || metadata["stats.activeSubscribers"] || triggers.value[triggerIndex].stats?.activeSubscribers || 0,
|
|
343
|
-
lastFiredAt: metadata.stats?.lastFiredAt || metadata.lastFiredAt || metadata["stats.lastFiredAt"] || triggers.value[triggerIndex].stats?.lastFiredAt
|
|
344
|
-
};
|
|
345
|
-
triggers.value[triggerIndex] = {
|
|
346
|
-
...triggers.value[triggerIndex],
|
|
347
|
-
stats: stats2,
|
|
348
|
-
status: metadata.status ?? triggers.value[triggerIndex].status,
|
|
349
|
-
lastActivityAt: metadata.lastActivityAt ?? triggers.value[triggerIndex].lastActivityAt
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
onMounted(async () => {
|
|
353
|
-
await fetchTriggers();
|
|
354
|
-
loading.value = false;
|
|
355
|
-
if (import.meta.client) {
|
|
356
|
-
triggerWs.subscribeStats(
|
|
357
|
-
{
|
|
358
|
-
onInitial: (data) => {
|
|
359
|
-
updateTriggerStats(data);
|
|
360
|
-
},
|
|
361
|
-
onUpdate: (data) => {
|
|
362
|
-
updateTriggerStats(data);
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
autoReconnect: true,
|
|
367
|
-
onError: (err) => {
|
|
368
|
-
console.error("[Trigger Stats] Error:", err);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
onBeforeUnmount(() => {
|
|
375
|
-
triggerWs.unsubscribeStats();
|
|
376
|
-
triggerWs.stop();
|
|
377
|
-
});
|
|
378
|
-
const searchQuery = ref("");
|
|
379
|
-
const typeFilter = ref("all");
|
|
380
|
-
const scopeFilter = ref("all");
|
|
381
|
-
const statusFilter = ref("all");
|
|
382
|
-
const typeFilterOptions = [
|
|
383
|
-
{ label: "All Types", value: "all" },
|
|
384
|
-
{ label: "Event", value: "event", icon: "i-lucide-radio" },
|
|
385
|
-
{ label: "Webhook", value: "webhook", icon: "i-lucide-webhook" },
|
|
386
|
-
{ label: "Schedule", value: "schedule", icon: "i-lucide-clock" },
|
|
387
|
-
{ label: "Manual", value: "manual", icon: "i-lucide-hand" }
|
|
388
|
-
];
|
|
389
|
-
const scopeFilterOptions = [
|
|
390
|
-
{ label: "All Scopes", value: "all" },
|
|
391
|
-
{ label: "Flow", value: "flow", icon: "i-lucide-git-branch" },
|
|
392
|
-
{ label: "Run", value: "run", icon: "i-lucide-play-circle" }
|
|
393
|
-
];
|
|
394
|
-
const statusFilterOptions = [
|
|
395
|
-
{ label: "All Status", value: "all" },
|
|
396
|
-
{ label: "Active", value: "active", icon: "i-lucide-check-circle" },
|
|
397
|
-
{ label: "Inactive", value: "inactive", icon: "i-lucide-pause-circle" },
|
|
398
|
-
{ label: "Retired", value: "retired", icon: "i-lucide-archive" }
|
|
399
|
-
];
|
|
400
|
-
const currentPage = ref(1);
|
|
401
|
-
const itemsPerPage = 10;
|
|
402
|
-
const filteredTriggers = computed(() => {
|
|
403
|
-
if (!triggers.value) return [];
|
|
404
|
-
let result = triggers.value;
|
|
405
|
-
if (searchQuery.value) {
|
|
406
|
-
const query = searchQuery.value.toLowerCase();
|
|
407
|
-
result = result.filter(
|
|
408
|
-
(t) => t.name.toLowerCase().includes(query) || t.displayName?.toLowerCase().includes(query) || t.description?.toLowerCase().includes(query)
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
if (typeFilter.value !== "all") {
|
|
412
|
-
result = result.filter((t) => t.type === typeFilter.value);
|
|
413
|
-
}
|
|
414
|
-
if (scopeFilter.value !== "all") {
|
|
415
|
-
result = result.filter((t) => t.scope === scopeFilter.value);
|
|
416
|
-
}
|
|
417
|
-
if (statusFilter.value !== "all") {
|
|
418
|
-
result = result.filter((t) => t.status === statusFilter.value);
|
|
419
|
-
}
|
|
420
|
-
return result;
|
|
421
|
-
});
|
|
422
|
-
const totalPages = computed(() => {
|
|
423
|
-
if (!filteredTriggers.value) return 0;
|
|
424
|
-
return Math.ceil(filteredTriggers.value.length / itemsPerPage);
|
|
425
|
-
});
|
|
426
|
-
const startIndex = computed(() => {
|
|
427
|
-
return (currentPage.value - 1) * itemsPerPage;
|
|
428
|
-
});
|
|
429
|
-
const endIndex = computed(() => {
|
|
430
|
-
if (!filteredTriggers.value) return 0;
|
|
431
|
-
return Math.min(startIndex.value + itemsPerPage, filteredTriggers.value.length);
|
|
432
|
-
});
|
|
433
|
-
const paginatedTriggers = computed(() => {
|
|
434
|
-
if (!filteredTriggers.value) return [];
|
|
435
|
-
return filteredTriggers.value.slice(startIndex.value, endIndex.value);
|
|
436
|
-
});
|
|
437
|
-
const clearFilters = () => {
|
|
438
|
-
searchQuery.value = "";
|
|
439
|
-
typeFilter.value = "all";
|
|
440
|
-
scopeFilter.value = "all";
|
|
441
|
-
statusFilter.value = "all";
|
|
442
|
-
currentPage.value = 1;
|
|
443
|
-
};
|
|
444
|
-
const selectTrigger = (name) => {
|
|
445
|
-
router.push(`/triggers/${encodeURIComponent(name)}`);
|
|
446
|
-
};
|
|
447
|
-
const getTriggerIcon = (type) => {
|
|
448
|
-
switch (type) {
|
|
449
|
-
case "event":
|
|
450
|
-
return "i-lucide-radio";
|
|
451
|
-
case "webhook":
|
|
452
|
-
return "i-lucide-webhook";
|
|
453
|
-
case "schedule":
|
|
454
|
-
return "i-lucide-clock";
|
|
455
|
-
case "manual":
|
|
456
|
-
return "i-lucide-hand";
|
|
457
|
-
default:
|
|
458
|
-
return "i-lucide-zap";
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
const getTriggerIconColor = (type) => {
|
|
462
|
-
switch (type) {
|
|
463
|
-
case "event":
|
|
464
|
-
return "text-blue-500";
|
|
465
|
-
case "webhook":
|
|
466
|
-
return "text-purple-500";
|
|
467
|
-
case "schedule":
|
|
468
|
-
return "text-emerald-500";
|
|
469
|
-
case "manual":
|
|
470
|
-
return "text-amber-500";
|
|
471
|
-
default:
|
|
472
|
-
return "text-gray-500";
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
const getTriggerTypeColor = (type) => {
|
|
476
|
-
switch (type) {
|
|
477
|
-
case "event":
|
|
478
|
-
return "primary";
|
|
479
|
-
case "webhook":
|
|
480
|
-
return "success";
|
|
481
|
-
case "schedule":
|
|
482
|
-
return "warning";
|
|
483
|
-
case "manual":
|
|
484
|
-
return "neutral";
|
|
485
|
-
default:
|
|
486
|
-
return "neutral";
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
const formatTime = (timestamp) => {
|
|
490
|
-
const date = new Date(timestamp);
|
|
491
|
-
const now = /* @__PURE__ */ new Date();
|
|
492
|
-
const diff = now.getTime() - date.getTime();
|
|
493
|
-
const seconds = Math.floor(diff / 1e3);
|
|
494
|
-
const minutes = Math.floor(seconds / 60);
|
|
495
|
-
const hours = Math.floor(minutes / 60);
|
|
496
|
-
const days = Math.floor(hours / 24);
|
|
497
|
-
if (days > 0) return `${days}d ago`;
|
|
498
|
-
if (hours > 0) return `${hours}h ago`;
|
|
499
|
-
if (minutes > 0) return `${minutes}m ago`;
|
|
500
|
-
if (seconds > 10) return `${seconds}s ago`;
|
|
501
|
-
return "just now";
|
|
502
|
-
};
|
|
503
|
-
const formatNumber = (num) => {
|
|
504
|
-
if (num == null) return "0";
|
|
505
|
-
if (num >= 1e6) return `${(num / 1e6).toFixed(1)}M`;
|
|
506
|
-
if (num >= 1e3) return `${(num / 1e3).toFixed(1)}K`;
|
|
507
|
-
return num.toString();
|
|
508
|
-
};
|
|
509
|
-
const stats = computed(() => {
|
|
510
|
-
if (!triggers.value || triggers.value.length === 0) {
|
|
511
|
-
return {
|
|
512
|
-
total: 0,
|
|
513
|
-
active: 0,
|
|
514
|
-
totalSubscriptions: 0,
|
|
515
|
-
totalFires: 0
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
return {
|
|
519
|
-
total: triggers.value.length,
|
|
520
|
-
active: triggers.value.filter((t) => t.status === "active").length,
|
|
521
|
-
totalSubscriptions: triggers.value.reduce((acc, t) => acc + (t.subscriptionCount || t.stats?.activeSubscribers || 0), 0),
|
|
522
|
-
totalFires: triggers.value.reduce((acc, t) => acc + (t.stats?.totalFires || 0), 0)
|
|
523
|
-
};
|
|
524
|
-
});
|
|
525
|
-
</script>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
declare const _default: typeof __VLS_export;
|
|
3
|
-
export default _default;
|