@medha-analytics/medha-one-access-react 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14400,27 +14400,31 @@ 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: p, statusFilter: m, onStatusFilterChange: h }) {
14404
- let [v, y] = f({
14403
+ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessage: i = "No results found", onSearchChange: a, searchValue: s, onPaginationChange: l, pageSize: u = 20, searchPlaceholder: p = "Search...", toolbar: m, statusFilter: h, onStatusFilterChange: v }) {
14404
+ let [y, b] = f({
14405
14405
  pageIndex: 0,
14406
- pageSize: l
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);
14406
+ pageSize: u
14407
+ }), [x, S] = f(s ?? ""), C = d(void 0);
14408
+ c(() => {
14409
+ s !== void 0 && S(s);
14410
+ }, [s]);
14411
+ let w = o((e) => {
14412
+ S(e), C.current && clearTimeout(C.current), C.current = setTimeout(() => a?.(e), 400);
14409
14413
  }, [a]);
14410
14414
  c(() => () => {
14411
- S.current && clearTimeout(S.current);
14415
+ C.current && clearTimeout(C.current);
14412
14416
  }, []), c(() => {
14413
- s?.(v);
14414
- }, [v, s]);
14415
- let w = Cn({
14417
+ l?.(y);
14418
+ }, [y, l]);
14419
+ let T = Cn({
14416
14420
  data: t,
14417
14421
  columns: e,
14418
- pageCount: Math.ceil(n / v.pageSize),
14419
- state: { pagination: v },
14420
- onPaginationChange: y,
14422
+ pageCount: Math.ceil(n / y.pageSize),
14423
+ state: { pagination: y },
14424
+ onPaginationChange: b,
14421
14425
  getCoreRowModel: vn(),
14422
14426
  manualPagination: !0
14423
- }), T = Math.ceil(n / v.pageSize);
14427
+ }), E = Math.ceil(n / y.pageSize);
14424
14428
  return /* @__PURE__ */ _("div", {
14425
14429
  className: "space-y-4",
14426
14430
  children: [
@@ -14430,45 +14434,45 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
14430
14434
  a && /* @__PURE__ */ _("div", {
14431
14435
  className: "relative flex-1 max-w-sm",
14432
14436
  children: [/* @__PURE__ */ g(xe, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ g(ub, {
14433
- placeholder: u,
14434
- value: b,
14435
- onChange: (e) => C(e.target.value),
14437
+ placeholder: p,
14438
+ value: x,
14439
+ onChange: (e) => w(e.target.value),
14436
14440
  className: "pl-8"
14437
14441
  })]
14438
14442
  }),
14439
- h && /* @__PURE__ */ g("div", {
14443
+ v && /* @__PURE__ */ g("div", {
14440
14444
  className: "flex items-center rounded-md border",
14441
14445
  children: [
14442
14446
  "all",
14443
14447
  "active",
14444
14448
  "inactive"
14445
14449
  ].map((e) => /* @__PURE__ */ g("button", {
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"),
14450
+ onClick: () => v(e),
14451
+ className: H("cursor-pointer px-3 py-1.5 text-xs font-medium capitalize transition-colors first:rounded-l-md last:rounded-r-md", h === e ? "bg-primary text-primary-foreground" : "bg-background text-muted-foreground hover:bg-accent"),
14448
14452
  children: e
14449
14453
  }, e))
14450
14454
  }),
14451
- p && /* @__PURE__ */ g("div", {
14455
+ m && /* @__PURE__ */ g("div", {
14452
14456
  className: "flex items-center gap-2",
14453
- children: p
14457
+ children: m
14454
14458
  })
14455
14459
  ]
14456
14460
  }),
14457
14461
  /* @__PURE__ */ g("div", {
14458
14462
  className: "rounded-md border",
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, {
14463
+ children: /* @__PURE__ */ _(ib, { children: [/* @__PURE__ */ g(ab, { children: T.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: y.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)) : T.getRowModel().rows.length === 0 ? /* @__PURE__ */ g(sb, { children: /* @__PURE__ */ g(lb, {
14460
14464
  colSpan: e.length,
14461
14465
  className: "h-24 text-center text-muted-foreground",
14462
14466
  children: i
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)) })] })
14467
+ }) }) : T.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)) })] })
14464
14468
  }),
14465
14469
  n > 0 && /* @__PURE__ */ _("div", {
14466
14470
  className: "flex items-center justify-between",
14467
14471
  children: [/* @__PURE__ */ _("div", {
14468
14472
  className: "flex items-center gap-2 text-sm text-muted-foreground",
14469
14473
  children: [/* @__PURE__ */ g("span", { children: "Rows per page:" }), /* @__PURE__ */ _(db, {
14470
- value: String(v.pageSize),
14471
- onValueChange: (e) => y({
14474
+ value: String(y.pageSize),
14475
+ onValueChange: (e) => b({
14472
14476
  pageIndex: 0,
14473
14477
  pageSize: Number(e)
14474
14478
  }),
@@ -14490,9 +14494,9 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
14490
14494
  /* @__PURE__ */ _("span", {
14491
14495
  className: "text-muted-foreground",
14492
14496
  children: [
14493
- v.pageIndex * v.pageSize + 1,
14497
+ y.pageIndex * y.pageSize + 1,
14494
14498
  "–",
14495
- Math.min((v.pageIndex + 1) * v.pageSize, n),
14499
+ Math.min((y.pageIndex + 1) * y.pageSize, n),
14496
14500
  " of ",
14497
14501
  n
14498
14502
  ]
@@ -14500,21 +14504,21 @@ function yb({ columns: e, data: t, totalCount: n, isLoading: r = !1, emptyMessag
14500
14504
  /* @__PURE__ */ g(qh, {
14501
14505
  variant: "ghost",
14502
14506
  size: "icon",
14503
- onClick: () => y((e) => ({
14507
+ onClick: () => b((e) => ({
14504
14508
  ...e,
14505
14509
  pageIndex: e.pageIndex - 1
14506
14510
  })),
14507
- disabled: v.pageIndex === 0,
14511
+ disabled: y.pageIndex === 0,
14508
14512
  children: /* @__PURE__ */ g(pe, { className: "h-4 w-4" })
14509
14513
  }),
14510
14514
  /* @__PURE__ */ g(qh, {
14511
14515
  variant: "ghost",
14512
14516
  size: "icon",
14513
- onClick: () => y((e) => ({
14517
+ onClick: () => b((e) => ({
14514
14518
  ...e,
14515
14519
  pageIndex: e.pageIndex + 1
14516
14520
  })),
14517
- disabled: v.pageIndex >= T - 1,
14521
+ disabled: y.pageIndex >= E - 1,
14518
14522
  children: /* @__PURE__ */ g(me, { className: "h-4 w-4" })
14519
14523
  })
14520
14524
  ]
@@ -18678,7 +18682,7 @@ function sw(e) {
18678
18682
  let t = G();
18679
18683
  return C({
18680
18684
  queryKey: ["users", e],
18681
- queryFn: async () => (await t.get(`/users/${e}`)).data,
18685
+ queryFn: async () => (await t.get(`/users/${encodeURIComponent(e)}`)).data,
18682
18686
  enabled: !!e
18683
18687
  });
18684
18688
  }
@@ -18703,7 +18707,7 @@ function lw(e) {
18703
18707
  e,
18704
18708
  "groups"
18705
18709
  ],
18706
- queryFn: async () => (await t.get(`/users/${e}/groups`)).data.groups ?? [],
18710
+ queryFn: async () => (await t.get(`/users/${encodeURIComponent(e)}/groups`)).data.groups ?? [],
18707
18711
  enabled: !!e
18708
18712
  });
18709
18713
  }
@@ -18730,14 +18734,39 @@ function dw() {
18730
18734
  function fw() {
18731
18735
  let e = G(), t = w();
18732
18736
  return S({
18733
- mutationFn: async (t) => (await e.post("/users/", t)).data,
18737
+ mutationFn: async (t) => {
18738
+ let n = (t.id || t.email || "").trim(), r = t.first_name ?? "", i = t.last_name ?? "", a = t.email ?? "", o = t.department ?? "", s = t.role ?? "", c = t.manager_id || null, l = {
18739
+ type: t.type ?? "USER",
18740
+ active: t.active ?? !0,
18741
+ id: n,
18742
+ first_name: r,
18743
+ last_name: i,
18744
+ email: a,
18745
+ department: o,
18746
+ role: s,
18747
+ manager_id: c,
18748
+ parent_group_id: t.parent_group_id ?? null,
18749
+ owner_id: t.owner_id ?? null,
18750
+ expression: t.expression ?? null,
18751
+ user_metadata: {
18752
+ name: `${r} ${i}`.trim(),
18753
+ first_name: r,
18754
+ last_name: i,
18755
+ email: a,
18756
+ department: o,
18757
+ role: s,
18758
+ manager_id: c
18759
+ }
18760
+ };
18761
+ return (await e.post("/users/", l)).data;
18762
+ },
18734
18763
  onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
18735
18764
  });
18736
18765
  }
18737
18766
  function pw() {
18738
18767
  let e = G(), t = w();
18739
18768
  return S({
18740
- mutationFn: async (t) => (await e.put(`/users/${t.id}`, t)).data,
18769
+ mutationFn: async (t) => (await e.put(`/users/${encodeURIComponent(t.id)}`, t)).data,
18741
18770
  onSuccess: (e, n) => {
18742
18771
  t.invalidateQueries({ queryKey: ["users"] }), t.invalidateQueries({ queryKey: ["users", n.id] });
18743
18772
  }
@@ -18747,7 +18776,7 @@ function mw() {
18747
18776
  let e = G(), t = w();
18748
18777
  return S({
18749
18778
  mutationFn: async (t) => {
18750
- await e.delete(`/users/${t}`);
18779
+ await e.delete(`/users/${encodeURIComponent(t)}`);
18751
18780
  },
18752
18781
  onSuccess: () => t.invalidateQueries({ queryKey: ["users"] })
18753
18782
  });
@@ -18800,7 +18829,7 @@ function vw(e) {
18800
18829
  let t = G();
18801
18830
  return C({
18802
18831
  queryKey: ["access-rules", e],
18803
- queryFn: async () => hw((await t.get(`/access-rules/${e}`)).data),
18832
+ queryFn: async () => hw((await t.get(`/access-rules/${encodeURIComponent(e)}`)).data),
18804
18833
  enabled: !!e
18805
18834
  });
18806
18835
  }
@@ -18863,7 +18892,7 @@ function Cw(e) {
18863
18892
  "usergroup",
18864
18893
  e
18865
18894
  ],
18866
- queryFn: async () => xw((await t.get(`/access/usergroup/${e}`)).data.resolvedAccess),
18895
+ queryFn: async () => xw((await t.get(`/access/usergroup/${encodeURIComponent(e)}`)).data.resolvedAccess),
18867
18896
  enabled: !!e
18868
18897
  });
18869
18898
  }
@@ -18875,7 +18904,7 @@ function ww(e) {
18875
18904
  "resource",
18876
18905
  e
18877
18906
  ],
18878
- queryFn: async () => xw((await t.get(`/access/resource/${e}`)).data.users_with_access),
18907
+ queryFn: async () => xw((await t.get(`/access/resource/${encodeURIComponent(e)}`)).data.users_with_access),
18879
18908
  enabled: !!e
18880
18909
  });
18881
18910
  }
@@ -18887,7 +18916,7 @@ function Tw(e) {
18887
18916
  "resourcegroup",
18888
18917
  e
18889
18918
  ],
18890
- queryFn: async () => xw((await t.get(`/access/resourcegroup/${e}`)).data.users_with_access),
18919
+ queryFn: async () => xw((await t.get(`/access/resourcegroup/${encodeURIComponent(e)}`)).data.users_with_access),
18891
18920
  enabled: !!e
18892
18921
  });
18893
18922
  }
@@ -18941,7 +18970,7 @@ function Ow() {
18941
18970
  function kw() {
18942
18971
  let e = G(), t = w();
18943
18972
  return S({
18944
- mutationFn: async (t) => (await e.put(`/access-rules/${t.id}`, Dw(t))).data,
18973
+ mutationFn: async (t) => (await e.put(`/access-rules/${encodeURIComponent(t.id)}`, Dw(t))).data,
18945
18974
  onSuccess: (e, n) => {
18946
18975
  t.invalidateQueries({ queryKey: ["access-rules"] }), t.invalidateQueries({ queryKey: ["access-rules", n.id] });
18947
18976
  }
@@ -18951,7 +18980,7 @@ function Aw() {
18951
18980
  let e = G(), t = w();
18952
18981
  return S({
18953
18982
  mutationFn: async (t) => {
18954
- await e.delete(`/access-rules/${t}`);
18983
+ await e.delete(`/access-rules/${encodeURIComponent(t)}`);
18955
18984
  },
18956
18985
  onSuccess: () => t.invalidateQueries({ queryKey: ["access-rules"] })
18957
18986
  });
@@ -19257,7 +19286,7 @@ function Iw(e) {
19257
19286
  let t = G();
19258
19287
  return C({
19259
19288
  queryKey: ["artifacts", e],
19260
- queryFn: async () => (await t.get(`/artifacts/${e}`)).data,
19289
+ queryFn: async () => (await t.get(`/artifacts/${encodeURIComponent(e)}`)).data,
19261
19290
  enabled: !!e
19262
19291
  });
19263
19292
  }
@@ -19275,7 +19304,7 @@ function Rw(e) {
19275
19304
  let t = G();
19276
19305
  return C({
19277
19306
  queryKey: ["artifact-groups", e],
19278
- queryFn: async () => (await t.get(`/artifacts/${e}`)).data,
19307
+ queryFn: async () => (await t.get(`/artifacts/${encodeURIComponent(e)}`)).data,
19279
19308
  enabled: !!e
19280
19309
  });
19281
19310
  }
@@ -19287,7 +19316,7 @@ function zw(e) {
19287
19316
  e,
19288
19317
  "contents"
19289
19318
  ],
19290
- queryFn: async () => (await t.get(`/resourcegroups/${e}/contents`)).data.contents ?? [],
19319
+ queryFn: async () => (await t.get(`/resourcegroups/${encodeURIComponent(e)}/contents`)).data.contents ?? [],
19291
19320
  enabled: !!e
19292
19321
  });
19293
19322
  }
@@ -19299,7 +19328,7 @@ function Bw(e) {
19299
19328
  e,
19300
19329
  "groups"
19301
19330
  ],
19302
- queryFn: async () => (await t.get(`/artifacts/${e}/groups`)).data.groups ?? [],
19331
+ queryFn: async () => (await t.get(`/artifacts/${encodeURIComponent(e)}/groups`)).data.groups ?? [],
19303
19332
  enabled: !!e
19304
19333
  });
19305
19334
  }
@@ -19323,7 +19352,7 @@ function Hw() {
19323
19352
  function Uw() {
19324
19353
  let e = G(), t = w();
19325
19354
  return S({
19326
- mutationFn: async (t) => (await e.put(`/artifacts/${t.id}`, t)).data,
19355
+ mutationFn: async (t) => (await e.put(`/artifacts/${encodeURIComponent(t.id)}`, t)).data,
19327
19356
  onSuccess: (e, n) => {
19328
19357
  t.invalidateQueries({ queryKey: ["artifacts"] }), t.invalidateQueries({ queryKey: ["artifacts", n.id] });
19329
19358
  }
@@ -19333,7 +19362,7 @@ function Ww() {
19333
19362
  let e = G(), t = w();
19334
19363
  return S({
19335
19364
  mutationFn: async (t) => {
19336
- await e.delete(`/artifacts/${t}`);
19365
+ await e.delete(`/artifacts/${encodeURIComponent(t)}`);
19337
19366
  },
19338
19367
  onSuccess: () => t.invalidateQueries({ queryKey: ["artifacts"] })
19339
19368
  });
@@ -19566,7 +19595,7 @@ function Qw(e) {
19566
19595
  let t = G();
19567
19596
  return C({
19568
19597
  queryKey: ["groups", e],
19569
- queryFn: async () => (await t.get(`/users/${e}`)).data,
19598
+ queryFn: async () => (await t.get(`/users/${encodeURIComponent(e)}`)).data,
19570
19599
  enabled: !!e
19571
19600
  });
19572
19601
  }
@@ -19578,7 +19607,7 @@ function $w(e) {
19578
19607
  e,
19579
19608
  "members"
19580
19609
  ],
19581
- queryFn: async () => ((await t.get(`/usergroups/${e}/members`)).data.members ?? []).map((e) => ({
19610
+ queryFn: async () => ((await t.get(`/usergroups/${encodeURIComponent(e)}/members`)).data.members ?? []).map((e) => ({
19582
19611
  id: e.id,
19583
19612
  name: [e.first_name, e.last_name].filter(Boolean).join(" ") || e.id,
19584
19613
  email: e.email,
@@ -19590,14 +19619,30 @@ function $w(e) {
19590
19619
  function eT() {
19591
19620
  let e = G(), t = w();
19592
19621
  return S({
19593
- mutationFn: async (t) => (await e.post("/users/", t)).data,
19622
+ mutationFn: async (t) => {
19623
+ let n = (t.id || t.name || "").trim(), r = t.description ?? "", i = {
19624
+ id: n,
19625
+ type: "USERGROUP",
19626
+ active: t.active ?? !0,
19627
+ expression: t.expression ?? null,
19628
+ manager_id: null,
19629
+ parent_group_id: t.parent_group_id ?? null,
19630
+ owner_id: t.owner_id ?? null,
19631
+ description: r,
19632
+ user_metadata: {
19633
+ name: t.name ?? n,
19634
+ description: r
19635
+ }
19636
+ };
19637
+ return (await e.post("/users/", i)).data;
19638
+ },
19594
19639
  onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
19595
19640
  });
19596
19641
  }
19597
19642
  function tT() {
19598
19643
  let e = G(), t = w();
19599
19644
  return S({
19600
- mutationFn: async (t) => (await e.put(`/users/${t.id}`, t)).data,
19645
+ mutationFn: async (t) => (await e.put(`/users/${encodeURIComponent(t.id)}`, t)).data,
19601
19646
  onSuccess: (e, n) => {
19602
19647
  t.invalidateQueries({ queryKey: ["groups"] }), t.invalidateQueries({ queryKey: ["groups", n.id] });
19603
19648
  }
@@ -19607,7 +19652,7 @@ function nT() {
19607
19652
  let e = G(), t = w();
19608
19653
  return S({
19609
19654
  mutationFn: async (t) => {
19610
- await e.delete(`/users/${t}`);
19655
+ await e.delete(`/users/${encodeURIComponent(t)}`);
19611
19656
  },
19612
19657
  onSuccess: () => t.invalidateQueries({ queryKey: ["groups"] })
19613
19658
  });
@@ -19616,7 +19661,7 @@ function rT() {
19616
19661
  let e = G(), t = w();
19617
19662
  return S({
19618
19663
  mutationFn: async ({ groupId: t, userId: n }) => {
19619
- await e.post(`/usergroups/${t}/members`, { user_id: n });
19664
+ await e.post(`/usergroups/${encodeURIComponent(t)}/members`, { user_id: n });
19620
19665
  },
19621
19666
  onSuccess: (e, { groupId: n }) => t.invalidateQueries({ queryKey: [
19622
19667
  "groups",
@@ -19629,7 +19674,7 @@ function iT() {
19629
19674
  let e = G(), t = w();
19630
19675
  return S({
19631
19676
  mutationFn: async ({ groupId: t, userId: n }) => {
19632
- await e.delete(`/usergroups/${t}/members/${n}`);
19677
+ await e.delete(`/usergroups/${encodeURIComponent(t)}/members/${encodeURIComponent(n)}`);
19633
19678
  },
19634
19679
  onSuccess: (e, { groupId: n }) => t.invalidateQueries({ queryKey: [
19635
19680
  "groups",
@@ -20617,18 +20662,29 @@ function yT({ open: e, onClose: t, artifact: n, currentApplication: r, isAdmin:
20617
20662
  //#endregion
20618
20663
  //#region src/components/views/ArtifactsView.tsx
20619
20664
  function bT() {
20620
- 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({
20665
+ let { currentApplication: e, isAdmin: t } = Jy(), [n, r] = f(0), [i, a] = f(20), [o, s] = f(""), [c, l] = f(0), [u, d] = f(20), [p, m] = f(""), [h, v] = f("RESOURCE"), [y, b] = f("all"), [x, S] = f("all"), [C, w] = f(!1), [T, E] = f(), [D, O] = f(), { data: k = [] } = Vw(), A = t ? x === "all" ? void 0 : x : e, j = y === "active" ? !0 : y === "inactive" ? !1 : void 0, { data: M = [], isLoading: ee, isError: N, refetch: te } = Pw({
20621
20666
  skip: n,
20622
20667
  limit: i,
20623
- type: c,
20624
- appName: w,
20625
- activeOnly: u === "active" ? !0 : u === "inactive" ? !1 : void 0,
20668
+ type: "RESOURCE",
20669
+ appName: A,
20670
+ activeOnly: j,
20626
20671
  search: o
20627
- }), { data: k = 0 } = Fw({
20628
- type: c,
20629
- appName: w,
20672
+ }), { data: P = 0 } = Fw({
20673
+ type: "RESOURCE",
20674
+ appName: A,
20630
20675
  search: o
20631
- }), A = Ww(), { data: j = [] } = gT(), M = [
20676
+ }), { data: ne = [], isLoading: re, isError: ie, refetch: ae } = Pw({
20677
+ skip: c,
20678
+ limit: u,
20679
+ type: "RESOURCEGROUP",
20680
+ appName: A,
20681
+ activeOnly: j,
20682
+ search: p
20683
+ }), { data: oe = 0 } = Fw({
20684
+ type: "RESOURCEGROUP",
20685
+ appName: A,
20686
+ search: p
20687
+ }), se = Ww(), { data: ce = [] } = gT(), le = [
20632
20688
  {
20633
20689
  accessorKey: "name",
20634
20690
  header: "Name"
@@ -20659,27 +20715,27 @@ function bT() {
20659
20715
  variant: "ghost",
20660
20716
  size: "icon",
20661
20717
  onClick: () => {
20662
- b(e.original), v(!0);
20718
+ E(e.original), w(!0);
20663
20719
  },
20664
20720
  children: /* @__PURE__ */ g(ye, { className: "h-4 w-4" })
20665
20721
  }), /* @__PURE__ */ g(qh, {
20666
20722
  variant: "ghost",
20667
20723
  size: "icon",
20668
- onClick: () => S(e.original),
20724
+ onClick: () => O(e.original),
20669
20725
  children: /* @__PURE__ */ g(Ce, { className: "h-4 w-4 text-destructive" })
20670
20726
  })]
20671
20727
  })
20672
20728
  }
20673
- ], ee = t ? /* @__PURE__ */ _(db, {
20674
- value: p,
20675
- onValueChange: m,
20729
+ ], F = t ? /* @__PURE__ */ _(db, {
20730
+ value: x,
20731
+ onValueChange: S,
20676
20732
  children: [/* @__PURE__ */ g(pb, {
20677
20733
  className: "h-8 w-40",
20678
20734
  children: /* @__PURE__ */ g(fb, { placeholder: "All applications" })
20679
20735
  }), /* @__PURE__ */ _(mb, { children: [/* @__PURE__ */ g(hb, {
20680
20736
  value: "all",
20681
20737
  children: "All applications"
20682
- }), C.map((e) => /* @__PURE__ */ g(hb, {
20738
+ }), k.map((e) => /* @__PURE__ */ g(hb, {
20683
20739
  value: e,
20684
20740
  children: e
20685
20741
  }, e))] })]
@@ -20690,7 +20746,7 @@ function bT() {
20690
20746
  /* @__PURE__ */ _(Vh, {
20691
20747
  defaultValue: "resources",
20692
20748
  onValueChange: (e) => {
20693
- e === "resources" ? l("RESOURCE") : e === "groups" && l("RESOURCEGROUP");
20749
+ e === "resources" ? v("RESOURCE") : e === "groups" && v("RESOURCEGROUP");
20694
20750
  },
20695
20751
  children: [
20696
20752
  /* @__PURE__ */ _("div", {
@@ -20710,18 +20766,18 @@ function bT() {
20710
20766
  })
20711
20767
  ] }), /* @__PURE__ */ _(qh, {
20712
20768
  onClick: () => {
20713
- b(void 0), v(!0);
20769
+ E(void 0), w(!0);
20714
20770
  },
20715
20771
  children: [
20716
20772
  /* @__PURE__ */ g(ge, { className: "mr-2 h-4 w-4" }),
20717
20773
  " Add ",
20718
- c === "RESOURCE" ? "Artifact" : "Group"
20774
+ h === "RESOURCE" ? "Artifact" : "Group"
20719
20775
  ]
20720
20776
  })]
20721
20777
  }),
20722
20778
  /* @__PURE__ */ g(Gh, {
20723
20779
  value: "resources",
20724
- children: D ? /* @__PURE__ */ _("div", {
20780
+ children: N ? /* @__PURE__ */ _("div", {
20725
20781
  className: "rounded-md border border-destructive/50 p-4 flex items-center justify-between",
20726
20782
  children: [/* @__PURE__ */ g("span", {
20727
20783
  className: "text-sm text-destructive",
@@ -20729,74 +20785,91 @@ function bT() {
20729
20785
  }), /* @__PURE__ */ g(qh, {
20730
20786
  variant: "outline",
20731
20787
  size: "sm",
20732
- onClick: () => O(),
20788
+ onClick: () => te(),
20733
20789
  children: "Retry"
20734
20790
  })]
20735
20791
  }) : /* @__PURE__ */ g(yb, {
20736
- columns: M,
20737
- data: T,
20738
- totalCount: k,
20739
- isLoading: E,
20792
+ columns: le,
20793
+ data: M,
20794
+ totalCount: P,
20795
+ isLoading: ee,
20740
20796
  emptyMessage: "No artifacts found",
20741
20797
  searchPlaceholder: "Search artifacts...",
20798
+ searchValue: o,
20742
20799
  onSearchChange: (e) => {
20743
20800
  s(e), r(0);
20744
20801
  },
20745
20802
  onPaginationChange: (e) => {
20746
20803
  r(e.pageIndex * e.pageSize), a(e.pageSize);
20747
20804
  },
20748
- statusFilter: u,
20805
+ statusFilter: y,
20749
20806
  onStatusFilterChange: (e) => {
20750
- d(e), r(0);
20807
+ b(e), r(0);
20751
20808
  },
20752
- toolbar: ee
20809
+ toolbar: F
20753
20810
  })
20754
20811
  }),
20755
20812
  /* @__PURE__ */ g(Gh, {
20756
20813
  value: "groups",
20757
- children: /* @__PURE__ */ g(yb, {
20758
- columns: M,
20759
- data: T,
20760
- totalCount: k,
20761
- isLoading: E,
20814
+ children: ie ? /* @__PURE__ */ _("div", {
20815
+ className: "rounded-md border border-destructive/50 p-4 flex items-center justify-between",
20816
+ children: [/* @__PURE__ */ g("span", {
20817
+ className: "text-sm text-destructive",
20818
+ children: "Failed to load artifact groups"
20819
+ }), /* @__PURE__ */ g(qh, {
20820
+ variant: "outline",
20821
+ size: "sm",
20822
+ onClick: () => ae(),
20823
+ children: "Retry"
20824
+ })]
20825
+ }) : /* @__PURE__ */ g(yb, {
20826
+ columns: le,
20827
+ data: ne,
20828
+ totalCount: oe,
20829
+ isLoading: re,
20762
20830
  emptyMessage: "No artifact groups found",
20831
+ searchPlaceholder: "Search artifact groups...",
20832
+ searchValue: p,
20833
+ onSearchChange: (e) => {
20834
+ m(e), l(0);
20835
+ },
20763
20836
  onPaginationChange: (e) => {
20764
- r(e.pageIndex * e.pageSize), a(e.pageSize);
20837
+ l(e.pageIndex * e.pageSize), d(e.pageSize);
20765
20838
  },
20766
- statusFilter: u,
20839
+ statusFilter: y,
20767
20840
  onStatusFilterChange: (e) => {
20768
- d(e), r(0);
20841
+ b(e), l(0);
20769
20842
  },
20770
- toolbar: ee
20843
+ toolbar: F
20771
20844
  })
20772
20845
  }),
20773
20846
  /* @__PURE__ */ g(Gh, {
20774
20847
  value: "hierarchy",
20775
20848
  children: /* @__PURE__ */ g(Rb, {
20776
- nodes: j,
20849
+ nodes: ce,
20777
20850
  searchable: !0
20778
20851
  })
20779
20852
  })
20780
20853
  ]
20781
20854
  }),
20782
20855
  /* @__PURE__ */ g(yT, {
20783
- open: h,
20856
+ open: C,
20784
20857
  onClose: () => {
20785
- v(!1), b(void 0);
20858
+ w(!1), E(void 0);
20786
20859
  },
20787
- artifact: y,
20860
+ artifact: T,
20788
20861
  currentApplication: e,
20789
20862
  isAdmin: t
20790
20863
  }),
20791
20864
  /* @__PURE__ */ g(Ab, {
20792
- open: !!x,
20865
+ open: !!D,
20793
20866
  title: "Delete Artifact",
20794
- description: `Delete "${x?.name}"? This cannot be undone.`,
20867
+ description: `Delete "${D?.name}"? This cannot be undone.`,
20795
20868
  confirmLabel: "Delete",
20796
20869
  onConfirm: async () => {
20797
- x && await A.mutateAsync(x.id), S(void 0);
20870
+ D && await se.mutateAsync(D.id), O(void 0);
20798
20871
  },
20799
- onCancel: () => S(void 0)
20872
+ onCancel: () => O(void 0)
20800
20873
  })
20801
20874
  ]
20802
20875
  });