@escalated-dev/escalated 0.7.0 → 0.7.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.
Files changed (179) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +31 -0
  3. package/package.json +12 -6
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -55
  6. package/src/components/ActivityTimeline.vue +83 -83
  7. package/src/components/AdminDashboard.stories.js +1423 -1095
  8. package/src/components/AgentLoadIndicator.stories.js +37 -37
  9. package/src/components/AgentLoadIndicator.vue +49 -49
  10. package/src/components/AgentPerformanceCard.vue +44 -44
  11. package/src/components/ArticleEditor.vue +82 -82
  12. package/src/components/AssigneeSelect.vue +37 -37
  13. package/src/components/AttachmentList.vue +13 -1
  14. package/src/components/AuditLogEntry.vue +95 -95
  15. package/src/components/BulkActionBar.vue +166 -166
  16. package/src/components/CategoryTree.vue +89 -89
  17. package/src/components/ChartWidget.vue +46 -46
  18. package/src/components/ChatActionBar.vue +226 -0
  19. package/src/components/ChatBubble.vue +162 -0
  20. package/src/components/ChatComposer.vue +308 -0
  21. package/src/components/ChatQueue.vue +222 -0
  22. package/src/components/ChatThread.vue +197 -0
  23. package/src/components/CollisionWarning.stories.js +30 -30
  24. package/src/components/CollisionWarning.vue +68 -68
  25. package/src/components/ConditionalFieldRules.vue +135 -135
  26. package/src/components/ContextPanel.vue +66 -66
  27. package/src/components/ContextPanelSection.vue +65 -65
  28. package/src/components/CustomFieldRenderer.vue +159 -159
  29. package/src/components/EscalatedLayout.vue +29 -6
  30. package/src/components/FileDropzone.vue +57 -57
  31. package/src/components/FollowButton.stories.js +30 -30
  32. package/src/components/FollowButton.vue +88 -88
  33. package/src/components/KeyboardShortcutHelp.vue +213 -213
  34. package/src/components/KnowledgePanel.vue +122 -122
  35. package/src/components/KpiCard.stories.js +32 -32
  36. package/src/components/KpiCard.vue +88 -88
  37. package/src/components/MacroDropdown.vue +150 -150
  38. package/src/components/MentionDropdown.vue +154 -0
  39. package/src/components/MetricComparison.vue +89 -0
  40. package/src/components/PercentileChart.vue +67 -0
  41. package/src/components/PeriodSelector.vue +98 -0
  42. package/src/components/PermissionMatrix.vue +107 -107
  43. package/src/components/PinnedNotes.vue +129 -129
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +46 -2
  46. package/src/components/PriorityBadge.stories.js +33 -33
  47. package/src/components/PriorityBadge.vue +46 -46
  48. package/src/components/ReplyComposer.vue +81 -18
  49. package/src/components/ReplyThread.vue +40 -2
  50. package/src/components/ReportChart.vue +395 -0
  51. package/src/components/ReportExportButton.vue +108 -0
  52. package/src/components/SatisfactionRating.vue +180 -180
  53. package/src/components/SaveViewDialog.vue +172 -0
  54. package/src/components/SavedViewSidebar.vue +208 -0
  55. package/src/components/ScheduleEditor.vue +104 -104
  56. package/src/components/SideConversation.vue +165 -165
  57. package/src/components/SideConversationList.vue +147 -147
  58. package/src/components/SkillTagManager.vue +79 -79
  59. package/src/components/SlaComplianceChart.vue +46 -53
  60. package/src/components/SlaTimer.stories.js +35 -35
  61. package/src/components/SlaTimer.vue +62 -62
  62. package/src/components/SnoozeButton.vue +247 -0
  63. package/src/components/StatsCard.stories.js +24 -24
  64. package/src/components/StatsCard.vue +58 -58
  65. package/src/components/StatusBadge.stories.js +53 -53
  66. package/src/components/StatusBadge.vue +78 -78
  67. package/src/components/TagSelect.vue +84 -84
  68. package/src/components/TicketFilters.vue +270 -225
  69. package/src/components/TicketLinkPanel.vue +193 -193
  70. package/src/components/TicketList.vue +655 -594
  71. package/src/components/TicketMergeDialog.vue +157 -157
  72. package/src/components/TicketSplitDialog.vue +98 -0
  73. package/src/components/TotpInput.stories.js +9 -9
  74. package/src/components/TotpInput.vue +81 -81
  75. package/src/components/TwoFactorSetup.vue +113 -113
  76. package/src/components/VariableTokenInput.vue +111 -0
  77. package/src/components/WorkflowActionConfig.vue +287 -0
  78. package/src/components/WorkflowActionList.vue +350 -0
  79. package/src/components/WorkflowConditionBuilder.vue +265 -0
  80. package/src/components/WorkflowTriggerSelector.vue +125 -0
  81. package/src/composables/useChat.js +187 -0
  82. package/src/composables/useI18n.js +80 -80
  83. package/src/composables/useKeyboardShortcuts.js +46 -46
  84. package/src/composables/useMentions.js +134 -0
  85. package/src/composables/usePluginExtensions.js +159 -159
  86. package/src/composables/usePluginHooks.js +65 -65
  87. package/src/composables/useRealtime.js +182 -0
  88. package/src/defineEscalatedPlugin.js +76 -76
  89. package/src/index.js +84 -72
  90. package/src/locales/ar.json +727 -0
  91. package/src/locales/de.json +678 -430
  92. package/src/locales/en.json +717 -455
  93. package/src/locales/es.json +679 -430
  94. package/src/locales/fr.json +680 -431
  95. package/src/locales/index.js +12 -2
  96. package/src/locales/it.json +727 -0
  97. package/src/locales/ja.json +727 -0
  98. package/src/locales/ko.json +727 -0
  99. package/src/locales/nl.json +727 -0
  100. package/src/locales/pl.json +727 -0
  101. package/src/locales/pt-BR.json +727 -0
  102. package/src/locales/ru.json +727 -0
  103. package/src/locales/tr.json +727 -0
  104. package/src/locales/zh-CN.json +727 -0
  105. package/src/pages/Admin/ApiTokens/Index.vue +381 -381
  106. package/src/pages/Admin/AuditLog/Index.vue +154 -154
  107. package/src/pages/Admin/BusinessHours/Form.vue +172 -172
  108. package/src/pages/Admin/BusinessHours/Index.vue +113 -113
  109. package/src/pages/Admin/CannedResponses/Index.vue +127 -127
  110. package/src/pages/Admin/Capacity/Index.vue +134 -134
  111. package/src/pages/Admin/CustomFields/Form.vue +195 -195
  112. package/src/pages/Admin/CustomFields/Index.vue +134 -134
  113. package/src/pages/Admin/CustomObjects/Form.vue +202 -202
  114. package/src/pages/Admin/CustomObjects/Index.vue +127 -127
  115. package/src/pages/Admin/CustomObjects/Records.vue +228 -228
  116. package/src/pages/Admin/Departments/Form.vue +75 -75
  117. package/src/pages/Admin/Departments/Index.vue +110 -109
  118. package/src/pages/Admin/EscalationRules/Form.vue +157 -157
  119. package/src/pages/Admin/EscalationRules/Index.vue +178 -178
  120. package/src/pages/Admin/Import/Connect.vue +0 -1
  121. package/src/pages/Admin/Import/Index.vue +1 -1
  122. package/src/pages/Admin/Import/Progress.vue +1 -1
  123. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
  124. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
  125. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
  126. package/src/pages/Admin/Macros/Index.vue +448 -448
  127. package/src/pages/Admin/Plugins/Index.vue +327 -327
  128. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  129. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
  130. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  131. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  132. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  133. package/src/pages/Admin/Reports/CsatReport.vue +127 -127
  134. package/src/pages/Admin/Reports/Dashboard.vue +36 -21
  135. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  136. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  137. package/src/pages/Admin/Reports/SlaReport.vue +162 -166
  138. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  139. package/src/pages/Admin/Reports.vue +206 -206
  140. package/src/pages/Admin/Roles/Form.vue +71 -71
  141. package/src/pages/Admin/Roles/Index.vue +122 -122
  142. package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
  143. package/src/pages/Admin/Settings/DataRetention.vue +182 -182
  144. package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
  145. package/src/pages/Admin/Settings/Sandbox.vue +135 -135
  146. package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
  147. package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
  148. package/src/pages/Admin/Settings.vue +1008 -468
  149. package/src/pages/Admin/Skills/Form.vue +53 -53
  150. package/src/pages/Admin/Skills/Index.vue +94 -94
  151. package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
  152. package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
  153. package/src/pages/Admin/Statuses/Form.vue +114 -114
  154. package/src/pages/Admin/Statuses/Index.vue +153 -153
  155. package/src/pages/Admin/Tags/Index.vue +191 -191
  156. package/src/pages/Admin/Tickets/Index.vue +126 -91
  157. package/src/pages/Admin/Tickets/Show.vue +29 -0
  158. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
  159. package/src/pages/Admin/Webhooks/Form.vue +110 -110
  160. package/src/pages/Admin/Webhooks/Index.vue +136 -136
  161. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  162. package/src/pages/Admin/Workflows/Index.vue +235 -0
  163. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  164. package/src/pages/Agent/TicketIndex.vue +112 -88
  165. package/src/pages/Agent/TicketShow.vue +192 -60
  166. package/src/pages/Customer/Create.vue +1 -1
  167. package/src/pages/Customer/Index.vue +31 -31
  168. package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
  169. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
  170. package/src/pages/Customer/Show.vue +69 -63
  171. package/src/pages/Guest/Create.vue +40 -15
  172. package/src/pages/Guest/Show.vue +124 -93
  173. package/src/plugin.js +25 -0
  174. package/src/utils/mentionHighlight.js +24 -0
  175. package/src/utils/sanitizeHtml.js +78 -64
  176. package/src/widget/EscalatedWidget.vue +804 -0
  177. package/src/widget/index.js +254 -0
  178. package/src/pages/Admin/Automations/Form.vue +0 -184
  179. package/src/pages/Admin/Automations/Index.vue +0 -129
@@ -0,0 +1,235 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { Link, router } from '@inertiajs/vue3';
4
+ import { ref } from 'vue';
5
+
6
+ defineProps({
7
+ workflows: { type: Array, default: () => [] },
8
+ });
9
+
10
+ const dragIndex = ref(null);
11
+
12
+ function destroy(id) {
13
+ if (confirm('Delete this workflow? This cannot be undone.')) {
14
+ router.delete(route('escalated.admin.workflows.destroy', id));
15
+ }
16
+ }
17
+
18
+ function toggleActive(workflow) {
19
+ router.put(route('escalated.admin.workflows.toggle', workflow.id), {
20
+ active: !workflow.active,
21
+ });
22
+ }
23
+
24
+ function onDragStart(index) {
25
+ dragIndex.value = index;
26
+ }
27
+
28
+ function onDragOver(event) {
29
+ event.preventDefault();
30
+ }
31
+
32
+ function onDrop(event, workflows, targetIndex) {
33
+ event.preventDefault();
34
+ if (dragIndex.value === null || dragIndex.value === targetIndex) return;
35
+ const ids = workflows.map((w) => w.id);
36
+ const [moved] = ids.splice(dragIndex.value, 1);
37
+ ids.splice(targetIndex, 0, moved);
38
+ router.post(route('escalated.admin.workflows.reorder'), { ids });
39
+ dragIndex.value = null;
40
+ }
41
+
42
+ function onDragEnd() {
43
+ dragIndex.value = null;
44
+ }
45
+
46
+ function triggerBadgeClass(trigger) {
47
+ const classes = {
48
+ ticket_created: 'bg-blue-500/10 text-blue-400',
49
+ ticket_updated: 'bg-cyan-500/10 text-cyan-400',
50
+ reply_added: 'bg-emerald-500/10 text-emerald-400',
51
+ status_changed: 'bg-violet-500/10 text-violet-400',
52
+ ticket_assigned: 'bg-indigo-500/10 text-indigo-400',
53
+ ticket_escalated: 'bg-red-500/10 text-red-400',
54
+ sla_breached: 'bg-rose-500/10 text-rose-400',
55
+ sla_warning: 'bg-amber-500/10 text-amber-400',
56
+ chat_started: 'bg-teal-500/10 text-teal-400',
57
+ chat_ended: 'bg-gray-500/10 text-gray-400',
58
+ };
59
+ return classes[trigger] || 'bg-gray-500/10 text-gray-400';
60
+ }
61
+
62
+ function triggerLabel(trigger) {
63
+ return (trigger || '').replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
64
+ }
65
+ </script>
66
+
67
+ <template>
68
+ <EscalatedLayout title="Workflows">
69
+ <div class="mb-4 flex items-center justify-between">
70
+ <div>
71
+ <h2 class="text-lg font-semibold text-[var(--esc-panel-text-secondary)]">Workflows</h2>
72
+ <p class="text-xs text-[var(--esc-panel-text-muted)]">
73
+ Event-driven automations with conditions, actions, and delays
74
+ </p>
75
+ </div>
76
+ <div class="flex items-center gap-3">
77
+ <Link
78
+ :href="route('escalated.admin.workflows.logs')"
79
+ class="rounded-lg border border-[var(--esc-panel-border)] px-3 py-2 text-sm font-medium text-[var(--esc-panel-text-secondary)] transition-colors hover:bg-[var(--esc-panel-hover)]"
80
+ >
81
+ View Logs
82
+ </Link>
83
+ <Link
84
+ :href="route('escalated.admin.workflows.create')"
85
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-4 py-2 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-all hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)]"
86
+ >
87
+ Create Workflow
88
+ </Link>
89
+ </div>
90
+ </div>
91
+
92
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
93
+ <table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
94
+ <thead>
95
+ <tr class="bg-[var(--esc-panel-hover)]">
96
+ <th class="w-8 px-2 py-3" />
97
+ <th
98
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
99
+ >
100
+ Name
101
+ </th>
102
+ <th
103
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
104
+ >
105
+ Trigger
106
+ </th>
107
+ <th
108
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
109
+ >
110
+ Status
111
+ </th>
112
+ <th
113
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
114
+ >
115
+ Last Triggered
116
+ </th>
117
+ <th
118
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
119
+ >
120
+ Runs
121
+ </th>
122
+ <th
123
+ class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
124
+ >
125
+ Actions
126
+ </th>
127
+ </tr>
128
+ </thead>
129
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
130
+ <tr v-if="!workflows?.length">
131
+ <td colspan="7" class="px-4 py-12 text-center">
132
+ <svg
133
+ class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
134
+ fill="none"
135
+ stroke="currentColor"
136
+ stroke-width="1.5"
137
+ viewBox="0 0 24 24"
138
+ >
139
+ <path
140
+ stroke-linecap="round"
141
+ stroke-linejoin="round"
142
+ d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"
143
+ />
144
+ <path
145
+ stroke-linecap="round"
146
+ stroke-linejoin="round"
147
+ d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
148
+ />
149
+ </svg>
150
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No workflows yet</p>
151
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
152
+ Create event-driven automations with conditions and actions
153
+ </p>
154
+ </td>
155
+ </tr>
156
+ <tr
157
+ v-for="(workflow, i) in workflows"
158
+ :key="workflow.id"
159
+ class="transition-colors hover:bg-[var(--esc-panel-hover)]"
160
+ draggable="true"
161
+ @dragstart="onDragStart(i)"
162
+ @dragover="onDragOver($event)"
163
+ @drop="onDrop($event, workflows, i)"
164
+ @dragend="onDragEnd"
165
+ >
166
+ <td class="px-2 py-3">
167
+ <div class="cursor-grab text-[var(--esc-panel-text-muted)]">
168
+ <svg class="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
169
+ <circle cx="9" cy="6" r="1.5" />
170
+ <circle cx="15" cy="6" r="1.5" />
171
+ <circle cx="9" cy="12" r="1.5" />
172
+ <circle cx="15" cy="12" r="1.5" />
173
+ <circle cx="9" cy="18" r="1.5" />
174
+ <circle cx="15" cy="18" r="1.5" />
175
+ </svg>
176
+ </div>
177
+ </td>
178
+ <td class="px-4 py-3">
179
+ <Link
180
+ :href="route('escalated.admin.workflows.edit', workflow.id)"
181
+ class="text-sm font-medium text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
182
+ >
183
+ {{ workflow.name }}
184
+ </Link>
185
+ <p
186
+ v-if="workflow.description"
187
+ class="mt-0.5 truncate text-xs text-[var(--esc-panel-text-muted)]"
188
+ >
189
+ {{ workflow.description }}
190
+ </p>
191
+ </td>
192
+ <td class="px-4 py-3">
193
+ <span
194
+ class="inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium"
195
+ :class="triggerBadgeClass(workflow.trigger)"
196
+ >
197
+ {{ triggerLabel(workflow.trigger) }}
198
+ </span>
199
+ </td>
200
+ <td class="px-4 py-3">
201
+ <button
202
+ type="button"
203
+ class="relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none"
204
+ :class="workflow.active ? 'bg-emerald-500' : 'bg-[var(--esc-panel-border)]'"
205
+ @click="toggleActive(workflow)"
206
+ >
207
+ <span
208
+ class="pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
209
+ :class="workflow.active ? 'translate-x-4' : 'translate-x-0'"
210
+ />
211
+ </button>
212
+ </td>
213
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
214
+ {{ workflow.last_triggered_at || '---' }}
215
+ </td>
216
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
217
+ {{ workflow.trigger_count || 0 }}
218
+ </td>
219
+ <td class="px-4 py-3 text-right text-sm">
220
+ <Link
221
+ :href="route('escalated.admin.workflows.edit', workflow.id)"
222
+ class="text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
223
+ >
224
+ Edit
225
+ </Link>
226
+ <button class="ml-3 text-rose-400 hover:text-rose-300" @click="destroy(workflow.id)">
227
+ Delete
228
+ </button>
229
+ </td>
230
+ </tr>
231
+ </tbody>
232
+ </table>
233
+ </div>
234
+ </EscalatedLayout>
235
+ </template>
@@ -0,0 +1,286 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { ref } from 'vue';
4
+
5
+ defineProps({
6
+ logs: { type: Array, default: () => [] },
7
+ workflows: { type: Array, default: () => [] },
8
+ });
9
+
10
+ const expandedLog = ref(null);
11
+ const filterWorkflow = ref('');
12
+ const filterDateFrom = ref('');
13
+ const filterDateTo = ref('');
14
+ const filterTicket = ref('');
15
+
16
+ function toggleLog(id) {
17
+ expandedLog.value = expandedLog.value === id ? null : id;
18
+ }
19
+
20
+ function statusBadgeClass(status) {
21
+ switch (status) {
22
+ case 'success':
23
+ return 'bg-emerald-500/10 text-emerald-400';
24
+ case 'failed':
25
+ return 'bg-rose-500/10 text-rose-400';
26
+ case 'skipped':
27
+ return 'bg-gray-500/10 text-gray-400';
28
+ default:
29
+ return 'bg-gray-500/10 text-gray-400';
30
+ }
31
+ }
32
+
33
+ function statusLabel(status) {
34
+ switch (status) {
35
+ case 'success':
36
+ return 'Success';
37
+ case 'failed':
38
+ return 'Failed';
39
+ case 'skipped':
40
+ return 'Skipped';
41
+ default:
42
+ return status;
43
+ }
44
+ }
45
+
46
+ function actionStatusIcon(status) {
47
+ switch (status) {
48
+ case 'success':
49
+ return 'M4.5 12.75l6 6 9-13.5';
50
+ case 'failed':
51
+ return 'M6 18L18 6M6 6l12 12';
52
+ case 'skipped':
53
+ return 'M3 8.688c0-.864.933-1.405 1.683-.977l7.108 4.062a1.125 1.125 0 010 1.953l-7.108 4.062A1.125 1.125 0 013 16.81V8.688zM12.75 8.688c0-.864.933-1.405 1.683-.977l7.108 4.062a1.125 1.125 0 010 1.953l-7.108 4.062a1.125 1.125 0 01-1.683-.977V8.688z';
54
+ default:
55
+ return 'M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z';
56
+ }
57
+ }
58
+ </script>
59
+
60
+ <template>
61
+ <EscalatedLayout title="Workflow Logs">
62
+ <div class="mb-4">
63
+ <h2 class="text-lg font-semibold text-[var(--esc-panel-text-secondary)]">Workflow Execution Logs</h2>
64
+ <p class="text-xs text-[var(--esc-panel-text-muted)]">Track workflow executions and debug issues</p>
65
+ </div>
66
+
67
+ <!-- Filters -->
68
+ <div
69
+ class="mb-4 flex flex-wrap items-center gap-3 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-4"
70
+ >
71
+ <div>
72
+ <label class="block text-[10px] font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
73
+ >Workflow</label
74
+ >
75
+ <select
76
+ v-model="filterWorkflow"
77
+ class="mt-1 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
78
+ >
79
+ <option value="">All Workflows</option>
80
+ <option v-for="w in workflows" :key="w.id" :value="w.id">{{ w.name }}</option>
81
+ </select>
82
+ </div>
83
+ <div>
84
+ <label class="block text-[10px] font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
85
+ >From</label
86
+ >
87
+ <input
88
+ v-model="filterDateFrom"
89
+ type="date"
90
+ class="mt-1 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
91
+ />
92
+ </div>
93
+ <div>
94
+ <label class="block text-[10px] font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
95
+ >To</label
96
+ >
97
+ <input
98
+ v-model="filterDateTo"
99
+ type="date"
100
+ class="mt-1 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
101
+ />
102
+ </div>
103
+ <div>
104
+ <label class="block text-[10px] font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
105
+ >Ticket</label
106
+ >
107
+ <input
108
+ v-model="filterTicket"
109
+ type="text"
110
+ placeholder="Reference..."
111
+ class="mt-1 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
112
+ />
113
+ </div>
114
+ </div>
115
+
116
+ <!-- Logs table -->
117
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
118
+ <table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
119
+ <thead>
120
+ <tr class="bg-[var(--esc-panel-hover)]">
121
+ <th
122
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
123
+ >
124
+ Timestamp
125
+ </th>
126
+ <th
127
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
128
+ >
129
+ Workflow
130
+ </th>
131
+ <th
132
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
133
+ >
134
+ Ticket
135
+ </th>
136
+ <th
137
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
138
+ >
139
+ Event
140
+ </th>
141
+ <th
142
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
143
+ >
144
+ Matched
145
+ </th>
146
+ <th
147
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
148
+ >
149
+ Actions
150
+ </th>
151
+ <th
152
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
153
+ >
154
+ Duration
155
+ </th>
156
+ <th
157
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
158
+ >
159
+ Status
160
+ </th>
161
+ </tr>
162
+ </thead>
163
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
164
+ <tr v-if="!logs?.length">
165
+ <td colspan="8" class="px-4 py-12 text-center">
166
+ <svg
167
+ class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
168
+ fill="none"
169
+ stroke="currentColor"
170
+ stroke-width="1.5"
171
+ viewBox="0 0 24 24"
172
+ >
173
+ <path
174
+ stroke-linecap="round"
175
+ stroke-linejoin="round"
176
+ d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
177
+ />
178
+ </svg>
179
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No execution logs yet</p>
180
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
181
+ Logs appear when workflows are triggered
182
+ </p>
183
+ </td>
184
+ </tr>
185
+ <template v-for="log in logs" :key="log.id">
186
+ <tr
187
+ class="cursor-pointer transition-colors hover:bg-[var(--esc-panel-hover)]"
188
+ @click="toggleLog(log.id)"
189
+ >
190
+ <td class="px-4 py-3 text-xs text-[var(--esc-panel-text-tertiary)]">
191
+ {{ log.created_at }}
192
+ </td>
193
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
194
+ {{ log.workflow_name }}
195
+ </td>
196
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
197
+ {{ log.ticket_reference }}
198
+ </td>
199
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
200
+ {{ log.event }}
201
+ </td>
202
+ <td class="px-4 py-3">
203
+ <span
204
+ class="inline-flex rounded-full px-2 py-0.5 text-xs font-medium"
205
+ :class="
206
+ log.matched
207
+ ? 'bg-emerald-500/10 text-emerald-400'
208
+ : 'bg-gray-500/10 text-gray-400'
209
+ "
210
+ >
211
+ {{ log.matched ? 'Yes' : 'No' }}
212
+ </span>
213
+ </td>
214
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
215
+ {{ log.actions_executed || 0 }}
216
+ </td>
217
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
218
+ {{ log.duration_ms ? log.duration_ms + 'ms' : '---' }}
219
+ </td>
220
+ <td class="px-4 py-3">
221
+ <span
222
+ class="inline-flex rounded-full px-2 py-0.5 text-xs font-medium"
223
+ :class="statusBadgeClass(log.status)"
224
+ >
225
+ {{ statusLabel(log.status) }}
226
+ </span>
227
+ </td>
228
+ </tr>
229
+ <!-- Expanded detail row -->
230
+ <tr v-if="expandedLog === log.id">
231
+ <td colspan="8" class="bg-[var(--esc-panel-hover)] px-6 py-4">
232
+ <h4
233
+ class="mb-3 text-xs font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
234
+ >
235
+ Action-by-Action Execution
236
+ </h4>
237
+ <div v-if="log.action_details?.length" class="space-y-2">
238
+ <div
239
+ v-for="(detail, i) in log.action_details"
240
+ :key="i"
241
+ class="flex items-start gap-3 rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-3"
242
+ >
243
+ <svg
244
+ class="mt-0.5 h-4 w-4 flex-shrink-0"
245
+ :class="statusBadgeClass(detail.status).split(' ')[1]"
246
+ fill="none"
247
+ stroke="currentColor"
248
+ stroke-width="2"
249
+ viewBox="0 0 24 24"
250
+ >
251
+ <path
252
+ stroke-linecap="round"
253
+ stroke-linejoin="round"
254
+ :d="actionStatusIcon(detail.status)"
255
+ />
256
+ </svg>
257
+ <div class="min-w-0 flex-1">
258
+ <div class="text-sm font-medium text-[var(--esc-panel-text-secondary)]">
259
+ {{ detail.action_type }}
260
+ </div>
261
+ <div
262
+ v-if="detail.message"
263
+ class="mt-0.5 text-xs text-[var(--esc-panel-text-muted)]"
264
+ >
265
+ {{ detail.message }}
266
+ </div>
267
+ <div v-if="detail.error" class="mt-1 text-xs text-rose-400">
268
+ {{ detail.error }}
269
+ </div>
270
+ </div>
271
+ <div class="text-xs text-[var(--esc-panel-text-muted)]">
272
+ {{ detail.duration_ms ? detail.duration_ms + 'ms' : '' }}
273
+ </div>
274
+ </div>
275
+ </div>
276
+ <p v-else class="text-xs text-[var(--esc-panel-text-muted)]">
277
+ No detailed action logs available
278
+ </p>
279
+ </td>
280
+ </tr>
281
+ </template>
282
+ </tbody>
283
+ </table>
284
+ </div>
285
+ </EscalatedLayout>
286
+ </template>