@wso2/am-core-ui 0.0.18 → 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.
- package/dist/APIKeysManager-C0phJriD.js +241 -0
- package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
- package/dist/CodeBlock-mB_Loq7I.js +21736 -0
- package/dist/EnvironmentCard-09h1XRxx.js +310 -0
- package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
- package/dist/MCPLogo-D9IJzzl7.js +30 -0
- package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
- package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
- package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
- package/dist/clipboard-YAzStmkw.js +23 -0
- package/dist/debounce-BV83M53b.js +208 -0
- package/dist/format-BEZZRyE2.js +29 -0
- package/dist/formatDistanceToNow-TErllcH8.js +100 -0
- package/dist/gatewayScripts-D8O45W8u.js +72 -0
- package/dist/highlight-BsUzxSR3.js +454 -0
- package/dist/index-B52h3RHg.js +1290 -0
- package/dist/index-BP5drcF2.js +1265 -0
- package/dist/index-BZ4vxviI.js +7981 -0
- package/dist/index-B_Z0MwXk.js +25012 -0
- package/dist/index-BfjzUWDa.js +1397 -0
- package/dist/{index-DYV1jEai.js → index-BnV-PkwM.js} +22 -20
- package/dist/index-CGDYgUCH.js +711 -0
- package/dist/index-COt7nJIf.js +2286 -0
- package/dist/index-CWZjOy1h.js +2247 -0
- package/dist/index-CezvogTQ.js +116 -0
- package/dist/index-CgCWbWzN.js +2342 -0
- package/dist/index-CjCkcuuI.js +322 -0
- package/dist/index-CjXvuf9m.js +1354 -0
- package/dist/index-DD4qF7gq.js +2340 -0
- package/dist/index-DeQ-9KTC.js +737 -0
- package/dist/index-Df6OBy4E.js +3041 -0
- package/dist/index-KRsV2L4V.js +1564 -0
- package/dist/index-PUuASE1F.js +2507 -0
- package/dist/index-PWsNvJB-.js +546 -0
- package/dist/index-UqDmyMSA.js +119 -0
- package/dist/index-_0Pj_ZtW.js +459 -0
- package/dist/{index-CnXsN5I3.js → index-sr-mWz4T.js} +31 -30
- package/dist/index.d.ts +496 -200
- package/dist/index.js +462 -439
- package/dist/llmProviderPayload-CzihkdNa.js +332 -0
- package/dist/schemas-DFScWdSL.js +2969 -0
- package/package.json +1 -1
- package/dist/index-B47EJCom.js +0 -236
- package/dist/index-Bl1Y7Sro.js +0 -3037
- package/dist/index-DlS9Lybj.js +0 -80691
|
@@ -0,0 +1,1564 @@
|
|
|
1
|
+
import { Plus as Le, Users as nt, Trash as we, Link2 as xt, Check as Pt, Copy as It, ArrowLeft as Rt, Shield as it, Folder as st, Settings as Nt } from "@wso2/oxygen-ui-icons-react";
|
|
2
|
+
import { jsx as t, Fragment as H, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { useParams as fe, useNavigate as xe, generatePath as q, Link as ut, Route as le, Navigate as je, Routes as pt, useLocation as At, matchPath as Ut } from "react-router-dom";
|
|
4
|
+
import { c as Ie } from "react/compiler-runtime";
|
|
5
|
+
import { q as Ve, bF as gt, bG as Dt, G as at, g as he, r as Ke, A as Qe, bH as kt, bI as Gt, t as Et, bJ as Lt, bK as Tt, bL as _t, bM as ft, bN as bt, bO as vt, bP as zt, bQ as Ft, bR as Wt, bS as Mt, bT as Ot, bU as Bt, bV as Vt, bW as $t, bX as Ht, bY as Xt, bZ as qt, b_ as jt, b$ as Yt, c0 as Jt, c1 as Kt, c2 as Qt, c3 as Zt, c4 as er, bv as tr, P as rr } from "./index-B_Z0MwXk.js";
|
|
6
|
+
import { useState as R, useMemo as _, useEffect as $e, useRef as yt, useCallback as Ye } from "react";
|
|
7
|
+
import { ListingTable as n, Stack as ae, Skeleton as Se, Alert as ne, Button as X, Avatar as Ze, Typography as B, Tooltip as De, IconButton as ke, TablePagination as et, Form as S, TextField as ce, Box as L, Collapse as tt, Tabs as ot, Tab as Ee, Autocomplete as Oe, Chip as Je, createFilterOptions as nr, Checkbox as ht, CircularProgress as ir, Card as sr, List as ar, ListItemButton as or, ListItemIcon as lr, ListItemText as cr, ListSubheader as dr, Divider as hr } from "@wso2/oxygen-ui";
|
|
8
|
+
import "@tanstack/react-query";
|
|
9
|
+
import { o as rt, s as ye } from "./schemas-DFScWdSL.js";
|
|
10
|
+
const lt = (e) => {
|
|
11
|
+
const r = Ie(5), {
|
|
12
|
+
rows: d,
|
|
13
|
+
columns: c
|
|
14
|
+
} = e, l = d === void 0 ? 5 : d, a = c === void 0 ? 2 : c;
|
|
15
|
+
let m;
|
|
16
|
+
r[0] !== l ? (m = Array.from({
|
|
17
|
+
length: l
|
|
18
|
+
}), r[0] = l, r[1] = m) : m = r[1];
|
|
19
|
+
let o;
|
|
20
|
+
return r[2] !== a || r[3] !== m ? (o = /* @__PURE__ */ t(H, { children: m.map((f, g) => /* @__PURE__ */ s(n.Row, { variant: "table", children: [
|
|
21
|
+
/* @__PURE__ */ t(n.Cell, { children: /* @__PURE__ */ s(ae, { direction: "row", alignItems: "center", spacing: 2, children: [
|
|
22
|
+
/* @__PURE__ */ t(Se, { variant: "circular", width: 28, height: 28 }),
|
|
23
|
+
/* @__PURE__ */ t(Se, { variant: "text", width: "40%" })
|
|
24
|
+
] }) }),
|
|
25
|
+
a > 1 && /* @__PURE__ */ t(n.Cell, { children: /* @__PURE__ */ t(Se, { variant: "text", width: "70%" }) }),
|
|
26
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", width: "80px" })
|
|
27
|
+
] }, g)) }), r[2] = a, r[3] = m, r[4] = o) : o = r[4], o;
|
|
28
|
+
}, mr = {
|
|
29
|
+
width: 28,
|
|
30
|
+
height: 28,
|
|
31
|
+
fontSize: 12
|
|
32
|
+
}, ur = () => {
|
|
33
|
+
const {
|
|
34
|
+
orgId: e
|
|
35
|
+
} = fe(), r = xe(), d = Ve.featureFlags?.enableUserManagement === !0, [c, l] = R(0), [a, m] = R(10), [o, f] = R(""), {
|
|
36
|
+
data: g,
|
|
37
|
+
isLoading: i,
|
|
38
|
+
error: w
|
|
39
|
+
} = gt({
|
|
40
|
+
orgName: e
|
|
41
|
+
}, {
|
|
42
|
+
offset: c * a,
|
|
43
|
+
limit: a
|
|
44
|
+
}), {
|
|
45
|
+
mutateAsync: p
|
|
46
|
+
} = Dt(), {
|
|
47
|
+
addConfirmation: I
|
|
48
|
+
} = at(), P = _(() => g?.users ?? [], [g]), y = g?.total ?? 0;
|
|
49
|
+
$e(() => {
|
|
50
|
+
if (P.length === 0 && y > 0) {
|
|
51
|
+
const b = Math.max(0, Math.ceil(y / a) - 1);
|
|
52
|
+
c !== b && l(b);
|
|
53
|
+
}
|
|
54
|
+
}, [P.length, y, c, a]);
|
|
55
|
+
const N = he.children.org.children.settings.children.identities, U = e ? q(N.children.users.path + "/invite", {
|
|
56
|
+
orgId: e
|
|
57
|
+
}) : "#", F = e ? q(N.children.users.path + "/add", {
|
|
58
|
+
orgId: e
|
|
59
|
+
}) : "#", T = (b) => e ? q(N.children.users.path + "/:userId", {
|
|
60
|
+
orgId: e,
|
|
61
|
+
userId: b
|
|
62
|
+
}) : "#", C = (b) => String(b.attributes?.username ?? ""), u = _(() => {
|
|
63
|
+
if (!o) return P;
|
|
64
|
+
const b = o.toLowerCase();
|
|
65
|
+
return P.filter((M) => C(M).toLowerCase().includes(b));
|
|
66
|
+
}, [P, o]), A = (b) => {
|
|
67
|
+
I({
|
|
68
|
+
title: "Delete User",
|
|
69
|
+
description: `Are you sure you want to delete "${C(b)}"? This action cannot be undone.`,
|
|
70
|
+
confirmButtonText: "Delete",
|
|
71
|
+
confirmButtonColor: "error",
|
|
72
|
+
confirmButtonIcon: /* @__PURE__ */ t(we, { size: 16 }),
|
|
73
|
+
onConfirm: () => p({
|
|
74
|
+
orgName: e,
|
|
75
|
+
userId: b.id
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
80
|
+
w != null && /* @__PURE__ */ t(ne, { severity: "error", sx: {
|
|
81
|
+
mb: 2
|
|
82
|
+
}, children: "Failed to load users" }),
|
|
83
|
+
/* @__PURE__ */ t(n.Provider, { searchValue: o, onSearchChange: f, children: /* @__PURE__ */ s(n.Container, { children: [
|
|
84
|
+
/* @__PURE__ */ t(n.Toolbar, { showSearch: !0, searchPlaceholder: "Search users...", actions: /* @__PURE__ */ s(ae, { direction: "row", spacing: 1, children: [
|
|
85
|
+
/* @__PURE__ */ t(X, { variant: "outlined", startIcon: /* @__PURE__ */ t(Le, {}), onClick: () => r(F), disabled: !d, children: "Add User" }),
|
|
86
|
+
/* @__PURE__ */ t(X, { variant: "contained", startIcon: /* @__PURE__ */ t(Le, {}), onClick: () => r(U), disabled: !d, children: "Invite User" })
|
|
87
|
+
] }) }),
|
|
88
|
+
!i && y === 0 ? /* @__PURE__ */ t(n.EmptyState, { illustration: /* @__PURE__ */ t(nt, { size: 64 }), title: "No users yet", description: 'Click "Add User" to create one or "Invite User" to invite someone.' }) : !i && u.length === 0 ? /* @__PURE__ */ t(n.EmptyState, { illustration: /* @__PURE__ */ t(nt, { size: 64 }), title: "No users found", description: `No users match "${o}". Try a different search term.` }) : /* @__PURE__ */ s(n, { variant: "table", children: [
|
|
89
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
90
|
+
/* @__PURE__ */ t(n.Cell, { children: "Username" }),
|
|
91
|
+
/* @__PURE__ */ t(n.Cell, { children: "User ID" }),
|
|
92
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", width: "80px" })
|
|
93
|
+
] }) }),
|
|
94
|
+
/* @__PURE__ */ s(n.Body, { children: [
|
|
95
|
+
i && /* @__PURE__ */ t(lt, { rows: a }),
|
|
96
|
+
!i && u.map((b) => {
|
|
97
|
+
const M = C(b);
|
|
98
|
+
return /* @__PURE__ */ s(n.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => r(T(b.id)), children: [
|
|
99
|
+
/* @__PURE__ */ t(n.Cell, { children: /* @__PURE__ */ t(n.CellIcon, { icon: /* @__PURE__ */ t(Ze, { sx: mr, children: M.charAt(0).toUpperCase() || "U" }), primary: M }) }),
|
|
100
|
+
/* @__PURE__ */ t(n.Cell, { children: /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", noWrap: !0, children: b.id }) }),
|
|
101
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", children: /* @__PURE__ */ t(n.RowActions, { visibility: "hover", children: /* @__PURE__ */ t(De, { title: "Delete user", children: /* @__PURE__ */ t(ke, { size: "small", color: "error", onClick: (j) => {
|
|
102
|
+
j.stopPropagation(), A(b);
|
|
103
|
+
}, children: /* @__PURE__ */ t(we, { size: 16 }) }) }) }) })
|
|
104
|
+
] }, b.id);
|
|
105
|
+
})
|
|
106
|
+
] })
|
|
107
|
+
] }),
|
|
108
|
+
!i && y >= 5 && /* @__PURE__ */ t(et, { component: "div", count: y, page: c, rowsPerPage: a, onPageChange: (b, M) => l(M), onRowsPerPageChange: (b) => {
|
|
109
|
+
m(parseInt(b.target.value, 10)), l(0);
|
|
110
|
+
}, rowsPerPageOptions: [5, 10, 25, 50] })
|
|
111
|
+
] }) })
|
|
112
|
+
] });
|
|
113
|
+
}, pr = rt({
|
|
114
|
+
name: ye().trim().min(1, "Name is required").max(50, "Name must be at most 50 characters"),
|
|
115
|
+
description: ye().trim().optional()
|
|
116
|
+
}), gr = rt({
|
|
117
|
+
name: ye().trim().min(1, "Name is required").max(50, "Name must be at most 50 characters"),
|
|
118
|
+
description: ye().trim().optional()
|
|
119
|
+
}), fr = rt({
|
|
120
|
+
username: ye().trim().min(1, "Username is required").max(100, "Username must be at most 100 characters").regex(/^\S+$/, "Username cannot contain spaces"),
|
|
121
|
+
password: ye().min(1, "Password is required").min(8, "Password must be at least 8 characters"),
|
|
122
|
+
firstName: ye().trim().optional(),
|
|
123
|
+
lastName: ye().trim().optional(),
|
|
124
|
+
email: ye().trim().optional().refine((e) => !e || ye().email().safeParse(e).success, {
|
|
125
|
+
message: "Enter a valid email address"
|
|
126
|
+
})
|
|
127
|
+
}), br = rt({
|
|
128
|
+
email: ye().trim().min(1, "Email is required").email("Enter a valid email address")
|
|
129
|
+
}), vr = () => {
|
|
130
|
+
const e = Ie(40), {
|
|
131
|
+
orgId: r
|
|
132
|
+
} = fe(), d = xe();
|
|
133
|
+
let c;
|
|
134
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (c = {
|
|
135
|
+
email: ""
|
|
136
|
+
}, e[0] = c) : c = e[0];
|
|
137
|
+
const [l, a] = R(c), [m, o] = R(), [f, g] = R(!1), {
|
|
138
|
+
errors: i,
|
|
139
|
+
validateField: w,
|
|
140
|
+
validateForm: p,
|
|
141
|
+
clearErrors: I,
|
|
142
|
+
setFieldError: P
|
|
143
|
+
} = Ke(br), {
|
|
144
|
+
checkDirty: y,
|
|
145
|
+
resetDirty: N
|
|
146
|
+
} = Qe(l);
|
|
147
|
+
let U;
|
|
148
|
+
e[1] === Symbol.for("react.memo_cache_sentinel") ? (U = {}, e[1] = U) : U = e[1];
|
|
149
|
+
const [F, T] = R(U), {
|
|
150
|
+
mutateAsync: C,
|
|
151
|
+
isPending: u,
|
|
152
|
+
error: A
|
|
153
|
+
} = kt();
|
|
154
|
+
let b;
|
|
155
|
+
e[2] !== r ? (b = r ? q(he.children.org.children.settings.children.identities.children.users.path, {
|
|
156
|
+
orgId: r
|
|
157
|
+
}) : "#", e[2] = r, e[3] = b) : b = e[3];
|
|
158
|
+
const M = b;
|
|
159
|
+
let j;
|
|
160
|
+
e[4] !== y || e[5] !== l || e[6] !== P || e[7] !== w ? (j = (J, ie) => {
|
|
161
|
+
const de = {
|
|
162
|
+
...l,
|
|
163
|
+
[J]: ie
|
|
164
|
+
};
|
|
165
|
+
a(de), y(de), P(J, w(J, ie));
|
|
166
|
+
}, e[4] = y, e[5] = l, e[6] = P, e[7] = w, e[8] = j) : j = e[8];
|
|
167
|
+
const V = j;
|
|
168
|
+
let Y;
|
|
169
|
+
e[9] !== i || e[10] !== l || e[11] !== C || e[12] !== r || e[13] !== p ? (Y = async () => {
|
|
170
|
+
if (!p(l)) {
|
|
171
|
+
T(i);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
T({});
|
|
175
|
+
try {
|
|
176
|
+
const J = await C({
|
|
177
|
+
params: {
|
|
178
|
+
orgName: r
|
|
179
|
+
},
|
|
180
|
+
body: {
|
|
181
|
+
email: l.email.trim()
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
o(J.inviteLink);
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
}, e[9] = i, e[10] = l, e[11] = C, e[12] = r, e[13] = p, e[14] = Y) : Y = e[14];
|
|
188
|
+
const W = Y;
|
|
189
|
+
let Z;
|
|
190
|
+
e[15] !== I || e[16] !== N ? (Z = () => {
|
|
191
|
+
o(void 0), a({
|
|
192
|
+
email: ""
|
|
193
|
+
}), N(), I(), T({});
|
|
194
|
+
}, e[15] = I, e[16] = N, e[17] = Z) : Z = e[17];
|
|
195
|
+
const ee = Z;
|
|
196
|
+
let $;
|
|
197
|
+
e[18] !== m ? ($ = async () => {
|
|
198
|
+
m && (await navigator.clipboard.writeText(m), g(!0), setTimeout(() => g(!1), 2e3));
|
|
199
|
+
}, e[18] = m, e[19] = $) : $ = e[19];
|
|
200
|
+
const D = $;
|
|
201
|
+
let k;
|
|
202
|
+
e[20] !== F ? (k = Object.values(F), e[20] = F, e[21] = k) : k = e[21];
|
|
203
|
+
const te = k;
|
|
204
|
+
let O;
|
|
205
|
+
e[22] !== A ? (O = A != null && /* @__PURE__ */ t(ne, { severity: "error", children: A?.message ?? "Failed to send invitation" }), e[22] = A, e[23] = O) : O = e[23];
|
|
206
|
+
let G;
|
|
207
|
+
e[24] !== f || e[25] !== i || e[26] !== l.email || e[27] !== D || e[28] !== V || e[29] !== ee || e[30] !== W || e[31] !== m || e[32] !== u || e[33] !== d || e[34] !== te || e[35] !== M ? (G = m == null ? /* @__PURE__ */ s(H, { children: [
|
|
208
|
+
/* @__PURE__ */ t(S.Stack, { spacing: 3, children: /* @__PURE__ */ s(S.Section, { children: [
|
|
209
|
+
/* @__PURE__ */ t(S.Subheader, { children: "Invite Details" }),
|
|
210
|
+
/* @__PURE__ */ t(S.Stack, { spacing: 2, children: /* @__PURE__ */ t(S.ElementWrapper, { label: "Email Address", name: "email", children: /* @__PURE__ */ t(ce, { id: "email", type: "email", value: l.email, onChange: (J) => V("email", J.target.value), placeholder: "user@example.com", autoComplete: "off", error: !!i.email, helperText: i.email, fullWidth: !0 }) }) })
|
|
211
|
+
] }) }),
|
|
212
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 3, children: [
|
|
213
|
+
/* @__PURE__ */ t(tt, { in: te.length > 0, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ t(ne, { severity: "error", children: te.map(yr) }) }),
|
|
214
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
215
|
+
/* @__PURE__ */ t(X, { variant: "outlined", color: "primary", onClick: () => d(M), disabled: u, children: "Cancel" }),
|
|
216
|
+
/* @__PURE__ */ t(X, { variant: "contained", color: "primary", startIcon: /* @__PURE__ */ t(xt, { size: 16 }), onClick: W, disabled: u || !l.email.trim(), children: "Get Invitation Link" })
|
|
217
|
+
] })
|
|
218
|
+
] })
|
|
219
|
+
] }) : /* @__PURE__ */ t(S.Stack, { spacing: 3, children: /* @__PURE__ */ s(S.Section, { children: [
|
|
220
|
+
/* @__PURE__ */ t(S.Subheader, { children: "Invitation Created" }),
|
|
221
|
+
/* @__PURE__ */ s(S.Stack, { spacing: 2, children: [
|
|
222
|
+
/* @__PURE__ */ s(ne, { severity: "success", children: [
|
|
223
|
+
"An invitation has been created for",
|
|
224
|
+
" ",
|
|
225
|
+
/* @__PURE__ */ t("strong", { children: l.email }),
|
|
226
|
+
". Share the link below with the user to complete registration."
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ s(L, { children: [
|
|
229
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", mb: 1, children: "Invite Link" }),
|
|
230
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
231
|
+
/* @__PURE__ */ t(ce, { fullWidth: !0, value: m, InputProps: {
|
|
232
|
+
readOnly: !0
|
|
233
|
+
} }),
|
|
234
|
+
/* @__PURE__ */ t(De, { title: f ? "Copied!" : "Copy link", children: /* @__PURE__ */ t(ke, { onClick: D, size: "small", children: f ? /* @__PURE__ */ t(Pt, { size: 16 }) : /* @__PURE__ */ t(It, { size: 16 }) }) })
|
|
235
|
+
] })
|
|
236
|
+
] }),
|
|
237
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", justifyContent: "flex-end", children: [
|
|
238
|
+
/* @__PURE__ */ t(X, { variant: "outlined", color: "primary", onClick: ee, children: "Invite Another" }),
|
|
239
|
+
/* @__PURE__ */ t(X, { variant: "contained", color: "primary", onClick: () => d(M), children: "Done" })
|
|
240
|
+
] })
|
|
241
|
+
] })
|
|
242
|
+
] }) }), e[24] = f, e[25] = i, e[26] = l.email, e[27] = D, e[28] = V, e[29] = ee, e[30] = W, e[31] = m, e[32] = u, e[33] = d, e[34] = te, e[35] = M, e[36] = G) : G = e[36];
|
|
243
|
+
let re;
|
|
244
|
+
return e[37] !== O || e[38] !== G ? (re = /* @__PURE__ */ t(H, { children: /* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 2, children: [
|
|
245
|
+
O,
|
|
246
|
+
G
|
|
247
|
+
] }) }), e[37] = O, e[38] = G, e[39] = re) : re = e[39], re;
|
|
248
|
+
};
|
|
249
|
+
function yr(e, r) {
|
|
250
|
+
return /* @__PURE__ */ t(L, { children: e }, r);
|
|
251
|
+
}
|
|
252
|
+
const Cr = () => {
|
|
253
|
+
const e = Ie(99), {
|
|
254
|
+
orgId: r
|
|
255
|
+
} = fe(), d = xe(), c = he.children.org.children.settings.children.identities;
|
|
256
|
+
let l;
|
|
257
|
+
e[0] !== r ? (l = r ? q(c.children.users.path, {
|
|
258
|
+
orgId: r
|
|
259
|
+
}) : "#", e[0] = r, e[1] = l) : l = e[1];
|
|
260
|
+
const a = l, {
|
|
261
|
+
mutateAsync: m,
|
|
262
|
+
isPending: o,
|
|
263
|
+
error: f
|
|
264
|
+
} = Gt();
|
|
265
|
+
let g;
|
|
266
|
+
e[2] === Symbol.for("react.memo_cache_sentinel") ? (g = {
|
|
267
|
+
username: "",
|
|
268
|
+
password: "",
|
|
269
|
+
firstName: "",
|
|
270
|
+
lastName: "",
|
|
271
|
+
email: ""
|
|
272
|
+
}, e[2] = g) : g = e[2];
|
|
273
|
+
const [i, w] = R(g), {
|
|
274
|
+
errors: p,
|
|
275
|
+
validateField: I,
|
|
276
|
+
validateForm: P,
|
|
277
|
+
clearErrors: y,
|
|
278
|
+
setFieldError: N
|
|
279
|
+
} = Ke(fr), {
|
|
280
|
+
checkDirty: U,
|
|
281
|
+
resetDirty: F
|
|
282
|
+
} = Qe(i);
|
|
283
|
+
let T;
|
|
284
|
+
e[3] === Symbol.for("react.memo_cache_sentinel") ? (T = {}, e[3] = T) : T = e[3];
|
|
285
|
+
const [C, u] = R(T);
|
|
286
|
+
let A;
|
|
287
|
+
e[4] !== U || e[5] !== i || e[6] !== N || e[7] !== I ? (A = (K, He) => {
|
|
288
|
+
const Xe = {
|
|
289
|
+
...i,
|
|
290
|
+
[K]: He
|
|
291
|
+
};
|
|
292
|
+
w(Xe), U(Xe), N(K, I(K, He));
|
|
293
|
+
}, e[4] = U, e[5] = i, e[6] = N, e[7] = I, e[8] = A) : A = e[8];
|
|
294
|
+
const b = A;
|
|
295
|
+
let M;
|
|
296
|
+
e[9] !== y || e[10] !== m || e[11] !== p || e[12] !== i || e[13] !== d || e[14] !== r || e[15] !== F || e[16] !== a || e[17] !== P ? (M = async () => {
|
|
297
|
+
if (!P(i)) {
|
|
298
|
+
u(p);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
u({});
|
|
302
|
+
const K = {
|
|
303
|
+
username: i.username,
|
|
304
|
+
password: i.password
|
|
305
|
+
};
|
|
306
|
+
i.firstName && (K.given_name = i.firstName), i.lastName && (K.family_name = i.lastName), i.email && (K.email = i.email);
|
|
307
|
+
try {
|
|
308
|
+
await m({
|
|
309
|
+
params: {
|
|
310
|
+
orgName: r
|
|
311
|
+
},
|
|
312
|
+
body: {
|
|
313
|
+
type: "engineer",
|
|
314
|
+
attributes: K
|
|
315
|
+
}
|
|
316
|
+
}), F(), y(), d(a);
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
}, e[9] = y, e[10] = m, e[11] = p, e[12] = i, e[13] = d, e[14] = r, e[15] = F, e[16] = a, e[17] = P, e[18] = M) : M = e[18];
|
|
320
|
+
const j = M;
|
|
321
|
+
let V;
|
|
322
|
+
e[19] !== C ? (V = Object.values(C), e[19] = C, e[20] = V) : V = e[20];
|
|
323
|
+
const Y = V;
|
|
324
|
+
let W;
|
|
325
|
+
e[21] !== f ? (W = f != null && /* @__PURE__ */ t(ne, { severity: "error", children: f?.message ?? "Failed to create user" }), e[21] = f, e[22] = W) : W = e[22];
|
|
326
|
+
let Z;
|
|
327
|
+
e[23] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ t(S.Subheader, { children: "User Details" }), e[23] = Z) : Z = e[23];
|
|
328
|
+
let ee;
|
|
329
|
+
e[24] !== b ? (ee = (K) => b("username", K.target.value), e[24] = b, e[25] = ee) : ee = e[25];
|
|
330
|
+
const $ = !!p.username;
|
|
331
|
+
let D;
|
|
332
|
+
e[26] !== p.username || e[27] !== i.username || e[28] !== o || e[29] !== ee || e[30] !== $ ? (D = /* @__PURE__ */ t(S.ElementWrapper, { label: "Username", name: "username", children: /* @__PURE__ */ t(ce, { id: "username", value: i.username, onChange: ee, placeholder: "jane.doe", autoComplete: "off", disabled: o, error: $, helperText: p.username, fullWidth: !0 }) }), e[26] = p.username, e[27] = i.username, e[28] = o, e[29] = ee, e[30] = $, e[31] = D) : D = e[31];
|
|
333
|
+
let k;
|
|
334
|
+
e[32] !== b ? (k = (K) => b("password", K.target.value), e[32] = b, e[33] = k) : k = e[33];
|
|
335
|
+
const te = !!p.password;
|
|
336
|
+
let O;
|
|
337
|
+
e[34] !== p.password || e[35] !== i.password || e[36] !== o || e[37] !== k || e[38] !== te ? (O = /* @__PURE__ */ t(S.ElementWrapper, { label: "Password", name: "password", children: /* @__PURE__ */ t(Et, { id: "password", type: "password", showPasswordToggle: !0, value: i.password, onChange: k, autoComplete: "new-password", disabled: o, error: te, helperText: p.password, fullWidth: !0 }) }), e[34] = p.password, e[35] = i.password, e[36] = o, e[37] = k, e[38] = te, e[39] = O) : O = e[39];
|
|
338
|
+
let G;
|
|
339
|
+
e[40] !== b ? (G = (K) => b("firstName", K.target.value), e[40] = b, e[41] = G) : G = e[41];
|
|
340
|
+
const re = !!p.firstName;
|
|
341
|
+
let J;
|
|
342
|
+
e[42] !== p.firstName || e[43] !== i.firstName || e[44] !== o || e[45] !== G || e[46] !== re ? (J = /* @__PURE__ */ t(S.ElementWrapper, { label: "First Name (optional)", name: "firstName", children: /* @__PURE__ */ t(ce, { id: "firstName", value: i.firstName, onChange: G, disabled: o, error: re, helperText: p.firstName, fullWidth: !0 }) }), e[42] = p.firstName, e[43] = i.firstName, e[44] = o, e[45] = G, e[46] = re, e[47] = J) : J = e[47];
|
|
343
|
+
let ie;
|
|
344
|
+
e[48] !== b ? (ie = (K) => b("lastName", K.target.value), e[48] = b, e[49] = ie) : ie = e[49];
|
|
345
|
+
const de = !!p.lastName;
|
|
346
|
+
let se;
|
|
347
|
+
e[50] !== p.lastName || e[51] !== i.lastName || e[52] !== o || e[53] !== ie || e[54] !== de ? (se = /* @__PURE__ */ t(S.ElementWrapper, { label: "Last Name (optional)", name: "lastName", children: /* @__PURE__ */ t(ce, { id: "lastName", value: i.lastName, onChange: ie, disabled: o, error: de, helperText: p.lastName, fullWidth: !0 }) }), e[50] = p.lastName, e[51] = i.lastName, e[52] = o, e[53] = ie, e[54] = de, e[55] = se) : se = e[55];
|
|
348
|
+
let oe;
|
|
349
|
+
e[56] !== b ? (oe = (K) => b("email", K.target.value), e[56] = b, e[57] = oe) : oe = e[57];
|
|
350
|
+
const ue = !!p.email;
|
|
351
|
+
let be;
|
|
352
|
+
e[58] !== p.email || e[59] !== i.email || e[60] !== o || e[61] !== oe || e[62] !== ue ? (be = /* @__PURE__ */ t(S.ElementWrapper, { label: "Email Address (optional)", name: "email", children: /* @__PURE__ */ t(ce, { id: "email", type: "email", value: i.email, onChange: oe, placeholder: "user@example.com", disabled: o, error: ue, helperText: p.email, fullWidth: !0 }) }), e[58] = p.email, e[59] = i.email, e[60] = o, e[61] = oe, e[62] = ue, e[63] = be) : be = e[63];
|
|
353
|
+
let me;
|
|
354
|
+
e[64] !== D || e[65] !== O || e[66] !== J || e[67] !== se || e[68] !== be ? (me = /* @__PURE__ */ t(S.Stack, { spacing: 3, children: /* @__PURE__ */ s(S.Section, { children: [
|
|
355
|
+
Z,
|
|
356
|
+
/* @__PURE__ */ s(S.Stack, { spacing: 2, children: [
|
|
357
|
+
D,
|
|
358
|
+
O,
|
|
359
|
+
J,
|
|
360
|
+
se,
|
|
361
|
+
be
|
|
362
|
+
] })
|
|
363
|
+
] }) }), e[64] = D, e[65] = O, e[66] = J, e[67] = se, e[68] = be, e[69] = me) : me = e[69];
|
|
364
|
+
const x = Y.length > 0;
|
|
365
|
+
let E;
|
|
366
|
+
e[70] !== Y ? (E = /* @__PURE__ */ t(ne, { severity: "error", children: Y.map(Sr) }), e[70] = Y, e[71] = E) : E = e[71];
|
|
367
|
+
let Q;
|
|
368
|
+
e[72] !== x || e[73] !== E ? (Q = /* @__PURE__ */ t(tt, { in: x, timeout: "auto", unmountOnExit: !0, children: E }), e[72] = x, e[73] = E, e[74] = Q) : Q = e[74];
|
|
369
|
+
let ve;
|
|
370
|
+
e[75] !== d || e[76] !== a ? (ve = () => d(a), e[75] = d, e[76] = a, e[77] = ve) : ve = e[77];
|
|
371
|
+
let Re;
|
|
372
|
+
e[78] !== o || e[79] !== ve ? (Re = /* @__PURE__ */ t(X, { variant: "outlined", color: "primary", onClick: ve, disabled: o, children: "Cancel" }), e[78] = o, e[79] = ve, e[80] = Re) : Re = e[80];
|
|
373
|
+
let Te;
|
|
374
|
+
e[81] === Symbol.for("react.memo_cache_sentinel") ? (Te = /* @__PURE__ */ t(Le, { size: 16 }), e[81] = Te) : Te = e[81];
|
|
375
|
+
let pe;
|
|
376
|
+
e[82] !== i.password || e[83] !== i.username || e[84] !== o ? (pe = o || !i.username.trim() || !i.password, e[82] = i.password, e[83] = i.username, e[84] = o, e[85] = pe) : pe = e[85];
|
|
377
|
+
let Pe;
|
|
378
|
+
e[86] !== j || e[87] !== pe ? (Pe = /* @__PURE__ */ t(X, { variant: "contained", color: "primary", startIcon: Te, onClick: j, disabled: pe, children: "Create User" }), e[86] = j, e[87] = pe, e[88] = Pe) : Pe = e[88];
|
|
379
|
+
let Ne;
|
|
380
|
+
e[89] !== Re || e[90] !== Pe ? (Ne = /* @__PURE__ */ s(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
381
|
+
Re,
|
|
382
|
+
Pe
|
|
383
|
+
] }), e[89] = Re, e[90] = Pe, e[91] = Ne) : Ne = e[91];
|
|
384
|
+
let Ae;
|
|
385
|
+
e[92] !== Q || e[93] !== Ne ? (Ae = /* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 3, children: [
|
|
386
|
+
Q,
|
|
387
|
+
Ne
|
|
388
|
+
] }), e[92] = Q, e[93] = Ne, e[94] = Ae) : Ae = e[94];
|
|
389
|
+
let _e;
|
|
390
|
+
return e[95] !== me || e[96] !== Ae || e[97] !== W ? (_e = /* @__PURE__ */ t(H, { children: /* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 2, children: [
|
|
391
|
+
W,
|
|
392
|
+
me,
|
|
393
|
+
Ae
|
|
394
|
+
] }) }), e[95] = me, e[96] = Ae, e[97] = W, e[98] = _e) : _e = e[98], _e;
|
|
395
|
+
};
|
|
396
|
+
function Sr(e, r) {
|
|
397
|
+
return /* @__PURE__ */ t(L, { children: e }, r);
|
|
398
|
+
}
|
|
399
|
+
const Fe = (e) => {
|
|
400
|
+
const r = Ie(5), {
|
|
401
|
+
to: d,
|
|
402
|
+
label: c
|
|
403
|
+
} = e;
|
|
404
|
+
let l, a;
|
|
405
|
+
r[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ t(Rt, { size: 16 }), a = {
|
|
406
|
+
mb: 2
|
|
407
|
+
}, r[0] = l, r[1] = a) : (l = r[0], a = r[1]);
|
|
408
|
+
let m;
|
|
409
|
+
return r[2] !== c || r[3] !== d ? (m = /* @__PURE__ */ t(X, { component: ut, to: d, variant: "text", startIcon: l, sx: a, children: c }), r[2] = c, r[3] = d, r[4] = m) : m = r[4], m;
|
|
410
|
+
}, ct = (e) => {
|
|
411
|
+
const r = Ie(9), {
|
|
412
|
+
tabs: d
|
|
413
|
+
} = e, c = d === void 0 ? 2 : d;
|
|
414
|
+
let l;
|
|
415
|
+
r[0] === Symbol.for("react.memo_cache_sentinel") ? (l = {
|
|
416
|
+
borderBottom: 1,
|
|
417
|
+
borderColor: "divider",
|
|
418
|
+
pb: 1.5
|
|
419
|
+
}, r[0] = l) : l = r[0];
|
|
420
|
+
let a;
|
|
421
|
+
r[1] !== c ? (a = /* @__PURE__ */ t(ae, { direction: "row", spacing: 3, sx: l, children: Array.from({
|
|
422
|
+
length: c
|
|
423
|
+
}).map(wr) }), r[1] = c, r[2] = a) : a = r[2];
|
|
424
|
+
let m, o, f;
|
|
425
|
+
r[3] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ t(Se, { variant: "text", width: "30%", height: 28 }), o = /* @__PURE__ */ t(Se, { variant: "text", width: "55%" }), f = /* @__PURE__ */ t(Se, { variant: "rounded", height: 40 }), r[3] = m, r[4] = o, r[5] = f) : (m = r[3], o = r[4], f = r[5]);
|
|
426
|
+
let g;
|
|
427
|
+
r[6] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ s(ae, { spacing: 1, children: [
|
|
428
|
+
/* @__PURE__ */ t(Se, { variant: "rounded", height: 56 }),
|
|
429
|
+
/* @__PURE__ */ t(Se, { variant: "rounded", height: 56 }),
|
|
430
|
+
/* @__PURE__ */ t(Se, { variant: "rounded", height: 56 })
|
|
431
|
+
] }), r[6] = g) : g = r[6];
|
|
432
|
+
let i;
|
|
433
|
+
return r[7] !== a ? (i = /* @__PURE__ */ s(S.Section, { children: [
|
|
434
|
+
a,
|
|
435
|
+
m,
|
|
436
|
+
o,
|
|
437
|
+
f,
|
|
438
|
+
g
|
|
439
|
+
] }), r[7] = a, r[8] = i) : i = r[8], i;
|
|
440
|
+
};
|
|
441
|
+
function wr(e, r) {
|
|
442
|
+
return /* @__PURE__ */ t(Se, { variant: "text", width: 72 }, r);
|
|
443
|
+
}
|
|
444
|
+
const xr = {
|
|
445
|
+
width: 48,
|
|
446
|
+
height: 48,
|
|
447
|
+
fontSize: 20
|
|
448
|
+
}, Pr = {
|
|
449
|
+
flex: 1,
|
|
450
|
+
minWidth: 0
|
|
451
|
+
}, Ir = {
|
|
452
|
+
fontFamily: "monospace"
|
|
453
|
+
}, dt = (e) => {
|
|
454
|
+
const r = Ie(19), {
|
|
455
|
+
fallback: d,
|
|
456
|
+
name: c,
|
|
457
|
+
subtitle: l,
|
|
458
|
+
id: a,
|
|
459
|
+
badge: m
|
|
460
|
+
} = e;
|
|
461
|
+
let o;
|
|
462
|
+
r[0] !== d || r[1] !== c ? (o = c.charAt(0).toUpperCase() || d, r[0] = d, r[1] = c, r[2] = o) : o = r[2];
|
|
463
|
+
let f;
|
|
464
|
+
r[3] !== o ? (f = /* @__PURE__ */ t(Ze, { sx: xr, children: o }), r[3] = o, r[4] = f) : f = r[4];
|
|
465
|
+
let g;
|
|
466
|
+
r[5] !== m || r[6] !== c ? (g = m ? /* @__PURE__ */ s(ae, { direction: "row", alignItems: "center", spacing: 1, children: [
|
|
467
|
+
/* @__PURE__ */ t(B, { variant: "h6", noWrap: !0, children: c }),
|
|
468
|
+
m
|
|
469
|
+
] }) : /* @__PURE__ */ t(B, { variant: "h6", noWrap: !0, children: c }), r[5] = m, r[6] = c, r[7] = g) : g = r[7];
|
|
470
|
+
let i;
|
|
471
|
+
r[8] !== l ? (i = l && /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", noWrap: !0, children: l }), r[8] = l, r[9] = i) : i = r[9];
|
|
472
|
+
let w;
|
|
473
|
+
r[10] !== a ? (w = /* @__PURE__ */ t(B, { variant: "caption", color: "text.disabled", sx: Ir, children: a }), r[10] = a, r[11] = w) : w = r[11];
|
|
474
|
+
let p;
|
|
475
|
+
r[12] !== g || r[13] !== i || r[14] !== w ? (p = /* @__PURE__ */ s(L, { sx: Pr, children: [
|
|
476
|
+
g,
|
|
477
|
+
i,
|
|
478
|
+
w
|
|
479
|
+
] }), r[12] = g, r[13] = i, r[14] = w, r[15] = p) : p = r[15];
|
|
480
|
+
let I;
|
|
481
|
+
return r[16] !== f || r[17] !== p ? (I = /* @__PURE__ */ t(S.Section, { children: /* @__PURE__ */ s(ae, { direction: "row", alignItems: "center", spacing: 2, children: [
|
|
482
|
+
f,
|
|
483
|
+
p
|
|
484
|
+
] }) }), r[16] = f, r[17] = p, r[18] = I) : I = r[18], I;
|
|
485
|
+
}, Rr = () => {
|
|
486
|
+
const {
|
|
487
|
+
orgId: e,
|
|
488
|
+
userId: r
|
|
489
|
+
} = fe(), d = xe(), [c, l] = R("groups"), {
|
|
490
|
+
data: a,
|
|
491
|
+
isLoading: m
|
|
492
|
+
} = Lt({
|
|
493
|
+
orgName: e,
|
|
494
|
+
userId: r ?? ""
|
|
495
|
+
}), {
|
|
496
|
+
data: o,
|
|
497
|
+
isLoading: f
|
|
498
|
+
} = Tt({
|
|
499
|
+
orgName: e,
|
|
500
|
+
userId: r ?? ""
|
|
501
|
+
}), {
|
|
502
|
+
data: g,
|
|
503
|
+
isLoading: i
|
|
504
|
+
} = _t({
|
|
505
|
+
orgName: e,
|
|
506
|
+
userId: r ?? ""
|
|
507
|
+
}), {
|
|
508
|
+
data: w,
|
|
509
|
+
isLoading: p
|
|
510
|
+
} = ft({
|
|
511
|
+
orgName: e
|
|
512
|
+
}), {
|
|
513
|
+
mutateAsync: I
|
|
514
|
+
} = bt(), {
|
|
515
|
+
mutateAsync: P
|
|
516
|
+
} = vt(), y = _(() => w?.groups ?? [], [w]), N = _(() => o?.groups ?? [], [o]), [U, F] = R([]), [T, C] = R(!1), [u, A] = R(), [b, M] = R(!1), j = yt(!1);
|
|
517
|
+
$e(() => {
|
|
518
|
+
j.current || F(N);
|
|
519
|
+
}, [N]);
|
|
520
|
+
const V = _(() => {
|
|
521
|
+
const D = new Set(N.map((k) => k.id));
|
|
522
|
+
return D.size !== U.length || U.some((k) => !D.has(k.id));
|
|
523
|
+
}, [N, U]), Y = e ? q(he.children.org.children.settings.children.identities.children.users.path, {
|
|
524
|
+
orgId: e
|
|
525
|
+
}) : "#", W = String(a?.attributes?.username ?? r ?? ""), Z = async () => {
|
|
526
|
+
if (!(!e || !r)) {
|
|
527
|
+
A(void 0), M(!1), C(!0);
|
|
528
|
+
try {
|
|
529
|
+
const D = new Set(N.map((G) => G.id)), k = new Set(U.map((G) => G.id)), te = U.filter((G) => !D.has(G.id)), O = N.filter((G) => !k.has(G.id));
|
|
530
|
+
for (const G of te)
|
|
531
|
+
await I({
|
|
532
|
+
params: {
|
|
533
|
+
orgName: e,
|
|
534
|
+
groupId: G.id
|
|
535
|
+
},
|
|
536
|
+
body: {
|
|
537
|
+
userIds: [r]
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
for (const G of O)
|
|
541
|
+
await P({
|
|
542
|
+
params: {
|
|
543
|
+
orgName: e,
|
|
544
|
+
groupId: G.id
|
|
545
|
+
},
|
|
546
|
+
body: {
|
|
547
|
+
userIds: [r]
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
M(!0), j.current = !1;
|
|
551
|
+
} catch {
|
|
552
|
+
A("Failed to update group memberships. Please try again.");
|
|
553
|
+
} finally {
|
|
554
|
+
C(!1);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
if (m || f || p || i)
|
|
559
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
560
|
+
/* @__PURE__ */ t(Fe, { to: Y, label: "Users" }),
|
|
561
|
+
/* @__PURE__ */ t(ct, { tabs: 2 })
|
|
562
|
+
] });
|
|
563
|
+
const $ = g?.roles ?? [];
|
|
564
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
565
|
+
/* @__PURE__ */ t(Fe, { to: Y, label: "Users" }),
|
|
566
|
+
/* @__PURE__ */ s(ae, { spacing: 3, children: [
|
|
567
|
+
/* @__PURE__ */ t(dt, { fallback: "U", name: W, subtitle: a?.attributes?.email || void 0, id: r ?? "" }),
|
|
568
|
+
u != null && /* @__PURE__ */ t(ne, { severity: "error", children: u }),
|
|
569
|
+
b && /* @__PURE__ */ t(ne, { severity: "success", children: "User updated successfully." }),
|
|
570
|
+
/* @__PURE__ */ s(S.Section, { children: [
|
|
571
|
+
/* @__PURE__ */ s(ot, { value: c, onChange: (D, k) => l(k), sx: {
|
|
572
|
+
borderBottom: 1,
|
|
573
|
+
borderColor: "divider"
|
|
574
|
+
}, children: [
|
|
575
|
+
/* @__PURE__ */ t(Ee, { label: "Groups", value: "groups" }),
|
|
576
|
+
/* @__PURE__ */ t(Ee, { label: "Roles", value: "roles" })
|
|
577
|
+
] }),
|
|
578
|
+
c === "groups" && /* @__PURE__ */ s(H, { children: [
|
|
579
|
+
/* @__PURE__ */ t(S.Header, { children: "Group Memberships" }),
|
|
580
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "Search and select groups to assign this user to." }),
|
|
581
|
+
/* @__PURE__ */ s(S.Stack, { spacing: 2, sx: {
|
|
582
|
+
mt: 1
|
|
583
|
+
}, children: [
|
|
584
|
+
/* @__PURE__ */ t(S.ElementWrapper, { label: "Groups", name: "groups", children: /* @__PURE__ */ t(Oe, { id: "groups", multiple: !0, options: y, value: U, onChange: (D, k) => {
|
|
585
|
+
j.current = !0, F(k);
|
|
586
|
+
}, getOptionLabel: (D) => D.name, isOptionEqualToValue: (D, k) => D.id === k.id, renderTags: () => null, renderInput: (D) => /* @__PURE__ */ t(ce, { ...D, placeholder: "Search groups..." }), noOptionsText: "No groups found" }) }),
|
|
587
|
+
U.length > 0 && /* @__PURE__ */ t(ae, { direction: "row", flexWrap: "wrap", gap: 1, children: U.map((D) => /* @__PURE__ */ t(Je, { label: D.name, size: "small", onDelete: () => {
|
|
588
|
+
j.current = !0, F((k) => k.filter((te) => te.id !== D.id));
|
|
589
|
+
} }, D.id)) })
|
|
590
|
+
] })
|
|
591
|
+
] }),
|
|
592
|
+
c === "roles" && /* @__PURE__ */ s(H, { children: [
|
|
593
|
+
/* @__PURE__ */ t(S.Header, { children: "Assigned Roles" }),
|
|
594
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "Roles directly assigned to this user. To modify role assignments, use the Roles page." }),
|
|
595
|
+
/* @__PURE__ */ t(L, { sx: {
|
|
596
|
+
mt: 1
|
|
597
|
+
}, children: $.length === 0 ? /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "No roles assigned to this user." }) : /* @__PURE__ */ t(ae, { direction: "row", flexWrap: "wrap", gap: 1, children: $.map((D) => /* @__PURE__ */ t(Je, { label: D.name, size: "small" }, D.id)) }) })
|
|
598
|
+
] })
|
|
599
|
+
] }),
|
|
600
|
+
c === "groups" && V && /* @__PURE__ */ s(ae, { direction: "row", spacing: 1, children: [
|
|
601
|
+
/* @__PURE__ */ t(X, { variant: "outlined", onClick: () => d(Y), disabled: T, children: "Cancel" }),
|
|
602
|
+
/* @__PURE__ */ t(X, { variant: "contained", onClick: Z, disabled: T, children: T ? "Saving..." : "Save Changes" })
|
|
603
|
+
] })
|
|
604
|
+
] })
|
|
605
|
+
] });
|
|
606
|
+
}, Nr = {
|
|
607
|
+
width: 28,
|
|
608
|
+
height: 28,
|
|
609
|
+
fontSize: 12
|
|
610
|
+
}, Ar = () => {
|
|
611
|
+
const {
|
|
612
|
+
orgId: e
|
|
613
|
+
} = fe(), r = xe(), d = Ve.featureFlags?.enableUserManagement === !0, [c, l] = R(0), [a, m] = R(10), [o, f] = R(""), {
|
|
614
|
+
data: g,
|
|
615
|
+
isLoading: i,
|
|
616
|
+
error: w
|
|
617
|
+
} = zt({
|
|
618
|
+
orgName: e
|
|
619
|
+
}, {
|
|
620
|
+
offset: c * a,
|
|
621
|
+
limit: a
|
|
622
|
+
}), {
|
|
623
|
+
mutateAsync: p
|
|
624
|
+
} = Ft(), {
|
|
625
|
+
addConfirmation: I
|
|
626
|
+
} = at(), P = _(() => g?.roles ?? [], [g]), y = g?.total ?? 0;
|
|
627
|
+
$e(() => {
|
|
628
|
+
if (P.length === 0 && y > 0) {
|
|
629
|
+
const u = Math.max(0, Math.ceil(y / a) - 1);
|
|
630
|
+
c !== u && l(u);
|
|
631
|
+
}
|
|
632
|
+
}, [P.length, y, c, a]);
|
|
633
|
+
const N = he.children.org.children.settings.children.identities.children.roles.path, U = e ? q(N + "/create", {
|
|
634
|
+
orgId: e
|
|
635
|
+
}) : "#", F = (u) => e ? q(N + "/:roleId", {
|
|
636
|
+
orgId: e,
|
|
637
|
+
roleId: u
|
|
638
|
+
}) : "#", T = _(() => {
|
|
639
|
+
if (!o) return P;
|
|
640
|
+
const u = o.toLowerCase();
|
|
641
|
+
return P.filter((A) => A.name.toLowerCase().includes(u) || (A.description ?? "").toLowerCase().includes(u));
|
|
642
|
+
}, [P, o]), C = (u) => {
|
|
643
|
+
I({
|
|
644
|
+
title: "Delete Role",
|
|
645
|
+
description: `Are you sure you want to delete "${u.name}"? This action cannot be undone.`,
|
|
646
|
+
confirmButtonText: "Delete",
|
|
647
|
+
confirmButtonColor: "error",
|
|
648
|
+
confirmButtonIcon: /* @__PURE__ */ t(we, { size: 16 }),
|
|
649
|
+
onConfirm: () => p({
|
|
650
|
+
orgName: e,
|
|
651
|
+
roleId: u.id
|
|
652
|
+
})
|
|
653
|
+
});
|
|
654
|
+
};
|
|
655
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
656
|
+
w != null && /* @__PURE__ */ t(ne, { severity: "error", sx: {
|
|
657
|
+
mb: 2
|
|
658
|
+
}, children: "Failed to load roles" }),
|
|
659
|
+
/* @__PURE__ */ t(n.Provider, { searchValue: o, onSearchChange: f, children: /* @__PURE__ */ s(n.Container, { children: [
|
|
660
|
+
/* @__PURE__ */ t(n.Toolbar, { showSearch: !0, searchPlaceholder: "Search roles...", actions: /* @__PURE__ */ t(X, { variant: "contained", startIcon: /* @__PURE__ */ t(Le, {}), onClick: () => r(U), disabled: !d, children: "Create Role" }) }),
|
|
661
|
+
!i && y === 0 ? /* @__PURE__ */ t(n.EmptyState, { illustration: /* @__PURE__ */ t(it, { size: 64 }), title: "No roles yet", description: 'Click "Create Role" to add one.' }) : !i && T.length === 0 ? /* @__PURE__ */ t(n.EmptyState, { illustration: /* @__PURE__ */ t(it, { size: 64 }), title: "No roles found", description: `No roles match "${o}". Try a different search term.` }) : /* @__PURE__ */ s(n, { variant: "table", children: [
|
|
662
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
663
|
+
/* @__PURE__ */ t(n.Cell, { children: "Name" }),
|
|
664
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", width: "80px" })
|
|
665
|
+
] }) }),
|
|
666
|
+
/* @__PURE__ */ s(n.Body, { children: [
|
|
667
|
+
i && /* @__PURE__ */ t(lt, { rows: a, columns: 1 }),
|
|
668
|
+
!i && T.map((u) => /* @__PURE__ */ s(n.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => r(F(u.id)), children: [
|
|
669
|
+
/* @__PURE__ */ t(n.Cell, { children: /* @__PURE__ */ t(n.CellIcon, { icon: /* @__PURE__ */ t(Ze, { sx: Nr, children: u.name.charAt(0).toUpperCase() || "R" }), primary: u.name, secondary: u.description ?? void 0 }) }),
|
|
670
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", children: /* @__PURE__ */ t(n.RowActions, { visibility: "hover", children: !u.isReadOnly && /* @__PURE__ */ t(De, { title: "Delete role", children: /* @__PURE__ */ t(ke, { size: "small", color: "error", onClick: (A) => {
|
|
671
|
+
A.stopPropagation(), C(u);
|
|
672
|
+
}, children: /* @__PURE__ */ t(we, { size: 16 }) }) }) }) })
|
|
673
|
+
] }, u.id))
|
|
674
|
+
] })
|
|
675
|
+
] }),
|
|
676
|
+
!i && y >= 5 && /* @__PURE__ */ t(et, { component: "div", count: y, page: c, rowsPerPage: a, onPageChange: (u, A) => l(A), onRowsPerPageChange: (u) => {
|
|
677
|
+
m(parseInt(u.target.value, 10)), l(0);
|
|
678
|
+
}, rowsPerPageOptions: [5, 10, 25, 50] })
|
|
679
|
+
] }) })
|
|
680
|
+
] });
|
|
681
|
+
}, Ur = () => {
|
|
682
|
+
const {
|
|
683
|
+
orgId: e
|
|
684
|
+
} = fe(), r = xe(), [d, c] = R({
|
|
685
|
+
name: "",
|
|
686
|
+
description: ""
|
|
687
|
+
}), {
|
|
688
|
+
errors: l,
|
|
689
|
+
validateField: a,
|
|
690
|
+
validateForm: m,
|
|
691
|
+
clearErrors: o,
|
|
692
|
+
setFieldError: f
|
|
693
|
+
} = Ke(pr), {
|
|
694
|
+
checkDirty: g,
|
|
695
|
+
resetDirty: i
|
|
696
|
+
} = Qe(d), [w, p] = R({}), {
|
|
697
|
+
mutateAsync: I,
|
|
698
|
+
isPending: P,
|
|
699
|
+
error: y
|
|
700
|
+
} = Wt(), N = e ? q(he.children.org.children.settings.children.identities.children.roles.path, {
|
|
701
|
+
orgId: e
|
|
702
|
+
}) : "#", U = Ye((C, u) => {
|
|
703
|
+
const A = {
|
|
704
|
+
...d,
|
|
705
|
+
[C]: u
|
|
706
|
+
};
|
|
707
|
+
c(A), g(A), f(C, a(C, u));
|
|
708
|
+
}, [d, g, a, f]), F = Ye(async () => {
|
|
709
|
+
if (!m(d)) {
|
|
710
|
+
p(l);
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
p({});
|
|
714
|
+
try {
|
|
715
|
+
const C = await I({
|
|
716
|
+
params: {
|
|
717
|
+
orgName: e
|
|
718
|
+
},
|
|
719
|
+
body: {
|
|
720
|
+
name: d.name.trim(),
|
|
721
|
+
description: d.description?.trim() || void 0
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
i(), o(), r(q(he.children.org.children.settings.children.identities.children.roles.children.detail.path, {
|
|
725
|
+
orgId: e,
|
|
726
|
+
roleId: C.id
|
|
727
|
+
}));
|
|
728
|
+
} catch {
|
|
729
|
+
}
|
|
730
|
+
}, [d, m, l, I, e, i, o, r]), T = Object.values(w);
|
|
731
|
+
return /* @__PURE__ */ t(H, { children: /* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 2, children: [
|
|
732
|
+
y != null && /* @__PURE__ */ t(ne, { severity: "error", children: y?.message ?? "Failed to create role" }),
|
|
733
|
+
/* @__PURE__ */ t(S.Stack, { spacing: 3, children: /* @__PURE__ */ s(S.Section, { children: [
|
|
734
|
+
/* @__PURE__ */ t(S.Subheader, { children: "Role Details" }),
|
|
735
|
+
/* @__PURE__ */ s(S.Stack, { spacing: 2, children: [
|
|
736
|
+
/* @__PURE__ */ t(S.ElementWrapper, { label: "Name", name: "name", children: /* @__PURE__ */ t(ce, { id: "name", value: d.name, onChange: (C) => U("name", C.target.value), placeholder: "admin", autoComplete: "off", error: !!l.name, helperText: l.name, fullWidth: !0 }) }),
|
|
737
|
+
/* @__PURE__ */ t(S.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ t(ce, { id: "description", value: d.description, onChange: (C) => U("description", C.target.value), placeholder: "Describe the role's purpose and permissions", multiline: !0, minRows: 2, maxRows: 6, error: !!l.description, helperText: l.description, fullWidth: !0 }) })
|
|
738
|
+
] })
|
|
739
|
+
] }) }),
|
|
740
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 3, children: [
|
|
741
|
+
/* @__PURE__ */ t(tt, { in: T.length > 0, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ t(ne, { severity: "error", children: T.map((C, u) => /* @__PURE__ */ t(L, { children: C }, u)) }) }),
|
|
742
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
743
|
+
/* @__PURE__ */ t(X, { variant: "outlined", color: "primary", onClick: () => r(N), children: "Cancel" }),
|
|
744
|
+
/* @__PURE__ */ t(X, { variant: "contained", color: "primary", startIcon: /* @__PURE__ */ t(Le, { size: 16 }), onClick: F, disabled: P || !d.name.trim(), children: "Create Role" })
|
|
745
|
+
] })
|
|
746
|
+
] })
|
|
747
|
+
] }) });
|
|
748
|
+
}, qe = (e) => e.actionName || e.name.split(":")[1] || e.name, Be = (e) => e.resourceName || e.name.split(":")[0], Dr = (e) => {
|
|
749
|
+
const r = /* @__PURE__ */ new Map();
|
|
750
|
+
for (const d of e) {
|
|
751
|
+
const c = Be(d);
|
|
752
|
+
r.has(c) || r.set(c, []), r.get(c).push(d);
|
|
753
|
+
}
|
|
754
|
+
return [...r.entries()].sort(([d], [c]) => d.localeCompare(c)).map(([d, c]) => ({
|
|
755
|
+
resource: d,
|
|
756
|
+
permissions: c
|
|
757
|
+
}));
|
|
758
|
+
}, kr = nr({
|
|
759
|
+
stringify: (e) => {
|
|
760
|
+
const r = Be(e), d = qe(e);
|
|
761
|
+
return `${r} ${d}`;
|
|
762
|
+
}
|
|
763
|
+
}), Gr = () => {
|
|
764
|
+
const {
|
|
765
|
+
orgId: e,
|
|
766
|
+
roleId: r
|
|
767
|
+
} = fe(), d = xe(), [c, l] = R("permissions"), [a, m] = R(!1), [o, f] = R(), [g, i] = R(!1), {
|
|
768
|
+
data: w,
|
|
769
|
+
isLoading: p
|
|
770
|
+
} = Mt({
|
|
771
|
+
orgName: e,
|
|
772
|
+
roleId: r ?? ""
|
|
773
|
+
}), I = w?.isReadOnly ?? !1, {
|
|
774
|
+
data: P,
|
|
775
|
+
isLoading: y
|
|
776
|
+
} = Ot({
|
|
777
|
+
orgName: e,
|
|
778
|
+
roleId: r ?? ""
|
|
779
|
+
}), {
|
|
780
|
+
data: N,
|
|
781
|
+
isLoading: U
|
|
782
|
+
} = Bt({
|
|
783
|
+
orgName: e
|
|
784
|
+
}), {
|
|
785
|
+
data: F,
|
|
786
|
+
isLoading: T
|
|
787
|
+
} = ft({
|
|
788
|
+
orgName: e
|
|
789
|
+
}), {
|
|
790
|
+
data: C,
|
|
791
|
+
isLoading: u
|
|
792
|
+
} = Vt({
|
|
793
|
+
orgName: e
|
|
794
|
+
}), {
|
|
795
|
+
mutateAsync: A
|
|
796
|
+
} = $t(), {
|
|
797
|
+
mutateAsync: b
|
|
798
|
+
} = Ht(), {
|
|
799
|
+
mutateAsync: M
|
|
800
|
+
} = Xt(), {
|
|
801
|
+
mutateAsync: j
|
|
802
|
+
} = qt(), V = _(() => P?.users ?? [], [P]), Y = _(() => P?.groups ?? [], [P]), W = _(() => w?.permissions?.flatMap((h) => h.permissions) ?? [], [w]), Z = _(() => N?.users ?? [], [N]), ee = _(() => F?.groups ?? [], [F]), $ = _(() => C?.permissions ?? [], [C]), D = C?.resourceServerId ?? "", [k, te] = R([]), [O, G] = R(/* @__PURE__ */ new Set()), [re, J] = R([]), [ie, de] = R(/* @__PURE__ */ new Set()), [se, oe] = R([]), ue = yt(!1);
|
|
803
|
+
$e(() => {
|
|
804
|
+
if (!ue.current && $.length > 0) {
|
|
805
|
+
const h = new Set(W);
|
|
806
|
+
oe($.filter((v) => h.has(v.name)));
|
|
807
|
+
}
|
|
808
|
+
}, [W, $]);
|
|
809
|
+
const be = e ? q(he.children.org.children.settings.children.identities.children.roles.path, {
|
|
810
|
+
orgId: e
|
|
811
|
+
}) : "#", me = _(() => [...V.filter((v) => !O.has(v.id)), ...k], [V, k, O]), x = _(() => [...Y.filter((v) => !ie.has(v.id)), ...re], [Y, re, ie]), E = _(() => new Set(me.map((h) => h.id)), [me]), Q = _(() => new Set(x.map((h) => h.id)), [x]), ve = _(() => Z.filter((h) => !E.has(h.id)), [Z, E]), Re = _(() => ee.filter((h) => !Q.has(h.id)), [ee, Q]), Te = _(() => Dr($), [$]), pe = _(() => new Set(se.map((h) => h.name)), [se]), Pe = (h) => String(h.attributes?.username ?? h.id ?? ""), Ne = (h, v) => {
|
|
812
|
+
v && (O.has(v.id) ? G((z) => {
|
|
813
|
+
const Ce = new Set(z);
|
|
814
|
+
return Ce.delete(v.id), Ce;
|
|
815
|
+
}) : te((z) => [...z, v]));
|
|
816
|
+
}, Ae = (h) => {
|
|
817
|
+
k.find((v) => v.id === h) ? te((v) => v.filter((z) => z.id !== h)) : G((v) => /* @__PURE__ */ new Set([...v, h]));
|
|
818
|
+
}, _e = (h, v) => {
|
|
819
|
+
v && (ie.has(v.id) ? de((z) => {
|
|
820
|
+
const Ce = new Set(z);
|
|
821
|
+
return Ce.delete(v.id), Ce;
|
|
822
|
+
}) : J((z) => [...z, v]));
|
|
823
|
+
}, K = (h) => {
|
|
824
|
+
re.find((v) => v.id === h) ? J((v) => v.filter((z) => z.id !== h)) : de((v) => /* @__PURE__ */ new Set([...v, h]));
|
|
825
|
+
}, He = (h, v) => {
|
|
826
|
+
ue.current = !0, oe(v);
|
|
827
|
+
}, Xe = (h) => {
|
|
828
|
+
ue.current = !0, oe((v) => v.filter((z) => z.name !== h));
|
|
829
|
+
}, Ct = async () => {
|
|
830
|
+
if (!(!e || !r)) {
|
|
831
|
+
f(void 0), i(!1), m(!0);
|
|
832
|
+
try {
|
|
833
|
+
const h = {
|
|
834
|
+
orgName: e,
|
|
835
|
+
roleId: r
|
|
836
|
+
}, v = k.map((Ge) => Ge.id), z = [...O];
|
|
837
|
+
v.length > 0 && await A({
|
|
838
|
+
params: h,
|
|
839
|
+
body: {
|
|
840
|
+
userIds: v
|
|
841
|
+
}
|
|
842
|
+
}), z.length > 0 && await b({
|
|
843
|
+
params: h,
|
|
844
|
+
body: {
|
|
845
|
+
userIds: z
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
const Ce = re.map((Ge) => Ge.id), We = [...ie];
|
|
849
|
+
if (Ce.length > 0 && await A({
|
|
850
|
+
params: h,
|
|
851
|
+
body: {
|
|
852
|
+
groupIds: Ce
|
|
853
|
+
}
|
|
854
|
+
}), We.length > 0 && await b({
|
|
855
|
+
params: h,
|
|
856
|
+
body: {
|
|
857
|
+
groupIds: We
|
|
858
|
+
}
|
|
859
|
+
}), ue.current && D && !I) {
|
|
860
|
+
const Ge = new Set(W), ge = new Set(se.map((Me) => Me.name)), ze = [...ge].filter((Me) => !Ge.has(Me)), Ue = [...Ge].filter((Me) => !ge.has(Me));
|
|
861
|
+
ze.length > 0 && await M({
|
|
862
|
+
params: h,
|
|
863
|
+
body: {
|
|
864
|
+
resourceServerId: D,
|
|
865
|
+
permissions: ze
|
|
866
|
+
}
|
|
867
|
+
}), Ue.length > 0 && await j({
|
|
868
|
+
params: h,
|
|
869
|
+
body: {
|
|
870
|
+
resourceServerId: D,
|
|
871
|
+
permissions: Ue
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
i(!0), te([]), G(/* @__PURE__ */ new Set()), J([]), de(/* @__PURE__ */ new Set()), ue.current = !1;
|
|
876
|
+
} catch {
|
|
877
|
+
f("Failed to update role. Please try again.");
|
|
878
|
+
} finally {
|
|
879
|
+
m(!1);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}, St = p || y || U || T || u, wt = _(() => {
|
|
883
|
+
if (I) return !1;
|
|
884
|
+
const h = new Set(W);
|
|
885
|
+
return h.size !== se.length || se.some((v) => !h.has(v.name));
|
|
886
|
+
}, [I, W, se]) || k.length > 0 || O.size > 0 || re.length > 0 || ie.size > 0;
|
|
887
|
+
return St ? /* @__PURE__ */ s(H, { children: [
|
|
888
|
+
/* @__PURE__ */ t(Fe, { to: be, label: "Roles" }),
|
|
889
|
+
/* @__PURE__ */ t(ct, { tabs: 3 })
|
|
890
|
+
] }) : /* @__PURE__ */ s(H, { children: [
|
|
891
|
+
/* @__PURE__ */ t(Fe, { to: be, label: "Roles" }),
|
|
892
|
+
/* @__PURE__ */ s(ae, { spacing: 3, children: [
|
|
893
|
+
/* @__PURE__ */ t(dt, { fallback: "R", name: w?.name ?? "", subtitle: w?.description, id: r ?? "", badge: I ? /* @__PURE__ */ t(Je, { label: "Read-only", size: "small" }) : void 0 }),
|
|
894
|
+
o != null && /* @__PURE__ */ t(ne, { severity: "error", children: o }),
|
|
895
|
+
g && /* @__PURE__ */ t(ne, { severity: "success", children: "Role updated successfully." }),
|
|
896
|
+
/* @__PURE__ */ s(S.Section, { children: [
|
|
897
|
+
/* @__PURE__ */ s(ot, { value: c, onChange: (h, v) => l(v), sx: {
|
|
898
|
+
borderBottom: 1,
|
|
899
|
+
borderColor: "divider"
|
|
900
|
+
}, children: [
|
|
901
|
+
/* @__PURE__ */ t(Ee, { label: "Permissions", value: "permissions" }),
|
|
902
|
+
/* @__PURE__ */ t(Ee, { label: "Users", value: "users" }),
|
|
903
|
+
/* @__PURE__ */ t(Ee, { label: "Groups", value: "groups" })
|
|
904
|
+
] }),
|
|
905
|
+
c === "permissions" && /* @__PURE__ */ s(H, { children: [
|
|
906
|
+
/* @__PURE__ */ t(S.Header, { children: "Permissions" }),
|
|
907
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: I ? "Permissions for predefined roles cannot be modified." : "Search and select permissions to assign to this role." }),
|
|
908
|
+
/* @__PURE__ */ s(L, { sx: {
|
|
909
|
+
mt: 1
|
|
910
|
+
}, children: [
|
|
911
|
+
!I && /* @__PURE__ */ t(S.ElementWrapper, { label: "Add permissions", name: "addPermissions", children: /* @__PURE__ */ t(Oe, { id: "addPermissions", multiple: !0, disableCloseOnSelect: !0, options: $, value: se, onChange: He, getOptionLabel: (h) => qe(h), groupBy: (h) => Be(h), filterOptions: kr, isOptionEqualToValue: (h, v) => h.name === v.name, renderTags: () => null, renderGroup: (h) => {
|
|
912
|
+
const v = $.filter((ge) => Be(ge) === h.group), z = v.every((ge) => pe.has(ge.name)), Ce = v.some((ge) => pe.has(ge.name)), We = (ge) => {
|
|
913
|
+
if (ge.stopPropagation(), ue.current = !0, z)
|
|
914
|
+
oe((ze) => ze.filter((Ue) => Be(Ue) !== h.group));
|
|
915
|
+
else {
|
|
916
|
+
const ze = v.filter((Ue) => !pe.has(Ue.name));
|
|
917
|
+
oe((Ue) => [...Ue, ...ze]);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
return /* @__PURE__ */ s("li", { children: [
|
|
921
|
+
/* @__PURE__ */ s(L, { sx: {
|
|
922
|
+
display: "flex",
|
|
923
|
+
alignItems: "center",
|
|
924
|
+
px: 1,
|
|
925
|
+
py: 0.25,
|
|
926
|
+
cursor: "pointer",
|
|
927
|
+
userSelect: "none",
|
|
928
|
+
"&:hover": {
|
|
929
|
+
bgcolor: "action.hover"
|
|
930
|
+
}
|
|
931
|
+
}, onClick: We, children: [
|
|
932
|
+
/* @__PURE__ */ t(ht, { checked: z, indeterminate: Ce && !z, size: "small", sx: {
|
|
933
|
+
mr: 0.5,
|
|
934
|
+
p: 0.5
|
|
935
|
+
}, onClick: (ge) => ge.stopPropagation(), onChange: We }),
|
|
936
|
+
/* @__PURE__ */ t(B, { variant: "caption", fontWeight: 700, sx: {
|
|
937
|
+
textTransform: "uppercase",
|
|
938
|
+
letterSpacing: 0.5
|
|
939
|
+
}, children: h.group })
|
|
940
|
+
] }),
|
|
941
|
+
/* @__PURE__ */ t("ul", { style: {
|
|
942
|
+
padding: 0
|
|
943
|
+
}, children: h.children })
|
|
944
|
+
] }, h.key);
|
|
945
|
+
}, renderOption: (h, v, {
|
|
946
|
+
selected: z
|
|
947
|
+
}) => /* @__PURE__ */ s("li", { ...h, children: [
|
|
948
|
+
/* @__PURE__ */ t(ht, { checked: z, size: "small", sx: {
|
|
949
|
+
mr: 1
|
|
950
|
+
} }),
|
|
951
|
+
qe(v)
|
|
952
|
+
] }), renderInput: (h) => /* @__PURE__ */ t(ce, { ...h, placeholder: "Search by resource or action..." }), noOptionsText: "No permissions available", sx: {
|
|
953
|
+
mb: 3
|
|
954
|
+
} }) }),
|
|
955
|
+
se.length === 0 ? /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "No permissions assigned yet." }) : /* @__PURE__ */ t(ae, { spacing: 2, children: Te.filter(({
|
|
956
|
+
permissions: h
|
|
957
|
+
}) => h.some((v) => pe.has(v.name))).map(({
|
|
958
|
+
resource: h,
|
|
959
|
+
permissions: v
|
|
960
|
+
}) => /* @__PURE__ */ s(L, { children: [
|
|
961
|
+
/* @__PURE__ */ t(B, { variant: "caption", fontWeight: 600, color: "text.secondary", sx: {
|
|
962
|
+
textTransform: "uppercase",
|
|
963
|
+
letterSpacing: 0.5
|
|
964
|
+
}, children: h }),
|
|
965
|
+
/* @__PURE__ */ t(ae, { direction: "row", flexWrap: "wrap", gap: 1, mt: 0.5, children: v.filter((z) => pe.has(z.name)).map((z) => /* @__PURE__ */ t(Je, { label: qe(z), size: "small", onDelete: I ? void 0 : () => Xe(z.name) }, z.name)) })
|
|
966
|
+
] }, h)) })
|
|
967
|
+
] })
|
|
968
|
+
] }),
|
|
969
|
+
c === "users" && /* @__PURE__ */ s(H, { children: [
|
|
970
|
+
/* @__PURE__ */ t(S.Header, { children: "Assigned Users" }),
|
|
971
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "Search and add users to this role." }),
|
|
972
|
+
/* @__PURE__ */ t(L, { sx: {
|
|
973
|
+
mt: 1,
|
|
974
|
+
mb: 2
|
|
975
|
+
}, children: /* @__PURE__ */ t(S.ElementWrapper, { label: "Add User", name: "addUser", children: /* @__PURE__ */ t(Oe, { id: "addUser", options: ve, getOptionLabel: (h) => Pe(h), onChange: Ne, value: null, renderInput: (h) => /* @__PURE__ */ t(ce, { ...h, placeholder: "Search users..." }), noOptionsText: "No users available" }) }) }),
|
|
976
|
+
me.length === 0 ? /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "No users assigned yet. Search and add users above." }) : /* @__PURE__ */ t(n.Container, { children: /* @__PURE__ */ s(n, { children: [
|
|
977
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
978
|
+
/* @__PURE__ */ t(n.Cell, { children: "Username" }),
|
|
979
|
+
/* @__PURE__ */ t(n.Cell, { children: "User ID" }),
|
|
980
|
+
/* @__PURE__ */ t(n.Cell, {})
|
|
981
|
+
] }) }),
|
|
982
|
+
/* @__PURE__ */ t(n.Body, { children: me.map((h) => /* @__PURE__ */ s(n.Row, { children: [
|
|
983
|
+
/* @__PURE__ */ t(n.Cell, { children: Pe(h) }),
|
|
984
|
+
/* @__PURE__ */ t(n.Cell, { children: h.id }),
|
|
985
|
+
/* @__PURE__ */ t(n.Cell, { align: "right", children: /* @__PURE__ */ t(De, { title: "Remove from role", children: /* @__PURE__ */ t(ke, { size: "small", onClick: () => Ae(h.id), children: /* @__PURE__ */ t(we, { size: 16 }) }) }) })
|
|
986
|
+
] }, h.id)) })
|
|
987
|
+
] }) })
|
|
988
|
+
] }),
|
|
989
|
+
c === "groups" && /* @__PURE__ */ s(H, { children: [
|
|
990
|
+
/* @__PURE__ */ t(S.Header, { children: "Assigned Groups" }),
|
|
991
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "Search and add groups to this role." }),
|
|
992
|
+
/* @__PURE__ */ t(L, { sx: {
|
|
993
|
+
mt: 1,
|
|
994
|
+
mb: 2
|
|
995
|
+
}, children: /* @__PURE__ */ t(S.ElementWrapper, { label: "Add Group", name: "addGroup", children: /* @__PURE__ */ t(Oe, { id: "addGroup", options: Re, getOptionLabel: (h) => h.name, onChange: _e, value: null, renderInput: (h) => /* @__PURE__ */ t(ce, { ...h, placeholder: "Search groups..." }), noOptionsText: "No groups available" }) }) }),
|
|
996
|
+
x.length === 0 ? /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "No groups assigned yet. Search and add groups above." }) : /* @__PURE__ */ t(n.Container, { children: /* @__PURE__ */ s(n, { children: [
|
|
997
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
998
|
+
/* @__PURE__ */ t(n.Cell, { children: "Name" }),
|
|
999
|
+
/* @__PURE__ */ t(n.Cell, { children: "Description" }),
|
|
1000
|
+
/* @__PURE__ */ t(n.Cell, {})
|
|
1001
|
+
] }) }),
|
|
1002
|
+
/* @__PURE__ */ t(n.Body, { children: x.map((h) => /* @__PURE__ */ s(n.Row, { children: [
|
|
1003
|
+
/* @__PURE__ */ t(n.Cell, { children: h.name }),
|
|
1004
|
+
/* @__PURE__ */ t(n.Cell, { children: h.description ?? "-" }),
|
|
1005
|
+
/* @__PURE__ */ t(n.Cell, { align: "right", children: /* @__PURE__ */ t(De, { title: "Remove from role", children: /* @__PURE__ */ t(ke, { size: "small", onClick: () => K(h.id), children: /* @__PURE__ */ t(we, { size: 16 }) }) }) })
|
|
1006
|
+
] }, h.id)) })
|
|
1007
|
+
] }) })
|
|
1008
|
+
] })
|
|
1009
|
+
] }),
|
|
1010
|
+
wt && /* @__PURE__ */ s(ae, { direction: "row", spacing: 1, children: [
|
|
1011
|
+
/* @__PURE__ */ t(X, { variant: "outlined", onClick: () => d(be), disabled: a, children: "Cancel" }),
|
|
1012
|
+
/* @__PURE__ */ t(X, { variant: "contained", onClick: Ct, disabled: a, children: a ? "Saving..." : "Save Changes" })
|
|
1013
|
+
] })
|
|
1014
|
+
] })
|
|
1015
|
+
] });
|
|
1016
|
+
}, Er = {
|
|
1017
|
+
width: 28,
|
|
1018
|
+
height: 28,
|
|
1019
|
+
fontSize: 12
|
|
1020
|
+
}, Lr = () => {
|
|
1021
|
+
const {
|
|
1022
|
+
orgId: e
|
|
1023
|
+
} = fe(), r = xe(), d = Ve.featureFlags?.enableUserManagement === !0, [c, l] = R(0), [a, m] = R(10), [o, f] = R(""), {
|
|
1024
|
+
data: g,
|
|
1025
|
+
isLoading: i,
|
|
1026
|
+
error: w
|
|
1027
|
+
} = jt({
|
|
1028
|
+
orgName: e
|
|
1029
|
+
}, {
|
|
1030
|
+
offset: c * a,
|
|
1031
|
+
limit: a
|
|
1032
|
+
}), {
|
|
1033
|
+
mutateAsync: p
|
|
1034
|
+
} = Yt(), {
|
|
1035
|
+
addConfirmation: I
|
|
1036
|
+
} = at(), P = _(() => g?.groups ?? [], [g]), y = g?.total ?? 0;
|
|
1037
|
+
$e(() => {
|
|
1038
|
+
if (P.length === 0 && y > 0) {
|
|
1039
|
+
const u = Math.max(0, Math.ceil(y / a) - 1);
|
|
1040
|
+
c !== u && l(u);
|
|
1041
|
+
}
|
|
1042
|
+
}, [P.length, y, c, a]);
|
|
1043
|
+
const N = he.children.org.children.settings.children.identities, U = e ? q(N.children.groups.path + "/create", {
|
|
1044
|
+
orgId: e
|
|
1045
|
+
}) : "#", F = (u) => e ? q(N.children.groups.path + "/:groupId", {
|
|
1046
|
+
orgId: e,
|
|
1047
|
+
groupId: u
|
|
1048
|
+
}) : "#", T = _(() => {
|
|
1049
|
+
if (!o) return P;
|
|
1050
|
+
const u = o.toLowerCase();
|
|
1051
|
+
return P.filter((A) => A.name.toLowerCase().includes(u) || (A.description ?? "").toLowerCase().includes(u));
|
|
1052
|
+
}, [P, o]), C = (u) => {
|
|
1053
|
+
I({
|
|
1054
|
+
title: "Delete Group",
|
|
1055
|
+
description: `Are you sure you want to delete "${u.name}"? This action cannot be undone.`,
|
|
1056
|
+
confirmButtonText: "Delete",
|
|
1057
|
+
confirmButtonColor: "error",
|
|
1058
|
+
confirmButtonIcon: /* @__PURE__ */ t(we, { size: 16 }),
|
|
1059
|
+
onConfirm: () => p({
|
|
1060
|
+
orgName: e,
|
|
1061
|
+
groupId: u.id
|
|
1062
|
+
})
|
|
1063
|
+
});
|
|
1064
|
+
};
|
|
1065
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
1066
|
+
w != null && /* @__PURE__ */ t(ne, { severity: "error", sx: {
|
|
1067
|
+
mb: 2
|
|
1068
|
+
}, children: "Failed to load groups" }),
|
|
1069
|
+
/* @__PURE__ */ t(n.Provider, { searchValue: o, onSearchChange: f, children: /* @__PURE__ */ s(n.Container, { children: [
|
|
1070
|
+
/* @__PURE__ */ t(n.Toolbar, { showSearch: !0, searchPlaceholder: "Search groups...", actions: /* @__PURE__ */ t(X, { variant: "contained", startIcon: /* @__PURE__ */ t(Le, {}), onClick: () => r(U), disabled: !d, children: "Create Group" }) }),
|
|
1071
|
+
!i && y === 0 ? /* @__PURE__ */ t(n.EmptyState, { illustration: /* @__PURE__ */ t(st, { size: 64 }), title: "No groups yet", description: 'Click "Create Group" to add one.' }) : !i && T.length === 0 ? /* @__PURE__ */ t(n.EmptyState, { illustration: /* @__PURE__ */ t(st, { size: 64 }), title: "No groups found", description: `No groups match "${o}". Try a different search term.` }) : /* @__PURE__ */ s(n, { variant: "table", children: [
|
|
1072
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
1073
|
+
/* @__PURE__ */ t(n.Cell, { children: "Name" }),
|
|
1074
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", width: "80px" })
|
|
1075
|
+
] }) }),
|
|
1076
|
+
/* @__PURE__ */ s(n.Body, { children: [
|
|
1077
|
+
i && /* @__PURE__ */ t(lt, { rows: a, columns: 1 }),
|
|
1078
|
+
!i && T.map((u) => /* @__PURE__ */ s(n.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => r(F(u.id)), children: [
|
|
1079
|
+
/* @__PURE__ */ t(n.Cell, { children: /* @__PURE__ */ t(n.CellIcon, { icon: /* @__PURE__ */ t(Ze, { sx: Er, children: u.name.charAt(0).toUpperCase() || "G" }), primary: u.name, secondary: u.description ?? void 0 }) }),
|
|
1080
|
+
/* @__PURE__ */ t(n.Cell, { align: "center", children: /* @__PURE__ */ t(n.RowActions, { visibility: "hover", children: /* @__PURE__ */ t(De, { title: "Delete group", children: /* @__PURE__ */ t(ke, { size: "small", color: "error", onClick: (A) => {
|
|
1081
|
+
A.stopPropagation(), C(u);
|
|
1082
|
+
}, children: /* @__PURE__ */ t(we, { size: 16 }) }) }) }) })
|
|
1083
|
+
] }, u.id))
|
|
1084
|
+
] })
|
|
1085
|
+
] }),
|
|
1086
|
+
!i && y >= 5 && /* @__PURE__ */ t(et, { component: "div", count: y, page: c, rowsPerPage: a, onPageChange: (u, A) => l(A), onRowsPerPageChange: (u) => {
|
|
1087
|
+
m(parseInt(u.target.value, 10)), l(0);
|
|
1088
|
+
}, rowsPerPageOptions: [5, 10, 25, 50] })
|
|
1089
|
+
] }) })
|
|
1090
|
+
] });
|
|
1091
|
+
}, Tr = () => {
|
|
1092
|
+
const {
|
|
1093
|
+
orgId: e
|
|
1094
|
+
} = fe(), r = xe(), [d, c] = R({
|
|
1095
|
+
name: "",
|
|
1096
|
+
description: ""
|
|
1097
|
+
}), {
|
|
1098
|
+
errors: l,
|
|
1099
|
+
validateField: a,
|
|
1100
|
+
validateForm: m,
|
|
1101
|
+
clearErrors: o,
|
|
1102
|
+
setFieldError: f
|
|
1103
|
+
} = Ke(gr), {
|
|
1104
|
+
checkDirty: g,
|
|
1105
|
+
resetDirty: i
|
|
1106
|
+
} = Qe(d), [w, p] = R({}), {
|
|
1107
|
+
mutateAsync: I,
|
|
1108
|
+
isPending: P,
|
|
1109
|
+
error: y
|
|
1110
|
+
} = Jt(), N = e ? q(he.children.org.children.settings.children.identities.children.groups.path, {
|
|
1111
|
+
orgId: e
|
|
1112
|
+
}) : "#", U = Ye((C, u) => {
|
|
1113
|
+
const A = {
|
|
1114
|
+
...d,
|
|
1115
|
+
[C]: u
|
|
1116
|
+
};
|
|
1117
|
+
c(A), g(A), f(C, a(C, u));
|
|
1118
|
+
}, [d, g, a, f]), F = Ye(async () => {
|
|
1119
|
+
if (!m(d)) {
|
|
1120
|
+
p(l);
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
p({});
|
|
1124
|
+
try {
|
|
1125
|
+
const C = await I({
|
|
1126
|
+
params: {
|
|
1127
|
+
orgName: e
|
|
1128
|
+
},
|
|
1129
|
+
body: {
|
|
1130
|
+
name: d.name.trim(),
|
|
1131
|
+
description: d.description?.trim() || void 0
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
1134
|
+
i(), o(), r(q(he.children.org.children.settings.children.identities.children.groups.children.detail.path, {
|
|
1135
|
+
orgId: e,
|
|
1136
|
+
groupId: C.id
|
|
1137
|
+
}));
|
|
1138
|
+
} catch {
|
|
1139
|
+
}
|
|
1140
|
+
}, [d, m, l, I, e, i, o, r]), T = Object.values(w);
|
|
1141
|
+
return /* @__PURE__ */ t(H, { children: /* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 2, children: [
|
|
1142
|
+
y != null && /* @__PURE__ */ t(ne, { severity: "error", children: y?.message ?? "Failed to create group" }),
|
|
1143
|
+
/* @__PURE__ */ t(S.Stack, { spacing: 3, children: /* @__PURE__ */ s(S.Section, { children: [
|
|
1144
|
+
/* @__PURE__ */ t(S.Subheader, { children: "Group Details" }),
|
|
1145
|
+
/* @__PURE__ */ s(S.Stack, { spacing: 2, children: [
|
|
1146
|
+
/* @__PURE__ */ t(S.ElementWrapper, { label: "Name", name: "name", children: /* @__PURE__ */ t(ce, { id: "name", value: d.name, onChange: (C) => U("name", C.target.value), placeholder: "engineering", autoComplete: "off", error: !!l.name, helperText: l.name, fullWidth: !0 }) }),
|
|
1147
|
+
/* @__PURE__ */ t(S.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ t(ce, { id: "description", value: d.description, onChange: (C) => U("description", C.target.value), placeholder: "Describe the group's purpose", multiline: !0, minRows: 2, maxRows: 6, error: !!l.description, helperText: l.description, fullWidth: !0 }) })
|
|
1148
|
+
] })
|
|
1149
|
+
] }) }),
|
|
1150
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "column", gap: 3, children: [
|
|
1151
|
+
/* @__PURE__ */ t(tt, { in: T.length > 0, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ t(ne, { severity: "error", children: T.map((C, u) => /* @__PURE__ */ t(L, { children: C }, u)) }) }),
|
|
1152
|
+
/* @__PURE__ */ s(L, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
|
|
1153
|
+
/* @__PURE__ */ t(X, { variant: "outlined", color: "primary", onClick: () => r(N), children: "Cancel" }),
|
|
1154
|
+
/* @__PURE__ */ t(X, { variant: "contained", color: "primary", startIcon: /* @__PURE__ */ t(Le, { size: 16 }), onClick: F, disabled: P || !d.name.trim(), children: "Create Group" })
|
|
1155
|
+
] })
|
|
1156
|
+
] })
|
|
1157
|
+
] }) });
|
|
1158
|
+
}, _r = () => {
|
|
1159
|
+
const {
|
|
1160
|
+
orgId: e,
|
|
1161
|
+
groupId: r
|
|
1162
|
+
} = fe(), d = xe(), [c, l] = R("users"), [a, m] = R(0), [o, f] = R(10), {
|
|
1163
|
+
data: g,
|
|
1164
|
+
isLoading: i
|
|
1165
|
+
} = Kt({
|
|
1166
|
+
orgName: e,
|
|
1167
|
+
groupId: r ?? ""
|
|
1168
|
+
}), {
|
|
1169
|
+
data: w,
|
|
1170
|
+
isLoading: p
|
|
1171
|
+
} = Qt({
|
|
1172
|
+
orgName: e,
|
|
1173
|
+
groupId: r ?? ""
|
|
1174
|
+
}, {
|
|
1175
|
+
offset: a * o,
|
|
1176
|
+
limit: o
|
|
1177
|
+
}), {
|
|
1178
|
+
data: I,
|
|
1179
|
+
isLoading: P
|
|
1180
|
+
} = Zt({
|
|
1181
|
+
orgName: e,
|
|
1182
|
+
groupId: r ?? ""
|
|
1183
|
+
}), {
|
|
1184
|
+
data: y,
|
|
1185
|
+
isLoading: N,
|
|
1186
|
+
isError: U
|
|
1187
|
+
} = er({
|
|
1188
|
+
orgName: e,
|
|
1189
|
+
groupId: r ?? ""
|
|
1190
|
+
}), {
|
|
1191
|
+
data: F,
|
|
1192
|
+
isLoading: T
|
|
1193
|
+
} = gt({
|
|
1194
|
+
orgName: e
|
|
1195
|
+
}, {
|
|
1196
|
+
offset: 0,
|
|
1197
|
+
limit: 100
|
|
1198
|
+
}), {
|
|
1199
|
+
mutateAsync: C
|
|
1200
|
+
} = bt(), {
|
|
1201
|
+
mutateAsync: u
|
|
1202
|
+
} = vt(), A = _(() => w?.users ?? [], [w]), b = _(() => new Set(I?.memberIds ?? []), [I]), M = _(() => y?.roles ?? [], [y]), j = _(() => F?.users ?? [], [F]), [V, Y] = R([]), [W, Z] = R(/* @__PURE__ */ new Set()), [ee, $] = R(!1), [D, k] = R(), [te, O] = R(!1), G = e ? q(he.children.org.children.settings.children.identities.children.groups.path, {
|
|
1203
|
+
orgId: e
|
|
1204
|
+
}) : "#", re = w?.total ?? 0, J = _(() => A.filter((x) => !W.has(x.id)), [A, W]), ie = _(() => {
|
|
1205
|
+
const x = /* @__PURE__ */ new Set([...[...b].filter((E) => !W.has(E)), ...V.map((E) => E.id)]);
|
|
1206
|
+
return j.filter((E) => !x.has(E.id));
|
|
1207
|
+
}, [j, b, V, W]), de = (x) => String(x.attributes?.username ?? x.id ?? ""), se = (x, E) => {
|
|
1208
|
+
E && (W.has(E.id) ? Z((Q) => {
|
|
1209
|
+
const ve = new Set(Q);
|
|
1210
|
+
return ve.delete(E.id), ve;
|
|
1211
|
+
}) : Y((Q) => [...Q, E]));
|
|
1212
|
+
}, oe = (x) => {
|
|
1213
|
+
V.find((E) => E.id === x) ? Y((E) => E.filter((Q) => Q.id !== x)) : Z((E) => /* @__PURE__ */ new Set([...E, x]));
|
|
1214
|
+
}, ue = async () => {
|
|
1215
|
+
if (!(!e || !r)) {
|
|
1216
|
+
k(void 0), O(!1), $(!0);
|
|
1217
|
+
try {
|
|
1218
|
+
const x = V.filter((Q) => !b.has(Q.id)).map((Q) => Q.id), E = [...W];
|
|
1219
|
+
x.length > 0 && await C({
|
|
1220
|
+
params: {
|
|
1221
|
+
orgName: e,
|
|
1222
|
+
groupId: r
|
|
1223
|
+
},
|
|
1224
|
+
body: {
|
|
1225
|
+
userIds: x
|
|
1226
|
+
}
|
|
1227
|
+
}), E.length > 0 && await u({
|
|
1228
|
+
params: {
|
|
1229
|
+
orgName: e,
|
|
1230
|
+
groupId: r
|
|
1231
|
+
},
|
|
1232
|
+
body: {
|
|
1233
|
+
userIds: E
|
|
1234
|
+
}
|
|
1235
|
+
}), O(!0), Y([]), Z(/* @__PURE__ */ new Set());
|
|
1236
|
+
} catch {
|
|
1237
|
+
k("Failed to update group members. Please try again.");
|
|
1238
|
+
} finally {
|
|
1239
|
+
$(!1);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
if (i || p || P || T)
|
|
1244
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
1245
|
+
/* @__PURE__ */ t(Fe, { to: G, label: "Groups" }),
|
|
1246
|
+
/* @__PURE__ */ t(ct, { tabs: 2 })
|
|
1247
|
+
] });
|
|
1248
|
+
const me = V.length > 0 || W.size > 0;
|
|
1249
|
+
return /* @__PURE__ */ s(H, { children: [
|
|
1250
|
+
/* @__PURE__ */ t(Fe, { to: G, label: "Groups" }),
|
|
1251
|
+
/* @__PURE__ */ s(ae, { spacing: 3, children: [
|
|
1252
|
+
/* @__PURE__ */ t(dt, { fallback: "G", name: g?.name ?? "", subtitle: g?.description, id: r ?? "" }),
|
|
1253
|
+
D != null && /* @__PURE__ */ t(ne, { severity: "error", children: D }),
|
|
1254
|
+
te && /* @__PURE__ */ t(ne, { severity: "success", children: "Group updated successfully." }),
|
|
1255
|
+
/* @__PURE__ */ s(S.Section, { children: [
|
|
1256
|
+
/* @__PURE__ */ s(ot, { value: c, onChange: (x, E) => l(E), sx: {
|
|
1257
|
+
borderBottom: 1,
|
|
1258
|
+
borderColor: "divider"
|
|
1259
|
+
}, children: [
|
|
1260
|
+
/* @__PURE__ */ t(Ee, { label: "Users", value: "users" }),
|
|
1261
|
+
/* @__PURE__ */ t(Ee, { label: "Roles", value: "roles" })
|
|
1262
|
+
] }),
|
|
1263
|
+
c === "users" && /* @__PURE__ */ s(H, { children: [
|
|
1264
|
+
/* @__PURE__ */ t(S.Header, { children: "Users" }),
|
|
1265
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "Search and add users to this group." }),
|
|
1266
|
+
/* @__PURE__ */ t(L, { sx: {
|
|
1267
|
+
mt: 1
|
|
1268
|
+
}, children: /* @__PURE__ */ t(S.ElementWrapper, { label: "Add User", name: "addUser", children: /* @__PURE__ */ t(Oe, { id: "addUser", options: ie, getOptionLabel: (x) => de(x), onChange: se, value: null, renderInput: (x) => /* @__PURE__ */ t(ce, { ...x, placeholder: "Search users..." }), noOptionsText: "No users available" }) }) }),
|
|
1269
|
+
V.length > 0 && /* @__PURE__ */ s(L, { mb: 2, children: [
|
|
1270
|
+
/* @__PURE__ */ t(B, { variant: "body2", fontWeight: 500, mb: 1, children: "Pending additions (unsaved)" }),
|
|
1271
|
+
/* @__PURE__ */ t(n.Container, { children: /* @__PURE__ */ s(n, { children: [
|
|
1272
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
1273
|
+
/* @__PURE__ */ t(n.Cell, { children: "Username" }),
|
|
1274
|
+
/* @__PURE__ */ t(n.Cell, { children: "User ID" }),
|
|
1275
|
+
/* @__PURE__ */ t(n.Cell, {})
|
|
1276
|
+
] }) }),
|
|
1277
|
+
/* @__PURE__ */ t(n.Body, { children: V.map((x) => /* @__PURE__ */ s(n.Row, { children: [
|
|
1278
|
+
/* @__PURE__ */ t(n.Cell, { children: de(x) }),
|
|
1279
|
+
/* @__PURE__ */ t(n.Cell, { children: x.id }),
|
|
1280
|
+
/* @__PURE__ */ t(n.Cell, { align: "right", children: /* @__PURE__ */ t(De, { title: "Remove from group", children: /* @__PURE__ */ t(ke, { size: "small", onClick: () => oe(x.id), children: /* @__PURE__ */ t(we, { size: 16 }) }) }) })
|
|
1281
|
+
] }, x.id)) })
|
|
1282
|
+
] }) })
|
|
1283
|
+
] }),
|
|
1284
|
+
re === 0 && V.length === 0 ? /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "No members yet. Search and add users above." }) : re > 0 ? /* @__PURE__ */ s(n.Container, { children: [
|
|
1285
|
+
/* @__PURE__ */ s(n, { children: [
|
|
1286
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
1287
|
+
/* @__PURE__ */ t(n.Cell, { children: "Username" }),
|
|
1288
|
+
/* @__PURE__ */ t(n.Cell, { children: "User ID" }),
|
|
1289
|
+
/* @__PURE__ */ t(n.Cell, {})
|
|
1290
|
+
] }) }),
|
|
1291
|
+
/* @__PURE__ */ t(n.Body, { children: J.map((x) => /* @__PURE__ */ s(n.Row, { children: [
|
|
1292
|
+
/* @__PURE__ */ t(n.Cell, { children: de(x) }),
|
|
1293
|
+
/* @__PURE__ */ t(n.Cell, { children: x.id }),
|
|
1294
|
+
/* @__PURE__ */ t(n.Cell, { align: "right", children: /* @__PURE__ */ t(De, { title: "Remove from group", children: /* @__PURE__ */ t(ke, { size: "small", onClick: () => oe(x.id), children: /* @__PURE__ */ t(we, { size: 16 }) }) }) })
|
|
1295
|
+
] }, x.id)) })
|
|
1296
|
+
] }),
|
|
1297
|
+
/* @__PURE__ */ t(et, { component: "div", count: re, page: a, rowsPerPage: o, onPageChange: (x, E) => m(E), onRowsPerPageChange: (x) => {
|
|
1298
|
+
f(parseInt(x.target.value, 10)), m(0);
|
|
1299
|
+
}, rowsPerPageOptions: [5, 10, 25, 50] })
|
|
1300
|
+
] }) : null
|
|
1301
|
+
] }),
|
|
1302
|
+
c === "roles" && /* @__PURE__ */ s(H, { children: [
|
|
1303
|
+
/* @__PURE__ */ t(S.Header, { children: "Assigned Roles" }),
|
|
1304
|
+
/* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "Roles currently assigned to this group. Manage role assignments from the Roles page." }),
|
|
1305
|
+
/* @__PURE__ */ t(L, { sx: {
|
|
1306
|
+
mt: 1
|
|
1307
|
+
}, children: N ? /* @__PURE__ */ t(ir, { size: 20 }) : U ? /* @__PURE__ */ t(B, { variant: "body2", color: "error", children: "Failed to load roles. Please try again." }) : M.length === 0 ? /* @__PURE__ */ t(B, { variant: "body2", color: "text.secondary", children: "No roles assigned to this group." }) : /* @__PURE__ */ t(n.Container, { children: /* @__PURE__ */ s(n, { children: [
|
|
1308
|
+
/* @__PURE__ */ t(n.Head, { children: /* @__PURE__ */ s(n.Row, { children: [
|
|
1309
|
+
/* @__PURE__ */ t(n.Cell, { children: "Name" }),
|
|
1310
|
+
/* @__PURE__ */ t(n.Cell, { children: "Description" })
|
|
1311
|
+
] }) }),
|
|
1312
|
+
/* @__PURE__ */ t(n.Body, { children: M.map((x) => /* @__PURE__ */ s(n.Row, { children: [
|
|
1313
|
+
/* @__PURE__ */ t(n.Cell, { children: x.name }),
|
|
1314
|
+
/* @__PURE__ */ t(n.Cell, { children: x.description ?? "-" })
|
|
1315
|
+
] }, x.id)) })
|
|
1316
|
+
] }) }) })
|
|
1317
|
+
] })
|
|
1318
|
+
] }),
|
|
1319
|
+
me && /* @__PURE__ */ s(ae, { direction: "row", spacing: 1, children: [
|
|
1320
|
+
/* @__PURE__ */ t(X, { variant: "outlined", onClick: () => d(G), disabled: ee, children: "Cancel" }),
|
|
1321
|
+
/* @__PURE__ */ t(X, { variant: "contained", onClick: ue, disabled: ee, children: ee ? "Saving..." : "Save Changes" })
|
|
1322
|
+
] })
|
|
1323
|
+
] })
|
|
1324
|
+
] });
|
|
1325
|
+
}, zr = () => {
|
|
1326
|
+
const e = Ie(21), {
|
|
1327
|
+
orgId: r
|
|
1328
|
+
} = fe(), d = he.children.org.children.settings.children.identities;
|
|
1329
|
+
let c;
|
|
1330
|
+
e[0] !== r ? (c = q(d.children.users.path, {
|
|
1331
|
+
orgId: r
|
|
1332
|
+
}), e[0] = r, e[1] = c) : c = e[1];
|
|
1333
|
+
let l;
|
|
1334
|
+
e[2] !== c ? (l = /* @__PURE__ */ t(le, { index: !0, element: /* @__PURE__ */ t(je, { to: c, replace: !0 }) }), e[2] = c, e[3] = l) : l = e[3];
|
|
1335
|
+
let a;
|
|
1336
|
+
e[4] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ t(le, { path: "users/invite", element: /* @__PURE__ */ t(vr, {}) }), e[4] = a) : a = e[4];
|
|
1337
|
+
let m;
|
|
1338
|
+
e[5] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ t(le, { path: "users/add", element: /* @__PURE__ */ t(Cr, {}) }), e[5] = m) : m = e[5];
|
|
1339
|
+
let o;
|
|
1340
|
+
e[6] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ t(le, { path: "users/:userId", element: /* @__PURE__ */ t(Rr, {}) }), e[6] = o) : o = e[6];
|
|
1341
|
+
let f;
|
|
1342
|
+
e[7] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ t(le, { path: "users/*", element: /* @__PURE__ */ t(ur, {}) }), e[7] = f) : f = e[7];
|
|
1343
|
+
let g;
|
|
1344
|
+
e[8] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ t(le, { path: "roles/create", element: /* @__PURE__ */ t(Ur, {}) }), e[8] = g) : g = e[8];
|
|
1345
|
+
let i;
|
|
1346
|
+
e[9] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ t(le, { path: "roles/:roleId", element: /* @__PURE__ */ t(Gr, {}) }), e[9] = i) : i = e[9];
|
|
1347
|
+
let w;
|
|
1348
|
+
e[10] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ t(le, { path: "roles/*", element: /* @__PURE__ */ t(Ar, {}) }), e[10] = w) : w = e[10];
|
|
1349
|
+
let p;
|
|
1350
|
+
e[11] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ t(le, { path: "groups/create", element: /* @__PURE__ */ t(Tr, {}) }), e[11] = p) : p = e[11];
|
|
1351
|
+
let I;
|
|
1352
|
+
e[12] === Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ t(le, { path: "groups/:groupId", element: /* @__PURE__ */ t(_r, {}) }), e[12] = I) : I = e[12];
|
|
1353
|
+
let P;
|
|
1354
|
+
e[13] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ t(le, { path: "groups/*", element: /* @__PURE__ */ t(Lr, {}) }), e[13] = P) : P = e[13];
|
|
1355
|
+
let y;
|
|
1356
|
+
e[14] !== r ? (y = q(d.children.users.path, {
|
|
1357
|
+
orgId: r
|
|
1358
|
+
}), e[14] = r, e[15] = y) : y = e[15];
|
|
1359
|
+
let N;
|
|
1360
|
+
e[16] !== y ? (N = /* @__PURE__ */ t(le, { path: "*", element: /* @__PURE__ */ t(je, { to: y, replace: !0 }) }), e[16] = y, e[17] = N) : N = e[17];
|
|
1361
|
+
let U;
|
|
1362
|
+
return e[18] !== l || e[19] !== N ? (U = /* @__PURE__ */ s(pt, { children: [
|
|
1363
|
+
l,
|
|
1364
|
+
a,
|
|
1365
|
+
m,
|
|
1366
|
+
o,
|
|
1367
|
+
f,
|
|
1368
|
+
g,
|
|
1369
|
+
i,
|
|
1370
|
+
w,
|
|
1371
|
+
p,
|
|
1372
|
+
I,
|
|
1373
|
+
P,
|
|
1374
|
+
N
|
|
1375
|
+
] }), e[18] = l, e[19] = N, e[20] = U) : U = e[20], U;
|
|
1376
|
+
}, Fr = he.children.org.children.settings;
|
|
1377
|
+
function Wr() {
|
|
1378
|
+
const e = Ie(8), {
|
|
1379
|
+
userInfo: r
|
|
1380
|
+
} = tr();
|
|
1381
|
+
r?.scope;
|
|
1382
|
+
let d;
|
|
1383
|
+
e: {
|
|
1384
|
+
if (Ve.disableAuth || !Ve.rbacEnabled) {
|
|
1385
|
+
let i;
|
|
1386
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (i = {
|
|
1387
|
+
users: !0,
|
|
1388
|
+
roles: !0,
|
|
1389
|
+
groups: !0
|
|
1390
|
+
}, e[0] = i) : i = e[0], d = i;
|
|
1391
|
+
break e;
|
|
1392
|
+
}
|
|
1393
|
+
const c = r?.scope;
|
|
1394
|
+
if (!c) {
|
|
1395
|
+
let i;
|
|
1396
|
+
e[1] === Symbol.for("react.memo_cache_sentinel") ? (i = {
|
|
1397
|
+
users: !1,
|
|
1398
|
+
roles: !1,
|
|
1399
|
+
groups: !1
|
|
1400
|
+
}, e[1] = i) : i = e[1], d = i;
|
|
1401
|
+
break e;
|
|
1402
|
+
}
|
|
1403
|
+
let l;
|
|
1404
|
+
e[2] !== c ? (l = new Set(c.split(" ").filter(Boolean)), e[2] = c, e[3] = l) : l = e[3];
|
|
1405
|
+
const a = l, m = a.has("amp:org:invite-member") || a.has("amp:org:remove-member"), o = a.has("amp:role:read") || a.has("amp:role:create") || a.has("amp:role:update") || a.has("amp:role:delete"), f = a.has("amp:group:read") || a.has("amp:group:create") || a.has("amp:group:update") || a.has("amp:group:delete");
|
|
1406
|
+
let g;
|
|
1407
|
+
e[4] !== m || e[5] !== o || e[6] !== f ? (g = {
|
|
1408
|
+
users: m,
|
|
1409
|
+
roles: o,
|
|
1410
|
+
groups: f
|
|
1411
|
+
}, e[4] = m, e[5] = o, e[6] = f, e[7] = g) : g = e[7], d = g;
|
|
1412
|
+
}
|
|
1413
|
+
return d;
|
|
1414
|
+
}
|
|
1415
|
+
const Mr = {
|
|
1416
|
+
minWidth: 36,
|
|
1417
|
+
color: "primary.main"
|
|
1418
|
+
}, Or = {
|
|
1419
|
+
minWidth: 36,
|
|
1420
|
+
color: "inherit"
|
|
1421
|
+
}, Br = {
|
|
1422
|
+
color: "text.secondary"
|
|
1423
|
+
}, Vr = {
|
|
1424
|
+
color: "inherit"
|
|
1425
|
+
}, $r = (e) => {
|
|
1426
|
+
const r = Ie(7), {
|
|
1427
|
+
children: d
|
|
1428
|
+
} = e, {
|
|
1429
|
+
orgId: c
|
|
1430
|
+
} = fe(), {
|
|
1431
|
+
pathname: l
|
|
1432
|
+
} = At(), a = Wr(), m = Fr.children.identities.children;
|
|
1433
|
+
let o;
|
|
1434
|
+
if (r[0] !== d || r[1] !== a.groups || r[2] !== a.roles || r[3] !== a.users || r[4] !== c || r[5] !== l) {
|
|
1435
|
+
const f = [];
|
|
1436
|
+
a.users && f.push({
|
|
1437
|
+
label: "Users",
|
|
1438
|
+
href: q(m.users.path, {
|
|
1439
|
+
orgId: c
|
|
1440
|
+
}),
|
|
1441
|
+
wildPath: m.users.wildPath,
|
|
1442
|
+
icon: t(nt, {
|
|
1443
|
+
size: 18
|
|
1444
|
+
})
|
|
1445
|
+
}), a.groups && f.push({
|
|
1446
|
+
label: "Groups",
|
|
1447
|
+
href: q(m.groups.path, {
|
|
1448
|
+
orgId: c
|
|
1449
|
+
}),
|
|
1450
|
+
wildPath: m.groups.wildPath,
|
|
1451
|
+
icon: t(st, {
|
|
1452
|
+
size: 18
|
|
1453
|
+
})
|
|
1454
|
+
}), a.roles && f.push({
|
|
1455
|
+
label: "Roles",
|
|
1456
|
+
href: q(m.roles.path, {
|
|
1457
|
+
orgId: c
|
|
1458
|
+
}),
|
|
1459
|
+
wildPath: m.roles.wildPath,
|
|
1460
|
+
icon: t(it, {
|
|
1461
|
+
size: 18
|
|
1462
|
+
})
|
|
1463
|
+
});
|
|
1464
|
+
const g = f.length > 0 ? [{
|
|
1465
|
+
title: "User Management",
|
|
1466
|
+
items: f
|
|
1467
|
+
}] : [];
|
|
1468
|
+
o = t(rr, {
|
|
1469
|
+
title: "Settings",
|
|
1470
|
+
disableIcon: !0,
|
|
1471
|
+
children: s(sr, {
|
|
1472
|
+
sx: {
|
|
1473
|
+
display: "flex",
|
|
1474
|
+
overflow: "hidden",
|
|
1475
|
+
minHeight: "calc(70vh - 64px)"
|
|
1476
|
+
},
|
|
1477
|
+
children: [t(L, {
|
|
1478
|
+
component: "nav",
|
|
1479
|
+
sx: {
|
|
1480
|
+
width: 200,
|
|
1481
|
+
flexShrink: 0,
|
|
1482
|
+
overflowY: "auto",
|
|
1483
|
+
p: 2
|
|
1484
|
+
},
|
|
1485
|
+
children: g.map((i) => t(ar, {
|
|
1486
|
+
subheader: t(dr, {
|
|
1487
|
+
disableGutters: !0,
|
|
1488
|
+
disableSticky: !0,
|
|
1489
|
+
children: t(B, {
|
|
1490
|
+
variant: "overline",
|
|
1491
|
+
children: i.title
|
|
1492
|
+
})
|
|
1493
|
+
}),
|
|
1494
|
+
children: i.items.map((w) => {
|
|
1495
|
+
const p = !!Ut(w.wildPath, l);
|
|
1496
|
+
return t(ut, {
|
|
1497
|
+
to: w.href,
|
|
1498
|
+
style: {
|
|
1499
|
+
textDecoration: "none",
|
|
1500
|
+
color: "inherit"
|
|
1501
|
+
},
|
|
1502
|
+
children: s(or, {
|
|
1503
|
+
selected: p,
|
|
1504
|
+
children: [t(lr, {
|
|
1505
|
+
sx: p ? Mr : Or,
|
|
1506
|
+
children: w.icon
|
|
1507
|
+
}), t(cr, {
|
|
1508
|
+
primary: w.label,
|
|
1509
|
+
sx: p ? Br : Vr
|
|
1510
|
+
})]
|
|
1511
|
+
})
|
|
1512
|
+
}, w.label);
|
|
1513
|
+
})
|
|
1514
|
+
}, i.title))
|
|
1515
|
+
}), t(hr, {
|
|
1516
|
+
orientation: "vertical",
|
|
1517
|
+
flexItem: !0
|
|
1518
|
+
}), t(L, {
|
|
1519
|
+
sx: {
|
|
1520
|
+
flex: 1,
|
|
1521
|
+
minWidth: 0,
|
|
1522
|
+
overflowY: "auto",
|
|
1523
|
+
p: 3
|
|
1524
|
+
},
|
|
1525
|
+
children: d
|
|
1526
|
+
})]
|
|
1527
|
+
})
|
|
1528
|
+
}), r[0] = d, r[1] = a.groups, r[2] = a.roles, r[3] = a.users, r[4] = c, r[5] = l, r[6] = o;
|
|
1529
|
+
} else
|
|
1530
|
+
o = r[6];
|
|
1531
|
+
return o;
|
|
1532
|
+
}, mt = () => t($r, {
|
|
1533
|
+
children: s(pt, {
|
|
1534
|
+
children: [t(le, {
|
|
1535
|
+
index: !0,
|
|
1536
|
+
element: t(je, {
|
|
1537
|
+
to: "identities/users",
|
|
1538
|
+
replace: !0
|
|
1539
|
+
})
|
|
1540
|
+
}), t(le, {
|
|
1541
|
+
path: "identities/*",
|
|
1542
|
+
element: t(zr, {})
|
|
1543
|
+
}), t(le, {
|
|
1544
|
+
path: "*",
|
|
1545
|
+
element: t(je, {
|
|
1546
|
+
to: "identities/users",
|
|
1547
|
+
replace: !0
|
|
1548
|
+
})
|
|
1549
|
+
})]
|
|
1550
|
+
})
|
|
1551
|
+
}), tn = {
|
|
1552
|
+
title: "Settings",
|
|
1553
|
+
description: "Manage IDP settings and appearance",
|
|
1554
|
+
icon: Nt,
|
|
1555
|
+
path: "/settings",
|
|
1556
|
+
component: mt,
|
|
1557
|
+
levels: {
|
|
1558
|
+
organization: mt
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
export {
|
|
1562
|
+
mt as SettingsOrganization,
|
|
1563
|
+
tn as metaData
|
|
1564
|
+
};
|