@kong-ui-public/entities-consumer-groups 3.5.54 → 3.5.55

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,9 +1,9 @@
1
- import { defineComponent as ye, ref as _, computed as I, watch as Ie, resolveComponent as Q, openBlock as T, createBlock as me, unref as t, withCtx as v, createElementVNode as N, toDisplayString as G, createVNode as f, createElementBlock as W, Fragment as Re, renderList as Be, createCommentVNode as te, onBeforeMount as Te, Teleport as qe, withDirectives as Ne, createTextVNode as de, vShow as Oe, createSlots as je, reactive as Ge } from "vue";
2
- import { useRouter as Pe } from "vue-router";
3
- import { AddIcon as Le } from "@kong/icons";
4
- import { createI18n as Qe, i18nTComponent as Je } from "@kong-ui-public/i18n";
5
- import { useAxios as we, useDebouncedFilter as Ve, useFetcher as He, useDeleteUrlBuilder as ze, FetcherStatus as Ae, EntityBaseTable as We, EntityFilter as Xe, PermissionsWrapper as ve, TableTags as Ye, EntityDeleteModal as Ze, EntityTypes as eo, useErrors as oo, useValidators as so, EntityBaseFormType as ke, EntityBaseForm as ro, SupportedEntityType as Fe, EntityFormSection as Se, EntityBaseConfigCard as to } from "@kong-ui-public/entities-shared";
6
- const no = {
1
+ import { defineComponent as ye, ref as k, computed as I, watch as Ie, resolveComponent as L, openBlock as S, createBlock as ge, unref as r, withCtx as y, createElementVNode as q, toDisplayString as M, createVNode as f, createElementBlock as z, Fragment as De, renderList as Ke, createCommentVNode as se, onBeforeMount as Ge, Teleport as Ue, createTextVNode as pe, createSlots as Be, reactive as xe } from "vue";
2
+ import { useRouter as Ae } from "vue-router";
3
+ import { AddIcon as Re } from "@kong/icons";
4
+ import { createI18n as qe, i18nTComponent as Ne } from "@kong-ui-public/i18n";
5
+ import { useAxios as we, useDebouncedFilter as Se, useFetcher as Oe, useDeleteUrlBuilder as je, FetcherStatus as Le, EntityBaseTable as Qe, EntityFilter as Je, PermissionsWrapper as ve, TableTags as He, EntityDeleteModal as ze, EntityTypes as We, useErrors as Xe, useValidators as Ye, EntityBaseFormType as ke, EntityBaseForm as Ze, SupportedEntityType as Pe, EntityFormSection as Me, EntityBaseConfigCard as eo } from "@kong-ui-public/entities-shared";
6
+ const oo = {
7
7
  list: {
8
8
  table_headers: {
9
9
  name: "Name",
@@ -92,20 +92,20 @@ const no = {
92
92
  }
93
93
  }
94
94
  }
95
- }, ao = {
96
- consumer_groups: no
95
+ }, to = {
96
+ consumer_groups: oo
97
97
  };
98
- function uo() {
99
- const e = Qe("en-us", ao);
98
+ function so() {
99
+ const e = qe("en-us", to);
100
100
  return {
101
101
  i18n: e,
102
- i18nT: Je(e)
102
+ i18nT: Ne(e)
103
103
  // Translation component <i18n-t>
104
104
  };
105
105
  }
106
106
  const he = {
107
- useI18n: uo
108
- }, B = "/v2/control-planes/{controlPlaneId}/core-entities", q = "/{workspace}", X = {
107
+ useI18n: so
108
+ }, B = "/v2/control-planes/{controlPlaneId}/core-entities", R = "/{workspace}", W = {
109
109
  list: {
110
110
  konnect: {
111
111
  all: `${B}/consumer_groups`,
@@ -114,11 +114,11 @@ const he = {
114
114
  oneForConsumer: `${B}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`
115
115
  },
116
116
  kongManager: {
117
- all: `${q}/consumer_groups?counter=true`,
117
+ all: `${R}/consumer_groups?counter=true`,
118
118
  // we need counter=true to get consumers_count in consumer group list
119
- forModal: `${q}/consumer_groups`,
120
- forConsumer: `${q}/consumers/{consumerId}/consumer_groups`,
121
- oneForConsumer: `${q}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`
119
+ forModal: `${R}/consumer_groups`,
120
+ forConsumer: `${R}/consumers/{consumerId}/consumer_groups`,
121
+ oneForConsumer: `${R}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`
122
122
  }
123
123
  },
124
124
  form: {
@@ -131,18 +131,18 @@ const he = {
131
131
  getConsumers: `${B}/consumer_groups/{id}/consumers`
132
132
  },
133
133
  kongManager: {
134
- consumersList: `${q}/consumers`,
135
- create: `${q}/consumer_groups`,
136
- edit: `${q}/consumer_groups/{id}`,
137
- addConsumer: `${q}/consumer_groups/{id}/consumers`,
138
- removeConsumer: `${q}/consumer_groups/{id}/consumers/{consumerId}`,
139
- getConsumers: `${q}/consumer_groups/{id}/consumers`
134
+ consumersList: `${R}/consumers`,
135
+ create: `${R}/consumer_groups`,
136
+ edit: `${R}/consumer_groups/{id}`,
137
+ addConsumer: `${R}/consumer_groups/{id}/consumers`,
138
+ removeConsumer: `${R}/consumer_groups/{id}/consumers/{consumerId}`,
139
+ getConsumers: `${R}/consumer_groups/{id}/consumers`
140
140
  }
141
141
  }
142
- }, lo = { class: "add-to-group-form-container" }, io = { class: "add-to-group-cta-text" }, co = {
142
+ }, ro = { class: "add-to-group-form-container" }, no = { class: "add-to-group-cta-text" }, ao = {
143
143
  key: 0,
144
144
  class: "kong-ui-entity-add-to-groups-error"
145
- }, mo = { key: 0 }, po = /* @__PURE__ */ ye({
145
+ }, uo = { key: 0 }, io = /* @__PURE__ */ ye({
146
146
  __name: "AddToGroupModal",
147
147
  props: {
148
148
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -158,130 +158,130 @@ const he = {
158
158
  }
159
159
  },
160
160
  emits: ["cancel", "add:success", "add:partial-success", "error"],
161
- setup(e, { emit: O }) {
162
- var L;
163
- const { i18n: { t: u } } = he.useI18n(), s = e, g = O, { axiosInstance: i } = we((L = s.config) == null ? void 0 : L.axiosRequestConfig), n = _([]), {
164
- debouncedQueryChange: $,
165
- loading: j,
166
- allRecords: A,
167
- error: ne,
168
- loadItems: ae,
169
- results: D
170
- } = Ve(
171
- s.config,
172
- X.list[s.config.app].forModal,
161
+ setup(e, { emit: N }) {
162
+ var j;
163
+ const { i18n: { t: u } } = he.useI18n(), t = e, g = N, { axiosInstance: l } = we((j = t.config) == null ? void 0 : j.axiosRequestConfig), n = k([]), {
164
+ debouncedQueryChange: E,
165
+ loading: O,
166
+ allRecords: G,
167
+ error: re,
168
+ loadItems: ne,
169
+ results: F
170
+ } = Se(
171
+ t.config,
172
+ W.list[t.config.app].forModal,
173
173
  "",
174
174
  {
175
175
  fetchedItemsKey: "data",
176
176
  searchKeys: ["name", "id"]
177
177
  }
178
- ), V = I(() => ne.value ? u("consumer_groups.errors.general") : ""), ue = _(0), Y = I(() => A.value === void 0), K = I(() => D.value.map((m) => ({
178
+ ), T = I(() => re.value ? u("consumer_groups.errors.general") : ""), ae = k(0), X = I(() => G.value === void 0), D = I(() => F.value.map((m) => ({
179
179
  label: m.name,
180
180
  value: m.id,
181
181
  selected: n.value.includes(m.id),
182
182
  data: m
183
183
  // we need this to determine whether or not to show the description text
184
- }))), oe = (m) => {
184
+ }))), Z = (m) => {
185
185
  var d;
186
- const k = Y.value ? D.value.find((y) => y.id === m) : (d = A.value) == null ? void 0 : d.find((y) => y.id === m);
187
- return k ? k.name : m;
188
- }, le = () => {
189
- E.value = "", U.value = [], P.value = [], g("cancel");
190
- }, U = _([]), J = _(!1), E = _(""), ie = async () => {
186
+ const v = X.value ? F.value.find((h) => h.id === m) : (d = G.value) == null ? void 0 : d.find((h) => h.id === m);
187
+ return v ? v.name : m;
188
+ }, ue = () => {
189
+ x.value = "", K.value = [], P.value = [], g("cancel");
190
+ }, K = k([]), Q = k(!1), x = k(""), ie = async () => {
191
191
  if (!n.value.length) {
192
- E.value = "", P.value = [], g("cancel");
192
+ x.value = "", P.value = [], g("cancel");
193
193
  return;
194
194
  }
195
- J.value = !0, E.value = "", U.value = [], P.value = [];
195
+ Q.value = !0, x.value = "", K.value = [], P.value = [];
196
196
  try {
197
- const m = n.value.map((y) => Z(y)), k = await Promise.allSettled(m);
197
+ const m = n.value.map((h) => le(h)), v = await Promise.allSettled(m);
198
198
  let d = !0;
199
- k.forEach((y) => {
200
- y.status !== "fulfilled" && (d = !1);
201
- }), d ? (U.value = [], P.value = [], g("add:success", n.value), n.value = []) : (U.value.length && g("add:partial-success", U.value), n.value = [], se(k));
199
+ v.forEach((h) => {
200
+ h.status !== "fulfilled" && (d = !1);
201
+ }), d ? (K.value = [], P.value = [], g("add:success", n.value), n.value = []) : (K.value.length && g("add:partial-success", K.value), n.value = [], ee(v));
202
202
  } catch {
203
- E.value = u("consumer_groups.errors.add"), g("error", E.value);
203
+ x.value = u("consumer_groups.errors.add"), g("error", x.value);
204
204
  } finally {
205
- J.value = !1;
205
+ Q.value = !1;
206
206
  }
207
- }, H = I(() => {
208
- var k, d, y, S;
209
- let m = `${s.config.apiBaseUrl}${X.list[s.config.app].forConsumer}`;
210
- return s.config.app === "konnect" ? m = m.replace(/{controlPlaneId}/gi, ((k = s.config) == null ? void 0 : k.controlPlaneId) || "").replace(/{consumerId}/gi, ((d = s.config) == null ? void 0 : d.consumerId) || "") : s.config.app === "kongManager" && (m = m.replace(/\/{workspace}/gi, (y = s.config) != null && y.workspace ? `/${s.config.workspace}` : "").replace(/{consumerId}/gi, ((S = s.config) == null ? void 0 : S.consumerId) || "")), m;
211
- }), Z = async (m) => {
212
- const k = {
207
+ }, J = I(() => {
208
+ var v, d, h, V;
209
+ let m = `${t.config.apiBaseUrl}${W.list[t.config.app].forConsumer}`;
210
+ return t.config.app === "konnect" ? m = m.replace(/{controlPlaneId}/gi, ((v = t.config) == null ? void 0 : v.controlPlaneId) || "").replace(/{consumerId}/gi, ((d = t.config) == null ? void 0 : d.consumerId) || "") : t.config.app === "kongManager" && (m = m.replace(/\/{workspace}/gi, (h = t.config) != null && h.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((V = t.config) == null ? void 0 : V.consumerId) || "")), m;
211
+ }), le = async (m) => {
212
+ const v = {
213
213
  group: m
214
214
  };
215
215
  try {
216
- const d = await i.post(H.value, k);
217
- return U.value.push(m), d;
216
+ const d = await l.post(J.value, v);
217
+ return K.value.push(m), d;
218
218
  } catch (d) {
219
- let y = `${oe(m)} - ${d.message}`;
220
- return d.response.status === 409 && (y = `${oe(m)} - ${u("consumer_groups.errors.already_added")}`), Promise.reject(Error(y));
219
+ let h = `${Z(m)} - ${d.message}`;
220
+ return d.response.status === 409 && (h = `${Z(m)} - ${u("consumer_groups.errors.already_added")}`), Promise.reject(Error(h));
221
221
  }
222
- }, P = _([]), se = (m) => {
223
- P.value = m.map((k) => {
222
+ }, P = k([]), ee = (m) => {
223
+ P.value = m.map((v) => {
224
224
  var d;
225
- return (d = k.reason) == null ? void 0 : d.message;
225
+ return (d = v.reason) == null ? void 0 : d.message;
226
226
  }).filter(Boolean);
227
227
  };
228
- return Ie(K, () => {
229
- ue.value++;
230
- }, { immediate: !0, deep: !0 }), Ie(() => s.visible, () => {
231
- s.visible && ae();
232
- }, { immediate: !0 }), (m, k) => {
233
- const d = Q("KMultiselect"), y = Q("KAlert"), S = Q("KPrompt");
234
- return T(), me(S, {
235
- "action-button-disabled": J.value,
228
+ return Ie(D, () => {
229
+ ae.value++;
230
+ }, { immediate: !0, deep: !0 }), Ie(() => t.visible, () => {
231
+ t.visible && ne();
232
+ }, { immediate: !0 }), (m, v) => {
233
+ const d = L("KMultiselect"), h = L("KAlert"), V = L("KPrompt");
234
+ return S(), ge(V, {
235
+ "action-button-disabled": Q.value,
236
236
  class: "kong-ui-entities-add-to-groups-modal",
237
237
  "data-testid": "add-to-group-modal",
238
- title: t(u)("consumer_groups.consumers.add.title"),
238
+ title: r(u)("consumer_groups.consumers.add.title"),
239
239
  visible: e.visible,
240
- onCancel: le,
240
+ onCancel: ue,
241
241
  onProceed: ie
242
242
  }, {
243
- default: v(() => [
244
- N("div", lo, [
245
- N("p", io, G(t(u)("consumer_groups.consumers.add.ctaText")), 1),
243
+ default: y(() => [
244
+ q("div", ro, [
245
+ q("p", no, M(r(u)("consumer_groups.consumers.add.ctaText")), 1),
246
246
  f(d, {
247
247
  modelValue: n.value,
248
- "onUpdate:modelValue": k[0] || (k[0] = (z) => n.value = z),
248
+ "onUpdate:modelValue": v[0] || (v[0] = (Y) => n.value = Y),
249
249
  autosuggest: "",
250
250
  "data-testid": "add-to-groups-multiselect",
251
- "dropdown-footer-text": Y.value ? t(u)("consumer_groups.consumers.add.footer") : void 0,
252
- items: K.value,
253
- label: t(u)("consumer_groups.consumers.add.consumer_groups_label"),
254
- loading: t(j),
255
- placeholder: t(u)("consumer_groups.consumers.add.consumer_group_placeholder"),
256
- readonly: J.value,
251
+ "dropdown-footer-text": X.value ? r(u)("consumer_groups.consumers.add.footer") : void 0,
252
+ items: D.value,
253
+ label: r(u)("consumer_groups.consumers.add.consumer_groups_label"),
254
+ loading: r(O),
255
+ placeholder: r(u)("consumer_groups.consumers.add.consumer_group_placeholder"),
256
+ readonly: Q.value,
257
257
  required: "",
258
258
  width: "100%",
259
- onQueryChange: t($)
259
+ onQueryChange: r(E)
260
260
  }, null, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
261
- E.value || V.value || P.value.length ? (T(), W("div", co, [
262
- f(y, { appearance: "danger" }, {
263
- default: v(() => [
264
- N("p", null, G(t(u)("consumer_groups.errors.add")), 1),
265
- P.value.length ? (T(), W("ul", mo, [
266
- (T(!0), W(Re, null, Be(P.value, (z, ce) => (T(), W("li", { key: ce }, G(z), 1))), 128))
267
- ])) : te("", !0),
268
- N("div", null, G(E.value || V.value), 1)
261
+ x.value || T.value || P.value.length ? (S(), z("div", ao, [
262
+ f(h, { appearance: "danger" }, {
263
+ default: y(() => [
264
+ q("p", null, M(r(u)("consumer_groups.errors.add")), 1),
265
+ P.value.length ? (S(), z("ul", uo, [
266
+ (S(!0), z(De, null, Ke(P.value, (Y, ce) => (S(), z("li", { key: ce }, M(Y), 1))), 128))
267
+ ])) : se("", !0),
268
+ q("div", null, M(x.value || T.value), 1)
269
269
  ]),
270
270
  _: 1
271
271
  })
272
- ])) : te("", !0)
272
+ ])) : se("", !0)
273
273
  ])
274
274
  ]),
275
275
  _: 1
276
276
  }, 8, ["action-button-disabled", "title", "visible"]);
277
277
  };
278
278
  }
279
- }), $e = (e, O) => {
279
+ }), $e = (e, N) => {
280
280
  const u = e.__vccOpts || e;
281
- for (const [s, g] of O)
282
- u[s] = g;
281
+ for (const [t, g] of N)
282
+ u[t] = g;
283
283
  return u;
284
- }, go = /* @__PURE__ */ $e(po, [["__scopeId", "data-v-4260ce03"]]), fo = { class: "kong-ui-entities-consumer-groups-list" }, vo = /* @__PURE__ */ ye({
284
+ }, lo = /* @__PURE__ */ $e(io, [["__scopeId", "data-v-4260ce03"]]), co = { class: "kong-ui-entities-consumer-groups-list" }, mo = /* @__PURE__ */ ye({
285
285
  __name: "ConsumerGroupList",
286
286
  props: {
287
287
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -326,274 +326,271 @@ const he = {
326
326
  }
327
327
  },
328
328
  emits: ["error", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
329
- setup(e, { emit: O }) {
330
- var Me;
331
- const u = O, s = e, { i18nT: g, i18n: { t: i } } = he.useI18n(), n = Pe(), { axiosInstance: $ } = we((Me = s.config) == null ? void 0 : Me.axiosRequestConfig), j = _(1), A = I(() => !!s.config.consumerId), ne = I(
332
- () => A.value ? "kong-ui-entities-consumer-groups-list-in-consumer-page" : "kong-ui-entities-consumer-groups-list"
333
- ), ae = I(() => s.config.app !== "kongManager" || !!s.config.disableSorting), D = {
329
+ setup(e, { emit: N }) {
330
+ var Ee;
331
+ const u = N, t = e, { i18nT: g, i18n: { t: l } } = he.useI18n(), n = Ae(), { axiosInstance: E } = we((Ee = t.config) == null ? void 0 : Ee.axiosRequestConfig), O = k(1), G = I(() => !!t.config.consumerId), re = I(
332
+ () => G.value ? "kong-ui-entities-consumer-groups-list-in-consumer-page" : "kong-ui-entities-consumer-groups-list"
333
+ ), ne = I(() => t.config.app !== "kongManager" || !!t.config.disableSorting), F = {
334
334
  // the Name column is non-hidable
335
- name: { label: i("consumer_groups.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 }
335
+ name: { label: l("consumer_groups.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 }
336
336
  };
337
- s.config.app === "kongManager" && (D.consumers_count = { label: i("consumer_groups.list.table_headers.consumers_count"), searchable: !1, sortable: !1 }), D.tags = { label: i("consumer_groups.list.table_headers.tags"), sortable: !1 };
338
- const V = D, ue = (r) => ({
339
- "data-testid": r.username ?? r.custom_id ?? r.id
340
- }), Y = I(() => {
341
- var p, C, w, F;
342
- let r = `${s.config.apiBaseUrl}${X.list[s.config.app][A.value ? "forConsumer" : "all"]}`;
343
- return s.config.app === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((p = s.config) == null ? void 0 : p.controlPlaneId) || "").replace(/{consumerId}/gi, ((C = s.config) == null ? void 0 : C.consumerId) || "") : s.config.app === "kongManager" && (r = r.replace(/\/{workspace}/gi, (w = s.config) != null && w.workspace ? `/${s.config.workspace}` : "").replace(/{consumerId}/gi, ((F = s.config) == null ? void 0 : F.consumerId) || "")), r;
344
- }), K = _(""), oe = I(() => {
345
- const r = s.config.app === "konnect" || s.config.isExactMatch;
346
- return r ? {
347
- isExactMatch: r,
337
+ t.config.app === "kongManager" && (F.consumers_count = { label: l("consumer_groups.list.table_headers.consumers_count"), searchable: !1, sortable: !1 }), F.tags = { label: l("consumer_groups.list.table_headers.tags"), sortable: !1 };
338
+ const T = F, ae = (s) => ({
339
+ "data-testid": s.username ?? s.custom_id ?? s.id
340
+ }), X = I(() => {
341
+ var p, b, w, H;
342
+ let s = `${t.config.apiBaseUrl}${W.list[t.config.app][G.value ? "forConsumer" : "all"]}`;
343
+ return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((p = t.config) == null ? void 0 : p.controlPlaneId) || "").replace(/{consumerId}/gi, ((b = t.config) == null ? void 0 : b.consumerId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, (w = t.config) != null && w.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((H = t.config) == null ? void 0 : H.consumerId) || "")), s;
344
+ }), D = k(""), Z = I(() => {
345
+ const s = t.config.app === "konnect" || t.config.isExactMatch;
346
+ return s ? {
347
+ isExactMatch: s,
348
348
  fields: {
349
- username: D.name,
350
- id: { label: i("consumer_groups.list.table_headers.id") }
349
+ username: F.name,
350
+ id: { label: l("consumer_groups.list.table_headers.id") }
351
351
  },
352
- placeholder: i("consumer_groups.search.placeholder")
352
+ placeholder: l("consumer_groups.search.placeholder")
353
353
  } : {
354
- isExactMatch: r,
354
+ isExactMatch: s,
355
355
  fields: {
356
- name: D.name
356
+ name: F.name
357
357
  },
358
- schema: s.config.filterSchema
358
+ schema: t.config.filterSchema
359
359
  };
360
- }), le = I(() => s.config.app === "konnect" && K.value ? "consumer_group" : A.value && !s.config.paginatedEndpoint ? "consumer_groups" : void 0), { fetcher: U, fetcherState: J } = He(s.config, Y.value, le), E = () => {
361
- K.value = "";
360
+ }), ue = I(() => t.config.app === "konnect" && D.value ? "consumer_group" : G.value && !t.config.paginatedEndpoint ? "consumer_groups" : void 0), { fetcher: K, fetcherState: Q } = Oe(t.config, X.value, ue), x = () => {
361
+ D.value = "";
362
362
  }, ie = () => {
363
- j.value++;
364
- }, H = _(null), Z = _(!1), P = (r, p) => {
365
- const C = r.id;
366
- if (!p(C)) {
363
+ O.value++;
364
+ }, J = k(null), le = (s, p) => {
365
+ const b = s.id;
366
+ if (!p(b)) {
367
367
  u("copy:error", {
368
- entity: r,
368
+ entity: s,
369
369
  field: "id",
370
- message: i("consumer_groups.errors.copy")
370
+ message: l("consumer_groups.errors.copy")
371
371
  });
372
372
  return;
373
373
  }
374
374
  u("copy:success", {
375
- entity: r,
375
+ entity: s,
376
376
  field: "id",
377
- message: i("consumer_groups.copy.success", { val: C })
377
+ message: l("consumer_groups.copy.success", { val: b })
378
378
  });
379
- }, se = (r, p) => {
380
- const C = JSON.stringify(r);
381
- if (!p(C)) {
379
+ }, P = (s, p) => {
380
+ const b = JSON.stringify(s);
381
+ if (!p(b)) {
382
382
  u("copy:error", {
383
- entity: r,
384
- message: i("consumer_groups.errors.copy")
383
+ entity: s,
384
+ message: l("consumer_groups.errors.copy")
385
385
  });
386
386
  return;
387
387
  }
388
388
  u("copy:success", {
389
- entity: r,
390
- message: i("consumer_groups.copy.success_brief")
389
+ entity: s,
390
+ message: l("consumer_groups.copy.success_brief")
391
391
  });
392
- }, L = async (r) => {
393
- var C;
394
- await ((C = s.canRetrieve) == null ? void 0 : C.call(s, r)) && n.push(s.config.getViewRoute(r.id));
395
- }, m = (r) => ({
396
- label: i("consumer_groups.actions.view"),
397
- to: s.config.getViewRoute(r)
398
- }), k = (r) => ({
399
- label: i("consumer_groups.actions.edit"),
400
- to: s.config.getEditRoute(r)
401
- }), d = _(void 0), y = _(!1), S = _(!1), z = _(""), ce = ze(s.config, Y.value), _e = (r) => {
402
- d.value = r, y.value = !0;
403
- }, pe = () => {
404
- y.value = !1;
405
- }, ge = async () => {
406
- var r, p, C;
407
- if ((r = d.value) != null && r.id) {
408
- S.value = !0;
392
+ }, ee = async (s) => {
393
+ var b;
394
+ await ((b = t.canRetrieve) == null ? void 0 : b.call(t, s)) && n.push(t.config.getViewRoute(s.id));
395
+ }, j = (s) => ({
396
+ label: l("consumer_groups.actions.view"),
397
+ to: t.config.getViewRoute(s)
398
+ }), m = (s) => ({
399
+ label: l("consumer_groups.actions.edit"),
400
+ to: t.config.getEditRoute(s)
401
+ }), v = k(void 0), d = k(!1), h = k(!1), V = k(""), Y = je(t.config, X.value), ce = (s) => {
402
+ v.value = s, d.value = !0;
403
+ }, _e = () => {
404
+ d.value = !1;
405
+ }, fe = async () => {
406
+ var s, p, b;
407
+ if ((s = v.value) != null && s.id) {
408
+ h.value = !0;
409
409
  try {
410
- await $.delete(ce(d.value.id)), S.value = !1, y.value = !1, j.value++, u("delete:success", d.value);
410
+ await E.delete(Y(v.value.id)), h.value = !1, d.value = !1, O.value++, u("delete:success", v.value);
411
411
  } catch (w) {
412
- z.value = ((C = (p = w.response) == null ? void 0 : p.data) == null ? void 0 : C.message) || w.message || i("consumer_groups.errors.delete"), u("error", w);
412
+ V.value = ((b = (p = w.response) == null ? void 0 : p.data) == null ? void 0 : b.message) || w.message || l("consumer_groups.errors.delete"), u("error", w);
413
413
  } finally {
414
- S.value = !1;
414
+ h.value = !1;
415
415
  }
416
416
  }
417
- }, re = _(!1), o = () => {
418
- re.value = !0;
419
- }, a = () => {
420
- re.value = !1;
421
- }, b = (r, p) => {
422
- p || a(), j.value++, u("add:success", r);
423
- }, c = () => {
424
- A.value && o();
425
- }, l = _(void 0), x = _(!1), R = _(""), M = (r) => {
426
- l.value = r, x.value = !0;
427
- }, ee = () => {
428
- x.value = !1, l.value = void 0;
429
- }, fe = I(() => {
430
- var p, C, w, F;
431
- let r = `${s.config.apiBaseUrl}${X.list[s.config.app].oneForConsumer}`;
432
- return s.config.app === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((p = s.config) == null ? void 0 : p.controlPlaneId) || "").replace(/{consumerId}/gi, ((C = s.config) == null ? void 0 : C.consumerId) || "") : s.config.app === "kongManager" && (r = r.replace(/\/{workspace}/gi, (w = s.config) != null && w.workspace ? `/${s.config.workspace}` : "").replace(/{consumerId}/gi, ((F = s.config) == null ? void 0 : F.consumerId) || "")), r;
433
- }), Ee = _(!1), De = async () => {
434
- if (l.value) {
435
- Ee.value = !0;
417
+ }, oe = k(!1), de = () => {
418
+ oe.value = !0;
419
+ }, o = () => {
420
+ oe.value = !1;
421
+ }, a = (s, p) => {
422
+ p || o(), O.value++, u("add:success", s);
423
+ }, C = () => {
424
+ G.value && de();
425
+ }, i = k(void 0), c = k(!1), A = k(""), U = (s) => {
426
+ i.value = s, c.value = !0;
427
+ }, $ = () => {
428
+ c.value = !1, i.value = void 0;
429
+ }, te = I(() => {
430
+ var p, b, w, H;
431
+ let s = `${t.config.apiBaseUrl}${W.list[t.config.app].oneForConsumer}`;
432
+ return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((p = t.config) == null ? void 0 : p.controlPlaneId) || "").replace(/{consumerId}/gi, ((b = t.config) == null ? void 0 : b.consumerId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, (w = t.config) != null && w.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, ((H = t.config) == null ? void 0 : H.consumerId) || "")), s;
433
+ }), me = k(!1), Te = async () => {
434
+ if (i.value) {
435
+ me.value = !0;
436
436
  try {
437
- const r = fe.value.replace(/{consumerGroupId}/gi, l.value.id);
438
- await $.delete(r), u("remove:success", l.value), ee(), j.value++;
439
- } catch (r) {
440
- R.value = r.message || i("consumer_groups.errors.delete"), u("error", r);
437
+ const s = te.value.replace(/{consumerGroupId}/gi, i.value.id);
438
+ await E.delete(s), u("remove:success", i.value), $(), O.value++;
439
+ } catch (s) {
440
+ A.value = s.message || l("consumer_groups.errors.delete"), u("error", s);
441
441
  } finally {
442
- Ee.value = !1;
442
+ me.value = !1;
443
443
  }
444
444
  }
445
- }, xe = _(!1);
446
- Ie(J, (r) => {
447
- var p, C, w, F;
448
- if (Array.isArray((p = r == null ? void 0 : r.response) == null ? void 0 : p.data) && (xe.value = r.response.data.length > 0), r.status === Ae.NoRecords ? Z.value = !0 : Z.value = !1, r.status === Ae.Error) {
449
- H.value = {
450
- title: i("consumer_groups.errors.general")
451
- }, (F = (w = (C = r.error) == null ? void 0 : C.response) == null ? void 0 : w.data) != null && F.message && (H.value.message = r.error.response.data.message), u("error", r.error);
445
+ };
446
+ Ie(Q, (s) => {
447
+ var p, b, w;
448
+ if (s.status === Le.Error) {
449
+ J.value = {
450
+ title: l("consumer_groups.errors.general")
451
+ }, (w = (b = (p = s.error) == null ? void 0 : p.response) == null ? void 0 : b.data) != null && w.message && (J.value.message = s.error.response.data.message), u("error", s.error);
452
452
  return;
453
453
  }
454
- H.value = null;
454
+ J.value = null;
455
455
  });
456
- const be = _({
457
- ctaPath: A.value ? void 0 : s.config.createRoute,
456
+ const be = k({
457
+ ctaPath: G.value ? void 0 : t.config.createRoute,
458
458
  ctaText: void 0,
459
- message: `${i("consumer_groups.list.empty_state.description")}${s.config.additionMessageForEmptyState ? ` ${s.config.additionMessageForEmptyState}` : ""}`,
460
- title: i("consumer_groups.title")
459
+ message: `${l("consumer_groups.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
460
+ title: l("consumer_groups.title")
461
461
  });
462
- return Te(async () => {
463
- await s.canCreate() && (be.value.title = A.value ? i("consumer_groups.list.empty_state.title_for_consumer") : i("consumer_groups.list.empty_state.title"), be.value.ctaText = A.value ? i("consumer_groups.actions.add_to_group") : i("consumer_groups.actions.create"));
464
- }), (r, p) => {
465
- const C = Q("KButton"), w = Q("KDropdownItem"), F = Q("KClipboardProvider"), Ke = Q("KPrompt");
466
- return T(), W("div", fo, [
467
- f(t(We), {
462
+ return Ge(async () => {
463
+ await t.canCreate() && (be.value.title = G.value ? l("consumer_groups.list.empty_state.title_for_consumer") : l("consumer_groups.list.empty_state.title"), be.value.ctaText = G.value ? l("consumer_groups.actions.add_to_group") : l("consumer_groups.actions.create"));
464
+ }), (s, p) => {
465
+ const b = L("KButton"), w = L("KDropdownItem"), H = L("KClipboardProvider"), Ve = L("KPrompt");
466
+ return S(), z("div", co, [
467
+ f(r(Qe), {
468
468
  "cache-identifier": e.cacheIdentifier,
469
- "disable-pagination": A.value && !e.config.paginatedEndpoint,
470
- "disable-sorting": ae.value,
469
+ "disable-pagination": G.value && !e.config.paginatedEndpoint,
470
+ "disable-sorting": ne.value,
471
471
  "empty-state-options": be.value,
472
472
  "enable-entity-actions": "",
473
- "error-message": H.value,
474
- fetcher: t(U),
475
- "fetcher-cache-key": j.value,
476
- "hide-toolbar": Z.value,
473
+ "error-message": J.value,
474
+ fetcher: r(K),
475
+ "fetcher-cache-key": O.value,
477
476
  "pagination-type": "offset",
478
- "preferences-storage-key": ne.value,
479
- query: K.value,
480
- "row-attributes": ue,
481
- "table-headers": t(V),
482
- onClearSearchInput: E,
483
- "onClick:row": p[2] || (p[2] = (h) => L(h)),
484
- onEmptyStateCtaClicked: c,
477
+ "preferences-storage-key": re.value,
478
+ query: D.value,
479
+ "row-attributes": ae,
480
+ "table-headers": r(T),
481
+ onClearSearchInput: x,
482
+ "onClick:row": p[2] || (p[2] = (_) => ee(_)),
483
+ onEmptyStateCtaClicked: C,
485
484
  onSort: ie
486
485
  }, {
487
- "toolbar-filter": v(() => [
488
- A.value ? te("", !0) : (T(), me(t(Xe), {
486
+ "toolbar-filter": y(() => [
487
+ G.value ? se("", !0) : (S(), ge(r(Je), {
489
488
  key: 0,
490
- modelValue: K.value,
491
- "onUpdate:modelValue": p[0] || (p[0] = (h) => K.value = h),
492
- config: oe.value
489
+ modelValue: D.value,
490
+ "onUpdate:modelValue": p[0] || (p[0] = (_) => D.value = _),
491
+ config: Z.value
493
492
  }, null, 8, ["modelValue", "config"]))
494
493
  ]),
495
- "toolbar-button": v(() => [
496
- (T(), me(qe, {
494
+ "toolbar-button": y(() => [
495
+ (S(), ge(Ue, {
497
496
  disabled: !e.useActionOutside,
498
497
  to: "#kong-ui-app-page-header-action-button"
499
498
  }, [
500
- f(t(ve), {
499
+ f(r(ve), {
501
500
  "auth-function": () => e.canCreate()
502
501
  }, {
503
- default: v(() => [
504
- Ne(f(C, {
502
+ default: y(() => [
503
+ f(b, {
505
504
  appearance: "primary",
506
505
  "data-testid": "toolbar-add-consumer-group",
507
506
  size: e.useActionOutside ? "medium" : "large",
508
507
  to: e.config.consumerId ? void 0 : e.config.createRoute,
509
- onClick: p[1] || (p[1] = () => e.config.consumerId ? o() : void 0)
508
+ onClick: p[1] || (p[1] = () => e.config.consumerId ? de() : void 0)
510
509
  }, {
511
- default: v(() => [
512
- f(t(Le)),
513
- de(" " + G(e.config.consumerId ? t(i)("consumer_groups.actions.add_to_group") : t(i)("consumer_groups.list.toolbar_actions.new_consumer_group")), 1)
510
+ default: y(() => [
511
+ f(r(Re)),
512
+ pe(" " + M(e.config.consumerId ? r(l)("consumer_groups.actions.add_to_group") : r(l)("consumer_groups.list.toolbar_actions.new_consumer_group")), 1)
514
513
  ]),
515
514
  _: 1
516
- }, 8, ["size", "to"]), [
517
- [Oe, xe.value]
518
- ])
515
+ }, 8, ["size", "to"])
519
516
  ]),
520
517
  _: 1
521
518
  }, 8, ["auth-function"])
522
519
  ], 8, ["disabled"]))
523
520
  ]),
524
- name: v(({ rowValue: h }) => [
525
- N("b", null, G(h ?? "-"), 1)
521
+ name: y(({ rowValue: _ }) => [
522
+ q("b", null, M(_ ?? "-"), 1)
526
523
  ]),
527
- consumers_count: v(({ rowValue: h }) => [
528
- de(G(h ?? "-"), 1)
524
+ consumers_count: y(({ rowValue: _ }) => [
525
+ pe(M(_ ?? "-"), 1)
529
526
  ]),
530
- tags: v(({ rowValue: h }) => [
531
- f(t(Ye), { tags: h }, null, 8, ["tags"])
527
+ tags: y(({ rowValue: _ }) => [
528
+ f(r(He), { tags: _ }, null, 8, ["tags"])
532
529
  ]),
533
- actions: v(({ row: h }) => [
534
- f(F, null, {
535
- default: v(({ copyToClipboard: Ce }) => [
530
+ actions: y(({ row: _ }) => [
531
+ f(H, null, {
532
+ default: y(({ copyToClipboard: Ce }) => [
536
533
  f(w, {
537
534
  "data-testid": "action-entity-copy-id",
538
- onClick: (Ue) => P(h, Ce)
535
+ onClick: (Fe) => le(_, Ce)
539
536
  }, {
540
- default: v(() => [
541
- de(G(t(i)("consumer_groups.actions.copy_id")), 1)
537
+ default: y(() => [
538
+ pe(M(r(l)("consumer_groups.actions.copy_id")), 1)
542
539
  ]),
543
540
  _: 2
544
541
  }, 1032, ["onClick"])
545
542
  ]),
546
543
  _: 2
547
544
  }, 1024),
548
- f(F, null, {
549
- default: v(({ copyToClipboard: Ce }) => [
545
+ f(H, null, {
546
+ default: y(({ copyToClipboard: Ce }) => [
550
547
  f(w, {
551
548
  "data-testid": "action-entity-copy-json",
552
- onClick: (Ue) => se(h, Ce)
549
+ onClick: (Fe) => P(_, Ce)
553
550
  }, {
554
- default: v(() => [
555
- de(G(t(i)("consumer_groups.actions.copy_json")), 1)
551
+ default: y(() => [
552
+ pe(M(r(l)("consumer_groups.actions.copy_json")), 1)
556
553
  ]),
557
554
  _: 2
558
555
  }, 1032, ["onClick"])
559
556
  ]),
560
557
  _: 2
561
558
  }, 1024),
562
- f(t(ve), {
563
- "auth-function": () => e.canRetrieve(h)
559
+ f(r(ve), {
560
+ "auth-function": () => e.canRetrieve(_)
564
561
  }, {
565
- default: v(() => [
562
+ default: y(() => [
566
563
  f(w, {
567
564
  "data-testid": "action-entity-view",
568
565
  "has-divider": "",
569
- item: m(h.id)
566
+ item: j(_.id)
570
567
  }, null, 8, ["item"])
571
568
  ]),
572
569
  _: 2
573
570
  }, 1032, ["auth-function"]),
574
- f(t(ve), {
575
- "auth-function": () => e.canEdit(h)
571
+ f(r(ve), {
572
+ "auth-function": () => e.canEdit(_)
576
573
  }, {
577
- default: v(() => [
574
+ default: y(() => [
578
575
  f(w, {
579
576
  "data-testid": "action-entity-edit",
580
- item: k(h.id)
577
+ item: m(_.id)
581
578
  }, null, 8, ["item"])
582
579
  ]),
583
580
  _: 2
584
581
  }, 1032, ["auth-function"]),
585
- f(t(ve), {
586
- "auth-function": () => e.canDelete(h)
582
+ f(r(ve), {
583
+ "auth-function": () => e.canDelete(_)
587
584
  }, {
588
- default: v(() => [
585
+ default: y(() => [
589
586
  f(w, {
590
587
  danger: "",
591
588
  "data-testid": "action-entity-delete",
592
589
  "has-divider": "",
593
- onClick: () => e.config.consumerId ? M(h) : _e(h)
590
+ onClick: () => e.config.consumerId ? U(_) : ce(_)
594
591
  }, {
595
- default: v(() => [
596
- de(G(e.config.consumerId ? t(i)("consumer_groups.actions.exit") : t(i)("consumer_groups.actions.delete")), 1)
592
+ default: y(() => [
593
+ pe(M(e.config.consumerId ? r(l)("consumer_groups.actions.exit") : r(l)("consumer_groups.actions.delete")), 1)
597
594
  ]),
598
595
  _: 2
599
596
  }, 1032, ["onClick"])
@@ -602,67 +599,67 @@ const he = {
602
599
  }, 1032, ["auth-function"])
603
600
  ]),
604
601
  _: 1
605
- }, 8, ["cache-identifier", "disable-pagination", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "hide-toolbar", "preferences-storage-key", "query", "table-headers"]),
606
- f(t(Ze), {
607
- "action-pending": S.value,
602
+ }, 8, ["cache-identifier", "disable-pagination", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "preferences-storage-key", "query", "table-headers"]),
603
+ f(r(ze), {
604
+ "action-pending": h.value,
608
605
  "data-testid": "delete-consumer-group-modal",
609
- description: t(i)("consumer_groups.delete.description"),
610
- "entity-name": d.value && (d.value.name || d.value.id),
611
- "entity-type": t(eo).ConsumerGroup,
612
- error: z.value,
613
- title: t(i)("consumer_groups.delete.title"),
614
- visible: y.value,
615
- onCancel: pe,
616
- onProceed: ge
606
+ description: r(l)("consumer_groups.delete.description"),
607
+ "entity-name": v.value && (v.value.name || v.value.id),
608
+ "entity-type": r(We).ConsumerGroup,
609
+ error: V.value,
610
+ title: r(l)("consumer_groups.delete.title"),
611
+ visible: d.value,
612
+ onCancel: _e,
613
+ onProceed: fe
617
614
  }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"]),
618
- e.config.consumerId ? (T(), me(go, {
615
+ e.config.consumerId ? (S(), ge(lo, {
619
616
  key: 0,
620
617
  config: e.config,
621
618
  "data-testid": "add-to-group-modal",
622
- visible: re.value,
623
- "onAdd:partialSuccess": p[3] || (p[3] = (h) => b(h, !0)),
624
- "onAdd:success": p[4] || (p[4] = (h) => b(h)),
625
- onCancel: a
626
- }, null, 8, ["config", "visible"])) : te("", !0),
627
- e.config.consumerId && l.value ? (T(), me(Ke, {
619
+ visible: oe.value,
620
+ "onAdd:partialSuccess": p[3] || (p[3] = (_) => a(_, !0)),
621
+ "onAdd:success": p[4] || (p[4] = (_) => a(_)),
622
+ onCancel: o
623
+ }, null, 8, ["config", "visible"])) : se("", !0),
624
+ e.config.consumerId && i.value ? (S(), ge(Ve, {
628
625
  key: 1,
629
626
  "action-button-appearance": "danger",
630
627
  "data-testid": "exit-group-modal",
631
- title: t(i)("consumer_groups.consumers.exit.title"),
632
- visible: x.value,
633
- onCancel: ee,
634
- onProceed: De
628
+ title: r(l)("consumer_groups.consumers.exit.title"),
629
+ visible: c.value,
630
+ onCancel: $,
631
+ onProceed: Te
635
632
  }, {
636
- default: v(() => [
637
- f(t(g), {
633
+ default: y(() => [
634
+ f(r(g), {
638
635
  class: "exit-modal-message",
639
636
  keypath: e.config.consumerUsername ? "consumer_groups.consumers.exit.confirmation" : "consumer_groups.consumers.exit.confirmationNoUsername",
640
637
  tag: "p"
641
- }, je({
642
- consumerGroup: v(() => [
643
- N("strong", null, G(l.value.name || l.value.id), 1)
638
+ }, Be({
639
+ consumerGroup: y(() => [
640
+ q("strong", null, M(i.value.name || i.value.id), 1)
644
641
  ]),
645
642
  _: 2
646
643
  }, [
647
644
  e.config.consumerUsername ? {
648
645
  name: "consumer",
649
- fn: v(() => [
650
- N("strong", null, G(e.config.consumerUsername), 1)
646
+ fn: y(() => [
647
+ q("strong", null, M(e.config.consumerUsername), 1)
651
648
  ]),
652
649
  key: "0"
653
650
  } : void 0
654
651
  ]), 1032, ["keypath"]),
655
- N("p", null, G(t(i)("consumer_groups.consumers.exit.description")), 1)
652
+ q("p", null, M(r(l)("consumer_groups.consumers.exit.description")), 1)
656
653
  ]),
657
654
  _: 1
658
- }, 8, ["title", "visible"])) : te("", !0)
655
+ }, 8, ["title", "visible"])) : se("", !0)
659
656
  ]);
660
657
  };
661
658
  }
662
- }), Mo = /* @__PURE__ */ $e(vo, [["__scopeId", "data-v-3c823a87"]]), yo = { class: "kong-ui-entities-consumer-group-form" }, ho = { class: "select-item-container" }, _o = { class: "select-item-label" }, bo = {
659
+ }), wo = /* @__PURE__ */ $e(mo, [["__scopeId", "data-v-7f3c37dc"]]), po = { class: "kong-ui-entities-consumer-group-form" }, go = { class: "select-item-container" }, fo = { class: "select-item-label" }, vo = {
663
660
  key: 0,
664
661
  class: "select-item-description"
665
- }, Co = /* @__PURE__ */ ye({
662
+ }, yo = /* @__PURE__ */ ye({
666
663
  __name: "ConsumerGroupForm",
667
664
  props: {
668
665
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -679,9 +676,9 @@ const he = {
679
676
  }
680
677
  },
681
678
  emits: ["update", "error", "loading"],
682
- setup(e, { emit: O }) {
683
- var pe, ge, re;
684
- const u = e, s = O, { i18n: { t: g } } = he.useI18n(), i = Pe(), n = Ge({
679
+ setup(e, { emit: N }) {
680
+ var fe, oe, de;
681
+ const u = e, t = N, { i18n: { t: g } } = he.useI18n(), l = Ae(), n = xe({
685
682
  fields: {
686
683
  name: "",
687
684
  tags: "",
@@ -689,197 +686,197 @@ const he = {
689
686
  },
690
687
  errorMessage: "",
691
688
  readonly: !1
692
- }), $ = Ge({
689
+ }), E = xe({
693
690
  name: "",
694
691
  tags: "",
695
692
  consumers: []
696
693
  }), {
697
- debouncedQueryChange: j,
698
- loading: A,
699
- error: ne,
700
- loadItems: ae,
701
- results: D
702
- } = Ve(u.config, (ge = X.form[(pe = u.config) == null ? void 0 : pe.app]) == null ? void 0 : ge.consumersList, "", {
694
+ debouncedQueryChange: O,
695
+ loading: G,
696
+ error: re,
697
+ loadItems: ne,
698
+ results: F
699
+ } = Se(u.config, (oe = W.form[(fe = u.config) == null ? void 0 : fe.app]) == null ? void 0 : oe.consumersList, "", {
703
700
  fetchedItemsKey: "data",
704
701
  searchKeys: ["username", "custom_id", "id"]
705
- }), { axiosInstance: V } = we((re = u.config) == null ? void 0 : re.axiosRequestConfig), { getMessageFromError: ue } = oo(), Y = so(), K = I(() => D.value.map((o) => ({
702
+ }), { axiosInstance: T } = we((de = u.config) == null ? void 0 : de.axiosRequestConfig), { getMessageFromError: ae } = Xe(), X = Ye(), D = I(() => F.value.map((o) => ({
706
703
  label: o.username || o.custom_id,
707
704
  value: o.id,
708
705
  selected: n.fields.consumers.includes(o.id),
709
706
  data: o
710
707
  // we need this to determine whether or not to show the description text
711
- }))), oe = I(() => {
708
+ }))), Z = I(() => {
712
709
  var o, a;
713
- return (a = X.form[(o = u.config) == null ? void 0 : o.app]) == null ? void 0 : a.edit;
714
- }), le = I(() => u.consumerGroupId ? ke.Edit : ke.Create), U = I(() => !!n.fields.name && !se.value), J = I(() => JSON.stringify(n.fields) !== JSON.stringify($)), E = (o, a = "", b = "") => {
715
- var l, x, R, M, ee, fe;
716
- let c = `${(l = u.config) == null ? void 0 : l.apiBaseUrl}${X.form[(x = u.config) == null ? void 0 : x.app][o]}`;
717
- return ((R = u.config) == null ? void 0 : R.app) === "konnect" ? c = c.replace(/{controlPlaneId}/gi, ((M = u.config) == null ? void 0 : M.controlPlaneId) || "") : ((ee = u.config) == null ? void 0 : ee.app) === "kongManager" && (c = c.replace(/\/{workspace}/gi, (fe = u.config) != null && fe.workspace ? `/${u.config.workspace}` : "")), c = c.replace(/{id}/gi, a || u.consumerGroupId), (o === "addConsumer" || o === "removeConsumer") && (c = c.replace(/{consumerId}/gi, b)), c;
710
+ return (a = W.form[(o = u.config) == null ? void 0 : o.app]) == null ? void 0 : a.edit;
711
+ }), ue = I(() => u.consumerGroupId ? ke.Edit : ke.Create), K = I(() => !!n.fields.name && !ee.value), Q = I(() => JSON.stringify(n.fields) !== JSON.stringify(E)), x = (o, a = "", C = "") => {
712
+ var c, A, U, $, te, me;
713
+ let i = `${(c = u.config) == null ? void 0 : c.apiBaseUrl}${W.form[(A = u.config) == null ? void 0 : A.app][o]}`;
714
+ return ((U = u.config) == null ? void 0 : U.app) === "konnect" ? i = i.replace(/{controlPlaneId}/gi, (($ = u.config) == null ? void 0 : $.controlPlaneId) || "") : ((te = u.config) == null ? void 0 : te.app) === "kongManager" && (i = i.replace(/\/{workspace}/gi, (me = u.config) != null && me.workspace ? `/${u.config.workspace}` : "")), i = i.replace(/{id}/gi, a || u.consumerGroupId), (o === "addConsumer" || o === "removeConsumer") && (i = i.replace(/{consumerId}/gi, C)), i;
718
715
  }, ie = () => {
719
716
  var o;
720
- i.push(((o = u.config) == null ? void 0 : o.cancelRoute) || { name: "consumer-group-list" });
721
- }, H = (o) => {
722
- s("error", o);
723
- }, Z = (o) => {
724
- s("loading", o);
717
+ l.push(((o = u.config) == null ? void 0 : o.cancelRoute) || { name: "consumer-group-list" });
718
+ }, J = (o) => {
719
+ t("error", o);
720
+ }, le = (o) => {
721
+ t("loading", o);
725
722
  }, P = async (o) => {
726
- var b, c, l, x, R;
727
- n.fields.name = ((b = o == null ? void 0 : o.item) == null ? void 0 : b.name) || ((c = o == null ? void 0 : o.consumer_group) == null ? void 0 : c.name) || (o == null ? void 0 : o.name) || "";
728
- const a = ((l = o == null ? void 0 : o.item) == null ? void 0 : l.tags) || (o == null ? void 0 : o.consumer_group.tags) || (o == null ? void 0 : o.tags) || [];
723
+ var C, i, c, A, U;
724
+ n.fields.name = ((C = o == null ? void 0 : o.item) == null ? void 0 : C.name) || ((i = o == null ? void 0 : o.consumer_group) == null ? void 0 : i.name) || (o == null ? void 0 : o.name) || "";
725
+ const a = ((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) || [];
729
726
  if (n.fields.tags = (a == null ? void 0 : a.join(", ")) || "", "consumers" in o)
730
- n.fields.consumers = ((x = o == null ? void 0 : o.consumers) == null ? void 0 : x.map((M) => M.id)) || [];
727
+ n.fields.consumers = ((A = o == null ? void 0 : o.consumers) == null ? void 0 : A.map(($) => $.id)) || [];
731
728
  else
732
729
  try {
733
- const { data: M } = await V.get(E("getConsumers"));
734
- n.fields.consumers = "consumers" in M ? (R = M == null ? void 0 : M.consumers) == null ? void 0 : R.map((ee) => ee.id) : [];
735
- } catch (M) {
736
- d(M);
730
+ const { data: $ } = await T.get(x("getConsumers"));
731
+ n.fields.consumers = "consumers" in $ ? (U = $ == null ? void 0 : $.consumers) == null ? void 0 : U.map((te) => te.id) : [];
732
+ } catch ($) {
733
+ d($);
737
734
  }
738
- Object.assign($, n.fields);
739
- }, se = I(() => Y.utf8Name(n.fields.name)), L = I(() => {
735
+ Object.assign(E, n.fields);
736
+ }, ee = I(() => X.utf8Name(n.fields.name)), j = I(() => {
740
737
  var o, a;
741
738
  return {
742
739
  name: n.fields.name,
743
- tags: (a = (o = n.fields.tags.split(",")) == null ? void 0 : o.map((b) => String(b || "").trim())) == null ? void 0 : a.filter((b) => b !== "")
740
+ tags: (a = (o = n.fields.tags.split(",")) == null ? void 0 : o.map((C) => String(C || "").trim())) == null ? void 0 : a.filter((C) => C !== "")
744
741
  };
745
- }), m = async (o, a = "") => await V.post(E("addConsumer", a, o), { consumer: o }), k = async (o, a = "") => await V.delete(E("removeConsumer", a, o)), d = (o) => {
746
- n.errorMessage = ue(o), s("error", o);
747
- }, y = (o = u.consumerGroupId) => {
748
- Object.assign($, n.fields), s("update", { ...n.fields, id: o });
749
- }, S = (o, a, b = u.consumerGroupId) => {
750
- const c = o == null ? void 0 : o.find((l) => l.status !== "fulfilled");
751
- c ? d({
752
- code: c.status,
742
+ }), m = async (o, a = "") => await T.post(x("addConsumer", a, o), { consumer: o }), v = async (o, a = "") => await T.delete(x("removeConsumer", a, o)), d = (o) => {
743
+ n.errorMessage = ae(o), t("error", o);
744
+ }, h = (o = u.consumerGroupId) => {
745
+ Object.assign(E, n.fields), t("update", { ...n.fields, id: o });
746
+ }, V = (o, a, C = u.consumerGroupId) => {
747
+ const i = o == null ? void 0 : o.find((c) => c.status !== "fulfilled");
748
+ i ? d({
749
+ code: i.status,
753
750
  message: a
754
- }) : y(b);
755
- }, z = async () => {
751
+ }) : h(C);
752
+ }, Y = async () => {
756
753
  let o = "";
757
754
  try {
758
- const { data: a } = await V.post(E("create"), L.value);
755
+ const { data: a } = await T.post(x("create"), j.value);
759
756
  o = "item" in a ? a.item.id : a.id;
760
757
  } catch (a) {
761
758
  d(a);
762
759
  }
763
760
  if (n.fields.consumers.length > 0 && o)
764
761
  try {
765
- const a = n.fields.consumers.map((c) => m(c, o)), b = await Promise.allSettled(a);
766
- S(b, g("consumer_groups.errors.add_consumer"), o);
762
+ const a = n.fields.consumers.map((i) => m(i, o)), C = await Promise.allSettled(a);
763
+ V(C, g("consumer_groups.errors.add_consumer"), o);
767
764
  } catch (a) {
768
765
  d(a);
769
766
  }
770
- else n.fields.consumers.length === 0 && o && y(o);
767
+ else n.fields.consumers.length === 0 && o && h(o);
771
768
  }, ce = async () => {
772
- var b;
769
+ var C;
773
770
  try {
774
- ((b = u.config) == null ? void 0 : b.app) === "konnect" ? await V.put(E("edit"), L.value) : await V.patch(E("edit"), L.value);
775
- } catch (c) {
776
- d(c);
771
+ ((C = u.config) == null ? void 0 : C.app) === "konnect" ? await T.put(x("edit"), j.value) : await T.patch(x("edit"), j.value);
772
+ } catch (i) {
773
+ d(i);
777
774
  }
778
- const o = n.fields.consumers.filter((c) => !$.consumers.includes(c)), a = $.consumers.filter((c) => !n.fields.consumers.includes(c));
775
+ const o = n.fields.consumers.filter((i) => !E.consumers.includes(i)), a = E.consumers.filter((i) => !n.fields.consumers.includes(i));
779
776
  if (a.length === 0 && o.length === 0)
780
- y();
777
+ h();
781
778
  else {
782
779
  if (a.length > 0)
783
780
  try {
784
- const c = a.map((x) => k(x)), l = await Promise.allSettled(c);
785
- S(l, g("consumer_groups.errors.remove_consumer"));
786
- } catch (c) {
787
- d(c);
781
+ const i = a.map((A) => v(A)), c = await Promise.allSettled(i);
782
+ V(c, g("consumer_groups.errors.remove_consumer"));
783
+ } catch (i) {
784
+ d(i);
788
785
  }
789
786
  if (o.length > 0)
790
787
  try {
791
- const c = o.map((x) => m(x)), l = await Promise.allSettled(c);
792
- S(l, g("consumer_groups.errors.add_consumer"));
793
- } catch (c) {
794
- d(c);
788
+ const i = o.map((A) => m(A)), c = await Promise.allSettled(i);
789
+ V(c, g("consumer_groups.errors.add_consumer"));
790
+ } catch (i) {
791
+ d(i);
795
792
  }
796
793
  }
797
794
  }, _e = async () => {
798
795
  try {
799
- n.readonly = !0, le.value === ke.Create ? await z() : await ce();
796
+ n.readonly = !0, ue.value === ke.Create ? await Y() : await ce();
800
797
  } finally {
801
798
  n.readonly = !1;
802
799
  }
803
800
  };
804
- return Te(async () => {
805
- await ae();
801
+ return Ge(async () => {
802
+ await ne();
806
803
  }), (o, a) => {
807
- const b = Q("KInput"), c = Q("KMultiselect");
808
- return T(), W("div", yo, [
809
- f(t(ro), {
810
- "can-submit": U.value && J.value,
804
+ const C = L("KInput"), i = L("KMultiselect");
805
+ return S(), z("div", po, [
806
+ f(r(Ze), {
807
+ "can-submit": K.value && Q.value,
811
808
  config: e.config,
812
809
  "edit-id": e.consumerGroupId,
813
- "entity-type": t(Fe).ConsumerGroup,
814
- "error-message": n.errorMessage || t(ne) || se.value,
815
- "fetch-url": oe.value,
816
- "form-fields": L.value,
810
+ "entity-type": r(Pe).ConsumerGroup,
811
+ "error-message": n.errorMessage || r(re) || ee.value,
812
+ "fetch-url": Z.value,
813
+ "form-fields": j.value,
817
814
  "is-readonly": n.readonly,
818
815
  onCancel: ie,
819
- "onFetch:error": a[3] || (a[3] = (l) => H(l)),
816
+ "onFetch:error": a[3] || (a[3] = (c) => J(c)),
820
817
  "onFetch:success": P,
821
- onLoading: a[4] || (a[4] = (l) => Z(l)),
818
+ onLoading: a[4] || (a[4] = (c) => le(c)),
822
819
  onSubmit: _e
823
820
  }, {
824
- default: v(() => [
825
- f(t(Se), {
826
- description: t(g)("consumer_groups.form.general_info.description"),
827
- title: t(g)("consumer_groups.form.general_info.title")
821
+ default: y(() => [
822
+ f(r(Me), {
823
+ description: r(g)("consumer_groups.form.general_info.description"),
824
+ title: r(g)("consumer_groups.form.general_info.title")
828
825
  }, {
829
- default: v(() => [
830
- f(b, {
826
+ default: y(() => [
827
+ f(C, {
831
828
  modelValue: n.fields.name,
832
- "onUpdate:modelValue": a[0] || (a[0] = (l) => n.fields.name = l),
829
+ "onUpdate:modelValue": a[0] || (a[0] = (c) => n.fields.name = c),
833
830
  modelModifiers: { trim: !0 },
834
831
  autocomplete: "off",
835
832
  "data-testid": "consumer-group-form-name",
836
- label: t(g)("consumer_groups.form.fields.name.label"),
837
- placeholder: t(g)("consumer_groups.form.fields.name.placeholder"),
833
+ label: r(g)("consumer_groups.form.fields.name.label"),
834
+ placeholder: r(g)("consumer_groups.form.fields.name.placeholder"),
838
835
  required: "",
839
836
  type: "text"
840
837
  }, null, 8, ["modelValue", "label", "placeholder"]),
841
- f(b, {
838
+ f(C, {
842
839
  modelValue: n.fields.tags,
843
- "onUpdate:modelValue": a[1] || (a[1] = (l) => n.fields.tags = l),
840
+ "onUpdate:modelValue": a[1] || (a[1] = (c) => n.fields.tags = c),
844
841
  modelModifiers: { trim: !0 },
845
842
  autocomplete: "off",
846
843
  "data-testid": "consumer-group-form-tags",
847
- help: t(g)("consumer_groups.form.fields.tags.help"),
848
- label: t(g)("consumer_groups.form.fields.tags.label"),
844
+ help: r(g)("consumer_groups.form.fields.tags.help"),
845
+ label: r(g)("consumer_groups.form.fields.tags.label"),
849
846
  "label-attributes": {
850
- info: t(g)("consumer_groups.form.fields.tags.tooltip"),
847
+ info: r(g)("consumer_groups.form.fields.tags.tooltip"),
851
848
  tooltipAttributes: { maxWidth: "400" }
852
849
  },
853
- placeholder: t(g)("consumer_groups.form.fields.tags.placeholder"),
850
+ placeholder: r(g)("consumer_groups.form.fields.tags.placeholder"),
854
851
  type: "text"
855
852
  }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder"])
856
853
  ]),
857
854
  _: 1
858
855
  }, 8, ["description", "title"]),
859
- f(t(Se), {
860
- description: t(g)("consumer_groups.form.consumers.description"),
856
+ f(r(Me), {
857
+ description: r(g)("consumer_groups.form.consumers.description"),
861
858
  "has-divider": "",
862
- title: t(g)("consumer_groups.form.consumers.title")
859
+ title: r(g)("consumer_groups.form.consumers.title")
863
860
  }, {
864
- default: v(() => [
865
- f(c, {
861
+ default: y(() => [
862
+ f(i, {
866
863
  modelValue: n.fields.consumers,
867
- "onUpdate:modelValue": a[2] || (a[2] = (l) => n.fields.consumers = l),
864
+ "onUpdate:modelValue": a[2] || (a[2] = (c) => n.fields.consumers = c),
868
865
  appearance: "select",
869
866
  autosuggest: "",
870
- items: K.value,
871
- label: t(g)("consumer_groups.form.fields.consumers.label"),
872
- loading: t(A),
873
- placeholder: t(g)("consumer_groups.form.fields.consumers.placeholder"),
867
+ items: D.value,
868
+ label: r(g)("consumer_groups.form.fields.consumers.label"),
869
+ loading: r(G),
870
+ placeholder: r(g)("consumer_groups.form.fields.consumers.placeholder"),
874
871
  width: "auto",
875
- onQueryChange: t(j)
872
+ onQueryChange: r(O)
876
873
  }, {
877
- "item-template": v(({ item: l }) => {
878
- var x, R, M;
874
+ "item-template": y(({ item: c }) => {
875
+ var A, U, $;
879
876
  return [
880
- N("div", ho, [
881
- N("div", _o, G(l.label), 1),
882
- (x = l == null ? void 0 : l.data) != null && x.username && ((R = l == null ? void 0 : l.data) != null && R.custom_id) ? (T(), W("div", bo, G((M = l == null ? void 0 : l.data) == null ? void 0 : M.custom_id), 1)) : te("", !0)
877
+ q("div", go, [
878
+ q("div", fo, M(c.label), 1),
879
+ (A = c == null ? void 0 : c.data) != null && A.username && ((U = c == null ? void 0 : c.data) != null && U.custom_id) ? (S(), z("div", vo, M(($ = c == null ? void 0 : c.data) == null ? void 0 : $.custom_id), 1)) : se("", !0)
883
880
  ])
884
881
  ];
885
882
  }),
@@ -894,7 +891,7 @@ const he = {
894
891
  ]);
895
892
  };
896
893
  }
897
- }), Go = /* @__PURE__ */ $e(Co, [["__scopeId", "data-v-dfa56d62"]]), ko = { class: "kong-ui-consumer-group-entity-config-card" }, Ao = /* @__PURE__ */ ye({
894
+ }), $o = /* @__PURE__ */ $e(yo, [["__scopeId", "data-v-dfa56d62"]]), ho = { class: "kong-ui-consumer-group-entity-config-card" }, Eo = /* @__PURE__ */ ye({
898
895
  __name: "ConsumerGroupConfigCard",
899
896
  props: {
900
897
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
@@ -921,7 +918,7 @@ const he = {
921
918
  },
922
919
  emits: ["loading", "fetch:error", "fetch:success"],
923
920
  setup(e) {
924
- const O = e, { i18n: { t: u } } = he.useI18n(), s = I(() => X.form[O.config.app].edit), g = _({
921
+ const N = e, { i18n: { t: u } } = he.useI18n(), t = I(() => W.form[N.config.app].edit), g = k({
925
922
  id: {},
926
923
  name: {},
927
924
  created_at: {},
@@ -930,24 +927,24 @@ const he = {
930
927
  tooltip: u("consumer_groups.form.fields.tags.tooltip")
931
928
  }
932
929
  });
933
- return (i, n) => (T(), W("div", ko, [
934
- f(t(to), {
930
+ return (l, n) => (S(), z("div", ho, [
931
+ f(r(eo), {
935
932
  config: e.config,
936
933
  "config-card-doc": e.configCardDoc,
937
934
  "config-schema": g.value,
938
935
  "data-key": "consumer_group",
939
- "entity-type": t(Fe).ConsumerGroup,
940
- "fetch-url": s.value,
936
+ "entity-type": r(Pe).ConsumerGroup,
937
+ "fetch-url": t.value,
941
938
  "hide-title": e.hideTitle,
942
- "onFetch:error": n[0] || (n[0] = ($) => i.$emit("fetch:error", $)),
943
- "onFetch:success": n[1] || (n[1] = ($) => i.$emit("fetch:success", $)),
944
- onLoading: n[2] || (n[2] = ($) => i.$emit("loading", $))
939
+ "onFetch:error": n[0] || (n[0] = (E) => l.$emit("fetch:error", E)),
940
+ "onFetch:success": n[1] || (n[1] = (E) => l.$emit("fetch:success", E)),
941
+ onLoading: n[2] || (n[2] = (E) => l.$emit("loading", E))
945
942
  }, null, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
946
943
  ]));
947
944
  }
948
945
  });
949
946
  export {
950
- Ao as ConsumerGroupConfigCard,
951
- Go as ConsumerGroupForm,
952
- Mo as ConsumerGroupList
947
+ Eo as ConsumerGroupConfigCard,
948
+ $o as ConsumerGroupForm,
949
+ wo as ConsumerGroupList
953
950
  };