@nvent-addon/app 0.5.15 → 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,610 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="h-full flex flex-col overflow-hidden bg-gray-50 dark:bg-gray-950">
|
|
3
|
-
<!-- Header -->
|
|
4
|
-
<div class="border-b border-gray-200 dark:border-gray-800 px-6 py-4 shrink-0 bg-white dark:bg-gray-900">
|
|
5
|
-
<div class="flex items-center justify-between">
|
|
6
|
-
<div class="flex items-center gap-3">
|
|
7
|
-
<UButton
|
|
8
|
-
icon="i-lucide-arrow-left"
|
|
9
|
-
size="sm"
|
|
10
|
-
color="neutral"
|
|
11
|
-
variant="ghost"
|
|
12
|
-
@click="router.push('/triggers')"
|
|
13
|
-
/>
|
|
14
|
-
<div>
|
|
15
|
-
<h1 class="text-lg font-semibold">
|
|
16
|
-
Create New Trigger
|
|
17
|
-
</h1>
|
|
18
|
-
<p class="text-sm text-gray-500 dark:text-gray-400 mt-0.5">
|
|
19
|
-
Configure a trigger to start flows automatically
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<!-- Main Content -->
|
|
27
|
-
<div class="flex-1 min-h-0 overflow-y-auto">
|
|
28
|
-
<div class="max-w-4xl mx-auto py-8 px-6">
|
|
29
|
-
<!-- Stepper -->
|
|
30
|
-
<UStepper
|
|
31
|
-
v-model="currentStep"
|
|
32
|
-
:items="steps"
|
|
33
|
-
orientation="horizontal"
|
|
34
|
-
class="mb-8"
|
|
35
|
-
/>
|
|
36
|
-
|
|
37
|
-
<!-- Step Content -->
|
|
38
|
-
<UForm
|
|
39
|
-
ref="form"
|
|
40
|
-
:schema="currentStepSchema"
|
|
41
|
-
:state="formState"
|
|
42
|
-
class="bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 shadow-sm"
|
|
43
|
-
>
|
|
44
|
-
<!-- Step 1: Type Selection -->
|
|
45
|
-
<div v-show="currentStep === 1">
|
|
46
|
-
<div class="p-6 border-b border-gray-200 dark:border-gray-800">
|
|
47
|
-
<h2 class="text-xl font-semibold mb-2">
|
|
48
|
-
Select Trigger Type
|
|
49
|
-
</h2>
|
|
50
|
-
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
51
|
-
Choose how you want to trigger your flows
|
|
52
|
-
</p>
|
|
53
|
-
</div>
|
|
54
|
-
<div class="p-6">
|
|
55
|
-
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
56
|
-
<button
|
|
57
|
-
v-for="type in triggerTypes"
|
|
58
|
-
:key="type.value"
|
|
59
|
-
class="group relative p-6 rounded-lg border-2 transition-all text-left"
|
|
60
|
-
:class="formState.type === type.value ? 'border-primary-500 bg-primary-50 dark:bg-primary-950/30' : 'border-gray-200 dark:border-gray-800 hover:border-gray-300 dark:hover:border-gray-700'"
|
|
61
|
-
@click="selectType(type.value)"
|
|
62
|
-
>
|
|
63
|
-
<div class="flex items-start gap-4">
|
|
64
|
-
<div
|
|
65
|
-
class="w-12 h-12 rounded-lg flex items-center justify-center shrink-0 transition-colors"
|
|
66
|
-
:class="formState.type === type.value ? 'bg-primary-100 dark:bg-primary-900/40' : 'bg-gray-100 dark:bg-gray-800 group-hover:bg-gray-200 dark:group-hover:bg-gray-700'"
|
|
67
|
-
>
|
|
68
|
-
<UIcon
|
|
69
|
-
:name="type.icon"
|
|
70
|
-
class="w-6 h-6"
|
|
71
|
-
:class="formState.type === type.value ? 'text-primary-600 dark:text-primary-400' : 'text-gray-600 dark:text-gray-400'"
|
|
72
|
-
/>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="flex-1 min-w-0">
|
|
75
|
-
<h3 class="text-base font-semibold mb-1">
|
|
76
|
-
{{ type.label }}
|
|
77
|
-
</h3>
|
|
78
|
-
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
79
|
-
{{ type.description }}
|
|
80
|
-
</p>
|
|
81
|
-
<div class="flex items-center gap-2 mt-3">
|
|
82
|
-
<UBadge
|
|
83
|
-
:label="type.scope"
|
|
84
|
-
size="xs"
|
|
85
|
-
color="neutral"
|
|
86
|
-
variant="subtle"
|
|
87
|
-
/>
|
|
88
|
-
<span class="text-xs text-gray-400">•</span>
|
|
89
|
-
<span class="text-xs text-gray-500 dark:text-gray-400">
|
|
90
|
-
{{ type.useCase }}
|
|
91
|
-
</span>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
<div
|
|
95
|
-
v-if="formState.type === type.value"
|
|
96
|
-
class="absolute top-4 right-4"
|
|
97
|
-
>
|
|
98
|
-
<div class="w-6 h-6 rounded-full bg-primary-500 flex items-center justify-center">
|
|
99
|
-
<UIcon
|
|
100
|
-
name="i-lucide-check"
|
|
101
|
-
class="w-4 h-4 text-white"
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</button>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
<!-- Step 2: Basic Information -->
|
|
112
|
-
<div v-show="currentStep === 2">
|
|
113
|
-
<div class="p-6 border-b border-gray-200 dark:border-gray-800">
|
|
114
|
-
<h2 class="text-xl font-semibold mb-2">
|
|
115
|
-
Basic Information
|
|
116
|
-
</h2>
|
|
117
|
-
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
118
|
-
Provide details about your trigger
|
|
119
|
-
</p>
|
|
120
|
-
</div>
|
|
121
|
-
<div class="p-6">
|
|
122
|
-
<BasicInfoCard
|
|
123
|
-
v-model="formState"
|
|
124
|
-
no-card
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<!-- Step 3: Configuration -->
|
|
130
|
-
<div v-show="currentStep === 3">
|
|
131
|
-
<div class="p-6 border-b border-gray-200 dark:border-gray-800">
|
|
132
|
-
<div class="flex items-center gap-3 mb-2">
|
|
133
|
-
<div
|
|
134
|
-
class="w-10 h-10 rounded-lg flex items-center justify-center"
|
|
135
|
-
:class="getTriggerTypeBgClass(formState.type)"
|
|
136
|
-
>
|
|
137
|
-
<UIcon
|
|
138
|
-
:name="getTriggerTypeIcon(formState.type)"
|
|
139
|
-
class="w-5 h-5"
|
|
140
|
-
:class="getTriggerTypeIconClass(formState.type)"
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
<div>
|
|
144
|
-
<h2 class="text-xl font-semibold">
|
|
145
|
-
{{ getTriggerTypeLabel(formState.type) }} Configuration
|
|
146
|
-
</h2>
|
|
147
|
-
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
148
|
-
Configure the specific settings for this trigger type
|
|
149
|
-
</p>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
<div class="p-6">
|
|
154
|
-
<!-- Event Config -->
|
|
155
|
-
<EventConfig
|
|
156
|
-
v-if="formState.type === 'event'"
|
|
157
|
-
v-model="formState.config"
|
|
158
|
-
no-card
|
|
159
|
-
name="config"
|
|
160
|
-
/>
|
|
161
|
-
|
|
162
|
-
<!-- Webhook Config -->
|
|
163
|
-
<WebhookConfig
|
|
164
|
-
v-if="formState.type === 'webhook'"
|
|
165
|
-
v-model="formState.webhook"
|
|
166
|
-
no-card
|
|
167
|
-
name="webhook"
|
|
168
|
-
/>
|
|
169
|
-
|
|
170
|
-
<!-- Schedule Config -->
|
|
171
|
-
<ScheduleConfig
|
|
172
|
-
v-if="formState.type === 'schedule'"
|
|
173
|
-
v-model="formState.schedule"
|
|
174
|
-
no-card
|
|
175
|
-
name="schedule"
|
|
176
|
-
/>
|
|
177
|
-
|
|
178
|
-
<!-- Manual Trigger Info -->
|
|
179
|
-
<div
|
|
180
|
-
v-if="formState.type === 'manual'"
|
|
181
|
-
class="p-4 bg-amber-50 dark:bg-amber-950/30 rounded-lg border border-amber-200 dark:border-amber-800"
|
|
182
|
-
>
|
|
183
|
-
<div class="flex items-start gap-3">
|
|
184
|
-
<UIcon
|
|
185
|
-
name="i-lucide-info"
|
|
186
|
-
class="w-5 h-5 text-amber-600 dark:text-amber-400 mt-0.5 shrink-0"
|
|
187
|
-
/>
|
|
188
|
-
<div>
|
|
189
|
-
<p class="text-sm text-amber-800 dark:text-amber-200 font-medium mb-1">
|
|
190
|
-
Manual triggers require no additional configuration
|
|
191
|
-
</p>
|
|
192
|
-
<p class="text-xs text-amber-700 dark:text-amber-300">
|
|
193
|
-
Manual triggers can only be invoked via API calls or the UI. They are useful for on-demand flow execution.
|
|
194
|
-
</p>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<!-- Step 4: Flow Subscriptions -->
|
|
202
|
-
<div v-show="currentStep === 4">
|
|
203
|
-
<div class="p-6">
|
|
204
|
-
<FlowSubscriptions
|
|
205
|
-
:subscriptions="formState.subscriptions"
|
|
206
|
-
:flows="availableFlows"
|
|
207
|
-
@toggle="toggleFlow"
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
|
|
212
|
-
<!-- Step 5: Review & Create -->
|
|
213
|
-
<div v-show="currentStep === 5">
|
|
214
|
-
<div class="p-6 border-b border-gray-200 dark:border-gray-800">
|
|
215
|
-
<h2 class="text-xl font-semibold mb-2">
|
|
216
|
-
Review & Create
|
|
217
|
-
</h2>
|
|
218
|
-
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
219
|
-
Review your trigger configuration before creating it
|
|
220
|
-
</p>
|
|
221
|
-
</div>
|
|
222
|
-
<div class="p-6 space-y-6">
|
|
223
|
-
<!-- Summary Card -->
|
|
224
|
-
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-lg p-6 space-y-4">
|
|
225
|
-
<div class="flex items-start gap-4">
|
|
226
|
-
<div
|
|
227
|
-
class="w-12 h-12 rounded-lg flex items-center justify-center shrink-0"
|
|
228
|
-
:class="getTriggerTypeBgClass(formState.type)"
|
|
229
|
-
>
|
|
230
|
-
<UIcon
|
|
231
|
-
:name="getTriggerTypeIcon(formState.type)"
|
|
232
|
-
class="w-6 h-6"
|
|
233
|
-
:class="getTriggerTypeIconClass(formState.type)"
|
|
234
|
-
/>
|
|
235
|
-
</div>
|
|
236
|
-
<div class="flex-1 min-w-0">
|
|
237
|
-
<h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-1">
|
|
238
|
-
{{ formState.displayName || formState.name }}
|
|
239
|
-
</h3>
|
|
240
|
-
<p
|
|
241
|
-
v-if="formState.description"
|
|
242
|
-
class="text-sm text-gray-600 dark:text-gray-400"
|
|
243
|
-
>
|
|
244
|
-
{{ formState.description }}
|
|
245
|
-
</p>
|
|
246
|
-
<div class="flex items-center gap-2 mt-2">
|
|
247
|
-
<UBadge
|
|
248
|
-
:label="getTriggerTypeLabel(formState.type)"
|
|
249
|
-
:color="getTriggerTypeColor(formState.type)"
|
|
250
|
-
variant="subtle"
|
|
251
|
-
/>
|
|
252
|
-
<UBadge
|
|
253
|
-
:label="getTriggerScope(formState.type)"
|
|
254
|
-
color="neutral"
|
|
255
|
-
variant="subtle"
|
|
256
|
-
/>
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
|
-
<div class="grid grid-cols-2 gap-4 pt-4 border-t border-gray-200 dark:border-gray-700">
|
|
262
|
-
<div>
|
|
263
|
-
<p class="text-xs text-gray-500 dark:text-gray-400 mb-1">
|
|
264
|
-
Trigger Name
|
|
265
|
-
</p>
|
|
266
|
-
<p class="text-sm font-medium font-mono text-gray-900 dark:text-gray-100">
|
|
267
|
-
{{ formState.name }}
|
|
268
|
-
</p>
|
|
269
|
-
</div>
|
|
270
|
-
<div>
|
|
271
|
-
<p class="text-xs text-gray-500 dark:text-gray-400 mb-1">
|
|
272
|
-
Subscriptions
|
|
273
|
-
</p>
|
|
274
|
-
<p class="text-sm font-medium text-gray-900 dark:text-gray-100">
|
|
275
|
-
{{ formState.subscriptions.length }} flow{{ formState.subscriptions.length === 1 ? "" : "s" }}
|
|
276
|
-
</p>
|
|
277
|
-
</div>
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
|
|
281
|
-
<!-- Configuration Details -->
|
|
282
|
-
<div>
|
|
283
|
-
<h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-3">
|
|
284
|
-
Configuration
|
|
285
|
-
</h4>
|
|
286
|
-
<div class="bg-gray-900 dark:bg-black rounded-lg p-4 font-mono text-sm overflow-x-auto">
|
|
287
|
-
<pre class="text-gray-100 dark:text-gray-300">{{ JSON.stringify(getReviewConfig(), null, 2) }}</pre>
|
|
288
|
-
</div>
|
|
289
|
-
</div>
|
|
290
|
-
|
|
291
|
-
<!-- Subscribed Flows -->
|
|
292
|
-
<div v-if="formState.subscriptions.length > 0">
|
|
293
|
-
<h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-3">
|
|
294
|
-
Subscribed Flows ({{ formState.subscriptions.length }})
|
|
295
|
-
</h4>
|
|
296
|
-
<div class="space-y-2">
|
|
297
|
-
<div
|
|
298
|
-
v-for="flowId in formState.subscriptions"
|
|
299
|
-
:key="flowId"
|
|
300
|
-
class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/50 rounded-lg"
|
|
301
|
-
>
|
|
302
|
-
<UIcon
|
|
303
|
-
name="i-lucide-git-branch"
|
|
304
|
-
class="w-4 h-4 text-gray-500 dark:text-gray-400"
|
|
305
|
-
/>
|
|
306
|
-
<span class="text-sm text-gray-900 dark:text-gray-100">{{ flowId }}</span>
|
|
307
|
-
</div>
|
|
308
|
-
</div>
|
|
309
|
-
</div>
|
|
310
|
-
</div>
|
|
311
|
-
</div>
|
|
312
|
-
|
|
313
|
-
<!-- Navigation Footer -->
|
|
314
|
-
<div class="p-6 border-t border-gray-200 dark:border-gray-800 flex items-center justify-between">
|
|
315
|
-
<UButton
|
|
316
|
-
v-if="currentStep > 1"
|
|
317
|
-
label="Back"
|
|
318
|
-
icon="i-lucide-arrow-left"
|
|
319
|
-
color="neutral"
|
|
320
|
-
variant="ghost"
|
|
321
|
-
@click="previousStep"
|
|
322
|
-
/>
|
|
323
|
-
<div v-else />
|
|
324
|
-
<div class="flex items-center gap-3">
|
|
325
|
-
<UButton
|
|
326
|
-
label="Cancel"
|
|
327
|
-
color="neutral"
|
|
328
|
-
variant="ghost"
|
|
329
|
-
@click="router.push('/triggers')"
|
|
330
|
-
/>
|
|
331
|
-
<UButton
|
|
332
|
-
v-if="currentStep < 5"
|
|
333
|
-
label="Next"
|
|
334
|
-
icon-trailing="i-lucide-arrow-right"
|
|
335
|
-
@click="nextStep"
|
|
336
|
-
/>
|
|
337
|
-
<UButton
|
|
338
|
-
v-else
|
|
339
|
-
label="Create Trigger"
|
|
340
|
-
icon="i-lucide-check"
|
|
341
|
-
:loading="creating"
|
|
342
|
-
@click="createTrigger"
|
|
343
|
-
/>
|
|
344
|
-
</div>
|
|
345
|
-
</div>
|
|
346
|
-
</UForm>
|
|
347
|
-
</div>
|
|
348
|
-
</div>
|
|
349
|
-
</div>
|
|
350
|
-
</template>
|
|
351
|
-
|
|
352
|
-
<script setup>
|
|
353
|
-
import { ref, computed, useToast } from "#imports";
|
|
354
|
-
import { useComponentRouter } from "../../composables/useComponentRouter";
|
|
355
|
-
import { useAnalyzedFlows } from "../../composables/useAnalyzedFlows";
|
|
356
|
-
import { z } from "zod";
|
|
357
|
-
import BasicInfoCard from "../../components/trigger/BasicInfoCard.vue";
|
|
358
|
-
import WebhookConfig from "../../components/trigger/WebhookConfig.vue";
|
|
359
|
-
import ScheduleConfig from "../../components/trigger/ScheduleConfig.vue";
|
|
360
|
-
import EventConfig from "../../components/trigger/EventConfig.vue";
|
|
361
|
-
import FlowSubscriptions from "../../components/trigger/FlowSubscriptions.vue";
|
|
362
|
-
const router = useComponentRouter();
|
|
363
|
-
const flows = useAnalyzedFlows();
|
|
364
|
-
const toast = useToast();
|
|
365
|
-
const currentStep = ref(1);
|
|
366
|
-
const steps = [
|
|
367
|
-
{ key: 1, label: "Type", icon: "i-lucide-sparkles" },
|
|
368
|
-
{ key: 2, label: "Info", icon: "i-lucide-file-text" },
|
|
369
|
-
{ key: 3, label: "Config", icon: "i-lucide-settings" },
|
|
370
|
-
{ key: 4, label: "Flows", icon: "i-lucide-git-branch" },
|
|
371
|
-
{ key: 5, label: "Review", icon: "i-lucide-check-circle" }
|
|
372
|
-
];
|
|
373
|
-
const currentStepSchema = computed(() => z.object({}));
|
|
374
|
-
const formState = ref({
|
|
375
|
-
type: "event",
|
|
376
|
-
scope: "flow",
|
|
377
|
-
status: "active",
|
|
378
|
-
name: "",
|
|
379
|
-
displayName: "",
|
|
380
|
-
description: "",
|
|
381
|
-
webhook: {
|
|
382
|
-
path: "",
|
|
383
|
-
method: "POST",
|
|
384
|
-
requireAuth: false,
|
|
385
|
-
authHeader: "X-API-Key"
|
|
386
|
-
},
|
|
387
|
-
schedule: {
|
|
388
|
-
cron: "",
|
|
389
|
-
interval: void 0,
|
|
390
|
-
timezone: "UTC"
|
|
391
|
-
},
|
|
392
|
-
config: {
|
|
393
|
-
event: "",
|
|
394
|
-
filter: ""
|
|
395
|
-
},
|
|
396
|
-
subscriptions: []
|
|
397
|
-
});
|
|
398
|
-
const form = ref();
|
|
399
|
-
const creating = ref(false);
|
|
400
|
-
const triggerTypes = [
|
|
401
|
-
{
|
|
402
|
-
value: "event",
|
|
403
|
-
label: "Event Trigger",
|
|
404
|
-
icon: "i-lucide-radio",
|
|
405
|
-
description: "Trigger flows when specific events are published",
|
|
406
|
-
scope: "flow",
|
|
407
|
-
useCase: "Event-driven workflows"
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
value: "webhook",
|
|
411
|
-
label: "Webhook Trigger",
|
|
412
|
-
icon: "i-lucide-webhook",
|
|
413
|
-
description: "Trigger flows via HTTP requests",
|
|
414
|
-
scope: "flow",
|
|
415
|
-
useCase: "External integrations"
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
value: "schedule",
|
|
419
|
-
label: "Schedule Trigger",
|
|
420
|
-
icon: "i-lucide-clock",
|
|
421
|
-
description: "Trigger flows on a time-based schedule",
|
|
422
|
-
scope: "flow",
|
|
423
|
-
useCase: "Recurring tasks"
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
value: "manual",
|
|
427
|
-
label: "Manual Trigger",
|
|
428
|
-
icon: "i-lucide-hand",
|
|
429
|
-
description: "Trigger flows manually via UI or API",
|
|
430
|
-
scope: "flow",
|
|
431
|
-
useCase: "On-demand execution"
|
|
432
|
-
}
|
|
433
|
-
];
|
|
434
|
-
const availableFlows = computed(() => flows.value || []);
|
|
435
|
-
const selectType = (type) => {
|
|
436
|
-
formState.value.type = type;
|
|
437
|
-
formState.value.scope = getTriggerScope(type) || "flow";
|
|
438
|
-
};
|
|
439
|
-
const nextStep = async () => {
|
|
440
|
-
if ((currentStep.value === 2 || currentStep.value === 3) && form.value) {
|
|
441
|
-
try {
|
|
442
|
-
await form.value.validate();
|
|
443
|
-
currentStep.value++;
|
|
444
|
-
} catch {
|
|
445
|
-
}
|
|
446
|
-
} else {
|
|
447
|
-
currentStep.value++;
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
const previousStep = () => {
|
|
451
|
-
currentStep.value--;
|
|
452
|
-
};
|
|
453
|
-
const toggleFlow = (flowId) => {
|
|
454
|
-
const index = formState.value.subscriptions.indexOf(flowId);
|
|
455
|
-
if (index >= 0) {
|
|
456
|
-
formState.value.subscriptions.splice(index, 1);
|
|
457
|
-
} else {
|
|
458
|
-
formState.value.subscriptions.push(flowId);
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
const getReviewConfig = () => {
|
|
462
|
-
const config = {};
|
|
463
|
-
if (formState.value.type === "event") {
|
|
464
|
-
config.event = formState.value.config.event;
|
|
465
|
-
if (formState.value.config.filter) {
|
|
466
|
-
try {
|
|
467
|
-
config.filter = JSON.parse(formState.value.config.filter);
|
|
468
|
-
} catch {
|
|
469
|
-
config.filter = formState.value.config.filter;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
} else if (formState.value.type === "webhook") {
|
|
473
|
-
config.path = formState.value.webhook.path;
|
|
474
|
-
config.method = formState.value.webhook.method;
|
|
475
|
-
if (formState.value.webhook.requireAuth) {
|
|
476
|
-
config.requireAuth = true;
|
|
477
|
-
config.authHeader = formState.value.webhook.authHeader;
|
|
478
|
-
}
|
|
479
|
-
} else if (formState.value.type === "schedule") {
|
|
480
|
-
if (formState.value.schedule.cron) {
|
|
481
|
-
config.cron = formState.value.schedule.cron;
|
|
482
|
-
}
|
|
483
|
-
if (formState.value.schedule.interval) {
|
|
484
|
-
config.interval = formState.value.schedule.interval;
|
|
485
|
-
}
|
|
486
|
-
config.timezone = formState.value.schedule.timezone;
|
|
487
|
-
}
|
|
488
|
-
return config;
|
|
489
|
-
};
|
|
490
|
-
const createTrigger = async () => {
|
|
491
|
-
try {
|
|
492
|
-
creating.value = true;
|
|
493
|
-
const config = getReviewConfig();
|
|
494
|
-
if (formState.value.type === "schedule") {
|
|
495
|
-
if (!config.cron && !config.interval) {
|
|
496
|
-
toast.add({
|
|
497
|
-
title: "Validation Error",
|
|
498
|
-
description: "Schedule triggers require either a cron expression or an interval",
|
|
499
|
-
color: "error",
|
|
500
|
-
icon: "i-lucide-alert-circle"
|
|
501
|
-
});
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
const payload = {
|
|
506
|
-
name: formState.value.name,
|
|
507
|
-
displayName: formState.value.displayName || formState.value.name,
|
|
508
|
-
description: formState.value.description,
|
|
509
|
-
type: formState.value.type,
|
|
510
|
-
scope: formState.value.scope,
|
|
511
|
-
status: formState.value.status,
|
|
512
|
-
config,
|
|
513
|
-
subscriptions: formState.value.subscriptions
|
|
514
|
-
};
|
|
515
|
-
const response = await $fetch("/api/_triggers", {
|
|
516
|
-
method: "POST",
|
|
517
|
-
body: payload
|
|
518
|
-
});
|
|
519
|
-
if (response && typeof response === "object" && "error" in response) {
|
|
520
|
-
toast.add({
|
|
521
|
-
title: "Failed to create trigger",
|
|
522
|
-
description: response.error,
|
|
523
|
-
color: "error",
|
|
524
|
-
icon: "i-lucide-alert-circle"
|
|
525
|
-
});
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
toast.add({
|
|
529
|
-
title: "Trigger created",
|
|
530
|
-
description: `Successfully created trigger '${formState.value.displayName || formState.value.name}'`,
|
|
531
|
-
color: "success",
|
|
532
|
-
icon: "i-lucide-check-circle"
|
|
533
|
-
});
|
|
534
|
-
router.push("/triggers");
|
|
535
|
-
} catch (err) {
|
|
536
|
-
console.error("Failed to create trigger:", err);
|
|
537
|
-
let errorMessage = "An unexpected error occurred";
|
|
538
|
-
if (err && typeof err === "object") {
|
|
539
|
-
if ("data" in err && err.data && typeof err.data === "object") {
|
|
540
|
-
if ("error" in err.data) {
|
|
541
|
-
errorMessage = err.data.error;
|
|
542
|
-
} else if ("message" in err.data) {
|
|
543
|
-
errorMessage = err.data.message;
|
|
544
|
-
}
|
|
545
|
-
} else if ("message" in err) {
|
|
546
|
-
errorMessage = err.message;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
toast.add({
|
|
550
|
-
title: "Failed to create trigger",
|
|
551
|
-
description: errorMessage,
|
|
552
|
-
color: "error",
|
|
553
|
-
icon: "i-lucide-alert-circle"
|
|
554
|
-
});
|
|
555
|
-
} finally {
|
|
556
|
-
creating.value = false;
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
const getTriggerTypeIcon = (type) => {
|
|
560
|
-
return triggerTypes.find((t) => t.value === type)?.icon || "i-lucide-zap";
|
|
561
|
-
};
|
|
562
|
-
const getTriggerTypeLabel = (type) => {
|
|
563
|
-
return triggerTypes.find((t) => t.value === type)?.label || type;
|
|
564
|
-
};
|
|
565
|
-
const getTriggerTypeColor = (type) => {
|
|
566
|
-
switch (type) {
|
|
567
|
-
case "event":
|
|
568
|
-
return "primary";
|
|
569
|
-
case "webhook":
|
|
570
|
-
return "success";
|
|
571
|
-
case "schedule":
|
|
572
|
-
return "warning";
|
|
573
|
-
case "manual":
|
|
574
|
-
return "neutral";
|
|
575
|
-
default:
|
|
576
|
-
return "neutral";
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
const getTriggerTypeBgClass = (type) => {
|
|
580
|
-
switch (type) {
|
|
581
|
-
case "event":
|
|
582
|
-
return "bg-blue-100 dark:bg-blue-900/40";
|
|
583
|
-
case "webhook":
|
|
584
|
-
return "bg-purple-100 dark:bg-purple-900/40";
|
|
585
|
-
case "schedule":
|
|
586
|
-
return "bg-emerald-100 dark:bg-emerald-900/40";
|
|
587
|
-
case "manual":
|
|
588
|
-
return "bg-amber-100 dark:bg-amber-900/40";
|
|
589
|
-
default:
|
|
590
|
-
return "bg-gray-100 dark:bg-gray-800";
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
const getTriggerTypeIconClass = (type) => {
|
|
594
|
-
switch (type) {
|
|
595
|
-
case "event":
|
|
596
|
-
return "text-blue-600 dark:text-blue-400";
|
|
597
|
-
case "webhook":
|
|
598
|
-
return "text-purple-600 dark:text-purple-400";
|
|
599
|
-
case "schedule":
|
|
600
|
-
return "text-emerald-600 dark:text-emerald-400";
|
|
601
|
-
case "manual":
|
|
602
|
-
return "text-amber-600 dark:text-amber-400";
|
|
603
|
-
default:
|
|
604
|
-
return "text-gray-600 dark:text-gray-400";
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
const getTriggerScope = (type) => {
|
|
608
|
-
return triggerTypes.find((t) => t.value === type)?.scope || "flow";
|
|
609
|
-
};
|
|
610
|
-
</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,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DELETE /api/_flows/:flowName/clear-history
|
|
3
|
-
*
|
|
4
|
-
* Clears all event history for a specific flow.
|
|
5
|
-
* This deletes:
|
|
6
|
-
* - All flow run streams (nq:flow:run-*)
|
|
7
|
-
* - The flow runs index (nq:flows:<flowName>)
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: any;
|
|
10
|
-
export default _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineEventHandler, createError, useStoreAdapter, useStreamTopics } from "#imports";
|
|
2
|
-
export default defineEventHandler(async (event) => {
|
|
3
|
-
const flowName = event.context.params?.name;
|
|
4
|
-
if (!flowName) {
|
|
5
|
-
throw createError({ statusCode: 400, statusMessage: "Flow name required" });
|
|
6
|
-
}
|
|
7
|
-
let store;
|
|
8
|
-
let StoreSubjects;
|
|
9
|
-
try {
|
|
10
|
-
store = useStoreAdapter();
|
|
11
|
-
const topics = useStreamTopics();
|
|
12
|
-
StoreSubjects = topics.StoreSubjects;
|
|
13
|
-
} catch {
|
|
14
|
-
throw createError({
|
|
15
|
-
statusCode: 503,
|
|
16
|
-
statusMessage: "Server initializing",
|
|
17
|
-
data: "Adapters not ready yet, please retry"
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
let deletedStreams = 0;
|
|
22
|
-
let deletedIndex = false;
|
|
23
|
-
const indexKey = StoreSubjects.flowRunIndex(flowName);
|
|
24
|
-
const runs = await store.index.read(indexKey, { limit: 1e4 });
|
|
25
|
-
if (store.stream.delete) {
|
|
26
|
-
for (const run of runs) {
|
|
27
|
-
const streamName = StoreSubjects.flowRun(run.id);
|
|
28
|
-
await store.stream.delete(streamName);
|
|
29
|
-
deletedStreams++;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
for (const run of runs) {
|
|
33
|
-
await store.index.delete(indexKey, run.id);
|
|
34
|
-
deletedIndex = true;
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
success: true,
|
|
38
|
-
flowName,
|
|
39
|
-
deletedStreams,
|
|
40
|
-
deletedIndex
|
|
41
|
-
};
|
|
42
|
-
} catch (error) {
|
|
43
|
-
throw createError({
|
|
44
|
-
statusCode: 500,
|
|
45
|
-
statusMessage: "Failed to clear flow history",
|
|
46
|
-
data: error instanceof Error ? error.message : String(error)
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|