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