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