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