@medha-analytics/medha-one-access-react 1.0.7 → 1.0.9
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/components/shared/DataTable.d.ts.map +1 -1
- package/dist/components/shared/ExpressionInput.d.ts.map +1 -1
- package/dist/core/hooks/useAccessRules.d.ts.map +1 -1
- package/dist/core/hooks/useArtifacts.d.ts +1 -0
- package/dist/core/hooks/useArtifacts.d.ts.map +1 -1
- package/dist/core/hooks/useGroups.d.ts.map +1 -1
- package/dist/core/hooks/useUsers.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +213 -144
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14400,25 +14400,27 @@ function vb({ className: e, ...t }) {
|
|
|
14400
14400
|
}
|
|
14401
14401
|
//#endregion
|
|
14402
14402
|
//#region src/components/shared/DataTable.tsx
|
|
14403
|
-
function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessage: i = "No results found", onSearchChange: a, onPaginationChange: s, pageSize: l = 20, searchPlaceholder: u = "Search...", toolbar:
|
|
14404
|
-
let [
|
|
14403
|
+
function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessage: i = "No results found", onSearchChange: a, onPaginationChange: s, pageSize: l = 20, searchPlaceholder: u = "Search...", toolbar: p, statusFilter: m, onStatusFilterChange: h }) {
|
|
14404
|
+
let [v, y] = f({
|
|
14405
14405
|
pageIndex: 0,
|
|
14406
14406
|
pageSize: l
|
|
14407
|
-
}), [
|
|
14408
|
-
|
|
14407
|
+
}), [b, x] = f(""), S = d(void 0), C = o((e) => {
|
|
14408
|
+
x(e), S.current && clearTimeout(S.current), S.current = setTimeout(() => a?.(e), 400);
|
|
14409
14409
|
}, [a]);
|
|
14410
|
-
c(() => {
|
|
14411
|
-
|
|
14412
|
-
}, [
|
|
14413
|
-
|
|
14410
|
+
c(() => () => {
|
|
14411
|
+
S.current && clearTimeout(S.current);
|
|
14412
|
+
}, []), c(() => {
|
|
14413
|
+
s?.(v);
|
|
14414
|
+
}, [v, s]);
|
|
14415
|
+
let w = Cn({
|
|
14414
14416
|
data: t,
|
|
14415
14417
|
columns: e,
|
|
14416
|
-
pageCount: Math.ceil(n /
|
|
14417
|
-
state: { pagination:
|
|
14418
|
-
onPaginationChange:
|
|
14418
|
+
pageCount: Math.ceil(n / v.pageSize),
|
|
14419
|
+
state: { pagination: v },
|
|
14420
|
+
onPaginationChange: y,
|
|
14419
14421
|
getCoreRowModel: vn(),
|
|
14420
14422
|
manualPagination: !0
|
|
14421
|
-
}),
|
|
14423
|
+
}), T = Math.ceil(n / v.pageSize);
|
|
14422
14424
|
return /* @__PURE__ */ _("div", {
|
|
14423
14425
|
className: "space-y-4",
|
|
14424
14426
|
children: [
|
|
@@ -14429,44 +14431,44 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
|
|
|
14429
14431
|
className: "relative flex-1 max-w-sm",
|
|
14430
14432
|
children: [/* @__PURE__ */ g(xe, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ g(ub, {
|
|
14431
14433
|
placeholder: u,
|
|
14432
|
-
value:
|
|
14433
|
-
onChange: (e) =>
|
|
14434
|
+
value: b,
|
|
14435
|
+
onChange: (e) => C(e.target.value),
|
|
14434
14436
|
className: "pl-8"
|
|
14435
14437
|
})]
|
|
14436
14438
|
}),
|
|
14437
|
-
|
|
14439
|
+
h && /* @__PURE__ */ g("div", {
|
|
14438
14440
|
className: "flex items-center rounded-md border",
|
|
14439
14441
|
children: [
|
|
14440
14442
|
"all",
|
|
14441
14443
|
"active",
|
|
14442
14444
|
"inactive"
|
|
14443
14445
|
].map((e) => /* @__PURE__ */ g("button", {
|
|
14444
|
-
onClick: () =>
|
|
14445
|
-
className: H("cursor-pointer px-3 py-1.5 text-xs font-medium capitalize transition-colors first:rounded-l-md last:rounded-r-md",
|
|
14446
|
+
onClick: () => h(e),
|
|
14447
|
+
className: H("cursor-pointer px-3 py-1.5 text-xs font-medium capitalize transition-colors first:rounded-l-md last:rounded-r-md", m === e ? "bg-primary text-primary-foreground" : "bg-background text-muted-foreground hover:bg-accent"),
|
|
14446
14448
|
children: e
|
|
14447
14449
|
}, e))
|
|
14448
14450
|
}),
|
|
14449
|
-
|
|
14451
|
+
p && /* @__PURE__ */ g("div", {
|
|
14450
14452
|
className: "flex items-center gap-2",
|
|
14451
|
-
children:
|
|
14453
|
+
children: p
|
|
14452
14454
|
})
|
|
14453
14455
|
]
|
|
14454
14456
|
}),
|
|
14455
14457
|
/* @__PURE__ */ g("div", {
|
|
14456
14458
|
className: "rounded-md border",
|
|
14457
|
-
children: /* @__PURE__ */ _(ib, { children: [/* @__PURE__ */ g(ab, { children:
|
|
14459
|
+
children: /* @__PURE__ */ _(ib, { children: [/* @__PURE__ */ g(ab, { children: w.getHeaderGroups().map((e) => /* @__PURE__ */ g(sb, { children: e.headers.map((e) => /* @__PURE__ */ g(cb, { children: e.isPlaceholder ? null : yn(e.column.columnDef.header, e.getContext()) }, e.id)) }, e.id)) }), /* @__PURE__ */ g(ob, { children: r ? Array.from({ length: v.pageSize }).map((t, n) => /* @__PURE__ */ g(sb, { children: e.map((e, t) => /* @__PURE__ */ g(lb, { children: /* @__PURE__ */ g(vb, { className: "h-4 w-full animate-pulse" }) }, t)) }, n)) : w.getRowModel().rows.length === 0 ? /* @__PURE__ */ g(sb, { children: /* @__PURE__ */ g(lb, {
|
|
14458
14460
|
colSpan: e.length,
|
|
14459
14461
|
className: "h-24 text-center text-muted-foreground",
|
|
14460
14462
|
children: i
|
|
14461
|
-
}) }) :
|
|
14463
|
+
}) }) : w.getRowModel().rows.map((e) => /* @__PURE__ */ g(sb, { children: e.getVisibleCells().map((e) => /* @__PURE__ */ g(lb, { children: yn(e.column.columnDef.cell, e.getContext()) }, e.id)) }, e.id)) })] })
|
|
14462
14464
|
}),
|
|
14463
14465
|
n > 0 && /* @__PURE__ */ _("div", {
|
|
14464
14466
|
className: "flex items-center justify-between",
|
|
14465
14467
|
children: [/* @__PURE__ */ _("div", {
|
|
14466
14468
|
className: "flex items-center gap-2 text-sm text-muted-foreground",
|
|
14467
14469
|
children: [/* @__PURE__ */ g("span", { children: "Rows per page:" }), /* @__PURE__ */ _(db, {
|
|
14468
|
-
value: String(
|
|
14469
|
-
onValueChange: (e) =>
|
|
14470
|
+
value: String(v.pageSize),
|
|
14471
|
+
onValueChange: (e) => y({
|
|
14470
14472
|
pageIndex: 0,
|
|
14471
14473
|
pageSize: Number(e)
|
|
14472
14474
|
}),
|
|
@@ -14488,9 +14490,9 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
|
|
|
14488
14490
|
/* @__PURE__ */ _("span", {
|
|
14489
14491
|
className: "text-muted-foreground",
|
|
14490
14492
|
children: [
|
|
14491
|
-
|
|
14493
|
+
v.pageIndex * v.pageSize + 1,
|
|
14492
14494
|
"–",
|
|
14493
|
-
Math.min((
|
|
14495
|
+
Math.min((v.pageIndex + 1) * v.pageSize, n),
|
|
14494
14496
|
" of ",
|
|
14495
14497
|
n
|
|
14496
14498
|
]
|
|
@@ -14498,21 +14500,21 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
|
|
|
14498
14500
|
/* @__PURE__ */ g(qh, {
|
|
14499
14501
|
variant: "ghost",
|
|
14500
14502
|
size: "icon",
|
|
14501
|
-
onClick: () =>
|
|
14503
|
+
onClick: () => y((e) => ({
|
|
14502
14504
|
...e,
|
|
14503
14505
|
pageIndex: e.pageIndex - 1
|
|
14504
14506
|
})),
|
|
14505
|
-
disabled:
|
|
14507
|
+
disabled: v.pageIndex === 0,
|
|
14506
14508
|
children: /* @__PURE__ */ g(pe, { className: "h-4 w-4" })
|
|
14507
14509
|
}),
|
|
14508
14510
|
/* @__PURE__ */ g(qh, {
|
|
14509
14511
|
variant: "ghost",
|
|
14510
14512
|
size: "icon",
|
|
14511
|
-
onClick: () =>
|
|
14513
|
+
onClick: () => y((e) => ({
|
|
14512
14514
|
...e,
|
|
14513
14515
|
pageIndex: e.pageIndex + 1
|
|
14514
14516
|
})),
|
|
14515
|
-
disabled:
|
|
14517
|
+
disabled: v.pageIndex >= T - 1,
|
|
14516
14518
|
children: /* @__PURE__ */ g(me, { className: "h-4 w-4" })
|
|
14517
14519
|
})
|
|
14518
14520
|
]
|
|
@@ -18728,7 +18730,32 @@ function dw() {
|
|
|
18728
18730
|
function fw() {
|
|
18729
18731
|
let e = G(), t = w();
|
|
18730
18732
|
return S({
|
|
18731
|
-
mutationFn: async (t) =>
|
|
18733
|
+
mutationFn: async (t) => {
|
|
18734
|
+
let n = t.id || t.email || "", r = t.first_name ?? "", i = t.last_name ?? "", a = t.email ?? "", o = t.department ?? "", s = t.role ?? "", c = t.manager_id || null, l = {
|
|
18735
|
+
type: t.type ?? "USER",
|
|
18736
|
+
active: t.active ?? !0,
|
|
18737
|
+
id: n,
|
|
18738
|
+
first_name: r,
|
|
18739
|
+
last_name: i,
|
|
18740
|
+
email: a,
|
|
18741
|
+
department: o,
|
|
18742
|
+
role: s,
|
|
18743
|
+
manager_id: c,
|
|
18744
|
+
parent_group_id: t.parent_group_id ?? null,
|
|
18745
|
+
owner_id: t.owner_id ?? null,
|
|
18746
|
+
expression: t.expression ?? null,
|
|
18747
|
+
user_metadata: {
|
|
18748
|
+
name: `${r} ${i}`.trim(),
|
|
18749
|
+
first_name: r,
|
|
18750
|
+
last_name: i,
|
|
18751
|
+
email: a,
|
|
18752
|
+
department: o,
|
|
18753
|
+
role: s,
|
|
18754
|
+
manager_id: c
|
|
18755
|
+
}
|
|
18756
|
+
};
|
|
18757
|
+
return (await e.post("/users/", l)).data;
|
|
18758
|
+
},
|
|
18732
18759
|
onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
|
|
18733
18760
|
});
|
|
18734
18761
|
}
|
|
@@ -18774,7 +18801,9 @@ function gw(e = {}) {
|
|
|
18774
18801
|
queryKey: ["access-rules", e],
|
|
18775
18802
|
queryFn: async () => {
|
|
18776
18803
|
let e = {};
|
|
18777
|
-
|
|
18804
|
+
n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a);
|
|
18805
|
+
let s = o && o.trim() ? "/access-rules/search" : "/access-rules/";
|
|
18806
|
+
return o && o.trim() && (e.search = o.trim()), ((await t.get(s, { params: e })).data ?? []).map(hw);
|
|
18778
18807
|
}
|
|
18779
18808
|
});
|
|
18780
18809
|
}
|
|
@@ -19224,12 +19253,14 @@ function Nw({ open: e, onClose: t, user: n }) {
|
|
|
19224
19253
|
//#endregion
|
|
19225
19254
|
//#region src/core/hooks/useArtifacts.ts
|
|
19226
19255
|
function Pw(e = {}) {
|
|
19227
|
-
let t = G(), { skip: n, limit: r, activeOnly: i, appName: a, type: o } = e;
|
|
19256
|
+
let t = G(), { skip: n, limit: r, activeOnly: i, appName: a, type: o, search: s } = e;
|
|
19228
19257
|
return C({
|
|
19229
19258
|
queryKey: ["artifacts", e],
|
|
19230
19259
|
queryFn: async () => {
|
|
19231
19260
|
let e = {};
|
|
19232
|
-
|
|
19261
|
+
n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), i !== void 0 && (e.active = i), a && (e.application_name = a), o && (e.artifact_type = o);
|
|
19262
|
+
let c = s && s.trim() ? "/artifacts/search" : "/artifacts/";
|
|
19263
|
+
return s && s.trim() && (e.search = s.trim()), (await t.get(c, { params: e })).data;
|
|
19233
19264
|
}
|
|
19234
19265
|
});
|
|
19235
19266
|
}
|
|
@@ -19353,7 +19384,11 @@ function Kw(e) {
|
|
|
19353
19384
|
return `${t === 0 && e.operator === "+" ? "" : e.operator}${n}`;
|
|
19354
19385
|
}).join("");
|
|
19355
19386
|
}
|
|
19356
|
-
|
|
19387
|
+
var qw = {
|
|
19388
|
+
user: "user",
|
|
19389
|
+
resource: "artifact"
|
|
19390
|
+
};
|
|
19391
|
+
function Jw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
19357
19392
|
let [a, s] = f(""), [c, l] = f(!1), u = d(null), p = aw({ activeOnly: !0 }), m = cw(), h = Pw({ type: "RESOURCE" }), v = Pw({ type: "RESOURCEGROUP" }), { data: y } = Ew(t, e), b = e === "user" ? p.isLoading || m.isLoading : h.isLoading || v.isLoading, x = a.startsWith("-") ? "-" : "+", S = a.replace(/^[+-]/, "").trim().toLowerCase(), C = (() => {
|
|
19358
19393
|
if (e === "user") {
|
|
19359
19394
|
let e = p.data ?? [], t = m.data ?? [], n = (S ? e.filter((e) => {
|
|
@@ -19383,17 +19418,33 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19383
19418
|
kind: "resourcegroup"
|
|
19384
19419
|
}));
|
|
19385
19420
|
return [...r, ...i];
|
|
19386
|
-
})(), w =
|
|
19387
|
-
|
|
19421
|
+
})(), w = (() => {
|
|
19422
|
+
let t = /* @__PURE__ */ new Map();
|
|
19423
|
+
if (e === "user") {
|
|
19424
|
+
for (let e of p.data ?? []) {
|
|
19425
|
+
let n = `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim();
|
|
19426
|
+
t.set(e.id, n || e.email || e.id);
|
|
19427
|
+
}
|
|
19428
|
+
for (let e of m.data ?? []) t.set(e.id, e.name ?? e.id);
|
|
19429
|
+
} else {
|
|
19430
|
+
for (let e of h.data ?? []) t.set(e.id, e.name ?? e.id);
|
|
19431
|
+
for (let e of v.data ?? []) t.set(e.id, e.name ?? e.id);
|
|
19432
|
+
}
|
|
19433
|
+
return t;
|
|
19434
|
+
})(), T = Gw(t).map((e) => ({
|
|
19435
|
+
...e,
|
|
19436
|
+
label: w.get(e.entity) ?? e.entity
|
|
19437
|
+
})), E = o((e, t, r) => {
|
|
19438
|
+
T.find((t) => t.entity === e) || (n(Kw([...T, {
|
|
19388
19439
|
raw: `${r}${e}`,
|
|
19389
19440
|
operator: r,
|
|
19390
19441
|
entity: e,
|
|
19391
19442
|
label: t
|
|
19392
19443
|
}])), s(""), l(!1), u.current?.focus());
|
|
19393
|
-
}, [
|
|
19394
|
-
n(Kw(
|
|
19395
|
-
}, [
|
|
19396
|
-
n(Kw(
|
|
19444
|
+
}, [T, n]), D = o((e) => {
|
|
19445
|
+
n(Kw(T.filter((t, n) => n !== e)));
|
|
19446
|
+
}, [T, n]), O = o((e) => {
|
|
19447
|
+
n(Kw(T.map((t, n) => {
|
|
19397
19448
|
if (n !== e) return t;
|
|
19398
19449
|
let r = t.operator === "+" ? "-" : "+";
|
|
19399
19450
|
return {
|
|
@@ -19402,12 +19453,12 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19402
19453
|
raw: `${r}${t.entity}`
|
|
19403
19454
|
};
|
|
19404
19455
|
})));
|
|
19405
|
-
}, [
|
|
19406
|
-
function
|
|
19456
|
+
}, [T, n]);
|
|
19457
|
+
function k(e) {
|
|
19407
19458
|
s(e.target.value), l(!0);
|
|
19408
19459
|
}
|
|
19409
|
-
function
|
|
19410
|
-
e.key === "Backspace" && !a &&
|
|
19460
|
+
function A(e) {
|
|
19461
|
+
e.key === "Backspace" && !a && T.length > 0 && D(T.length - 1), e.key === "Escape" && (l(!1), s(""));
|
|
19411
19462
|
}
|
|
19412
19463
|
return /* @__PURE__ */ _("div", {
|
|
19413
19464
|
className: "space-y-2 relative",
|
|
@@ -19419,13 +19470,13 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19419
19470
|
/* @__PURE__ */ _("div", {
|
|
19420
19471
|
className: "min-h-9 rounded-md border border-input bg-background px-3 py-1.5 flex flex-wrap gap-1.5 items-center cursor-text focus-within:ring-1 focus-within:ring-ring",
|
|
19421
19472
|
onClick: () => u.current?.focus(),
|
|
19422
|
-
children: [
|
|
19473
|
+
children: [T.map((e, t) => /* @__PURE__ */ _(Yh, {
|
|
19423
19474
|
variant: e.operator === "+" ? "success" : "destructive",
|
|
19424
19475
|
className: "flex items-center gap-1 pr-1",
|
|
19425
19476
|
children: [
|
|
19426
19477
|
/* @__PURE__ */ g("button", {
|
|
19427
19478
|
type: "button",
|
|
19428
|
-
onClick: () =>
|
|
19479
|
+
onClick: () => O(t),
|
|
19429
19480
|
className: "cursor-pointer hover:opacity-70",
|
|
19430
19481
|
title: "Toggle include/exclude",
|
|
19431
19482
|
children: e.operator === "+" ? /* @__PURE__ */ g(be, { className: "h-3 w-3" }) : /* @__PURE__ */ g(ve, { className: "h-3 w-3" })
|
|
@@ -19436,7 +19487,7 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19436
19487
|
}),
|
|
19437
19488
|
/* @__PURE__ */ g("button", {
|
|
19438
19489
|
type: "button",
|
|
19439
|
-
onClick: () =>
|
|
19490
|
+
onClick: () => D(t),
|
|
19440
19491
|
className: "cursor-pointer hover:opacity-70 ml-0.5",
|
|
19441
19492
|
"aria-label": `Remove ${e.entity}`,
|
|
19442
19493
|
children: /* @__PURE__ */ g(Ee, { className: "h-3 w-3" })
|
|
@@ -19446,11 +19497,11 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19446
19497
|
ref: u,
|
|
19447
19498
|
type: "text",
|
|
19448
19499
|
value: a,
|
|
19449
|
-
onChange:
|
|
19450
|
-
onKeyDown:
|
|
19500
|
+
onChange: k,
|
|
19501
|
+
onKeyDown: A,
|
|
19451
19502
|
onFocus: () => l(!0),
|
|
19452
19503
|
onBlur: () => setTimeout(() => l(!1), 150),
|
|
19453
|
-
placeholder:
|
|
19504
|
+
placeholder: T.length === 0 ? `Type + or - then ${qw[e]} name…` : "",
|
|
19454
19505
|
className: "flex-1 min-w-28 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
19455
19506
|
})]
|
|
19456
19507
|
}),
|
|
@@ -19463,7 +19514,7 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19463
19514
|
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
19464
19515
|
children: [
|
|
19465
19516
|
"No ",
|
|
19466
|
-
e,
|
|
19517
|
+
qw[e],
|
|
19467
19518
|
"s found"
|
|
19468
19519
|
]
|
|
19469
19520
|
}) : /* @__PURE__ */ g("ul", {
|
|
@@ -19471,7 +19522,7 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19471
19522
|
children: C.map((e) => /* @__PURE__ */ g("li", { children: /* @__PURE__ */ _("button", {
|
|
19472
19523
|
type: "button",
|
|
19473
19524
|
className: "w-full cursor-pointer text-left px-3 py-2 text-sm hover:bg-accent flex items-center gap-2",
|
|
19474
|
-
onMouseDown: () =>
|
|
19525
|
+
onMouseDown: () => E(e.id, e.label, x),
|
|
19475
19526
|
children: [
|
|
19476
19527
|
/* @__PURE__ */ g("span", {
|
|
19477
19528
|
className: `font-mono text-xs font-bold ${x === "+" ? "text-green-600" : "text-red-500"}`,
|
|
@@ -19501,14 +19552,14 @@ function qw({ type: e, value: t, onChange: n, label: r, required: i }) {
|
|
|
19501
19552
|
}
|
|
19502
19553
|
//#endregion
|
|
19503
19554
|
//#region src/core/hooks/useGroups.ts
|
|
19504
|
-
function
|
|
19555
|
+
function Yw(e) {
|
|
19505
19556
|
let t = e.user_metadata ?? {}, n = e.id;
|
|
19506
19557
|
return t.name ? n = t.name : e.first_name || e.last_name ? n = `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim() : e.description && (n = e.description), {
|
|
19507
19558
|
...e,
|
|
19508
19559
|
name: n
|
|
19509
19560
|
};
|
|
19510
19561
|
}
|
|
19511
|
-
function
|
|
19562
|
+
function Xw(e = {}) {
|
|
19512
19563
|
let t = G(), { skip: n, limit: r, activeOnly: i, search: a } = e;
|
|
19513
19564
|
return C({
|
|
19514
19565
|
queryKey: ["groups", e],
|
|
@@ -19516,13 +19567,13 @@ function Yw(e = {}) {
|
|
|
19516
19567
|
let e = { user_type: "USERGROUP" };
|
|
19517
19568
|
if (i !== void 0 && (e.active = i), a && a.trim()) {
|
|
19518
19569
|
let n = await t.get("/users/", { params: e }), r = a.trim().toLowerCase();
|
|
19519
|
-
return (n.data ?? []).map(
|
|
19570
|
+
return (n.data ?? []).map(Yw).filter((e) => (e.name ?? "").toLowerCase().includes(r) || (e.description ?? "").toLowerCase().includes(r) || e.id.toLowerCase().includes(r));
|
|
19520
19571
|
}
|
|
19521
|
-
return n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), ((await t.get("/users/", { params: e })).data ?? []).map(
|
|
19572
|
+
return n !== void 0 && (e.skip = n), r !== void 0 && (e.limit = r), ((await t.get("/users/", { params: e })).data ?? []).map(Yw);
|
|
19522
19573
|
}
|
|
19523
19574
|
});
|
|
19524
19575
|
}
|
|
19525
|
-
function
|
|
19576
|
+
function Zw(e = {}) {
|
|
19526
19577
|
let t = G(), { activeOnly: n } = e;
|
|
19527
19578
|
return C({
|
|
19528
19579
|
queryKey: [
|
|
@@ -19536,7 +19587,7 @@ function Xw(e = {}) {
|
|
|
19536
19587
|
}
|
|
19537
19588
|
});
|
|
19538
19589
|
}
|
|
19539
|
-
function
|
|
19590
|
+
function Qw(e) {
|
|
19540
19591
|
let t = G();
|
|
19541
19592
|
return C({
|
|
19542
19593
|
queryKey: ["groups", e],
|
|
@@ -19544,7 +19595,7 @@ function Zw(e) {
|
|
|
19544
19595
|
enabled: !!e
|
|
19545
19596
|
});
|
|
19546
19597
|
}
|
|
19547
|
-
function
|
|
19598
|
+
function $w(e) {
|
|
19548
19599
|
let t = G();
|
|
19549
19600
|
return C({
|
|
19550
19601
|
queryKey: [
|
|
@@ -19561,14 +19612,30 @@ function Qw(e) {
|
|
|
19561
19612
|
enabled: !!e
|
|
19562
19613
|
});
|
|
19563
19614
|
}
|
|
19564
|
-
function
|
|
19615
|
+
function eT() {
|
|
19565
19616
|
let e = G(), t = w();
|
|
19566
19617
|
return S({
|
|
19567
|
-
mutationFn: async (t) =>
|
|
19618
|
+
mutationFn: async (t) => {
|
|
19619
|
+
let n = t.id || t.name || "", r = t.description ?? "", i = {
|
|
19620
|
+
id: n,
|
|
19621
|
+
type: "USERGROUP",
|
|
19622
|
+
active: t.active ?? !0,
|
|
19623
|
+
expression: t.expression ?? null,
|
|
19624
|
+
manager_id: null,
|
|
19625
|
+
parent_group_id: t.parent_group_id ?? null,
|
|
19626
|
+
owner_id: t.owner_id ?? null,
|
|
19627
|
+
description: r,
|
|
19628
|
+
user_metadata: {
|
|
19629
|
+
name: t.name ?? n,
|
|
19630
|
+
description: r
|
|
19631
|
+
}
|
|
19632
|
+
};
|
|
19633
|
+
return (await e.post("/users/", i)).data;
|
|
19634
|
+
},
|
|
19568
19635
|
onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
|
|
19569
19636
|
});
|
|
19570
19637
|
}
|
|
19571
|
-
function
|
|
19638
|
+
function tT() {
|
|
19572
19639
|
let e = G(), t = w();
|
|
19573
19640
|
return S({
|
|
19574
19641
|
mutationFn: async (t) => (await e.put(`/users/${t.id}`, t)).data,
|
|
@@ -19577,7 +19644,7 @@ function eT() {
|
|
|
19577
19644
|
}
|
|
19578
19645
|
});
|
|
19579
19646
|
}
|
|
19580
|
-
function
|
|
19647
|
+
function nT() {
|
|
19581
19648
|
let e = G(), t = w();
|
|
19582
19649
|
return S({
|
|
19583
19650
|
mutationFn: async (t) => {
|
|
@@ -19586,7 +19653,7 @@ function tT() {
|
|
|
19586
19653
|
onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
|
|
19587
19654
|
});
|
|
19588
19655
|
}
|
|
19589
|
-
function
|
|
19656
|
+
function rT() {
|
|
19590
19657
|
let e = G(), t = w();
|
|
19591
19658
|
return S({
|
|
19592
19659
|
mutationFn: async ({ groupId: t, userId: n }) => {
|
|
@@ -19599,7 +19666,7 @@ function nT() {
|
|
|
19599
19666
|
] })
|
|
19600
19667
|
});
|
|
19601
19668
|
}
|
|
19602
|
-
function
|
|
19669
|
+
function iT() {
|
|
19603
19670
|
let e = G(), t = w();
|
|
19604
19671
|
return S({
|
|
19605
19672
|
mutationFn: async ({ groupId: t, userId: n }) => {
|
|
@@ -19614,14 +19681,14 @@ function rT() {
|
|
|
19614
19681
|
}
|
|
19615
19682
|
//#endregion
|
|
19616
19683
|
//#region src/components/dialogs/GroupDialog.tsx
|
|
19617
|
-
var
|
|
19684
|
+
var aT = JC({
|
|
19618
19685
|
name: KC().min(1, "Name is required"),
|
|
19619
19686
|
description: KC().optional(),
|
|
19620
19687
|
expression: KC().min(1, "Expression is required")
|
|
19621
19688
|
});
|
|
19622
|
-
function
|
|
19623
|
-
let r = !!n, i =
|
|
19624
|
-
resolver: gS(
|
|
19689
|
+
function oT({ open: e, onClose: t, group: n }) {
|
|
19690
|
+
let r = !!n, i = eT(), a = tT(), { register: o, handleSubmit: s, watch: l, setValue: u, formState: { errors: d }, reset: f } = uS({
|
|
19691
|
+
resolver: gS(aT),
|
|
19625
19692
|
defaultValues: {
|
|
19626
19693
|
name: "",
|
|
19627
19694
|
description: "",
|
|
@@ -19652,7 +19719,7 @@ function aT({ open: e, onClose: t, group: n }) {
|
|
|
19652
19719
|
function m() {
|
|
19653
19720
|
f(), t();
|
|
19654
19721
|
}
|
|
19655
|
-
let { data: h = [], isLoading: v } =
|
|
19722
|
+
let { data: h = [], isLoading: v } = $w(r ? n.id : ""), { data: y = [], isLoading: b } = Cw(r ? n.id : "");
|
|
19656
19723
|
return /* @__PURE__ */ g(XC, {
|
|
19657
19724
|
open: e,
|
|
19658
19725
|
onOpenChange: (e) => !e && m(),
|
|
@@ -19710,7 +19777,7 @@ function aT({ open: e, onClose: t, group: n }) {
|
|
|
19710
19777
|
...o("description")
|
|
19711
19778
|
})]
|
|
19712
19779
|
}),
|
|
19713
|
-
/* @__PURE__ */ g(
|
|
19780
|
+
/* @__PURE__ */ g(Jw, {
|
|
19714
19781
|
type: "user",
|
|
19715
19782
|
value: l("expression"),
|
|
19716
19783
|
onChange: (e) => u("expression", e),
|
|
@@ -19786,12 +19853,12 @@ function aT({ open: e, onClose: t, group: n }) {
|
|
|
19786
19853
|
}
|
|
19787
19854
|
//#endregion
|
|
19788
19855
|
//#region src/components/views/GroupsView.tsx
|
|
19789
|
-
function
|
|
19790
|
-
let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f(!1), [c, l] = f(), [u, d] = f(), { data: p = [], isLoading: m, isError: h, refetch: v } =
|
|
19856
|
+
function sT() {
|
|
19857
|
+
let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f(!1), [c, l] = f(), [u, d] = f(), { data: p = [], isLoading: m, isError: h, refetch: v } = Xw({
|
|
19791
19858
|
skip: e,
|
|
19792
19859
|
limit: n,
|
|
19793
19860
|
search: i
|
|
19794
|
-
}), { data: y = 0 } =
|
|
19861
|
+
}), { data: y = 0 } = Zw(), b = nT();
|
|
19795
19862
|
return /* @__PURE__ */ _("div", {
|
|
19796
19863
|
className: "space-y-4",
|
|
19797
19864
|
children: [
|
|
@@ -19868,7 +19935,7 @@ function oT() {
|
|
|
19868
19935
|
t(e.pageIndex * e.pageSize), r(e.pageSize);
|
|
19869
19936
|
}
|
|
19870
19937
|
}),
|
|
19871
|
-
/* @__PURE__ */ g(
|
|
19938
|
+
/* @__PURE__ */ g(oT, {
|
|
19872
19939
|
open: o,
|
|
19873
19940
|
onClose: () => {
|
|
19874
19941
|
s(!1), l(void 0);
|
|
@@ -19890,7 +19957,7 @@ function oT() {
|
|
|
19890
19957
|
}
|
|
19891
19958
|
//#endregion
|
|
19892
19959
|
//#region src/core/lib/expression.ts
|
|
19893
|
-
function
|
|
19960
|
+
function cT(e) {
|
|
19894
19961
|
if (!e) return [];
|
|
19895
19962
|
let t = e.replace(/“/g, "\"").replace(/”/g, "\""), n = [], r = /([+-]?)\s*(".*?"|[^+-]+)/g, i, a = !0;
|
|
19896
19963
|
for (; (i = r.exec(t)) !== null;) {
|
|
@@ -19905,13 +19972,13 @@ function sT(e) {
|
|
|
19905
19972
|
}
|
|
19906
19973
|
return n;
|
|
19907
19974
|
}
|
|
19908
|
-
function
|
|
19975
|
+
function lT(e, t, n) {
|
|
19909
19976
|
if (!t) return !1;
|
|
19910
19977
|
let r = /* @__PURE__ */ new Set();
|
|
19911
19978
|
function i(t, a = 0) {
|
|
19912
19979
|
if (a > 10) return !1;
|
|
19913
19980
|
let o = !1;
|
|
19914
|
-
for (let s of
|
|
19981
|
+
for (let s of cT(t)) {
|
|
19915
19982
|
let t = s.entity.trim();
|
|
19916
19983
|
if (t === e) {
|
|
19917
19984
|
o = s.type === "include";
|
|
@@ -19930,20 +19997,20 @@ function cT(e, t, n) {
|
|
|
19930
19997
|
}
|
|
19931
19998
|
//#endregion
|
|
19932
19999
|
//#region src/core/hooks/useHierarchy.ts
|
|
19933
|
-
function
|
|
20000
|
+
function uT(e) {
|
|
19934
20001
|
return e.user_metadata?.name || e.name || e.id;
|
|
19935
20002
|
}
|
|
19936
|
-
function
|
|
20003
|
+
function dT(e) {
|
|
19937
20004
|
return e.name || [e.first_name, e.last_name].filter(Boolean).join(" ") || e.id;
|
|
19938
20005
|
}
|
|
19939
|
-
function
|
|
20006
|
+
function fT(e, t) {
|
|
19940
20007
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
19941
20008
|
for (let t of e) if (n.set(t.id, {
|
|
19942
20009
|
id: t.id,
|
|
19943
|
-
name:
|
|
20010
|
+
name: uT(t),
|
|
19944
20011
|
type: "USERGROUP",
|
|
19945
20012
|
children: []
|
|
19946
|
-
}), t.expression) for (let n of
|
|
20013
|
+
}), t.expression) for (let n of cT(t.expression)) {
|
|
19947
20014
|
let i = n.entity.trim();
|
|
19948
20015
|
n.type === "include" && e.some((e) => e.id === i) && (r.has(i) || r.set(i, []), r.get(i).push(t.id));
|
|
19949
20016
|
}
|
|
@@ -19954,9 +20021,9 @@ function dT(e, t) {
|
|
|
19954
20021
|
}
|
|
19955
20022
|
let o = e.find((e) => e.id === i);
|
|
19956
20023
|
if (!o?.expression) continue;
|
|
19957
|
-
let s = t.filter((t) =>
|
|
20024
|
+
let s = t.filter((t) => lT(t.id, o.expression, e)).map((e) => ({
|
|
19958
20025
|
id: e.id,
|
|
19959
|
-
name:
|
|
20026
|
+
name: dT(e),
|
|
19960
20027
|
type: "USER",
|
|
19961
20028
|
children: [],
|
|
19962
20029
|
email: e.email,
|
|
@@ -19969,9 +20036,9 @@ function dT(e, t) {
|
|
|
19969
20036
|
name: "Groups",
|
|
19970
20037
|
type: "USERGROUP",
|
|
19971
20038
|
children: Array.from(n.values())
|
|
19972
|
-
}], a = t.filter((t) => !e.some((n) => n.expression &&
|
|
20039
|
+
}], a = t.filter((t) => !e.some((n) => n.expression && lT(t.id, n.expression, e))).map((e) => ({
|
|
19973
20040
|
id: e.id,
|
|
19974
|
-
name:
|
|
20041
|
+
name: dT(e),
|
|
19975
20042
|
type: "USER",
|
|
19976
20043
|
children: [],
|
|
19977
20044
|
email: e.email,
|
|
@@ -19984,24 +20051,24 @@ function dT(e, t) {
|
|
|
19984
20051
|
children: a
|
|
19985
20052
|
}), i;
|
|
19986
20053
|
}
|
|
19987
|
-
function
|
|
20054
|
+
function pT() {
|
|
19988
20055
|
let e = G();
|
|
19989
20056
|
return C({
|
|
19990
20057
|
queryKey: ["hierarchy", "org"],
|
|
19991
20058
|
queryFn: async () => (await e.get("/reporting/organization-chart")).data
|
|
19992
20059
|
});
|
|
19993
20060
|
}
|
|
19994
|
-
function
|
|
20061
|
+
function mT() {
|
|
19995
20062
|
let e = G();
|
|
19996
20063
|
return C({
|
|
19997
20064
|
queryKey: ["hierarchy", "combined"],
|
|
19998
20065
|
queryFn: async () => {
|
|
19999
20066
|
let [t, n] = await Promise.all([e.get("/users/", { params: { user_type: "USERGROUP" } }), e.get("/users/", { params: { user_type: "USER" } })]);
|
|
20000
|
-
return
|
|
20067
|
+
return fT(t.data ?? [], n.data ?? []);
|
|
20001
20068
|
}
|
|
20002
20069
|
});
|
|
20003
20070
|
}
|
|
20004
|
-
function
|
|
20071
|
+
function hT(e, t) {
|
|
20005
20072
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
20006
20073
|
for (let t of e) if (n.set(t.id, {
|
|
20007
20074
|
id: t.id,
|
|
@@ -20009,7 +20076,7 @@ function mT(e, t) {
|
|
|
20009
20076
|
type: "RESOURCEGROUP",
|
|
20010
20077
|
children: [],
|
|
20011
20078
|
application: t.application
|
|
20012
|
-
}), t.expression) for (let n of
|
|
20079
|
+
}), t.expression) for (let n of cT(t.expression)) {
|
|
20013
20080
|
let i = n.entity.trim();
|
|
20014
20081
|
n.type === "include" && e.some((e) => e.id === i) && (r.has(i) || r.set(i, []), r.get(i).push(t.id));
|
|
20015
20082
|
}
|
|
@@ -20020,7 +20087,7 @@ function mT(e, t) {
|
|
|
20020
20087
|
}
|
|
20021
20088
|
let o = e.find((e) => e.id === i);
|
|
20022
20089
|
if (!o?.expression) continue;
|
|
20023
|
-
let s = t.filter((t) =>
|
|
20090
|
+
let s = t.filter((t) => lT(t.id, o.expression, e)).map((e) => ({
|
|
20024
20091
|
id: e.id,
|
|
20025
20092
|
name: e.name || e.id,
|
|
20026
20093
|
type: "RESOURCE",
|
|
@@ -20031,10 +20098,10 @@ function mT(e, t) {
|
|
|
20031
20098
|
}
|
|
20032
20099
|
let i = [{
|
|
20033
20100
|
id: "groups_root",
|
|
20034
|
-
name: "
|
|
20101
|
+
name: "Artifact Groups",
|
|
20035
20102
|
type: "RESOURCEGROUP",
|
|
20036
20103
|
children: Array.from(n.values())
|
|
20037
|
-
}], a = t.filter((t) => !e.some((n) => n.expression &&
|
|
20104
|
+
}], a = t.filter((t) => !e.some((n) => n.expression && lT(t.id, n.expression, e))).map((e) => ({
|
|
20038
20105
|
id: e.id,
|
|
20039
20106
|
name: e.name || e.id,
|
|
20040
20107
|
type: "RESOURCE",
|
|
@@ -20043,30 +20110,30 @@ function mT(e, t) {
|
|
|
20043
20110
|
}));
|
|
20044
20111
|
return a.length > 0 && i.push({
|
|
20045
20112
|
id: "artifacts_root",
|
|
20046
|
-
name: "Ungrouped
|
|
20113
|
+
name: "Ungrouped Artifacts",
|
|
20047
20114
|
type: "RESOURCE",
|
|
20048
20115
|
children: a
|
|
20049
20116
|
}), i;
|
|
20050
20117
|
}
|
|
20051
|
-
function
|
|
20118
|
+
function gT() {
|
|
20052
20119
|
let e = G();
|
|
20053
20120
|
return C({
|
|
20054
20121
|
queryKey: ["hierarchy", "artifacts-combined"],
|
|
20055
20122
|
queryFn: async () => {
|
|
20056
20123
|
let [t, n] = await Promise.all([e.get("/artifacts/", { params: { artifact_type: "RESOURCEGROUP" } }), e.get("/artifacts/", { params: { artifact_type: "RESOURCE" } })]);
|
|
20057
|
-
return
|
|
20124
|
+
return hT(t.data ?? [], n.data ?? []);
|
|
20058
20125
|
}
|
|
20059
20126
|
});
|
|
20060
20127
|
}
|
|
20061
20128
|
//#endregion
|
|
20062
20129
|
//#region src/components/views/UsersView.tsx
|
|
20063
|
-
function
|
|
20130
|
+
function _T() {
|
|
20064
20131
|
let [e, t] = f(0), [n, r] = f(20), [i, a] = f(""), [o, s] = f("all"), [c, l] = f("users"), [u, d] = f(!1), [p, m] = f(), [h, v] = f(!1), [y, b] = f(), { data: x = [], isLoading: S, isError: C, refetch: w } = aw({
|
|
20065
20132
|
skip: e,
|
|
20066
20133
|
limit: n,
|
|
20067
20134
|
search: i,
|
|
20068
20135
|
activeOnly: o === "active" ? !0 : o === "inactive" ? !1 : void 0
|
|
20069
|
-
}), { data: T = 0 } = ow({ search: i }), E = mw(), { data: D = [] } =
|
|
20136
|
+
}), { data: T = 0 } = ow({ search: i }), E = mw(), { data: D = [] } = mT();
|
|
20070
20137
|
return /* @__PURE__ */ _("div", {
|
|
20071
20138
|
className: "space-y-4",
|
|
20072
20139
|
children: [
|
|
@@ -20190,7 +20257,7 @@ function gT() {
|
|
|
20190
20257
|
}),
|
|
20191
20258
|
/* @__PURE__ */ g(Gh, {
|
|
20192
20259
|
value: "groups",
|
|
20193
|
-
children: /* @__PURE__ */ g(
|
|
20260
|
+
children: /* @__PURE__ */ g(sT, {})
|
|
20194
20261
|
}),
|
|
20195
20262
|
/* @__PURE__ */ g(Gh, {
|
|
20196
20263
|
value: "hierarchy",
|
|
@@ -20208,7 +20275,7 @@ function gT() {
|
|
|
20208
20275
|
},
|
|
20209
20276
|
user: p
|
|
20210
20277
|
}),
|
|
20211
|
-
/* @__PURE__ */ g(
|
|
20278
|
+
/* @__PURE__ */ g(oT, {
|
|
20212
20279
|
open: h,
|
|
20213
20280
|
onClose: () => v(!1)
|
|
20214
20281
|
}),
|
|
@@ -20227,7 +20294,7 @@ function gT() {
|
|
|
20227
20294
|
}
|
|
20228
20295
|
//#endregion
|
|
20229
20296
|
//#region src/components/dialogs/ArtifactDialog.tsx
|
|
20230
|
-
var
|
|
20297
|
+
var vT = JC({
|
|
20231
20298
|
name: KC().min(1, "Name is required"),
|
|
20232
20299
|
description: KC().optional(),
|
|
20233
20300
|
type: YC(["RESOURCE", "RESOURCEGROUP"]),
|
|
@@ -20235,9 +20302,9 @@ var _T = JC({
|
|
|
20235
20302
|
expression: KC().optional(),
|
|
20236
20303
|
status: YC(["Active", "Inactive"])
|
|
20237
20304
|
});
|
|
20238
|
-
function
|
|
20305
|
+
function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin: i }) {
|
|
20239
20306
|
let a = !!n, o = Hw(), s = Uw(), { register: l, handleSubmit: u, watch: d, setValue: p, formState: { errors: m }, reset: h } = uS({
|
|
20240
|
-
resolver: gS(
|
|
20307
|
+
resolver: gS(vT),
|
|
20241
20308
|
defaultValues: {
|
|
20242
20309
|
name: "",
|
|
20243
20310
|
description: "",
|
|
@@ -20371,10 +20438,10 @@ function vT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
|
|
|
20371
20438
|
onValueChange: (e) => p("type", e),
|
|
20372
20439
|
children: [/* @__PURE__ */ g(pb, { children: /* @__PURE__ */ g(fb, {}) }), /* @__PURE__ */ _(mb, { children: [/* @__PURE__ */ g(hb, {
|
|
20373
20440
|
value: "RESOURCE",
|
|
20374
|
-
children: "
|
|
20441
|
+
children: "Artifact"
|
|
20375
20442
|
}), /* @__PURE__ */ g(hb, {
|
|
20376
20443
|
value: "RESOURCEGROUP",
|
|
20377
|
-
children: "
|
|
20444
|
+
children: "Artifact Group"
|
|
20378
20445
|
})] })]
|
|
20379
20446
|
})]
|
|
20380
20447
|
}), /* @__PURE__ */ _("div", {
|
|
@@ -20496,11 +20563,11 @@ function vT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
|
|
|
20496
20563
|
})
|
|
20497
20564
|
]
|
|
20498
20565
|
}),
|
|
20499
|
-
v === "RESOURCEGROUP" && /* @__PURE__ */ g(
|
|
20566
|
+
v === "RESOURCEGROUP" && /* @__PURE__ */ g(Jw, {
|
|
20500
20567
|
type: "resource",
|
|
20501
20568
|
value: d("expression") ?? "",
|
|
20502
20569
|
onChange: (e) => p("expression", e),
|
|
20503
|
-
label: "
|
|
20570
|
+
label: "Artifacts Expression",
|
|
20504
20571
|
currentApplication: r,
|
|
20505
20572
|
isAdmin: i
|
|
20506
20573
|
}),
|
|
@@ -20550,7 +20617,7 @@ function vT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
|
|
|
20550
20617
|
children: "Loading members…"
|
|
20551
20618
|
}) : (ie.data ?? []).length === 0 ? /* @__PURE__ */ g("p", {
|
|
20552
20619
|
className: "py-6 text-center text-sm text-muted-foreground",
|
|
20553
|
-
children: "No member
|
|
20620
|
+
children: "No member artifacts"
|
|
20554
20621
|
}) : /* @__PURE__ */ g("ul", {
|
|
20555
20622
|
className: "space-y-1.5 py-2",
|
|
20556
20623
|
children: ie.data.map((e) => /* @__PURE__ */ _("li", {
|
|
@@ -20568,7 +20635,7 @@ function vT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
|
|
|
20568
20635
|
children: "Loading parent groups…"
|
|
20569
20636
|
}) : (ae.data ?? []).length === 0 ? /* @__PURE__ */ g("p", {
|
|
20570
20637
|
className: "py-6 text-center text-sm text-muted-foreground",
|
|
20571
|
-
children: "Not a member of any
|
|
20638
|
+
children: "Not a member of any artifact group"
|
|
20572
20639
|
}) : /* @__PURE__ */ g("ul", {
|
|
20573
20640
|
className: "space-y-1.5 py-2",
|
|
20574
20641
|
children: ae.data.map((e) => /* @__PURE__ */ _("li", {
|
|
@@ -20590,18 +20657,19 @@ function vT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
|
|
|
20590
20657
|
}
|
|
20591
20658
|
//#endregion
|
|
20592
20659
|
//#region src/components/views/ArtifactsView.tsx
|
|
20593
|
-
function
|
|
20660
|
+
function bT() {
|
|
20594
20661
|
let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f("RESOURCE"), [u, d] = f("all"), [p, m] = f("all"), [h, v] = f(!1), [y, b] = f(), [x, S] = f(), { data: C = [] } = Vw(), w = t ? p === "all" ? void 0 : p : e, { data: T = [], isLoading: E, isError: D, refetch: O } = Pw({
|
|
20595
20662
|
skip: n,
|
|
20596
20663
|
limit: i,
|
|
20597
20664
|
type: c,
|
|
20598
20665
|
appName: w,
|
|
20599
|
-
activeOnly: u === "active" ? !0 : u === "inactive" ? !1 : void 0
|
|
20666
|
+
activeOnly: u === "active" ? !0 : u === "inactive" ? !1 : void 0,
|
|
20667
|
+
search: o
|
|
20600
20668
|
}), { data: k = 0 } = Fw({
|
|
20601
20669
|
type: c,
|
|
20602
20670
|
appName: w,
|
|
20603
20671
|
search: o
|
|
20604
|
-
}), A = Ww(), { data: j = [] } =
|
|
20672
|
+
}), A = Ww(), { data: j = [] } = gT(), M = [
|
|
20605
20673
|
{
|
|
20606
20674
|
accessorKey: "name",
|
|
20607
20675
|
header: "Name"
|
|
@@ -20671,11 +20739,11 @@ function yT() {
|
|
|
20671
20739
|
children: [/* @__PURE__ */ _(Uh, { children: [
|
|
20672
20740
|
/* @__PURE__ */ g(Wh, {
|
|
20673
20741
|
value: "resources",
|
|
20674
|
-
children: "
|
|
20742
|
+
children: "Artifacts"
|
|
20675
20743
|
}),
|
|
20676
20744
|
/* @__PURE__ */ g(Wh, {
|
|
20677
20745
|
value: "groups",
|
|
20678
|
-
children: "
|
|
20746
|
+
children: "Artifact Groups"
|
|
20679
20747
|
}),
|
|
20680
20748
|
/* @__PURE__ */ g(Wh, {
|
|
20681
20749
|
value: "hierarchy",
|
|
@@ -20688,7 +20756,7 @@ function yT() {
|
|
|
20688
20756
|
children: [
|
|
20689
20757
|
/* @__PURE__ */ g(ge, { className: "mr-2 h-4 w-4" }),
|
|
20690
20758
|
" Add ",
|
|
20691
|
-
c === "RESOURCE" ? "
|
|
20759
|
+
c === "RESOURCE" ? "Artifact" : "Group"
|
|
20692
20760
|
]
|
|
20693
20761
|
})]
|
|
20694
20762
|
}),
|
|
@@ -20698,7 +20766,7 @@ function yT() {
|
|
|
20698
20766
|
className: "rounded-md border border-destructive/50 p-4 flex items-center justify-between",
|
|
20699
20767
|
children: [/* @__PURE__ */ g("span", {
|
|
20700
20768
|
className: "text-sm text-destructive",
|
|
20701
|
-
children: "Failed to load
|
|
20769
|
+
children: "Failed to load artifacts"
|
|
20702
20770
|
}), /* @__PURE__ */ g(qh, {
|
|
20703
20771
|
variant: "outline",
|
|
20704
20772
|
size: "sm",
|
|
@@ -20710,8 +20778,8 @@ function yT() {
|
|
|
20710
20778
|
data: T,
|
|
20711
20779
|
totalCount: k,
|
|
20712
20780
|
isLoading: E,
|
|
20713
|
-
emptyMessage: "No
|
|
20714
|
-
searchPlaceholder: "Search
|
|
20781
|
+
emptyMessage: "No artifacts found",
|
|
20782
|
+
searchPlaceholder: "Search artifacts...",
|
|
20715
20783
|
onSearchChange: (e) => {
|
|
20716
20784
|
s(e), r(0);
|
|
20717
20785
|
},
|
|
@@ -20732,7 +20800,7 @@ function yT() {
|
|
|
20732
20800
|
data: T,
|
|
20733
20801
|
totalCount: k,
|
|
20734
20802
|
isLoading: E,
|
|
20735
|
-
emptyMessage: "No
|
|
20803
|
+
emptyMessage: "No artifact groups found",
|
|
20736
20804
|
onPaginationChange: (e) => {
|
|
20737
20805
|
r(e.pageIndex * e.pageSize), a(e.pageSize);
|
|
20738
20806
|
},
|
|
@@ -20752,7 +20820,7 @@ function yT() {
|
|
|
20752
20820
|
})
|
|
20753
20821
|
]
|
|
20754
20822
|
}),
|
|
20755
|
-
/* @__PURE__ */ g(
|
|
20823
|
+
/* @__PURE__ */ g(yT, {
|
|
20756
20824
|
open: h,
|
|
20757
20825
|
onClose: () => {
|
|
20758
20826
|
v(!1), b(void 0);
|
|
@@ -20776,16 +20844,16 @@ function yT() {
|
|
|
20776
20844
|
}
|
|
20777
20845
|
//#endregion
|
|
20778
20846
|
//#region src/components/dialogs/AccessRuleDialog.tsx
|
|
20779
|
-
var
|
|
20847
|
+
var xT = [
|
|
20780
20848
|
"Read",
|
|
20781
20849
|
"Write",
|
|
20782
20850
|
"Execute",
|
|
20783
20851
|
"Export"
|
|
20784
|
-
],
|
|
20852
|
+
], ST = JC({
|
|
20785
20853
|
name: KC().min(1, "Name is required"),
|
|
20786
20854
|
description: KC().optional(),
|
|
20787
20855
|
userExpression: KC().min(1, "User expression is required"),
|
|
20788
|
-
resourceExpression: KC().min(1, "
|
|
20856
|
+
resourceExpression: KC().min(1, "Artifact expression is required"),
|
|
20789
20857
|
permissions: qC(KC()).min(1, "At least one permission is required"),
|
|
20790
20858
|
application: KC().optional(),
|
|
20791
20859
|
status: YC(["Active", "Inactive"]),
|
|
@@ -20794,9 +20862,9 @@ var bT = [
|
|
|
20794
20862
|
startTime: KC().optional(),
|
|
20795
20863
|
endTime: KC().optional()
|
|
20796
20864
|
});
|
|
20797
|
-
function
|
|
20798
|
-
let a = !!n, o = Ow(), s = kw(), [l, u] = f(
|
|
20799
|
-
resolver: gS(
|
|
20865
|
+
function CT({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i }) {
|
|
20866
|
+
let a = !!n, o = Ow(), s = kw(), [l, u] = f(xT), [d, p] = f(""), { register: m, handleSubmit: h, watch: v, setValue: y, formState: { errors: b }, reset: x } = uS({
|
|
20867
|
+
resolver: gS(ST),
|
|
20800
20868
|
defaultValues: {
|
|
20801
20869
|
name: "",
|
|
20802
20870
|
description: "",
|
|
@@ -20813,8 +20881,8 @@ function ST({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
|
|
|
20813
20881
|
});
|
|
20814
20882
|
c(() => {
|
|
20815
20883
|
if (e) {
|
|
20816
|
-
let e = (n?.permissions ?? []).filter((e) => !
|
|
20817
|
-
u(e.length ? [...
|
|
20884
|
+
let e = (n?.permissions ?? []).filter((e) => !xT.includes(e));
|
|
20885
|
+
u(e.length ? [...xT, ...e] : xT), p(""), x({
|
|
20818
20886
|
name: n?.name ?? "",
|
|
20819
20887
|
description: n?.description ?? "",
|
|
20820
20888
|
userExpression: n?.userExpression ?? "",
|
|
@@ -20907,7 +20975,7 @@ function ST({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
|
|
|
20907
20975
|
...m("description")
|
|
20908
20976
|
})]
|
|
20909
20977
|
}),
|
|
20910
|
-
/* @__PURE__ */ g(
|
|
20978
|
+
/* @__PURE__ */ g(Jw, {
|
|
20911
20979
|
type: "user",
|
|
20912
20980
|
value: v("userExpression"),
|
|
20913
20981
|
onChange: (e) => y("userExpression", e),
|
|
@@ -20920,11 +20988,11 @@ function ST({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
|
|
|
20920
20988
|
className: "text-xs text-destructive",
|
|
20921
20989
|
children: b.userExpression.message
|
|
20922
20990
|
}),
|
|
20923
|
-
/* @__PURE__ */ g(
|
|
20991
|
+
/* @__PURE__ */ g(Jw, {
|
|
20924
20992
|
type: "resource",
|
|
20925
20993
|
value: v("resourceExpression"),
|
|
20926
20994
|
onChange: (e) => y("resourceExpression", e),
|
|
20927
|
-
label: "
|
|
20995
|
+
label: "Artifact Expression",
|
|
20928
20996
|
required: !0,
|
|
20929
20997
|
currentApplication: r,
|
|
20930
20998
|
isAdmin: i
|
|
@@ -21069,12 +21137,13 @@ function ST({ open: e, onClose: t, rule: n, currentApplication: r, isAdmin: i })
|
|
|
21069
21137
|
}
|
|
21070
21138
|
//#endregion
|
|
21071
21139
|
//#region src/components/views/AccessRulesView.tsx
|
|
21072
|
-
function
|
|
21140
|
+
function wT() {
|
|
21073
21141
|
let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f("all"), [u, d] = f("all"), [p, m] = f(!1), [h, v] = f(), [y, b] = f(), { data: x = [] } = Vw(), S = t ? u === "all" ? void 0 : u : e, C = c === "active" ? !0 : c === "inactive" ? !1 : void 0, { data: w = [], isLoading: T, isError: E, refetch: D } = gw({
|
|
21074
21142
|
skip: n,
|
|
21075
21143
|
limit: i,
|
|
21076
21144
|
appName: S,
|
|
21077
|
-
activeOnly: C
|
|
21145
|
+
activeOnly: C,
|
|
21146
|
+
search: o
|
|
21078
21147
|
}), { data: O = 0 } = _w({
|
|
21079
21148
|
search: o,
|
|
21080
21149
|
appName: S,
|
|
@@ -21098,7 +21167,7 @@ function CT() {
|
|
|
21098
21167
|
},
|
|
21099
21168
|
{
|
|
21100
21169
|
accessorKey: "resourceExpression",
|
|
21101
|
-
header: "
|
|
21170
|
+
header: "Artifact Expression",
|
|
21102
21171
|
cell: ({ row: e }) => /* @__PURE__ */ g("span", {
|
|
21103
21172
|
className: "font-mono text-xs max-w-[140px] truncate block",
|
|
21104
21173
|
children: e.original.resourceExpression
|
|
@@ -21205,7 +21274,7 @@ function CT() {
|
|
|
21205
21274
|
},
|
|
21206
21275
|
toolbar: j
|
|
21207
21276
|
}),
|
|
21208
|
-
/* @__PURE__ */ g(
|
|
21277
|
+
/* @__PURE__ */ g(CT, {
|
|
21209
21278
|
open: p,
|
|
21210
21279
|
onClose: () => {
|
|
21211
21280
|
m(!1), v(void 0);
|
|
@@ -21229,7 +21298,7 @@ function CT() {
|
|
|
21229
21298
|
}
|
|
21230
21299
|
//#endregion
|
|
21231
21300
|
//#region src/MedhaOneAccess.tsx
|
|
21232
|
-
var
|
|
21301
|
+
var TT = [
|
|
21233
21302
|
{
|
|
21234
21303
|
id: "users",
|
|
21235
21304
|
label: "Users",
|
|
@@ -21246,7 +21315,7 @@ var wT = [
|
|
|
21246
21315
|
Icon: Se
|
|
21247
21316
|
}
|
|
21248
21317
|
];
|
|
21249
|
-
function
|
|
21318
|
+
function ET() {
|
|
21250
21319
|
let [e, t] = f("users");
|
|
21251
21320
|
return /* @__PURE__ */ _("div", {
|
|
21252
21321
|
className: "flex h-full bg-background",
|
|
@@ -21259,7 +21328,7 @@ function TT() {
|
|
|
21259
21328
|
className: "text-sm font-bold text-slate-600 uppercase tracking-wider",
|
|
21260
21329
|
children: "Access Control"
|
|
21261
21330
|
})
|
|
21262
|
-
}),
|
|
21331
|
+
}), TT.map(({ id: n, label: r, Icon: i }) => /* @__PURE__ */ _("button", {
|
|
21263
21332
|
onClick: () => t(n),
|
|
21264
21333
|
className: H("flex cursor-pointer items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium transition-colors text-left w-full", e === n ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-background/60 hover:text-foreground"),
|
|
21265
21334
|
children: [/* @__PURE__ */ g(i, { className: "h-4 w-4 shrink-0" }), r]
|
|
@@ -21270,9 +21339,9 @@ function TT() {
|
|
|
21270
21339
|
children: /* @__PURE__ */ _("div", {
|
|
21271
21340
|
className: "max-w-7xl mx-auto",
|
|
21272
21341
|
children: [
|
|
21273
|
-
e === "users" && /* @__PURE__ */ g(
|
|
21274
|
-
e === "artifacts" && /* @__PURE__ */ g(
|
|
21275
|
-
e === "access-rules" && /* @__PURE__ */ g(
|
|
21342
|
+
e === "users" && /* @__PURE__ */ g(_T, {}),
|
|
21343
|
+
e === "artifacts" && /* @__PURE__ */ g(bT, {}),
|
|
21344
|
+
e === "access-rules" && /* @__PURE__ */ g(wT, {})
|
|
21276
21345
|
]
|
|
21277
21346
|
})
|
|
21278
21347
|
}),
|
|
@@ -21284,6 +21353,6 @@ function TT() {
|
|
|
21284
21353
|
});
|
|
21285
21354
|
}
|
|
21286
21355
|
//#endregion
|
|
21287
|
-
export {
|
|
21356
|
+
export { CT as AccessRuleDialog, wT as AccessRulesView, yT as ArtifactDialog, bT as ArtifactsView, Yh as Badge, qh as Button, Ab as ConfirmDialog, yb as DataTable, Jw as ExpressionInput, oT as GroupDialog, sT as GroupsView, Rb as HierarchyTree, ub as Input, rw as Label, ET as MedhaOneAccess, Xy as MedhaOneAccessProvider, Nw as UserDialog, _T as UsersView, H as cn, Wy as generateToken, vw as useAccessRule, gw as useAccessRules, _w as useAccessRulesCount, rT as useAddGroupMember, Iw as useArtifact, ww as useArtifactAccess, gT as useArtifactCombinedHierarchy, Rw as useArtifactGroup, Tw as useArtifactGroupAccess, zw as useArtifactGroupContents, Lw as useArtifactGroups, Pw as useArtifacts, Fw as useArtifactsCount, yw as useCheckAccess, mT as useCombinedHierarchy, Ow as useCreateAccessRule, Hw as useCreateArtifact, eT as useCreateGroup, fw as useCreateUser, Aw as useDeleteAccessRule, Ww as useDeleteArtifact, nT as useDeleteGroup, mw as useDeleteUser, uw as useDepartments, Qw as useGroup, $w as useGroupMembers, Xw as useGroups, Zw as useGroupsCount, Bw as useGroupsForArtifact, Jy as useMedhaConfig, G as useMedhaHttp, pT as useOrgChart, iT as useRemoveGroupMember, dw as useRoles, Vw as useUniqueApplications, kw as useUpdateAccessRule, Uw as useUpdateArtifact, tT as useUpdateGroup, pw as useUpdateUser, sw as useUser, Sw as useUserAccess, Cw as useUserGroupAccess, lw as useUserGroups, aw as useUsers, ow as useUsersCount, Ew as useValidateExpression };
|
|
21288
21357
|
|
|
21289
21358
|
//# sourceMappingURL=index.js.map
|