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