@wso2/am-core-ui 0.0.13 → 0.0.15
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/{Layouts → core-ui/src/Layouts}/OxygenLayout/LeftNavigation.d.ts +1 -3
- package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/path-map.d.ts +0 -1
- package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/userMenuItems.d.ts +7 -2
- package/dist/{index.d.ts → core-ui/src/index.d.ts} +1 -0
- package/dist/{pages → core-ui/src/pages}/index.d.ts +12 -4
- package/dist/{types → core-ui/src/types}/mountPoints.d.ts +4 -1
- package/dist/index-B0d-vovv.js +236 -0
- package/dist/{index-B4OGjmhA.js → index-CCmLfbLS.js} +40468 -29940
- package/dist/{index-BhFccQ1l.js → index-CDm_burV.js} +21986 -20114
- package/dist/index-DJABKRWO.js +263 -0
- package/dist/index-qanXZe0s.js +3037 -0
- package/dist/index.js +427 -291
- package/package.json +1 -1
- package/dist/index-Cc-rP6G7.js +0 -2514
- package/dist/index-xHdqOiSN.js +0 -189
- /package/dist/{CoreUI.d.ts → core-ui/src/CoreUI.d.ts} +0 -0
- /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/OxygenLayout.d.ts +0 -0
- /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/TopNavigation.d.ts +0 -0
- /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/index.d.ts +0 -0
- /package/dist/{Layouts → core-ui/src/Layouts}/OxygenLayout/navigationItems.d.ts +0 -0
- /package/dist/{Layouts → core-ui/src/Layouts}/index.d.ts +0 -0
- /package/dist/{Providers → core-ui/src/Providers}/GlobalProviders/GlobalProviders.d.ts +0 -0
- /package/dist/{Providers → core-ui/src/Providers}/GlobalProviders/index.d.ts +0 -0
- /package/dist/{Providers → core-ui/src/Providers}/Protected/Protected.d.ts +0 -0
- /package/dist/{Providers → core-ui/src/Providers}/Protected/index.d.ts +0 -0
- /package/dist/{Providers → core-ui/src/Providers}/index.d.ts +0 -0
- /package/dist/{Route → core-ui/src/Route}/Route.d.ts +0 -0
- /package/dist/{Route → core-ui/src/Route}/index.d.ts +0 -0
- /package/dist/{components → core-ui/src/components}/LoadingFallback.d.ts +0 -0
- /package/dist/{pages → core-ui/src/pages}/Login/Login.d.ts +0 -0
- /package/dist/{pages → core-ui/src/pages}/Login/index.d.ts +0 -0
- /package/dist/{types → core-ui/src/types}/index.d.ts +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { jsx as i, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as V, useMemo as A, useEffect as z, useState as B } from "react";
|
|
3
|
+
import { Alert as G, Box as L, Collapse as D, Button as T, Form as b, TextField as F, Stack as M, CircularProgress as O, Typography as C, Select as H, MenuItem as k } from "@wso2/oxygen-ui";
|
|
4
|
+
import { useParams as $, useNavigate as J, generatePath as R } from "react-router-dom";
|
|
5
|
+
import { o as K, s as w, y as Q, M as U, j as X, A as Y, f as Z, N as _, O as ee, g as I, P as te } from "./index-CCmLfbLS.js";
|
|
6
|
+
import { c as W } from "react/compiler-runtime";
|
|
7
|
+
import "@tanstack/react-query";
|
|
8
|
+
import { Link as ne, PackagePlus as ie, FolderPlus as ae } from "@wso2/oxygen-ui-icons-react";
|
|
9
|
+
const re = K({
|
|
10
|
+
displayName: w().trim().min(1, "Display name is required").min(3, "Display name must be at least 3 characters").max(100, "Display name must be at most 100 characters"),
|
|
11
|
+
name: w().trim().max(50, "Name must be at most 50 characters"),
|
|
12
|
+
description: w().trim().optional(),
|
|
13
|
+
deploymentPipeline: w().trim().min(1, "Deployment pipeline is required")
|
|
14
|
+
}), oe = (a) => {
|
|
15
|
+
const e = W(22), {
|
|
16
|
+
lastSubmittedValidationErrors: t,
|
|
17
|
+
isPending: d,
|
|
18
|
+
onCancel: c,
|
|
19
|
+
onSubmit: s,
|
|
20
|
+
mode: l,
|
|
21
|
+
isNameEmpty: o
|
|
22
|
+
} = a, p = l === void 0 ? "deploy" : l, E = o === void 0 ? !1 : o, P = p === "connect";
|
|
23
|
+
let y;
|
|
24
|
+
e[0] !== t ? (y = Object.values(t), e[0] = t, e[1] = y) : y = e[1];
|
|
25
|
+
const u = y, v = u.length > 0;
|
|
26
|
+
let g;
|
|
27
|
+
e[2] !== u ? (g = /* @__PURE__ */ i(G, { severity: "error", children: u.map(le) }), e[2] = u, e[3] = g) : g = e[3];
|
|
28
|
+
let h;
|
|
29
|
+
e[4] !== v || e[5] !== g ? (h = /* @__PURE__ */ i(D, { in: v, timeout: "auto", unmountOnExit: !0, children: g }), e[4] = v, e[5] = g, e[6] = h) : h = e[6];
|
|
30
|
+
let n;
|
|
31
|
+
e[7] !== c ? (n = /* @__PURE__ */ i(T, { variant: "outlined", color: "primary", size: "medium", onClick: c, children: "Cancel" }), e[7] = c, e[8] = n) : n = e[8];
|
|
32
|
+
let r;
|
|
33
|
+
e[9] !== P ? (r = P ? /* @__PURE__ */ i(ne, { size: 16 }) : /* @__PURE__ */ i(ie, { size: 16 }), e[9] = P, e[10] = r) : r = e[10];
|
|
34
|
+
const m = d || E, f = P ? "Register" : "Create";
|
|
35
|
+
let j;
|
|
36
|
+
e[11] !== s || e[12] !== r || e[13] !== m || e[14] !== f ? (j = /* @__PURE__ */ i(T, { variant: "contained", color: "primary", size: "medium", startIcon: r, onClick: s, disabled: m, children: f }), e[11] = s, e[12] = r, e[13] = m, e[14] = f, e[15] = j) : j = e[15];
|
|
37
|
+
let x;
|
|
38
|
+
e[16] !== j || e[17] !== n ? (x = /* @__PURE__ */ N(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
39
|
+
n,
|
|
40
|
+
j
|
|
41
|
+
] }), e[16] = j, e[17] = n, e[18] = x) : x = e[18];
|
|
42
|
+
let S;
|
|
43
|
+
return e[19] !== x || e[20] !== h ? (S = /* @__PURE__ */ N(L, { display: "flex", flexDirection: "column", gap: 3, children: [
|
|
44
|
+
h,
|
|
45
|
+
x
|
|
46
|
+
] }), e[19] = x, e[20] = h, e[21] = S) : S = e[21], S;
|
|
47
|
+
};
|
|
48
|
+
function le(a, e) {
|
|
49
|
+
return /* @__PURE__ */ i(L, { children: a }, e);
|
|
50
|
+
}
|
|
51
|
+
function q(a, e) {
|
|
52
|
+
return a.promotionPaths.length === 0 ? null : [...a.promotionPaths.map((d) => d.sourceEnvironmentRef), a.promotionPaths[a.promotionPaths.length - 1]?.targetEnvironmentRefs[0]?.name].filter(Boolean).map((d) => e.get(d) ?? d).join(" → ");
|
|
53
|
+
}
|
|
54
|
+
function se(a) {
|
|
55
|
+
const e = W(10), {
|
|
56
|
+
pipeline: t,
|
|
57
|
+
envDisplayNameMap: d
|
|
58
|
+
} = a;
|
|
59
|
+
let c;
|
|
60
|
+
e[0] !== d || e[1] !== t ? (c = q(t, d), e[0] = d, e[1] = t, e[2] = c) : c = e[2];
|
|
61
|
+
const s = c;
|
|
62
|
+
let l;
|
|
63
|
+
e[3] !== t.displayName ? (l = /* @__PURE__ */ i(C, { variant: "body2", children: t.displayName }), e[3] = t.displayName, e[4] = l) : l = e[4];
|
|
64
|
+
let o;
|
|
65
|
+
e[5] !== s ? (o = s && /* @__PURE__ */ i(C, { variant: "caption", color: "text.disabled", children: s }), e[5] = s, e[6] = o) : o = e[6];
|
|
66
|
+
let p;
|
|
67
|
+
return e[7] !== l || e[8] !== o ? (p = /* @__PURE__ */ N(M, { direction: "row", alignItems: "center", spacing: 1, children: [
|
|
68
|
+
l,
|
|
69
|
+
o
|
|
70
|
+
] }), e[7] = l, e[8] = o, e[9] = p) : p = e[9], p;
|
|
71
|
+
}
|
|
72
|
+
function ce(a) {
|
|
73
|
+
const e = W(10), {
|
|
74
|
+
pipeline: t,
|
|
75
|
+
envDisplayNameMap: d
|
|
76
|
+
} = a;
|
|
77
|
+
let c;
|
|
78
|
+
e[0] !== d || e[1] !== t ? (c = q(t, d), e[0] = d, e[1] = t, e[2] = c) : c = e[2];
|
|
79
|
+
const s = c;
|
|
80
|
+
let l;
|
|
81
|
+
e[3] !== t.displayName ? (l = /* @__PURE__ */ i(C, { variant: "body2", children: t.displayName }), e[3] = t.displayName, e[4] = l) : l = e[4];
|
|
82
|
+
let o;
|
|
83
|
+
e[5] !== s ? (o = s && /* @__PURE__ */ i(C, { variant: "caption", color: "text.disbaled", children: s }), e[5] = s, e[6] = o) : o = e[6];
|
|
84
|
+
let p;
|
|
85
|
+
return e[7] !== l || e[8] !== o ? (p = /* @__PURE__ */ N(M, { children: [
|
|
86
|
+
l,
|
|
87
|
+
o
|
|
88
|
+
] }), e[7] = l, e[8] = o, e[9] = p) : p = e[9], p;
|
|
89
|
+
}
|
|
90
|
+
const de = ({
|
|
91
|
+
formData: a,
|
|
92
|
+
setFormData: e,
|
|
93
|
+
errors: t,
|
|
94
|
+
validateField: d,
|
|
95
|
+
setFieldError: c,
|
|
96
|
+
checkDirty: s
|
|
97
|
+
}) => {
|
|
98
|
+
const {
|
|
99
|
+
orgId: l
|
|
100
|
+
} = $(), o = V((n, r) => {
|
|
101
|
+
const m = {
|
|
102
|
+
...a,
|
|
103
|
+
[n]: r
|
|
104
|
+
};
|
|
105
|
+
e(m), s(m);
|
|
106
|
+
const f = d(n, r);
|
|
107
|
+
c(n, f);
|
|
108
|
+
}, [a, e, s, d, c]), {
|
|
109
|
+
mutate: p,
|
|
110
|
+
isPending: E
|
|
111
|
+
} = Q({
|
|
112
|
+
orgName: l
|
|
113
|
+
}), {
|
|
114
|
+
data: P,
|
|
115
|
+
isLoading: y
|
|
116
|
+
} = U({
|
|
117
|
+
orgName: l
|
|
118
|
+
}), u = P?.deploymentPipelines ?? [], {
|
|
119
|
+
data: v
|
|
120
|
+
} = X({
|
|
121
|
+
orgName: l
|
|
122
|
+
}), g = A(() => {
|
|
123
|
+
const n = /* @__PURE__ */ new Map();
|
|
124
|
+
return (v ?? []).forEach((r) => n.set(r.name, r.displayName ?? r.name)), n;
|
|
125
|
+
}, [v]);
|
|
126
|
+
z(() => {
|
|
127
|
+
if (!a.deploymentPipeline && u.length > 0) {
|
|
128
|
+
const n = u[0].name;
|
|
129
|
+
e((r) => {
|
|
130
|
+
const m = {
|
|
131
|
+
...r,
|
|
132
|
+
deploymentPipeline: n
|
|
133
|
+
};
|
|
134
|
+
return s(m), m;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}, [u, a.deploymentPipeline, e, s]);
|
|
138
|
+
const h = A(
|
|
139
|
+
() => Y.debounce((n) => {
|
|
140
|
+
if (n.length < 3) {
|
|
141
|
+
o("name", "");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
p({
|
|
145
|
+
displayName: n,
|
|
146
|
+
resourceType: "project"
|
|
147
|
+
}, {
|
|
148
|
+
onSuccess: (r) => {
|
|
149
|
+
e((m) => {
|
|
150
|
+
const f = {
|
|
151
|
+
...m,
|
|
152
|
+
name: r.name
|
|
153
|
+
};
|
|
154
|
+
return s(f), f;
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
onError: (r) => {
|
|
158
|
+
console.error("Failed to generate name:", r);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}, 500),
|
|
162
|
+
// 500ms delay
|
|
163
|
+
[p, e, s]
|
|
164
|
+
);
|
|
165
|
+
return z(() => () => {
|
|
166
|
+
h.cancel();
|
|
167
|
+
}, [h]), z(() => {
|
|
168
|
+
a.displayName && a.displayName.length >= 3 ? h(a.displayName) : (h.cancel(), e((n) => ({
|
|
169
|
+
...n,
|
|
170
|
+
name: ""
|
|
171
|
+
})));
|
|
172
|
+
}, [a.displayName, e, h]), /* @__PURE__ */ i(b.Stack, { spacing: 3, children: /* @__PURE__ */ N(b.Section, { children: [
|
|
173
|
+
/* @__PURE__ */ i(b.Subheader, { children: "Project Details" }),
|
|
174
|
+
/* @__PURE__ */ N(b.Stack, { spacing: 2, children: [
|
|
175
|
+
/* @__PURE__ */ i(b.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ i(F, { id: "displayName", value: a.displayName, onChange: (n) => o("displayName", n.target.value), placeholder: "e.g., Customer Support Platform", error: !!t.displayName, helperText: E ? /* @__PURE__ */ N(M, { direction: "row", alignItems: "center", gap: 1, children: [
|
|
176
|
+
/* @__PURE__ */ i(O, { size: 12 }),
|
|
177
|
+
/* @__PURE__ */ i(C, { variant: "caption", children: "Validating name..." })
|
|
178
|
+
] }) : t.displayName, fullWidth: !0 }) }),
|
|
179
|
+
/* @__PURE__ */ i(b.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ i(F, { id: "description", value: a.description, onChange: (n) => o("description", n.target.value), placeholder: "Short description of this project", multiline: !0, minRows: 2, maxRows: 6, error: !!t.description, helperText: t.description, fullWidth: !0 }) }),
|
|
180
|
+
/* @__PURE__ */ i(b.ElementWrapper, { label: "Deployment Pipeline", name: "deploymentPipeline", children: /* @__PURE__ */ N(H, { id: "deploymentPipeline", value: a.deploymentPipeline, onChange: (n) => o("deploymentPipeline", n.target.value), error: !!t.deploymentPipeline, disabled: y, displayEmpty: !0, renderValue: (n) => {
|
|
181
|
+
const r = u.find((m) => m.name === n);
|
|
182
|
+
return r ? /* @__PURE__ */ i(se, { pipeline: r, envDisplayNameMap: g }) : n;
|
|
183
|
+
}, fullWidth: !0, children: [
|
|
184
|
+
y && /* @__PURE__ */ i(k, { value: "", disabled: !0, children: /* @__PURE__ */ N(M, { direction: "row", alignItems: "center", gap: 1, children: [
|
|
185
|
+
/* @__PURE__ */ i(O, { size: 12 }),
|
|
186
|
+
/* @__PURE__ */ i(C, { variant: "caption", children: "Loading pipelines..." })
|
|
187
|
+
] }) }),
|
|
188
|
+
!y && u.length === 0 && /* @__PURE__ */ i(k, { value: "", disabled: !0, children: "No deployment pipelines available" }),
|
|
189
|
+
u.map((n) => /* @__PURE__ */ i(k, { value: n.name, children: /* @__PURE__ */ i(ce, { pipeline: n, envDisplayNameMap: g }) }, n.name))
|
|
190
|
+
] }) })
|
|
191
|
+
] })
|
|
192
|
+
] }) });
|
|
193
|
+
}, pe = () => {
|
|
194
|
+
const a = J(), {
|
|
195
|
+
orgId: e
|
|
196
|
+
} = $(), [t, d] = B({
|
|
197
|
+
name: "",
|
|
198
|
+
displayName: "",
|
|
199
|
+
description: "",
|
|
200
|
+
deploymentPipeline: "default"
|
|
201
|
+
}), {
|
|
202
|
+
errors: c,
|
|
203
|
+
validateField: s,
|
|
204
|
+
validateForm: l,
|
|
205
|
+
clearErrors: o,
|
|
206
|
+
setFieldError: p
|
|
207
|
+
} = Z(re), {
|
|
208
|
+
checkDirty: E,
|
|
209
|
+
resetDirty: P
|
|
210
|
+
} = _(t), y = A(() => ({
|
|
211
|
+
orgName: e ?? "default"
|
|
212
|
+
}), [e]), {
|
|
213
|
+
mutate: u,
|
|
214
|
+
isPending: v,
|
|
215
|
+
error: g
|
|
216
|
+
} = ee(y), h = V(() => {
|
|
217
|
+
a(R(I.children.org.path, {
|
|
218
|
+
orgId: e ?? ""
|
|
219
|
+
}));
|
|
220
|
+
}, [a, e]), [n, r] = B({}), m = V(() => {
|
|
221
|
+
if (l(t))
|
|
222
|
+
r({});
|
|
223
|
+
else {
|
|
224
|
+
r(c);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
u({
|
|
228
|
+
name: t.name,
|
|
229
|
+
displayName: t.displayName,
|
|
230
|
+
description: t.description?.trim() || void 0,
|
|
231
|
+
deploymentPipeline: t.deploymentPipeline
|
|
232
|
+
}, {
|
|
233
|
+
onSuccess: () => {
|
|
234
|
+
P(), o(), a(R(I.children.org.children.projects.path, {
|
|
235
|
+
orgId: y.orgName ?? "",
|
|
236
|
+
projectId: t.name
|
|
237
|
+
}));
|
|
238
|
+
},
|
|
239
|
+
onError: (f) => {
|
|
240
|
+
console.error("Failed to create project:", f);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}, [t, l, u, a, y.orgName, P, o, c]);
|
|
244
|
+
return /* @__PURE__ */ i(te, { title: "Create a New Project", description: "Create a new project to organize and manage your agents.", disableIcon: !0, backHref: R(I.children.org.path, {
|
|
245
|
+
orgId: e ?? ""
|
|
246
|
+
}), backLabel: "Back to Organization", children: /* @__PURE__ */ N(L, { display: "flex", flexDirection: "column", gap: 2, children: [
|
|
247
|
+
/* @__PURE__ */ i(de, { formData: t, setFormData: d, errors: c, validateField: s, setFieldError: p, checkDirty: E }),
|
|
248
|
+
!!g && /* @__PURE__ */ i(G, { severity: "error", sx: {
|
|
249
|
+
mt: 2
|
|
250
|
+
}, children: g instanceof Error ? g.message : "Failed to create project" }),
|
|
251
|
+
/* @__PURE__ */ i(oe, { lastSubmittedValidationErrors: n, isPending: v, onCancel: h, onSubmit: m, isNameEmpty: !t.name.trim(), mode: "deploy" })
|
|
252
|
+
] }) });
|
|
253
|
+
}, ve = {
|
|
254
|
+
title: "Add New Project",
|
|
255
|
+
description: "A page component for Add New Project",
|
|
256
|
+
icon: ae,
|
|
257
|
+
path: I.children.org.children.newProject.path,
|
|
258
|
+
component: pe
|
|
259
|
+
};
|
|
260
|
+
export {
|
|
261
|
+
pe as AddNewProject,
|
|
262
|
+
ve as metaData
|
|
263
|
+
};
|