@kong-ui-public/entities-consumer-groups 4.10.1-pr.4063.f9e4f8cdb.0 → 4.10.2
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,983 +1,970 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createI18n as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
learn_more: "Learn more"
|
|
24
|
-
},
|
|
25
|
-
toolbar_actions: { new_consumer_group: "New consumer group" }
|
|
26
|
-
},
|
|
27
|
-
title: "Consumer groups",
|
|
28
|
-
search: { placeholder: "Filter by exact name or ID" },
|
|
29
|
-
actions: {
|
|
30
|
-
add_to_group: "Add to consumer group",
|
|
31
|
-
create: "New consumer group",
|
|
32
|
-
copy_id: "Copy ID",
|
|
33
|
-
copy_json: "Copy JSON",
|
|
34
|
-
edit: "Edit",
|
|
35
|
-
delete: "Delete",
|
|
36
|
-
exit: "Exit",
|
|
37
|
-
view: "View details"
|
|
38
|
-
},
|
|
39
|
-
delete: {
|
|
40
|
-
title: "Delete a consumer group",
|
|
41
|
-
description: "Deleting this group will remove all its plugins and rate limit configuration. This action cannot be reversed."
|
|
42
|
-
},
|
|
43
|
-
consumers: {
|
|
44
|
-
add: {
|
|
45
|
-
title: "Add to consumer groups",
|
|
46
|
-
ctaText: "Add this consumer to consumer groups",
|
|
47
|
-
consumer_groups_label: "Consumer groups",
|
|
48
|
-
consumer_group_placeholder: "Add to consumer groups",
|
|
49
|
-
footer: "Search by exact name or ID to find consumer groups not included in the list"
|
|
50
|
-
},
|
|
51
|
-
exit: {
|
|
52
|
-
title: "Exit from a consumer group",
|
|
53
|
-
confirmation: "Are you sure you want to remove consumer {consumer} from consumer group {consumerGroup}?",
|
|
54
|
-
confirmationNoUsername: "Are you sure you want this consumer to exit from consumer group {consumerGroup}?",
|
|
55
|
-
description: "Exiting from the group could change the rate limit policy applied to this consumer."
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
errors: {
|
|
59
|
-
general: "Consumer groups could not be retrieved",
|
|
60
|
-
delete: "The consumer group could not be deleted at this time.",
|
|
61
|
-
copy: "Failed to copy to clipboard",
|
|
62
|
-
add: "The consumer could not be added to some groups at this time.",
|
|
63
|
-
already_added: "The consumer is already in this consumer group",
|
|
64
|
-
add_consumer: "An unexpected error occurred while adding consumers. Please try again.",
|
|
65
|
-
remove_consumer: "An unexpected error occurred while removing consumers. Please try again."
|
|
66
|
-
},
|
|
67
|
-
copy: {
|
|
68
|
-
success: "Copied {val} to clipboard",
|
|
69
|
-
success_brief: "Successfully copied to clipboard"
|
|
70
|
-
},
|
|
71
|
-
form: {
|
|
72
|
-
general_info: {
|
|
73
|
-
title: "General information",
|
|
74
|
-
description: "General information will help identify and manage this consumer group."
|
|
75
|
-
},
|
|
76
|
-
consumers: {
|
|
77
|
-
title: "Consumers",
|
|
78
|
-
description: "Add or remove consumers from this group"
|
|
79
|
-
},
|
|
80
|
-
fields: {
|
|
81
|
-
name: {
|
|
82
|
-
label: "Name",
|
|
83
|
-
placeholder: "Enter a unique name for this consumer group "
|
|
84
|
-
},
|
|
85
|
-
tags: {
|
|
86
|
-
label: "Tags",
|
|
87
|
-
placeholder: "Enter a list of tags separated by comma",
|
|
88
|
-
help: "e.g. tag1, tag2, tag3",
|
|
89
|
-
tooltip: "An optional set of strings for grouping and filtering, separated by commas."
|
|
90
|
-
},
|
|
91
|
-
consumers: {
|
|
92
|
-
label: "Consumers",
|
|
93
|
-
placeholder: "Select one or more consumers"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} };
|
|
98
|
-
// src/composables/useI18n.ts
|
|
99
|
-
function se() {
|
|
100
|
-
let e = z("en-us", U);
|
|
101
|
-
return {
|
|
102
|
-
i18n: e,
|
|
103
|
-
i18nT: B(e)
|
|
104
|
-
};
|
|
1
|
+
import { defineComponent as ce, ref as v, openBlock as w, createElementBlock as N, createVNode as l, unref as o, createSlots as me, withCtx as c, renderSlot as xe, computed as h, watch as _e, resolveComponent as K, createBlock as L, createElementVNode as V, toDisplayString as C, Fragment as Qe, renderList as He, createCommentVNode as O, onBeforeMount as Ve, createTextVNode as q, Teleport as Je, reactive as Ge } from "vue";
|
|
2
|
+
import { EntityConfigCardView as ze, SupportedEntityType as be, useAxios as Ce, useDebouncedFilter as Be, useManagedByColumn as We, useTableState as Xe, useFetcher as Ye, useDeleteUrlBuilder as Ze, FetcherStatus as eo, EntityBaseTable as oo, PermissionsWrapper as de, getManagedByLabel as to, TableTags as so, EntityFilter as ro, EntityDeleteModal as no, EntityTypes as ao, useErrors as io, useValidators as uo, EntityBaseFormType as he, EntityBaseForm as co, EntityFormSection as Te, EntityBaseConfigCard as lo } from "@kong-ui-public/entities-shared";
|
|
3
|
+
import { createI18n as mo, i18nTComponent as po } from "@kong-ui-public/i18n";
|
|
4
|
+
import { useRouter as Fe } from "vue-router";
|
|
5
|
+
import { BookIcon as Ae, AddIcon as Pe, TeamIcon as go } from "@kong/icons";
|
|
6
|
+
const fo = { list: { table_headers: { name: "Name", consumers_count: "Consumers", tags: "Tags", id: "ID" }, empty_state: { title: "Configure a new consumer group", description: "Use consumer groups to manage custom rate limiting configuration for subsets of consumers.", title_for_consumer: "Add to a consumer group" }, empty_state_v2: { title: "Configure your first consumer group", group: "Consumer groups created in gateways within this group will automatically appear here.", description: "Organize consumers into groups to easily apply policies like rate limiting and authentication across the entire group.", learn_more: "Learn more" }, toolbar_actions: { new_consumer_group: "New consumer group" } }, title: "Consumer groups", search: { placeholder: "Filter by exact name or ID" }, actions: { add_to_group: "Add to consumer group", create: "New consumer group", copy_id: "Copy ID", copy_json: "Copy JSON", edit: "Edit", delete: "Delete", exit: "Exit", view: "View details" }, delete: { title: "Delete a consumer group", description: "Deleting this group will remove all its plugins and rate limit configuration. This action cannot be reversed." }, consumers: { add: { title: "Add to consumer groups", ctaText: "Add this consumer to consumer groups", consumer_groups_label: "Consumer groups", consumer_group_placeholder: "Add to consumer groups", footer: "Search by exact name or ID to find consumer groups not included in the list" }, exit: { title: "Exit from a consumer group", confirmation: "Are you sure you want to remove consumer {consumer} from consumer group {consumerGroup}?", confirmationNoUsername: "Are you sure you want this consumer to exit from consumer group {consumerGroup}?", description: "Exiting from the group could change the rate limit policy applied to this consumer." } }, errors: { general: "Consumer groups could not be retrieved", delete: "The consumer group could not be deleted at this time.", copy: "Failed to copy to clipboard", add: "The consumer could not be added to some groups at this time.", already_added: "The consumer is already in this consumer group", add_consumer: "An unexpected error occurred while adding consumers. Please try again.", remove_consumer: "An unexpected error occurred while removing consumers. Please try again." }, copy: { success: "Copied {val} to clipboard", success_brief: "Successfully copied to clipboard" }, form: { general_info: { title: "General information", description: "General information will help identify and manage this consumer group." }, consumers: { title: "Consumers", description: "Add or remove consumers from this group" }, fields: { name: { label: "Name", placeholder: "Enter a unique name for this consumer group " }, tags: { label: "Tags", placeholder: "Enter a list of tags separated by comma", help: "e.g. tag1, tag2, tag3", tooltip: "An optional set of strings for grouping and filtering, separated by commas." }, consumers: { label: "Consumers", placeholder: "Select one or more consumers" } } } }, yo = {
|
|
7
|
+
consumer_groups: fo
|
|
8
|
+
};
|
|
9
|
+
function vo() {
|
|
10
|
+
const e = mo("en-us", yo);
|
|
11
|
+
return {
|
|
12
|
+
i18n: e,
|
|
13
|
+
i18nT: po(e)
|
|
14
|
+
// Translation component <i18n-t>
|
|
15
|
+
};
|
|
105
16
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
17
|
+
const le = {
|
|
18
|
+
useI18n: vo
|
|
19
|
+
}, Do = /* @__PURE__ */ ce({
|
|
20
|
+
__name: "ConsumerGroupConfigCardView",
|
|
21
|
+
props: {
|
|
22
|
+
record: { type: Object, required: !0 },
|
|
23
|
+
config: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: () => ({})
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Control visibility of card title content
|
|
29
|
+
*/
|
|
30
|
+
hideTitle: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup(e) {
|
|
36
|
+
const { i18n: { t: T } } = le.useI18n(), a = v({
|
|
37
|
+
id: {},
|
|
38
|
+
name: {},
|
|
39
|
+
created_at: {},
|
|
40
|
+
updated_at: {},
|
|
41
|
+
tags: {
|
|
42
|
+
tooltip: T("consumer_groups.form.fields.tags.tooltip")
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return (t, p) => (w(), N("div", null, [
|
|
46
|
+
l(o(ze), {
|
|
47
|
+
config: e.config,
|
|
48
|
+
"config-schema": a.value,
|
|
49
|
+
"entity-type": o(be).ConsumerGroup,
|
|
50
|
+
"hide-title": e.hideTitle,
|
|
51
|
+
record: e.record
|
|
52
|
+
}, me({ _: 2 }, [
|
|
53
|
+
t.$slots.title ? {
|
|
54
|
+
name: "title",
|
|
55
|
+
fn: c(() => [
|
|
56
|
+
xe(t.$slots, "title")
|
|
57
|
+
]),
|
|
58
|
+
key: "0"
|
|
59
|
+
} : void 0,
|
|
60
|
+
t.$slots.actions ? {
|
|
61
|
+
name: "actions",
|
|
62
|
+
fn: c(() => [
|
|
63
|
+
xe(t.$slots, "actions")
|
|
64
|
+
]),
|
|
65
|
+
key: "1"
|
|
66
|
+
} : void 0
|
|
67
|
+
]), 1032, ["config", "config-schema", "entity-type", "hide-title", "record"])
|
|
68
|
+
]));
|
|
69
|
+
}
|
|
70
|
+
}), A = "/v2/control-planes/{controlPlaneId}/core-entities/{workspace}", P = "/{workspace}", Q = {
|
|
71
|
+
list: {
|
|
72
|
+
konnect: {
|
|
73
|
+
all: `${A}/consumer_groups`,
|
|
74
|
+
forModal: `${A}/consumer_groups`,
|
|
75
|
+
forConsumer: `${A}/consumers/{consumerId}/consumer_groups`,
|
|
76
|
+
oneForConsumer: `${A}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`
|
|
77
|
+
},
|
|
78
|
+
kongManager: {
|
|
79
|
+
all: `${P}/consumer_groups?counter=true`,
|
|
80
|
+
// we need counter=true to get consumers_count in consumer group list
|
|
81
|
+
forModal: `${P}/consumer_groups`,
|
|
82
|
+
forConsumer: `${P}/consumers/{consumerId}/consumer_groups`,
|
|
83
|
+
oneForConsumer: `${P}/consumers/{consumerId}/consumer_groups/{consumerGroupId}`
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
form: {
|
|
87
|
+
konnect: {
|
|
88
|
+
consumersList: `${A}/consumers`,
|
|
89
|
+
create: `${A}/consumer_groups`,
|
|
90
|
+
edit: `${A}/consumer_groups/{id}`,
|
|
91
|
+
addConsumer: `${A}/consumer_groups/{id}/consumers`,
|
|
92
|
+
removeConsumer: `${A}/consumer_groups/{id}/consumers/{consumerId}`,
|
|
93
|
+
getConsumers: `${A}/consumer_groups/{id}/consumers`
|
|
94
|
+
},
|
|
95
|
+
kongManager: {
|
|
96
|
+
consumersList: `${P}/consumers`,
|
|
97
|
+
create: `${P}/consumer_groups`,
|
|
98
|
+
edit: `${P}/consumer_groups/{id}`,
|
|
99
|
+
addConsumer: `${P}/consumer_groups/{id}/consumers`,
|
|
100
|
+
removeConsumer: `${P}/consumer_groups/{id}/consumers/{consumerId}`,
|
|
101
|
+
getConsumers: `${P}/consumer_groups/{id}/consumers`
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
item: {
|
|
105
|
+
konnect: `${A}/consumer_groups/{id}?list_consumers=false`,
|
|
106
|
+
kongManager: `${P}/consumer_groups/{id}?list_consumers=false`
|
|
107
|
+
}
|
|
108
|
+
}, ho = { class: "add-to-group-form-container" }, _o = { class: "add-to-group-cta-text" }, bo = {
|
|
109
|
+
key: 0,
|
|
110
|
+
class: "kong-ui-entity-add-to-groups-error"
|
|
111
|
+
}, Co = { key: 0 }, ko = /* @__PURE__ */ ce({
|
|
112
|
+
__name: "AddToGroupModal",
|
|
113
|
+
props: {
|
|
114
|
+
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
115
|
+
config: {
|
|
116
|
+
type: Object,
|
|
117
|
+
required: !0,
|
|
118
|
+
validator: (e) => !(!e || !["konnect", "kongManager"].includes(e?.app) || !e.consumerId)
|
|
119
|
+
},
|
|
120
|
+
visible: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
required: !0
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
emits: ["cancel", "add:success", "add:partial-success", "error"],
|
|
126
|
+
setup(e, { emit: T }) {
|
|
127
|
+
const { i18n: { t: a } } = le.useI18n(), t = e, p = T, { axiosInstance: i } = Ce(t.config?.axiosRequestConfig), n = v([]), {
|
|
128
|
+
debouncedQueryChange: $,
|
|
129
|
+
loading: ee,
|
|
130
|
+
allRecords: B,
|
|
131
|
+
error: oe,
|
|
132
|
+
loadItems: te,
|
|
133
|
+
results: J
|
|
134
|
+
} = Be(
|
|
135
|
+
t.config,
|
|
136
|
+
Q.list[t.config.app].forModal,
|
|
137
|
+
"",
|
|
138
|
+
{
|
|
139
|
+
fetchedItemsKey: "data",
|
|
140
|
+
searchKeys: ["name", "id"]
|
|
141
|
+
}
|
|
142
|
+
), G = h(() => oe.value ? a("consumer_groups.errors.general") : ""), z = v(0), x = h(() => B.value === void 0), W = h(() => J.value.map((m) => ({
|
|
143
|
+
label: m.name,
|
|
144
|
+
value: m.id,
|
|
145
|
+
selected: n.value.includes(m.id),
|
|
146
|
+
data: m
|
|
147
|
+
// we need this to determine whether or not to show the description text
|
|
148
|
+
}))), X = (m) => {
|
|
149
|
+
const _ = x.value ? J.value.find((I) => I.id === m) : B.value?.find((I) => I.id === m);
|
|
150
|
+
return _ ? _.name : m;
|
|
151
|
+
}, se = () => {
|
|
152
|
+
M.value = "", F.value = [], S.value = [], p("cancel");
|
|
153
|
+
}, F = v([]), E = v(!1), M = v(""), re = async () => {
|
|
154
|
+
if (!n.value.length) {
|
|
155
|
+
M.value = "", S.value = [], p("cancel");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
E.value = !0, M.value = "", F.value = [], S.value = [];
|
|
159
|
+
try {
|
|
160
|
+
const m = n.value.map((k) => ae(k)), _ = await Promise.allSettled(m);
|
|
161
|
+
let I = !0;
|
|
162
|
+
_.forEach((k) => {
|
|
163
|
+
k.status !== "fulfilled" && (I = !1);
|
|
164
|
+
}), I ? (F.value = [], S.value = [], p("add:success", n.value), n.value = []) : (F.value.length && p("add:partial-success", F.value), n.value = [], Y(_));
|
|
165
|
+
} catch {
|
|
166
|
+
M.value = a("consumer_groups.errors.add"), p("error", M.value);
|
|
167
|
+
} finally {
|
|
168
|
+
E.value = !1;
|
|
169
|
+
}
|
|
170
|
+
}, ne = h(() => {
|
|
171
|
+
let m = `${t.config.apiBaseUrl}${Q.list[t.config.app].forConsumer}`;
|
|
172
|
+
return t.config.app === "konnect" && (m = m.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), m.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, t.config?.consumerId || "");
|
|
173
|
+
}), ae = async (m) => {
|
|
174
|
+
const _ = {
|
|
175
|
+
group: m
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
const I = await i.post(ne.value, _);
|
|
179
|
+
return F.value.push(m), I;
|
|
180
|
+
} catch (I) {
|
|
181
|
+
let k = `${X(m)} - ${I.message}`;
|
|
182
|
+
return I.response.status === 409 && (k = `${X(m)} - ${a("consumer_groups.errors.already_added")}`), Promise.reject(Error(k));
|
|
183
|
+
}
|
|
184
|
+
}, S = v([]), Y = (m) => {
|
|
185
|
+
S.value = m.map((_) => _.reason?.message).filter(Boolean);
|
|
186
|
+
};
|
|
187
|
+
return _e(W, () => {
|
|
188
|
+
z.value++;
|
|
189
|
+
}, { immediate: !0, deep: !0 }), _e(() => t.visible, () => {
|
|
190
|
+
t.visible && te();
|
|
191
|
+
}, { immediate: !0 }), (m, _) => {
|
|
192
|
+
const I = K("KMultiselect"), k = K("KAlert"), H = K("KPrompt");
|
|
193
|
+
return w(), L(H, {
|
|
194
|
+
"action-button-disabled": E.value,
|
|
195
|
+
class: "kong-ui-entities-add-to-groups-modal",
|
|
196
|
+
"data-testid": "add-to-group-modal",
|
|
197
|
+
title: o(a)("consumer_groups.consumers.add.title"),
|
|
198
|
+
visible: e.visible,
|
|
199
|
+
onCancel: se,
|
|
200
|
+
onProceed: re
|
|
201
|
+
}, {
|
|
202
|
+
default: c(() => [
|
|
203
|
+
V("div", ho, [
|
|
204
|
+
V("p", _o, C(o(a)("consumer_groups.consumers.add.ctaText")), 1),
|
|
205
|
+
l(I, {
|
|
206
|
+
modelValue: n.value,
|
|
207
|
+
"onUpdate:modelValue": _[0] || (_[0] = (D) => n.value = D),
|
|
208
|
+
autosuggest: "",
|
|
209
|
+
"data-testid": "add-to-groups-multiselect",
|
|
210
|
+
"dropdown-footer-text": x.value ? o(a)("consumer_groups.consumers.add.footer") : void 0,
|
|
211
|
+
items: W.value,
|
|
212
|
+
label: o(a)("consumer_groups.consumers.add.consumer_groups_label"),
|
|
213
|
+
loading: o(ee),
|
|
214
|
+
placeholder: o(a)("consumer_groups.consumers.add.consumer_group_placeholder"),
|
|
215
|
+
readonly: E.value,
|
|
216
|
+
required: "",
|
|
217
|
+
width: "100%",
|
|
218
|
+
onQueryChange: o($)
|
|
219
|
+
}, null, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
|
|
220
|
+
M.value || G.value || S.value.length ? (w(), N("div", bo, [
|
|
221
|
+
l(k, { appearance: "danger" }, {
|
|
222
|
+
default: c(() => [
|
|
223
|
+
V("p", null, C(o(a)("consumer_groups.errors.add")), 1),
|
|
224
|
+
S.value.length ? (w(), N("ul", Co, [
|
|
225
|
+
(w(!0), N(Qe, null, He(S.value, (D, ie) => (w(), N("li", { key: ie }, C(D), 1))), 128))
|
|
226
|
+
])) : O("", !0),
|
|
227
|
+
V("div", null, C(M.value || G.value), 1)
|
|
228
|
+
]),
|
|
229
|
+
_: 1
|
|
230
|
+
})
|
|
231
|
+
])) : O("", !0)
|
|
232
|
+
])
|
|
233
|
+
]),
|
|
234
|
+
_: 1
|
|
235
|
+
}, 8, ["action-button-disabled", "title", "visible"]);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}), ke = (e, T) => {
|
|
239
|
+
const a = e.__vccOpts || e;
|
|
240
|
+
for (const [t, p] of T)
|
|
241
|
+
a[t] = p;
|
|
242
|
+
return a;
|
|
243
|
+
}, Io = /* @__PURE__ */ ke(ko, [["__scopeId", "data-v-54887165"]]), wo = { class: "kong-ui-entities-consumer-groups-list" }, $o = { class: "button-row" }, Eo = /* @__PURE__ */ ce({
|
|
244
|
+
__name: "ConsumerGroupList",
|
|
245
|
+
props: {
|
|
246
|
+
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
247
|
+
config: {
|
|
248
|
+
type: Object,
|
|
249
|
+
required: !0,
|
|
250
|
+
validator: (e) => !(!e || !["konnect", "kongManager"].includes(e?.app) || !e.createRoute || !e.getViewRoute || !e.getEditRoute || e.app === "kongManager" && !e.isExactMatch && !e.filterSchema)
|
|
251
|
+
},
|
|
252
|
+
// used to override the default identifier for the cache entry
|
|
253
|
+
cacheIdentifier: {
|
|
254
|
+
type: String,
|
|
255
|
+
default: ""
|
|
256
|
+
},
|
|
257
|
+
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
|
|
258
|
+
canCreate: {
|
|
259
|
+
type: Function,
|
|
260
|
+
required: !1,
|
|
261
|
+
default: async () => !0
|
|
262
|
+
},
|
|
263
|
+
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
|
|
264
|
+
canDelete: {
|
|
265
|
+
type: Function,
|
|
266
|
+
required: !1,
|
|
267
|
+
default: async () => !0
|
|
268
|
+
},
|
|
269
|
+
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
|
|
270
|
+
canEdit: {
|
|
271
|
+
type: Function,
|
|
272
|
+
required: !1,
|
|
273
|
+
default: async () => !0
|
|
274
|
+
},
|
|
275
|
+
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
|
|
276
|
+
canRetrieve: {
|
|
277
|
+
type: Function,
|
|
278
|
+
required: !1,
|
|
279
|
+
default: async () => !0
|
|
280
|
+
},
|
|
281
|
+
/** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
|
|
282
|
+
useActionOutside: {
|
|
283
|
+
type: Boolean,
|
|
284
|
+
default: !1
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
|
|
288
|
+
setup(e, { emit: T }) {
|
|
289
|
+
const a = T, t = e, { i18nT: p, i18n: { t: i } } = le.useI18n(), n = Fe(), { axiosInstance: $ } = Ce(t.config?.axiosRequestConfig), ee = h(() => t.config.app !== "kongManager" || !!t.config.disableSorting), B = {
|
|
290
|
+
// the Name column is non-hidable
|
|
291
|
+
name: { label: i("consumer_groups.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 }
|
|
292
|
+
};
|
|
293
|
+
t.config.app === "kongManager" && (B.consumers_count = { label: i("consumer_groups.list.table_headers.consumers_count"), searchable: !1, sortable: !1 }), B.tags = { label: i("consumer_groups.list.table_headers.tags"), sortable: !1 };
|
|
294
|
+
const { defaultTablePreferences: oe, tableHeaders: te } = We(B), J = (r) => ({
|
|
295
|
+
"data-testid": r.username ?? r.custom_id ?? r.id
|
|
296
|
+
}), G = () => {
|
|
297
|
+
t.config.consumerId ? Ie() : n.push(t.config.createRoute);
|
|
298
|
+
}, z = h(() => {
|
|
299
|
+
let r = `${t.config.apiBaseUrl}${Q.list[t.config.app][E.value ? "forConsumer" : "all"]}`;
|
|
300
|
+
return t.config.app === "konnect" && (r = r.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || ""), x.value && t.config.isExactMatch && (r += "?list_consumers=false")), r.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, t.config?.consumerId || "");
|
|
301
|
+
}), x = v(""), W = h(() => {
|
|
302
|
+
const r = t.config.app === "konnect" || t.config.isExactMatch;
|
|
303
|
+
return r ? {
|
|
304
|
+
isExactMatch: r,
|
|
305
|
+
fields: {
|
|
306
|
+
username: B.name,
|
|
307
|
+
id: { label: i("consumer_groups.list.table_headers.id") }
|
|
308
|
+
},
|
|
309
|
+
placeholder: i("consumer_groups.search.placeholder")
|
|
310
|
+
} : {
|
|
311
|
+
isExactMatch: r,
|
|
312
|
+
fields: {
|
|
313
|
+
name: B.name
|
|
314
|
+
},
|
|
315
|
+
schema: t.config.filterSchema
|
|
316
|
+
};
|
|
317
|
+
}), { hasRecords: X, handleStateChange: se } = Xe(x), F = h(() => X.value && t.config.app === "konnect"), E = h(() => !!t.config.consumerId), M = h(
|
|
318
|
+
() => E.value ? "kong-ui-entities-consumer-groups-list-in-consumer-page" : "kong-ui-entities-consumer-groups-list"
|
|
319
|
+
), re = h(() => t.config.app === "konnect" && x.value ? "consumer_group" : E.value && !t.config.paginatedEndpoint ? "consumer_groups" : void 0), {
|
|
320
|
+
fetcher: ne,
|
|
321
|
+
fetcherState: ae,
|
|
322
|
+
fetcherCacheKey: S
|
|
323
|
+
} = Ye(h(() => ({ ...t.config, cacheIdentifier: t.cacheIdentifier })), z, re), Y = () => {
|
|
324
|
+
x.value = "";
|
|
325
|
+
}, m = () => {
|
|
326
|
+
S.value++;
|
|
327
|
+
}, _ = v(null), I = async (r, b) => {
|
|
328
|
+
const R = r.id;
|
|
329
|
+
if (!await b(R)) {
|
|
330
|
+
a("copy:error", {
|
|
331
|
+
entity: r,
|
|
332
|
+
field: "id",
|
|
333
|
+
message: i("consumer_groups.errors.copy")
|
|
334
|
+
});
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
a("copy:success", {
|
|
338
|
+
entity: r,
|
|
339
|
+
field: "id",
|
|
340
|
+
message: i("consumer_groups.copy.success", { val: R })
|
|
341
|
+
});
|
|
342
|
+
}, k = async (r, b) => {
|
|
343
|
+
const R = JSON.stringify(r);
|
|
344
|
+
if (!await b(R)) {
|
|
345
|
+
a("copy:error", {
|
|
346
|
+
entity: r,
|
|
347
|
+
message: i("consumer_groups.errors.copy")
|
|
348
|
+
});
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
a("copy:success", {
|
|
352
|
+
entity: r,
|
|
353
|
+
message: i("consumer_groups.copy.success_brief")
|
|
354
|
+
});
|
|
355
|
+
}, H = async (r) => {
|
|
356
|
+
await t.canRetrieve?.(r) && n.push(t.config.getViewRoute(r.id));
|
|
357
|
+
}, D = (r) => ({
|
|
358
|
+
label: i("consumer_groups.actions.view"),
|
|
359
|
+
to: t.config.getViewRoute(r)
|
|
360
|
+
}), ie = (r) => ({
|
|
361
|
+
label: i("consumer_groups.actions.edit"),
|
|
362
|
+
to: t.config.getEditRoute(r)
|
|
363
|
+
}), U = v(void 0), Z = v(!1), s = v(!1), u = v(""), d = Ze(t.config, z.value), f = (r) => {
|
|
364
|
+
U.value = r, Z.value = !0;
|
|
365
|
+
}, y = () => {
|
|
366
|
+
Z.value = !1;
|
|
367
|
+
}, Ke = async () => {
|
|
368
|
+
if (U.value?.id) {
|
|
369
|
+
s.value = !0;
|
|
370
|
+
try {
|
|
371
|
+
await $.delete(d(U.value.id)), s.value = !1, Z.value = !1, S.value++, a("delete:success", U.value);
|
|
372
|
+
} catch (r) {
|
|
373
|
+
u.value = r.response?.data?.message || r.message || i("consumer_groups.errors.delete"), a("error", r);
|
|
374
|
+
} finally {
|
|
375
|
+
s.value = !1;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}, pe = v(!1), Ie = () => {
|
|
379
|
+
pe.value = !0;
|
|
380
|
+
}, we = () => {
|
|
381
|
+
pe.value = !1;
|
|
382
|
+
}, $e = (r, b) => {
|
|
383
|
+
b || we(), S.value++, a("add:success", r);
|
|
384
|
+
}, De = () => {
|
|
385
|
+
E.value && Ie();
|
|
386
|
+
}, j = v(void 0), ge = v(!1), Ue = v(""), Re = (r) => {
|
|
387
|
+
j.value = r, ge.value = !0;
|
|
388
|
+
}, Ee = () => {
|
|
389
|
+
ge.value = !1, j.value = void 0;
|
|
390
|
+
}, qe = h(() => {
|
|
391
|
+
let r = `${t.config.apiBaseUrl}${Q.list[t.config.app].oneForConsumer}`;
|
|
392
|
+
return t.config.app === "konnect" && (r = r.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), r.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerId}/gi, t.config?.consumerId || "");
|
|
393
|
+
}), Me = v(!1), Oe = async () => {
|
|
394
|
+
if (j.value) {
|
|
395
|
+
Me.value = !0;
|
|
396
|
+
try {
|
|
397
|
+
const r = qe.value.replace(/{consumerGroupId}/gi, j.value.id);
|
|
398
|
+
await $.delete(r), a("remove:success", j.value), Ee(), S.value++;
|
|
399
|
+
} catch (r) {
|
|
400
|
+
Ue.value = r.message || i("consumer_groups.errors.delete"), a("error", r);
|
|
401
|
+
} finally {
|
|
402
|
+
Me.value = !1;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
_e(ae, (r) => {
|
|
407
|
+
if (r.status === eo.Error) {
|
|
408
|
+
_.value = {
|
|
409
|
+
title: i("consumer_groups.errors.general")
|
|
410
|
+
}, r.error?.response?.data?.message && (_.value.message = r.error.response.data.message), a("error", r.error);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
_.value = null;
|
|
414
|
+
});
|
|
415
|
+
const fe = v({
|
|
416
|
+
ctaPath: E.value ? void 0 : t.config.createRoute,
|
|
417
|
+
ctaText: void 0,
|
|
418
|
+
message: `${i("consumer_groups.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
|
|
419
|
+
title: i("consumer_groups.title")
|
|
420
|
+
}), ye = v(!1);
|
|
421
|
+
return Ve(async () => {
|
|
422
|
+
ye.value = await t.canCreate(), ye.value && (fe.value.title = E.value ? i("consumer_groups.list.empty_state.title_for_consumer") : i("consumer_groups.list.empty_state.title"), fe.value.ctaText = E.value ? i("consumer_groups.actions.add_to_group") : i("consumer_groups.actions.create"));
|
|
423
|
+
}), (r, b) => {
|
|
424
|
+
const R = K("KButton"), Ne = K("KEmptyState"), ue = K("KDropdownItem"), Se = K("KClipboardProvider"), je = K("KPrompt");
|
|
425
|
+
return w(), N("div", wo, [
|
|
426
|
+
l(o(oo), {
|
|
427
|
+
"cache-identifier": e.cacheIdentifier,
|
|
428
|
+
"default-table-preferences": o(oe),
|
|
429
|
+
"disable-pagination": E.value && !e.config.paginatedEndpoint,
|
|
430
|
+
"disable-sorting": ee.value,
|
|
431
|
+
"empty-state-options": fe.value,
|
|
432
|
+
"enable-entity-actions": "",
|
|
433
|
+
"error-message": _.value,
|
|
434
|
+
fetcher: o(ne),
|
|
435
|
+
"fetcher-cache-key": o(S),
|
|
436
|
+
"pagination-type": "offset",
|
|
437
|
+
"preferences-storage-key": M.value,
|
|
438
|
+
query: x.value,
|
|
439
|
+
"row-attributes": J,
|
|
440
|
+
"table-headers": o(te),
|
|
441
|
+
onClearSearchInput: Y,
|
|
442
|
+
"onClick:row": b[3] || (b[3] = (g) => H(g)),
|
|
443
|
+
onEmptyStateCtaClicked: De,
|
|
444
|
+
onSort: m,
|
|
445
|
+
onState: o(se)
|
|
446
|
+
}, me({
|
|
447
|
+
"toolbar-filter": c(() => [
|
|
448
|
+
E.value ? O("", !0) : (w(), L(o(ro), {
|
|
449
|
+
key: 0,
|
|
450
|
+
modelValue: x.value,
|
|
451
|
+
"onUpdate:modelValue": b[0] || (b[0] = (g) => x.value = g),
|
|
452
|
+
config: W.value
|
|
453
|
+
}, null, 8, ["modelValue", "config"]))
|
|
454
|
+
]),
|
|
455
|
+
"toolbar-button": c(() => [
|
|
456
|
+
(w(), L(Je, {
|
|
457
|
+
disabled: !e.useActionOutside,
|
|
458
|
+
to: "#kong-ui-app-page-header-action-button"
|
|
459
|
+
}, [
|
|
460
|
+
V("div", $o, [
|
|
461
|
+
F.value ? (w(), L(R, {
|
|
462
|
+
key: 0,
|
|
463
|
+
appearance: "secondary",
|
|
464
|
+
class: "open-learning-hub",
|
|
465
|
+
"data-testid": "consumer-groups-learn-more-button",
|
|
466
|
+
icon: "",
|
|
467
|
+
onClick: b[1] || (b[1] = (g) => r.$emit("click:learn-more"))
|
|
468
|
+
}, {
|
|
469
|
+
default: c(() => [
|
|
470
|
+
l(o(Ae), { decorative: "" })
|
|
471
|
+
]),
|
|
472
|
+
_: 1
|
|
473
|
+
})) : O("", !0),
|
|
474
|
+
l(o(de), {
|
|
475
|
+
"auth-function": () => e.canCreate()
|
|
476
|
+
}, {
|
|
477
|
+
default: c(() => [
|
|
478
|
+
l(R, {
|
|
479
|
+
appearance: "primary",
|
|
480
|
+
"data-testid": "toolbar-add-consumer-group",
|
|
481
|
+
size: e.useActionOutside ? "medium" : "large",
|
|
482
|
+
onClick: G
|
|
483
|
+
}, {
|
|
484
|
+
default: c(() => [
|
|
485
|
+
l(o(Pe)),
|
|
486
|
+
q(" " + C(e.config.consumerId ? o(i)("consumer_groups.actions.add_to_group") : o(i)("consumer_groups.list.toolbar_actions.new_consumer_group")), 1)
|
|
487
|
+
]),
|
|
488
|
+
_: 1
|
|
489
|
+
}, 8, ["size"])
|
|
490
|
+
]),
|
|
491
|
+
_: 1
|
|
492
|
+
}, 8, ["auth-function"])
|
|
493
|
+
])
|
|
494
|
+
], 8, ["disabled"]))
|
|
495
|
+
]),
|
|
496
|
+
name: c(({ rowValue: g }) => [
|
|
497
|
+
V("b", null, C(g ?? "-"), 1)
|
|
498
|
+
]),
|
|
499
|
+
consumers_count: c(({ rowValue: g }) => [
|
|
500
|
+
q(C(g ?? "-"), 1)
|
|
501
|
+
]),
|
|
502
|
+
tags: c(({ rowValue: g }) => [
|
|
503
|
+
l(o(so), { tags: g }, null, 8, ["tags"])
|
|
504
|
+
]),
|
|
505
|
+
managed_by: c(({ rowValue: g }) => [
|
|
506
|
+
q(C(o(to)(g) ?? "-"), 1)
|
|
507
|
+
]),
|
|
508
|
+
actions: c(({ row: g }) => [
|
|
509
|
+
l(Se, null, {
|
|
510
|
+
default: c(({ copyToClipboard: ve }) => [
|
|
511
|
+
l(ue, {
|
|
512
|
+
"data-testid": "action-entity-copy-id",
|
|
513
|
+
onClick: (Le) => I(g, ve)
|
|
514
|
+
}, {
|
|
515
|
+
default: c(() => [
|
|
516
|
+
q(C(o(i)("consumer_groups.actions.copy_id")), 1)
|
|
517
|
+
]),
|
|
518
|
+
_: 1
|
|
519
|
+
}, 8, ["onClick"])
|
|
520
|
+
]),
|
|
521
|
+
_: 2
|
|
522
|
+
}, 1024),
|
|
523
|
+
l(Se, null, {
|
|
524
|
+
default: c(({ copyToClipboard: ve }) => [
|
|
525
|
+
l(ue, {
|
|
526
|
+
"data-testid": "action-entity-copy-json",
|
|
527
|
+
onClick: (Le) => k(g, ve)
|
|
528
|
+
}, {
|
|
529
|
+
default: c(() => [
|
|
530
|
+
q(C(o(i)("consumer_groups.actions.copy_json")), 1)
|
|
531
|
+
]),
|
|
532
|
+
_: 1
|
|
533
|
+
}, 8, ["onClick"])
|
|
534
|
+
]),
|
|
535
|
+
_: 2
|
|
536
|
+
}, 1024),
|
|
537
|
+
l(o(de), {
|
|
538
|
+
"auth-function": () => e.canRetrieve(g)
|
|
539
|
+
}, {
|
|
540
|
+
default: c(() => [
|
|
541
|
+
l(ue, {
|
|
542
|
+
"data-testid": "action-entity-view",
|
|
543
|
+
"has-divider": "",
|
|
544
|
+
item: D(g.id)
|
|
545
|
+
}, null, 8, ["item"])
|
|
546
|
+
]),
|
|
547
|
+
_: 2
|
|
548
|
+
}, 1032, ["auth-function"]),
|
|
549
|
+
l(o(de), {
|
|
550
|
+
"auth-function": () => e.canEdit(g)
|
|
551
|
+
}, {
|
|
552
|
+
default: c(() => [
|
|
553
|
+
l(ue, {
|
|
554
|
+
"data-testid": "action-entity-edit",
|
|
555
|
+
item: ie(g.id)
|
|
556
|
+
}, null, 8, ["item"])
|
|
557
|
+
]),
|
|
558
|
+
_: 2
|
|
559
|
+
}, 1032, ["auth-function"]),
|
|
560
|
+
l(o(de), {
|
|
561
|
+
"auth-function": () => e.canDelete(g)
|
|
562
|
+
}, {
|
|
563
|
+
default: c(() => [
|
|
564
|
+
l(ue, {
|
|
565
|
+
danger: "",
|
|
566
|
+
"data-testid": "action-entity-delete",
|
|
567
|
+
"has-divider": "",
|
|
568
|
+
onClick: () => e.config.consumerId ? Re(g) : f(g)
|
|
569
|
+
}, {
|
|
570
|
+
default: c(() => [
|
|
571
|
+
q(C(e.config.consumerId ? o(i)("consumer_groups.actions.exit") : o(i)("consumer_groups.actions.delete")), 1)
|
|
572
|
+
]),
|
|
573
|
+
_: 1
|
|
574
|
+
}, 8, ["onClick"])
|
|
575
|
+
]),
|
|
576
|
+
_: 2
|
|
577
|
+
}, 1032, ["auth-function"])
|
|
578
|
+
]),
|
|
579
|
+
_: 2
|
|
580
|
+
}, [
|
|
581
|
+
!x.value && e.config.app === "konnect" ? {
|
|
582
|
+
name: "empty-state",
|
|
583
|
+
fn: c(() => [
|
|
584
|
+
l(Ne, {
|
|
585
|
+
"data-testid": "consumer-groups-entity-empty-state",
|
|
586
|
+
"icon-background": "",
|
|
587
|
+
message: o(i)("consumer_groups.list.empty_state_v2.description"),
|
|
588
|
+
title: o(i)("consumer_groups.list.empty_state_v2.title")
|
|
589
|
+
}, me({
|
|
590
|
+
icon: c(() => [
|
|
591
|
+
l(o(go), { decorative: "" })
|
|
592
|
+
]),
|
|
593
|
+
action: c(() => [
|
|
594
|
+
ye.value ? (w(), L(R, {
|
|
595
|
+
key: 0,
|
|
596
|
+
"data-testid": "entity-create-button",
|
|
597
|
+
onClick: G
|
|
598
|
+
}, {
|
|
599
|
+
default: c(() => [
|
|
600
|
+
l(o(Pe), { decorative: "" }),
|
|
601
|
+
q(" " + C(o(i)("consumer_groups.list.toolbar_actions.new_consumer_group")), 1)
|
|
602
|
+
]),
|
|
603
|
+
_: 1
|
|
604
|
+
})) : O("", !0),
|
|
605
|
+
l(R, {
|
|
606
|
+
appearance: "secondary",
|
|
607
|
+
"data-testid": "entity-learn-more-button",
|
|
608
|
+
onClick: b[2] || (b[2] = (g) => r.$emit("click:learn-more"))
|
|
609
|
+
}, {
|
|
610
|
+
default: c(() => [
|
|
611
|
+
l(o(Ae), { decorative: "" }),
|
|
612
|
+
q(" " + C(o(i)("consumer_groups.list.empty_state_v2.learn_more")), 1)
|
|
613
|
+
]),
|
|
614
|
+
_: 1
|
|
615
|
+
})
|
|
616
|
+
]),
|
|
617
|
+
_: 2
|
|
618
|
+
}, [
|
|
619
|
+
e.config?.isControlPlaneGroup ? {
|
|
620
|
+
name: "default",
|
|
621
|
+
fn: c(() => [
|
|
622
|
+
q(C(o(i)("consumer_groups.list.empty_state_v2.group")), 1)
|
|
623
|
+
]),
|
|
624
|
+
key: "0"
|
|
625
|
+
} : void 0
|
|
626
|
+
]), 1032, ["message", "title"])
|
|
627
|
+
]),
|
|
628
|
+
key: "0"
|
|
629
|
+
} : void 0
|
|
630
|
+
]), 1032, ["cache-identifier", "default-table-preferences", "disable-pagination", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "preferences-storage-key", "query", "table-headers", "onState"]),
|
|
631
|
+
l(o(no), {
|
|
632
|
+
"action-pending": s.value,
|
|
633
|
+
"data-testid": "delete-consumer-group-modal",
|
|
634
|
+
description: o(i)("consumer_groups.delete.description"),
|
|
635
|
+
"entity-name": U.value && (U.value.name || U.value.id),
|
|
636
|
+
"entity-type": o(ao).ConsumerGroup,
|
|
637
|
+
error: u.value,
|
|
638
|
+
title: o(i)("consumer_groups.delete.title"),
|
|
639
|
+
visible: Z.value,
|
|
640
|
+
onCancel: y,
|
|
641
|
+
onProceed: Ke
|
|
642
|
+
}, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"]),
|
|
643
|
+
e.config.consumerId ? (w(), L(Io, {
|
|
644
|
+
key: 0,
|
|
645
|
+
config: e.config,
|
|
646
|
+
"data-testid": "add-to-group-modal",
|
|
647
|
+
visible: pe.value,
|
|
648
|
+
"onAdd:partialSuccess": b[4] || (b[4] = (g) => $e(g, !0)),
|
|
649
|
+
"onAdd:success": b[5] || (b[5] = (g) => $e(g)),
|
|
650
|
+
onCancel: we
|
|
651
|
+
}, null, 8, ["config", "visible"])) : O("", !0),
|
|
652
|
+
e.config.consumerId && j.value ? (w(), L(je, {
|
|
653
|
+
key: 1,
|
|
654
|
+
"action-button-appearance": "danger",
|
|
655
|
+
"data-testid": "exit-group-modal",
|
|
656
|
+
title: o(i)("consumer_groups.consumers.exit.title"),
|
|
657
|
+
visible: ge.value,
|
|
658
|
+
onCancel: Ee,
|
|
659
|
+
onProceed: Oe
|
|
660
|
+
}, {
|
|
661
|
+
default: c(() => [
|
|
662
|
+
l(o(p), {
|
|
663
|
+
class: "exit-modal-message",
|
|
664
|
+
keypath: e.config.consumerUsername ? "consumer_groups.consumers.exit.confirmation" : "consumer_groups.consumers.exit.confirmationNoUsername",
|
|
665
|
+
tag: "p"
|
|
666
|
+
}, me({
|
|
667
|
+
consumerGroup: c(() => [
|
|
668
|
+
V("strong", null, C(j.value.name || j.value.id), 1)
|
|
669
|
+
]),
|
|
670
|
+
_: 2
|
|
671
|
+
}, [
|
|
672
|
+
e.config.consumerUsername ? {
|
|
673
|
+
name: "consumer",
|
|
674
|
+
fn: c(() => [
|
|
675
|
+
V("strong", null, C(e.config.consumerUsername), 1)
|
|
676
|
+
]),
|
|
677
|
+
key: "0"
|
|
678
|
+
} : void 0
|
|
679
|
+
]), 1032, ["keypath"]),
|
|
680
|
+
V("p", null, C(o(i)("consumer_groups.consumers.exit.description")), 1)
|
|
681
|
+
]),
|
|
682
|
+
_: 1
|
|
683
|
+
}, 8, ["title", "visible"])) : O("", !0)
|
|
684
|
+
]);
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
}), Uo = /* @__PURE__ */ ke(Eo, [["__scopeId", "data-v-0da0fd50"]]), Mo = { class: "kong-ui-entities-consumer-group-form" }, So = { class: "select-item-container" }, xo = { class: "select-item-label" }, Go = {
|
|
688
|
+
key: 0,
|
|
689
|
+
class: "select-item-description"
|
|
690
|
+
}, To = /* @__PURE__ */ ce({
|
|
691
|
+
__name: "ConsumerGroupForm",
|
|
692
|
+
props: {
|
|
693
|
+
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
694
|
+
config: {
|
|
695
|
+
type: Object,
|
|
696
|
+
required: !0,
|
|
697
|
+
validator: (e) => !(!e || !["konnect", "kongManager"].includes(e?.app) || e?.app === "konnect" && !e?.controlPlaneId || e?.app === "kongManager" && typeof e?.workspace != "string" || !e?.cancelRoute)
|
|
698
|
+
},
|
|
699
|
+
/** If a valid consumerGroupId is provided, it will put the form in Edit mode instead of Create */
|
|
700
|
+
consumerGroupId: {
|
|
701
|
+
type: String,
|
|
702
|
+
required: !1,
|
|
703
|
+
default: null
|
|
704
|
+
},
|
|
705
|
+
hideConsumers: {
|
|
706
|
+
type: Boolean,
|
|
707
|
+
default: !1
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
emits: ["update", "error", "loading"],
|
|
711
|
+
setup(e, { emit: T }) {
|
|
712
|
+
const a = e, t = T, { i18n: { t: p } } = le.useI18n(), i = Fe(), n = Ge({
|
|
713
|
+
fields: {
|
|
714
|
+
name: "",
|
|
715
|
+
tags: "",
|
|
716
|
+
consumers: []
|
|
717
|
+
},
|
|
718
|
+
errorMessage: "",
|
|
719
|
+
readonly: !1
|
|
720
|
+
}), $ = Ge({
|
|
721
|
+
name: "",
|
|
722
|
+
tags: "",
|
|
723
|
+
consumers: []
|
|
724
|
+
}), {
|
|
725
|
+
debouncedQueryChange: ee,
|
|
726
|
+
loading: B,
|
|
727
|
+
error: oe,
|
|
728
|
+
loadItems: te,
|
|
729
|
+
results: J
|
|
730
|
+
} = Be(a.config, Q.form[a.config?.app]?.consumersList, "", {
|
|
731
|
+
fetchedItemsKey: "data",
|
|
732
|
+
searchKeys: ["username", "custom_id", "id"]
|
|
733
|
+
}), { axiosInstance: G } = Ce(a.config?.axiosRequestConfig), { getMessageFromError: z } = io(), x = uo(), W = h(() => J.value.map((s) => ({
|
|
734
|
+
label: s.username || s.custom_id,
|
|
735
|
+
value: s.id,
|
|
736
|
+
selected: n.fields.consumers.includes(s.id),
|
|
737
|
+
data: s
|
|
738
|
+
// we need this to determine whether or not to show the description text
|
|
739
|
+
}))), X = h(() => Q.form[a.config?.app].edit), se = h(() => a.consumerGroupId ? he.Edit : he.Create), F = h(() => !!n.fields.name && !Y.value), E = h(() => JSON.stringify(n.fields) !== JSON.stringify($)), M = (s, u = "", d = "") => {
|
|
740
|
+
let f = `${a.config?.apiBaseUrl}${Q.form[a.config?.app][s]}`;
|
|
741
|
+
return a.config?.app === "konnect" && (f = f.replace(/{controlPlaneId}/gi, a.config?.controlPlaneId || "")), f = f.replace(/\/{workspace}/gi, a.config?.workspace ? `/${a.config.workspace}` : "").replace(/{id}/gi, (u || a.consumerGroupId) ?? ""), (s === "addConsumer" || s === "removeConsumer") && (f = f.replace(/{consumerId}/gi, d)), f;
|
|
742
|
+
}, re = () => {
|
|
743
|
+
i.push(a.config?.cancelRoute || { name: "consumer-group-list" });
|
|
744
|
+
}, ne = (s) => {
|
|
745
|
+
t("error", s);
|
|
746
|
+
}, ae = (s) => {
|
|
747
|
+
t("loading", s);
|
|
748
|
+
}, S = async (s) => {
|
|
749
|
+
n.fields.name = s?.item?.name || s?.consumer_group?.name || s?.name || "";
|
|
750
|
+
const u = s?.item?.tags || s?.consumer_group.tags || s?.tags || [];
|
|
751
|
+
if (n.fields.tags = u?.join(", ") || "", "consumers" in s)
|
|
752
|
+
n.fields.consumers = s?.consumers?.map((d) => d.id) || [];
|
|
753
|
+
else
|
|
754
|
+
try {
|
|
755
|
+
const { data: d } = await G.get(M("getConsumers"));
|
|
756
|
+
n.fields.consumers = "consumers" in d ? d?.consumers?.map((f) => f.id) : [];
|
|
757
|
+
} catch (d) {
|
|
758
|
+
k(d);
|
|
759
|
+
}
|
|
760
|
+
Object.assign($, n.fields);
|
|
761
|
+
}, Y = h(() => x.utf8Name(n.fields.name)), m = h(() => ({
|
|
762
|
+
name: n.fields.name,
|
|
763
|
+
tags: n.fields.tags.split(",")?.map((s) => String(s || "").trim())?.filter((s) => s !== "")
|
|
764
|
+
})), _ = async (s, u = "") => await G.post(M("addConsumer", u, s), { consumer: s }), I = async (s, u = "") => await G.delete(M("removeConsumer", u, s)), k = (s) => {
|
|
765
|
+
n.errorMessage = z(s), t("error", s);
|
|
766
|
+
}, H = (s = a.consumerGroupId ?? "") => {
|
|
767
|
+
Object.assign($, n.fields), t("update", { ...n.fields, id: s });
|
|
768
|
+
}, D = (s, u, d = a.consumerGroupId ?? "") => {
|
|
769
|
+
const f = s?.find((y) => y.status !== "fulfilled");
|
|
770
|
+
f ? k({
|
|
771
|
+
code: f.status,
|
|
772
|
+
message: u
|
|
773
|
+
}) : H(d);
|
|
774
|
+
}, ie = async () => {
|
|
775
|
+
let s = "";
|
|
776
|
+
try {
|
|
777
|
+
const { data: u } = await G.post(M("create"), m.value);
|
|
778
|
+
s = "item" in u ? u.item.id : u.id;
|
|
779
|
+
} catch (u) {
|
|
780
|
+
k(u);
|
|
781
|
+
}
|
|
782
|
+
if (n.fields.consumers.length > 0 && s)
|
|
783
|
+
try {
|
|
784
|
+
const u = n.fields.consumers.map((f) => _(f, s)), d = await Promise.allSettled(u);
|
|
785
|
+
D(d, p("consumer_groups.errors.add_consumer"), s);
|
|
786
|
+
} catch (u) {
|
|
787
|
+
k(u);
|
|
788
|
+
}
|
|
789
|
+
else n.fields.consumers.length === 0 && s && H(s);
|
|
790
|
+
}, U = async () => {
|
|
791
|
+
try {
|
|
792
|
+
a.config?.app === "konnect" ? await G.put(M("edit"), m.value) : await G.patch(M("edit"), m.value);
|
|
793
|
+
} catch (d) {
|
|
794
|
+
k(d);
|
|
795
|
+
}
|
|
796
|
+
const s = n.fields.consumers.filter((d) => !$.consumers.includes(d)), u = $.consumers.filter((d) => !n.fields.consumers.includes(d));
|
|
797
|
+
if (u.length === 0 && s.length === 0)
|
|
798
|
+
H();
|
|
799
|
+
else {
|
|
800
|
+
if (u.length > 0)
|
|
801
|
+
try {
|
|
802
|
+
const d = u.map((y) => I(y)), f = await Promise.allSettled(d);
|
|
803
|
+
D(f, p("consumer_groups.errors.remove_consumer"));
|
|
804
|
+
} catch (d) {
|
|
805
|
+
k(d);
|
|
806
|
+
}
|
|
807
|
+
if (s.length > 0)
|
|
808
|
+
try {
|
|
809
|
+
const d = s.map((y) => _(y)), f = await Promise.allSettled(d);
|
|
810
|
+
D(f, p("consumer_groups.errors.add_consumer"));
|
|
811
|
+
} catch (d) {
|
|
812
|
+
k(d);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}, Z = async () => {
|
|
816
|
+
try {
|
|
817
|
+
n.readonly = !0, se.value === he.Create ? await ie() : await U();
|
|
818
|
+
} finally {
|
|
819
|
+
n.readonly = !1;
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
return Ve(async () => {
|
|
823
|
+
a.hideConsumers || await te();
|
|
824
|
+
}), (s, u) => {
|
|
825
|
+
const d = K("KInput"), f = K("KMultiselect");
|
|
826
|
+
return w(), N("div", Mo, [
|
|
827
|
+
l(o(co), {
|
|
828
|
+
"can-submit": F.value && E.value,
|
|
829
|
+
config: e.config,
|
|
830
|
+
"edit-id": e.consumerGroupId,
|
|
831
|
+
"entity-type": o(be).ConsumerGroup,
|
|
832
|
+
"error-message": n.errorMessage || o(oe) || Y.value,
|
|
833
|
+
"fetch-url": X.value,
|
|
834
|
+
"form-fields": m.value,
|
|
835
|
+
"is-readonly": n.readonly,
|
|
836
|
+
onCancel: re,
|
|
837
|
+
"onFetch:error": u[3] || (u[3] = (y) => ne(y)),
|
|
838
|
+
"onFetch:success": S,
|
|
839
|
+
onLoading: u[4] || (u[4] = (y) => ae(y)),
|
|
840
|
+
onSubmit: Z
|
|
841
|
+
}, {
|
|
842
|
+
default: c(() => [
|
|
843
|
+
l(o(Te), {
|
|
844
|
+
description: o(p)("consumer_groups.form.general_info.description"),
|
|
845
|
+
title: o(p)("consumer_groups.form.general_info.title")
|
|
846
|
+
}, {
|
|
847
|
+
default: c(() => [
|
|
848
|
+
l(d, {
|
|
849
|
+
modelValue: n.fields.name,
|
|
850
|
+
"onUpdate:modelValue": u[0] || (u[0] = (y) => n.fields.name = y),
|
|
851
|
+
modelModifiers: { trim: !0 },
|
|
852
|
+
autocomplete: "off",
|
|
853
|
+
"data-testid": "consumer-group-form-name",
|
|
854
|
+
label: o(p)("consumer_groups.form.fields.name.label"),
|
|
855
|
+
placeholder: o(p)("consumer_groups.form.fields.name.placeholder"),
|
|
856
|
+
required: "",
|
|
857
|
+
type: "text"
|
|
858
|
+
}, null, 8, ["modelValue", "label", "placeholder"]),
|
|
859
|
+
l(d, {
|
|
860
|
+
modelValue: n.fields.tags,
|
|
861
|
+
"onUpdate:modelValue": u[1] || (u[1] = (y) => n.fields.tags = y),
|
|
862
|
+
modelModifiers: { trim: !0 },
|
|
863
|
+
autocomplete: "off",
|
|
864
|
+
"data-testid": "consumer-group-form-tags",
|
|
865
|
+
help: o(p)("consumer_groups.form.fields.tags.help"),
|
|
866
|
+
label: o(p)("consumer_groups.form.fields.tags.label"),
|
|
867
|
+
"label-attributes": {
|
|
868
|
+
info: o(p)("consumer_groups.form.fields.tags.tooltip"),
|
|
869
|
+
tooltipAttributes: { maxWidth: "400" }
|
|
870
|
+
},
|
|
871
|
+
placeholder: o(p)("consumer_groups.form.fields.tags.placeholder"),
|
|
872
|
+
type: "text"
|
|
873
|
+
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder"])
|
|
874
|
+
]),
|
|
875
|
+
_: 1
|
|
876
|
+
}, 8, ["description", "title"]),
|
|
877
|
+
e.hideConsumers ? O("", !0) : (w(), L(o(Te), {
|
|
878
|
+
key: 0,
|
|
879
|
+
description: o(p)("consumer_groups.form.consumers.description"),
|
|
880
|
+
"has-divider": "",
|
|
881
|
+
title: o(p)("consumer_groups.form.consumers.title")
|
|
882
|
+
}, {
|
|
883
|
+
default: c(() => [
|
|
884
|
+
l(f, {
|
|
885
|
+
modelValue: n.fields.consumers,
|
|
886
|
+
"onUpdate:modelValue": u[2] || (u[2] = (y) => n.fields.consumers = y),
|
|
887
|
+
appearance: "select",
|
|
888
|
+
autosuggest: "",
|
|
889
|
+
items: W.value,
|
|
890
|
+
label: o(p)("consumer_groups.form.fields.consumers.label"),
|
|
891
|
+
loading: o(B),
|
|
892
|
+
placeholder: o(p)("consumer_groups.form.fields.consumers.placeholder"),
|
|
893
|
+
width: "auto",
|
|
894
|
+
onQueryChange: o(ee)
|
|
895
|
+
}, {
|
|
896
|
+
"item-template": c(({ item: y }) => [
|
|
897
|
+
V("div", So, [
|
|
898
|
+
V("div", xo, C(y.label), 1),
|
|
899
|
+
y?.data?.username && y?.data?.custom_id ? (w(), N("div", Go, C(y?.data?.custom_id), 1)) : O("", !0)
|
|
900
|
+
])
|
|
901
|
+
]),
|
|
902
|
+
_: 1
|
|
903
|
+
}, 8, ["modelValue", "items", "label", "loading", "placeholder", "onQueryChange"])
|
|
904
|
+
]),
|
|
905
|
+
_: 1
|
|
906
|
+
}, 8, ["description", "title"]))
|
|
907
|
+
]),
|
|
908
|
+
_: 1
|
|
909
|
+
}, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"])
|
|
910
|
+
]);
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
}), Ro = /* @__PURE__ */ ke(To, [["__scopeId", "data-v-9c98b878"]]), Ao = { class: "kong-ui-consumer-group-entity-config-card" }, qo = /* @__PURE__ */ ce({
|
|
914
|
+
__name: "ConsumerGroupConfigCard",
|
|
915
|
+
props: {
|
|
916
|
+
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
917
|
+
config: {
|
|
918
|
+
type: Object,
|
|
919
|
+
required: !0,
|
|
920
|
+
validator: (e) => !(!e || !["konnect", "kongManager"].includes(e?.app) || e.app === "konnect" && !e.controlPlaneId || e.app === "kongManager" && typeof e.workspace != "string" || !e.entityId)
|
|
921
|
+
},
|
|
922
|
+
/**
|
|
923
|
+
* External link for documentation that determines visibility of Documentation button
|
|
924
|
+
*/
|
|
925
|
+
configCardDoc: {
|
|
926
|
+
type: String,
|
|
927
|
+
default: "",
|
|
928
|
+
required: !1
|
|
929
|
+
},
|
|
930
|
+
/**
|
|
931
|
+
* Control visibility of card title content
|
|
932
|
+
*/
|
|
933
|
+
hideTitle: {
|
|
934
|
+
type: Boolean,
|
|
935
|
+
default: !1
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
emits: ["loading", "fetch:error", "fetch:success"],
|
|
939
|
+
setup(e) {
|
|
940
|
+
const T = e, { i18n: { t: a } } = le.useI18n(), t = h(() => Q.item[T.config.app]), p = v({
|
|
941
|
+
id: {},
|
|
942
|
+
name: {},
|
|
943
|
+
created_at: {},
|
|
944
|
+
updated_at: {},
|
|
945
|
+
tags: {
|
|
946
|
+
tooltip: a("consumer_groups.form.fields.tags.tooltip")
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
return (i, n) => (w(), N("div", Ao, [
|
|
950
|
+
l(o(lo), {
|
|
951
|
+
config: e.config,
|
|
952
|
+
"config-card-doc": e.configCardDoc,
|
|
953
|
+
"config-schema": p.value,
|
|
954
|
+
"data-key": "consumer_group",
|
|
955
|
+
"entity-type": o(be).ConsumerGroup,
|
|
956
|
+
"fetch-url": t.value,
|
|
957
|
+
"hide-title": e.hideTitle,
|
|
958
|
+
"onFetch:error": n[0] || (n[0] = ($) => i.$emit("fetch:error", $)),
|
|
959
|
+
"onFetch:success": n[1] || (n[1] = ($) => i.$emit("fetch:success", $)),
|
|
960
|
+
onLoading: n[2] || (n[2] = ($) => i.$emit("loading", $))
|
|
961
|
+
}, null, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
|
|
962
|
+
]));
|
|
963
|
+
}
|
|
982
964
|
});
|
|
983
|
-
export {
|
|
965
|
+
export {
|
|
966
|
+
qo as ConsumerGroupConfigCard,
|
|
967
|
+
Do as ConsumerGroupConfigCardView,
|
|
968
|
+
Ro as ConsumerGroupForm,
|
|
969
|
+
Uo as ConsumerGroupList
|
|
970
|
+
};
|