@kong-ui-public/entities-consumer-groups 3.9.2-pr.2114.f471b8dbc.0 → 3.9.2-pr.2129.a56bab684.0

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