@kong-ui-public/entities-consumer-groups 4.4.0 → 4.4.1

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as he, ref as I, computed as k, watch as $e, resolveComponent as j, openBlock as G, createBlock as Y, unref as s, withCtx as d, createElementVNode as R, toDisplayString as E, createVNode as p, createElementBlock as Z, Fragment as Le, renderList as Qe, createCommentVNode as H, onBeforeMount as Ke, createSlots as Ie, createTextVNode as X, Teleport as He, reactive as Pe } from "vue";
1
+ import { defineComponent as he, ref as I, computed as k, watch as $e, resolveComponent as j, openBlock as S, createBlock as Y, unref as s, withCtx as d, createElementVNode as R, toDisplayString as E, createVNode as p, createElementBlock as Z, Fragment as Le, renderList as Qe, createCommentVNode as H, onBeforeMount as Ke, createSlots as Ie, createTextVNode as X, Teleport as He, reactive as Pe } from "vue";
2
2
  import { useRouter as Be } from "vue-router";
3
3
  import { BookIcon as Te, AddIcon as Ve, TeamIcon as Je } from "@kong/icons";
4
4
  import { createI18n as ze, i18nTComponent as We } from "@kong-ui-public/i18n";
@@ -12,7 +12,7 @@ const co = {
12
12
  id: "ID"
13
13
  },
14
14
  empty_state: {
15
- title: "Configure a New Consumer Group",
15
+ title: "Configure a new consumer group",
16
16
  description: "Use consumer groups to manage custom rate limiting configuration for subsets of consumers.",
17
17
  title_for_consumer: "Add to a consumer group"
18
18
  },
@@ -26,7 +26,7 @@ const co = {
26
26
  new_consumer_group: "New consumer group"
27
27
  }
28
28
  },
29
- title: "Consumer Groups",
29
+ title: "Consumer groups",
30
30
  search: {
31
31
  placeholder: "Filter by exact name or ID"
32
32
  },
@@ -38,29 +38,29 @@ const co = {
38
38
  edit: "Edit",
39
39
  delete: "Delete",
40
40
  exit: "Exit",
41
- view: "View Details"
41
+ view: "View details"
42
42
  },
43
43
  delete: {
44
- title: "Delete a Consumer Group",
44
+ title: "Delete a consumer group",
45
45
  description: "Deleting this group will remove all its plugins and rate limit configuration. This action cannot be reversed."
46
46
  },
47
47
  consumers: {
48
48
  add: {
49
- title: "Add To Consumer Groups",
49
+ title: "Add To consumer groups",
50
50
  ctaText: "Add this consumer to consumer groups",
51
- consumer_groups_label: "Consumer Groups",
51
+ consumer_groups_label: "Consumer groups",
52
52
  consumer_group_placeholder: "Add to consumer groups",
53
53
  footer: "Search by exact name or ID to find consumer groups not included in the list"
54
54
  },
55
55
  exit: {
56
- title: "Exit from a Consumer Group",
56
+ title: "Exit from a consumer group",
57
57
  confirmation: "Are you sure you want to remove consumer {consumer} from consumer group {consumerGroup}?",
58
58
  confirmationNoUsername: "Are you sure you want this consumer to exit from consumer group {consumerGroup}?",
59
59
  description: "Exiting from the group could change the rate limit policy applied to this consumer."
60
60
  }
61
61
  },
62
62
  errors: {
63
- general: "Consumer Groups could not be retrieved",
63
+ general: "Consumer groups could not be retrieved",
64
64
  delete: "The consumer group could not be deleted at this time.",
65
65
  copy: "Failed to copy to clipboard",
66
66
  add: "The consumer could not be added to some groups at this time.",
@@ -74,7 +74,7 @@ const co = {
74
74
  },
75
75
  form: {
76
76
  general_info: {
77
- title: "General Information",
77
+ title: "General information",
78
78
  description: "General information will help identify and manage this consumer group."
79
79
  },
80
80
  consumers: {
@@ -215,9 +215,9 @@ const be = {
215
215
  J.value = !1;
216
216
  }
217
217
  }, me = k(() => {
218
- var w, f, C, N;
218
+ var w, f, C, O;
219
219
  let g = `${t.config.apiBaseUrl}${ee.list[t.config.app].forConsumer}`;
220
- return t.config.app === "konnect" ? g = g.replace(/{controlPlaneId}/gi, ((w = t.config) == null ? void 0 : w.controlPlaneId) || "").replace(/{consumerId}/gi, ((f = t.config) == null ? void 0 : f.consumerId) || "") : t.config.app === "kongManager" && (g = g.replace(/\/{workspace}/gi, (C = t.config) != null && C.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((N = t.config) == null ? void 0 : N.consumerId) || "")), g;
220
+ return t.config.app === "konnect" ? g = g.replace(/{controlPlaneId}/gi, ((w = t.config) == null ? void 0 : w.controlPlaneId) || "").replace(/{consumerId}/gi, ((f = t.config) == null ? void 0 : f.consumerId) || "") : t.config.app === "kongManager" && (g = g.replace(/\/{workspace}/gi, (C = t.config) != null && C.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((O = t.config) == null ? void 0 : O.consumerId) || "")), g;
221
221
  }), Q = async (g) => {
222
222
  const w = {
223
223
  group: g
@@ -240,8 +240,8 @@ const be = {
240
240
  }, { immediate: !0, deep: !0 }), $e(() => t.visible, () => {
241
241
  t.visible && le();
242
242
  }, { immediate: !0 }), (g, w) => {
243
- const f = j("KMultiselect"), C = j("KAlert"), N = j("KPrompt");
244
- return G(), Y(N, {
243
+ const f = j("KMultiselect"), C = j("KAlert"), O = j("KPrompt");
244
+ return S(), Y(O, {
245
245
  "action-button-disabled": J.value,
246
246
  class: "kong-ui-entities-add-to-groups-modal",
247
247
  "data-testid": "add-to-group-modal",
@@ -268,12 +268,12 @@ const be = {
268
268
  width: "100%",
269
269
  onQueryChange: s(M)
270
270
  }, null, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
271
- x.value || T.value || V.value.length ? (G(), Z("div", vo, [
271
+ x.value || T.value || V.value.length ? (S(), Z("div", vo, [
272
272
  p(C, { appearance: "danger" }, {
273
273
  default: d(() => [
274
274
  R("p", null, E(s(a)("consumer_groups.errors.add")), 1),
275
- V.value.length ? (G(), Z("ul", yo, [
276
- (G(!0), Z(Le, null, Qe(V.value, (P, z) => (G(), Z("li", { key: z }, E(P), 1))), 128))
275
+ V.value.length ? (S(), Z("ul", yo, [
276
+ (S(!0), Z(Le, null, Qe(V.value, (P, z) => (S(), Z("li", { key: z }, E(P), 1))), 128))
277
277
  ])) : H("", !0),
278
278
  R("div", null, E(x.value || T.value), 1)
279
279
  ]),
@@ -337,8 +337,8 @@ const be = {
337
337
  },
338
338
  emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
339
339
  setup(e, { emit: L }) {
340
- var Se;
341
- const a = L, t = e, { i18nT: v, i18n: { t: u } } = be.useI18n(), n = Be(), { axiosInstance: M } = Ee((Se = t.config) == null ? void 0 : Se.axiosRequestConfig), ue = k(() => t.config.app !== "kongManager" || !!t.config.disableSorting), q = {
340
+ var Ae;
341
+ const a = L, t = e, { i18nT: v, i18n: { t: u } } = be.useI18n(), n = Be(), { axiosInstance: M } = Ee((Ae = t.config) == null ? void 0 : Ae.axiosRequestConfig), ue = k(() => t.config.app !== "kongManager" || !!t.config.disableSorting), q = {
342
342
  // the Name column is non-hidable
343
343
  name: { label: u("consumer_groups.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 }
344
344
  };
@@ -348,9 +348,9 @@ const be = {
348
348
  }), oe = () => {
349
349
  t.config.consumerId ? l() : n.push(t.config.createRoute);
350
350
  }, T = k(() => {
351
- var m, _, A, B;
351
+ var m, _, G, B;
352
352
  let r = `${t.config.apiBaseUrl}${ee.list[t.config.app][$.value ? "forConsumer" : "all"]}`;
353
- return t.config.app === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((m = t.config) == null ? void 0 : m.controlPlaneId) || "").replace(/{consumerId}/gi, ((_ = t.config) == null ? void 0 : _.consumerId) || "") : t.config.app === "kongManager" && (r = r.replace(/\/{workspace}/gi, (A = t.config) != null && A.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((B = t.config) == null ? void 0 : B.consumerId) || "")), r;
353
+ return t.config.app === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((m = t.config) == null ? void 0 : m.controlPlaneId) || "").replace(/{consumerId}/gi, ((_ = t.config) == null ? void 0 : _.consumerId) || "") : t.config.app === "kongManager" && (r = r.replace(/\/{workspace}/gi, (G = t.config) != null && G.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((B = t.config) == null ? void 0 : B.consumerId) || "")), r;
354
354
  }), K = I(""), te = k(() => {
355
355
  const r = t.config.app === "konnect" || t.config.isExactMatch;
356
356
  return r ? {
@@ -411,7 +411,7 @@ const be = {
411
411
  }, C = (r) => ({
412
412
  label: u("consumer_groups.actions.view"),
413
413
  to: t.config.getViewRoute(r)
414
- }), N = (r) => ({
414
+ }), O = (r) => ({
415
415
  label: u("consumer_groups.actions.edit"),
416
416
  to: t.config.getEditRoute(r)
417
417
  }), P = I(void 0), z = I(!1), ae = I(!1), pe = I(""), ge = Ze(t.config, T.value), fe = (r) => {
@@ -424,8 +424,8 @@ const be = {
424
424
  ae.value = !0;
425
425
  try {
426
426
  await M.delete(ge(P.value.id)), ae.value = !1, z.value = !1, Q.value++, a("delete:success", P.value);
427
- } catch (A) {
428
- pe.value = ((_ = (m = A.response) == null ? void 0 : m.data) == null ? void 0 : _.message) || A.message || u("consumer_groups.errors.delete"), a("error", A);
427
+ } catch (G) {
428
+ pe.value = ((_ = (m = G.response) == null ? void 0 : m.data) == null ? void 0 : _.message) || G.message || u("consumer_groups.errors.delete"), a("error", G);
429
429
  } finally {
430
430
  ae.value = !1;
431
431
  }
@@ -434,37 +434,37 @@ const be = {
434
434
  b.value = !0;
435
435
  }, c = () => {
436
436
  b.value = !1;
437
- }, S = (r, m) => {
437
+ }, A = (r, m) => {
438
438
  m || c(), Q.value++, a("add:success", r);
439
- }, O = () => {
439
+ }, N = () => {
440
440
  $.value && l();
441
441
  }, h = I(void 0), W = I(!1), ve = I(""), Re = (r) => {
442
442
  h.value = r, W.value = !0;
443
443
  }, xe = () => {
444
444
  W.value = !1, h.value = void 0;
445
445
  }, qe = k(() => {
446
- var m, _, A, B;
446
+ var m, _, G, B;
447
447
  let r = `${t.config.apiBaseUrl}${ee.list[t.config.app].oneForConsumer}`;
448
- return t.config.app === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((m = t.config) == null ? void 0 : m.controlPlaneId) || "").replace(/{consumerId}/gi, ((_ = t.config) == null ? void 0 : _.consumerId) || "") : t.config.app === "kongManager" && (r = r.replace(/\/{workspace}/gi, (A = t.config) != null && A.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((B = t.config) == null ? void 0 : B.consumerId) || "")), r;
449
- }), Ge = I(!1), Ne = async () => {
448
+ return t.config.app === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((m = t.config) == null ? void 0 : m.controlPlaneId) || "").replace(/{consumerId}/gi, ((_ = t.config) == null ? void 0 : _.consumerId) || "") : t.config.app === "kongManager" && (r = r.replace(/\/{workspace}/gi, (G = t.config) != null && G.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((B = t.config) == null ? void 0 : B.consumerId) || "")), r;
449
+ }), Se = I(!1), Oe = async () => {
450
450
  if (h.value) {
451
- Ge.value = !0;
451
+ Se.value = !0;
452
452
  try {
453
453
  const r = qe.value.replace(/{consumerGroupId}/gi, h.value.id);
454
454
  await M.delete(r), a("remove:success", h.value), xe(), Q.value++;
455
455
  } catch (r) {
456
456
  ve.value = r.message || u("consumer_groups.errors.delete"), a("error", r);
457
457
  } finally {
458
- Ge.value = !1;
458
+ Se.value = !1;
459
459
  }
460
460
  }
461
461
  };
462
462
  $e(me, (r) => {
463
- var m, _, A;
463
+ var m, _, G;
464
464
  if (r.status === eo.Error) {
465
465
  F.value = {
466
466
  title: u("consumer_groups.errors.general")
467
- }, (A = (_ = (m = r.error) == null ? void 0 : m.response) == null ? void 0 : _.data) != null && A.message && (F.value.message = r.error.response.data.message), a("error", r.error);
467
+ }, (G = (_ = (m = r.error) == null ? void 0 : m.response) == null ? void 0 : _.data) != null && G.message && (F.value.message = r.error.response.data.message), a("error", r.error);
468
468
  return;
469
469
  }
470
470
  F.value = null;
@@ -478,8 +478,8 @@ const be = {
478
478
  return Ke(async () => {
479
479
  ke.value = await t.canCreate(), ke.value && (Ce.value.title = $.value ? u("consumer_groups.list.empty_state.title_for_consumer") : u("consumer_groups.list.empty_state.title"), Ce.value.ctaText = $.value ? u("consumer_groups.actions.add_to_group") : u("consumer_groups.actions.create"));
480
480
  }), (r, m) => {
481
- const _ = j("KButton"), A = j("KEmptyState"), B = j("KDropdownItem"), Ae = j("KClipboardProvider"), Oe = j("KPrompt");
482
- return G(), Z("div", bo, [
481
+ const _ = j("KButton"), G = j("KEmptyState"), B = j("KDropdownItem"), Ge = j("KClipboardProvider"), Ne = j("KPrompt");
482
+ return S(), Z("div", bo, [
483
483
  p(s(oo), {
484
484
  "cache-identifier": e.cacheIdentifier,
485
485
  "disable-pagination": $.value && !e.config.paginatedEndpoint,
@@ -496,12 +496,12 @@ const be = {
496
496
  "table-headers": s(ie),
497
497
  onClearSearchInput: V,
498
498
  "onClick:row": m[3] || (m[3] = (y) => f(y)),
499
- onEmptyStateCtaClicked: O,
499
+ onEmptyStateCtaClicked: N,
500
500
  onSort: ne,
501
501
  onState: s(re)
502
502
  }, Ie({
503
503
  "toolbar-filter": d(() => [
504
- $.value ? H("", !0) : (G(), Y(s(so), {
504
+ $.value ? H("", !0) : (S(), Y(s(so), {
505
505
  key: 0,
506
506
  modelValue: K.value,
507
507
  "onUpdate:modelValue": m[0] || (m[0] = (y) => K.value = y),
@@ -509,12 +509,12 @@ const be = {
509
509
  }, null, 8, ["modelValue", "config"]))
510
510
  ]),
511
511
  "toolbar-button": d(() => [
512
- (G(), Y(He, {
512
+ (S(), Y(He, {
513
513
  disabled: !e.useActionOutside,
514
514
  to: "#kong-ui-app-page-header-action-button"
515
515
  }, [
516
516
  R("div", Co, [
517
- ce.value ? (G(), Y(_, {
517
+ ce.value ? (S(), Y(_, {
518
518
  key: 0,
519
519
  appearance: "secondary",
520
520
  class: "open-learning-hub",
@@ -559,7 +559,7 @@ const be = {
559
559
  p(s(to), { tags: y }, null, 8, ["tags"])
560
560
  ]),
561
561
  actions: d(({ row: y }) => [
562
- p(Ae, null, {
562
+ p(Ge, null, {
563
563
  default: d(({ copyToClipboard: ye }) => [
564
564
  p(B, {
565
565
  "data-testid": "action-entity-copy-id",
@@ -573,7 +573,7 @@ const be = {
573
573
  ]),
574
574
  _: 2
575
575
  }, 1024),
576
- p(Ae, null, {
576
+ p(Ge, null, {
577
577
  default: d(({ copyToClipboard: ye }) => [
578
578
  p(B, {
579
579
  "data-testid": "action-entity-copy-json",
@@ -605,7 +605,7 @@ const be = {
605
605
  default: d(() => [
606
606
  p(B, {
607
607
  "data-testid": "action-entity-edit",
608
- item: N(y.id)
608
+ item: O(y.id)
609
609
  }, null, 8, ["item"])
610
610
  ]),
611
611
  _: 2
@@ -636,7 +636,7 @@ const be = {
636
636
  fn: d(() => {
637
637
  var y;
638
638
  return [
639
- p(A, {
639
+ p(G, {
640
640
  "data-testid": "consumer-groups-entity-empty-state",
641
641
  "icon-background": "",
642
642
  message: s(u)("consumer_groups.list.empty_state_v2.description"),
@@ -646,7 +646,7 @@ const be = {
646
646
  p(s(Je), { decorative: "" })
647
647
  ]),
648
648
  action: d(() => [
649
- ke.value ? (G(), Y(_, {
649
+ ke.value ? (S(), Y(_, {
650
650
  key: 0,
651
651
  "data-testid": "entity-create-button",
652
652
  onClick: oe
@@ -696,23 +696,23 @@ const be = {
696
696
  onCancel: o,
697
697
  onProceed: i
698
698
  }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"]),
699
- e.config.consumerId ? (G(), Y(ho, {
699
+ e.config.consumerId ? (S(), Y(ho, {
700
700
  key: 0,
701
701
  config: e.config,
702
702
  "data-testid": "add-to-group-modal",
703
703
  visible: b.value,
704
- "onAdd:partialSuccess": m[4] || (m[4] = (y) => S(y, !0)),
705
- "onAdd:success": m[5] || (m[5] = (y) => S(y)),
704
+ "onAdd:partialSuccess": m[4] || (m[4] = (y) => A(y, !0)),
705
+ "onAdd:success": m[5] || (m[5] = (y) => A(y)),
706
706
  onCancel: c
707
707
  }, null, 8, ["config", "visible"])) : H("", !0),
708
- e.config.consumerId && h.value ? (G(), Y(Oe, {
708
+ e.config.consumerId && h.value ? (S(), Y(Ne, {
709
709
  key: 1,
710
710
  "action-button-appearance": "danger",
711
711
  "data-testid": "exit-group-modal",
712
712
  title: s(u)("consumer_groups.consumers.exit.title"),
713
713
  visible: W.value,
714
714
  onCancel: xe,
715
- onProceed: Ne
715
+ onProceed: Oe
716
716
  }, {
717
717
  default: d(() => [
718
718
  p(s(v), {
@@ -797,9 +797,9 @@ const be = {
797
797
  var o;
798
798
  return ee.item[(o = a.config) == null ? void 0 : o.app];
799
799
  }), ce = k(() => a.consumerGroupId ? we.Edit : we.Create), $ = k(() => !!n.fields.name && !ne.value), J = k(() => JSON.stringify(n.fields) !== JSON.stringify(M)), x = (o, i = "", b = "") => {
800
- var c, S, O, h, W, ve;
801
- let l = `${(c = a.config) == null ? void 0 : c.apiBaseUrl}${ee.form[(S = a.config) == null ? void 0 : S.app][o]}`;
802
- return ((O = a.config) == null ? void 0 : O.app) === "konnect" ? l = l.replace(/{controlPlaneId}/gi, ((h = a.config) == null ? void 0 : h.controlPlaneId) || "") : ((W = a.config) == null ? void 0 : W.app) === "kongManager" && (l = l.replace(/\/{workspace}/gi, (ve = a.config) != null && ve.workspace ? `/${a.config.workspace}` : "")), l = l.replace(/{id}/gi, i || a.consumerGroupId), (o === "addConsumer" || o === "removeConsumer") && (l = l.replace(/{consumerId}/gi, b)), l;
800
+ var c, A, N, h, W, ve;
801
+ let l = `${(c = a.config) == null ? void 0 : c.apiBaseUrl}${ee.form[(A = a.config) == null ? void 0 : A.app][o]}`;
802
+ return ((N = a.config) == null ? void 0 : N.app) === "konnect" ? l = l.replace(/{controlPlaneId}/gi, ((h = a.config) == null ? void 0 : h.controlPlaneId) || "") : ((W = a.config) == null ? void 0 : W.app) === "kongManager" && (l = l.replace(/\/{workspace}/gi, (ve = a.config) != null && ve.workspace ? `/${a.config.workspace}` : "")), l = l.replace(/{id}/gi, i || a.consumerGroupId), (o === "addConsumer" || o === "removeConsumer") && (l = l.replace(/{consumerId}/gi, b)), l;
803
803
  }, de = () => {
804
804
  var o;
805
805
  u.push(((o = a.config) == null ? void 0 : o.cancelRoute) || { name: "consumer-group-list" });
@@ -808,15 +808,15 @@ const be = {
808
808
  }, Q = (o) => {
809
809
  t("loading", o);
810
810
  }, V = async (o) => {
811
- var b, l, c, S, O;
811
+ var b, l, c, A, N;
812
812
  n.fields.name = ((b = o == null ? void 0 : o.item) == null ? void 0 : b.name) || ((l = o == null ? void 0 : o.consumer_group) == null ? void 0 : l.name) || (o == null ? void 0 : o.name) || "";
813
813
  const i = ((c = o == null ? void 0 : o.item) == null ? void 0 : c.tags) || (o == null ? void 0 : o.consumer_group.tags) || (o == null ? void 0 : o.tags) || [];
814
814
  if (n.fields.tags = (i == null ? void 0 : i.join(", ")) || "", "consumers" in o)
815
- n.fields.consumers = ((S = o == null ? void 0 : o.consumers) == null ? void 0 : S.map((h) => h.id)) || [];
815
+ n.fields.consumers = ((A = o == null ? void 0 : o.consumers) == null ? void 0 : A.map((h) => h.id)) || [];
816
816
  else
817
817
  try {
818
818
  const { data: h } = await T.get(x("getConsumers"));
819
- n.fields.consumers = "consumers" in h ? (O = h == null ? void 0 : h.consumers) == null ? void 0 : O.map((W) => W.id) : [];
819
+ n.fields.consumers = "consumers" in h ? (N = h == null ? void 0 : h.consumers) == null ? void 0 : N.map((W) => W.id) : [];
820
820
  } catch (h) {
821
821
  f(h);
822
822
  }
@@ -831,7 +831,7 @@ const be = {
831
831
  n.errorMessage = K(o), t("error", o);
832
832
  }, C = (o = a.consumerGroupId) => {
833
833
  Object.assign(M, n.fields), t("update", { ...n.fields, id: o });
834
- }, N = (o, i, b = a.consumerGroupId) => {
834
+ }, O = (o, i, b = a.consumerGroupId) => {
835
835
  const l = o == null ? void 0 : o.find((c) => c.status !== "fulfilled");
836
836
  l ? f({
837
837
  code: l.status,
@@ -848,7 +848,7 @@ const be = {
848
848
  if (n.fields.consumers.length > 0 && o)
849
849
  try {
850
850
  const i = n.fields.consumers.map((l) => g(l, o)), b = await Promise.allSettled(i);
851
- N(b, v("consumer_groups.errors.add_consumer"), o);
851
+ O(b, v("consumer_groups.errors.add_consumer"), o);
852
852
  } catch (i) {
853
853
  f(i);
854
854
  }
@@ -866,15 +866,15 @@ const be = {
866
866
  else {
867
867
  if (i.length > 0)
868
868
  try {
869
- const l = i.map((S) => w(S)), c = await Promise.allSettled(l);
870
- N(c, v("consumer_groups.errors.remove_consumer"));
869
+ const l = i.map((A) => w(A)), c = await Promise.allSettled(l);
870
+ O(c, v("consumer_groups.errors.remove_consumer"));
871
871
  } catch (l) {
872
872
  f(l);
873
873
  }
874
874
  if (o.length > 0)
875
875
  try {
876
- const l = o.map((S) => g(S)), c = await Promise.allSettled(l);
877
- N(c, v("consumer_groups.errors.add_consumer"));
876
+ const l = o.map((A) => g(A)), c = await Promise.allSettled(l);
877
+ O(c, v("consumer_groups.errors.add_consumer"));
878
878
  } catch (l) {
879
879
  f(l);
880
880
  }
@@ -890,7 +890,7 @@ const be = {
890
890
  a.hideConsumers || await le();
891
891
  }), (o, i) => {
892
892
  const b = j("KInput"), l = j("KMultiselect");
893
- return G(), Z("div", Io, [
893
+ return S(), Z("div", Io, [
894
894
  p(s(io), {
895
895
  "can-submit": $.value && J.value,
896
896
  config: e.config,
@@ -941,7 +941,7 @@ const be = {
941
941
  ]),
942
942
  _: 1
943
943
  }, 8, ["description", "title"]),
944
- e.hideConsumers ? H("", !0) : (G(), Y(s(Fe), {
944
+ e.hideConsumers ? H("", !0) : (S(), Y(s(Fe), {
945
945
  key: 0,
946
946
  description: s(v)("consumer_groups.form.consumers.description"),
947
947
  "has-divider": "",
@@ -961,11 +961,11 @@ const be = {
961
961
  onQueryChange: s(ue)
962
962
  }, {
963
963
  "item-template": d(({ item: c }) => {
964
- var S, O, h;
964
+ var A, N, h;
965
965
  return [
966
966
  R("div", wo, [
967
967
  R("div", $o, E(c.label), 1),
968
- (S = c == null ? void 0 : c.data) != null && S.username && ((O = c == null ? void 0 : c.data) != null && O.custom_id) ? (G(), Z("div", Eo, E((h = c == null ? void 0 : c.data) == null ? void 0 : h.custom_id), 1)) : H("", !0)
968
+ (A = c == null ? void 0 : c.data) != null && A.username && ((N = c == null ? void 0 : c.data) != null && N.custom_id) ? (S(), Z("div", Eo, E((h = c == null ? void 0 : c.data) == null ? void 0 : h.custom_id), 1)) : H("", !0)
969
969
  ])
970
970
  ];
971
971
  }),
@@ -1016,7 +1016,7 @@ const be = {
1016
1016
  tooltip: a("consumer_groups.form.fields.tags.tooltip")
1017
1017
  }
1018
1018
  });
1019
- return (u, n) => (G(), Z("div", xo, [
1019
+ return (u, n) => (S(), Z("div", xo, [
1020
1020
  p(s(lo), {
1021
1021
  config: e.config,
1022
1022
  "config-card-doc": e.configCardDoc,
@@ -1 +1 @@
1
- (function(N,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router"),require("@kong/icons"),require("@kong-ui-public/i18n"),require("@kong-ui-public/entities-shared")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","@kong/icons","@kong-ui-public/i18n","@kong-ui-public/entities-shared"],e):(N=typeof globalThis<"u"?globalThis:N||self,e(N["kong-ui-public-entities-consumer-groups"]={},N.Vue,N.VueRouter,N.KongIcons,N["kong-ui-public-i18n"],N["kong-ui-public-entities-shared"]))})(this,function(N,e,pe,Y,fe,m){"use strict";const Ce={consumer_groups:{list:{table_headers:{name:"Name",consumers_count:"Consumers",tags:"Tags",id:"ID"},empty_state:{title:"Configure a New Consumer Group",description:"Use consumer groups to manage custom rate limiting configuration for subsets of consumers.",title_for_consumer:"Add to a consumer group"},empty_state_v2:{title:"Configure your first consumer group",group:"Consumer groups created in gateways within this group will automatically appear here.",description:"Organize consumers into groups to easily apply policies like rate limiting and authentication across the entire group.",learn_more:"Learn more"},toolbar_actions:{new_consumer_group:"New consumer group"}},title:"Consumer Groups",search:{placeholder:"Filter by exact name or ID"},actions:{add_to_group:"Add to consumer group",create:"New consumer group",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",exit:"Exit",view:"View Details"},delete:{title:"Delete a Consumer Group",description:"Deleting this group will remove all its plugins and rate limit configuration. This action cannot be reversed."},consumers:{add:{title:"Add To Consumer Groups",ctaText:"Add this consumer to consumer groups",consumer_groups_label:"Consumer Groups",consumer_group_placeholder:"Add to consumer groups",footer:"Search by exact name or ID to find consumer groups not included in the list"},exit:{title:"Exit from a Consumer Group",confirmation:"Are you sure you want to remove consumer {consumer} from consumer group {consumerGroup}?",confirmationNoUsername:"Are you sure you want this consumer to exit from consumer group {consumerGroup}?",description:"Exiting from the group could change the rate limit policy applied to this consumer."}},errors:{general:"Consumer Groups could not be retrieved",delete:"The consumer group could not be deleted at this time.",copy:"Failed to copy to clipboard",add:"The consumer could not be added to some groups at this time.",already_added:"The consumer is already in this consumer group",add_consumer:"An unexpected error occurred while adding consumers. Please try again.",remove_consumer:"An unexpected error occurred while removing consumers. Please try again."},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{general_info:{title:"General Information",description:"General information will help identify and manage this consumer group."},consumers:{title:"Consumers",description:"Add or remove consumers from this group"},fields:{name:{label:"Name",placeholder:"Enter a unique name for this consumer group "},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},consumers:{label:"Consumers",placeholder:"Select one or more consumers"}}}}};function ke(){const o=fe.createI18n("en-us",Ce);return{i18n:o,i18nT:fe.i18nTComponent(o)}}const se={useI18n:ke},G="/v2/control-planes/{controlPlaneId}/core-entities",D="/{workspace}",q={list:{konnect:{all:`${G}/consumer_groups`,forModal:`${G}/consumer_groups`,forConsumer:`${G}/consumers/{consumerId}/consumer_groups`,oneForConsumer:`${G}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`},kongManager:{all:`${D}/consumer_groups?counter=true`,forModal:`${D}/consumer_groups`,forConsumer:`${D}/consumers/{consumerId}/consumer_groups`,oneForConsumer:`${D}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`}},form:{konnect:{consumersList:`${G}/consumers`,create:`${G}/consumer_groups`,edit:`${G}/consumer_groups/{id}`,addConsumer:`${G}/consumer_groups/{id}/consumers`,removeConsumer:`${G}/consumer_groups/{id}/consumers/{consumerId}`,getConsumers:`${G}/consumer_groups/{id}/consumers`},kongManager:{consumersList:`${D}/consumers`,create:`${D}/consumer_groups`,edit:`${D}/consumer_groups/{id}`,addConsumer:`${D}/consumer_groups/{id}/consumers`,removeConsumer:`${D}/consumer_groups/{id}/consumers/{consumerId}`,getConsumers:`${D}/consumer_groups/{id}/consumers`}},item:{konnect:`${G}/consumer_groups/{id}?list_consumers=false`,kongManager:`${D}/consumer_groups/{id}?list_consumers=false`}},be={class:"add-to-group-form-container"},we={class:"add-to-group-cta-text"},Ve={key:0,class:"kong-ui-entity-add-to-groups-error"},xe={key:0},Ie=e.defineComponent({__name:"AddToGroupModal",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||!o.consumerId)},visible:{type:Boolean,required:!0,default:!1}},emits:["cancel","add:success","add:partial-success","error"],setup(o,{emit:R}){var T;const{i18n:{t:a}}=se.useI18n(),r=o,g=R,{axiosInstance:c}=m.useAxios((T=r.config)==null?void 0:T.axiosRequestConfig),s=e.ref([]),{debouncedQueryChange:V,loading:Z,allRecords:S,error:v,loadItems:ee,results:Q}=m.useDebouncedFilter(r.config,q.list[r.config.app].forModal,"",{fetchedItemsKey:"data",searchKeys:["name","id"]}),B=e.computed(()=>v.value?a("consumer_groups.errors.general"):""),A=e.ref(0),H=e.computed(()=>S.value===void 0),J=e.computed(()=>Q.value.map(p=>({label:p.name,value:p.id,selected:s.value.includes(p.id),data:p}))),W=p=>{var f;const b=H.value?Q.value.find(k=>k.id===p):(f=S.value)==null?void 0:f.find(k=>k.id===p);return b?b.name:p},oe=()=>{x.value="",w.value=[],M.value=[],g("cancel")},w=e.ref([]),O=e.ref(!1),x=e.ref(""),te=async()=>{if(!s.value.length){x.value="",M.value=[],g("cancel");return}O.value=!0,x.value="",w.value=[],M.value=[];try{const p=s.value.map(k=>U(k)),b=await Promise.allSettled(p);let f=!0;b.forEach(k=>{k.status!=="fulfilled"&&(f=!1)}),f?(w.value=[],M.value=[],g("add:success",s.value),s.value=[]):(w.value.length&&g("add:partial-success",w.value),s.value=[],z(b))}catch{x.value=a("consumer_groups.errors.add"),g("error",x.value)}finally{O.value=!1}},re=e.computed(()=>{var b,f,k,F;let p=`${r.config.apiBaseUrl}${q.list[r.config.app].forConsumer}`;return r.config.app==="konnect"?p=p.replace(/{controlPlaneId}/gi,((b=r.config)==null?void 0:b.controlPlaneId)||"").replace(/{consumerId}/gi,((f=r.config)==null?void 0:f.consumerId)||""):r.config.app==="kongManager"&&(p=p.replace(/\/{workspace}/gi,(k=r.config)!=null&&k.workspace?`/${r.config.workspace}`:"").replace(/{consumerId}/gi,((F=r.config)==null?void 0:F.consumerId)||"")),p}),U=async p=>{const b={group:p};try{const f=await c.post(re.value,b);return w.value.push(p),f}catch(f){let k=`${W(p)} - ${f.message}`;return f.response.status===409&&(k=`${W(p)} - ${a("consumer_groups.errors.already_added")}`),Promise.reject(Error(k))}},M=e.ref([]),z=p=>{M.value=p.map(b=>{var f;return(f=b.reason)==null?void 0:f.message}).filter(Boolean)};return e.watch(J,()=>{A.value++},{immediate:!0,deep:!0}),e.watch(()=>r.visible,()=>{r.visible&&ee()},{immediate:!0}),(p,b)=>{const f=e.resolveComponent("KMultiselect"),k=e.resolveComponent("KAlert"),F=e.resolveComponent("KPrompt");return e.openBlock(),e.createBlock(F,{"action-button-disabled":O.value,class:"kong-ui-entities-add-to-groups-modal","data-testid":"add-to-group-modal",title:e.unref(a)("consumer_groups.consumers.add.title"),visible:o.visible,onCancel:oe,onProceed:te},{default:e.withCtx(()=>[e.createElementVNode("div",be,[e.createElementVNode("p",we,e.toDisplayString(e.unref(a)("consumer_groups.consumers.add.ctaText")),1),e.createVNode(f,{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=$=>s.value=$),autosuggest:"","data-testid":"add-to-groups-multiselect","dropdown-footer-text":H.value?e.unref(a)("consumer_groups.consumers.add.footer"):void 0,items:J.value,label:e.unref(a)("consumer_groups.consumers.add.consumer_groups_label"),loading:e.unref(Z),placeholder:e.unref(a)("consumer_groups.consumers.add.consumer_group_placeholder"),readonly:O.value,required:"",width:"100%",onQueryChange:e.unref(V)},null,8,["modelValue","dropdown-footer-text","items","label","loading","placeholder","readonly","onQueryChange"]),x.value||B.value||M.value.length?(e.openBlock(),e.createElementBlock("div",Ve,[e.createVNode(k,{appearance:"danger"},{default:e.withCtx(()=>[e.createElementVNode("p",null,e.toDisplayString(e.unref(a)("consumer_groups.errors.add")),1),M.value.length?(e.openBlock(),e.createElementBlock("ul",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,($,j)=>(e.openBlock(),e.createElementBlock("li",{key:j},e.toDisplayString($),1))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",null,e.toDisplayString(x.value||B.value),1)]),_:1})])):e.createCommentVNode("",!0)])]),_:1},8,["action-button-disabled","title","visible"])}}}),ue=(o,R)=>{const a=o.__vccOpts||o;for(const[r,g]of R)a[r]=g;return a},Ee=ue(Ie,[["__scopeId","data-v-4a6bfc7b"]]),Ne={class:"kong-ui-entities-consumer-groups-list"},$e={class:"button-row"},Be=ue(e.defineComponent({__name:"ConsumerGroupList",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||!o.createRoute||!o.getViewRoute||!o.getEditRoute||o.app==="kongManager"&&!o.isExactMatch&&!o.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","add:success","remove:success"],setup(o,{emit:R}){var he;const a=R,r=o,{i18nT:g,i18n:{t:c}}=se.useI18n(),s=pe.useRouter(),{axiosInstance:V}=m.useAxios((he=r.config)==null?void 0:he.axiosRequestConfig),Z=e.computed(()=>r.config.app!=="kongManager"||!!r.config.disableSorting),S={name:{label:c("consumer_groups.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};r.config.app==="kongManager"&&(S.consumers_count={label:c("consumer_groups.list.table_headers.consumers_count"),searchable:!1,sortable:!1}),S.tags={label:c("consumer_groups.list.table_headers.tags"),sortable:!1};const v=S,ee=n=>({"data-testid":n.username??n.custom_id??n.id}),Q=()=>{r.config.consumerId?l():s.push(r.config.createRoute)},B=e.computed(()=>{var d,h,E,P;let n=`${r.config.apiBaseUrl}${q.list[r.config.app][w.value?"forConsumer":"all"]}`;return r.config.app==="konnect"?n=n.replace(/{controlPlaneId}/gi,((d=r.config)==null?void 0:d.controlPlaneId)||"").replace(/{consumerId}/gi,((h=r.config)==null?void 0:h.consumerId)||""):r.config.app==="kongManager"&&(n=n.replace(/\/{workspace}/gi,(E=r.config)!=null&&E.workspace?`/${r.config.workspace}`:"").replace(/{consumerId}/gi,((P=r.config)==null?void 0:P.consumerId)||"")),n}),A=e.ref(""),H=e.computed(()=>{const n=r.config.app==="konnect"||r.config.isExactMatch;return n?{isExactMatch:n,fields:{username:S.name,id:{label:c("consumer_groups.list.table_headers.id")}},placeholder:c("consumer_groups.search.placeholder")}:{isExactMatch:n,fields:{name:S.name},schema:r.config.filterSchema}}),{hasRecords:J,handleStateChange:W}=m.useTableState(A),oe=e.computed(()=>J.value&&r.config.app==="konnect"),w=e.computed(()=>!!r.config.consumerId),O=e.computed(()=>w.value?"kong-ui-entities-consumer-groups-list-in-consumer-page":"kong-ui-entities-consumer-groups-list"),x=e.computed(()=>r.config.app==="konnect"&&A.value?"consumer_group":w.value&&!r.config.paginatedEndpoint?"consumer_groups":void 0),{fetcher:te,fetcherState:re,fetcherCacheKey:U}=m.useFetcher(e.computed(()=>({...r.config,cacheIdentifier:r.cacheIdentifier})),B,x),M=()=>{A.value=""},z=()=>{U.value++},T=e.ref(null),p=async(n,d)=>{const h=n.id;if(!await d(h)){a("copy:error",{entity:n,field:"id",message:c("consumer_groups.errors.copy")});return}a("copy:success",{entity:n,field:"id",message:c("consumer_groups.copy.success",{val:h})})},b=async(n,d)=>{const h=JSON.stringify(n);if(!await d(h)){a("copy:error",{entity:n,message:c("consumer_groups.errors.copy")});return}a("copy:success",{entity:n,message:c("consumer_groups.copy.success_brief")})},f=async n=>{var h;await((h=r.canRetrieve)==null?void 0:h.call(r,n))&&s.push(r.config.getViewRoute(n.id))},k=n=>({label:c("consumer_groups.actions.view"),to:r.config.getViewRoute(n)}),F=n=>({label:c("consumer_groups.actions.edit"),to:r.config.getEditRoute(n)}),$=e.ref(void 0),j=e.ref(!1),X=e.ref(!1),ne=e.ref(""),ae=m.useDeleteUrlBuilder(r.config,B.value),ce=n=>{$.value=n,j.value=!0},t=()=>{j.value=!1},i=async()=>{var n,d,h;if((n=$.value)!=null&&n.id){X.value=!0;try{await V.delete(ae($.value.id)),X.value=!1,j.value=!1,U.value++,a("delete:success",$.value)}catch(E){ne.value=((h=(d=E.response)==null?void 0:d.data)==null?void 0:h.message)||E.message||c("consumer_groups.errors.delete"),a("error",E)}finally{X.value=!1}}},C=e.ref(!1),l=()=>{C.value=!0},u=()=>{C.value=!1},I=(n,d)=>{d||u(),U.value++,a("add:success",n)},K=()=>{w.value&&l()},_=e.ref(void 0),L=e.ref(!1),ie=e.ref(""),Fe=n=>{_.value=n,L.value=!0},ge=()=>{L.value=!1,_.value=void 0},Ke=e.computed(()=>{var d,h,E,P;let n=`${r.config.apiBaseUrl}${q.list[r.config.app].oneForConsumer}`;return r.config.app==="konnect"?n=n.replace(/{controlPlaneId}/gi,((d=r.config)==null?void 0:d.controlPlaneId)||"").replace(/{consumerId}/gi,((h=r.config)==null?void 0:h.consumerId)||""):r.config.app==="kongManager"&&(n=n.replace(/\/{workspace}/gi,(E=r.config)!=null&&E.workspace?`/${r.config.workspace}`:"").replace(/{consumerId}/gi,((P=r.config)==null?void 0:P.consumerId)||"")),n}),ye=e.ref(!1),Re=async()=>{if(_.value){ye.value=!0;try{const n=Ke.value.replace(/{consumerGroupId}/gi,_.value.id);await V.delete(n),a("remove:success",_.value),ge(),U.value++}catch(n){ie.value=n.message||c("consumer_groups.errors.delete"),a("error",n)}finally{ye.value=!1}}};e.watch(re,n=>{var d,h,E;if(n.status===m.FetcherStatus.Error){T.value={title:c("consumer_groups.errors.general")},(E=(h=(d=n.error)==null?void 0:d.response)==null?void 0:h.data)!=null&&E.message&&(T.value.message=n.error.response.data.message),a("error",n.error);return}T.value=null});const de=e.ref({ctaPath:w.value?void 0:r.config.createRoute,ctaText:void 0,message:`${c("consumer_groups.list.empty_state.description")}${r.config.additionMessageForEmptyState?` ${r.config.additionMessageForEmptyState}`:""}`,title:c("consumer_groups.title")}),me=e.ref(!1);return e.onBeforeMount(async()=>{me.value=await r.canCreate(),me.value&&(de.value.title=w.value?c("consumer_groups.list.empty_state.title_for_consumer"):c("consumer_groups.list.empty_state.title"),de.value.ctaText=w.value?c("consumer_groups.actions.add_to_group"):c("consumer_groups.actions.create"))}),(n,d)=>{const h=e.resolveComponent("KButton"),E=e.resolveComponent("KEmptyState"),P=e.resolveComponent("KDropdownItem"),_e=e.resolveComponent("KClipboardProvider"),Ue=e.resolveComponent("KPrompt");return e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(e.unref(m.EntityBaseTable),{"cache-identifier":o.cacheIdentifier,"disable-pagination":w.value&&!o.config.paginatedEndpoint,"disable-sorting":Z.value,"empty-state-options":de.value,"enable-entity-actions":"","error-message":T.value,fetcher:e.unref(te),"fetcher-cache-key":e.unref(U),"pagination-type":"offset","preferences-storage-key":O.value,query:A.value,"row-attributes":ee,"table-headers":e.unref(v),onClearSearchInput:M,"onClick:row":d[3]||(d[3]=y=>f(y)),onEmptyStateCtaClicked:K,onSort:z,onState:e.unref(W)},e.createSlots({"toolbar-filter":e.withCtx(()=>[w.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(m.EntityFilter),{key:0,modelValue:A.value,"onUpdate:modelValue":d[0]||(d[0]=y=>A.value=y),config:H.value},null,8,["modelValue","config"]))]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!o.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",$e,[oe.value?(e.openBlock(),e.createBlock(h,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"consumer-groups-learn-more-button",icon:"",onClick:d[1]||(d[1]=y=>n.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canCreate()},{default:e.withCtx(()=>[e.createVNode(h,{appearance:"primary","data-testid":"toolbar-add-consumer-group",size:o.useActionOutside?"medium":"large",onClick:Q},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.AddIcon)),e.createTextVNode(" "+e.toDisplayString(o.config.consumerId?e.unref(c)("consumer_groups.actions.add_to_group"):e.unref(c)("consumer_groups.list.toolbar_actions.new_consumer_group")),1)]),_:1},8,["size"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({rowValue:y})=>[e.createElementVNode("b",null,e.toDisplayString(y??"-"),1)]),consumers_count:e.withCtx(({rowValue:y})=>[e.createTextVNode(e.toDisplayString(y??"-"),1)]),tags:e.withCtx(({rowValue:y})=>[e.createVNode(e.unref(m.TableTags),{tags:y},null,8,["tags"])]),actions:e.withCtx(({row:y})=>[e.createVNode(_e,null,{default:e.withCtx(({copyToClipboard:le})=>[e.createVNode(P,{"data-testid":"action-entity-copy-id",onClick:qe=>p(y,le)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("consumer_groups.actions.copy_id")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(_e,null,{default:e.withCtx(({copyToClipboard:le})=>[e.createVNode(P,{"data-testid":"action-entity-copy-json",onClick:qe=>b(y,le)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("consumer_groups.actions.copy_json")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canRetrieve(y)},{default:e.withCtx(()=>[e.createVNode(P,{"data-testid":"action-entity-view","has-divider":"",item:k(y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canEdit(y)},{default:e.withCtx(()=>[e.createVNode(P,{"data-testid":"action-entity-edit",item:F(y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canDelete(y)},{default:e.withCtx(()=>[e.createVNode(P,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:()=>o.config.consumerId?Fe(y):ce(y)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.config.consumerId?e.unref(c)("consumer_groups.actions.exit"):e.unref(c)("consumer_groups.actions.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!A.value&&o.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var y;return[e.createVNode(E,{"data-testid":"consumer-groups-entity-empty-state","icon-background":"",message:e.unref(c)("consumer_groups.list.empty_state_v2.description"),title:e.unref(c)("consumer_groups.list.empty_state_v2.title")},e.createSlots({icon:e.withCtx(()=>[e.createVNode(e.unref(Y.TeamIcon),{decorative:""})]),action:e.withCtx(()=>[me.value?(e.openBlock(),e.createBlock(h,{key:0,"data-testid":"entity-create-button",onClick:Q},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(c)("consumer_groups.list.toolbar_actions.new_consumer_group")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(h,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:d[2]||(d[2]=le=>n.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(c)("consumer_groups.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(y=o.config)!=null&&y.isControlPlaneGroup?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("consumer_groups.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-pagination","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","preferences-storage-key","query","table-headers","onState"]),e.createVNode(e.unref(m.EntityDeleteModal),{"action-pending":X.value,"data-testid":"delete-consumer-group-modal",description:e.unref(c)("consumer_groups.delete.description"),"entity-name":$.value&&($.value.name||$.value.id),"entity-type":e.unref(m.EntityTypes).ConsumerGroup,error:ne.value,title:e.unref(c)("consumer_groups.delete.title"),visible:j.value,onCancel:t,onProceed:i},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"]),o.config.consumerId?(e.openBlock(),e.createBlock(Ee,{key:0,config:o.config,"data-testid":"add-to-group-modal",visible:C.value,"onAdd:partialSuccess":d[4]||(d[4]=y=>I(y,!0)),"onAdd:success":d[5]||(d[5]=y=>I(y)),onCancel:u},null,8,["config","visible"])):e.createCommentVNode("",!0),o.config.consumerId&&_.value?(e.openBlock(),e.createBlock(Ue,{key:1,"action-button-appearance":"danger","data-testid":"exit-group-modal",title:e.unref(c)("consumer_groups.consumers.exit.title"),visible:L.value,onCancel:ge,onProceed:Re},{default:e.withCtx(()=>[e.createVNode(e.unref(g),{class:"exit-modal-message",keypath:o.config.consumerUsername?"consumer_groups.consumers.exit.confirmation":"consumer_groups.consumers.exit.confirmationNoUsername",tag:"p"},e.createSlots({consumerGroup:e.withCtx(()=>[e.createElementVNode("strong",null,e.toDisplayString(_.value.name||_.value.id),1)]),_:2},[o.config.consumerUsername?{name:"consumer",fn:e.withCtx(()=>[e.createElementVNode("strong",null,e.toDisplayString(o.config.consumerUsername),1)]),key:"0"}:void 0]),1032,["keypath"]),e.createElementVNode("p",null,e.toDisplayString(e.unref(c)("consumer_groups.consumers.exit.description")),1)]),_:1},8,["title","visible"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-569ce4be"]]),Me={class:"kong-ui-entities-consumer-group-form"},Te={class:"select-item-container"},Ge={class:"select-item-label"},De={key:0,class:"select-item-description"},Ae=ue(e.defineComponent({__name:"ConsumerGroupForm",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||(o==null?void 0:o.app)==="konnect"&&!(o!=null&&o.controlPlaneId)||(o==null?void 0:o.app)==="kongManager"&&typeof(o==null?void 0:o.workspace)!="string"||!(o!=null&&o.cancelRoute))},consumerGroupId:{type:String,required:!1,default:""},hideConsumers:{type:Boolean,default:!1}},emits:["update","error","loading"],setup(o,{emit:R}){var ne,ae,ce;const a=o,r=R,{i18n:{t:g}}=se.useI18n(),c=pe.useRouter(),s=e.reactive({fields:{name:"",tags:"",consumers:[]},errorMessage:"",readonly:!1}),V=e.reactive({name:"",tags:"",consumers:[]}),{debouncedQueryChange:Z,loading:S,error:v,loadItems:ee,results:Q}=m.useDebouncedFilter(a.config,(ae=q.form[(ne=a.config)==null?void 0:ne.app])==null?void 0:ae.consumersList,"",{fetchedItemsKey:"data",searchKeys:["username","custom_id","id"]}),{axiosInstance:B}=m.useAxios((ce=a.config)==null?void 0:ce.axiosRequestConfig),{getMessageFromError:A}=m.useErrors(),H=m.useValidators(),J=e.computed(()=>Q.value.map(t=>({label:t.username||t.custom_id,value:t.id,selected:s.fields.consumers.includes(t.id),data:t}))),W=e.computed(()=>{var t;return q.item[(t=a.config)==null?void 0:t.app]}),oe=e.computed(()=>a.consumerGroupId?m.EntityBaseFormType.Edit:m.EntityBaseFormType.Create),w=e.computed(()=>!!s.fields.name&&!z.value),O=e.computed(()=>JSON.stringify(s.fields)!==JSON.stringify(V)),x=(t,i="",C="")=>{var u,I,K,_,L,ie;let l=`${(u=a.config)==null?void 0:u.apiBaseUrl}${q.form[(I=a.config)==null?void 0:I.app][t]}`;return((K=a.config)==null?void 0:K.app)==="konnect"?l=l.replace(/{controlPlaneId}/gi,((_=a.config)==null?void 0:_.controlPlaneId)||""):((L=a.config)==null?void 0:L.app)==="kongManager"&&(l=l.replace(/\/{workspace}/gi,(ie=a.config)!=null&&ie.workspace?`/${a.config.workspace}`:"")),l=l.replace(/{id}/gi,i||a.consumerGroupId),(t==="addConsumer"||t==="removeConsumer")&&(l=l.replace(/{consumerId}/gi,C)),l},te=()=>{var t;c.push(((t=a.config)==null?void 0:t.cancelRoute)||{name:"consumer-group-list"})},re=t=>{r("error",t)},U=t=>{r("loading",t)},M=async t=>{var C,l,u,I,K;s.fields.name=((C=t==null?void 0:t.item)==null?void 0:C.name)||((l=t==null?void 0:t.consumer_group)==null?void 0:l.name)||(t==null?void 0:t.name)||"";const i=((u=t==null?void 0:t.item)==null?void 0:u.tags)||(t==null?void 0:t.consumer_group.tags)||(t==null?void 0:t.tags)||[];if(s.fields.tags=(i==null?void 0:i.join(", "))||"","consumers"in t)s.fields.consumers=((I=t==null?void 0:t.consumers)==null?void 0:I.map(_=>_.id))||[];else try{const{data:_}=await B.get(x("getConsumers"));s.fields.consumers="consumers"in _?(K=_==null?void 0:_.consumers)==null?void 0:K.map(L=>L.id):[]}catch(_){f(_)}Object.assign(V,s.fields)},z=e.computed(()=>H.utf8Name(s.fields.name)),T=e.computed(()=>{var t,i;return{name:s.fields.name,tags:(i=(t=s.fields.tags.split(","))==null?void 0:t.map(C=>String(C||"").trim()))==null?void 0:i.filter(C=>C!=="")}}),p=async(t,i="")=>await B.post(x("addConsumer",i,t),{consumer:t}),b=async(t,i="")=>await B.delete(x("removeConsumer",i,t)),f=t=>{s.errorMessage=A(t),r("error",t)},k=(t=a.consumerGroupId)=>{Object.assign(V,s.fields),r("update",{...s.fields,id:t})},F=(t,i,C=a.consumerGroupId)=>{const l=t==null?void 0:t.find(u=>u.status!=="fulfilled");l?f({code:l.status,message:i}):k(C)},$=async()=>{let t="";try{const{data:i}=await B.post(x("create"),T.value);t="item"in i?i.item.id:i.id}catch(i){f(i)}if(s.fields.consumers.length>0&&t)try{const i=s.fields.consumers.map(l=>p(l,t)),C=await Promise.allSettled(i);F(C,g("consumer_groups.errors.add_consumer"),t)}catch(i){f(i)}else s.fields.consumers.length===0&&t&&k(t)},j=async()=>{var C;try{((C=a.config)==null?void 0:C.app)==="konnect"?await B.put(x("edit"),T.value):await B.patch(x("edit"),T.value)}catch(l){f(l)}const t=s.fields.consumers.filter(l=>!V.consumers.includes(l)),i=V.consumers.filter(l=>!s.fields.consumers.includes(l));if(i.length===0&&t.length===0)k();else{if(i.length>0)try{const l=i.map(I=>b(I)),u=await Promise.allSettled(l);F(u,g("consumer_groups.errors.remove_consumer"))}catch(l){f(l)}if(t.length>0)try{const l=t.map(I=>p(I)),u=await Promise.allSettled(l);F(u,g("consumer_groups.errors.add_consumer"))}catch(l){f(l)}}},X=async()=>{try{s.readonly=!0,oe.value===m.EntityBaseFormType.Create?await $():await j()}finally{s.readonly=!1}};return e.onBeforeMount(async()=>{a.hideConsumers||await ee()}),(t,i)=>{const C=e.resolveComponent("KInput"),l=e.resolveComponent("KMultiselect");return e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(e.unref(m.EntityBaseForm),{"can-submit":w.value&&O.value,config:o.config,"edit-id":o.consumerGroupId,"entity-type":e.unref(m.SupportedEntityType).ConsumerGroup,"error-message":s.errorMessage||e.unref(v)||z.value,"fetch-url":W.value,"form-fields":T.value,"is-readonly":s.readonly,onCancel:te,"onFetch:error":i[3]||(i[3]=u=>re(u)),"onFetch:success":M,onLoading:i[4]||(i[4]=u=>U(u)),onSubmit:X},{default:e.withCtx(()=>[e.createVNode(e.unref(m.EntityFormSection),{description:e.unref(g)("consumer_groups.form.general_info.description"),title:e.unref(g)("consumer_groups.form.general_info.title")},{default:e.withCtx(()=>[e.createVNode(C,{modelValue:s.fields.name,"onUpdate:modelValue":i[0]||(i[0]=u=>s.fields.name=u),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"consumer-group-form-name",label:e.unref(g)("consumer_groups.form.fields.name.label"),placeholder:e.unref(g)("consumer_groups.form.fields.name.placeholder"),required:"",type:"text"},null,8,["modelValue","label","placeholder"]),e.createVNode(C,{modelValue:s.fields.tags,"onUpdate:modelValue":i[1]||(i[1]=u=>s.fields.tags=u),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"consumer-group-form-tags",help:e.unref(g)("consumer_groups.form.fields.tags.help"),label:e.unref(g)("consumer_groups.form.fields.tags.label"),"label-attributes":{info:e.unref(g)("consumer_groups.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:e.unref(g)("consumer_groups.form.fields.tags.placeholder"),type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder"])]),_:1},8,["description","title"]),o.hideConsumers?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(m.EntityFormSection),{key:0,description:e.unref(g)("consumer_groups.form.consumers.description"),"has-divider":"",title:e.unref(g)("consumer_groups.form.consumers.title")},{default:e.withCtx(()=>[e.createVNode(l,{modelValue:s.fields.consumers,"onUpdate:modelValue":i[2]||(i[2]=u=>s.fields.consumers=u),appearance:"select",autosuggest:"",items:J.value,label:e.unref(g)("consumer_groups.form.fields.consumers.label"),loading:e.unref(S),placeholder:e.unref(g)("consumer_groups.form.fields.consumers.placeholder"),width:"auto",onQueryChange:e.unref(Z)},{"item-template":e.withCtx(({item:u})=>{var I,K,_;return[e.createElementVNode("div",Te,[e.createElementVNode("div",Ge,e.toDisplayString(u.label),1),(I=u==null?void 0:u.data)!=null&&I.username&&((K=u==null?void 0:u.data)!=null&&K.custom_id)?(e.openBlock(),e.createElementBlock("div",De,e.toDisplayString((_=u==null?void 0:u.data)==null?void 0:_.custom_id),1)):e.createCommentVNode("",!0)])]}),_:1},8,["modelValue","items","label","loading","placeholder","onQueryChange"])]),_:1},8,["description","title"]))]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-831e62f1"]]),Pe={class:"kong-ui-consumer-group-entity-config-card"},Se=e.defineComponent({__name:"ConsumerGroupConfigCard",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||o.app==="konnect"&&!o.controlPlaneId||o.app==="kongManager"&&typeof o.workspace!="string"||!o.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(o){const R=o,{i18n:{t:a}}=se.useI18n(),r=e.computed(()=>q.item[R.config.app]),g=e.ref({id:{},name:{},created_at:{},updated_at:{},tags:{tooltip:a("consumer_groups.form.fields.tags.tooltip")}});return(c,s)=>(e.openBlock(),e.createElementBlock("div",Pe,[e.createVNode(e.unref(m.EntityBaseConfigCard),{config:o.config,"config-card-doc":o.configCardDoc,"config-schema":g.value,"data-key":"consumer_group","entity-type":e.unref(m.SupportedEntityType).ConsumerGroup,"fetch-url":r.value,"hide-title":o.hideTitle,"onFetch:error":s[0]||(s[0]=V=>c.$emit("fetch:error",V)),"onFetch:success":s[1]||(s[1]=V=>c.$emit("fetch:success",V)),onLoading:s[2]||(s[2]=V=>c.$emit("loading",V))},null,8,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title"])]))}});N.ConsumerGroupConfigCard=Se,N.ConsumerGroupForm=Ae,N.ConsumerGroupList=Be,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
1
+ (function(N,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router"),require("@kong/icons"),require("@kong-ui-public/i18n"),require("@kong-ui-public/entities-shared")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","@kong/icons","@kong-ui-public/i18n","@kong-ui-public/entities-shared"],e):(N=typeof globalThis<"u"?globalThis:N||self,e(N["kong-ui-public-entities-consumer-groups"]={},N.Vue,N.VueRouter,N.KongIcons,N["kong-ui-public-i18n"],N["kong-ui-public-entities-shared"]))})(this,function(N,e,pe,Y,fe,m){"use strict";const Ce={consumer_groups:{list:{table_headers:{name:"Name",consumers_count:"Consumers",tags:"Tags",id:"ID"},empty_state:{title:"Configure a new consumer group",description:"Use consumer groups to manage custom rate limiting configuration for subsets of consumers.",title_for_consumer:"Add to a consumer group"},empty_state_v2:{title:"Configure your first consumer group",group:"Consumer groups created in gateways within this group will automatically appear here.",description:"Organize consumers into groups to easily apply policies like rate limiting and authentication across the entire group.",learn_more:"Learn more"},toolbar_actions:{new_consumer_group:"New consumer group"}},title:"Consumer groups",search:{placeholder:"Filter by exact name or ID"},actions:{add_to_group:"Add to consumer group",create:"New consumer group",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",exit:"Exit",view:"View details"},delete:{title:"Delete a consumer group",description:"Deleting this group will remove all its plugins and rate limit configuration. This action cannot be reversed."},consumers:{add:{title:"Add To consumer groups",ctaText:"Add this consumer to consumer groups",consumer_groups_label:"Consumer groups",consumer_group_placeholder:"Add to consumer groups",footer:"Search by exact name or ID to find consumer groups not included in the list"},exit:{title:"Exit from a consumer group",confirmation:"Are you sure you want to remove consumer {consumer} from consumer group {consumerGroup}?",confirmationNoUsername:"Are you sure you want this consumer to exit from consumer group {consumerGroup}?",description:"Exiting from the group could change the rate limit policy applied to this consumer."}},errors:{general:"Consumer groups could not be retrieved",delete:"The consumer group could not be deleted at this time.",copy:"Failed to copy to clipboard",add:"The consumer could not be added to some groups at this time.",already_added:"The consumer is already in this consumer group",add_consumer:"An unexpected error occurred while adding consumers. Please try again.",remove_consumer:"An unexpected error occurred while removing consumers. Please try again."},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{general_info:{title:"General information",description:"General information will help identify and manage this consumer group."},consumers:{title:"Consumers",description:"Add or remove consumers from this group"},fields:{name:{label:"Name",placeholder:"Enter a unique name for this consumer group "},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},consumers:{label:"Consumers",placeholder:"Select one or more consumers"}}}}};function ke(){const o=fe.createI18n("en-us",Ce);return{i18n:o,i18nT:fe.i18nTComponent(o)}}const se={useI18n:ke},D="/v2/control-planes/{controlPlaneId}/core-entities",A="/{workspace}",q={list:{konnect:{all:`${D}/consumer_groups`,forModal:`${D}/consumer_groups`,forConsumer:`${D}/consumers/{consumerId}/consumer_groups`,oneForConsumer:`${D}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`},kongManager:{all:`${A}/consumer_groups?counter=true`,forModal:`${A}/consumer_groups`,forConsumer:`${A}/consumers/{consumerId}/consumer_groups`,oneForConsumer:`${A}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`}},form:{konnect:{consumersList:`${D}/consumers`,create:`${D}/consumer_groups`,edit:`${D}/consumer_groups/{id}`,addConsumer:`${D}/consumer_groups/{id}/consumers`,removeConsumer:`${D}/consumer_groups/{id}/consumers/{consumerId}`,getConsumers:`${D}/consumer_groups/{id}/consumers`},kongManager:{consumersList:`${A}/consumers`,create:`${A}/consumer_groups`,edit:`${A}/consumer_groups/{id}`,addConsumer:`${A}/consumer_groups/{id}/consumers`,removeConsumer:`${A}/consumer_groups/{id}/consumers/{consumerId}`,getConsumers:`${A}/consumer_groups/{id}/consumers`}},item:{konnect:`${D}/consumer_groups/{id}?list_consumers=false`,kongManager:`${A}/consumer_groups/{id}?list_consumers=false`}},be={class:"add-to-group-form-container"},we={class:"add-to-group-cta-text"},Ve={key:0,class:"kong-ui-entity-add-to-groups-error"},xe={key:0},Ie=e.defineComponent({__name:"AddToGroupModal",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||!o.consumerId)},visible:{type:Boolean,required:!0,default:!1}},emits:["cancel","add:success","add:partial-success","error"],setup(o,{emit:R}){var T;const{i18n:{t:a}}=se.useI18n(),r=o,g=R,{axiosInstance:c}=m.useAxios((T=r.config)==null?void 0:T.axiosRequestConfig),s=e.ref([]),{debouncedQueryChange:V,loading:Z,allRecords:S,error:v,loadItems:ee,results:Q}=m.useDebouncedFilter(r.config,q.list[r.config.app].forModal,"",{fetchedItemsKey:"data",searchKeys:["name","id"]}),B=e.computed(()=>v.value?a("consumer_groups.errors.general"):""),P=e.ref(0),H=e.computed(()=>S.value===void 0),J=e.computed(()=>Q.value.map(p=>({label:p.name,value:p.id,selected:s.value.includes(p.id),data:p}))),W=p=>{var f;const b=H.value?Q.value.find(k=>k.id===p):(f=S.value)==null?void 0:f.find(k=>k.id===p);return b?b.name:p},oe=()=>{x.value="",w.value=[],M.value=[],g("cancel")},w=e.ref([]),O=e.ref(!1),x=e.ref(""),te=async()=>{if(!s.value.length){x.value="",M.value=[],g("cancel");return}O.value=!0,x.value="",w.value=[],M.value=[];try{const p=s.value.map(k=>U(k)),b=await Promise.allSettled(p);let f=!0;b.forEach(k=>{k.status!=="fulfilled"&&(f=!1)}),f?(w.value=[],M.value=[],g("add:success",s.value),s.value=[]):(w.value.length&&g("add:partial-success",w.value),s.value=[],z(b))}catch{x.value=a("consumer_groups.errors.add"),g("error",x.value)}finally{O.value=!1}},re=e.computed(()=>{var b,f,k,F;let p=`${r.config.apiBaseUrl}${q.list[r.config.app].forConsumer}`;return r.config.app==="konnect"?p=p.replace(/{controlPlaneId}/gi,((b=r.config)==null?void 0:b.controlPlaneId)||"").replace(/{consumerId}/gi,((f=r.config)==null?void 0:f.consumerId)||""):r.config.app==="kongManager"&&(p=p.replace(/\/{workspace}/gi,(k=r.config)!=null&&k.workspace?`/${r.config.workspace}`:"").replace(/{consumerId}/gi,((F=r.config)==null?void 0:F.consumerId)||"")),p}),U=async p=>{const b={group:p};try{const f=await c.post(re.value,b);return w.value.push(p),f}catch(f){let k=`${W(p)} - ${f.message}`;return f.response.status===409&&(k=`${W(p)} - ${a("consumer_groups.errors.already_added")}`),Promise.reject(Error(k))}},M=e.ref([]),z=p=>{M.value=p.map(b=>{var f;return(f=b.reason)==null?void 0:f.message}).filter(Boolean)};return e.watch(J,()=>{P.value++},{immediate:!0,deep:!0}),e.watch(()=>r.visible,()=>{r.visible&&ee()},{immediate:!0}),(p,b)=>{const f=e.resolveComponent("KMultiselect"),k=e.resolveComponent("KAlert"),F=e.resolveComponent("KPrompt");return e.openBlock(),e.createBlock(F,{"action-button-disabled":O.value,class:"kong-ui-entities-add-to-groups-modal","data-testid":"add-to-group-modal",title:e.unref(a)("consumer_groups.consumers.add.title"),visible:o.visible,onCancel:oe,onProceed:te},{default:e.withCtx(()=>[e.createElementVNode("div",be,[e.createElementVNode("p",we,e.toDisplayString(e.unref(a)("consumer_groups.consumers.add.ctaText")),1),e.createVNode(f,{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=$=>s.value=$),autosuggest:"","data-testid":"add-to-groups-multiselect","dropdown-footer-text":H.value?e.unref(a)("consumer_groups.consumers.add.footer"):void 0,items:J.value,label:e.unref(a)("consumer_groups.consumers.add.consumer_groups_label"),loading:e.unref(Z),placeholder:e.unref(a)("consumer_groups.consumers.add.consumer_group_placeholder"),readonly:O.value,required:"",width:"100%",onQueryChange:e.unref(V)},null,8,["modelValue","dropdown-footer-text","items","label","loading","placeholder","readonly","onQueryChange"]),x.value||B.value||M.value.length?(e.openBlock(),e.createElementBlock("div",Ve,[e.createVNode(k,{appearance:"danger"},{default:e.withCtx(()=>[e.createElementVNode("p",null,e.toDisplayString(e.unref(a)("consumer_groups.errors.add")),1),M.value.length?(e.openBlock(),e.createElementBlock("ul",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,($,j)=>(e.openBlock(),e.createElementBlock("li",{key:j},e.toDisplayString($),1))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",null,e.toDisplayString(x.value||B.value),1)]),_:1})])):e.createCommentVNode("",!0)])]),_:1},8,["action-button-disabled","title","visible"])}}}),ue=(o,R)=>{const a=o.__vccOpts||o;for(const[r,g]of R)a[r]=g;return a},Ee=ue(Ie,[["__scopeId","data-v-4a6bfc7b"]]),Ne={class:"kong-ui-entities-consumer-groups-list"},$e={class:"button-row"},Be=ue(e.defineComponent({__name:"ConsumerGroupList",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||!o.createRoute||!o.getViewRoute||!o.getEditRoute||o.app==="kongManager"&&!o.isExactMatch&&!o.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success","add:success","remove:success"],setup(o,{emit:R}){var he;const a=R,r=o,{i18nT:g,i18n:{t:c}}=se.useI18n(),s=pe.useRouter(),{axiosInstance:V}=m.useAxios((he=r.config)==null?void 0:he.axiosRequestConfig),Z=e.computed(()=>r.config.app!=="kongManager"||!!r.config.disableSorting),S={name:{label:c("consumer_groups.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1}};r.config.app==="kongManager"&&(S.consumers_count={label:c("consumer_groups.list.table_headers.consumers_count"),searchable:!1,sortable:!1}),S.tags={label:c("consumer_groups.list.table_headers.tags"),sortable:!1};const v=S,ee=n=>({"data-testid":n.username??n.custom_id??n.id}),Q=()=>{r.config.consumerId?l():s.push(r.config.createRoute)},B=e.computed(()=>{var d,h,E,G;let n=`${r.config.apiBaseUrl}${q.list[r.config.app][w.value?"forConsumer":"all"]}`;return r.config.app==="konnect"?n=n.replace(/{controlPlaneId}/gi,((d=r.config)==null?void 0:d.controlPlaneId)||"").replace(/{consumerId}/gi,((h=r.config)==null?void 0:h.consumerId)||""):r.config.app==="kongManager"&&(n=n.replace(/\/{workspace}/gi,(E=r.config)!=null&&E.workspace?`/${r.config.workspace}`:"").replace(/{consumerId}/gi,((G=r.config)==null?void 0:G.consumerId)||"")),n}),P=e.ref(""),H=e.computed(()=>{const n=r.config.app==="konnect"||r.config.isExactMatch;return n?{isExactMatch:n,fields:{username:S.name,id:{label:c("consumer_groups.list.table_headers.id")}},placeholder:c("consumer_groups.search.placeholder")}:{isExactMatch:n,fields:{name:S.name},schema:r.config.filterSchema}}),{hasRecords:J,handleStateChange:W}=m.useTableState(P),oe=e.computed(()=>J.value&&r.config.app==="konnect"),w=e.computed(()=>!!r.config.consumerId),O=e.computed(()=>w.value?"kong-ui-entities-consumer-groups-list-in-consumer-page":"kong-ui-entities-consumer-groups-list"),x=e.computed(()=>r.config.app==="konnect"&&P.value?"consumer_group":w.value&&!r.config.paginatedEndpoint?"consumer_groups":void 0),{fetcher:te,fetcherState:re,fetcherCacheKey:U}=m.useFetcher(e.computed(()=>({...r.config,cacheIdentifier:r.cacheIdentifier})),B,x),M=()=>{P.value=""},z=()=>{U.value++},T=e.ref(null),p=async(n,d)=>{const h=n.id;if(!await d(h)){a("copy:error",{entity:n,field:"id",message:c("consumer_groups.errors.copy")});return}a("copy:success",{entity:n,field:"id",message:c("consumer_groups.copy.success",{val:h})})},b=async(n,d)=>{const h=JSON.stringify(n);if(!await d(h)){a("copy:error",{entity:n,message:c("consumer_groups.errors.copy")});return}a("copy:success",{entity:n,message:c("consumer_groups.copy.success_brief")})},f=async n=>{var h;await((h=r.canRetrieve)==null?void 0:h.call(r,n))&&s.push(r.config.getViewRoute(n.id))},k=n=>({label:c("consumer_groups.actions.view"),to:r.config.getViewRoute(n)}),F=n=>({label:c("consumer_groups.actions.edit"),to:r.config.getEditRoute(n)}),$=e.ref(void 0),j=e.ref(!1),X=e.ref(!1),ne=e.ref(""),ae=m.useDeleteUrlBuilder(r.config,B.value),ce=n=>{$.value=n,j.value=!0},t=()=>{j.value=!1},i=async()=>{var n,d,h;if((n=$.value)!=null&&n.id){X.value=!0;try{await V.delete(ae($.value.id)),X.value=!1,j.value=!1,U.value++,a("delete:success",$.value)}catch(E){ne.value=((h=(d=E.response)==null?void 0:d.data)==null?void 0:h.message)||E.message||c("consumer_groups.errors.delete"),a("error",E)}finally{X.value=!1}}},C=e.ref(!1),l=()=>{C.value=!0},u=()=>{C.value=!1},I=(n,d)=>{d||u(),U.value++,a("add:success",n)},K=()=>{w.value&&l()},_=e.ref(void 0),L=e.ref(!1),ie=e.ref(""),Fe=n=>{_.value=n,L.value=!0},ge=()=>{L.value=!1,_.value=void 0},Ke=e.computed(()=>{var d,h,E,G;let n=`${r.config.apiBaseUrl}${q.list[r.config.app].oneForConsumer}`;return r.config.app==="konnect"?n=n.replace(/{controlPlaneId}/gi,((d=r.config)==null?void 0:d.controlPlaneId)||"").replace(/{consumerId}/gi,((h=r.config)==null?void 0:h.consumerId)||""):r.config.app==="kongManager"&&(n=n.replace(/\/{workspace}/gi,(E=r.config)!=null&&E.workspace?`/${r.config.workspace}`:"").replace(/{consumerId}/gi,((G=r.config)==null?void 0:G.consumerId)||"")),n}),ye=e.ref(!1),Re=async()=>{if(_.value){ye.value=!0;try{const n=Ke.value.replace(/{consumerGroupId}/gi,_.value.id);await V.delete(n),a("remove:success",_.value),ge(),U.value++}catch(n){ie.value=n.message||c("consumer_groups.errors.delete"),a("error",n)}finally{ye.value=!1}}};e.watch(re,n=>{var d,h,E;if(n.status===m.FetcherStatus.Error){T.value={title:c("consumer_groups.errors.general")},(E=(h=(d=n.error)==null?void 0:d.response)==null?void 0:h.data)!=null&&E.message&&(T.value.message=n.error.response.data.message),a("error",n.error);return}T.value=null});const de=e.ref({ctaPath:w.value?void 0:r.config.createRoute,ctaText:void 0,message:`${c("consumer_groups.list.empty_state.description")}${r.config.additionMessageForEmptyState?` ${r.config.additionMessageForEmptyState}`:""}`,title:c("consumer_groups.title")}),me=e.ref(!1);return e.onBeforeMount(async()=>{me.value=await r.canCreate(),me.value&&(de.value.title=w.value?c("consumer_groups.list.empty_state.title_for_consumer"):c("consumer_groups.list.empty_state.title"),de.value.ctaText=w.value?c("consumer_groups.actions.add_to_group"):c("consumer_groups.actions.create"))}),(n,d)=>{const h=e.resolveComponent("KButton"),E=e.resolveComponent("KEmptyState"),G=e.resolveComponent("KDropdownItem"),_e=e.resolveComponent("KClipboardProvider"),Ue=e.resolveComponent("KPrompt");return e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(e.unref(m.EntityBaseTable),{"cache-identifier":o.cacheIdentifier,"disable-pagination":w.value&&!o.config.paginatedEndpoint,"disable-sorting":Z.value,"empty-state-options":de.value,"enable-entity-actions":"","error-message":T.value,fetcher:e.unref(te),"fetcher-cache-key":e.unref(U),"pagination-type":"offset","preferences-storage-key":O.value,query:P.value,"row-attributes":ee,"table-headers":e.unref(v),onClearSearchInput:M,"onClick:row":d[3]||(d[3]=y=>f(y)),onEmptyStateCtaClicked:K,onSort:z,onState:e.unref(W)},e.createSlots({"toolbar-filter":e.withCtx(()=>[w.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(m.EntityFilter),{key:0,modelValue:P.value,"onUpdate:modelValue":d[0]||(d[0]=y=>P.value=y),config:H.value},null,8,["modelValue","config"]))]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!o.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",$e,[oe.value?(e.openBlock(),e.createBlock(h,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"consumer-groups-learn-more-button",icon:"",onClick:d[1]||(d[1]=y=>n.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canCreate()},{default:e.withCtx(()=>[e.createVNode(h,{appearance:"primary","data-testid":"toolbar-add-consumer-group",size:o.useActionOutside?"medium":"large",onClick:Q},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.AddIcon)),e.createTextVNode(" "+e.toDisplayString(o.config.consumerId?e.unref(c)("consumer_groups.actions.add_to_group"):e.unref(c)("consumer_groups.list.toolbar_actions.new_consumer_group")),1)]),_:1},8,["size"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({rowValue:y})=>[e.createElementVNode("b",null,e.toDisplayString(y??"-"),1)]),consumers_count:e.withCtx(({rowValue:y})=>[e.createTextVNode(e.toDisplayString(y??"-"),1)]),tags:e.withCtx(({rowValue:y})=>[e.createVNode(e.unref(m.TableTags),{tags:y},null,8,["tags"])]),actions:e.withCtx(({row:y})=>[e.createVNode(_e,null,{default:e.withCtx(({copyToClipboard:le})=>[e.createVNode(G,{"data-testid":"action-entity-copy-id",onClick:qe=>p(y,le)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("consumer_groups.actions.copy_id")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(_e,null,{default:e.withCtx(({copyToClipboard:le})=>[e.createVNode(G,{"data-testid":"action-entity-copy-json",onClick:qe=>b(y,le)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("consumer_groups.actions.copy_json")),1)]),_:1},8,["onClick"])]),_:2},1024),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canRetrieve(y)},{default:e.withCtx(()=>[e.createVNode(G,{"data-testid":"action-entity-view","has-divider":"",item:k(y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canEdit(y)},{default:e.withCtx(()=>[e.createVNode(G,{"data-testid":"action-entity-edit",item:F(y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(m.PermissionsWrapper),{"auth-function":()=>o.canDelete(y)},{default:e.withCtx(()=>[e.createVNode(G,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:()=>o.config.consumerId?Fe(y):ce(y)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.config.consumerId?e.unref(c)("consumer_groups.actions.exit"):e.unref(c)("consumer_groups.actions.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!P.value&&o.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var y;return[e.createVNode(E,{"data-testid":"consumer-groups-entity-empty-state","icon-background":"",message:e.unref(c)("consumer_groups.list.empty_state_v2.description"),title:e.unref(c)("consumer_groups.list.empty_state_v2.title")},e.createSlots({icon:e.withCtx(()=>[e.createVNode(e.unref(Y.TeamIcon),{decorative:""})]),action:e.withCtx(()=>[me.value?(e.openBlock(),e.createBlock(h,{key:0,"data-testid":"entity-create-button",onClick:Q},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.AddIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(c)("consumer_groups.list.toolbar_actions.new_consumer_group")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(h,{appearance:"secondary","data-testid":"entity-learn-more-button",onClick:d[2]||(d[2]=le=>n.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.BookIcon),{decorative:""}),e.createTextVNode(" "+e.toDisplayString(e.unref(c)("consumer_groups.list.empty_state_v2.learn_more")),1)]),_:1})]),_:2},[(y=o.config)!=null&&y.isControlPlaneGroup?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("consumer_groups.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["message","title"])]}),key:"0"}:void 0]),1032,["cache-identifier","disable-pagination","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","preferences-storage-key","query","table-headers","onState"]),e.createVNode(e.unref(m.EntityDeleteModal),{"action-pending":X.value,"data-testid":"delete-consumer-group-modal",description:e.unref(c)("consumer_groups.delete.description"),"entity-name":$.value&&($.value.name||$.value.id),"entity-type":e.unref(m.EntityTypes).ConsumerGroup,error:ne.value,title:e.unref(c)("consumer_groups.delete.title"),visible:j.value,onCancel:t,onProceed:i},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"]),o.config.consumerId?(e.openBlock(),e.createBlock(Ee,{key:0,config:o.config,"data-testid":"add-to-group-modal",visible:C.value,"onAdd:partialSuccess":d[4]||(d[4]=y=>I(y,!0)),"onAdd:success":d[5]||(d[5]=y=>I(y)),onCancel:u},null,8,["config","visible"])):e.createCommentVNode("",!0),o.config.consumerId&&_.value?(e.openBlock(),e.createBlock(Ue,{key:1,"action-button-appearance":"danger","data-testid":"exit-group-modal",title:e.unref(c)("consumer_groups.consumers.exit.title"),visible:L.value,onCancel:ge,onProceed:Re},{default:e.withCtx(()=>[e.createVNode(e.unref(g),{class:"exit-modal-message",keypath:o.config.consumerUsername?"consumer_groups.consumers.exit.confirmation":"consumer_groups.consumers.exit.confirmationNoUsername",tag:"p"},e.createSlots({consumerGroup:e.withCtx(()=>[e.createElementVNode("strong",null,e.toDisplayString(_.value.name||_.value.id),1)]),_:2},[o.config.consumerUsername?{name:"consumer",fn:e.withCtx(()=>[e.createElementVNode("strong",null,e.toDisplayString(o.config.consumerUsername),1)]),key:"0"}:void 0]),1032,["keypath"]),e.createElementVNode("p",null,e.toDisplayString(e.unref(c)("consumer_groups.consumers.exit.description")),1)]),_:1},8,["title","visible"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-569ce4be"]]),Me={class:"kong-ui-entities-consumer-group-form"},Te={class:"select-item-container"},De={class:"select-item-label"},Ae={key:0,class:"select-item-description"},Pe=ue(e.defineComponent({__name:"ConsumerGroupForm",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||(o==null?void 0:o.app)==="konnect"&&!(o!=null&&o.controlPlaneId)||(o==null?void 0:o.app)==="kongManager"&&typeof(o==null?void 0:o.workspace)!="string"||!(o!=null&&o.cancelRoute))},consumerGroupId:{type:String,required:!1,default:""},hideConsumers:{type:Boolean,default:!1}},emits:["update","error","loading"],setup(o,{emit:R}){var ne,ae,ce;const a=o,r=R,{i18n:{t:g}}=se.useI18n(),c=pe.useRouter(),s=e.reactive({fields:{name:"",tags:"",consumers:[]},errorMessage:"",readonly:!1}),V=e.reactive({name:"",tags:"",consumers:[]}),{debouncedQueryChange:Z,loading:S,error:v,loadItems:ee,results:Q}=m.useDebouncedFilter(a.config,(ae=q.form[(ne=a.config)==null?void 0:ne.app])==null?void 0:ae.consumersList,"",{fetchedItemsKey:"data",searchKeys:["username","custom_id","id"]}),{axiosInstance:B}=m.useAxios((ce=a.config)==null?void 0:ce.axiosRequestConfig),{getMessageFromError:P}=m.useErrors(),H=m.useValidators(),J=e.computed(()=>Q.value.map(t=>({label:t.username||t.custom_id,value:t.id,selected:s.fields.consumers.includes(t.id),data:t}))),W=e.computed(()=>{var t;return q.item[(t=a.config)==null?void 0:t.app]}),oe=e.computed(()=>a.consumerGroupId?m.EntityBaseFormType.Edit:m.EntityBaseFormType.Create),w=e.computed(()=>!!s.fields.name&&!z.value),O=e.computed(()=>JSON.stringify(s.fields)!==JSON.stringify(V)),x=(t,i="",C="")=>{var u,I,K,_,L,ie;let l=`${(u=a.config)==null?void 0:u.apiBaseUrl}${q.form[(I=a.config)==null?void 0:I.app][t]}`;return((K=a.config)==null?void 0:K.app)==="konnect"?l=l.replace(/{controlPlaneId}/gi,((_=a.config)==null?void 0:_.controlPlaneId)||""):((L=a.config)==null?void 0:L.app)==="kongManager"&&(l=l.replace(/\/{workspace}/gi,(ie=a.config)!=null&&ie.workspace?`/${a.config.workspace}`:"")),l=l.replace(/{id}/gi,i||a.consumerGroupId),(t==="addConsumer"||t==="removeConsumer")&&(l=l.replace(/{consumerId}/gi,C)),l},te=()=>{var t;c.push(((t=a.config)==null?void 0:t.cancelRoute)||{name:"consumer-group-list"})},re=t=>{r("error",t)},U=t=>{r("loading",t)},M=async t=>{var C,l,u,I,K;s.fields.name=((C=t==null?void 0:t.item)==null?void 0:C.name)||((l=t==null?void 0:t.consumer_group)==null?void 0:l.name)||(t==null?void 0:t.name)||"";const i=((u=t==null?void 0:t.item)==null?void 0:u.tags)||(t==null?void 0:t.consumer_group.tags)||(t==null?void 0:t.tags)||[];if(s.fields.tags=(i==null?void 0:i.join(", "))||"","consumers"in t)s.fields.consumers=((I=t==null?void 0:t.consumers)==null?void 0:I.map(_=>_.id))||[];else try{const{data:_}=await B.get(x("getConsumers"));s.fields.consumers="consumers"in _?(K=_==null?void 0:_.consumers)==null?void 0:K.map(L=>L.id):[]}catch(_){f(_)}Object.assign(V,s.fields)},z=e.computed(()=>H.utf8Name(s.fields.name)),T=e.computed(()=>{var t,i;return{name:s.fields.name,tags:(i=(t=s.fields.tags.split(","))==null?void 0:t.map(C=>String(C||"").trim()))==null?void 0:i.filter(C=>C!=="")}}),p=async(t,i="")=>await B.post(x("addConsumer",i,t),{consumer:t}),b=async(t,i="")=>await B.delete(x("removeConsumer",i,t)),f=t=>{s.errorMessage=P(t),r("error",t)},k=(t=a.consumerGroupId)=>{Object.assign(V,s.fields),r("update",{...s.fields,id:t})},F=(t,i,C=a.consumerGroupId)=>{const l=t==null?void 0:t.find(u=>u.status!=="fulfilled");l?f({code:l.status,message:i}):k(C)},$=async()=>{let t="";try{const{data:i}=await B.post(x("create"),T.value);t="item"in i?i.item.id:i.id}catch(i){f(i)}if(s.fields.consumers.length>0&&t)try{const i=s.fields.consumers.map(l=>p(l,t)),C=await Promise.allSettled(i);F(C,g("consumer_groups.errors.add_consumer"),t)}catch(i){f(i)}else s.fields.consumers.length===0&&t&&k(t)},j=async()=>{var C;try{((C=a.config)==null?void 0:C.app)==="konnect"?await B.put(x("edit"),T.value):await B.patch(x("edit"),T.value)}catch(l){f(l)}const t=s.fields.consumers.filter(l=>!V.consumers.includes(l)),i=V.consumers.filter(l=>!s.fields.consumers.includes(l));if(i.length===0&&t.length===0)k();else{if(i.length>0)try{const l=i.map(I=>b(I)),u=await Promise.allSettled(l);F(u,g("consumer_groups.errors.remove_consumer"))}catch(l){f(l)}if(t.length>0)try{const l=t.map(I=>p(I)),u=await Promise.allSettled(l);F(u,g("consumer_groups.errors.add_consumer"))}catch(l){f(l)}}},X=async()=>{try{s.readonly=!0,oe.value===m.EntityBaseFormType.Create?await $():await j()}finally{s.readonly=!1}};return e.onBeforeMount(async()=>{a.hideConsumers||await ee()}),(t,i)=>{const C=e.resolveComponent("KInput"),l=e.resolveComponent("KMultiselect");return e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(e.unref(m.EntityBaseForm),{"can-submit":w.value&&O.value,config:o.config,"edit-id":o.consumerGroupId,"entity-type":e.unref(m.SupportedEntityType).ConsumerGroup,"error-message":s.errorMessage||e.unref(v)||z.value,"fetch-url":W.value,"form-fields":T.value,"is-readonly":s.readonly,onCancel:te,"onFetch:error":i[3]||(i[3]=u=>re(u)),"onFetch:success":M,onLoading:i[4]||(i[4]=u=>U(u)),onSubmit:X},{default:e.withCtx(()=>[e.createVNode(e.unref(m.EntityFormSection),{description:e.unref(g)("consumer_groups.form.general_info.description"),title:e.unref(g)("consumer_groups.form.general_info.title")},{default:e.withCtx(()=>[e.createVNode(C,{modelValue:s.fields.name,"onUpdate:modelValue":i[0]||(i[0]=u=>s.fields.name=u),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"consumer-group-form-name",label:e.unref(g)("consumer_groups.form.fields.name.label"),placeholder:e.unref(g)("consumer_groups.form.fields.name.placeholder"),required:"",type:"text"},null,8,["modelValue","label","placeholder"]),e.createVNode(C,{modelValue:s.fields.tags,"onUpdate:modelValue":i[1]||(i[1]=u=>s.fields.tags=u),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"consumer-group-form-tags",help:e.unref(g)("consumer_groups.form.fields.tags.help"),label:e.unref(g)("consumer_groups.form.fields.tags.label"),"label-attributes":{info:e.unref(g)("consumer_groups.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:e.unref(g)("consumer_groups.form.fields.tags.placeholder"),type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder"])]),_:1},8,["description","title"]),o.hideConsumers?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(m.EntityFormSection),{key:0,description:e.unref(g)("consumer_groups.form.consumers.description"),"has-divider":"",title:e.unref(g)("consumer_groups.form.consumers.title")},{default:e.withCtx(()=>[e.createVNode(l,{modelValue:s.fields.consumers,"onUpdate:modelValue":i[2]||(i[2]=u=>s.fields.consumers=u),appearance:"select",autosuggest:"",items:J.value,label:e.unref(g)("consumer_groups.form.fields.consumers.label"),loading:e.unref(S),placeholder:e.unref(g)("consumer_groups.form.fields.consumers.placeholder"),width:"auto",onQueryChange:e.unref(Z)},{"item-template":e.withCtx(({item:u})=>{var I,K,_;return[e.createElementVNode("div",Te,[e.createElementVNode("div",De,e.toDisplayString(u.label),1),(I=u==null?void 0:u.data)!=null&&I.username&&((K=u==null?void 0:u.data)!=null&&K.custom_id)?(e.openBlock(),e.createElementBlock("div",Ae,e.toDisplayString((_=u==null?void 0:u.data)==null?void 0:_.custom_id),1)):e.createCommentVNode("",!0)])]}),_:1},8,["modelValue","items","label","loading","placeholder","onQueryChange"])]),_:1},8,["description","title"]))]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-831e62f1"]]),Ge={class:"kong-ui-consumer-group-entity-config-card"},Se=e.defineComponent({__name:"ConsumerGroupConfigCard",props:{config:{type:Object,required:!0,validator:o=>!(!o||!["konnect","kongManager"].includes(o==null?void 0:o.app)||o.app==="konnect"&&!o.controlPlaneId||o.app==="kongManager"&&typeof o.workspace!="string"||!o.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(o){const R=o,{i18n:{t:a}}=se.useI18n(),r=e.computed(()=>q.item[R.config.app]),g=e.ref({id:{},name:{},created_at:{},updated_at:{},tags:{tooltip:a("consumer_groups.form.fields.tags.tooltip")}});return(c,s)=>(e.openBlock(),e.createElementBlock("div",Ge,[e.createVNode(e.unref(m.EntityBaseConfigCard),{config:o.config,"config-card-doc":o.configCardDoc,"config-schema":g.value,"data-key":"consumer_group","entity-type":e.unref(m.SupportedEntityType).ConsumerGroup,"fetch-url":r.value,"hide-title":o.hideTitle,"onFetch:error":s[0]||(s[0]=V=>c.$emit("fetch:error",V)),"onFetch:success":s[1]||(s[1]=V=>c.$emit("fetch:success",V)),onLoading:s[2]||(s[2]=V=>c.$emit("loading",V))},null,8,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title"])]))}});N.ConsumerGroupConfigCard=Se,N.ConsumerGroupForm=Pe,N.ConsumerGroupList=Be,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-consumer-groups",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-consumer-groups.umd.js",
6
6
  "module": "./dist/entities-consumer-groups.es.js",
@@ -26,7 +26,7 @@
26
26
  "axios": "^1.15.2",
27
27
  "vue": ">= 3.3.13 < 4",
28
28
  "vue-router": "^4.6.4 || ^5.0.6",
29
- "@kong-ui-public/entities-shared": "^3.44.3",
29
+ "@kong-ui-public/entities-shared": "^3.44.4",
30
30
  "@kong-ui-public/i18n": "^2.4.6"
31
31
  },
32
32
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  "axios": "^1.15.2",
37
37
  "vue": "^3.5.33",
38
38
  "vue-router": "^5.0.6",
39
- "@kong-ui-public/entities-shared": "^3.44.3",
39
+ "@kong-ui-public/entities-shared": "^3.44.4",
40
40
  "@kong-ui-public/i18n": "^2.4.6"
41
41
  },
42
42
  "repository": {