@elevasis/ui 2.34.0 → 2.36.0
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/api/index.js +3 -3
- package/dist/app/index.d.ts +37 -30
- package/dist/app/index.js +25 -23
- package/dist/charts/index.js +3 -5
- package/dist/{chunk-ND5TDV2J.js → chunk-57OZ3AEG.js} +1 -1
- package/dist/{chunk-E4WQGJNS.js → chunk-7FPLLSHN.js} +14 -1
- package/dist/{chunk-RQA2EVN3.js → chunk-AKW7KISS.js} +39 -3
- package/dist/chunk-AUDNF2Q7.js +2050 -0
- package/dist/chunk-F6EFC2MJ.js +41101 -0
- package/dist/{chunk-TYRUKGGD.js → chunk-GX6XBRRF.js} +1 -2
- package/dist/{chunk-RIAXZ6AH.js → chunk-K4UZU3TU.js} +2 -2
- package/dist/{chunk-V6SZ4ECN.js → chunk-LUYVRATI.js} +257 -6
- package/dist/{chunk-DTFKWZ7A.js → chunk-O2Q4VMRN.js} +589 -932
- package/dist/{chunk-X4WBGKJQ.js → chunk-R3VCBZDC.js} +50 -3
- package/dist/chunk-SIQ3P4OR.js +1764 -0
- package/dist/{chunk-3FV6HBXS.js → chunk-WF7CONXF.js} +23 -23
- package/dist/{chunk-3QXJK5IY.js → chunk-YYX7OPZQ.js} +1 -1
- package/dist/components/index.d.ts +74 -71
- package/dist/components/index.js +20 -2795
- package/dist/components/navigation/index.js +25 -5
- package/dist/execution/index.d.ts +11 -11
- package/dist/execution/index.js +1 -2
- package/dist/features/auth/index.d.ts +3 -0
- package/dist/features/auth/index.js +23 -2
- package/dist/features/clients/index.js +20 -26
- package/dist/features/crm/index.d.ts +3 -0
- package/dist/features/crm/index.js +20 -30
- package/dist/features/dashboard/index.d.ts +69 -69
- package/dist/features/dashboard/index.js +20 -28
- package/dist/features/delivery/index.d.ts +3 -0
- package/dist/features/delivery/index.js +20 -30
- package/dist/features/knowledge/index.js +25 -9
- package/dist/features/lead-gen/index.d.ts +295 -57
- package/dist/features/lead-gen/index.js +20 -31
- package/dist/features/monitoring/index.js +20 -30
- package/dist/features/monitoring/requests/index.js +20 -25
- package/dist/features/operations/index.d.ts +183 -183
- package/dist/features/operations/index.js +18 -37
- package/dist/features/seo/index.js +3 -4
- package/dist/features/settings/index.d.ts +3 -0
- package/dist/features/settings/index.js +20 -27
- package/dist/graph/index.js +1 -1
- package/dist/hooks/delivery/index.d.ts +3 -0
- package/dist/hooks/delivery/index.js +30 -2
- package/dist/hooks/index.d.ts +112 -99
- package/dist/hooks/index.js +20 -21
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +46 -46
- package/dist/hooks/published.d.ts +112 -99
- package/dist/hooks/published.js +20 -20
- package/dist/index.css +532 -532
- package/dist/index.d.ts +9385 -5915
- package/dist/index.js +22 -26
- package/dist/initialization/index.d.ts +3 -0
- package/dist/knowledge/index.d.ts +42 -42
- package/dist/knowledge/index.js +10 -17
- package/dist/{knowledge-search-index-ORIJCEZX.js → knowledge-search-index-NBCTFIOH.js} +2 -2
- package/dist/layout/index.js +4 -10
- package/dist/organization/index.js +27 -1
- package/dist/profile/index.d.ts +3 -0
- package/dist/provider/index.d.ts +72 -39
- package/dist/provider/index.js +20 -15
- package/dist/provider/published.d.ts +40 -34
- package/dist/provider/published.js +20 -11
- package/dist/sse/index.js +26 -5
- package/dist/supabase/index.d.ts +6 -0
- package/dist/test-utils/index.js +3 -3
- package/dist/theme/index.js +2 -3
- package/dist/theme/presets/index.d.ts +28 -3
- package/dist/theme/presets/index.js +1 -1
- package/dist/typeform/index.js +1 -2049
- package/dist/types/index.d.ts +82 -79
- package/dist/utils/index.d.ts +47 -47
- package/dist/utils/index.js +1 -1
- package/dist/zustand/index.d.ts +6 -6
- package/dist/zustand/index.js +0 -3
- package/package.json +5 -5
- package/dist/chunk-3AJVNMY5.js +0 -4769
- package/dist/chunk-3MEXPLWT.js +0 -265
- package/dist/chunk-3ZMAGTWF.js +0 -18
- package/dist/chunk-4O4MII5S.js +0 -4716
- package/dist/chunk-5EYJ2GIN.js +0 -122
- package/dist/chunk-7M2VOCYN.js +0 -1
- package/dist/chunk-BPQVTIUP.js +0 -105
- package/dist/chunk-BZZCNLT6.js +0 -12
- package/dist/chunk-CLDCYJQT.js +0 -1
- package/dist/chunk-E565XMTQ.js +0 -17
- package/dist/chunk-HRWLKKWM.js +0 -758
- package/dist/chunk-IGDYWFNE.js +0 -5198
- package/dist/chunk-IIMU5YAJ.js +0 -53
- package/dist/chunk-IVGI4GDL.js +0 -1593
- package/dist/chunk-JFL3GRD4.js +0 -39
- package/dist/chunk-LAWLB6CT.js +0 -951
- package/dist/chunk-LGKLC5MG.js +0 -44
- package/dist/chunk-LRWTWOGP.js +0 -1778
- package/dist/chunk-MP3GPBPX.js +0 -1874
- package/dist/chunk-N55DVMAG.js +0 -14
- package/dist/chunk-NLBQTDOW.js +0 -12051
- package/dist/chunk-O6JXQ6UQ.js +0 -468
- package/dist/chunk-OBBQ2JCM.js +0 -68
- package/dist/chunk-PDHTXPSF.js +0 -12
- package/dist/chunk-PLP3NYPL.js +0 -356
- package/dist/chunk-R2XR4FCV.js +0 -48
- package/dist/chunk-R66W5UDG.js +0 -26
- package/dist/chunk-RYTEQBAO.js +0 -37
- package/dist/chunk-SDXSB3HN.js +0 -425
- package/dist/chunk-TKAYX2SP.js +0 -204
- package/dist/chunk-TUMSNGTX.js +0 -35
- package/dist/chunk-VNAZTCHA.js +0 -65
- package/dist/chunk-VNFR57DF.js +0 -87
- package/dist/chunk-VTXTZXAU.js +0 -539
- package/dist/chunk-W73ZABT6.js +0 -85
- package/dist/chunk-WU4FNWCW.js +0 -2281
- package/dist/chunk-XZGSCABI.js +0 -383
- package/dist/chunk-YNWZIWJL.js +0 -1863
- /package/dist/{chunk-2RJMVWFJ.js → chunk-GEFWMU26.js} +0 -0
- /package/dist/{chunk-22UVE3RA.js → chunk-HENXLGVD.js} +0 -0
package/dist/chunk-LRWTWOGP.js
DELETED
|
@@ -1,1778 +0,0 @@
|
|
|
1
|
-
import { CyberAreaChart, CostTrendChart, ActivityTrendChart } from './chunk-LAWLB6CT.js';
|
|
2
|
-
import { AppShellLoader } from './chunk-RYTEQBAO.js';
|
|
3
|
-
import { FilterBar } from './chunk-PDHTXPSF.js';
|
|
4
|
-
import { CustomModal } from './chunk-R66W5UDG.js';
|
|
5
|
-
import { formatDuration } from './chunk-E4WQGJNS.js';
|
|
6
|
-
import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead, useExecutionLogsFilters, useExecutionLogs, useExecutionHealth, useErrorAnalysis, useTimeRangeDates, useErrorDetail, useResolveErrorsByExecution, useResources, useCostTrends, useCostSummary, useCostByModel, useCostBreakdown, useActivityFilters, useActivityTrend, useActivities, useNotifications, useMarkAllAsRead } from './chunk-IGDYWFNE.js';
|
|
7
|
-
import { CenteredErrorState, CardHeader, StatsCardSkeleton, TrendIndicator, DetailCardSkeleton, EmptyState, PageTitleCaption, JsonViewer } from './chunk-HRWLKKWM.js';
|
|
8
|
-
import { useRouterContext } from './chunk-Q7DJKLEN.js';
|
|
9
|
-
import { formatBucketTime, PAGE_SIZE_DEFAULT, getTimeRangeDates } from './chunk-2RJMVWFJ.js';
|
|
10
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
11
|
-
import { Table, Text, Badge, Tooltip, Card, Group, Select, SegmentedControl, Button, TextInput, Stack, Paper, Center, Loader, ActionIcon, NumberFormatter, Box, Alert, Switch, Pagination, UnstyledButton, Title, Divider, Code, CopyButton, Accordion } from '@mantine/core';
|
|
12
|
-
import { IconActivity, IconFilterOff, IconCircleCheck, IconThumbDown, IconThumbUp, IconClock, IconCircleX, IconSearch, IconArrowUpRight, IconAlertTriangle, IconAlertCircle, IconExternalLink, IconChartPie, IconHeartbeat, IconDownload, IconCpu, IconTrendingUp, IconChartBar, IconCash, IconInfoCircle, IconExclamationCircle, IconBug, IconChecks, IconCircle, IconCircleFilled, IconCheck, IconCopy, IconCircleDashed, IconArrowUp, IconArrowDown, IconFileOff, IconRobot, IconKey, IconUser } from '@tabler/icons-react';
|
|
13
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
import { formatDistanceToNow } from 'date-fns';
|
|
15
|
-
|
|
16
|
-
function formatStartTime(timestamp) {
|
|
17
|
-
return new Date(timestamp).toLocaleString("en-US", {
|
|
18
|
-
month: "short",
|
|
19
|
-
day: "numeric",
|
|
20
|
-
hour: "numeric",
|
|
21
|
-
minute: "2-digit"
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function getStatusConfig(status) {
|
|
25
|
-
switch (status) {
|
|
26
|
-
case "running":
|
|
27
|
-
return {
|
|
28
|
-
icon: /* @__PURE__ */ jsx(IconCircle, { size: 14, color: "var(--color-primary)" }),
|
|
29
|
-
label: "Running",
|
|
30
|
-
color: "blue"
|
|
31
|
-
};
|
|
32
|
-
case "completed":
|
|
33
|
-
return {
|
|
34
|
-
icon: /* @__PURE__ */ jsx(IconCircleCheck, { size: 14, color: "var(--color-success)" }),
|
|
35
|
-
label: "Completed",
|
|
36
|
-
color: "green"
|
|
37
|
-
};
|
|
38
|
-
case "failed":
|
|
39
|
-
return {
|
|
40
|
-
icon: /* @__PURE__ */ jsx(IconCircleX, { size: 14, color: "var(--color-error)" }),
|
|
41
|
-
label: "Failed",
|
|
42
|
-
color: "red"
|
|
43
|
-
};
|
|
44
|
-
case "warning":
|
|
45
|
-
return {
|
|
46
|
-
icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 14, color: "var(--color-warning)" }),
|
|
47
|
-
label: "Warning",
|
|
48
|
-
color: "yellow"
|
|
49
|
-
};
|
|
50
|
-
case "pending":
|
|
51
|
-
default:
|
|
52
|
-
return {
|
|
53
|
-
icon: /* @__PURE__ */ jsx(IconCircle, { size: 14, color: "var(--mantine-color-gray-6)" }),
|
|
54
|
-
label: "Pending",
|
|
55
|
-
color: "gray"
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function LoadingState() {
|
|
60
|
-
return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "md" }) });
|
|
61
|
-
}
|
|
62
|
-
function EmptyState2() {
|
|
63
|
-
return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
|
|
64
|
-
/* @__PURE__ */ jsx(IconFileOff, { size: 48, color: "var(--color-text-subtle)" }),
|
|
65
|
-
/* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, c: "dimmed", children: "No executions found" }),
|
|
66
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Executions will appear here when workflows or agents are run" })
|
|
67
|
-
] }) });
|
|
68
|
-
}
|
|
69
|
-
function ExecutionLogsTable({ executions, isLoading, onRowClick }) {
|
|
70
|
-
const handleRowClick = (execution) => {
|
|
71
|
-
onRowClick?.({
|
|
72
|
-
resourceType: execution.resourceType,
|
|
73
|
-
resourceId: execution.resourceId,
|
|
74
|
-
executionId: execution.id
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
return /* @__PURE__ */ jsxs(Table, { highlightOnHover: true, children: [
|
|
78
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
79
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Resource" }),
|
|
80
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Status" }),
|
|
81
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Started" }),
|
|
82
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Duration" }),
|
|
83
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Env" }),
|
|
84
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Version" })
|
|
85
|
-
] }) }),
|
|
86
|
-
/* @__PURE__ */ jsx(Table.Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: 6, children: /* @__PURE__ */ jsx(LoadingState, {}) }) }) : executions.length === 0 ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: 6, children: /* @__PURE__ */ jsx(EmptyState2, {}) }) }) : executions.map((execution) => {
|
|
87
|
-
const statusConfig3 = getStatusConfig(execution.status);
|
|
88
|
-
return /* @__PURE__ */ jsxs(
|
|
89
|
-
Table.Tr,
|
|
90
|
-
{
|
|
91
|
-
style: { cursor: onRowClick ? "pointer" : void 0 },
|
|
92
|
-
onClick: () => handleRowClick(execution),
|
|
93
|
-
children: [
|
|
94
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 200 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, title: execution.resourceName, children: execution.resourceName }) }),
|
|
95
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: statusConfig3.color, variant: "light", size: "sm", leftSection: statusConfig3.icon, children: statusConfig3.label }) }),
|
|
96
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", children: formatStartTime(execution.startTime) }) }),
|
|
97
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: execution.status === "running" ? "dimmed" : void 0, children: formatDuration(execution.duration) }) }),
|
|
98
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "center", children: /* @__PURE__ */ jsx(Badge, { color: execution.resourceStatus === "prod" ? "green" : "gray", variant: "light", size: "sm", children: execution.resourceStatus.toUpperCase() }) }),
|
|
99
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "center", children: /* @__PURE__ */ jsx(
|
|
100
|
-
Tooltip,
|
|
101
|
-
{
|
|
102
|
-
label: `Resource: ${execution.resourceVersion ?? "-"}
|
|
103
|
-
API: ${execution.apiVersion ?? "-"}
|
|
104
|
-
SDK: ${execution.sdkVersion ?? "-"}`,
|
|
105
|
-
multiline: true,
|
|
106
|
-
position: "left",
|
|
107
|
-
children: /* @__PURE__ */ jsx(Text, { size: "sm", ff: "monospace", c: "dimmed", style: { cursor: "help" }, children: execution.resourceVersion ?? "-" })
|
|
108
|
-
}
|
|
109
|
-
) })
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
execution.id
|
|
113
|
-
);
|
|
114
|
-
}) })
|
|
115
|
-
] });
|
|
116
|
-
}
|
|
117
|
-
var resourceOptions = [{ value: "", label: "All Resources" }];
|
|
118
|
-
var statusOptions = [
|
|
119
|
-
{ value: "all", label: "All" },
|
|
120
|
-
{ value: "running", label: "Running" },
|
|
121
|
-
{ value: "completed", label: "Completed" },
|
|
122
|
-
{ value: "warning", label: "Warning" },
|
|
123
|
-
{ value: "failed", label: "Failed" }
|
|
124
|
-
];
|
|
125
|
-
var environmentOptions = [
|
|
126
|
-
{ value: "all", label: "All" },
|
|
127
|
-
{ value: "dev", label: "Dev" },
|
|
128
|
-
{ value: "prod", label: "Prod" }
|
|
129
|
-
];
|
|
130
|
-
function ExecutionLogsFilters({ filters, onFilterChange, onReset }) {
|
|
131
|
-
const hasActiveFilters = filters.resourceId !== void 0 || filters.status !== "all" || filters.resourceStatus !== "all";
|
|
132
|
-
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Group, { gap: "md", wrap: "wrap", children: [
|
|
133
|
-
/* @__PURE__ */ jsx(
|
|
134
|
-
Select,
|
|
135
|
-
{
|
|
136
|
-
placeholder: "Resource",
|
|
137
|
-
data: resourceOptions,
|
|
138
|
-
value: filters.resourceId ?? "",
|
|
139
|
-
onChange: (value) => onFilterChange("resourceId", value === "" || value === null ? void 0 : value),
|
|
140
|
-
style: { minWidth: 180 }
|
|
141
|
-
}
|
|
142
|
-
),
|
|
143
|
-
/* @__PURE__ */ jsx(
|
|
144
|
-
SegmentedControl,
|
|
145
|
-
{
|
|
146
|
-
data: statusOptions,
|
|
147
|
-
value: filters.status,
|
|
148
|
-
onChange: (value) => onFilterChange("status", value)
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ jsx(
|
|
152
|
-
SegmentedControl,
|
|
153
|
-
{
|
|
154
|
-
data: environmentOptions,
|
|
155
|
-
value: filters.resourceStatus,
|
|
156
|
-
onChange: (value) => onFilterChange("resourceStatus", value)
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
hasActiveFilters && /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "gray", leftSection: /* @__PURE__ */ jsx(IconFilterOff, { size: 16 }), onClick: onReset, children: "Reset" })
|
|
160
|
-
] }) });
|
|
161
|
-
}
|
|
162
|
-
var statusConfig = {
|
|
163
|
-
success: { color: "green", icon: IconCircleCheck },
|
|
164
|
-
failure: { color: "red", icon: IconCircleX },
|
|
165
|
-
pending: { color: "yellow", icon: IconClock },
|
|
166
|
-
approved: { color: "green", icon: IconThumbUp },
|
|
167
|
-
rejected: { color: "red", icon: IconThumbDown },
|
|
168
|
-
completed: { color: "blue", icon: IconCircleCheck }
|
|
169
|
-
};
|
|
170
|
-
var activityTypeLabels = {
|
|
171
|
-
workflow_execution: "Workflow",
|
|
172
|
-
agent_run: "Agent",
|
|
173
|
-
hitl_action: "HITL Action",
|
|
174
|
-
webhook_received: "Webhook In",
|
|
175
|
-
webhook_executed: "Webhook Out",
|
|
176
|
-
webhook_failed: "Webhook Fail",
|
|
177
|
-
credential_change: "Credential",
|
|
178
|
-
credential_read: "Credential Read",
|
|
179
|
-
api_key_change: "API Key",
|
|
180
|
-
deployment_change: "Deployment",
|
|
181
|
-
membership_change: "Membership"
|
|
182
|
-
};
|
|
183
|
-
function getActorDisplay(actorType) {
|
|
184
|
-
switch (actorType) {
|
|
185
|
-
case "user":
|
|
186
|
-
return { label: "User", color: "blue", icon: IconUser };
|
|
187
|
-
case "api_key":
|
|
188
|
-
return { label: "API Key", color: "violet", icon: IconKey };
|
|
189
|
-
default:
|
|
190
|
-
return { label: "System", color: "gray", icon: IconRobot };
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
var COLUMN_COUNT = 6;
|
|
194
|
-
function LoadingState2() {
|
|
195
|
-
return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "md" }) });
|
|
196
|
-
}
|
|
197
|
-
function EmptyState3() {
|
|
198
|
-
return /* @__PURE__ */ jsx(Center, { py: "xl", children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
|
|
199
|
-
/* @__PURE__ */ jsx(IconFileOff, { size: 48, color: "var(--color-text-subtle)" }),
|
|
200
|
-
/* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, c: "dimmed", children: "No activities found" }),
|
|
201
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Activities will appear here as workflows and agents run" })
|
|
202
|
-
] }) });
|
|
203
|
-
}
|
|
204
|
-
function ActivityTable({ activities, isLoading, onRowClick }) {
|
|
205
|
-
return /* @__PURE__ */ jsxs(Table, { children: [
|
|
206
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
207
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Title" }),
|
|
208
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Type" }),
|
|
209
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Status" }),
|
|
210
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Actor" }),
|
|
211
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Entity" }),
|
|
212
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Time" })
|
|
213
|
-
] }) }),
|
|
214
|
-
/* @__PURE__ */ jsx(Table.Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: COLUMN_COUNT, children: /* @__PURE__ */ jsx(LoadingState2, {}) }) }) : activities.length === 0 ? /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, { colSpan: COLUMN_COUNT, children: /* @__PURE__ */ jsx(EmptyState3, {}) }) }) : activities.map((activity) => {
|
|
215
|
-
const config = statusConfig[activity.status];
|
|
216
|
-
const StatusIcon = config.icon;
|
|
217
|
-
const actor = getActorDisplay(activity.actorType);
|
|
218
|
-
const ActorIcon = actor.icon;
|
|
219
|
-
return /* @__PURE__ */ jsxs(
|
|
220
|
-
Table.Tr,
|
|
221
|
-
{
|
|
222
|
-
style: { cursor: onRowClick ? "pointer" : void 0 },
|
|
223
|
-
onClick: () => onRowClick?.(activity),
|
|
224
|
-
children: [
|
|
225
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 250 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, title: activity.title, children: activity.title }) }),
|
|
226
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { variant: "light", size: "sm", color: "gray", children: activityTypeLabels[activity.activityType] }) }),
|
|
227
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: config.color, variant: "light", size: "sm", leftSection: /* @__PURE__ */ jsx(StatusIcon, { size: 14 }), children: activity.status }) }),
|
|
228
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: actor.color, variant: "light", size: "sm", leftSection: /* @__PURE__ */ jsx(ActorIcon, { size: 14 }), children: actor.label }) }),
|
|
229
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 200 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", lineClamp: 1, title: activity.entityName || activity.entityId, children: activity.entityName || activity.entityId }) }),
|
|
230
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: formatDistanceToNow(activity.occurredAt, { addSuffix: true }) }) })
|
|
231
|
-
]
|
|
232
|
-
},
|
|
233
|
-
activity.id
|
|
234
|
-
);
|
|
235
|
-
}) })
|
|
236
|
-
] });
|
|
237
|
-
}
|
|
238
|
-
var activityTypeOptions = [
|
|
239
|
-
{ value: "all", label: "All Types" },
|
|
240
|
-
{ value: "workflow_execution", label: "Workflow Executions" },
|
|
241
|
-
{ value: "agent_run", label: "Agent Runs" },
|
|
242
|
-
{ value: "hitl_action", label: "HITL Actions" },
|
|
243
|
-
{ value: "webhook_received", label: "Webhook Received" },
|
|
244
|
-
{ value: "webhook_executed", label: "Webhook Executed" },
|
|
245
|
-
{ value: "webhook_failed", label: "Webhook Failed" },
|
|
246
|
-
{ value: "credential_change", label: "Credential Changes" },
|
|
247
|
-
{ value: "credential_read", label: "Credential Reads" },
|
|
248
|
-
{ value: "api_key_change", label: "API Key Changes" },
|
|
249
|
-
{ value: "deployment_change", label: "Deployment Changes" },
|
|
250
|
-
{ value: "membership_change", label: "Membership Changes" }
|
|
251
|
-
];
|
|
252
|
-
var statusOptions2 = [
|
|
253
|
-
{ value: "all", label: "All Statuses" },
|
|
254
|
-
{ value: "success", label: "Success" },
|
|
255
|
-
{ value: "failure", label: "Failure" },
|
|
256
|
-
{ value: "pending", label: "Pending" },
|
|
257
|
-
{ value: "approved", label: "Approved" },
|
|
258
|
-
{ value: "rejected", label: "Rejected" },
|
|
259
|
-
{ value: "completed", label: "Completed" }
|
|
260
|
-
];
|
|
261
|
-
function ActivityFilters({ filters, onFilterChange, onReset }) {
|
|
262
|
-
return /* @__PURE__ */ jsxs(
|
|
263
|
-
FilterBar,
|
|
264
|
-
{
|
|
265
|
-
actions: /* @__PURE__ */ jsx(Button, { variant: "subtle", color: "gray", leftSection: /* @__PURE__ */ jsx(IconFilterOff, { size: 16 }), onClick: onReset, children: "Reset" }),
|
|
266
|
-
children: [
|
|
267
|
-
/* @__PURE__ */ jsx(
|
|
268
|
-
Select,
|
|
269
|
-
{
|
|
270
|
-
placeholder: "Activity Type",
|
|
271
|
-
data: activityTypeOptions,
|
|
272
|
-
value: filters.activityType || "all",
|
|
273
|
-
onChange: (value) => onFilterChange("activityType", value),
|
|
274
|
-
style: { flex: 1, minWidth: 200 }
|
|
275
|
-
}
|
|
276
|
-
),
|
|
277
|
-
/* @__PURE__ */ jsx(
|
|
278
|
-
Select,
|
|
279
|
-
{
|
|
280
|
-
placeholder: "Status",
|
|
281
|
-
data: statusOptions2,
|
|
282
|
-
value: filters.status || "all",
|
|
283
|
-
onChange: (value) => onFilterChange("status", value),
|
|
284
|
-
style: { flex: 1, minWidth: 150 }
|
|
285
|
-
}
|
|
286
|
-
),
|
|
287
|
-
/* @__PURE__ */ jsx(
|
|
288
|
-
TextInput,
|
|
289
|
-
{
|
|
290
|
-
placeholder: "Search by name...",
|
|
291
|
-
leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 16 }),
|
|
292
|
-
value: filters.search || "",
|
|
293
|
-
onChange: (event) => onFilterChange("search", event.currentTarget.value),
|
|
294
|
-
style: { flex: 1, minWidth: 200 }
|
|
295
|
-
}
|
|
296
|
-
)
|
|
297
|
-
]
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
var statusConfig2 = {
|
|
302
|
-
success: { color: "green", icon: IconCircleCheck },
|
|
303
|
-
failure: { color: "red", icon: IconCircleX },
|
|
304
|
-
pending: { color: "yellow", icon: IconClock },
|
|
305
|
-
approved: { color: "green", icon: IconThumbUp },
|
|
306
|
-
rejected: { color: "red", icon: IconThumbDown },
|
|
307
|
-
completed: { color: "blue", icon: IconCircleCheck }
|
|
308
|
-
};
|
|
309
|
-
function getActorDisplay2(actorType) {
|
|
310
|
-
switch (actorType) {
|
|
311
|
-
case "user":
|
|
312
|
-
return { label: "User", color: "blue", icon: IconUser };
|
|
313
|
-
case "api_key":
|
|
314
|
-
return { label: "API Key", color: "violet", icon: IconKey };
|
|
315
|
-
default:
|
|
316
|
-
return { label: "System", color: "gray", icon: IconRobot };
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
function getNavigationPath(activity) {
|
|
320
|
-
switch (activity.activityType) {
|
|
321
|
-
case "workflow_execution":
|
|
322
|
-
return `/operations/resources/workflow/${activity.entityId}`;
|
|
323
|
-
case "agent_run":
|
|
324
|
-
return `/operations/resources/agent/${activity.entityId}`;
|
|
325
|
-
case "hitl_action":
|
|
326
|
-
return "/command-queue";
|
|
327
|
-
case "credential_change":
|
|
328
|
-
case "credential_read":
|
|
329
|
-
return "/settings/credentials";
|
|
330
|
-
case "api_key_change":
|
|
331
|
-
return "/settings/api-keys";
|
|
332
|
-
case "deployment_change":
|
|
333
|
-
return "/settings/deployments";
|
|
334
|
-
case "membership_change":
|
|
335
|
-
return "/settings/organization";
|
|
336
|
-
default:
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function ActivityCard({ activity }) {
|
|
341
|
-
const config = statusConfig2[activity.status];
|
|
342
|
-
const StatusIcon = config.icon;
|
|
343
|
-
const { navigate } = useRouterContext();
|
|
344
|
-
const navigationPath = getNavigationPath(activity);
|
|
345
|
-
const isClickable = navigationPath !== null;
|
|
346
|
-
const actor = getActorDisplay2(activity.actorType);
|
|
347
|
-
const ActorIcon = actor.icon;
|
|
348
|
-
const handleClick = () => {
|
|
349
|
-
if (navigationPath) {
|
|
350
|
-
navigate(navigationPath);
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
return /* @__PURE__ */ jsx(
|
|
354
|
-
Card,
|
|
355
|
-
{
|
|
356
|
-
withBorder: true,
|
|
357
|
-
style: {
|
|
358
|
-
cursor: isClickable ? "pointer" : "default",
|
|
359
|
-
transition: "box-shadow var(--duration-fast) var(--easing)"
|
|
360
|
-
},
|
|
361
|
-
onClick: handleClick,
|
|
362
|
-
children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
363
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", children: [
|
|
364
|
-
/* @__PURE__ */ jsxs(Group, { gap: "xs", style: { flex: 1, minWidth: 0 }, children: [
|
|
365
|
-
/* @__PURE__ */ jsx(StatusIcon, { size: 16, color: `var(--mantine-color-${config.color}-6)` }),
|
|
366
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, style: { flex: 1, fontFamily: "var(--elevasis-font-family-subtitle)" }, truncate: true, children: activity.title })
|
|
367
|
-
] }),
|
|
368
|
-
/* @__PURE__ */ jsx(Badge, { size: "sm", color: config.color, variant: "light", children: activity.status })
|
|
369
|
-
] }),
|
|
370
|
-
activity.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: activity.description }),
|
|
371
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", gap: "xs", children: [
|
|
372
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", truncate: true, style: { flex: 1 }, children: activity.entityName || activity.entityId }),
|
|
373
|
-
/* @__PURE__ */ jsx(Badge, { size: "xs", color: actor.color, variant: "dot", leftSection: /* @__PURE__ */ jsx(ActorIcon, { size: 10 }), children: actor.label }),
|
|
374
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: { whiteSpace: "nowrap" }, children: formatDistanceToNow(activity.occurredAt, { addSuffix: true }) })
|
|
375
|
-
] })
|
|
376
|
-
] })
|
|
377
|
-
}
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
function ErrorAnalysisCard({ data, isLoading, error }) {
|
|
381
|
-
const topFailures = data?.topFailingResources.map((res) => ({
|
|
382
|
-
id: res.resourceId,
|
|
383
|
-
name: res.name,
|
|
384
|
-
errorCount: res.errorCount,
|
|
385
|
-
failureRate: res.failureRate
|
|
386
|
-
})) ?? [];
|
|
387
|
-
if (error) {
|
|
388
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load error analysis metrics" }) });
|
|
389
|
-
}
|
|
390
|
-
if (isLoading) {
|
|
391
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
392
|
-
}
|
|
393
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
394
|
-
/* @__PURE__ */ jsx(
|
|
395
|
-
CardHeader,
|
|
396
|
-
{
|
|
397
|
-
icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 18 }),
|
|
398
|
-
title: "Error Analysis",
|
|
399
|
-
rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
|
|
400
|
-
}
|
|
401
|
-
),
|
|
402
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "sm", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Top Failing Resources" }),
|
|
403
|
-
/* @__PURE__ */ jsxs(Table, { children: [
|
|
404
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
405
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Resource" }),
|
|
406
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Errors" }),
|
|
407
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "% Failed" }),
|
|
408
|
-
/* @__PURE__ */ jsx(Table.Th, {})
|
|
409
|
-
] }) }),
|
|
410
|
-
/* @__PURE__ */ jsx(Table.Tbody, { children: topFailures.map((resource) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
411
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
412
|
-
/* @__PURE__ */ jsx(IconAlertCircle, { size: 16, color: "var(--color-error)" }),
|
|
413
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", children: resource.name })
|
|
414
|
-
] }) }),
|
|
415
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Badge, { color: "red", variant: "light", children: resource.errorCount }) }),
|
|
416
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: resource.failureRate > 10 ? "red" : "dimmed", children: [
|
|
417
|
-
resource.failureRate,
|
|
418
|
-
"%"
|
|
419
|
-
] }) }),
|
|
420
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconExternalLink, { size: 14 }) }) })
|
|
421
|
-
] }, resource.id)) })
|
|
422
|
-
] })
|
|
423
|
-
] });
|
|
424
|
-
}
|
|
425
|
-
function ExecutionBreakdownTable({ data, isLoading, error }) {
|
|
426
|
-
if (error) {
|
|
427
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load execution breakdown" }) });
|
|
428
|
-
}
|
|
429
|
-
if (isLoading) {
|
|
430
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
431
|
-
}
|
|
432
|
-
const totalExecutions = data?.totalExecutions ?? 0;
|
|
433
|
-
const statusCounts = data?.statusCounts ?? { success: 0, failed: 0, pending: 0, warning: 0 };
|
|
434
|
-
const p95Duration = data?.p95Duration ?? 0;
|
|
435
|
-
const statusRows = [
|
|
436
|
-
{
|
|
437
|
-
status: "Completed",
|
|
438
|
-
count: statusCounts.success,
|
|
439
|
-
percentage: totalExecutions > 0 ? statusCounts.success / totalExecutions * 100 : 0,
|
|
440
|
-
avgDuration: p95Duration * 0.85,
|
|
441
|
-
// Estimate avg duration from P95
|
|
442
|
-
color: "green"
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
status: "Warning",
|
|
446
|
-
count: statusCounts.warning,
|
|
447
|
-
percentage: totalExecutions > 0 ? statusCounts.warning / totalExecutions * 100 : 0,
|
|
448
|
-
avgDuration: p95Duration * 0.85,
|
|
449
|
-
// Warning executions completed, similar to success
|
|
450
|
-
color: "yellow"
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
status: "Failed",
|
|
454
|
-
count: statusCounts.failed,
|
|
455
|
-
percentage: totalExecutions > 0 ? statusCounts.failed / totalExecutions * 100 : 0,
|
|
456
|
-
avgDuration: p95Duration * 0.6,
|
|
457
|
-
// Failed executions typically shorter
|
|
458
|
-
color: "red"
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
status: "Running",
|
|
462
|
-
count: 0,
|
|
463
|
-
// No running count in current data structure
|
|
464
|
-
percentage: 0,
|
|
465
|
-
avgDuration: 0,
|
|
466
|
-
color: "blue"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
status: "Pending",
|
|
470
|
-
count: statusCounts.pending,
|
|
471
|
-
percentage: totalExecutions > 0 ? statusCounts.pending / totalExecutions * 100 : 0,
|
|
472
|
-
avgDuration: 0,
|
|
473
|
-
// Pending has no duration
|
|
474
|
-
color: "gray"
|
|
475
|
-
}
|
|
476
|
-
];
|
|
477
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
478
|
-
/* @__PURE__ */ jsx(CardHeader, { icon: /* @__PURE__ */ jsx(IconChartPie, { size: 18 }), title: "Execution Status Breakdown" }),
|
|
479
|
-
/* @__PURE__ */ jsxs(Table, { children: [
|
|
480
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
481
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Status" }),
|
|
482
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Count" }),
|
|
483
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Percentage" }),
|
|
484
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Avg Duration" })
|
|
485
|
-
] }) }),
|
|
486
|
-
/* @__PURE__ */ jsx(Table.Tbody, { children: statusRows.map((row) => /* @__PURE__ */ jsxs(
|
|
487
|
-
Table.Tr,
|
|
488
|
-
{
|
|
489
|
-
style: { cursor: "pointer" },
|
|
490
|
-
onClick: () => {
|
|
491
|
-
console.log(`Filter to ${row.status} executions`);
|
|
492
|
-
},
|
|
493
|
-
children: [
|
|
494
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { color: row.color, variant: "light", children: row.status }) }),
|
|
495
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: row.count.toLocaleString() }) }),
|
|
496
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
|
|
497
|
-
row.percentage.toFixed(1),
|
|
498
|
-
"%"
|
|
499
|
-
] }) }),
|
|
500
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: row.avgDuration > 0 ? `${(row.avgDuration / 1e3).toFixed(1)}s` : "-" }) })
|
|
501
|
-
]
|
|
502
|
-
},
|
|
503
|
-
row.status
|
|
504
|
-
)) })
|
|
505
|
-
] })
|
|
506
|
-
] });
|
|
507
|
-
}
|
|
508
|
-
function ExecutionHealthCard({ data, isLoading, error }) {
|
|
509
|
-
const successRate = data?.successRate ?? 0;
|
|
510
|
-
const p95Duration = data?.p95Duration ?? 0;
|
|
511
|
-
const totalExecutions = data?.totalExecutions ?? 0;
|
|
512
|
-
const failedCount = data?.statusCounts.failed ?? 0;
|
|
513
|
-
const warningCount = data?.statusCounts.warning ?? 0;
|
|
514
|
-
const trendData = data?.trendData.map((d) => ({
|
|
515
|
-
hour: formatBucketTime(d.time, data?.granularity ?? "hour"),
|
|
516
|
-
errors: d.errorCount,
|
|
517
|
-
warnings: d.warningCount
|
|
518
|
-
})) ?? [];
|
|
519
|
-
const hasExecutions = totalExecutions > 0;
|
|
520
|
-
const statusColor = hasExecutions ? successRate >= 98 ? "green" : successRate >= 95 ? "yellow" : "red" : "gray";
|
|
521
|
-
const statusLabel = hasExecutions ? successRate >= 98 ? "Healthy" : successRate >= 95 ? "Warning" : "Critical" : "No Data";
|
|
522
|
-
if (error) {
|
|
523
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load execution health metrics" }) });
|
|
524
|
-
}
|
|
525
|
-
if (isLoading) {
|
|
526
|
-
return /* @__PURE__ */ jsx(StatsCardSkeleton, {});
|
|
527
|
-
}
|
|
528
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
529
|
-
/* @__PURE__ */ jsx(
|
|
530
|
-
CardHeader,
|
|
531
|
-
{
|
|
532
|
-
icon: /* @__PURE__ */ jsx(IconHeartbeat, { size: 18 }),
|
|
533
|
-
title: "Execution Health",
|
|
534
|
-
rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
|
|
535
|
-
}
|
|
536
|
-
),
|
|
537
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
|
|
538
|
-
/* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
|
|
539
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
540
|
-
/* @__PURE__ */ jsx(
|
|
541
|
-
Text,
|
|
542
|
-
{
|
|
543
|
-
size: "xl",
|
|
544
|
-
fw: 700,
|
|
545
|
-
c: "var(--color-error)",
|
|
546
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
547
|
-
children: failedCount
|
|
548
|
-
}
|
|
549
|
-
),
|
|
550
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "failures" })
|
|
551
|
-
] }),
|
|
552
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
553
|
-
/* @__PURE__ */ jsx(
|
|
554
|
-
Text,
|
|
555
|
-
{
|
|
556
|
-
size: "xl",
|
|
557
|
-
fw: 700,
|
|
558
|
-
c: warningCount > 0 ? "yellow" : "dimmed",
|
|
559
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
560
|
-
children: warningCount
|
|
561
|
-
}
|
|
562
|
-
),
|
|
563
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "warnings" })
|
|
564
|
-
] }),
|
|
565
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
566
|
-
/* @__PURE__ */ jsxs(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: [
|
|
567
|
-
(p95Duration / 1e3).toFixed(1),
|
|
568
|
-
"s"
|
|
569
|
-
] }),
|
|
570
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "P95" })
|
|
571
|
-
] })
|
|
572
|
-
] }),
|
|
573
|
-
/* @__PURE__ */ jsx(Badge, { size: "md", variant: "dot", color: statusColor, children: statusLabel })
|
|
574
|
-
] }),
|
|
575
|
-
/* @__PURE__ */ jsx(
|
|
576
|
-
CyberAreaChart,
|
|
577
|
-
{
|
|
578
|
-
data: trendData,
|
|
579
|
-
series: [
|
|
580
|
-
{ dataKey: "warnings", color: "yellow", name: "Warnings" },
|
|
581
|
-
{ dataKey: "errors", color: "red", name: "Errors" }
|
|
582
|
-
],
|
|
583
|
-
xDataKey: "hour",
|
|
584
|
-
height: 200,
|
|
585
|
-
yDomain: [0, "auto"]
|
|
586
|
-
}
|
|
587
|
-
),
|
|
588
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", mt: "sm", children: [
|
|
589
|
-
totalExecutions.toLocaleString(),
|
|
590
|
-
" total executions"
|
|
591
|
-
] })
|
|
592
|
-
] });
|
|
593
|
-
}
|
|
594
|
-
function CostByModelTable({ data, isLoading, error }) {
|
|
595
|
-
const [sortField, setSortField] = useState("cost");
|
|
596
|
-
const [sortDirection, setSortDirection] = useState("desc");
|
|
597
|
-
const totalCost = data?.totalCostUsd ?? 0;
|
|
598
|
-
const tableData = data?.models.map((m) => ({
|
|
599
|
-
model: m.model,
|
|
600
|
-
cost: m.totalCostUsd,
|
|
601
|
-
percentage: totalCost > 0 ? m.totalCostUsd / totalCost * 100 : 0,
|
|
602
|
-
calls: m.callCount,
|
|
603
|
-
avgCost: m.avgCostPerCall,
|
|
604
|
-
inputTokens: m.totalInputTokens,
|
|
605
|
-
outputTokens: m.totalOutputTokens
|
|
606
|
-
})) ?? [];
|
|
607
|
-
const sortedData = [...tableData].sort((a, b) => {
|
|
608
|
-
const aValue = a[sortField];
|
|
609
|
-
const bValue = b[sortField];
|
|
610
|
-
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
611
|
-
return sortDirection === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
|
|
612
|
-
}
|
|
613
|
-
return sortDirection === "asc" ? aValue - bValue : bValue - aValue;
|
|
614
|
-
});
|
|
615
|
-
const highestCost = Math.max(...tableData.map((d) => d.cost), 0);
|
|
616
|
-
const handleSort = (field) => {
|
|
617
|
-
if (sortField === field) {
|
|
618
|
-
setSortDirection(sortDirection === "asc" ? "desc" : "asc");
|
|
619
|
-
} else {
|
|
620
|
-
setSortField(field);
|
|
621
|
-
setSortDirection("desc");
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
const handleExport = () => {
|
|
625
|
-
if (!data) return;
|
|
626
|
-
const csvContent = [
|
|
627
|
-
["Model", "Cost ($)", "Percentage (%)", "Calls", "Avg Cost/Call ($)", "Input Tokens", "Output Tokens"],
|
|
628
|
-
...sortedData.map((d) => [
|
|
629
|
-
d.model,
|
|
630
|
-
d.cost.toFixed(4),
|
|
631
|
-
d.percentage.toFixed(2),
|
|
632
|
-
d.calls,
|
|
633
|
-
d.avgCost.toFixed(6),
|
|
634
|
-
d.inputTokens,
|
|
635
|
-
d.outputTokens
|
|
636
|
-
]),
|
|
637
|
-
["Total", totalCost.toFixed(4), "100.00", data.totalCallCount, "", "", ""]
|
|
638
|
-
].map((row) => row.join(",")).join("\n");
|
|
639
|
-
const blob = new Blob([csvContent], { type: "text/csv" });
|
|
640
|
-
const url = URL.createObjectURL(blob);
|
|
641
|
-
const link = document.createElement("a");
|
|
642
|
-
link.href = url;
|
|
643
|
-
link.download = `cost-by-model-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
|
|
644
|
-
link.click();
|
|
645
|
-
URL.revokeObjectURL(url);
|
|
646
|
-
};
|
|
647
|
-
const SortIcon = ({ field }) => {
|
|
648
|
-
if (sortField !== field) return null;
|
|
649
|
-
return sortDirection === "asc" ? /* @__PURE__ */ jsx(IconArrowUp, { size: 14 }) : /* @__PURE__ */ jsx(IconArrowDown, { size: 14 });
|
|
650
|
-
};
|
|
651
|
-
const formatModelName = (model) => {
|
|
652
|
-
const parts = model.split("/");
|
|
653
|
-
const modelName = parts.length > 1 ? parts[1] : model;
|
|
654
|
-
return modelName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
655
|
-
};
|
|
656
|
-
if (error) {
|
|
657
|
-
return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load cost by model" }) });
|
|
658
|
-
}
|
|
659
|
-
if (isLoading) {
|
|
660
|
-
return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
661
|
-
}
|
|
662
|
-
return /* @__PURE__ */ jsxs(Paper, { children: [
|
|
663
|
-
/* @__PURE__ */ jsx(
|
|
664
|
-
CardHeader,
|
|
665
|
-
{
|
|
666
|
-
icon: /* @__PURE__ */ jsx(IconCpu, { size: 18 }),
|
|
667
|
-
title: "Cost by Model",
|
|
668
|
-
rightSection: /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "xs", leftSection: /* @__PURE__ */ jsx(IconDownload, { size: 14 }), onClick: handleExport, children: "Export CSV" })
|
|
669
|
-
}
|
|
670
|
-
),
|
|
671
|
-
/* @__PURE__ */ jsxs(Table, { children: [
|
|
672
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
673
|
-
/* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("model"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
674
|
-
"Model",
|
|
675
|
-
/* @__PURE__ */ jsx(SortIcon, { field: "model" })
|
|
676
|
-
] }) }),
|
|
677
|
-
/* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("cost"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
678
|
-
"Cost",
|
|
679
|
-
/* @__PURE__ */ jsx(SortIcon, { field: "cost" })
|
|
680
|
-
] }) }),
|
|
681
|
-
/* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("percentage"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
682
|
-
"Percentage",
|
|
683
|
-
/* @__PURE__ */ jsx(SortIcon, { field: "percentage" })
|
|
684
|
-
] }) }),
|
|
685
|
-
/* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("calls"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
686
|
-
"Calls",
|
|
687
|
-
/* @__PURE__ */ jsx(SortIcon, { field: "calls" })
|
|
688
|
-
] }) }),
|
|
689
|
-
/* @__PURE__ */ jsx(Table.Th, { style: { cursor: "pointer" }, onClick: () => handleSort("avgCost"), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
690
|
-
"Avg Cost/Call",
|
|
691
|
-
/* @__PURE__ */ jsx(SortIcon, { field: "avgCost" })
|
|
692
|
-
] }) })
|
|
693
|
-
] }) }),
|
|
694
|
-
/* @__PURE__ */ jsxs(Table.Tbody, { children: [
|
|
695
|
-
sortedData.map((row) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
696
|
-
/* @__PURE__ */ jsxs(Table.Td, { children: [
|
|
697
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: row.cost === highestCost ? 600 : 400, children: formatModelName(row.model) }),
|
|
698
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: row.model })
|
|
699
|
-
] }),
|
|
700
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", fw: row.cost === highestCost ? 600 : 400, children: [
|
|
701
|
-
"$",
|
|
702
|
-
row.cost.toFixed(4)
|
|
703
|
-
] }) }),
|
|
704
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Badge, { color: row.percentage > 30 ? "red" : row.percentage > 15 ? "yellow" : "gray", children: [
|
|
705
|
-
row.percentage.toFixed(1),
|
|
706
|
-
"%"
|
|
707
|
-
] }) }),
|
|
708
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: row.calls.toLocaleString() }) }),
|
|
709
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
|
|
710
|
-
"$",
|
|
711
|
-
row.avgCost.toFixed(6)
|
|
712
|
-
] }) })
|
|
713
|
-
] }, row.model)),
|
|
714
|
-
tableData.length > 0 && /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
715
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 700, children: "Total" }) }),
|
|
716
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Text, { size: "sm", fw: 700, children: [
|
|
717
|
-
"$",
|
|
718
|
-
totalCost.toFixed(4)
|
|
719
|
-
] }) }),
|
|
720
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Badge, { children: "100.0%" }) }),
|
|
721
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", fw: 700, children: (data?.totalCallCount ?? 0).toLocaleString() }) }),
|
|
722
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "-" }) })
|
|
723
|
-
] })
|
|
724
|
-
] })
|
|
725
|
-
] }),
|
|
726
|
-
tableData.length === 0 && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "xl", children: "No cost data available for this time period" })
|
|
727
|
-
] });
|
|
728
|
-
}
|
|
729
|
-
function BusinessImpactCard({
|
|
730
|
-
impactData,
|
|
731
|
-
summaryData,
|
|
732
|
-
trendsData,
|
|
733
|
-
data,
|
|
734
|
-
isLoading,
|
|
735
|
-
error,
|
|
736
|
-
laborRate = 75
|
|
737
|
-
}) {
|
|
738
|
-
const businessData = impactData ?? data;
|
|
739
|
-
const laborCostSavings = businessData?.totalSavingsUsd ?? 0;
|
|
740
|
-
const platformCost = businessData?.totalCostUsd ?? 0;
|
|
741
|
-
const netSavings = businessData?.netSavingsUsd ?? 0;
|
|
742
|
-
const roi = businessData?.roi ?? 0;
|
|
743
|
-
const hoursSaved = Math.round(laborCostSavings / laborRate);
|
|
744
|
-
const previousCost = summaryData?.previous.totalCostUsd ?? platformCost;
|
|
745
|
-
const previousSavings = laborCostSavings * (previousCost > 0 ? (summaryData?.previous.totalCostUsd ?? platformCost) / platformCost : 0.8);
|
|
746
|
-
const previousHoursSaved = Math.round(previousSavings / laborRate);
|
|
747
|
-
const totalTrendCost = trendsData?.totalCostUsd ?? 0;
|
|
748
|
-
const trendData = (trendsData?.trendData ?? []).map((point) => {
|
|
749
|
-
const date = new Date(point.time);
|
|
750
|
-
const timeLabel = trendsData?.granularity === "hour" ? date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
751
|
-
const proportion = totalTrendCost > 0 ? point.totalCostUsd / totalTrendCost : 1 / (trendsData?.trendData.length ?? 1);
|
|
752
|
-
return {
|
|
753
|
-
time: timeLabel,
|
|
754
|
-
savings: laborCostSavings * proportion
|
|
755
|
-
};
|
|
756
|
-
});
|
|
757
|
-
if (error) {
|
|
758
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load business impact metrics" }) });
|
|
759
|
-
}
|
|
760
|
-
if (isLoading) {
|
|
761
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
762
|
-
}
|
|
763
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
764
|
-
/* @__PURE__ */ jsx(
|
|
765
|
-
CardHeader,
|
|
766
|
-
{
|
|
767
|
-
icon: /* @__PURE__ */ jsx(IconTrendingUp, { size: 18 }),
|
|
768
|
-
title: "Business Impact",
|
|
769
|
-
rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
|
|
770
|
-
}
|
|
771
|
-
),
|
|
772
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
|
|
773
|
-
/* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
|
|
774
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
775
|
-
/* @__PURE__ */ jsx(
|
|
776
|
-
Text,
|
|
777
|
-
{
|
|
778
|
-
size: "xl",
|
|
779
|
-
fw: 700,
|
|
780
|
-
c: "var(--color-primary)",
|
|
781
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
782
|
-
children: hoursSaved
|
|
783
|
-
}
|
|
784
|
-
),
|
|
785
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "hrs saved" }),
|
|
786
|
-
/* @__PURE__ */ jsx(TrendIndicator, { current: hoursSaved, previous: previousHoursSaved })
|
|
787
|
-
] }),
|
|
788
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
789
|
-
/* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: laborCostSavings, thousandSeparator: true }) }),
|
|
790
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "labor saved" })
|
|
791
|
-
] })
|
|
792
|
-
] }),
|
|
793
|
-
/* @__PURE__ */ jsx(
|
|
794
|
-
Badge,
|
|
795
|
-
{
|
|
796
|
-
size: "lg",
|
|
797
|
-
variant: roi > 0 ? "dot" : "light",
|
|
798
|
-
color: roi > 1e3 ? "green" : roi > 500 ? "yellow" : "gray",
|
|
799
|
-
children: roi > 0 ? `${roi.toFixed(0)}x ROI` : "N/A"
|
|
800
|
-
}
|
|
801
|
-
)
|
|
802
|
-
] }),
|
|
803
|
-
/* @__PURE__ */ jsx(
|
|
804
|
-
CyberAreaChart,
|
|
805
|
-
{
|
|
806
|
-
data: trendData,
|
|
807
|
-
series: [{ dataKey: "savings", color: "blue", name: "Savings" }],
|
|
808
|
-
xDataKey: "time",
|
|
809
|
-
height: 200,
|
|
810
|
-
yTickFormatter: (v) => `$${v.toFixed(2)}`
|
|
811
|
-
}
|
|
812
|
-
),
|
|
813
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", mt: "sm", children: [
|
|
814
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
815
|
-
"Platform cost: ",
|
|
816
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: platformCost, decimalScale: 2 })
|
|
817
|
-
] }),
|
|
818
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", fw: 500, c: netSavings < 0 ? "var(--color-error)" : "var(--color-primary)", children: [
|
|
819
|
-
"Net savings: ",
|
|
820
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: netSavings, thousandSeparator: true, decimalScale: 2 })
|
|
821
|
-
] })
|
|
822
|
-
] })
|
|
823
|
-
] });
|
|
824
|
-
}
|
|
825
|
-
function CostBreakdownCard({
|
|
826
|
-
breakdownData,
|
|
827
|
-
summaryData,
|
|
828
|
-
data,
|
|
829
|
-
isLoading,
|
|
830
|
-
error,
|
|
831
|
-
budget = 1500
|
|
832
|
-
}) {
|
|
833
|
-
const resourceData = breakdownData ?? data;
|
|
834
|
-
const legacyTotalCost = resourceData?.resources.reduce((sum, r) => sum + r.totalCostUsd, 0) ?? 0;
|
|
835
|
-
const mtdCost = summaryData?.mtd.totalCostUsd ?? legacyTotalCost * 2;
|
|
836
|
-
const projectedMonthlyCost = summaryData?.projection.monthlyCostUsd ?? mtdCost * 1.05;
|
|
837
|
-
const workflowCosts = resourceData?.resources.slice(0, 4).map((r) => ({
|
|
838
|
-
name: r.resourceId,
|
|
839
|
-
cost: r.totalCostUsd,
|
|
840
|
-
executions: r.executionCount,
|
|
841
|
-
avgCost: r.avgCostUsd
|
|
842
|
-
})) ?? [];
|
|
843
|
-
if (error) {
|
|
844
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load cost breakdown" }) });
|
|
845
|
-
}
|
|
846
|
-
if (isLoading) {
|
|
847
|
-
return /* @__PURE__ */ jsx(DetailCardSkeleton, { rows: 3 });
|
|
848
|
-
}
|
|
849
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
850
|
-
/* @__PURE__ */ jsx(
|
|
851
|
-
CardHeader,
|
|
852
|
-
{
|
|
853
|
-
icon: /* @__PURE__ */ jsx(IconChartBar, { size: 18 }),
|
|
854
|
-
title: "AI Costs Breakdown",
|
|
855
|
-
rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
|
|
856
|
-
}
|
|
857
|
-
),
|
|
858
|
-
/* @__PURE__ */ jsxs(Stack, { gap: "xs", mb: "md", children: [
|
|
859
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Top Spenders" }),
|
|
860
|
-
workflowCosts.length > 0 ? workflowCosts.map((workflow) => /* @__PURE__ */ jsx(
|
|
861
|
-
Box,
|
|
862
|
-
{
|
|
863
|
-
p: "sm",
|
|
864
|
-
style: {
|
|
865
|
-
borderLeft: "3px solid var(--color-primary)",
|
|
866
|
-
backgroundColor: "var(--color-surface)",
|
|
867
|
-
borderRadius: 4
|
|
868
|
-
},
|
|
869
|
-
children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "nowrap", children: [
|
|
870
|
-
/* @__PURE__ */ jsxs(Stack, { gap: 0, style: { flex: 1 }, children: [
|
|
871
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: workflow.name }),
|
|
872
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
873
|
-
workflow.executions,
|
|
874
|
-
" executions - $",
|
|
875
|
-
workflow.avgCost.toFixed(4),
|
|
876
|
-
"/exec"
|
|
877
|
-
] })
|
|
878
|
-
] }),
|
|
879
|
-
/* @__PURE__ */ jsx(
|
|
880
|
-
Text,
|
|
881
|
-
{
|
|
882
|
-
size: "sm",
|
|
883
|
-
fw: 600,
|
|
884
|
-
c: "var(--color-primary)",
|
|
885
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
886
|
-
children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: workflow.cost, decimalScale: 4 })
|
|
887
|
-
}
|
|
888
|
-
)
|
|
889
|
-
] })
|
|
890
|
-
},
|
|
891
|
-
workflow.name
|
|
892
|
-
)) : /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "md", children: "No resource data available" })
|
|
893
|
-
] }),
|
|
894
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", mt: "sm", children: [
|
|
895
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
896
|
-
"Projected: ",
|
|
897
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
|
|
898
|
-
] }),
|
|
899
|
-
/* @__PURE__ */ jsxs(
|
|
900
|
-
Text,
|
|
901
|
-
{
|
|
902
|
-
size: "xs",
|
|
903
|
-
fw: 600,
|
|
904
|
-
c: projectedMonthlyCost > budget ? "red" : "dimmed",
|
|
905
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
906
|
-
children: [
|
|
907
|
-
"Budget: ",
|
|
908
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: budget, thousandSeparator: true, decimalScale: 2 })
|
|
909
|
-
]
|
|
910
|
-
}
|
|
911
|
-
)
|
|
912
|
-
] })
|
|
913
|
-
] });
|
|
914
|
-
}
|
|
915
|
-
function CostMetricsCard({
|
|
916
|
-
summaryData,
|
|
917
|
-
trendsData,
|
|
918
|
-
data,
|
|
919
|
-
isLoading,
|
|
920
|
-
error,
|
|
921
|
-
budget = 1500
|
|
922
|
-
}) {
|
|
923
|
-
const legacyTotalCost = data?.resources.reduce((sum, r) => sum + r.totalCostUsd, 0) ?? 0;
|
|
924
|
-
const todayCost = summaryData?.current.totalCostUsd ?? legacyTotalCost;
|
|
925
|
-
const previousCost = summaryData?.previous.totalCostUsd ?? legacyTotalCost * 0.9;
|
|
926
|
-
const mtdCost = summaryData?.mtd.totalCostUsd ?? legacyTotalCost * 2;
|
|
927
|
-
const projectedMonthlyCost = summaryData?.projection.monthlyCostUsd ?? mtdCost * 1.05;
|
|
928
|
-
const confidence = summaryData?.projection.confidence ?? "low";
|
|
929
|
-
const budgetStatus = projectedMonthlyCost <= budget ? "green" : projectedMonthlyCost <= budget * 1.1 ? "yellow" : "red";
|
|
930
|
-
const budgetLabel = projectedMonthlyCost <= budget ? "On Budget" : projectedMonthlyCost <= budget * 1.1 ? "Warning" : "Over Budget";
|
|
931
|
-
const chartData = trendsData?.trendData.slice(-7).map((point, idx) => {
|
|
932
|
-
const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
933
|
-
return {
|
|
934
|
-
day: trendsData.granularity === "day" ? new Date(point.time).toLocaleDateString("en-US", { weekday: "short" }) : days[idx % 7],
|
|
935
|
-
cost: point.totalCostUsd
|
|
936
|
-
};
|
|
937
|
-
}) ?? data?.resources.slice(0, 7).map((r, idx) => ({
|
|
938
|
-
day: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][idx] || `Day ${idx + 1}`,
|
|
939
|
-
cost: r.totalCostUsd
|
|
940
|
-
})) ?? [];
|
|
941
|
-
if (error) {
|
|
942
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load cost metrics" }) });
|
|
943
|
-
}
|
|
944
|
-
if (isLoading) {
|
|
945
|
-
return /* @__PURE__ */ jsx(StatsCardSkeleton, {});
|
|
946
|
-
}
|
|
947
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
948
|
-
/* @__PURE__ */ jsx(
|
|
949
|
-
CardHeader,
|
|
950
|
-
{
|
|
951
|
-
icon: /* @__PURE__ */ jsx(IconCash, { size: 18 }),
|
|
952
|
-
title: "AI Costs",
|
|
953
|
-
rightSection: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", children: /* @__PURE__ */ jsx(IconArrowUpRight, { size: 16 }) })
|
|
954
|
-
}
|
|
955
|
-
),
|
|
956
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
|
|
957
|
-
/* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
|
|
958
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
959
|
-
/* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: todayCost, decimalScale: 2 }) }),
|
|
960
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "period" }),
|
|
961
|
-
/* @__PURE__ */ jsx(TrendIndicator, { current: todayCost, previous: previousCost, inverse: true })
|
|
962
|
-
] }),
|
|
963
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
964
|
-
/* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: mtdCost, thousandSeparator: true, decimalScale: 2 }) }),
|
|
965
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "MTD" })
|
|
966
|
-
] })
|
|
967
|
-
] }),
|
|
968
|
-
/* @__PURE__ */ jsx(Badge, { size: "md", variant: "dot", color: budgetStatus, children: budgetLabel })
|
|
969
|
-
] }),
|
|
970
|
-
chartData.length > 0 ? /* @__PURE__ */ jsx(
|
|
971
|
-
CyberAreaChart,
|
|
972
|
-
{
|
|
973
|
-
data: chartData,
|
|
974
|
-
series: [{ dataKey: "cost", color: "blue", name: "Cost" }],
|
|
975
|
-
xDataKey: "day",
|
|
976
|
-
height: 120,
|
|
977
|
-
yTickFormatter: (v) => `$${v.toFixed(2)}`
|
|
978
|
-
}
|
|
979
|
-
) : /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", py: "lg", children: "No trend data available" }),
|
|
980
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", mt: "sm", children: [
|
|
981
|
-
/* @__PURE__ */ jsxs(Group, { gap: 4, children: [
|
|
982
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
983
|
-
"Projected monthly:",
|
|
984
|
-
" ",
|
|
985
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
|
|
986
|
-
] }),
|
|
987
|
-
/* @__PURE__ */ jsx(Tooltip, { label: `Projection confidence: ${confidence}`, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 12, color: "var(--color-text-subtle)" }) })
|
|
988
|
-
] }),
|
|
989
|
-
/* @__PURE__ */ jsxs(
|
|
990
|
-
Text,
|
|
991
|
-
{
|
|
992
|
-
size: "xs",
|
|
993
|
-
fw: 600,
|
|
994
|
-
c: projectedMonthlyCost > budget ? "red" : "dimmed",
|
|
995
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
996
|
-
children: [
|
|
997
|
-
"Budget: ",
|
|
998
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: budget, thousandSeparator: true, decimalScale: 2 })
|
|
999
|
-
]
|
|
1000
|
-
}
|
|
1001
|
-
)
|
|
1002
|
-
] })
|
|
1003
|
-
] });
|
|
1004
|
-
}
|
|
1005
|
-
function ErrorBreakdownTable({ startDate, endDate, onErrorClick }) {
|
|
1006
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
1007
|
-
const [filterType, setFilterType] = useState("all");
|
|
1008
|
-
const [filterSeverity, setFilterSeverity] = useState();
|
|
1009
|
-
const [showResolved, setShowResolved] = useState(false);
|
|
1010
|
-
const resolveError = useResolveError();
|
|
1011
|
-
const resolveAll = useResolveAllErrors();
|
|
1012
|
-
const { page, setPage, totalPages } = usePaginationState(PAGE_SIZE_DEFAULT, [
|
|
1013
|
-
filterType,
|
|
1014
|
-
filterSeverity,
|
|
1015
|
-
searchQuery,
|
|
1016
|
-
showResolved,
|
|
1017
|
-
startDate,
|
|
1018
|
-
endDate
|
|
1019
|
-
]);
|
|
1020
|
-
const { data, isLoading, isError, error } = useErrorDetails({
|
|
1021
|
-
errorType: filterType === "all" ? void 0 : filterType,
|
|
1022
|
-
severity: filterSeverity,
|
|
1023
|
-
search: searchQuery || void 0,
|
|
1024
|
-
startDate,
|
|
1025
|
-
endDate,
|
|
1026
|
-
page,
|
|
1027
|
-
limit: PAGE_SIZE_DEFAULT,
|
|
1028
|
-
resolved: showResolved ? void 0 : false
|
|
1029
|
-
});
|
|
1030
|
-
if (isLoading) {
|
|
1031
|
-
return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(Stack, { align: "center", justify: "center", mih: 200, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
|
|
1032
|
-
}
|
|
1033
|
-
if (isError) {
|
|
1034
|
-
return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconAlertCircle, {}), title: "Error Loading Data", children: error?.message || "Failed to load error details. Please try again." }) });
|
|
1035
|
-
}
|
|
1036
|
-
if (!data || data.errors.length === 0) {
|
|
1037
|
-
return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1038
|
-
/* @__PURE__ */ jsx(
|
|
1039
|
-
CardHeader,
|
|
1040
|
-
{
|
|
1041
|
-
icon: /* @__PURE__ */ jsx(IconExclamationCircle, { size: 18 }),
|
|
1042
|
-
title: "Recent Errors",
|
|
1043
|
-
subtitle: "0 errors found",
|
|
1044
|
-
rightSection: /* @__PURE__ */ jsx(
|
|
1045
|
-
Switch,
|
|
1046
|
-
{
|
|
1047
|
-
label: "Show resolved",
|
|
1048
|
-
checked: showResolved,
|
|
1049
|
-
onChange: (e) => setShowResolved(e.currentTarget.checked),
|
|
1050
|
-
size: "sm"
|
|
1051
|
-
}
|
|
1052
|
-
)
|
|
1053
|
-
}
|
|
1054
|
-
),
|
|
1055
|
-
/* @__PURE__ */ jsx(
|
|
1056
|
-
EmptyState,
|
|
1057
|
-
{
|
|
1058
|
-
icon: IconBug,
|
|
1059
|
-
title: "No errors found",
|
|
1060
|
-
description: showResolved ? "No errors found for the selected time range" : "All errors have been resolved"
|
|
1061
|
-
}
|
|
1062
|
-
)
|
|
1063
|
-
] }) });
|
|
1064
|
-
}
|
|
1065
|
-
const filteredErrors = data.errors;
|
|
1066
|
-
const errorTypes = Array.from(new Set(data.errors.map((e) => e.errorType)));
|
|
1067
|
-
const total = data.total;
|
|
1068
|
-
const getSeverityIcon = (severity) => {
|
|
1069
|
-
switch (severity) {
|
|
1070
|
-
case "critical":
|
|
1071
|
-
return /* @__PURE__ */ jsx(IconAlertCircle, { size: 16, color: "var(--color-error)" });
|
|
1072
|
-
case "warning":
|
|
1073
|
-
return /* @__PURE__ */ jsx(IconAlertTriangle, { size: 16, color: "var(--mantine-color-orange-6)" });
|
|
1074
|
-
default:
|
|
1075
|
-
return /* @__PURE__ */ jsx(IconBug, { size: 16, color: "var(--color-primary)" });
|
|
1076
|
-
}
|
|
1077
|
-
};
|
|
1078
|
-
const getSeverityColor = (severity) => {
|
|
1079
|
-
switch (severity) {
|
|
1080
|
-
case "critical":
|
|
1081
|
-
return "red";
|
|
1082
|
-
case "warning":
|
|
1083
|
-
return "orange";
|
|
1084
|
-
default:
|
|
1085
|
-
return "blue";
|
|
1086
|
-
}
|
|
1087
|
-
};
|
|
1088
|
-
return /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1089
|
-
/* @__PURE__ */ jsx(
|
|
1090
|
-
CardHeader,
|
|
1091
|
-
{
|
|
1092
|
-
icon: /* @__PURE__ */ jsx(IconExclamationCircle, { size: 18 }),
|
|
1093
|
-
title: "Recent Errors",
|
|
1094
|
-
subtitle: `${filteredErrors.length} error${filteredErrors.length !== 1 ? "s" : ""} found`,
|
|
1095
|
-
rightSection: /* @__PURE__ */ jsxs(Group, { children: [
|
|
1096
|
-
/* @__PURE__ */ jsx(
|
|
1097
|
-
Switch,
|
|
1098
|
-
{
|
|
1099
|
-
label: "Show resolved",
|
|
1100
|
-
checked: showResolved,
|
|
1101
|
-
onChange: (e) => setShowResolved(e.currentTarget.checked),
|
|
1102
|
-
size: "sm"
|
|
1103
|
-
}
|
|
1104
|
-
),
|
|
1105
|
-
!showResolved && filteredErrors.some((e) => !e.resolved) && /* @__PURE__ */ jsx(
|
|
1106
|
-
Button,
|
|
1107
|
-
{
|
|
1108
|
-
leftSection: /* @__PURE__ */ jsx(IconChecks, { size: 16 }),
|
|
1109
|
-
variant: "light",
|
|
1110
|
-
loading: resolveAll.isPending,
|
|
1111
|
-
onClick: () => resolveAll.mutate(),
|
|
1112
|
-
children: "Resolve All"
|
|
1113
|
-
}
|
|
1114
|
-
)
|
|
1115
|
-
] })
|
|
1116
|
-
}
|
|
1117
|
-
),
|
|
1118
|
-
/* @__PURE__ */ jsxs(FilterBar, { children: [
|
|
1119
|
-
/* @__PURE__ */ jsx(
|
|
1120
|
-
TextInput,
|
|
1121
|
-
{
|
|
1122
|
-
placeholder: "Search errors...",
|
|
1123
|
-
leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 16 }),
|
|
1124
|
-
value: searchQuery,
|
|
1125
|
-
onChange: (e) => {
|
|
1126
|
-
setSearchQuery(e.currentTarget.value);
|
|
1127
|
-
},
|
|
1128
|
-
style: { flex: 1 }
|
|
1129
|
-
}
|
|
1130
|
-
),
|
|
1131
|
-
/* @__PURE__ */ jsx(
|
|
1132
|
-
Select,
|
|
1133
|
-
{
|
|
1134
|
-
placeholder: "Filter by type",
|
|
1135
|
-
value: filterType,
|
|
1136
|
-
onChange: (value) => {
|
|
1137
|
-
setFilterType(value || "all");
|
|
1138
|
-
},
|
|
1139
|
-
data: [{ value: "all", label: "All Types" }, ...errorTypes.map((type) => ({ value: type, label: type }))],
|
|
1140
|
-
style: { width: 200 },
|
|
1141
|
-
clearable: true
|
|
1142
|
-
}
|
|
1143
|
-
),
|
|
1144
|
-
/* @__PURE__ */ jsx(
|
|
1145
|
-
Select,
|
|
1146
|
-
{
|
|
1147
|
-
placeholder: "Filter by severity",
|
|
1148
|
-
value: filterSeverity,
|
|
1149
|
-
onChange: (value) => {
|
|
1150
|
-
setFilterSeverity(value);
|
|
1151
|
-
},
|
|
1152
|
-
data: [
|
|
1153
|
-
{ value: "critical", label: "Critical" },
|
|
1154
|
-
{ value: "warning", label: "Warning" },
|
|
1155
|
-
{ value: "info", label: "Info" }
|
|
1156
|
-
],
|
|
1157
|
-
style: { width: 200 },
|
|
1158
|
-
clearable: true
|
|
1159
|
-
}
|
|
1160
|
-
)
|
|
1161
|
-
] }),
|
|
1162
|
-
/* @__PURE__ */ jsxs(Table, { children: [
|
|
1163
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
1164
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Timestamp" }),
|
|
1165
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Type" }),
|
|
1166
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Message" }),
|
|
1167
|
-
/* @__PURE__ */ jsx(Table.Th, { children: "Resource" }),
|
|
1168
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "center", children: "Severity" }),
|
|
1169
|
-
/* @__PURE__ */ jsx(Table.Th, { ta: "right", children: "Actions" })
|
|
1170
|
-
] }) }),
|
|
1171
|
-
/* @__PURE__ */ jsx(Table.Tbody, { children: filteredErrors.map((error2) => /* @__PURE__ */ jsxs(Table.Tr, { style: { cursor: "pointer" }, onClick: () => onErrorClick?.(error2.executionId), children: [
|
|
1172
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Text, { size: "sm", children: new Date(error2.timestamp).toLocaleString("en-US", {
|
|
1173
|
-
month: "short",
|
|
1174
|
-
day: "numeric",
|
|
1175
|
-
hour: "2-digit",
|
|
1176
|
-
minute: "2-digit"
|
|
1177
|
-
}) }) }),
|
|
1178
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(Badge, { variant: "light", size: "sm", children: error2.errorType }) }),
|
|
1179
|
-
/* @__PURE__ */ jsx(Table.Td, { style: { maxWidth: 300 }, children: /* @__PURE__ */ jsx(Text, { size: "sm", lineClamp: 1, children: error2.message }) }),
|
|
1180
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(Text, { size: "sm", children: error2.resourceName }) }),
|
|
1181
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "center", style: { whiteSpace: "nowrap" }, children: /* @__PURE__ */ jsx(
|
|
1182
|
-
Badge,
|
|
1183
|
-
{
|
|
1184
|
-
color: getSeverityColor(error2.severity),
|
|
1185
|
-
variant: "light",
|
|
1186
|
-
size: "sm",
|
|
1187
|
-
leftSection: getSeverityIcon(error2.severity),
|
|
1188
|
-
children: error2.severity.toUpperCase()
|
|
1189
|
-
}
|
|
1190
|
-
) }),
|
|
1191
|
-
/* @__PURE__ */ jsx(Table.Td, { ta: "right", children: /* @__PURE__ */ jsxs(Group, { gap: 4, justify: "flex-end", wrap: "nowrap", children: [
|
|
1192
|
-
error2.resolved ? /* @__PURE__ */ jsx(Badge, { color: "green", variant: "light", size: "sm", style: { cursor: "default" }, children: "Resolved" }) : /* @__PURE__ */ jsx(
|
|
1193
|
-
Badge,
|
|
1194
|
-
{
|
|
1195
|
-
color: "gray",
|
|
1196
|
-
variant: "light",
|
|
1197
|
-
size: "sm",
|
|
1198
|
-
style: {
|
|
1199
|
-
cursor: resolveError.isPending && resolveError.variables === error2.id ? "wait" : "pointer",
|
|
1200
|
-
opacity: resolveError.isPending && resolveError.variables === error2.id ? 0.5 : 1
|
|
1201
|
-
},
|
|
1202
|
-
onClick: (e) => {
|
|
1203
|
-
e.stopPropagation();
|
|
1204
|
-
resolveError.mutate(error2.id);
|
|
1205
|
-
},
|
|
1206
|
-
children: "Resolve"
|
|
1207
|
-
}
|
|
1208
|
-
),
|
|
1209
|
-
/* @__PURE__ */ jsx(
|
|
1210
|
-
ActionIcon,
|
|
1211
|
-
{
|
|
1212
|
-
variant: "subtle",
|
|
1213
|
-
size: "sm",
|
|
1214
|
-
onClick: (e) => {
|
|
1215
|
-
e.stopPropagation();
|
|
1216
|
-
onErrorClick?.(error2.executionId);
|
|
1217
|
-
},
|
|
1218
|
-
children: /* @__PURE__ */ jsx(IconExternalLink, { size: 14 })
|
|
1219
|
-
}
|
|
1220
|
-
)
|
|
1221
|
-
] }) })
|
|
1222
|
-
] }, error2.id)) })
|
|
1223
|
-
] }),
|
|
1224
|
-
totalPages(total) > 1 && /* @__PURE__ */ jsx(Group, { justify: "flex-start", children: /* @__PURE__ */ jsx(Pagination, { total: totalPages(total), value: page, onChange: setPage, size: "sm", boundaries: 1 }) })
|
|
1225
|
-
] }) });
|
|
1226
|
-
}
|
|
1227
|
-
var categoryColors = {
|
|
1228
|
-
info: "blue",
|
|
1229
|
-
queue: "cyan",
|
|
1230
|
-
alert: "yellow",
|
|
1231
|
-
error: "red",
|
|
1232
|
-
system: "gray"
|
|
1233
|
-
};
|
|
1234
|
-
function NotificationItem({ notification, onClose, onNavigate }) {
|
|
1235
|
-
const markAsRead = useMarkAsRead();
|
|
1236
|
-
const handleClick = async () => {
|
|
1237
|
-
if (!notification.read) {
|
|
1238
|
-
await markAsRead.mutateAsync(notification.id);
|
|
1239
|
-
}
|
|
1240
|
-
if (notification.actionUrl) {
|
|
1241
|
-
onNavigate?.(notification.actionUrl);
|
|
1242
|
-
}
|
|
1243
|
-
onClose?.();
|
|
1244
|
-
};
|
|
1245
|
-
const categoryColor = categoryColors[notification.category] || "gray";
|
|
1246
|
-
return /* @__PURE__ */ jsx(
|
|
1247
|
-
UnstyledButton,
|
|
1248
|
-
{
|
|
1249
|
-
onClick: handleClick,
|
|
1250
|
-
style: {
|
|
1251
|
-
width: "100%",
|
|
1252
|
-
padding: "12px",
|
|
1253
|
-
backgroundColor: "transparent",
|
|
1254
|
-
transition: "background-color var(--duration-fast) var(--easing)"
|
|
1255
|
-
},
|
|
1256
|
-
styles: {
|
|
1257
|
-
root: {
|
|
1258
|
-
"&:hover": {
|
|
1259
|
-
backgroundColor: "var(--color-surface-hover)"
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
},
|
|
1263
|
-
children: /* @__PURE__ */ jsxs(Group, { gap: "sm", align: "flex-start", wrap: "nowrap", children: [
|
|
1264
|
-
/* @__PURE__ */ jsx(Box, { mt: 4, children: notification.read ? /* @__PURE__ */ jsx(IconCircle, { size: 12, color: "var(--mantine-color-gray-5)" }) : /* @__PURE__ */ jsx(IconCircleFilled, { size: 12, color: `var(--mantine-color-${categoryColor}-6)` }) }),
|
|
1265
|
-
/* @__PURE__ */ jsxs(Stack, { gap: 4, style: { flex: 1 }, children: [
|
|
1266
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: notification.read ? 400 : 600, children: notification.title }),
|
|
1267
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", lineClamp: 2, children: notification.message }),
|
|
1268
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatDistanceToNow(new Date(notification.createdAt), { addSuffix: true }) })
|
|
1269
|
-
] })
|
|
1270
|
-
] })
|
|
1271
|
-
}
|
|
1272
|
-
);
|
|
1273
|
-
}
|
|
1274
|
-
function NotificationList({ notifications, isLoading, onClose, onNavigate }) {
|
|
1275
|
-
if (isLoading) {
|
|
1276
|
-
return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) });
|
|
1277
|
-
}
|
|
1278
|
-
if (notifications.length === 0) {
|
|
1279
|
-
return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No notifications" }) });
|
|
1280
|
-
}
|
|
1281
|
-
return /* @__PURE__ */ jsx(Stack, { gap: 0, children: notifications.map((notification) => /* @__PURE__ */ jsx(NotificationItem, { notification, onClose, onNavigate }, notification.id)) });
|
|
1282
|
-
}
|
|
1283
|
-
function ExecutionLogsPage({
|
|
1284
|
-
timeRange,
|
|
1285
|
-
pageSize = 20,
|
|
1286
|
-
onNavigateToExecution,
|
|
1287
|
-
renderTrendChart
|
|
1288
|
-
}) {
|
|
1289
|
-
const { filters, updateFilter, resetFilters } = useExecutionLogsFilters(timeRange);
|
|
1290
|
-
const startDate = useMemo(() => {
|
|
1291
|
-
const { startDate: sd } = getTimeRangeDates(timeRange);
|
|
1292
|
-
return new Date(sd).getTime();
|
|
1293
|
-
}, [timeRange]);
|
|
1294
|
-
const { page, setPage, offset, totalPages } = usePaginationState(pageSize, [
|
|
1295
|
-
filters.resourceId,
|
|
1296
|
-
filters.status,
|
|
1297
|
-
filters.resourceStatus,
|
|
1298
|
-
timeRange
|
|
1299
|
-
]);
|
|
1300
|
-
const { data, isLoading } = useExecutionLogs({
|
|
1301
|
-
resourceId: filters.resourceId,
|
|
1302
|
-
status: filters.status !== "all" ? filters.status : void 0,
|
|
1303
|
-
resourceStatus: filters.resourceStatus !== "all" ? filters.resourceStatus : void 0,
|
|
1304
|
-
startDate,
|
|
1305
|
-
limit: pageSize,
|
|
1306
|
-
offset
|
|
1307
|
-
});
|
|
1308
|
-
const total = data?.total ?? 0;
|
|
1309
|
-
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1310
|
-
/* @__PURE__ */ jsx(PageTitleCaption, { title: "Execution Logs", caption: "View and filter execution history across all resources" }),
|
|
1311
|
-
renderTrendChart({ timeRange }),
|
|
1312
|
-
/* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1313
|
-
/* @__PURE__ */ jsx(ExecutionLogsFilters, { filters, onFilterChange: updateFilter, onReset: resetFilters }),
|
|
1314
|
-
/* @__PURE__ */ jsx(
|
|
1315
|
-
ExecutionLogsTable,
|
|
1316
|
-
{
|
|
1317
|
-
executions: data?.executions || [],
|
|
1318
|
-
isLoading,
|
|
1319
|
-
onRowClick: onNavigateToExecution
|
|
1320
|
-
}
|
|
1321
|
-
),
|
|
1322
|
-
totalPages(total) > 1 && /* @__PURE__ */ jsx(Group, { justify: "flex-start", children: /* @__PURE__ */ jsx(Pagination, { value: page, onChange: setPage, total: totalPages(total), size: "sm", boundaries: 1 }) })
|
|
1323
|
-
] }) })
|
|
1324
|
-
] });
|
|
1325
|
-
}
|
|
1326
|
-
function ExecutionHealth({ timeRange, onErrorClick }) {
|
|
1327
|
-
const { data, isLoading, error } = useExecutionHealth({ timeRange });
|
|
1328
|
-
const { data: errorData, isLoading: errorLoading, error: errorError } = useErrorAnalysis(timeRange);
|
|
1329
|
-
const { startDate, endDate } = useTimeRangeDates(timeRange);
|
|
1330
|
-
if (isLoading) return /* @__PURE__ */ jsx(AppShellLoader, {});
|
|
1331
|
-
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1332
|
-
/* @__PURE__ */ jsx(
|
|
1333
|
-
PageTitleCaption,
|
|
1334
|
-
{
|
|
1335
|
-
title: "Execution Health",
|
|
1336
|
-
caption: "Detailed execution metrics, success rates, and performance trends"
|
|
1337
|
-
}
|
|
1338
|
-
),
|
|
1339
|
-
/* @__PURE__ */ jsx(ExecutionHealthCard, { data: data?.executionHealth, isLoading, error }),
|
|
1340
|
-
/* @__PURE__ */ jsx(
|
|
1341
|
-
ErrorBreakdownTable,
|
|
1342
|
-
{
|
|
1343
|
-
startDate,
|
|
1344
|
-
endDate,
|
|
1345
|
-
onErrorClick: (executionId) => onErrorClick(executionId)
|
|
1346
|
-
}
|
|
1347
|
-
),
|
|
1348
|
-
/* @__PURE__ */ jsx(ErrorAnalysisCard, { data: errorData, isLoading: errorLoading, error: errorError })
|
|
1349
|
-
] });
|
|
1350
|
-
}
|
|
1351
|
-
function ErrorDetailsModal({ executionId, opened, onClose, organizationName }) {
|
|
1352
|
-
const { data: errors, isLoading, isError } = useErrorDetail(executionId);
|
|
1353
|
-
const resolveErrors = useResolveErrorsByExecution();
|
|
1354
|
-
const { data: resources } = useResources();
|
|
1355
|
-
const resourceNameMap = useMemo(() => {
|
|
1356
|
-
const map = /* @__PURE__ */ new Map();
|
|
1357
|
-
if (resources) {
|
|
1358
|
-
for (const r of [...resources.workflows, ...resources.agents]) {
|
|
1359
|
-
map.set(r.resourceId, r.name);
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
return map;
|
|
1363
|
-
}, [resources]);
|
|
1364
|
-
const resourceTypeMap = useMemo(() => {
|
|
1365
|
-
const map = /* @__PURE__ */ new Map();
|
|
1366
|
-
if (resources) {
|
|
1367
|
-
for (const r of resources.workflows) {
|
|
1368
|
-
map.set(r.resourceId, "workflow");
|
|
1369
|
-
}
|
|
1370
|
-
for (const r of resources.agents) {
|
|
1371
|
-
map.set(r.resourceId, "agent");
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
return map;
|
|
1375
|
-
}, [resources]);
|
|
1376
|
-
const primaryError = errors?.[0];
|
|
1377
|
-
const resolvedResourceName = primaryError ? resourceNameMap.get(primaryError.resourceId) ?? primaryError.resourceId : void 0;
|
|
1378
|
-
const resolvedResourceType = primaryError ? resourceTypeMap.get(primaryError.resourceId) : void 0;
|
|
1379
|
-
const resourceDetailHref = primaryError && resolvedResourceType ? `/operations/resources/${resolvedResourceType}/${primaryError.resourceId}` : null;
|
|
1380
|
-
const allResolved = errors?.every((e) => e.resolved) ?? false;
|
|
1381
|
-
const hasRetries = errors && errors.length > 1;
|
|
1382
|
-
const handleCopyDetails = () => {
|
|
1383
|
-
if (!primaryError) return;
|
|
1384
|
-
const detailsText = `
|
|
1385
|
-
Error ID: ${primaryError.id}
|
|
1386
|
-
Timestamp: ${primaryError.timestamp}
|
|
1387
|
-
Type: ${primaryError.errorType}
|
|
1388
|
-
Severity: ${primaryError.severity}
|
|
1389
|
-
Execution ID: ${primaryError.executionId}
|
|
1390
|
-
Resource: ${primaryError.resourceName}
|
|
1391
|
-
|
|
1392
|
-
Message:
|
|
1393
|
-
${primaryError.message}
|
|
1394
|
-
|
|
1395
|
-
Stack Trace:
|
|
1396
|
-
${primaryError.stackTrace || "No stack trace available"}
|
|
1397
|
-
|
|
1398
|
-
Context:
|
|
1399
|
-
${primaryError.errorContext ? JSON.stringify(primaryError.errorContext, null, 2) : "No context available"}
|
|
1400
|
-
`.trim();
|
|
1401
|
-
navigator.clipboard.writeText(detailsText);
|
|
1402
|
-
};
|
|
1403
|
-
return /* @__PURE__ */ jsx(CustomModal, { opened, onClose, size: "xl", children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1404
|
-
isLoading && /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }),
|
|
1405
|
-
isError && /* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconAlertCircle, {}), title: "Error Loading Details", children: "Failed to load error details. Please try again." }),
|
|
1406
|
-
!isLoading && !isError && !primaryError && /* @__PURE__ */ jsx(Alert, { color: "gray", icon: /* @__PURE__ */ jsx(IconBug, {}), children: "No error details found for this execution." }),
|
|
1407
|
-
!isLoading && !isError && primaryError && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1408
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1409
|
-
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
1410
|
-
/* @__PURE__ */ jsx(IconAlertCircle, { size: 24, color: "var(--color-error)" }),
|
|
1411
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1412
|
-
/* @__PURE__ */ jsx(Title, { order: 3, children: primaryError.errorType }),
|
|
1413
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: new Date(primaryError.timestamp).toLocaleString("en-US", {
|
|
1414
|
-
month: "long",
|
|
1415
|
-
day: "numeric",
|
|
1416
|
-
year: "numeric",
|
|
1417
|
-
hour: "2-digit",
|
|
1418
|
-
minute: "2-digit",
|
|
1419
|
-
second: "2-digit"
|
|
1420
|
-
}) })
|
|
1421
|
-
] })
|
|
1422
|
-
] }),
|
|
1423
|
-
/* @__PURE__ */ jsx(
|
|
1424
|
-
Badge,
|
|
1425
|
-
{
|
|
1426
|
-
color: primaryError.severity === "critical" ? "red" : primaryError.severity === "warning" ? "orange" : "blue",
|
|
1427
|
-
variant: "light",
|
|
1428
|
-
children: primaryError.severity
|
|
1429
|
-
}
|
|
1430
|
-
)
|
|
1431
|
-
] }),
|
|
1432
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
1433
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1434
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Error Message" }),
|
|
1435
|
-
/* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconBug, { size: 16 }), children: primaryError.message })
|
|
1436
|
-
] }),
|
|
1437
|
-
hasRetries && /* @__PURE__ */ jsxs(Alert, { color: "yellow", icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), children: [
|
|
1438
|
-
"This execution has ",
|
|
1439
|
-
errors.length,
|
|
1440
|
-
" errors (including retries). Showing most recent error."
|
|
1441
|
-
] }),
|
|
1442
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1443
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Execution Context" }),
|
|
1444
|
-
/* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
1445
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1446
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Execution ID" }),
|
|
1447
|
-
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
1448
|
-
/* @__PURE__ */ jsx(Code, { children: primaryError.executionId }),
|
|
1449
|
-
/* @__PURE__ */ jsx(CopyButton, { value: `"${organizationName}/${primaryError.resourceId}" ${primaryError.executionId}`, children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy Execution Ref", children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", color: copied ? "teal" : "gray", onClick: copy, children: copied ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : /* @__PURE__ */ jsx(IconCopy, { size: 14 }) }) }) }),
|
|
1450
|
-
resourceDetailHref && /* @__PURE__ */ jsx(
|
|
1451
|
-
ActionIcon,
|
|
1452
|
-
{
|
|
1453
|
-
variant: "subtle",
|
|
1454
|
-
size: "sm",
|
|
1455
|
-
component: "a",
|
|
1456
|
-
href: resourceDetailHref,
|
|
1457
|
-
target: "_blank",
|
|
1458
|
-
title: "View Execution Log",
|
|
1459
|
-
children: /* @__PURE__ */ jsx(IconExternalLink, { size: 14 })
|
|
1460
|
-
}
|
|
1461
|
-
)
|
|
1462
|
-
] })
|
|
1463
|
-
] }),
|
|
1464
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1465
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Resource Name" }),
|
|
1466
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", children: resolvedResourceName })
|
|
1467
|
-
] }),
|
|
1468
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1469
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Resource ID" }),
|
|
1470
|
-
/* @__PURE__ */ jsx(Code, { children: primaryError.resourceId })
|
|
1471
|
-
] }),
|
|
1472
|
-
primaryError.retryAttempt && /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1473
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Retry Attempt" }),
|
|
1474
|
-
/* @__PURE__ */ jsx(Badge, { size: "sm", children: primaryError.retryAttempt })
|
|
1475
|
-
] }),
|
|
1476
|
-
primaryError.stepName && /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1477
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Step Name" }),
|
|
1478
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", children: primaryError.stepName })
|
|
1479
|
-
] })
|
|
1480
|
-
] })
|
|
1481
|
-
] }),
|
|
1482
|
-
primaryError.stackTrace && /* @__PURE__ */ jsxs("div", { children: [
|
|
1483
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", mb: "xs", children: [
|
|
1484
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Stack Trace" }),
|
|
1485
|
-
/* @__PURE__ */ jsx(CopyButton, { value: primaryError.stackTrace, children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy stack trace", children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "sm", onClick: copy, children: copied ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : /* @__PURE__ */ jsx(IconCopy, { size: 14 }) }) }) })
|
|
1486
|
-
] }),
|
|
1487
|
-
/* @__PURE__ */ jsx(
|
|
1488
|
-
Code,
|
|
1489
|
-
{
|
|
1490
|
-
block: true,
|
|
1491
|
-
style: {
|
|
1492
|
-
maxHeight: 300,
|
|
1493
|
-
overflow: "auto",
|
|
1494
|
-
fontSize: "12px",
|
|
1495
|
-
lineHeight: "1.5"
|
|
1496
|
-
},
|
|
1497
|
-
children: primaryError.stackTrace
|
|
1498
|
-
}
|
|
1499
|
-
)
|
|
1500
|
-
] }),
|
|
1501
|
-
primaryError.errorContext && /* @__PURE__ */ jsxs("div", { children: [
|
|
1502
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Error Context" }),
|
|
1503
|
-
/* @__PURE__ */ jsx(JsonViewer, { data: primaryError.errorContext, maxHeight: 200, fontSize: "12px" })
|
|
1504
|
-
] }),
|
|
1505
|
-
primaryError.executionContext && /* @__PURE__ */ jsxs("div", { children: [
|
|
1506
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "Execution Context" }),
|
|
1507
|
-
/* @__PURE__ */ jsx(JsonViewer, { data: primaryError.executionContext, maxHeight: 200, fontSize: "12px" })
|
|
1508
|
-
] }),
|
|
1509
|
-
hasRetries && /* @__PURE__ */ jsxs("div", { children: [
|
|
1510
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, mb: "xs", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: "All Errors (including retries)" }),
|
|
1511
|
-
/* @__PURE__ */ jsx(Accordion, { children: errors.map((error, index) => /* @__PURE__ */ jsxs(Accordion.Item, { value: error.id, children: [
|
|
1512
|
-
/* @__PURE__ */ jsx(Accordion.Control, { children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1513
|
-
/* @__PURE__ */ jsxs(Text, { size: "sm", children: [
|
|
1514
|
-
"Attempt ",
|
|
1515
|
-
error.retryAttempt || index + 1,
|
|
1516
|
-
" - ",
|
|
1517
|
-
error.errorType
|
|
1518
|
-
] }),
|
|
1519
|
-
/* @__PURE__ */ jsx(
|
|
1520
|
-
Badge,
|
|
1521
|
-
{
|
|
1522
|
-
size: "sm",
|
|
1523
|
-
color: error.severity === "critical" ? "red" : error.severity === "warning" ? "orange" : "blue",
|
|
1524
|
-
children: error.severity
|
|
1525
|
-
}
|
|
1526
|
-
)
|
|
1527
|
-
] }) }),
|
|
1528
|
-
/* @__PURE__ */ jsx(Accordion.Panel, { children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
|
|
1529
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", children: error.message }),
|
|
1530
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: new Date(error.timestamp).toLocaleString() }),
|
|
1531
|
-
error.stackTrace && /* @__PURE__ */ jsx(Code, { block: true, style: { fontSize: "11px", maxHeight: 150, overflow: "auto" }, children: error.stackTrace })
|
|
1532
|
-
] }) })
|
|
1533
|
-
] }, error.id)) })
|
|
1534
|
-
] }),
|
|
1535
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
1536
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
1537
|
-
/* @__PURE__ */ jsxs(Group, { children: [
|
|
1538
|
-
/* @__PURE__ */ jsx(Button, { variant: "light", leftSection: /* @__PURE__ */ jsx(IconCopy, { size: 16 }), onClick: handleCopyDetails, children: "Copy Error Details" }),
|
|
1539
|
-
allResolved ? /* @__PURE__ */ jsx(
|
|
1540
|
-
Badge,
|
|
1541
|
-
{
|
|
1542
|
-
size: "lg",
|
|
1543
|
-
color: "green",
|
|
1544
|
-
variant: "light",
|
|
1545
|
-
leftSection: /* @__PURE__ */ jsx(IconCircleCheck, { size: 14 }),
|
|
1546
|
-
style: { cursor: "default" },
|
|
1547
|
-
children: "Resolved"
|
|
1548
|
-
}
|
|
1549
|
-
) : /* @__PURE__ */ jsx(
|
|
1550
|
-
Button,
|
|
1551
|
-
{
|
|
1552
|
-
variant: "light",
|
|
1553
|
-
color: "teal",
|
|
1554
|
-
leftSection: /* @__PURE__ */ jsx(IconCircleDashed, { size: 16 }),
|
|
1555
|
-
loading: resolveErrors.isPending,
|
|
1556
|
-
onClick: () => executionId && resolveErrors.mutate(executionId),
|
|
1557
|
-
children: "Resolve"
|
|
1558
|
-
}
|
|
1559
|
-
)
|
|
1560
|
-
] }),
|
|
1561
|
-
/* @__PURE__ */ jsxs(Group, { children: [
|
|
1562
|
-
/* @__PURE__ */ jsx(Button, { variant: "default", onClick: onClose, children: "Close" }),
|
|
1563
|
-
resourceDetailHref && /* @__PURE__ */ jsx(Button, { component: "a", href: resourceDetailHref, target: "_blank", leftSection: /* @__PURE__ */ jsx(IconExternalLink, { size: 16 }), children: "View Execution Log" })
|
|
1564
|
-
] })
|
|
1565
|
-
] })
|
|
1566
|
-
] })
|
|
1567
|
-
] }) });
|
|
1568
|
-
}
|
|
1569
|
-
function CostAnalytics({ timeRange }) {
|
|
1570
|
-
const { data: trendsData, isLoading: trendsLoading, error: trendsError } = useCostTrends(timeRange);
|
|
1571
|
-
const { data: summaryData } = useCostSummary(timeRange);
|
|
1572
|
-
const { data: modelData, isLoading: modelLoading, error: modelError } = useCostByModel(timeRange);
|
|
1573
|
-
const { data: breakdownData, isLoading: breakdownLoading, error: breakdownError } = useCostBreakdown(timeRange);
|
|
1574
|
-
if (trendsLoading) return /* @__PURE__ */ jsx(AppShellLoader, {});
|
|
1575
|
-
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1576
|
-
/* @__PURE__ */ jsx(
|
|
1577
|
-
PageTitleCaption,
|
|
1578
|
-
{
|
|
1579
|
-
title: "Cost Analytics",
|
|
1580
|
-
caption: "Comprehensive cost tracking, budgets, ROI analysis, and labor savings"
|
|
1581
|
-
}
|
|
1582
|
-
),
|
|
1583
|
-
/* @__PURE__ */ jsx(CostTrendChart, { data: trendsData, summaryData, isLoading: trendsLoading, error: trendsError }),
|
|
1584
|
-
/* @__PURE__ */ jsx(
|
|
1585
|
-
CostBreakdownCard,
|
|
1586
|
-
{
|
|
1587
|
-
breakdownData,
|
|
1588
|
-
summaryData,
|
|
1589
|
-
isLoading: breakdownLoading,
|
|
1590
|
-
error: breakdownError
|
|
1591
|
-
}
|
|
1592
|
-
),
|
|
1593
|
-
/* @__PURE__ */ jsx(CostByModelTable, { data: modelData, isLoading: modelLoading, error: modelError })
|
|
1594
|
-
] });
|
|
1595
|
-
}
|
|
1596
|
-
function getNavigationPath2(activity) {
|
|
1597
|
-
switch (activity.activityType) {
|
|
1598
|
-
case "workflow_execution":
|
|
1599
|
-
return `/operations/resources/workflow/${activity.entityId}`;
|
|
1600
|
-
case "agent_run":
|
|
1601
|
-
return `/operations/resources/agent/${activity.entityId}`;
|
|
1602
|
-
case "hitl_action":
|
|
1603
|
-
return "/operations/command-queue";
|
|
1604
|
-
case "credential_change":
|
|
1605
|
-
case "credential_read":
|
|
1606
|
-
return "/settings/credentials";
|
|
1607
|
-
case "api_key_change":
|
|
1608
|
-
return "/settings/api-keys";
|
|
1609
|
-
case "deployment_change":
|
|
1610
|
-
return "/settings/deployments";
|
|
1611
|
-
case "membership_change":
|
|
1612
|
-
return "/settings/organization";
|
|
1613
|
-
default:
|
|
1614
|
-
return null;
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
function ActivityLog({ timeRange, pageSize = PAGE_SIZE_DEFAULT, onNavigate }) {
|
|
1618
|
-
const { filters, updateFilter, resetFilters } = useActivityFilters(timeRange);
|
|
1619
|
-
const startDate = useMemo(() => {
|
|
1620
|
-
const { startDate: startDate2 } = getTimeRangeDates(timeRange);
|
|
1621
|
-
return startDate2;
|
|
1622
|
-
}, [timeRange]);
|
|
1623
|
-
const activityType = filters.activityType !== "all" ? filters.activityType : void 0;
|
|
1624
|
-
const { page, setPage, offset, totalPages } = usePaginationState(pageSize, [
|
|
1625
|
-
filters.activityType,
|
|
1626
|
-
filters.status,
|
|
1627
|
-
filters.search,
|
|
1628
|
-
timeRange
|
|
1629
|
-
]);
|
|
1630
|
-
const { data: chartData, isLoading: isChartLoading } = useActivityTrend({
|
|
1631
|
-
activityType,
|
|
1632
|
-
startDate
|
|
1633
|
-
});
|
|
1634
|
-
const tableParams = useMemo(() => {
|
|
1635
|
-
const params = {
|
|
1636
|
-
limit: pageSize,
|
|
1637
|
-
offset,
|
|
1638
|
-
startDate
|
|
1639
|
-
};
|
|
1640
|
-
if (filters.activityType && filters.activityType !== "all") {
|
|
1641
|
-
params.activityType = filters.activityType;
|
|
1642
|
-
}
|
|
1643
|
-
if (filters.status && filters.status !== "all") {
|
|
1644
|
-
params.status = filters.status;
|
|
1645
|
-
}
|
|
1646
|
-
if (filters.search?.trim()) {
|
|
1647
|
-
params.search = filters.search.trim();
|
|
1648
|
-
}
|
|
1649
|
-
return params;
|
|
1650
|
-
}, [offset, startDate, filters.activityType, filters.status, filters.search, pageSize]);
|
|
1651
|
-
const { data: tableData, isLoading: isTableLoading } = useActivities(tableParams);
|
|
1652
|
-
const total = tableData?.total ?? 0;
|
|
1653
|
-
const handleRowClick = useCallback(
|
|
1654
|
-
(activity) => {
|
|
1655
|
-
const path = getNavigationPath2(activity);
|
|
1656
|
-
if (path) {
|
|
1657
|
-
onNavigate(path);
|
|
1658
|
-
}
|
|
1659
|
-
},
|
|
1660
|
-
[onNavigate]
|
|
1661
|
-
);
|
|
1662
|
-
if (isChartLoading && isTableLoading) return /* @__PURE__ */ jsx(AppShellLoader, {});
|
|
1663
|
-
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1664
|
-
/* @__PURE__ */ jsx(
|
|
1665
|
-
PageTitleCaption,
|
|
1666
|
-
{
|
|
1667
|
-
title: "Activity Log",
|
|
1668
|
-
caption: "Real-time activity feed with automatic updates every 30 seconds"
|
|
1669
|
-
}
|
|
1670
|
-
),
|
|
1671
|
-
/* @__PURE__ */ jsx(
|
|
1672
|
-
ActivityTrendChart,
|
|
1673
|
-
{
|
|
1674
|
-
timestamps: chartData?.timestamps ?? [],
|
|
1675
|
-
total: chartData?.total ?? 0,
|
|
1676
|
-
isLoading: isChartLoading,
|
|
1677
|
-
timeRange
|
|
1678
|
-
}
|
|
1679
|
-
),
|
|
1680
|
-
/* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1681
|
-
/* @__PURE__ */ jsx(ActivityFilters, { filters, onFilterChange: updateFilter, onReset: resetFilters }),
|
|
1682
|
-
/* @__PURE__ */ jsx(
|
|
1683
|
-
ActivityTable,
|
|
1684
|
-
{
|
|
1685
|
-
activities: tableData?.activities ?? [],
|
|
1686
|
-
isLoading: isTableLoading,
|
|
1687
|
-
onRowClick: handleRowClick
|
|
1688
|
-
}
|
|
1689
|
-
),
|
|
1690
|
-
totalPages(total) > 1 && /* @__PURE__ */ jsx(Group, { justify: "flex-start", children: /* @__PURE__ */ jsx(Pagination, { value: page, onChange: setPage, total: totalPages(total), size: "sm", boundaries: 1 }) })
|
|
1691
|
-
] }) })
|
|
1692
|
-
] });
|
|
1693
|
-
}
|
|
1694
|
-
function ActivityFeed({
|
|
1695
|
-
limit = 50,
|
|
1696
|
-
activityType,
|
|
1697
|
-
entityType,
|
|
1698
|
-
entityId,
|
|
1699
|
-
filters,
|
|
1700
|
-
clientFilters,
|
|
1701
|
-
overrideData,
|
|
1702
|
-
overrideLoading
|
|
1703
|
-
}) {
|
|
1704
|
-
const [currentLimit, setCurrentLimit] = useState(limit);
|
|
1705
|
-
const shouldFetch = !overrideData;
|
|
1706
|
-
const fetchResult = useActivities({
|
|
1707
|
-
limit: currentLimit,
|
|
1708
|
-
activityType: filters?.activityType || activityType,
|
|
1709
|
-
entityType,
|
|
1710
|
-
entityId,
|
|
1711
|
-
startDate: filters?.startDate
|
|
1712
|
-
});
|
|
1713
|
-
const data = overrideData ?? fetchResult.data;
|
|
1714
|
-
const error = shouldFetch ? fetchResult.error : null;
|
|
1715
|
-
const isLoading = overrideLoading ?? (shouldFetch ? fetchResult.isLoading : false);
|
|
1716
|
-
const handleLoadMore = () => {
|
|
1717
|
-
setCurrentLimit((prev) => prev + 50);
|
|
1718
|
-
};
|
|
1719
|
-
const filteredActivities = useMemo(() => {
|
|
1720
|
-
if (!data?.activities) return [];
|
|
1721
|
-
let filtered = data.activities;
|
|
1722
|
-
if (clientFilters?.status) {
|
|
1723
|
-
filtered = filtered.filter((activity) => activity.status === clientFilters.status);
|
|
1724
|
-
}
|
|
1725
|
-
if (clientFilters?.search) {
|
|
1726
|
-
const searchLower = clientFilters.search.toLowerCase();
|
|
1727
|
-
filtered = filtered.filter(
|
|
1728
|
-
(activity) => activity.title.toLowerCase().includes(searchLower) || activity.description?.toLowerCase().includes(searchLower) || activity.entityName?.toLowerCase().includes(searchLower)
|
|
1729
|
-
);
|
|
1730
|
-
}
|
|
1731
|
-
return filtered;
|
|
1732
|
-
}, [data?.activities, clientFilters]);
|
|
1733
|
-
if (isLoading) {
|
|
1734
|
-
return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, { size: "md" }) });
|
|
1735
|
-
}
|
|
1736
|
-
if (error) {
|
|
1737
|
-
return /* @__PURE__ */ jsx(Alert, { icon: /* @__PURE__ */ jsx(IconInfoCircle, { size: 16 }), title: "Error loading activities", color: "red", children: /* @__PURE__ */ jsx(Text, { size: "sm", children: error instanceof Error ? error.message : "Failed to load activities" }) });
|
|
1738
|
-
}
|
|
1739
|
-
if (!filteredActivities.length) {
|
|
1740
|
-
return /* @__PURE__ */ jsx(EmptyState, { icon: IconActivity, title: "No activities found" });
|
|
1741
|
-
}
|
|
1742
|
-
const hasMore = data ? data.total > currentLimit : false;
|
|
1743
|
-
const showingCount = filteredActivities.length;
|
|
1744
|
-
const totalCount = data?.total || 0;
|
|
1745
|
-
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
1746
|
-
/* @__PURE__ */ jsx(Group, { justify: "space-between", children: /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
|
|
1747
|
-
"Showing ",
|
|
1748
|
-
showingCount,
|
|
1749
|
-
" of ",
|
|
1750
|
-
totalCount,
|
|
1751
|
-
" activities"
|
|
1752
|
-
] }) }),
|
|
1753
|
-
/* @__PURE__ */ jsx(Stack, { children: filteredActivities.map((activity) => /* @__PURE__ */ jsx(ActivityCard, { activity }, activity.id)) }),
|
|
1754
|
-
hasMore && /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Button, { variant: "light", onClick: handleLoadMore, loading: isLoading, children: "Load More" }) })
|
|
1755
|
-
] });
|
|
1756
|
-
}
|
|
1757
|
-
function NotificationCenter({ pageSize = 20 }) {
|
|
1758
|
-
const { page, setPage, offset, totalPages } = usePaginationState(pageSize);
|
|
1759
|
-
const { data, isLoading } = useNotifications({ limit: pageSize, offset });
|
|
1760
|
-
const notifications = data?.notifications ?? [];
|
|
1761
|
-
const markAllAsRead = useMarkAllAsRead();
|
|
1762
|
-
const hasUnread = notifications.some((n) => !n.read);
|
|
1763
|
-
const handleMarkAllAsRead = async () => {
|
|
1764
|
-
await markAllAsRead.mutateAsync();
|
|
1765
|
-
};
|
|
1766
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1767
|
-
hasUnread && /* @__PURE__ */ jsx(Group, { justify: "flex-end", children: /* @__PURE__ */ jsx(Button, { variant: "light", size: "sm", onClick: handleMarkAllAsRead, loading: markAllAsRead.isPending, children: "Mark all as read" }) }),
|
|
1768
|
-
/* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(NotificationList, { notifications, isLoading }) }),
|
|
1769
|
-
totalPages(data?.total ?? 0) > 1 && /* @__PURE__ */ jsx(Group, { justify: "flex-start", children: /* @__PURE__ */ jsx(Pagination, { value: page, onChange: setPage, total: totalPages(data?.total ?? 0), size: "sm", boundaries: 1 }) })
|
|
1770
|
-
] });
|
|
1771
|
-
}
|
|
1772
|
-
var monitoringManifest = {
|
|
1773
|
-
key: "monitoring",
|
|
1774
|
-
routePrefixes: ["/monitoring"],
|
|
1775
|
-
icon: IconActivity
|
|
1776
|
-
};
|
|
1777
|
-
|
|
1778
|
-
export { ActivityCard, ActivityFeed, ActivityFilters, ActivityLog, ActivityTable, BusinessImpactCard, CostAnalytics, CostBreakdownCard, CostByModelTable, CostMetricsCard, ErrorAnalysisCard, ErrorBreakdownTable, ErrorDetailsModal, ExecutionBreakdownTable, ExecutionHealth, ExecutionHealthCard, ExecutionLogsFilters, ExecutionLogsPage, ExecutionLogsTable, NotificationCenter, NotificationItem, NotificationList, monitoringManifest };
|