@wso2/am-core-ui 0.0.2 → 0.0.3-rc1
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/index.js +1052 -267
- package/package.json +2 -3
- package/dist/index-BZ_J_A7D.js +0 -189
- package/dist/index-Btf11tLc.js +0 -47410
- package/dist/index-C4S6JSHh.js +0 -1784
- package/dist/index-DbDfhpO7.js +0 -66192
- package/dist/index.css +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wso2/am-core-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-rc1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
|
-
}
|
|
13
|
-
"./dist/index.css": "./dist/index.css"
|
|
12
|
+
}
|
|
14
13
|
},
|
|
15
14
|
"files": [
|
|
16
15
|
"dist"
|
package/dist/index-BZ_J_A7D.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { jsx as r, jsxs as j } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback as z, useMemo as R, useEffect as F, useState as W } from "react";
|
|
3
|
-
import { Alert as T, Box as S, Collapse as B, Button as A, Form as y, TextField as L, Stack as M, CircularProgress as G, Typography as O, Select as q, MenuItem as D } from "@wso2/oxygen-ui";
|
|
4
|
-
import { useParams as V, useNavigate as _, generatePath as k } from "react-router-dom";
|
|
5
|
-
import { o as H, s as w, v as $, w as J, f as K, y as Q, z as U, g as I, P as X } from "./index-DbDfhpO7.js";
|
|
6
|
-
import { c as Y } from "react/compiler-runtime";
|
|
7
|
-
import "@tanstack/react-query";
|
|
8
|
-
import { Link as Z, PackagePlus as ee, FolderPlus as te } from "@wso2/oxygen-ui-icons-react";
|
|
9
|
-
const re = H({
|
|
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
|
-
}), ne = (i) => {
|
|
15
|
-
const e = Y(22), {
|
|
16
|
-
lastSubmittedValidationErrors: n,
|
|
17
|
-
isPending: N,
|
|
18
|
-
onCancel: s,
|
|
19
|
-
onSubmit: c,
|
|
20
|
-
mode: g,
|
|
21
|
-
isNameEmpty: d
|
|
22
|
-
} = i, P = g === void 0 ? "deploy" : g, C = d === void 0 ? !1 : d, l = P === "connect";
|
|
23
|
-
let t;
|
|
24
|
-
e[0] !== n ? (t = Object.values(n), e[0] = n, e[1] = t) : t = e[1];
|
|
25
|
-
const o = t, m = o.length > 0;
|
|
26
|
-
let a;
|
|
27
|
-
e[2] !== o ? (a = /* @__PURE__ */ r(T, { severity: "error", children: o.map(ie) }), e[2] = o, e[3] = a) : a = e[3];
|
|
28
|
-
let u;
|
|
29
|
-
e[4] !== m || e[5] !== a ? (u = /* @__PURE__ */ r(B, { in: m, timeout: "auto", unmountOnExit: !0, children: a }), e[4] = m, e[5] = a, e[6] = u) : u = e[6];
|
|
30
|
-
let h;
|
|
31
|
-
e[7] !== s ? (h = /* @__PURE__ */ r(A, { variant: "outlined", color: "primary", size: "medium", onClick: s, children: "Cancel" }), e[7] = s, e[8] = h) : h = e[8];
|
|
32
|
-
let p;
|
|
33
|
-
e[9] !== l ? (p = l ? /* @__PURE__ */ r(Z, { size: 16 }) : /* @__PURE__ */ r(ee, { size: 16 }), e[9] = l, e[10] = p) : p = e[10];
|
|
34
|
-
const v = N || C, x = l ? "Register" : "Create";
|
|
35
|
-
let f;
|
|
36
|
-
e[11] !== c || e[12] !== p || e[13] !== v || e[14] !== x ? (f = /* @__PURE__ */ r(A, { variant: "contained", color: "primary", size: "medium", startIcon: p, onClick: c, disabled: v, children: x }), e[11] = c, e[12] = p, e[13] = v, e[14] = x, e[15] = f) : f = e[15];
|
|
37
|
-
let b;
|
|
38
|
-
e[16] !== f || e[17] !== h ? (b = /* @__PURE__ */ j(S, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
39
|
-
h,
|
|
40
|
-
f
|
|
41
|
-
] }), e[16] = f, e[17] = h, e[18] = b) : b = e[18];
|
|
42
|
-
let E;
|
|
43
|
-
return e[19] !== b || e[20] !== u ? (E = /* @__PURE__ */ j(S, { display: "flex", flexDirection: "column", gap: 3, children: [
|
|
44
|
-
u,
|
|
45
|
-
b
|
|
46
|
-
] }), e[19] = b, e[20] = u, e[21] = E) : E = e[21], E;
|
|
47
|
-
};
|
|
48
|
-
function ie(i, e) {
|
|
49
|
-
return /* @__PURE__ */ r(S, { children: i }, e);
|
|
50
|
-
}
|
|
51
|
-
const ae = ({
|
|
52
|
-
formData: i,
|
|
53
|
-
setFormData: e,
|
|
54
|
-
errors: n,
|
|
55
|
-
validateField: N,
|
|
56
|
-
setFieldError: s,
|
|
57
|
-
checkDirty: c
|
|
58
|
-
}) => {
|
|
59
|
-
const {
|
|
60
|
-
orgId: g
|
|
61
|
-
} = V(), d = z((t, o) => {
|
|
62
|
-
const m = {
|
|
63
|
-
...i,
|
|
64
|
-
[t]: o
|
|
65
|
-
};
|
|
66
|
-
e(m), c(m);
|
|
67
|
-
const a = N(t, o);
|
|
68
|
-
s(t, a);
|
|
69
|
-
}, [i, e, c, N, s]), {
|
|
70
|
-
mutate: P,
|
|
71
|
-
isPending: C
|
|
72
|
-
} = $({
|
|
73
|
-
orgName: g
|
|
74
|
-
}), l = R(
|
|
75
|
-
() => J.debounce((t) => {
|
|
76
|
-
if (t.length < 3) {
|
|
77
|
-
d("name", "");
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
P({
|
|
81
|
-
displayName: t,
|
|
82
|
-
resourceType: "project"
|
|
83
|
-
}, {
|
|
84
|
-
onSuccess: (o) => {
|
|
85
|
-
e((m) => {
|
|
86
|
-
const a = {
|
|
87
|
-
...m,
|
|
88
|
-
name: o.name
|
|
89
|
-
};
|
|
90
|
-
return c(a), a;
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
onError: (o) => {
|
|
94
|
-
console.error("Failed to generate name:", o);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}, 500),
|
|
98
|
-
// 500ms delay
|
|
99
|
-
[P, e, c]
|
|
100
|
-
);
|
|
101
|
-
return F(() => () => {
|
|
102
|
-
l.cancel();
|
|
103
|
-
}, [l]), F(() => {
|
|
104
|
-
i.displayName && i.displayName.length >= 3 ? l(i.displayName) : (l.cancel(), e((t) => ({
|
|
105
|
-
...t,
|
|
106
|
-
name: ""
|
|
107
|
-
})));
|
|
108
|
-
}, [i.displayName, e, l]), /* @__PURE__ */ r(y.Stack, { spacing: 3, children: /* @__PURE__ */ j(y.Section, { children: [
|
|
109
|
-
/* @__PURE__ */ r(y.Subheader, { children: "Project Details" }),
|
|
110
|
-
/* @__PURE__ */ j(y.Stack, { spacing: 2, children: [
|
|
111
|
-
/* @__PURE__ */ r(y.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ r(L, { id: "displayName", value: i.displayName, onChange: (t) => d("displayName", t.target.value), placeholder: "e.g., Customer Support Platform", error: !!n.displayName, helperText: C ? /* @__PURE__ */ j(M, { direction: "row", alignItems: "center", gap: 1, children: [
|
|
112
|
-
/* @__PURE__ */ r(G, { size: 12 }),
|
|
113
|
-
/* @__PURE__ */ r(O, { variant: "caption", children: "Validating name..." })
|
|
114
|
-
] }) : n.displayName, fullWidth: !0 }) }),
|
|
115
|
-
/* @__PURE__ */ r(y.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ r(L, { id: "description", value: i.description, onChange: (t) => d("description", t.target.value), placeholder: "Short description of this project", multiline: !0, minRows: 2, maxRows: 6, error: !!n.description, helperText: n.description, fullWidth: !0 }) }),
|
|
116
|
-
/* @__PURE__ */ r(S, { display: "none", children: /* @__PURE__ */ r(y.ElementWrapper, { label: "Deployment Pipeline", name: "deploymentPipeline", children: /* @__PURE__ */ r(q, { id: "deploymentPipeline", value: i.deploymentPipeline, onChange: (t) => d("deploymentPipeline", t.target.value), error: !!n.deploymentPipeline, fullWidth: !0, children: /* @__PURE__ */ r(D, { value: "default", children: "default" }) }) }) })
|
|
117
|
-
] })
|
|
118
|
-
] }) });
|
|
119
|
-
}, oe = () => {
|
|
120
|
-
const i = _(), {
|
|
121
|
-
orgId: e
|
|
122
|
-
} = V(), [n, N] = W({
|
|
123
|
-
name: "",
|
|
124
|
-
displayName: "",
|
|
125
|
-
description: "",
|
|
126
|
-
deploymentPipeline: "default"
|
|
127
|
-
}), {
|
|
128
|
-
errors: s,
|
|
129
|
-
validateField: c,
|
|
130
|
-
validateForm: g,
|
|
131
|
-
clearErrors: d,
|
|
132
|
-
setFieldError: P
|
|
133
|
-
} = K(re), {
|
|
134
|
-
checkDirty: C,
|
|
135
|
-
resetDirty: l
|
|
136
|
-
} = Q(n), t = R(() => ({
|
|
137
|
-
orgName: e ?? "default"
|
|
138
|
-
}), [e]), {
|
|
139
|
-
mutate: o,
|
|
140
|
-
isPending: m,
|
|
141
|
-
error: a
|
|
142
|
-
} = U(t), u = z(() => {
|
|
143
|
-
i(k(I.children.org.path, {
|
|
144
|
-
orgId: e ?? ""
|
|
145
|
-
}));
|
|
146
|
-
}, [i, e]), [h, p] = W({}), v = z(() => {
|
|
147
|
-
if (g(n))
|
|
148
|
-
p({});
|
|
149
|
-
else {
|
|
150
|
-
p(s);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
o({
|
|
154
|
-
name: n.name,
|
|
155
|
-
displayName: n.displayName,
|
|
156
|
-
description: n.description?.trim() || void 0,
|
|
157
|
-
deploymentPipeline: n.deploymentPipeline
|
|
158
|
-
}, {
|
|
159
|
-
onSuccess: () => {
|
|
160
|
-
l(), d(), i(k(I.children.org.children.projects.path, {
|
|
161
|
-
orgId: t.orgName ?? "",
|
|
162
|
-
projectId: n.name
|
|
163
|
-
}));
|
|
164
|
-
},
|
|
165
|
-
onError: (x) => {
|
|
166
|
-
console.error("Failed to create project:", x);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}, [n, g, o, i, t.orgName, l, d, s]);
|
|
170
|
-
return /* @__PURE__ */ r(X, { title: "Create a New Project", description: "Create a new project to organize and manage your agents.", disableIcon: !0, backHref: k(I.children.org.path, {
|
|
171
|
-
orgId: e ?? ""
|
|
172
|
-
}), backLabel: "Back to Organization", children: /* @__PURE__ */ j(S, { display: "flex", flexDirection: "column", gap: 2, children: [
|
|
173
|
-
/* @__PURE__ */ r(ae, { formData: n, setFormData: N, errors: s, validateField: c, setFieldError: P, checkDirty: C }),
|
|
174
|
-
!!a && /* @__PURE__ */ r(T, { severity: "error", sx: {
|
|
175
|
-
mt: 2
|
|
176
|
-
}, children: a instanceof Error ? a.message : "Failed to create project" }),
|
|
177
|
-
/* @__PURE__ */ r(ne, { lastSubmittedValidationErrors: h, isPending: m, onCancel: u, onSubmit: v, isNameEmpty: !n.name.trim(), mode: "deploy" })
|
|
178
|
-
] }) });
|
|
179
|
-
}, ge = {
|
|
180
|
-
title: "Add New Project",
|
|
181
|
-
description: "A page component for Add New Project",
|
|
182
|
-
icon: te,
|
|
183
|
-
path: I.children.org.children.newProject.path,
|
|
184
|
-
component: oe
|
|
185
|
-
};
|
|
186
|
-
export {
|
|
187
|
-
oe as AddNewProject,
|
|
188
|
-
ge as metaData
|
|
189
|
-
};
|