@kong-ui-public/entities-consumer-groups 4.0.3-pr.1994.98921f12a.0 → 4.0.3

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.
Files changed (28) hide show
  1. package/dist/entities-consumer-groups.es.js +1020 -0
  2. package/dist/entities-consumer-groups.umd.js +1 -0
  3. package/dist/style.css +1 -0
  4. package/dist/types/components/AddToGroupModal.vue.d.ts +39 -0
  5. package/dist/types/components/AddToGroupModal.vue.d.ts.map +1 -0
  6. package/dist/types/components/ConsumerGroupConfigCard.vue.d.ts +62 -0
  7. package/dist/types/components/ConsumerGroupConfigCard.vue.d.ts.map +1 -0
  8. package/dist/types/components/ConsumerGroupForm.vue.d.ts +52 -0
  9. package/dist/types/components/ConsumerGroupForm.vue.d.ts.map +1 -0
  10. package/dist/types/components/ConsumerGroupList.vue.d.ts +110 -0
  11. package/dist/types/components/ConsumerGroupList.vue.d.ts.map +1 -0
  12. package/dist/types/composables/index.d.ts +6 -0
  13. package/dist/types/composables/index.d.ts.map +1 -0
  14. package/dist/types/composables/useI18n.d.ts +9 -0
  15. package/dist/types/composables/useI18n.d.ts.map +1 -0
  16. package/dist/types/consumer-groups-endpoints.d.ts +36 -0
  17. package/dist/types/consumer-groups-endpoints.d.ts.map +1 -0
  18. package/dist/types/index.d.ts +6 -0
  19. package/dist/types/index.d.ts.map +1 -0
  20. package/dist/types/types/consumer-group-config-card.d.ts +15 -0
  21. package/dist/types/types/consumer-group-config-card.d.ts.map +1 -0
  22. package/dist/types/types/consumer-group-form.d.ts +37 -0
  23. package/dist/types/types/consumer-group-form.d.ts.map +1 -0
  24. package/dist/types/types/consumer-group-list.d.ts +39 -0
  25. package/dist/types/types/consumer-group-list.d.ts.map +1 -0
  26. package/dist/types/types/index.d.ts +4 -0
  27. package/dist/types/types/index.d.ts.map +1 -0
  28. package/package.json +5 -5
@@ -0,0 +1,1020 @@
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 = {
7
+ list: {
8
+ table_headers: {
9
+ name: "Name",
10
+ consumers_count: "Consumers",
11
+ tags: "Tags",
12
+ id: "ID"
13
+ },
14
+ empty_state: {
15
+ title: "Configure a New Consumer Group",
16
+ description: "Use consumer groups to manage custom rate limiting configuration for subsets of consumers.",
17
+ title_for_consumer: "Add to a consumer group"
18
+ },
19
+ empty_state_v2: {
20
+ title: "Configure your first consumer group",
21
+ group: "Consumer groups created in gateways within this group will automatically appear here.",
22
+ description: "Organize consumers into groups to easily apply policies like rate limiting and authentication across the entire group."
23
+ },
24
+ toolbar_actions: {
25
+ new_consumer_group: "New consumer group"
26
+ }
27
+ },
28
+ title: "Consumer Groups",
29
+ search: {
30
+ placeholder: "Filter by exact name or ID"
31
+ },
32
+ actions: {
33
+ add_to_group: "Add to consumer group",
34
+ create: "New consumer group",
35
+ copy_id: "Copy ID",
36
+ copy_json: "Copy JSON",
37
+ edit: "Edit",
38
+ delete: "Delete",
39
+ exit: "Exit",
40
+ view: "View Details"
41
+ },
42
+ delete: {
43
+ title: "Delete a Consumer Group",
44
+ description: "Deleting this group will remove all its plugins and rate limit configuration. This action cannot be reversed."
45
+ },
46
+ consumers: {
47
+ add: {
48
+ title: "Add To Consumer Groups",
49
+ ctaText: "Add this consumer to consumer groups",
50
+ consumer_groups_label: "Consumer Groups",
51
+ consumer_group_placeholder: "Add to consumer groups",
52
+ footer: "Search by exact name or ID to find consumer groups not included in the list"
53
+ },
54
+ exit: {
55
+ title: "Exit from a Consumer Group",
56
+ confirmation: "Are you sure you want to remove consumer {consumer} from consumer group {consumerGroup}?",
57
+ confirmationNoUsername: "Are you sure you want this consumer to exit from consumer group {consumerGroup}?",
58
+ description: "Exiting from the group could change the rate limit policy applied to this consumer."
59
+ }
60
+ },
61
+ errors: {
62
+ general: "Consumer Groups could not be retrieved",
63
+ delete: "The consumer group could not be deleted at this time.",
64
+ copy: "Failed to copy to clipboard",
65
+ add: "The consumer could not be added to some groups at this time.",
66
+ already_added: "The consumer is already in this consumer group",
67
+ add_consumer: "An unexpected error occurred while adding consumers. Please try again.",
68
+ remove_consumer: "An unexpected error occurred while removing consumers. Please try again."
69
+ },
70
+ copy: {
71
+ success: "Copied {val} to clipboard",
72
+ success_brief: "Successfully copied to clipboard"
73
+ },
74
+ form: {
75
+ general_info: {
76
+ title: "General Information",
77
+ description: "General information will help identify and manage this consumer group."
78
+ },
79
+ consumers: {
80
+ title: "Consumers",
81
+ description: "Add or remove consumers from this group"
82
+ },
83
+ fields: {
84
+ name: {
85
+ label: "Name",
86
+ placeholder: "Enter a unique name for this consumer group "
87
+ },
88
+ tags: {
89
+ label: "Tags",
90
+ placeholder: "Enter a list of tags separated by comma",
91
+ help: "e.g. tag1, tag2, tag3",
92
+ tooltip: "An optional set of strings for grouping and filtering, separated by commas."
93
+ },
94
+ consumers: {
95
+ label: "Consumers",
96
+ placeholder: "Select one or more consumers"
97
+ }
98
+ }
99
+ }
100
+ }, po = {
101
+ consumer_groups: mo
102
+ };
103
+ function go() {
104
+ const e = He("en-us", po);
105
+ return {
106
+ i18n: e,
107
+ i18nT: ze(e)
108
+ // Translation component <i18n-t>
109
+ };
110
+ }
111
+ const be = {
112
+ useI18n: go
113
+ }, O = "/v2/control-planes/{controlPlaneId}/core-entities", q = "/{workspace}", Z = {
114
+ list: {
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
124
+ forModal: `${q}/consumer_groups`,
125
+ forConsumer: `${q}/consumers/{consumerId}/consumer_groups`,
126
+ oneForConsumer: `${q}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`
127
+ }
128
+ },
129
+ form: {
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
+ consumersList: `${q}/consumers`,
140
+ create: `${q}/consumer_groups`,
141
+ edit: `${q}/consumer_groups/{id}`,
142
+ addConsumer: `${q}/consumer_groups/{id}/consumers`,
143
+ removeConsumer: `${q}/consumer_groups/{id}/consumers/{consumerId}`,
144
+ getConsumers: `${q}/consumer_groups/{id}/consumers`
145
+ }
146
+ }
147
+ }, fo = { class: "add-to-group-form-container" }, vo = { class: "add-to-group-cta-text" }, yo = {
148
+ key: 0,
149
+ class: "kong-ui-entity-add-to-groups-error"
150
+ }, ho = { key: 0 }, _o = /* @__PURE__ */ _e({
151
+ __name: "AddToGroupModal",
152
+ props: {
153
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
154
+ config: {
155
+ type: Object,
156
+ required: !0,
157
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || !e.consumerId)
158
+ },
159
+ visible: {
160
+ type: Boolean,
161
+ required: !0,
162
+ default: !1
163
+ }
164
+ },
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,
171
+ allRecords: D,
172
+ error: ie,
173
+ loadItems: ce,
174
+ results: Y
175
+ } = Ve(
176
+ t.config,
177
+ Z.list[t.config.app].forModal,
178
+ "",
179
+ {
180
+ fetchedItemsKey: "data",
181
+ searchKeys: ["name", "id"]
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
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 () => {
196
+ if (!n.value.length) {
197
+ M.value = "", V.value = [], v("cancel");
198
+ return;
199
+ }
200
+ Q.value = !0, M.value = "", $.value = [], V.value = [];
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));
207
+ } catch {
208
+ M.value = a("consumer_groups.errors.add"), v("error", M.value);
209
+ } finally {
210
+ Q.value = !1;
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
219
+ };
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));
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;
231
+ }).filter(Boolean);
232
+ };
233
+ return we(te, () => {
234
+ U.value++;
235
+ }, { immediate: !0, deep: !0 }), we(() => t.visible, () => {
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,
241
+ class: "kong-ui-entities-add-to-groups-modal",
242
+ "data-testid": "add-to-group-modal",
243
+ title: s(a)("consumer_groups.consumers.add.title"),
244
+ visible: e.visible,
245
+ onCancel: le,
246
+ onProceed: de
247
+ }, {
248
+ default: p(() => [
249
+ K("div", fo, [
250
+ K("p", vo, G(s(a)("consumer_groups.consumers.add.ctaText")), 1),
251
+ f(g, {
252
+ modelValue: n.value,
253
+ "onUpdate:modelValue": I[0] || (I[0] = (T) => n.value = T),
254
+ autosuggest: "",
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,
258
+ label: s(a)("consumer_groups.consumers.add.consumer_groups_label"),
259
+ loading: s(ue),
260
+ placeholder: s(a)("consumer_groups.consumers.add.consumer_group_placeholder"),
261
+ readonly: Q.value,
262
+ required: "",
263
+ width: "100%",
264
+ onQueryChange: s(x)
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" }, {
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)
274
+ ]),
275
+ _: 1
276
+ })
277
+ ])) : X("", !0)
278
+ ])
279
+ ]),
280
+ _: 1
281
+ }, 8, ["action-button-disabled", "title", "visible"]);
282
+ };
283
+ }
284
+ }), Ee = (e, N) => {
285
+ const a = e.__vccOpts || e;
286
+ for (const [t, v] of N)
287
+ a[t] = v;
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({
290
+ __name: "ConsumerGroupList",
291
+ props: {
292
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
293
+ config: {
294
+ type: Object,
295
+ required: !0,
296
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || !e.createRoute || !e.getViewRoute || !e.getEditRoute || e.app === "kongManager" && !e.isExactMatch && !e.filterSchema)
297
+ },
298
+ // used to override the default identifier for the cache entry
299
+ cacheIdentifier: {
300
+ type: String,
301
+ default: ""
302
+ },
303
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
304
+ canCreate: {
305
+ type: Function,
306
+ required: !1,
307
+ default: async () => !0
308
+ },
309
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
310
+ canDelete: {
311
+ type: Function,
312
+ required: !1,
313
+ default: async () => !0
314
+ },
315
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
316
+ canEdit: {
317
+ type: Function,
318
+ required: !1,
319
+ default: async () => !0
320
+ },
321
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
322
+ canRetrieve: {
323
+ type: Function,
324
+ required: !1,
325
+ default: async () => !0
326
+ },
327
+ /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
328
+ useActionOutside: {
329
+ type: Boolean,
330
+ default: !1
331
+ }
332
+ },
333
+ 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 = {
337
+ // the Name column is non-hidable
338
+ name: { label: i("consumer_groups.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 }
339
+ };
340
+ 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) => ({
342
+ "data-testid": r.username ?? r.custom_id ?? r.id
343
+ }), Y = () => {
344
+ 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(() => {
350
+ const r = t.config.app === "konnect" || t.config.isExactMatch;
351
+ return r ? {
352
+ isExactMatch: r,
353
+ fields: {
354
+ username: D.name,
355
+ id: { label: i("consumer_groups.list.table_headers.id") }
356
+ },
357
+ placeholder: i("consumer_groups.search.placeholder")
358
+ } : {
359
+ isExactMatch: r,
360
+ fields: {
361
+ name: D.name
362
+ },
363
+ schema: t.config.filterSchema
364
+ };
365
+ }), { hasRecords: te, handleStateChange: se } = Je(U), le = k(() => te.value && t.config.app === "konnect"), $ = k(() => !!t.config.consumerId), Q = k(
366
+ () => $.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)) {
378
+ a("copy:error", {
379
+ entity: r,
380
+ field: "id",
381
+ message: i("consumer_groups.errors.copy")
382
+ });
383
+ return;
384
+ }
385
+ a("copy:success", {
386
+ entity: r,
387
+ field: "id",
388
+ message: i("consumer_groups.copy.success", { val: b })
389
+ });
390
+ }, I = async (r, d) => {
391
+ const b = JSON.stringify(r);
392
+ if (!await d(b)) {
393
+ a("copy:error", {
394
+ entity: r,
395
+ message: i("consumer_groups.errors.copy")
396
+ });
397
+ return;
398
+ }
399
+ a("copy:success", {
400
+ entity: r,
401
+ message: i("consumer_groups.copy.success_brief")
402
+ });
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) => ({
407
+ label: i("consumer_groups.actions.view"),
408
+ to: t.config.getViewRoute(r)
409
+ }), B = (r) => ({
410
+ label: i("consumer_groups.actions.edit"),
411
+ 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
+ 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);
424
+ } finally {
425
+ ne.value = !1;
426
+ }
427
+ }
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 = () => {
435
+ $.value && c();
436
+ }, h = w(void 0), z = w(!1), ve = w(""), Ke = (r) => {
437
+ h.value = r, z.value = !0;
438
+ }, 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) {
446
+ Me.value = !0;
447
+ 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++;
450
+ } catch (r) {
451
+ ve.value = r.message || i("consumer_groups.errors.delete"), a("error", r);
452
+ } finally {
453
+ Me.value = !1;
454
+ }
455
+ }
456
+ };
457
+ we(me, (r) => {
458
+ var d, b, E;
459
+ if (r.status === Ze.Error) {
460
+ F.value = {
461
+ 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);
463
+ return;
464
+ }
465
+ F.value = null;
466
+ });
467
+ const Ce = w({
468
+ ctaPath: $.value ? void 0 : t.config.createRoute,
469
+ ctaText: void 0,
470
+ message: `${i("consumer_groups.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
471
+ title: i("consumer_groups.title")
472
+ });
473
+ return Te(async () => {
474
+ 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), {
479
+ "cache-identifier": e.cacheIdentifier,
480
+ "disable-pagination": $.value && !e.config.paginatedEndpoint,
481
+ "disable-sorting": ue.value,
482
+ "empty-state-options": Ce.value,
483
+ "enable-entity-actions": "",
484
+ "error-message": F.value,
485
+ fetcher: s(de),
486
+ "fetcher-cache-key": s(j),
487
+ "pagination-type": "offset",
488
+ "preferences-storage-key": Q.value,
489
+ query: U.value,
490
+ "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,
496
+ onState: s(se)
497
+ }, ke({
498
+ "toolbar-filter": p(() => [
499
+ $.value ? X("", !0) : (A(), ee(s(eo), {
500
+ key: 0,
501
+ modelValue: U.value,
502
+ "onUpdate:modelValue": d[0] || (d[0] = (y) => U.value = y),
503
+ config: oe.value
504
+ }, null, 8, ["modelValue", "config"]))
505
+ ]),
506
+ "toolbar-button": p(() => [
507
+ (A(), ee(Ne, {
508
+ disabled: !e.useActionOutside,
509
+ to: "#kong-ui-app-page-header-action-button"
510
+ }, [
511
+ K("div", ko, [
512
+ le.value ? (A(), ee(b, {
513
+ key: 0,
514
+ appearance: "secondary",
515
+ class: "open-learning-hub",
516
+ "data-testid": "consumer-groups-learn-more-button",
517
+ icon: "",
518
+ onClick: d[1] || (d[1] = (y) => r.$emit("click:learn-more"))
519
+ }, {
520
+ default: p(() => [
521
+ f(s(je), { decorative: "" })
522
+ ]),
523
+ _: 1
524
+ })) : X("", !0),
525
+ f(s(he), {
526
+ "auth-function": () => e.canCreate()
527
+ }, {
528
+ default: p(() => [
529
+ f(b, {
530
+ appearance: "primary",
531
+ "data-testid": "toolbar-add-consumer-group",
532
+ size: e.useActionOutside ? "medium" : "large",
533
+ onClick: Y
534
+ }, {
535
+ 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)
538
+ ]),
539
+ _: 1
540
+ }, 8, ["size"])
541
+ ]),
542
+ _: 1
543
+ }, 8, ["auth-function"])
544
+ ])
545
+ ], 8, ["disabled"]))
546
+ ]),
547
+ name: p(({ rowValue: y }) => [
548
+ K("b", null, G(y ?? "-"), 1)
549
+ ]),
550
+ consumers_count: p(({ rowValue: y }) => [
551
+ ae(G(y ?? "-"), 1)
552
+ ]),
553
+ tags: p(({ rowValue: y }) => [
554
+ f(s(oo), { tags: y }, null, 8, ["tags"])
555
+ ]),
556
+ actions: p(({ row: y }) => [
557
+ f(J, null, {
558
+ default: p(({ copyToClipboard: ye }) => [
559
+ f(E, {
560
+ "data-testid": "action-entity-copy-id",
561
+ onClick: (Re) => m(y, ye)
562
+ }, {
563
+ default: p(() => [
564
+ ae(G(s(i)("consumer_groups.actions.copy_id")), 1)
565
+ ]),
566
+ _: 2
567
+ }, 1032, ["onClick"])
568
+ ]),
569
+ _: 2
570
+ }, 1024),
571
+ f(J, null, {
572
+ default: p(({ copyToClipboard: ye }) => [
573
+ f(E, {
574
+ "data-testid": "action-entity-copy-json",
575
+ onClick: (Re) => I(y, ye)
576
+ }, {
577
+ default: p(() => [
578
+ ae(G(s(i)("consumer_groups.actions.copy_json")), 1)
579
+ ]),
580
+ _: 2
581
+ }, 1032, ["onClick"])
582
+ ]),
583
+ _: 2
584
+ }, 1024),
585
+ f(s(he), {
586
+ "auth-function": () => e.canRetrieve(y)
587
+ }, {
588
+ default: p(() => [
589
+ f(E, {
590
+ "data-testid": "action-entity-view",
591
+ "has-divider": "",
592
+ item: C(y.id)
593
+ }, null, 8, ["item"])
594
+ ]),
595
+ _: 2
596
+ }, 1032, ["auth-function"]),
597
+ f(s(he), {
598
+ "auth-function": () => e.canEdit(y)
599
+ }, {
600
+ default: p(() => [
601
+ f(E, {
602
+ "data-testid": "action-entity-edit",
603
+ item: B(y.id)
604
+ }, null, 8, ["item"])
605
+ ]),
606
+ _: 2
607
+ }, 1032, ["auth-function"]),
608
+ f(s(he), {
609
+ "auth-function": () => e.canDelete(y)
610
+ }, {
611
+ default: p(() => [
612
+ f(E, {
613
+ danger: "",
614
+ "data-testid": "action-entity-delete",
615
+ "has-divider": "",
616
+ onClick: () => e.config.consumerId ? Ke(y) : fe(y)
617
+ }, {
618
+ default: p(() => [
619
+ ae(G(e.config.consumerId ? s(i)("consumer_groups.actions.exit") : s(i)("consumer_groups.actions.delete")), 1)
620
+ ]),
621
+ _: 2
622
+ }, 1032, ["onClick"])
623
+ ]),
624
+ _: 2
625
+ }, 1032, ["auth-function"])
626
+ ]),
627
+ _: 2
628
+ }, [
629
+ !U.value && e.config.app === "konnect" ? {
630
+ name: "empty-state",
631
+ fn: p(() => {
632
+ var y;
633
+ return [
634
+ f(s(to), {
635
+ "action-button-text": s(i)("consumer_groups.list.toolbar_actions.new_consumer_group"),
636
+ appearance: "secondary",
637
+ "can-create": () => e.canCreate(),
638
+ "data-testid": "consumer-groups-entity-empty-state",
639
+ description: s(i)("consumer_groups.list.empty_state_v2.description"),
640
+ "learn-more": e.config.app === "konnect",
641
+ 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"))
644
+ }, ke({
645
+ image: p(() => [
646
+ K("div", Io, [
647
+ f(s(Qe), {
648
+ color: s(co),
649
+ size: s(lo)
650
+ }, null, 8, ["color", "size"])
651
+ ])
652
+ ]),
653
+ _: 2
654
+ }, [
655
+ (y = e.config) != null && y.isControlPlaneGroup ? {
656
+ name: "message",
657
+ fn: p(() => [
658
+ ae(G(s(i)("consumer_groups.list.empty_state_v2.group")), 1)
659
+ ]),
660
+ key: "0"
661
+ } : void 0
662
+ ]), 1032, ["action-button-text", "can-create", "description", "learn-more", "title"])
663
+ ];
664
+ }),
665
+ key: "0"
666
+ } : void 0
667
+ ]), 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,
670
+ "data-testid": "delete-consumer-group-modal",
671
+ 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,
675
+ title: s(i)("consumer_groups.delete.title"),
676
+ visible: H.value,
677
+ onCancel: o,
678
+ onProceed: u
679
+ }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"]),
680
+ e.config.consumerId ? (A(), ee(bo, {
681
+ key: 0,
682
+ config: e.config,
683
+ "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, {
690
+ key: 1,
691
+ "action-button-appearance": "danger",
692
+ "data-testid": "exit-group-modal",
693
+ title: s(i)("consumer_groups.consumers.exit.title"),
694
+ visible: z.value,
695
+ onCancel: xe,
696
+ onProceed: De
697
+ }, {
698
+ default: p(() => [
699
+ f(s(v), {
700
+ class: "exit-modal-message",
701
+ keypath: e.config.consumerUsername ? "consumer_groups.consumers.exit.confirmation" : "consumer_groups.consumers.exit.confirmationNoUsername",
702
+ tag: "p"
703
+ }, ke({
704
+ consumerGroup: p(() => [
705
+ K("strong", null, G(h.value.name || h.value.id), 1)
706
+ ]),
707
+ _: 2
708
+ }, [
709
+ e.config.consumerUsername ? {
710
+ name: "consumer",
711
+ fn: p(() => [
712
+ K("strong", null, G(e.config.consumerUsername), 1)
713
+ ]),
714
+ key: "0"
715
+ } : void 0
716
+ ]), 1032, ["keypath"]),
717
+ K("p", null, G(s(i)("consumer_groups.consumers.exit.description")), 1)
718
+ ]),
719
+ _: 1
720
+ }, 8, ["title", "visible"])) : X("", !0)
721
+ ]);
722
+ };
723
+ }
724
+ }), Ko = /* @__PURE__ */ Ee(wo, [["__scopeId", "data-v-667ef6c9"]]), $o = { class: "kong-ui-entities-consumer-group-form" }, Eo = { class: "select-item-container" }, xo = { class: "select-item-label" }, Mo = {
725
+ key: 0,
726
+ class: "select-item-description"
727
+ }, Go = /* @__PURE__ */ _e({
728
+ __name: "ConsumerGroupForm",
729
+ props: {
730
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
731
+ config: {
732
+ type: Object,
733
+ required: !0,
734
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || (e == null ? void 0 : e.app) === "konnect" && !(e != null && e.controlPlaneId) || (e == null ? void 0 : e.app) === "kongManager" && typeof (e == null ? void 0 : e.workspace) != "string" || !(e != null && e.cancelRoute))
735
+ },
736
+ /** If a valid consumerGroupId is provided, it will put the form in Edit mode instead of Create */
737
+ consumerGroupId: {
738
+ type: String,
739
+ required: !1,
740
+ default: ""
741
+ },
742
+ hideConsumers: {
743
+ type: Boolean,
744
+ default: !1
745
+ }
746
+ },
747
+ 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({
751
+ fields: {
752
+ name: "",
753
+ tags: "",
754
+ consumers: []
755
+ },
756
+ errorMessage: "",
757
+ readonly: !1
758
+ }), x = Se({
759
+ name: "",
760
+ tags: "",
761
+ consumers: []
762
+ }), {
763
+ debouncedQueryChange: ue,
764
+ loading: D,
765
+ error: ie,
766
+ 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, "", {
769
+ fetchedItemsKey: "data",
770
+ 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) => ({
772
+ label: o.username || o.custom_id,
773
+ value: o.id,
774
+ selected: n.fields.consumers.includes(o.id),
775
+ data: o
776
+ // we need this to determine whether or not to show the description text
777
+ }))), se = k(() => {
778
+ 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 = () => {
785
+ var o;
786
+ i.push(((o = a.config) == null ? void 0 : o.cancelRoute) || { name: "consumer-group-list" });
787
+ }, me = (o) => {
788
+ t("error", o);
789
+ }, j = (o) => {
790
+ 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) || [];
795
+ 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)) || [];
797
+ else
798
+ 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);
803
+ }
804
+ Object.assign(x, n.fields);
805
+ }, re = k(() => oe.utf8Name(n.fields.name)), F = k(() => {
806
+ var o, u;
807
+ return {
808
+ name: n.fields.name,
809
+ tags: (u = (o = n.fields.tags.split(",")) == null ? void 0 : o.map((_) => String(_ || "").trim())) == null ? void 0 : u.filter((_) => _ !== "")
810
+ };
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,
819
+ message: u
820
+ }) : C(_);
821
+ }, T = async () => {
822
+ let o = "";
823
+ try {
824
+ const { data: u } = await P.post(M("create"), F.value);
825
+ o = "item" in u ? u.item.id : u.id;
826
+ } catch (u) {
827
+ g(u);
828
+ }
829
+ if (n.fields.consumers.length > 0 && o)
830
+ 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);
833
+ } catch (u) {
834
+ g(u);
835
+ }
836
+ else n.fields.consumers.length === 0 && o && C(o);
837
+ }, H = async () => {
838
+ var _;
839
+ 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);
843
+ }
844
+ const o = n.fields.consumers.filter((c) => !x.consumers.includes(c)), u = x.consumers.filter((c) => !n.fields.consumers.includes(c));
845
+ if (u.length === 0 && o.length === 0)
846
+ C();
847
+ else {
848
+ if (u.length > 0)
849
+ 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);
854
+ }
855
+ if (o.length > 0)
856
+ 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);
861
+ }
862
+ }
863
+ }, ne = async () => {
864
+ try {
865
+ n.readonly = !0, le.value === Ie.Create ? await T() : await H();
866
+ } finally {
867
+ n.readonly = !1;
868
+ }
869
+ };
870
+ return Te(async () => {
871
+ a.hideConsumers || await ce();
872
+ }), (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,
877
+ config: e.config,
878
+ "edit-id": e.consumerGroupId,
879
+ "entity-type": s(Fe).ConsumerGroup,
880
+ "error-message": n.errorMessage || s(ie) || re.value,
881
+ "fetch-url": se.value,
882
+ "form-fields": F.value,
883
+ "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)),
888
+ onSubmit: ne
889
+ }, {
890
+ default: p(() => [
891
+ f(s(Ae), {
892
+ description: s(v)("consumer_groups.form.general_info.description"),
893
+ title: s(v)("consumer_groups.form.general_info.title")
894
+ }, {
895
+ default: p(() => [
896
+ f(_, {
897
+ modelValue: n.fields.name,
898
+ "onUpdate:modelValue": u[0] || (u[0] = (l) => n.fields.name = l),
899
+ modelModifiers: { trim: !0 },
900
+ autocomplete: "off",
901
+ "data-testid": "consumer-group-form-name",
902
+ label: s(v)("consumer_groups.form.fields.name.label"),
903
+ placeholder: s(v)("consumer_groups.form.fields.name.placeholder"),
904
+ required: "",
905
+ type: "text"
906
+ }, null, 8, ["modelValue", "label", "placeholder"]),
907
+ f(_, {
908
+ modelValue: n.fields.tags,
909
+ "onUpdate:modelValue": u[1] || (u[1] = (l) => n.fields.tags = l),
910
+ modelModifiers: { trim: !0 },
911
+ autocomplete: "off",
912
+ "data-testid": "consumer-group-form-tags",
913
+ help: s(v)("consumer_groups.form.fields.tags.help"),
914
+ label: s(v)("consumer_groups.form.fields.tags.label"),
915
+ "label-attributes": {
916
+ info: s(v)("consumer_groups.form.fields.tags.tooltip"),
917
+ tooltipAttributes: { maxWidth: "400" }
918
+ },
919
+ placeholder: s(v)("consumer_groups.form.fields.tags.placeholder"),
920
+ type: "text"
921
+ }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder"])
922
+ ]),
923
+ _: 1
924
+ }, 8, ["description", "title"]),
925
+ e.hideConsumers ? X("", !0) : (A(), ee(s(Ae), {
926
+ key: 0,
927
+ description: s(v)("consumer_groups.form.consumers.description"),
928
+ "has-divider": "",
929
+ title: s(v)("consumer_groups.form.consumers.title")
930
+ }, {
931
+ default: p(() => [
932
+ f(c, {
933
+ modelValue: n.fields.consumers,
934
+ "onUpdate:modelValue": u[2] || (u[2] = (l) => n.fields.consumers = l),
935
+ appearance: "select",
936
+ autosuggest: "",
937
+ items: te.value,
938
+ label: s(v)("consumer_groups.form.fields.consumers.label"),
939
+ loading: s(D),
940
+ placeholder: s(v)("consumer_groups.form.fields.consumers.placeholder"),
941
+ width: "auto",
942
+ onQueryChange: s(ue)
943
+ }, {
944
+ "item-template": p(({ item: l }) => {
945
+ var S, R, h;
946
+ 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)
950
+ ])
951
+ ];
952
+ }),
953
+ _: 1
954
+ }, 8, ["modelValue", "items", "label", "loading", "placeholder", "onQueryChange"])
955
+ ]),
956
+ _: 1
957
+ }, 8, ["description", "title"]))
958
+ ]),
959
+ _: 1
960
+ }, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"])
961
+ ]);
962
+ };
963
+ }
964
+ }), Uo = /* @__PURE__ */ Ee(Go, [["__scopeId", "data-v-0487fbd2"]]), So = { class: "kong-ui-consumer-group-entity-config-card" }, Do = /* @__PURE__ */ _e({
965
+ __name: "ConsumerGroupConfigCard",
966
+ props: {
967
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
968
+ config: {
969
+ type: Object,
970
+ required: !0,
971
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || e.app === "konnect" && !e.controlPlaneId || e.app === "kongManager" && typeof e.workspace != "string" || !e.entityId)
972
+ },
973
+ /**
974
+ * External link for documentation that determines visibility of Documentation button
975
+ */
976
+ configCardDoc: {
977
+ type: String,
978
+ default: "",
979
+ required: !1
980
+ },
981
+ /**
982
+ * Control visibility of card title content
983
+ */
984
+ hideTitle: {
985
+ type: Boolean,
986
+ default: !1
987
+ }
988
+ },
989
+ emits: ["loading", "fetch:error", "fetch:success"],
990
+ setup(e) {
991
+ const N = e, { i18n: { t: a } } = be.useI18n(), t = k(() => Z.form[N.config.app].edit), v = w({
992
+ id: {},
993
+ name: {},
994
+ created_at: {},
995
+ updated_at: {},
996
+ tags: {
997
+ tooltip: a("consumer_groups.form.fields.tags.tooltip")
998
+ }
999
+ });
1000
+ return (i, n) => (A(), W("div", So, [
1001
+ f(s(io), {
1002
+ config: e.config,
1003
+ "config-card-doc": e.configCardDoc,
1004
+ "config-schema": v.value,
1005
+ "data-key": "consumer_group",
1006
+ "entity-type": s(Fe).ConsumerGroup,
1007
+ "fetch-url": t.value,
1008
+ "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))
1012
+ }, null, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
1013
+ ]));
1014
+ }
1015
+ });
1016
+ export {
1017
+ Do as ConsumerGroupConfigCard,
1018
+ Uo as ConsumerGroupForm,
1019
+ Ko as ConsumerGroupList
1020
+ };