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