@wso2/am-core-ui 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
  3. package/dist/CodeBlock-mB_Loq7I.js +21736 -0
  4. package/dist/EnvironmentCard-09h1XRxx.js +310 -0
  5. package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
  6. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  7. package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
  8. package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
  9. package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
  10. package/dist/clipboard-YAzStmkw.js +23 -0
  11. package/dist/debounce-BV83M53b.js +208 -0
  12. package/dist/format-BEZZRyE2.js +29 -0
  13. package/dist/formatDistanceToNow-TErllcH8.js +100 -0
  14. package/dist/gatewayScripts-D8O45W8u.js +72 -0
  15. package/dist/highlight-BsUzxSR3.js +454 -0
  16. package/dist/index-B52h3RHg.js +1290 -0
  17. package/dist/index-BP5drcF2.js +1265 -0
  18. package/dist/index-BZ4vxviI.js +7981 -0
  19. package/dist/index-B_Z0MwXk.js +25012 -0
  20. package/dist/index-BfjzUWDa.js +1397 -0
  21. package/dist/{index-CDm_burV.js → index-BnV-PkwM.js} +22 -20
  22. package/dist/index-CGDYgUCH.js +711 -0
  23. package/dist/index-COt7nJIf.js +2286 -0
  24. package/dist/index-CWZjOy1h.js +2247 -0
  25. package/dist/index-CezvogTQ.js +116 -0
  26. package/dist/index-CgCWbWzN.js +2342 -0
  27. package/dist/index-CjCkcuuI.js +322 -0
  28. package/dist/index-CjXvuf9m.js +1354 -0
  29. package/dist/index-DD4qF7gq.js +2340 -0
  30. package/dist/index-DeQ-9KTC.js +737 -0
  31. package/dist/index-Df6OBy4E.js +3041 -0
  32. package/dist/index-KRsV2L4V.js +1564 -0
  33. package/dist/index-PUuASE1F.js +2507 -0
  34. package/dist/index-PWsNvJB-.js +546 -0
  35. package/dist/index-UqDmyMSA.js +119 -0
  36. package/dist/index-_0Pj_ZtW.js +459 -0
  37. package/dist/{index-DJABKRWO.js → index-sr-mWz4T.js} +31 -30
  38. package/dist/index.d.ts +496 -200
  39. package/dist/index.js +462 -439
  40. package/dist/llmProviderPayload-CzihkdNa.js +332 -0
  41. package/dist/schemas-DFScWdSL.js +2969 -0
  42. package/package.json +1 -1
  43. package/dist/index-B0d-vovv.js +0 -236
  44. package/dist/index-CCmLfbLS.js +0 -80707
  45. package/dist/index-qanXZe0s.js +0 -3037
@@ -0,0 +1,322 @@
1
+ import { jsx as i, jsxs as w } from "react/jsx-runtime";
2
+ import { c as Q } from "react/compiler-runtime";
3
+ import { useParams as le, useSearchParams as me } from "react-router-dom";
4
+ import { N as V, h as ce, aS as ue, T as v, c as de, d as he, aU as fe, P as ge } from "./index-B_Z0MwXk.js";
5
+ import "@tanstack/react-query";
6
+ import "react";
7
+ import { useTheme as pe, Grid as F, Card as W, CardContent as Y, Skeleton as Z, Box as X, Stack as J, Typography as ee, Alert as ye, CardHeader as te, CircularProgress as ve, IconButton as be } from "@wso2/oxygen-ui";
8
+ import { LineChart as se, ChartTooltip as ae } from "@wso2/oxygen-ui-charts-react";
9
+ import { RefreshCcw as Re, PauseCircle as xe, BarChart3 as Se } from "@wso2/oxygen-ui-icons-react";
10
+ import { E as Te } from "./EnvironmentSelector-B7Bl93s2.js";
11
+ const $ = (e) => e / 1024 ** 3, ie = (e) => {
12
+ const t = /* @__PURE__ */ new Map();
13
+ return e.forEach(({
14
+ key: s,
15
+ points: n,
16
+ transform: o
17
+ }) => {
18
+ n?.forEach((a) => {
19
+ const l = t.get(a.time) ?? {
20
+ time: a.time,
21
+ label: ce(new Date(a.time), "MM/dd HH:mm")
22
+ };
23
+ t.set(a.time, {
24
+ ...l,
25
+ [s]: o ? o(a.value) : a.value
26
+ });
27
+ });
28
+ }), Array.from(t.values()).sort((s, n) => new Date(s.time).getTime() - new Date(n.time).getTime());
29
+ }, ne = (e) => {
30
+ const t = Q(7), {
31
+ active: s,
32
+ payload: n,
33
+ formatter: o
34
+ } = e;
35
+ if (!s || !n || n.length === 0)
36
+ return null;
37
+ let a;
38
+ if (t[0] !== o || t[1] !== n) {
39
+ let m;
40
+ t[3] !== o ? (m = (r) => /* @__PURE__ */ w(J, { direction: "row", alignItems: "center", gap: 1, children: [
41
+ /* @__PURE__ */ i(X, { sx: {
42
+ width: 8,
43
+ height: 8,
44
+ borderRadius: "50%",
45
+ bgcolor: r.color ?? "text.secondary"
46
+ } }),
47
+ /* @__PURE__ */ i(ee, { variant: "body2", color: "textSecondary", flex: 1, children: r.name ?? r.dataKey }),
48
+ /* @__PURE__ */ i(ee, { variant: "body2", fontWeight: 600, children: typeof r.value == "number" && o ? o(r.value) : r.value ?? "--" })
49
+ ] }, r.dataKey ?? r.name), t[3] = o, t[4] = m) : m = t[4], a = n.map(m), t[0] = o, t[1] = n, t[2] = a;
50
+ } else
51
+ a = t[2];
52
+ let l;
53
+ return t[5] !== a ? (l = /* @__PURE__ */ i(W, { variant: "outlined", children: /* @__PURE__ */ i(Y, { children: /* @__PURE__ */ i(J, { direction: "column", gap: 0.5, children: a }) }) }), t[5] = a, t[6] = l) : l = t[6], l;
54
+ }, Ne = (e) => {
55
+ const t = Q(27), {
56
+ metrics: s,
57
+ isLoading: n,
58
+ error: o
59
+ } = e, a = pe(), l = (s?.cpuUsage?.length ?? 0) > 0 || (s?.cpuRequests?.length ?? 0) > 0 || (s?.cpuLimits?.length ?? 0) > 0, m = (s?.memory?.length ?? 0) > 0 || (s?.memoryRequests?.length ?? 0) > 0 || (s?.memoryLimits?.length ?? 0) > 0;
60
+ if (o) {
61
+ const U = o instanceof Error ? o.message : "Failed to load metrics";
62
+ let y;
63
+ return t[0] !== U ? (y = /* @__PURE__ */ i(ye, { severity: "error", children: U }), t[0] = U, t[1] = y) : y = t[1], y;
64
+ }
65
+ let r;
66
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (r = {
67
+ xs: 12,
68
+ md: 6
69
+ }, t[2] = r) : r = t[2];
70
+ let c, b;
71
+ t[3] === Symbol.for("react.memo_cache_sentinel") ? (c = {
72
+ height: "100%"
73
+ }, b = /* @__PURE__ */ i(te, { title: "CPU Usage" }), t[3] = c, t[4] = b) : (c = t[3], b = t[4]);
74
+ let h;
75
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (h = {
76
+ display: "flex",
77
+ flexDirection: "column",
78
+ height: "100%",
79
+ "& svg:focus, & svg:focus-visible, & [tabindex]:focus, & [tabindex]:focus-visible": {
80
+ outline: "none"
81
+ }
82
+ }, t[5] = h) : h = t[5];
83
+ let d;
84
+ t[6] !== l || t[7] !== n || t[8] !== s?.cpuLimits || t[9] !== s?.cpuRequests || t[10] !== s?.cpuUsage || t[11] !== a ? (d = /* @__PURE__ */ i(F, { size: r, children: /* @__PURE__ */ w(W, { variant: "outlined", sx: c, children: [
85
+ b,
86
+ /* @__PURE__ */ i(Y, { sx: h, children: n ? /* @__PURE__ */ i(Z, { variant: "rounded", height: 260, width: "100%" }) : l ? /* @__PURE__ */ i(se, { data: ie([{
87
+ key: "cpuUsage",
88
+ points: s?.cpuUsage
89
+ }, {
90
+ key: "cpuRequests",
91
+ points: s?.cpuRequests
92
+ }, {
93
+ key: "cpuLimits",
94
+ points: s?.cpuLimits
95
+ }]), xAxisDataKey: "label", tooltip: {
96
+ show: !1
97
+ }, xAxis: {
98
+ show: !0,
99
+ interval: "preserveStartEnd"
100
+ }, yAxis: {
101
+ show: !0,
102
+ name: "Cores"
103
+ }, syncId: "metricsSync", lines: [{
104
+ dataKey: "cpuUsage",
105
+ name: "Usage",
106
+ stroke: a.palette.info.main,
107
+ dot: !1,
108
+ connectNulls: !0,
109
+ unit: " cores"
110
+ }, {
111
+ dataKey: "cpuRequests",
112
+ name: "Requests",
113
+ stroke: a.palette.warning.main,
114
+ dot: !1,
115
+ connectNulls: !0,
116
+ unit: " cores"
117
+ }, {
118
+ dataKey: "cpuLimits",
119
+ name: "Limits",
120
+ stroke: a.palette.error.main,
121
+ dot: !1,
122
+ connectNulls: !0,
123
+ strokeDasharray: "0",
124
+ unit: " cores"
125
+ }], children: /* @__PURE__ */ i(ae, { content: /* @__PURE__ */ i(ne, { title: "CPU", formatter: _e }) }) }) : /* @__PURE__ */ i(X, { display: "flex", justifyContent: "center", alignItems: "center", height: 260, children: /* @__PURE__ */ i(V, { message: "No CPU metrics available", subtitle: "Try changing the time range", disableBackground: !0 }) }) })
126
+ ] }) }), t[6] = l, t[7] = n, t[8] = s?.cpuLimits, t[9] = s?.cpuRequests, t[10] = s?.cpuUsage, t[11] = a, t[12] = d) : d = t[12];
127
+ let f;
128
+ t[13] === Symbol.for("react.memo_cache_sentinel") ? (f = {
129
+ xs: 12,
130
+ md: 6
131
+ }, t[13] = f) : f = t[13];
132
+ let x, g;
133
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (x = {
134
+ height: "100%"
135
+ }, g = /* @__PURE__ */ i(te, { title: "Memory Usage" }), t[14] = x, t[15] = g) : (x = t[14], g = t[15]);
136
+ let R;
137
+ t[16] === Symbol.for("react.memo_cache_sentinel") ? (R = {
138
+ display: "flex",
139
+ flexDirection: "column",
140
+ height: "100%",
141
+ "& svg:focus, & svg:focus-visible, & [tabindex]:focus, & [tabindex]:focus-visible": {
142
+ outline: "none"
143
+ }
144
+ }, t[16] = R) : R = t[16];
145
+ let u;
146
+ t[17] !== m || t[18] !== n || t[19] !== s?.memory || t[20] !== s?.memoryLimits || t[21] !== s?.memoryRequests || t[22] !== a ? (u = /* @__PURE__ */ i(F, { size: f, children: /* @__PURE__ */ w(W, { variant: "outlined", sx: x, children: [
147
+ g,
148
+ /* @__PURE__ */ i(Y, { sx: R, children: n ? /* @__PURE__ */ i(Z, { variant: "rounded", height: 260, width: "100%" }) : m ? /* @__PURE__ */ i(se, { data: ie([{
149
+ key: "memoryUsage",
150
+ points: s?.memory,
151
+ transform: $
152
+ }, {
153
+ key: "memoryRequests",
154
+ points: s?.memoryRequests,
155
+ transform: $
156
+ }, {
157
+ key: "memoryLimits",
158
+ points: s?.memoryLimits,
159
+ transform: $
160
+ }]), xAxisDataKey: "label", xAxis: {
161
+ show: !0,
162
+ interval: "preserveStartEnd"
163
+ }, yAxis: {
164
+ show: !0,
165
+ name: "GiB"
166
+ }, tooltip: {
167
+ show: !1
168
+ }, syncId: "metricsSync", lines: [{
169
+ dataKey: "memoryUsage",
170
+ name: "Usage",
171
+ stroke: a.palette.info.main,
172
+ dot: !1,
173
+ connectNulls: !0,
174
+ unit: " GB"
175
+ }, {
176
+ dataKey: "memoryRequests",
177
+ name: "Requests",
178
+ stroke: a.palette.warning.main,
179
+ dot: !1,
180
+ connectNulls: !0,
181
+ unit: " GB"
182
+ }, {
183
+ dataKey: "memoryLimits",
184
+ name: "Limits",
185
+ stroke: a.palette.error.main,
186
+ dot: !1,
187
+ connectNulls: !0,
188
+ strokeDasharray: "0",
189
+ unit: " GB"
190
+ }], children: /* @__PURE__ */ i(ae, { content: /* @__PURE__ */ i(ne, { title: "Memory", formatter: Ce }) }) }) : /* @__PURE__ */ i(X, { display: "flex", justifyContent: "center", alignItems: "center", height: 260, children: /* @__PURE__ */ i(V, { message: "No memory metrics available", subtitle: "Try changing the time range", disableBackground: !0 }) }) })
191
+ ] }) }), t[17] = m, t[18] = n, t[19] = s?.memory, t[20] = s?.memoryLimits, t[21] = s?.memoryRequests, t[22] = a, t[23] = u) : u = t[23];
192
+ let p;
193
+ return t[24] !== u || t[25] !== d ? (p = /* @__PURE__ */ w(F, { container: !0, spacing: 3, children: [
194
+ d,
195
+ u
196
+ ] }), t[24] = u, t[25] = d, t[26] = p) : p = t[26], p;
197
+ };
198
+ function _e(e) {
199
+ return `${e.toFixed(3)} cores`;
200
+ }
201
+ function Ce(e) {
202
+ return `${e.toFixed(2)} GB`;
203
+ }
204
+ const Ee = [{
205
+ value: v.TEN_MINUTES,
206
+ label: "10 Minutes"
207
+ }, {
208
+ value: v.THIRTY_MINUTES,
209
+ label: "30 Minutes"
210
+ }, {
211
+ value: v.ONE_HOUR,
212
+ label: "1 Hour"
213
+ }, {
214
+ value: v.SIX_HOURS,
215
+ label: "6 Hours"
216
+ }, {
217
+ value: v.TWELVE_HOURS,
218
+ label: "12 Hours"
219
+ }, {
220
+ value: v.ONE_DAY,
221
+ label: "1 Day"
222
+ }, {
223
+ value: v.SEVEN_DAYS,
224
+ label: "7 Days"
225
+ }], re = () => {
226
+ const e = Q(51), {
227
+ agentId: t,
228
+ orgId: s,
229
+ projectId: n,
230
+ envId: o
231
+ } = le(), [a, l] = me(), {
232
+ customStartTime: m,
233
+ customEndTime: r,
234
+ hasCustomRange: c,
235
+ handleCustomRangeApply: b
236
+ } = ue(a, l);
237
+ let h;
238
+ e[0] !== c || e[1] !== a ? (h = c ? void 0 : Object.values(v).includes(a.get("timeRange") ?? "") ? a.get("timeRange") : v.ONE_HOUR, e[0] = c, e[1] = a, e[2] = h) : h = e[2];
239
+ const d = h;
240
+ let f;
241
+ e[3] !== t || e[4] !== s || e[5] !== n ? (f = {
242
+ orgName: s,
243
+ projName: n,
244
+ agentName: t
245
+ }, e[3] = t, e[4] = s, e[5] = n, e[6] = f) : f = e[6];
246
+ const {
247
+ data: x
248
+ } = de(f), g = x === void 0 ? void 0 : x[o ?? ""]?.status === "suspended", R = o ?? "";
249
+ let u;
250
+ e[7] !== r || e[8] !== m || e[9] !== c ? (u = c ? {
251
+ startTime: m,
252
+ endTime: r
253
+ } : {}, e[7] = r, e[8] = m, e[9] = c, e[10] = u) : u = e[10];
254
+ let p;
255
+ e[11] !== R || e[12] !== u ? (p = {
256
+ environmentName: R,
257
+ ...u
258
+ }, e[11] = R, e[12] = u, e[13] = p) : p = e[13];
259
+ const U = p;
260
+ let y;
261
+ e[14] !== t || e[15] !== s || e[16] !== n ? (y = {
262
+ agentName: t,
263
+ orgName: s,
264
+ projName: n
265
+ }, e[14] = t, e[15] = s, e[16] = n, e[17] = y) : y = e[17];
266
+ const q = g === !1 && !!t && !!s && !!n && !!o && (c || !!d), P = !c, H = c ? void 0 : d;
267
+ let L;
268
+ e[18] !== q || e[19] !== P || e[20] !== H ? (L = {
269
+ enabled: q,
270
+ enableAutoRefresh: P,
271
+ timeRange: H
272
+ }, e[18] = q, e[19] = P, e[20] = H, e[21] = L) : L = e[21];
273
+ const {
274
+ data: B,
275
+ error: K,
276
+ isLoading: O,
277
+ isRefetching: S,
278
+ refetch: G
279
+ } = he(y, U, L);
280
+ let k;
281
+ e[22] !== G ? (k = () => {
282
+ G();
283
+ }, e[22] = G, e[23] = k) : k = e[23];
284
+ const j = k;
285
+ let D;
286
+ e[24] !== a || e[25] !== l ? (D = (oe) => {
287
+ const A = new URLSearchParams(a);
288
+ A.set("timeRange", oe), A.delete("startTime"), A.delete("endTime"), l(A);
289
+ }, e[24] = a, e[25] = l, e[26] = D) : D = e[26];
290
+ const z = D;
291
+ let M;
292
+ e[27] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ i(Te, {}), e[27] = M) : M = e[27];
293
+ let T;
294
+ e[28] !== r || e[29] !== m || e[30] !== b || e[31] !== z || e[32] !== d ? (T = /* @__PURE__ */ i(fe, { preset: d, customStart: m, customEnd: r, options: Ee, onPresetChange: z, onCustomRangeApply: b }), e[28] = r, e[29] = m, e[30] = b, e[31] = z, e[32] = d, e[33] = T) : T = e[33];
295
+ let N;
296
+ e[34] !== S ? (N = S ? /* @__PURE__ */ i(ve, { size: 16 }) : /* @__PURE__ */ i(Re, { size: 16 }), e[34] = S, e[35] = N) : N = e[35];
297
+ let _;
298
+ e[36] !== j || e[37] !== S || e[38] !== N ? (_ = /* @__PURE__ */ i(be, { size: "small", disabled: S, onClick: j, "aria-label": "Refresh", children: N }), e[36] = j, e[37] = S, e[38] = N, e[39] = _) : _ = e[39];
299
+ let C;
300
+ e[40] !== T || e[41] !== _ ? (C = /* @__PURE__ */ w(J, { direction: "row", spacing: 2, alignItems: "center", flexWrap: "wrap", children: [
301
+ M,
302
+ T,
303
+ _
304
+ ] }), e[40] = T, e[41] = _, e[42] = C) : C = e[42];
305
+ let E;
306
+ e[43] !== K || e[44] !== O || e[45] !== g || e[46] !== B ? (E = g ? /* @__PURE__ */ i(V, { iconElement: xe, message: "Environment Suspended", subtitle: "Metrics are unavailable while the environment is suspended." }) : /* @__PURE__ */ i(Ne, { metrics: B, isLoading: O, error: K }), e[43] = K, e[44] = O, e[45] = g, e[46] = B, e[47] = E) : E = e[47];
307
+ let I;
308
+ return e[48] !== C || e[49] !== E ? (I = /* @__PURE__ */ i(ge, { title: "System Metrics", disableIcon: !0, actions: C, children: E }), e[48] = C, e[49] = E, e[50] = I) : I = e[50], I;
309
+ }, He = {
310
+ title: "System Metrics",
311
+ description: "A page component for System Metrics",
312
+ icon: Se,
313
+ path: "/metrics",
314
+ component: re,
315
+ levels: {
316
+ component: re
317
+ }
318
+ };
319
+ export {
320
+ re as MetricsComponent,
321
+ He as metaData
322
+ };