@elevasis/ui 2.34.0 → 2.35.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 +12 -12
- package/dist/app/index.js +25 -23
- package/dist/charts/index.js +3 -5
- package/dist/chunk-26HFM4MH.js +41449 -0
- package/dist/{chunk-DTFKWZ7A.js → chunk-4U3XAWCN.js} +502 -484
- 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-TYRUKGGD.js → chunk-GX6XBRRF.js} +1 -2
- package/dist/{chunk-V6SZ4ECN.js → chunk-LUYVRATI.js} +257 -6
- package/dist/{chunk-X4WBGKJQ.js → chunk-R3VCBZDC.js} +50 -3
- package/dist/chunk-SIQ3P4OR.js +1764 -0
- package/dist/{chunk-RIAXZ6AH.js → chunk-VDOOGGBA.js} +1 -1
- 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 +69 -69
- package/dist/components/index.js +20 -2795
- package/dist/components/navigation/index.js +25 -5
- package/dist/execution/index.d.ts +9 -9
- package/dist/execution/index.js +1 -2
- package/dist/features/auth/index.js +23 -2
- package/dist/features/clients/index.js +20 -26
- package/dist/features/crm/index.js +20 -30
- package/dist/features/dashboard/index.d.ts +68 -68
- package/dist/features/dashboard/index.js +20 -28
- package/dist/features/delivery/index.js +20 -30
- package/dist/features/knowledge/index.js +25 -9
- package/dist/features/lead-gen/index.d.ts +9 -9
- 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 +153 -153
- package/dist/features/operations/index.js +18 -37
- package/dist/features/seo/index.js +3 -4
- package/dist/features/settings/index.js +20 -27
- package/dist/graph/index.js +1 -1
- package/dist/hooks/delivery/index.js +30 -2
- package/dist/hooks/index.d.ts +85 -85
- package/dist/hooks/index.js +20 -21
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +35 -35
- package/dist/hooks/published.d.ts +85 -85
- package/dist/hooks/published.js +20 -20
- package/dist/index.css +532 -532
- package/dist/index.d.ts +9256 -5803
- package/dist/index.js +22 -26
- package/dist/knowledge/index.d.ts +21 -21
- package/dist/knowledge/index.js +8 -15
- package/dist/layout/index.js +4 -10
- package/dist/organization/index.js +27 -1
- package/dist/provider/index.d.ts +47 -21
- package/dist/provider/index.js +20 -15
- package/dist/provider/published.d.ts +15 -16
- package/dist/provider/published.js +20 -11
- 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 +68 -68
- package/dist/utils/index.d.ts +46 -46
- 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-LAWLB6CT.js
DELETED
|
@@ -1,951 +0,0 @@
|
|
|
1
|
-
import { useErrorTrends } from './chunk-VNAZTCHA.js';
|
|
2
|
-
import { CardHeader, CenteredErrorState, TrendIndicator, EmptyState, StatCard } from './chunk-HRWLKKWM.js';
|
|
3
|
-
import { getTimeRangeLabel, getTimeRangeDates, formatBucketTime } from './chunk-2RJMVWFJ.js';
|
|
4
|
-
import { useRef, useState, useLayoutEffect, useEffect, useMemo, useCallback } from 'react';
|
|
5
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
import { useComputedColorScheme, Group, Text, Box, Stack, Center, Loader, Paper, Button, NumberFormatter, Badge, Space, Tooltip as Tooltip$1, SimpleGrid, Alert, SegmentedControl } from '@mantine/core';
|
|
7
|
-
import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine as ReferenceLine$1, Area, PieChart, Pie, Cell } from 'recharts';
|
|
8
|
-
import { IconActivity, IconDownload, IconChartLine, IconInfoCircle, IconApps, IconPlayerPlay, IconChartBar, IconAlertTriangle, IconRocket, IconAlertCircle } from '@tabler/icons-react';
|
|
9
|
-
|
|
10
|
-
function ChartFrame({ h, debounceMs = 150, children }) {
|
|
11
|
-
const ref = useRef(null);
|
|
12
|
-
const [width, setWidth] = useState(0);
|
|
13
|
-
useLayoutEffect(() => {
|
|
14
|
-
const el = ref.current;
|
|
15
|
-
if (!el) return;
|
|
16
|
-
const w = el.getBoundingClientRect().width;
|
|
17
|
-
if (w > 0) setWidth(w);
|
|
18
|
-
}, []);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const el = ref.current;
|
|
21
|
-
if (!el) return;
|
|
22
|
-
let timeout;
|
|
23
|
-
const ro = new ResizeObserver((entries) => {
|
|
24
|
-
if (timeout !== void 0) window.clearTimeout(timeout);
|
|
25
|
-
const nextWidth = entries[0]?.contentRect.width ?? 0;
|
|
26
|
-
timeout = window.setTimeout(() => {
|
|
27
|
-
if (nextWidth > 0) setWidth(nextWidth);
|
|
28
|
-
}, debounceMs);
|
|
29
|
-
});
|
|
30
|
-
ro.observe(el);
|
|
31
|
-
return () => {
|
|
32
|
-
ro.disconnect();
|
|
33
|
-
if (timeout !== void 0) window.clearTimeout(timeout);
|
|
34
|
-
};
|
|
35
|
-
}, [debounceMs]);
|
|
36
|
-
return /* @__PURE__ */ jsx("div", { ref, style: { width: "100%", height: h, position: "relative" }, children: width > 0 && /* @__PURE__ */ jsx("div", { style: { width, height: h }, children }) });
|
|
37
|
-
}
|
|
38
|
-
var THEME_DERIVED = {
|
|
39
|
-
grid: "var(--color-border)",
|
|
40
|
-
gridLine: "var(--color-border)",
|
|
41
|
-
tickText: "var(--mantine-color-dimmed)",
|
|
42
|
-
tooltipBg: "var(--glass-background)",
|
|
43
|
-
tooltipBorder: "var(--color-border)",
|
|
44
|
-
tooltipText: "var(--mantine-color-dimmed)",
|
|
45
|
-
dotStroke: "var(--mantine-color-body)"
|
|
46
|
-
};
|
|
47
|
-
var DARK = {
|
|
48
|
-
cyan: "#00e5ff",
|
|
49
|
-
cyanDim: "#00b8d4",
|
|
50
|
-
blue: "#448aff",
|
|
51
|
-
green: "#00ff88",
|
|
52
|
-
greenDim: "#00c853",
|
|
53
|
-
red: "#ff1744",
|
|
54
|
-
redDim: "#d50000",
|
|
55
|
-
yellow: "#ffab00",
|
|
56
|
-
magenta: "#ff4081",
|
|
57
|
-
...THEME_DERIVED,
|
|
58
|
-
cardGlow: "0 0 30px rgba(0, 229, 255, 0.06)"
|
|
59
|
-
};
|
|
60
|
-
var LIGHT = {
|
|
61
|
-
cyan: "#0091ea",
|
|
62
|
-
cyanDim: "#0277bd",
|
|
63
|
-
blue: "#4d8af0",
|
|
64
|
-
green: "#00a854",
|
|
65
|
-
greenDim: "#00873e",
|
|
66
|
-
red: "#d32f2f",
|
|
67
|
-
redDim: "#b71c1c",
|
|
68
|
-
yellow: "#f9a825",
|
|
69
|
-
magenta: "#c51162",
|
|
70
|
-
...THEME_DERIVED,
|
|
71
|
-
cardGlow: "0 0 20px rgba(0, 145, 234, 0.06)"
|
|
72
|
-
};
|
|
73
|
-
function useCyberColors() {
|
|
74
|
-
const scheme = useComputedColorScheme("dark");
|
|
75
|
-
return useMemo(() => scheme === "dark" ? DARK : LIGHT, [scheme]);
|
|
76
|
-
}
|
|
77
|
-
function getSeriesColor(key, colors) {
|
|
78
|
-
switch (key) {
|
|
79
|
-
case "Success Rate":
|
|
80
|
-
return colors.cyan;
|
|
81
|
-
case "Executions":
|
|
82
|
-
return colors.blue;
|
|
83
|
-
case "Success Count":
|
|
84
|
-
return colors.green;
|
|
85
|
-
case "Error Count":
|
|
86
|
-
return colors.red;
|
|
87
|
-
default:
|
|
88
|
-
return colors.cyan;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
var ReferenceLine = ReferenceLine$1;
|
|
92
|
-
function CyberDefs({ colors, isLight }) {
|
|
93
|
-
const gradMul = isLight ? 0.5 : 1;
|
|
94
|
-
const gradients = [
|
|
95
|
-
{ id: "gradCyan", color: colors.cyan, opacity: 0.35 * gradMul },
|
|
96
|
-
{ id: "gradBlue", color: colors.blue, opacity: 0.3 * gradMul },
|
|
97
|
-
{ id: "gradGreen", color: colors.green, opacity: 0.3 * gradMul },
|
|
98
|
-
{ id: "gradRed", color: colors.red, opacity: 0.3 * gradMul },
|
|
99
|
-
{ id: "gradYellow", color: colors.yellow, opacity: 0.3 * gradMul }
|
|
100
|
-
];
|
|
101
|
-
const glowMul = isLight ? 0.25 : 1;
|
|
102
|
-
const filters = [
|
|
103
|
-
{ id: "glowCyan", std: 3 * glowMul },
|
|
104
|
-
{ id: "glowBlue", std: 3 * glowMul },
|
|
105
|
-
{ id: "glowGreen", std: 2.5 * glowMul },
|
|
106
|
-
{ id: "glowRed", std: 2.5 * glowMul },
|
|
107
|
-
{ id: "glowYellow", std: 2.5 * glowMul }
|
|
108
|
-
];
|
|
109
|
-
return /* @__PURE__ */ jsxs("defs", { children: [
|
|
110
|
-
gradients.map((g) => /* @__PURE__ */ jsxs("linearGradient", { id: g.id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
111
|
-
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: g.color, stopOpacity: g.opacity }),
|
|
112
|
-
/* @__PURE__ */ jsx("stop", { offset: "60%", stopColor: g.color, stopOpacity: g.opacity * 0.2 }),
|
|
113
|
-
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: g.color, stopOpacity: 0 })
|
|
114
|
-
] }, g.id)),
|
|
115
|
-
filters.map((f) => /* @__PURE__ */ jsxs("filter", { id: f.id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
|
|
116
|
-
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: f.std, result: "blur" }),
|
|
117
|
-
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
118
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
119
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
120
|
-
] })
|
|
121
|
-
] }, f.id)),
|
|
122
|
-
/* @__PURE__ */ jsxs("filter", { id: "dotGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
123
|
-
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
|
|
124
|
-
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
125
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
126
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
127
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
128
|
-
] })
|
|
129
|
-
] }),
|
|
130
|
-
/* @__PURE__ */ jsxs("filter", { id: "pulseGlow", x: "-30%", y: "-30%", width: "160%", height: "160%", children: [
|
|
131
|
-
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "5", result: "blur" }),
|
|
132
|
-
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
133
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
134
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
135
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
136
|
-
] })
|
|
137
|
-
] })
|
|
138
|
-
] });
|
|
139
|
-
}
|
|
140
|
-
function PulseDefs({ series, colors, isLight }) {
|
|
141
|
-
return /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
|
|
142
|
-
const color = colors[s.color ?? "cyan"];
|
|
143
|
-
const dur = "6s";
|
|
144
|
-
const delay = "0s";
|
|
145
|
-
const keyTimes = "0;0.3;1";
|
|
146
|
-
const keySplines = "0.33 0 0.67 1;0 0 1 1";
|
|
147
|
-
const animateProps = {
|
|
148
|
-
dur,
|
|
149
|
-
keyTimes,
|
|
150
|
-
keySplines,
|
|
151
|
-
repeatCount: "indefinite",
|
|
152
|
-
calcMode: "spline",
|
|
153
|
-
begin: delay
|
|
154
|
-
};
|
|
155
|
-
return /* @__PURE__ */ jsxs("linearGradient", { id: `pulse-${i}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
156
|
-
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.15;1.0;1.0", ...animateProps }) }),
|
|
157
|
-
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: isLight ? "white" : color, stopOpacity: isLight ? 0.6 : 0.9, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.075;1.075;1.075", ...animateProps }) }),
|
|
158
|
-
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "0;1.15;1.15", ...animateProps }) })
|
|
159
|
-
] }, i);
|
|
160
|
-
}) });
|
|
161
|
-
}
|
|
162
|
-
function CyberActiveDot({
|
|
163
|
-
cx,
|
|
164
|
-
cy,
|
|
165
|
-
color,
|
|
166
|
-
dotStroke
|
|
167
|
-
}) {
|
|
168
|
-
if (cx == null || cy == null) return null;
|
|
169
|
-
return /* @__PURE__ */ jsxs("g", { filter: "url(#dotGlow)", children: [
|
|
170
|
-
/* @__PURE__ */ jsxs("circle", { cx, cy, r: 6, fill: "none", stroke: color, strokeWidth: 2, opacity: 0.5, children: [
|
|
171
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "r", from: "4", to: "10", dur: "1.2s", repeatCount: "indefinite" }),
|
|
172
|
-
/* @__PURE__ */ jsx("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: "1.2s", repeatCount: "indefinite" })
|
|
173
|
-
] }),
|
|
174
|
-
/* @__PURE__ */ jsx("circle", { cx, cy, r: 4, fill: color, stroke: dotStroke, strokeWidth: 2 })
|
|
175
|
-
] });
|
|
176
|
-
}
|
|
177
|
-
function CyberTooltipContent({
|
|
178
|
-
active,
|
|
179
|
-
payload,
|
|
180
|
-
label,
|
|
181
|
-
colors,
|
|
182
|
-
labelFormatter,
|
|
183
|
-
valueFormatter
|
|
184
|
-
}) {
|
|
185
|
-
if (!active || !payload?.length) return null;
|
|
186
|
-
const filtered = payload.filter((entry) => !entry.name?.startsWith("_pulse_"));
|
|
187
|
-
if (!filtered.length) return null;
|
|
188
|
-
const displayLabel = label && labelFormatter ? labelFormatter(label) : label;
|
|
189
|
-
return /* @__PURE__ */ jsxs(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
style: {
|
|
193
|
-
background: colors.tooltipBg,
|
|
194
|
-
border: `1px solid ${colors.tooltipBorder}`,
|
|
195
|
-
borderRadius: 8,
|
|
196
|
-
padding: "10px 14px",
|
|
197
|
-
backdropFilter: "var(--glass-blur)",
|
|
198
|
-
WebkitBackdropFilter: "var(--glass-blur)",
|
|
199
|
-
boxShadow: "var(--standard-box-shadow)",
|
|
200
|
-
fontFamily: "var(--mantine-font-family-monospace, monospace)",
|
|
201
|
-
minWidth: 160
|
|
202
|
-
},
|
|
203
|
-
children: [
|
|
204
|
-
/* @__PURE__ */ jsx(
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
style: {
|
|
208
|
-
fontSize: 11,
|
|
209
|
-
color: colors.tickText,
|
|
210
|
-
marginBottom: 8,
|
|
211
|
-
letterSpacing: "0.05em",
|
|
212
|
-
textTransform: "uppercase",
|
|
213
|
-
borderBottom: `1px solid ${colors.tooltipBorder}`,
|
|
214
|
-
paddingBottom: 6
|
|
215
|
-
},
|
|
216
|
-
children: displayLabel
|
|
217
|
-
}
|
|
218
|
-
),
|
|
219
|
-
filtered.map((entry) => {
|
|
220
|
-
const color = entry.color || getSeriesColor(entry.dataKey, colors);
|
|
221
|
-
return /* @__PURE__ */ jsxs(
|
|
222
|
-
"div",
|
|
223
|
-
{
|
|
224
|
-
style: {
|
|
225
|
-
display: "flex",
|
|
226
|
-
justifyContent: "space-between",
|
|
227
|
-
alignItems: "center",
|
|
228
|
-
gap: 16,
|
|
229
|
-
padding: "3px 0",
|
|
230
|
-
fontSize: 12
|
|
231
|
-
},
|
|
232
|
-
children: [
|
|
233
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
234
|
-
/* @__PURE__ */ jsx(
|
|
235
|
-
"div",
|
|
236
|
-
{
|
|
237
|
-
style: {
|
|
238
|
-
width: 8,
|
|
239
|
-
height: 8,
|
|
240
|
-
borderRadius: "50%",
|
|
241
|
-
backgroundColor: color,
|
|
242
|
-
boxShadow: `0 0 6px ${color}`
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
/* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText }, children: entry.name ?? entry.dataKey })
|
|
247
|
-
] }),
|
|
248
|
-
/* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: entry.value != null && valueFormatter ? valueFormatter(entry.value) : String(entry.value) })
|
|
249
|
-
]
|
|
250
|
-
},
|
|
251
|
-
entry.dataKey
|
|
252
|
-
);
|
|
253
|
-
})
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
function CyberLegendItem({ color, label }) {
|
|
259
|
-
return /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
|
|
260
|
-
/* @__PURE__ */ jsx(
|
|
261
|
-
"div",
|
|
262
|
-
{
|
|
263
|
-
style: {
|
|
264
|
-
width: 10,
|
|
265
|
-
height: 10,
|
|
266
|
-
borderRadius: "50%",
|
|
267
|
-
backgroundColor: color,
|
|
268
|
-
boxShadow: `0 0 8px ${color}, 0 0 16px ${color}40`
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
),
|
|
272
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", style: { color: "var(--color-text-subtle)", letterSpacing: "0.03em" }, children: label })
|
|
273
|
-
] });
|
|
274
|
-
}
|
|
275
|
-
var COLOR_MAP = {
|
|
276
|
-
cyan: { gradient: "url(#gradCyan)", filter: "url(#glowCyan)", key: "cyan" },
|
|
277
|
-
blue: { gradient: "url(#gradBlue)", filter: "url(#glowBlue)", key: "blue" },
|
|
278
|
-
green: { gradient: "url(#gradGreen)", filter: "url(#glowGreen)", key: "green" },
|
|
279
|
-
red: { gradient: "url(#gradRed)", filter: "url(#glowRed)", key: "red" },
|
|
280
|
-
yellow: { gradient: "url(#gradYellow)", filter: "url(#glowYellow)", key: "yellow" }
|
|
281
|
-
};
|
|
282
|
-
function CyberAreaChart({
|
|
283
|
-
data,
|
|
284
|
-
series,
|
|
285
|
-
xDataKey = "time",
|
|
286
|
-
height = 300,
|
|
287
|
-
yAxisLabel,
|
|
288
|
-
yDomain,
|
|
289
|
-
yTickFormatter,
|
|
290
|
-
showGrid = true,
|
|
291
|
-
showZeroBaseline = true,
|
|
292
|
-
baselineColor,
|
|
293
|
-
lineOnly = false,
|
|
294
|
-
margin = { top: 8, right: 20, left: 0, bottom: 0 },
|
|
295
|
-
xTickFormatter,
|
|
296
|
-
tooltipFormatter
|
|
297
|
-
}) {
|
|
298
|
-
const isLight = useComputedColorScheme("dark") === "light";
|
|
299
|
-
const colors = useCyberColors();
|
|
300
|
-
const [ready, setReady] = useState(false);
|
|
301
|
-
useEffect(() => {
|
|
302
|
-
const frame = requestAnimationFrame(() => setReady(true));
|
|
303
|
-
return () => cancelAnimationFrame(frame);
|
|
304
|
-
}, []);
|
|
305
|
-
const allZero = useMemo(() => {
|
|
306
|
-
if (!showZeroBaseline || !data.length) return false;
|
|
307
|
-
return data.every((row) => series.every((s) => row[s.dataKey] === 0));
|
|
308
|
-
}, [data, series, showZeroBaseline]);
|
|
309
|
-
if (!ready || !data.length) return /* @__PURE__ */ jsx(Box, { style: { height } });
|
|
310
|
-
const gridProps = {
|
|
311
|
-
stroke: colors.gridLine,
|
|
312
|
-
strokeDasharray: "3 6",
|
|
313
|
-
strokeOpacity: 1
|
|
314
|
-
};
|
|
315
|
-
const xAxisConfig = {
|
|
316
|
-
stroke: "none",
|
|
317
|
-
tick: {
|
|
318
|
-
fill: colors.tickText,
|
|
319
|
-
fontSize: 11,
|
|
320
|
-
fontFamily: "var(--mantine-font-family-monospace, monospace)"
|
|
321
|
-
},
|
|
322
|
-
tickLine: false,
|
|
323
|
-
axisLine: { stroke: colors.grid, strokeWidth: 1 }
|
|
324
|
-
};
|
|
325
|
-
const yTickStyle = {
|
|
326
|
-
fill: colors.tickText,
|
|
327
|
-
fontSize: 11,
|
|
328
|
-
fontFamily: "var(--mantine-font-family-monospace, monospace)"
|
|
329
|
-
};
|
|
330
|
-
return /* @__PURE__ */ jsx(Box, { style: { width: "100%", height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(AreaChart, { data, margin, children: [
|
|
331
|
-
/* @__PURE__ */ jsx(CyberDefs, { colors, isLight }),
|
|
332
|
-
/* @__PURE__ */ jsx(PulseDefs, { series, colors, isLight }),
|
|
333
|
-
showGrid && /* @__PURE__ */ jsx(CartesianGrid, { ...gridProps }),
|
|
334
|
-
/* @__PURE__ */ jsx(XAxis, { dataKey: xDataKey, ...xAxisConfig, tickFormatter: xTickFormatter }),
|
|
335
|
-
/* @__PURE__ */ jsx(
|
|
336
|
-
YAxis,
|
|
337
|
-
{
|
|
338
|
-
domain: yDomain ?? [0, (max) => Math.max(max, 1)],
|
|
339
|
-
stroke: "none",
|
|
340
|
-
tick: yTickStyle,
|
|
341
|
-
tickFormatter: yTickFormatter,
|
|
342
|
-
tickLine: false,
|
|
343
|
-
axisLine: { stroke: colors.grid, strokeWidth: 1 },
|
|
344
|
-
label: yAxisLabel ? {
|
|
345
|
-
value: yAxisLabel,
|
|
346
|
-
angle: -90,
|
|
347
|
-
position: "insideLeft",
|
|
348
|
-
offset: 0,
|
|
349
|
-
style: { fill: colors.tickText, fontSize: 11 }
|
|
350
|
-
} : void 0
|
|
351
|
-
}
|
|
352
|
-
),
|
|
353
|
-
/* @__PURE__ */ jsx(
|
|
354
|
-
Tooltip,
|
|
355
|
-
{
|
|
356
|
-
content: /* @__PURE__ */ jsx(CyberTooltipContent, { colors, labelFormatter: xTickFormatter, valueFormatter: tooltipFormatter }),
|
|
357
|
-
cursor: { stroke: colors.cyan, strokeOpacity: 0.2 }
|
|
358
|
-
}
|
|
359
|
-
),
|
|
360
|
-
allZero && (() => {
|
|
361
|
-
const bColor = colors[baselineColor ?? series[0]?.color ?? "cyan"];
|
|
362
|
-
const glow = isLight ? `drop-shadow(0 0 2px ${bColor})` : `drop-shadow(0 0 4px ${bColor}) drop-shadow(0 0 8px ${bColor})`;
|
|
363
|
-
return /* @__PURE__ */ jsx(ReferenceLine, { y: 0, stroke: bColor, strokeWidth: isLight ? 1.5 : 2, style: { filter: glow } });
|
|
364
|
-
})(),
|
|
365
|
-
series.map((s) => {
|
|
366
|
-
const cm = COLOR_MAP[s.color ?? "cyan"];
|
|
367
|
-
const strokeColor = colors[cm.key];
|
|
368
|
-
return /* @__PURE__ */ jsx(
|
|
369
|
-
Area,
|
|
370
|
-
{
|
|
371
|
-
type: "monotone",
|
|
372
|
-
dataKey: s.dataKey,
|
|
373
|
-
name: s.name ?? s.dataKey,
|
|
374
|
-
stroke: strokeColor,
|
|
375
|
-
strokeWidth: lineOnly ? 3 : 2,
|
|
376
|
-
fill: lineOnly ? "transparent" : cm.gradient,
|
|
377
|
-
filter: cm.filter,
|
|
378
|
-
dot: false,
|
|
379
|
-
activeDot: /* @__PURE__ */ jsx(CyberActiveDot, { color: strokeColor, dotStroke: colors.dotStroke }),
|
|
380
|
-
animationBegin: 100,
|
|
381
|
-
animationDuration: s.animationDuration ?? 1200,
|
|
382
|
-
animationEasing: "ease-out"
|
|
383
|
-
},
|
|
384
|
-
s.dataKey
|
|
385
|
-
);
|
|
386
|
-
}),
|
|
387
|
-
!isLight && series.map((s, i) => /* @__PURE__ */ jsx(
|
|
388
|
-
Area,
|
|
389
|
-
{
|
|
390
|
-
type: "monotone",
|
|
391
|
-
dataKey: s.dataKey,
|
|
392
|
-
name: `_pulse_${s.dataKey}`,
|
|
393
|
-
stroke: `url(#pulse-${i})`,
|
|
394
|
-
strokeWidth: 3,
|
|
395
|
-
fill: "none",
|
|
396
|
-
filter: "url(#pulseGlow)",
|
|
397
|
-
dot: false,
|
|
398
|
-
activeDot: false,
|
|
399
|
-
tooltipType: "none",
|
|
400
|
-
isAnimationActive: false,
|
|
401
|
-
style: { pointerEvents: "none" }
|
|
402
|
-
},
|
|
403
|
-
`pulse-${s.dataKey}`
|
|
404
|
-
))
|
|
405
|
-
] }) }) });
|
|
406
|
-
}
|
|
407
|
-
function CyberDonutTooltip({
|
|
408
|
-
active,
|
|
409
|
-
payload,
|
|
410
|
-
colors
|
|
411
|
-
}) {
|
|
412
|
-
if (!active || !payload?.length) return null;
|
|
413
|
-
const entry = payload[0];
|
|
414
|
-
if (!entry) return null;
|
|
415
|
-
const color = entry.payload?.color ?? colors.cyan;
|
|
416
|
-
return /* @__PURE__ */ jsxs(
|
|
417
|
-
"div",
|
|
418
|
-
{
|
|
419
|
-
style: {
|
|
420
|
-
background: colors.tooltipBg,
|
|
421
|
-
border: `1px solid ${colors.tooltipBorder}`,
|
|
422
|
-
borderRadius: 8,
|
|
423
|
-
padding: "8px 12px",
|
|
424
|
-
backdropFilter: "var(--glass-blur)",
|
|
425
|
-
WebkitBackdropFilter: "var(--glass-blur)",
|
|
426
|
-
boxShadow: "var(--standard-box-shadow)",
|
|
427
|
-
fontFamily: "var(--mantine-font-family-monospace, monospace)",
|
|
428
|
-
display: "flex",
|
|
429
|
-
alignItems: "center",
|
|
430
|
-
gap: 10
|
|
431
|
-
},
|
|
432
|
-
children: [
|
|
433
|
-
/* @__PURE__ */ jsx(
|
|
434
|
-
"div",
|
|
435
|
-
{
|
|
436
|
-
style: {
|
|
437
|
-
width: 8,
|
|
438
|
-
height: 8,
|
|
439
|
-
borderRadius: "50%",
|
|
440
|
-
backgroundColor: color,
|
|
441
|
-
boxShadow: `0 0 6px ${color}`
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
),
|
|
445
|
-
/* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText, fontSize: 12 }, children: entry.name }),
|
|
446
|
-
/* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontSize: 12, fontVariantNumeric: "tabular-nums" }, children: entry.value })
|
|
447
|
-
]
|
|
448
|
-
}
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
function CyberDonut({
|
|
452
|
-
title,
|
|
453
|
-
segments,
|
|
454
|
-
centerValue,
|
|
455
|
-
centerLabel,
|
|
456
|
-
centerValueColor = "var(--mantine-color-text)",
|
|
457
|
-
glowId,
|
|
458
|
-
colors,
|
|
459
|
-
size = 120,
|
|
460
|
-
innerRadius = 36,
|
|
461
|
-
outerRadius = 52,
|
|
462
|
-
isLoading,
|
|
463
|
-
showLegend = true
|
|
464
|
-
}) {
|
|
465
|
-
const filtered = segments.filter((s) => s.value > 0);
|
|
466
|
-
const isEmpty = filtered.length === 0;
|
|
467
|
-
const pieData = isEmpty ? [{ name: "Empty", value: 1, color: "var(--color-border)" }] : filtered;
|
|
468
|
-
return /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
|
|
469
|
-
title && /* @__PURE__ */ jsx(
|
|
470
|
-
Text,
|
|
471
|
-
{
|
|
472
|
-
size: "xs",
|
|
473
|
-
fw: 600,
|
|
474
|
-
style: { color: "var(--color-text)", letterSpacing: "0.03em", textTransform: "uppercase" },
|
|
475
|
-
children: title
|
|
476
|
-
}
|
|
477
|
-
),
|
|
478
|
-
/* @__PURE__ */ jsxs(Box, { style: { width: size, height: size, position: "relative" }, children: [
|
|
479
|
-
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart, { children: [
|
|
480
|
-
!isEmpty && /* @__PURE__ */ jsx("defs", { children: filtered.map((_, i) => /* @__PURE__ */ jsxs("filter", { id: `${glowId}-${i}`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
|
|
481
|
-
/* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
|
|
482
|
-
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
483
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
|
|
484
|
-
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
485
|
-
] })
|
|
486
|
-
] }, i)) }),
|
|
487
|
-
/* @__PURE__ */ jsx(
|
|
488
|
-
Pie,
|
|
489
|
-
{
|
|
490
|
-
data: pieData,
|
|
491
|
-
cx: "50%",
|
|
492
|
-
cy: "50%",
|
|
493
|
-
innerRadius,
|
|
494
|
-
outerRadius,
|
|
495
|
-
paddingAngle: isEmpty ? 0 : 3,
|
|
496
|
-
dataKey: "value",
|
|
497
|
-
stroke: "none",
|
|
498
|
-
animationBegin: 100,
|
|
499
|
-
animationDuration: 1e3,
|
|
500
|
-
animationEasing: "ease-out",
|
|
501
|
-
isAnimationActive: !isEmpty,
|
|
502
|
-
children: pieData.map((entry, i) => /* @__PURE__ */ jsx(
|
|
503
|
-
Cell,
|
|
504
|
-
{
|
|
505
|
-
fill: entry.color,
|
|
506
|
-
style: {
|
|
507
|
-
filter: isEmpty ? void 0 : `url(#${glowId}-${i})`,
|
|
508
|
-
fillOpacity: isEmpty ? 0.3 : 0.9
|
|
509
|
-
}
|
|
510
|
-
},
|
|
511
|
-
entry.name
|
|
512
|
-
))
|
|
513
|
-
}
|
|
514
|
-
),
|
|
515
|
-
!isEmpty && /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CyberDonutTooltip, { colors }) })
|
|
516
|
-
] }) }),
|
|
517
|
-
/* @__PURE__ */ jsxs(
|
|
518
|
-
"div",
|
|
519
|
-
{
|
|
520
|
-
style: {
|
|
521
|
-
position: "absolute",
|
|
522
|
-
top: "50%",
|
|
523
|
-
left: "50%",
|
|
524
|
-
transform: "translate(-50%, -50%)",
|
|
525
|
-
textAlign: "center",
|
|
526
|
-
pointerEvents: "none"
|
|
527
|
-
},
|
|
528
|
-
children: [
|
|
529
|
-
/* @__PURE__ */ jsx(
|
|
530
|
-
"div",
|
|
531
|
-
{
|
|
532
|
-
style: {
|
|
533
|
-
fontSize: 18,
|
|
534
|
-
fontWeight: 700,
|
|
535
|
-
fontFamily: "var(--mantine-font-family-monospace, monospace)",
|
|
536
|
-
color: centerValueColor,
|
|
537
|
-
lineHeight: 1
|
|
538
|
-
},
|
|
539
|
-
children: isLoading ? "-" : centerValue
|
|
540
|
-
}
|
|
541
|
-
),
|
|
542
|
-
/* @__PURE__ */ jsx(
|
|
543
|
-
"div",
|
|
544
|
-
{
|
|
545
|
-
style: {
|
|
546
|
-
fontSize: 8,
|
|
547
|
-
color: "var(--mantine-color-dimmed)",
|
|
548
|
-
letterSpacing: "0.05em",
|
|
549
|
-
textTransform: "uppercase",
|
|
550
|
-
marginTop: 2
|
|
551
|
-
},
|
|
552
|
-
children: centerLabel
|
|
553
|
-
}
|
|
554
|
-
)
|
|
555
|
-
]
|
|
556
|
-
}
|
|
557
|
-
)
|
|
558
|
-
] }),
|
|
559
|
-
showLegend && /* @__PURE__ */ jsx(Stack, { gap: 4, style: { width: "100%" }, children: segments.map((seg) => /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", px: "xs", children: [
|
|
560
|
-
/* @__PURE__ */ jsx(CyberLegendItem, { color: seg.color, label: seg.name }),
|
|
561
|
-
/* @__PURE__ */ jsx(
|
|
562
|
-
Text,
|
|
563
|
-
{
|
|
564
|
-
size: "xs",
|
|
565
|
-
fw: 600,
|
|
566
|
-
style: {
|
|
567
|
-
fontFamily: "var(--mantine-font-family-monospace, monospace)",
|
|
568
|
-
fontVariantNumeric: "tabular-nums"
|
|
569
|
-
},
|
|
570
|
-
children: isLoading ? "-" : seg.value
|
|
571
|
-
}
|
|
572
|
-
)
|
|
573
|
-
] }, seg.name)) })
|
|
574
|
-
] });
|
|
575
|
-
}
|
|
576
|
-
var GRANULARITY_MAP = {
|
|
577
|
-
"1h": "hour",
|
|
578
|
-
"24h": "hour",
|
|
579
|
-
"7d": "day",
|
|
580
|
-
"30d": "day"
|
|
581
|
-
};
|
|
582
|
-
var BUCKET_CONFIG = {
|
|
583
|
-
"1h": { size: 5 * 60 * 1e3, count: 12 },
|
|
584
|
-
"24h": { size: 60 * 60 * 1e3, count: 24 },
|
|
585
|
-
"7d": { size: 24 * 60 * 60 * 1e3, count: 7 },
|
|
586
|
-
"30d": { size: 24 * 60 * 60 * 1e3, count: 30 }
|
|
587
|
-
};
|
|
588
|
-
function groupTimestampsByTime(timestamps, timeRange) {
|
|
589
|
-
const { size: bucketSize, count: bucketCount } = BUCKET_CONFIG[timeRange];
|
|
590
|
-
const granularity = GRANULARITY_MAP[timeRange];
|
|
591
|
-
const now = /* @__PURE__ */ new Date();
|
|
592
|
-
const flooredNow = new Date(now.getTime() - now.getTime() % bucketSize);
|
|
593
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
594
|
-
for (let i = bucketCount - 1; i >= 0; i--) {
|
|
595
|
-
const bucketTime = new Date(flooredNow.getTime() - i * bucketSize);
|
|
596
|
-
const label = formatBucketTime(bucketTime.toISOString(), granularity);
|
|
597
|
-
buckets.set(label, 0);
|
|
598
|
-
}
|
|
599
|
-
timestamps.forEach((occurredAt) => {
|
|
600
|
-
const timeDiff = flooredNow.getTime() - occurredAt.getTime();
|
|
601
|
-
const bucketIndex = Math.floor(timeDiff / bucketSize);
|
|
602
|
-
if (bucketIndex >= 0 && bucketIndex < bucketCount) {
|
|
603
|
-
const bucketTime = new Date(flooredNow.getTime() - bucketIndex * bucketSize);
|
|
604
|
-
const label = formatBucketTime(bucketTime.toISOString(), granularity);
|
|
605
|
-
buckets.set(label, (buckets.get(label) || 0) + 1);
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
return Array.from(buckets.entries()).map(([time, count]) => ({
|
|
609
|
-
time,
|
|
610
|
-
"Activity Count": count
|
|
611
|
-
}));
|
|
612
|
-
}
|
|
613
|
-
function ActivityTrendChart({ timestamps, total, isLoading, timeRange }) {
|
|
614
|
-
const chartData = useMemo(() => {
|
|
615
|
-
return groupTimestampsByTime(timestamps, timeRange);
|
|
616
|
-
}, [timestamps, timeRange]);
|
|
617
|
-
if (isLoading) {
|
|
618
|
-
return /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) });
|
|
619
|
-
}
|
|
620
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
621
|
-
/* @__PURE__ */ jsx(
|
|
622
|
-
CardHeader,
|
|
623
|
-
{
|
|
624
|
-
icon: /* @__PURE__ */ jsx(IconActivity, { size: 18 }),
|
|
625
|
-
title: "Activity Trend",
|
|
626
|
-
subtitle: `${total} activities in ${getTimeRangeLabel(timeRange)}`
|
|
627
|
-
}
|
|
628
|
-
),
|
|
629
|
-
/* @__PURE__ */ jsx(
|
|
630
|
-
CyberAreaChart,
|
|
631
|
-
{
|
|
632
|
-
data: chartData,
|
|
633
|
-
series: [{ dataKey: "Activity Count", color: "blue" }],
|
|
634
|
-
height: 200,
|
|
635
|
-
yAxisLabel: "Count",
|
|
636
|
-
yDomain: [0, "auto"]
|
|
637
|
-
}
|
|
638
|
-
)
|
|
639
|
-
] });
|
|
640
|
-
}
|
|
641
|
-
function formatDollar(value) {
|
|
642
|
-
return `$${value.toFixed(2)}`;
|
|
643
|
-
}
|
|
644
|
-
function CostTrendChart({ data, summaryData, isLoading, error }) {
|
|
645
|
-
const todayCost = summaryData?.current.totalCostUsd ?? 0;
|
|
646
|
-
const previousCost = summaryData?.previous.totalCostUsd ?? 0;
|
|
647
|
-
const mtdCost = summaryData?.mtd.totalCostUsd ?? 0;
|
|
648
|
-
const projectedMonthlyCost = summaryData?.projection.monthlyCostUsd ?? 0;
|
|
649
|
-
const confidence = summaryData?.projection.confidence ?? "low";
|
|
650
|
-
const budget = 1500;
|
|
651
|
-
const budgetStatus = projectedMonthlyCost <= budget ? "green" : projectedMonthlyCost <= budget * 1.1 ? "yellow" : "red";
|
|
652
|
-
const budgetLabel = projectedMonthlyCost <= budget ? "On Budget" : projectedMonthlyCost <= budget * 1.1 ? "Warning" : "Over Budget";
|
|
653
|
-
const chartData = data?.trendData.map((point) => {
|
|
654
|
-
const date = new Date(point.time);
|
|
655
|
-
const timeLabel = data.granularity === "hour" ? date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }) : date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
656
|
-
return {
|
|
657
|
-
time: timeLabel,
|
|
658
|
-
"Total Cost": point.totalCostUsd
|
|
659
|
-
};
|
|
660
|
-
}) ?? [];
|
|
661
|
-
const handleExport = () => {
|
|
662
|
-
if (!data) return;
|
|
663
|
-
const csvContent = [
|
|
664
|
-
["Time", "Total Cost ($)", "Executions", "Avg Cost/Execution ($)"],
|
|
665
|
-
...data.trendData.map((d) => [
|
|
666
|
-
d.time,
|
|
667
|
-
d.totalCostUsd.toFixed(4),
|
|
668
|
-
d.executionCount,
|
|
669
|
-
d.avgCostPerExecution.toFixed(4)
|
|
670
|
-
])
|
|
671
|
-
].map((row) => row.join(",")).join("\n");
|
|
672
|
-
const blob = new Blob([csvContent], { type: "text/csv" });
|
|
673
|
-
const url = URL.createObjectURL(blob);
|
|
674
|
-
const link = document.createElement("a");
|
|
675
|
-
link.href = url;
|
|
676
|
-
link.download = `cost-trends-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
|
|
677
|
-
link.click();
|
|
678
|
-
URL.revokeObjectURL(url);
|
|
679
|
-
};
|
|
680
|
-
if (error) {
|
|
681
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load cost trends" }) });
|
|
682
|
-
}
|
|
683
|
-
if (isLoading) {
|
|
684
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
685
|
-
}
|
|
686
|
-
const granularityLabel = data?.granularity === "hour" ? "Hourly" : "Daily";
|
|
687
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
688
|
-
/* @__PURE__ */ jsx(
|
|
689
|
-
CardHeader,
|
|
690
|
-
{
|
|
691
|
-
icon: /* @__PURE__ */ jsx(IconChartLine, { size: 18 }),
|
|
692
|
-
title: `Cost Trend (${granularityLabel})`,
|
|
693
|
-
rightSection: /* @__PURE__ */ jsx(Button, { variant: "subtle", size: "xs", leftSection: /* @__PURE__ */ jsx(IconDownload, { size: 14 }), onClick: handleExport, children: "Export CSV" })
|
|
694
|
-
}
|
|
695
|
-
),
|
|
696
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", mb: "md", children: [
|
|
697
|
-
/* @__PURE__ */ jsxs(Group, { gap: "lg", children: [
|
|
698
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
699
|
-
/* @__PURE__ */ jsx(Text, { size: "xl", fw: 700, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: todayCost, decimalScale: 2 }) }),
|
|
700
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "period" }),
|
|
701
|
-
/* @__PURE__ */ jsx(TrendIndicator, { current: todayCost, previous: previousCost, inverse: true })
|
|
702
|
-
] }),
|
|
703
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, align: "baseline", children: [
|
|
704
|
-
/* @__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 }) }),
|
|
705
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "MTD" })
|
|
706
|
-
] })
|
|
707
|
-
] }),
|
|
708
|
-
/* @__PURE__ */ jsx(Badge, { size: "md", variant: "dot", color: budgetStatus, children: budgetLabel })
|
|
709
|
-
] }),
|
|
710
|
-
chartData.length > 0 ? /* @__PURE__ */ jsx(
|
|
711
|
-
CyberAreaChart,
|
|
712
|
-
{
|
|
713
|
-
data: chartData,
|
|
714
|
-
series: [{ dataKey: "Total Cost", color: "blue", name: "Total Cost" }],
|
|
715
|
-
height: 200,
|
|
716
|
-
yDomain: [0, (max) => Math.max(max * 1.1, 0.01)],
|
|
717
|
-
yTickFormatter: formatDollar,
|
|
718
|
-
tooltipFormatter: formatDollar,
|
|
719
|
-
baselineColor: "blue"
|
|
720
|
-
}
|
|
721
|
-
) : /* @__PURE__ */ jsx(EmptyState, { icon: IconChartLine, title: "No cost data available for this time period" }),
|
|
722
|
-
/* @__PURE__ */ jsx(Space, { h: "lg" }),
|
|
723
|
-
/* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
|
|
724
|
-
/* @__PURE__ */ jsxs(Group, { gap: 4, children: [
|
|
725
|
-
/* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
|
|
726
|
-
"Projected monthly:",
|
|
727
|
-
" ",
|
|
728
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
|
|
729
|
-
] }),
|
|
730
|
-
/* @__PURE__ */ jsx(Tooltip$1, { label: `Projection confidence: ${confidence}`, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 12, color: "var(--color-text-subtle)" }) })
|
|
731
|
-
] }),
|
|
732
|
-
/* @__PURE__ */ jsxs(
|
|
733
|
-
Text,
|
|
734
|
-
{
|
|
735
|
-
size: "xs",
|
|
736
|
-
fw: 600,
|
|
737
|
-
c: projectedMonthlyCost > budget ? "red" : "dimmed",
|
|
738
|
-
style: { fontFamily: "var(--mantine-font-family-headings)" },
|
|
739
|
-
children: [
|
|
740
|
-
"Budget: ",
|
|
741
|
-
/* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: budget, thousandSeparator: true, decimalScale: 2 })
|
|
742
|
-
]
|
|
743
|
-
}
|
|
744
|
-
)
|
|
745
|
-
] })
|
|
746
|
-
] });
|
|
747
|
-
}
|
|
748
|
-
var EM_DASH = "\u2014";
|
|
749
|
-
function getSuccessRateColor(rate) {
|
|
750
|
-
if (rate >= 95) return "var(--mantine-color-teal-6)";
|
|
751
|
-
if (rate >= 80) return "var(--mantine-color-yellow-6)";
|
|
752
|
-
return "var(--mantine-color-red-6)";
|
|
753
|
-
}
|
|
754
|
-
function getErrorCountColor(count) {
|
|
755
|
-
if (count === 0) return "var(--mantine-color-teal-6)";
|
|
756
|
-
if (count <= 5) return "var(--mantine-color-yellow-6)";
|
|
757
|
-
return "var(--mantine-color-red-6)";
|
|
758
|
-
}
|
|
759
|
-
function HeroStatsRow({
|
|
760
|
-
resourcesData,
|
|
761
|
-
resourcesLoading,
|
|
762
|
-
dashboardData,
|
|
763
|
-
dashboardLoading,
|
|
764
|
-
unresolvedErrorCount,
|
|
765
|
-
errorsLoading
|
|
766
|
-
}) {
|
|
767
|
-
const health = dashboardData?.executionHealth;
|
|
768
|
-
const resourceCount = resourcesData?.total ?? null;
|
|
769
|
-
const totalExecutions = health?.totalExecutions ?? null;
|
|
770
|
-
const successRate = totalExecutions ? health?.successRate ?? null : null;
|
|
771
|
-
return /* @__PURE__ */ jsxs(SimpleGrid, { cols: { base: 2, sm: 5 }, children: [
|
|
772
|
-
/* @__PURE__ */ jsx(
|
|
773
|
-
StatCard,
|
|
774
|
-
{
|
|
775
|
-
variant: "hero",
|
|
776
|
-
icon: IconApps,
|
|
777
|
-
value: resourceCount ?? EM_DASH,
|
|
778
|
-
label: "Resources",
|
|
779
|
-
isLoading: resourcesLoading
|
|
780
|
-
}
|
|
781
|
-
),
|
|
782
|
-
/* @__PURE__ */ jsx(
|
|
783
|
-
StatCard,
|
|
784
|
-
{
|
|
785
|
-
variant: "hero",
|
|
786
|
-
icon: IconPlayerPlay,
|
|
787
|
-
value: totalExecutions ?? EM_DASH,
|
|
788
|
-
label: "Executions",
|
|
789
|
-
isLoading: dashboardLoading
|
|
790
|
-
}
|
|
791
|
-
),
|
|
792
|
-
/* @__PURE__ */ jsx(
|
|
793
|
-
StatCard,
|
|
794
|
-
{
|
|
795
|
-
variant: "hero",
|
|
796
|
-
icon: IconChartBar,
|
|
797
|
-
value: successRate != null ? `${Math.round(successRate)}%` : EM_DASH,
|
|
798
|
-
label: "Success Rate",
|
|
799
|
-
valueColor: successRate != null ? getSuccessRateColor(successRate) : void 0,
|
|
800
|
-
isLoading: dashboardLoading
|
|
801
|
-
}
|
|
802
|
-
),
|
|
803
|
-
/* @__PURE__ */ jsx(
|
|
804
|
-
StatCard,
|
|
805
|
-
{
|
|
806
|
-
variant: "hero",
|
|
807
|
-
icon: IconAlertTriangle,
|
|
808
|
-
value: errorsLoading ? EM_DASH : unresolvedErrorCount ?? EM_DASH,
|
|
809
|
-
label: "Errors",
|
|
810
|
-
valueColor: unresolvedErrorCount != null ? getErrorCountColor(unresolvedErrorCount) : void 0
|
|
811
|
-
}
|
|
812
|
-
),
|
|
813
|
-
/* @__PURE__ */ jsx(
|
|
814
|
-
StatCard,
|
|
815
|
-
{
|
|
816
|
-
variant: "hero",
|
|
817
|
-
icon: IconRocket,
|
|
818
|
-
value: dashboardData?.activeDeploymentVersion ?? EM_DASH,
|
|
819
|
-
label: "Deployment",
|
|
820
|
-
isLoading: dashboardLoading
|
|
821
|
-
}
|
|
822
|
-
)
|
|
823
|
-
] });
|
|
824
|
-
}
|
|
825
|
-
function getGranularityFromTimeRange(timeRange) {
|
|
826
|
-
return ["1h", "24h"].includes(timeRange) ? "hour" : "day";
|
|
827
|
-
}
|
|
828
|
-
function formatPeakPeriod(peakPeriod, granularity) {
|
|
829
|
-
if (!peakPeriod) return "N/A";
|
|
830
|
-
const date = new Date(peakPeriod);
|
|
831
|
-
if (granularity === "hour") {
|
|
832
|
-
return date.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit", hour12: true });
|
|
833
|
-
} else {
|
|
834
|
-
return date.toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" });
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
function CombinedTrendChart({
|
|
838
|
-
healthData,
|
|
839
|
-
errorData: _errorData,
|
|
840
|
-
isLoading,
|
|
841
|
-
error,
|
|
842
|
-
timeRange,
|
|
843
|
-
navigationAction,
|
|
844
|
-
compact = false
|
|
845
|
-
}) {
|
|
846
|
-
const [activeTab, setActiveTab] = useState("success");
|
|
847
|
-
const colors = useCyberColors();
|
|
848
|
-
const { startDate: start, endDate: end } = useMemo(() => getTimeRangeDates(timeRange), [timeRange]);
|
|
849
|
-
const granularity = getGranularityFromTimeRange(timeRange);
|
|
850
|
-
const { data: errorTrends } = useErrorTrends({
|
|
851
|
-
startDate: start,
|
|
852
|
-
endDate: end,
|
|
853
|
-
granularity
|
|
854
|
-
});
|
|
855
|
-
const xTickFormatter = useCallback((value) => formatBucketTime(value, granularity), [granularity]);
|
|
856
|
-
if (error) {
|
|
857
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(CenteredErrorState, { error, title: "Failed to load trend data" }) });
|
|
858
|
-
}
|
|
859
|
-
if (isLoading) {
|
|
860
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { p: "xl", children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
861
|
-
}
|
|
862
|
-
const errorTrendsMap = new Map(errorTrends?.map((trend) => [trend.time, trend.errorCount]) || []);
|
|
863
|
-
const successErrorData = healthData?.trendData.length ? healthData.trendData.map((d) => {
|
|
864
|
-
const errorCount = errorTrendsMap.get(d.time) || 0;
|
|
865
|
-
return {
|
|
866
|
-
time: d.time,
|
|
867
|
-
"Success Count": d.successCount,
|
|
868
|
-
"Error Count": errorCount
|
|
869
|
-
};
|
|
870
|
-
}) : [];
|
|
871
|
-
const throughputData = healthData?.trendData.length ? healthData.trendData.map((d) => ({
|
|
872
|
-
time: d.time,
|
|
873
|
-
Executions: d.executionCount
|
|
874
|
-
})) : [];
|
|
875
|
-
const totalExecutions = healthData?.totalExecutions ?? 0;
|
|
876
|
-
const peakPeriod = healthData?.peakPeriod ?? "";
|
|
877
|
-
const dataGranularity = healthData?.granularity ?? granularity;
|
|
878
|
-
if (!successErrorData.length) {
|
|
879
|
-
return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { h: 300, children: /* @__PURE__ */ jsx(Alert, { icon: /* @__PURE__ */ jsx(IconAlertCircle, {}), color: "gray", variant: "light", children: "No trend data available for the selected time range" }) }) });
|
|
880
|
-
}
|
|
881
|
-
return /* @__PURE__ */ jsxs(Paper, { withBorder: true, children: [
|
|
882
|
-
/* @__PURE__ */ jsx(
|
|
883
|
-
CardHeader,
|
|
884
|
-
{
|
|
885
|
-
icon: /* @__PURE__ */ jsx(IconChartLine, { size: 18 }),
|
|
886
|
-
title: "Execution Trends",
|
|
887
|
-
subtitle: `${getTimeRangeLabel(timeRange)} - ${dataGranularity === "hour" ? "Hourly" : "Daily"} data`,
|
|
888
|
-
rightSection: /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
|
|
889
|
-
/* @__PURE__ */ jsx(
|
|
890
|
-
SegmentedControl,
|
|
891
|
-
{
|
|
892
|
-
value: activeTab ?? "success",
|
|
893
|
-
onChange: setActiveTab,
|
|
894
|
-
size: "xs",
|
|
895
|
-
data: [
|
|
896
|
-
{ label: "Success & Errors", value: "success" },
|
|
897
|
-
{ label: "Throughput", value: "throughput" }
|
|
898
|
-
]
|
|
899
|
-
}
|
|
900
|
-
),
|
|
901
|
-
navigationAction
|
|
902
|
-
] })
|
|
903
|
-
}
|
|
904
|
-
),
|
|
905
|
-
activeTab === "success" && /* @__PURE__ */ jsxs(Box, { style: { height: compact ? 180 : 280 }, children: [
|
|
906
|
-
/* @__PURE__ */ jsxs(Group, { gap: "lg", justify: "center", mb: "xs", h: 24, align: "center", children: [
|
|
907
|
-
/* @__PURE__ */ jsx(CyberLegendItem, { color: colors.green, label: "Success Count" }),
|
|
908
|
-
/* @__PURE__ */ jsx(CyberLegendItem, { color: colors.red, label: "Error Count" })
|
|
909
|
-
] }),
|
|
910
|
-
/* @__PURE__ */ jsx(
|
|
911
|
-
CyberAreaChart,
|
|
912
|
-
{
|
|
913
|
-
data: successErrorData,
|
|
914
|
-
series: [
|
|
915
|
-
{ dataKey: "Error Count", color: "red" },
|
|
916
|
-
{ dataKey: "Success Count", color: "green", animationDuration: 1400 }
|
|
917
|
-
],
|
|
918
|
-
height: compact ? 150 : 250,
|
|
919
|
-
yAxisLabel: "Count",
|
|
920
|
-
baselineColor: "green",
|
|
921
|
-
xTickFormatter
|
|
922
|
-
}
|
|
923
|
-
)
|
|
924
|
-
] }),
|
|
925
|
-
activeTab === "throughput" && /* @__PURE__ */ jsxs(Box, { style: { height: compact ? 180 : 280 }, children: [
|
|
926
|
-
/* @__PURE__ */ jsxs(Group, { gap: "lg", justify: "center", mb: "xs", h: 24, align: "center", children: [
|
|
927
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, children: [
|
|
928
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { color: colors.blue, fontVariantNumeric: "tabular-nums" }, children: totalExecutions.toLocaleString() }),
|
|
929
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "executions" })
|
|
930
|
-
] }),
|
|
931
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "|" }),
|
|
932
|
-
/* @__PURE__ */ jsxs(Group, { gap: 6, children: [
|
|
933
|
-
/* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "peak" }),
|
|
934
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { color: colors.blue, fontVariantNumeric: "tabular-nums" }, children: formatPeakPeriod(peakPeriod, dataGranularity) })
|
|
935
|
-
] }),
|
|
936
|
-
/* @__PURE__ */ jsx(Badge, { size: "xs", variant: "dot", color: "green", children: "Normal" })
|
|
937
|
-
] }),
|
|
938
|
-
/* @__PURE__ */ jsx(
|
|
939
|
-
CyberAreaChart,
|
|
940
|
-
{
|
|
941
|
-
data: throughputData,
|
|
942
|
-
series: [{ dataKey: "Executions", color: "blue" }],
|
|
943
|
-
height: compact ? 150 : 250,
|
|
944
|
-
xTickFormatter
|
|
945
|
-
}
|
|
946
|
-
)
|
|
947
|
-
] })
|
|
948
|
-
] });
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
export { ActivityTrendChart, ChartFrame, CombinedTrendChart, CostTrendChart, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, HeroStatsRow, getSeriesColor, useCyberColors };
|