@wso2/am-core-ui 0.0.19 → 0.0.20

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 (51) hide show
  1. package/dist/CatalogKindListing-DvUuZEpc.js +137 -0
  2. package/dist/{CodeBlock-mB_Loq7I.js → CodeBlock-B2Ecl916.js} +1 -1
  3. package/dist/EnvironmentCard-CIXhDhlZ.js +319 -0
  4. package/dist/{EnvironmentSelector-B7Bl93s2.js → EnvironmentSelector-D8S6nO9u.js} +1 -1
  5. package/dist/IsolationTierIndicator-cf90kgjL.js +81 -0
  6. package/dist/LabelChips-7rA7_yre.js +139 -0
  7. package/dist/PolicyListSection-D6aVSKwP.js +1143 -0
  8. package/dist/{ResourceListShell-Cx6mdeqv.js → ResourceListShell-DFisKftq.js} +1 -1
  9. package/dist/{SwaggerSpecViewer-BvkhoKsi.js → SwaggerSpecViewer-DzjR6U6W.js} +1 -1
  10. package/dist/{debounce-BV83M53b.js → debounce-D17ObVdG.js} +1 -1
  11. package/dist/{format-BEZZRyE2.js → format-wlHhWjGo.js} +1 -1
  12. package/dist/{formatDistanceToNow-TErllcH8.js → formatDistanceToNow-DyjnT7l9.js} +11 -11
  13. package/dist/{gatewayScripts-D8O45W8u.js → gatewayScripts-D4ZDEDPS.js} +1 -1
  14. package/dist/{index-sr-mWz4T.js → index-3K-zqdp-.js} +32 -32
  15. package/dist/{index-KRsV2L4V.js → index-6liAPSDn.js} +160 -160
  16. package/dist/{index-B52h3RHg.js → index-B3ASENUJ.js} +109 -109
  17. package/dist/index-B7Pf4oPq.js +3069 -0
  18. package/dist/index-BNO3FhZK.js +2304 -0
  19. package/dist/index-BUZSfCl5.js +335 -0
  20. package/dist/index-BXiG1r_o.js +1409 -0
  21. package/dist/{index-_0Pj_ZtW.js → index-BYy7Iaam.js} +40 -40
  22. package/dist/{index-BfjzUWDa.js → index-BbB_yx4V.js} +103 -103
  23. package/dist/index-BjWJ95lH.js +2728 -0
  24. package/dist/{index-B_Z0MwXk.js → index-ByEInFlf.js} +10916 -9520
  25. package/dist/index-C8WIhzyz.js +123 -0
  26. package/dist/index-CnzvaT6b.js +2368 -0
  27. package/dist/index-CrnCf-hJ.js +763 -0
  28. package/dist/{index-CgCWbWzN.js → index-Cvsho9xg.js} +381 -377
  29. package/dist/{index-UqDmyMSA.js → index-CxnAo1_c.js} +21 -21
  30. package/dist/{index-BnV-PkwM.js → index-Cz7-AZwE.js} +2 -2
  31. package/dist/{index-BP5drcF2.js → index-DBdRFjxm.js} +232 -233
  32. package/dist/{index-BZ4vxviI.js → index-DFsSvmMZ.js} +5 -5
  33. package/dist/index-DslzOSGN.js +2549 -0
  34. package/dist/{index-DD4qF7gq.js → index-DvpYvchM.js} +101 -100
  35. package/dist/index.d.ts +784 -163
  36. package/dist/index.js +532 -454
  37. package/dist/js-yaml-CvhD-clg.js +1335 -0
  38. package/dist/{llmProviderPayload-CzihkdNa.js → llmProviderPayload-BPzWDy7n.js} +2 -2
  39. package/package.json +1 -1
  40. package/dist/CatalogKindListing-DtFI2YMG.js +0 -118
  41. package/dist/EnvironmentCard-09h1XRxx.js +0 -310
  42. package/dist/PolicyListSection-o4k9e8XO.js +0 -2475
  43. package/dist/index-CGDYgUCH.js +0 -711
  44. package/dist/index-COt7nJIf.js +0 -2286
  45. package/dist/index-CWZjOy1h.js +0 -2247
  46. package/dist/index-CezvogTQ.js +0 -116
  47. package/dist/index-CjCkcuuI.js +0 -322
  48. package/dist/index-CjXvuf9m.js +0 -1354
  49. package/dist/index-DeQ-9KTC.js +0 -737
  50. package/dist/index-Df6OBy4E.js +0 -3041
  51. package/dist/index-PUuASE1F.js +0 -2507
@@ -0,0 +1,335 @@
1
+ import { jsx as i, jsxs as w } from "react/jsx-runtime";
2
+ import { c as ee } from "react/compiler-runtime";
3
+ import { useParams as ue, useSearchParams as de } from "react-router-dom";
4
+ import { N as Y, h as he, aX as fe, T as b, c as ge, d as pe, P as te, a_ as ye, aZ as ve } from "./index-ByEInFlf.js";
5
+ import "@tanstack/react-query";
6
+ import "react";
7
+ import { useTheme as be, Grid as V, Card as X, CardContent as Z, Skeleton as se, Box as J, Stack as Q, Typography as ie, Alert as ce, CardHeader as ae, CircularProgress as Re, IconButton as xe } from "@wso2/oxygen-ui";
8
+ import { LineChart as re, ChartTooltip as ne } from "@wso2/oxygen-ui-charts-react";
9
+ import { RefreshCcw as Se, PauseCircle as _e, BarChart3 as Te } from "@wso2/oxygen-ui-icons-react";
10
+ import { E as Ce } from "./EnvironmentSelector-D8S6nO9u.js";
11
+ const W = (e) => e / 1024 ** 3, oe = (e) => {
12
+ const t = /* @__PURE__ */ new Map();
13
+ return e.forEach(({
14
+ key: s,
15
+ points: r,
16
+ transform: o
17
+ }) => {
18
+ r?.forEach((a) => {
19
+ const l = t.get(a.time) ?? {
20
+ time: a.time,
21
+ label: he(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, r) => new Date(s.time).getTime() - new Date(r.time).getTime());
29
+ }, le = (e) => {
30
+ const t = ee(7), {
31
+ active: s,
32
+ payload: r,
33
+ formatter: o
34
+ } = e;
35
+ if (!s || !r || r.length === 0)
36
+ return null;
37
+ let a;
38
+ if (t[0] !== o || t[1] !== r) {
39
+ let m;
40
+ t[3] !== o ? (m = (n) => /* @__PURE__ */ w(Q, { direction: "row", alignItems: "center", gap: 1, children: [
41
+ /* @__PURE__ */ i(J, { sx: {
42
+ width: 8,
43
+ height: 8,
44
+ borderRadius: "50%",
45
+ bgcolor: n.color ?? "text.secondary"
46
+ } }),
47
+ /* @__PURE__ */ i(ie, { variant: "body2", color: "textSecondary", flex: 1, children: n.name ?? n.dataKey }),
48
+ /* @__PURE__ */ i(ie, { variant: "body2", fontWeight: 600, children: typeof n.value == "number" && o ? o(n.value) : n.value ?? "--" })
49
+ ] }, n.dataKey ?? n.name), t[3] = o, t[4] = m) : m = t[4], a = r.map(m), t[0] = o, t[1] = r, t[2] = a;
50
+ } else
51
+ a = t[2];
52
+ let l;
53
+ return t[5] !== a ? (l = /* @__PURE__ */ i(X, { variant: "outlined", children: /* @__PURE__ */ i(Z, { children: /* @__PURE__ */ i(Q, { direction: "column", gap: 0.5, children: a }) }) }), t[5] = a, t[6] = l) : l = t[6], l;
54
+ }, Ne = (e) => {
55
+ const t = ee(27), {
56
+ metrics: s,
57
+ isLoading: r,
58
+ error: o
59
+ } = e, a = be(), 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 M = o instanceof Error ? o.message : "Failed to load metrics";
62
+ let y;
63
+ return t[0] !== M ? (y = /* @__PURE__ */ i(ce, { severity: "error", children: M }), t[0] = M, t[1] = y) : y = t[1], y;
64
+ }
65
+ let n;
66
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (n = {
67
+ xs: 12,
68
+ md: 6
69
+ }, t[2] = n) : n = t[2];
70
+ let c, R;
71
+ t[3] === Symbol.for("react.memo_cache_sentinel") ? (c = {
72
+ height: "100%"
73
+ }, R = /* @__PURE__ */ i(ae, { title: "CPU Usage" }), t[3] = c, t[4] = R) : (c = t[3], R = 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] !== r || t[8] !== s?.cpuLimits || t[9] !== s?.cpuRequests || t[10] !== s?.cpuUsage || t[11] !== a ? (d = /* @__PURE__ */ i(V, { size: n, children: /* @__PURE__ */ w(X, { variant: "outlined", sx: c, children: [
85
+ R,
86
+ /* @__PURE__ */ i(Z, { sx: h, children: r ? /* @__PURE__ */ i(se, { variant: "rounded", height: 260, width: "100%" }) : l ? /* @__PURE__ */ i(re, { data: oe([{
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(ne, { content: /* @__PURE__ */ i(le, { title: "CPU", formatter: Ee }) }) }) : /* @__PURE__ */ i(J, { display: "flex", justifyContent: "center", alignItems: "center", height: 260, children: /* @__PURE__ */ i(Y, { message: "No CPU metrics available", subtitle: "Try changing the time range", disableBackground: !0 }) }) })
126
+ ] }) }), t[6] = l, t[7] = r, 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 S, g;
133
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (S = {
134
+ height: "100%"
135
+ }, g = /* @__PURE__ */ i(ae, { title: "Memory Usage" }), t[14] = S, t[15] = g) : (S = t[14], g = t[15]);
136
+ let x;
137
+ t[16] === Symbol.for("react.memo_cache_sentinel") ? (x = {
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] = x) : x = t[16];
145
+ let u;
146
+ t[17] !== m || t[18] !== r || t[19] !== s?.memory || t[20] !== s?.memoryLimits || t[21] !== s?.memoryRequests || t[22] !== a ? (u = /* @__PURE__ */ i(V, { size: f, children: /* @__PURE__ */ w(X, { variant: "outlined", sx: S, children: [
147
+ g,
148
+ /* @__PURE__ */ i(Z, { sx: x, children: r ? /* @__PURE__ */ i(se, { variant: "rounded", height: 260, width: "100%" }) : m ? /* @__PURE__ */ i(re, { data: oe([{
149
+ key: "memoryUsage",
150
+ points: s?.memory,
151
+ transform: W
152
+ }, {
153
+ key: "memoryRequests",
154
+ points: s?.memoryRequests,
155
+ transform: W
156
+ }, {
157
+ key: "memoryLimits",
158
+ points: s?.memoryLimits,
159
+ transform: W
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(ne, { content: /* @__PURE__ */ i(le, { title: "Memory", formatter: Le }) }) }) : /* @__PURE__ */ i(J, { display: "flex", justifyContent: "center", alignItems: "center", height: 260, children: /* @__PURE__ */ i(Y, { message: "No memory metrics available", subtitle: "Try changing the time range", disableBackground: !0 }) }) })
191
+ ] }) }), t[17] = m, t[18] = r, 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(V, { 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 Ee(e) {
199
+ return `${e.toFixed(3)} cores`;
200
+ }
201
+ function Le(e) {
202
+ return `${e.toFixed(2)} GB`;
203
+ }
204
+ const Ue = [{
205
+ value: b.TEN_MINUTES,
206
+ label: "10 Minutes"
207
+ }, {
208
+ value: b.THIRTY_MINUTES,
209
+ label: "30 Minutes"
210
+ }, {
211
+ value: b.ONE_HOUR,
212
+ label: "1 Hour"
213
+ }, {
214
+ value: b.SIX_HOURS,
215
+ label: "6 Hours"
216
+ }, {
217
+ value: b.TWELVE_HOURS,
218
+ label: "12 Hours"
219
+ }, {
220
+ value: b.ONE_DAY,
221
+ label: "1 Day"
222
+ }, {
223
+ value: b.SEVEN_DAYS,
224
+ label: "7 Days"
225
+ }], me = () => {
226
+ const e = ee(54), {
227
+ agentId: t,
228
+ orgId: s,
229
+ projectId: r,
230
+ envId: o
231
+ } = ue(), [a, l] = de(), {
232
+ customStartTime: m,
233
+ customEndTime: n,
234
+ hasCustomRange: c,
235
+ handleCustomRangeApply: R
236
+ } = fe(a, l);
237
+ let h;
238
+ e[0] !== c || e[1] !== a ? (h = c ? void 0 : Object.values(b).includes(a.get("timeRange") ?? "") ? a.get("timeRange") : b.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] !== r ? (f = {
242
+ orgName: s,
243
+ projName: r,
244
+ agentName: t
245
+ }, e[3] = t, e[4] = s, e[5] = r, e[6] = f) : f = e[6];
246
+ const {
247
+ data: S
248
+ } = ge(f), g = S === void 0 ? void 0 : S[o ?? ""]?.status === "suspended", x = o ?? "";
249
+ let u;
250
+ e[7] !== n || e[8] !== m || e[9] !== c ? (u = c ? {
251
+ startTime: m,
252
+ endTime: n
253
+ } : {}, e[7] = n, e[8] = m, e[9] = c, e[10] = u) : u = e[10];
254
+ let p;
255
+ e[11] !== x || e[12] !== u ? (p = {
256
+ environmentName: x,
257
+ ...u
258
+ }, e[11] = x, e[12] = u, e[13] = p) : p = e[13];
259
+ const M = p;
260
+ let y;
261
+ e[14] !== t || e[15] !== s || e[16] !== r ? (y = {
262
+ agentName: t,
263
+ orgName: s,
264
+ projName: r
265
+ }, e[14] = t, e[15] = s, e[16] = r, e[17] = y) : y = e[17];
266
+ const O = g === !1 && !!t && !!s && !!r && !!o && (c || !!d), B = !c, H = c ? void 0 : d;
267
+ let k;
268
+ e[18] !== O || e[19] !== B || e[20] !== H ? (k = {
269
+ enabled: O,
270
+ enableAutoRefresh: B,
271
+ timeRange: H
272
+ }, e[18] = O, e[19] = B, e[20] = H, e[21] = k) : k = e[21];
273
+ const {
274
+ data: K,
275
+ error: G,
276
+ isLoading: j,
277
+ isRefetching: _,
278
+ refetch: z
279
+ } = pe(y, M, k);
280
+ let I;
281
+ e[22] !== z ? (I = () => {
282
+ z();
283
+ }, e[22] = z, e[23] = I) : I = e[23];
284
+ const F = I;
285
+ let A;
286
+ e[24] !== a || e[25] !== l ? (A = (U) => {
287
+ const v = new URLSearchParams(a);
288
+ v.set("timeRange", U), v.delete("startTime"), v.delete("endTime"), l(v);
289
+ }, e[24] = a, e[25] = l, e[26] = A) : A = e[26];
290
+ const $ = A;
291
+ if (!ye()) {
292
+ let U, v;
293
+ e[27] === Symbol.for("react.memo_cache_sentinel") ? (U = {
294
+ mt: 2
295
+ }, v = /* @__PURE__ */ i("strong", { children: "Observer not configured." }), e[27] = U, e[28] = v) : (U = e[27], v = e[28]);
296
+ let q;
297
+ return e[29] === Symbol.for("react.memo_cache_sentinel") ? (q = /* @__PURE__ */ i(te, { title: "System Metrics", disableIcon: !0, children: /* @__PURE__ */ w(ce, { severity: "error", sx: U, children: [
298
+ v,
299
+ " Ask your platform administrator to set ",
300
+ /* @__PURE__ */ i("code", { children: "AM_OBSERVER_PUBLIC_URL" }),
301
+ " on the agent-manager service."
302
+ ] }) }), e[29] = q) : q = e[29], q;
303
+ }
304
+ let D;
305
+ e[30] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ i(Ce, {}), e[30] = D) : D = e[30];
306
+ let T;
307
+ e[31] !== n || e[32] !== m || e[33] !== R || e[34] !== $ || e[35] !== d ? (T = /* @__PURE__ */ i(ve, { preset: d, customStart: m, customEnd: n, options: Ue, onPresetChange: $, onCustomRangeApply: R }), e[31] = n, e[32] = m, e[33] = R, e[34] = $, e[35] = d, e[36] = T) : T = e[36];
308
+ let C;
309
+ e[37] !== _ ? (C = _ ? /* @__PURE__ */ i(Re, { size: 16 }) : /* @__PURE__ */ i(Se, { size: 16 }), e[37] = _, e[38] = C) : C = e[38];
310
+ let N;
311
+ e[39] !== F || e[40] !== _ || e[41] !== C ? (N = /* @__PURE__ */ i(xe, { size: "small", disabled: _, onClick: F, "aria-label": "Refresh", children: C }), e[39] = F, e[40] = _, e[41] = C, e[42] = N) : N = e[42];
312
+ let E;
313
+ e[43] !== T || e[44] !== N ? (E = /* @__PURE__ */ w(Q, { direction: "row", spacing: 2, alignItems: "center", flexWrap: "wrap", children: [
314
+ D,
315
+ T,
316
+ N
317
+ ] }), e[43] = T, e[44] = N, e[45] = E) : E = e[45];
318
+ let L;
319
+ e[46] !== G || e[47] !== j || e[48] !== g || e[49] !== K ? (L = g ? /* @__PURE__ */ i(Y, { iconElement: _e, message: "Environment Suspended", subtitle: "Metrics are unavailable while the environment is suspended." }) : /* @__PURE__ */ i(Ne, { metrics: K, isLoading: j, error: G }), e[46] = G, e[47] = j, e[48] = g, e[49] = K, e[50] = L) : L = e[50];
320
+ let P;
321
+ return e[51] !== E || e[52] !== L ? (P = /* @__PURE__ */ i(te, { title: "System Metrics", disableIcon: !0, actions: E, children: L }), e[51] = E, e[52] = L, e[53] = P) : P = e[53], P;
322
+ }, He = {
323
+ title: "System Metrics",
324
+ description: "A page component for System Metrics",
325
+ icon: Te,
326
+ path: "/metrics",
327
+ component: me,
328
+ levels: {
329
+ component: me
330
+ }
331
+ };
332
+ export {
333
+ me as MetricsComponent,
334
+ He as metaData
335
+ };