@kong-ui-public/entities-consumers 3.7.0 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { BookIcon as
|
|
4
|
-
import { createI18n as
|
|
5
|
-
import { useAxios as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as ce, ref as I, computed as w, watch as ye, resolveComponent as O, openBlock as x, createBlock as z, unref as o, withCtx as l, createElementVNode as _, toDisplayString as C, createVNode as c, createElementBlock as H, createCommentVNode as W, Fragment as Je, renderList as Qe, onBeforeMount as ze, createSlots as Se, Teleport as Me, createTextVNode as re, reactive as Ge } from "vue";
|
|
2
|
+
import { useRouter as Re } from "vue-router";
|
|
3
|
+
import { BookIcon as xe, AddIcon as We, TeamIcon as Ye } from "@kong/icons";
|
|
4
|
+
import { createI18n as Xe, i18nTComponent as Ze } from "@kong-ui-public/i18n";
|
|
5
|
+
import { useAxios as he, useDebouncedFilter as et, useTableState as tt, useFetcher as ot, useDeleteUrlBuilder as st, FetcherStatus as nt, EntityBaseTable as rt, EntityFilter as at, PermissionsWrapper as le, TableTags as it, EntityEmptyState as lt, EntityDeleteModal as ut, EntityTypes as ct, useErrors as dt, EntityBaseFormType as Ae, EntityBaseForm as mt, SupportedEntityType as Te, EntityFormSection as pt, ConfigurationSchemaSection as De, EntityBaseConfigCard as ft } from "@kong-ui-public/entities-shared";
|
|
6
|
+
const gt = "#00abd2", vt = "24px", yt = {
|
|
7
7
|
list: {
|
|
8
8
|
table_headers: {
|
|
9
9
|
username: "Username",
|
|
@@ -102,20 +102,20 @@ const ft = "#00abd2", gt = "24px", vt = {
|
|
|
102
102
|
tooltip: "An optional set of strings associated with the Consumer for grouping and filtering."
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
},
|
|
106
|
-
consumers:
|
|
105
|
+
}, ht = {
|
|
106
|
+
consumers: yt
|
|
107
107
|
};
|
|
108
|
-
function
|
|
109
|
-
const e =
|
|
108
|
+
function bt() {
|
|
109
|
+
const e = Xe("en-us", ht);
|
|
110
110
|
return {
|
|
111
111
|
i18n: e,
|
|
112
|
-
i18nT:
|
|
112
|
+
i18nT: Ze(e)
|
|
113
113
|
// Translation component <i18n-t>
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
const
|
|
117
|
-
useI18n:
|
|
118
|
-
}, te = "/v2/control-planes/{controlPlaneId}/core-entities", oe = "/{workspace}",
|
|
116
|
+
const de = {
|
|
117
|
+
useI18n: bt
|
|
118
|
+
}, te = "/v2/control-planes/{controlPlaneId}/core-entities", oe = "/{workspace}", Y = {
|
|
119
119
|
list: {
|
|
120
120
|
konnect: {
|
|
121
121
|
all: `${te}/consumers`,
|
|
@@ -140,13 +140,13 @@ const ce = {
|
|
|
140
140
|
edit: `${oe}/consumers/{id}`
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
},
|
|
143
|
+
}, Ct = { class: "add-consumer-form-container" }, _t = { class: "add-consumer-form-cta" }, kt = { class: "select-item-label" }, It = {
|
|
144
144
|
key: 0,
|
|
145
145
|
class: "select-item-desc"
|
|
146
|
-
},
|
|
146
|
+
}, wt = {
|
|
147
147
|
key: 0,
|
|
148
148
|
class: "kong-ui-entity-add-consumers-error"
|
|
149
|
-
},
|
|
149
|
+
}, $t = { key: 0 }, Et = /* @__PURE__ */ ce({
|
|
150
150
|
__name: "AddConsumerModal",
|
|
151
151
|
props: {
|
|
152
152
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -163,135 +163,135 @@ const ce = {
|
|
|
163
163
|
},
|
|
164
164
|
emits: ["cancel", "add:success", "add:partial-success", "error"],
|
|
165
165
|
setup(e, { emit: m }) {
|
|
166
|
-
var
|
|
167
|
-
const { i18n: { t:
|
|
166
|
+
var h;
|
|
167
|
+
const { i18n: { t: a } } = de.useI18n(), t = e, A = m, { axiosInstance: n } = he((h = t.config) == null ? void 0 : h.axiosRequestConfig), E = I([]), {
|
|
168
168
|
debouncedQueryChange: G,
|
|
169
|
-
loading:
|
|
170
|
-
allRecords:
|
|
169
|
+
loading: V,
|
|
170
|
+
allRecords: P,
|
|
171
171
|
error: p,
|
|
172
|
-
loadItems:
|
|
173
|
-
results:
|
|
174
|
-
} =
|
|
172
|
+
loadItems: X,
|
|
173
|
+
results: J
|
|
174
|
+
} = et(
|
|
175
175
|
t.config,
|
|
176
|
-
|
|
176
|
+
Y.list[t.config.app].all,
|
|
177
177
|
"",
|
|
178
178
|
{
|
|
179
179
|
fetchedItemsKey: "data",
|
|
180
180
|
searchKeys: ["username", "id"]
|
|
181
181
|
}
|
|
182
|
-
),
|
|
182
|
+
), N = (u) => u, U = w(() => p.value ? a("consumers.errors.general") : ""), se = I(0), j = w(() => P.value === void 0), Q = w(() => J.value.map((u) => ({
|
|
183
183
|
label: u.username || u.customId,
|
|
184
184
|
value: u.id,
|
|
185
|
-
selected:
|
|
185
|
+
selected: E.value.includes(u.id),
|
|
186
186
|
data: u
|
|
187
187
|
// we need this to determine whether or not to show the description text
|
|
188
188
|
}))), K = (u) => {
|
|
189
|
-
var
|
|
190
|
-
const b =
|
|
189
|
+
var v;
|
|
190
|
+
const b = j.value ? J.value.find((S) => S.id === u) : (v = P.value) == null ? void 0 : v.find((S) => S.id === u);
|
|
191
191
|
return b ? b.username || b.custom_id : u;
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
if (
|
|
196
|
-
|
|
192
|
+
}, ne = () => {
|
|
193
|
+
R.value = "", k.value = [], g.value = [], A("cancel");
|
|
194
|
+
}, k = I([]), D = I(!1), R = I(""), Z = async () => {
|
|
195
|
+
if (!E.value.length) {
|
|
196
|
+
R.value = "", g.value = [], A("cancel");
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
D.value = !0, R.value = "", k.value = [], g.value = [];
|
|
200
200
|
try {
|
|
201
|
-
const u =
|
|
202
|
-
let
|
|
203
|
-
b.forEach((
|
|
204
|
-
|
|
205
|
-
}),
|
|
201
|
+
const u = E.value.map((S) => r(S)), b = await Promise.allSettled(u);
|
|
202
|
+
let v = !0;
|
|
203
|
+
b.forEach((S) => {
|
|
204
|
+
S.status !== "fulfilled" && (v = !1);
|
|
205
|
+
}), v ? (k.value = [], g.value = [], A("add:success", E.value), E.value = []) : (k.value.length && A("add:partial-success", k.value), E.value = [], T(b));
|
|
206
206
|
} catch {
|
|
207
|
-
|
|
207
|
+
R.value = a("consumers.errors.add"), A("error", R.value);
|
|
208
208
|
} finally {
|
|
209
|
-
|
|
209
|
+
D.value = !1;
|
|
210
210
|
}
|
|
211
|
-
},
|
|
212
|
-
var b,
|
|
213
|
-
let u = `${t.config.apiBaseUrl}${
|
|
214
|
-
return t.config.app === "konnect" ? u = u.replace(/{controlPlaneId}/gi, ((b = t.config) == null ? void 0 : b.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((
|
|
215
|
-
}),
|
|
211
|
+
}, i = w(() => {
|
|
212
|
+
var b, v, S, ee;
|
|
213
|
+
let u = `${t.config.apiBaseUrl}${Y.list[t.config.app].forConsumerGroup}`;
|
|
214
|
+
return t.config.app === "konnect" ? u = u.replace(/{controlPlaneId}/gi, ((b = t.config) == null ? void 0 : b.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((v = t.config) == null ? void 0 : v.consumerGroupId) || "") : t.config.app === "kongManager" && (u = u.replace(/\/{workspace}/gi, (S = t.config) != null && S.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((ee = t.config) == null ? void 0 : ee.consumerGroupId) || "")), u;
|
|
215
|
+
}), r = async (u) => {
|
|
216
216
|
const b = {
|
|
217
217
|
consumer: u
|
|
218
218
|
};
|
|
219
219
|
try {
|
|
220
|
-
const
|
|
221
|
-
return
|
|
222
|
-
} catch (
|
|
223
|
-
let
|
|
224
|
-
return
|
|
220
|
+
const v = await n.post(i.value, b);
|
|
221
|
+
return k.value.push(u), v;
|
|
222
|
+
} catch (v) {
|
|
223
|
+
let S = `${K(u)} - ${v.message}`;
|
|
224
|
+
return v.response.status === 409 && (S = `${K(u)} - ${a("consumers.errors.already_added")}`), Promise.reject(Error(S));
|
|
225
225
|
}
|
|
226
|
-
}, g =
|
|
226
|
+
}, g = I([]), T = (u) => {
|
|
227
227
|
g.value = u.map((b) => {
|
|
228
|
-
var
|
|
229
|
-
return (
|
|
228
|
+
var v;
|
|
229
|
+
return (v = b.reason) == null ? void 0 : v.message;
|
|
230
230
|
}).filter(Boolean);
|
|
231
231
|
};
|
|
232
|
-
return
|
|
233
|
-
|
|
234
|
-
}, { immediate: !0, deep: !0 }),
|
|
235
|
-
t.visible &&
|
|
232
|
+
return ye(Q, () => {
|
|
233
|
+
se.value++;
|
|
234
|
+
}, { immediate: !0, deep: !0 }), ye(() => t.visible, () => {
|
|
235
|
+
t.visible && X();
|
|
236
236
|
}, { immediate: !0 }), (u, b) => {
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
"action-button-disabled":
|
|
237
|
+
const v = O("KMultiselect"), S = O("KAlert"), ee = O("KPrompt");
|
|
238
|
+
return x(), z(ee, {
|
|
239
|
+
"action-button-disabled": D.value,
|
|
240
240
|
class: "kong-ui-entities-add-consumers-modal",
|
|
241
241
|
"data-testid": "add-consumer-modal",
|
|
242
|
-
title: o(
|
|
242
|
+
title: o(a)("consumers.consumer_groups.add.title"),
|
|
243
243
|
visible: e.visible,
|
|
244
|
-
onCancel:
|
|
245
|
-
onProceed:
|
|
244
|
+
onCancel: ne,
|
|
245
|
+
onProceed: Z
|
|
246
246
|
}, {
|
|
247
247
|
default: l(() => [
|
|
248
|
-
_("div",
|
|
249
|
-
_("p",
|
|
250
|
-
c(
|
|
251
|
-
modelValue:
|
|
252
|
-
"onUpdate:modelValue": b[0] || (b[0] = (
|
|
248
|
+
_("div", Ct, [
|
|
249
|
+
_("p", _t, C(o(a)("consumers.consumer_groups.add.ctaText")), 1),
|
|
250
|
+
c(v, {
|
|
251
|
+
modelValue: E.value,
|
|
252
|
+
"onUpdate:modelValue": b[0] || (b[0] = (F) => E.value = F),
|
|
253
253
|
autosuggest: "",
|
|
254
254
|
"data-testid": "add-consumers-multiselect",
|
|
255
|
-
"dropdown-footer-text":
|
|
255
|
+
"dropdown-footer-text": j.value ? o(a)("consumers.consumer_groups.add.footer") : void 0,
|
|
256
256
|
items: Q.value,
|
|
257
|
-
label: o(
|
|
258
|
-
loading: o(
|
|
259
|
-
placeholder: o(
|
|
260
|
-
readonly:
|
|
257
|
+
label: o(a)("consumers.consumer_groups.add.consumers_label"),
|
|
258
|
+
loading: o(V),
|
|
259
|
+
placeholder: o(a)("consumers.consumer_groups.add.consumer_placeholder"),
|
|
260
|
+
readonly: D.value,
|
|
261
261
|
required: "",
|
|
262
262
|
width: "100%",
|
|
263
263
|
onQueryChange: o(G)
|
|
264
264
|
}, {
|
|
265
|
-
"item-template": l(({ item:
|
|
266
|
-
_("div",
|
|
267
|
-
|
|
265
|
+
"item-template": l(({ item: F }) => [
|
|
266
|
+
_("div", kt, C(F.label), 1),
|
|
267
|
+
N(F).data.username && N(F).data.custom_id ? (x(), H("div", It, C(N(F).data.custom_id), 1)) : W("", !0)
|
|
268
268
|
]),
|
|
269
269
|
_: 1
|
|
270
270
|
}, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
|
|
271
|
-
|
|
272
|
-
c(
|
|
271
|
+
R.value || U.value || g.value.length ? (x(), H("div", wt, [
|
|
272
|
+
c(S, { appearance: "danger" }, {
|
|
273
273
|
default: l(() => [
|
|
274
|
-
_("p", null, C(o(
|
|
275
|
-
g.value.length ? (
|
|
276
|
-
(
|
|
277
|
-
])) :
|
|
278
|
-
_("div", null, C(
|
|
274
|
+
_("p", null, C(o(a)("consumers.errors.add")), 1),
|
|
275
|
+
g.value.length ? (x(), H("ul", $t, [
|
|
276
|
+
(x(!0), H(Je, null, Qe(g.value, (F, B) => (x(), H("li", { key: B }, C(F), 1))), 128))
|
|
277
|
+
])) : W("", !0),
|
|
278
|
+
_("div", null, C(R.value || U.value), 1)
|
|
279
279
|
]),
|
|
280
280
|
_: 1
|
|
281
281
|
})
|
|
282
|
-
])) :
|
|
282
|
+
])) : W("", !0)
|
|
283
283
|
])
|
|
284
284
|
]),
|
|
285
285
|
_: 1
|
|
286
286
|
}, 8, ["action-button-disabled", "title", "visible"]);
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
}),
|
|
290
|
-
const
|
|
291
|
-
for (const [t,
|
|
292
|
-
|
|
293
|
-
return
|
|
294
|
-
},
|
|
289
|
+
}), be = (e, m) => {
|
|
290
|
+
const a = e.__vccOpts || e;
|
|
291
|
+
for (const [t, A] of m)
|
|
292
|
+
a[t] = A;
|
|
293
|
+
return a;
|
|
294
|
+
}, St = /* @__PURE__ */ be(Et, [["__scopeId", "data-v-d54468ab"]]), Mt = { class: "kong-ui-entities-consumers-list" }, Gt = { class: "button-row" }, xt = { class: "empty-state-icon-gateway" }, At = /* @__PURE__ */ ce({
|
|
295
295
|
__name: "ConsumerList",
|
|
296
296
|
props: {
|
|
297
297
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -345,21 +345,21 @@ const ce = {
|
|
|
345
345
|
},
|
|
346
346
|
emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
|
|
347
347
|
setup(e, { emit: m }) {
|
|
348
|
-
var
|
|
349
|
-
const
|
|
348
|
+
var Ee;
|
|
349
|
+
const a = m, t = e, { i18nT: A, i18n: { t: n } } = de.useI18n(), E = Re(), { axiosInstance: G } = he((Ee = t.config) == null ? void 0 : Ee.axiosRequestConfig), V = w(() => t.config.app !== "kongManager" || !!t.config.disableSorting), P = {
|
|
350
350
|
// the Username column is non-hidable
|
|
351
351
|
username: { label: n("consumers.list.table_headers.username"), searchable: !0, sortable: !0, hidable: !1 },
|
|
352
352
|
custom_id: { label: n("consumers.list.table_headers.custom_id"), searchable: !0, sortable: !0 },
|
|
353
353
|
tags: { label: n("consumers.list.table_headers.tags"), sortable: !1 }
|
|
354
|
-
}, p =
|
|
354
|
+
}, p = P, X = (s) => ({
|
|
355
355
|
"data-testid": s.username ?? s.custom_id ?? s.id
|
|
356
|
-
}),
|
|
357
|
-
t.config.consumerGroupId ?
|
|
358
|
-
},
|
|
359
|
-
var d,
|
|
360
|
-
let s = `${t.config.apiBaseUrl}${
|
|
361
|
-
return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((
|
|
362
|
-
}),
|
|
356
|
+
}), J = () => {
|
|
357
|
+
t.config.consumerGroupId ? _e() : E.push(t.config.createRoute);
|
|
358
|
+
}, N = w(() => {
|
|
359
|
+
var d, y, $, L;
|
|
360
|
+
let s = `${t.config.apiBaseUrl}${Y.list[t.config.app][k.value ? "forConsumerGroup" : "all"]}`;
|
|
361
|
+
return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((y = t.config) == null ? void 0 : y.consumerGroupId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, ($ = t.config) != null && $.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((L = t.config) == null ? void 0 : L.consumerGroupId) || "")), s;
|
|
362
|
+
}), U = I(""), se = w(() => {
|
|
363
363
|
const s = t.config.app === "konnect" || t.config.isExactMatch;
|
|
364
364
|
return s ? {
|
|
365
365
|
isExactMatch: s,
|
|
@@ -367,159 +367,159 @@ const ce = {
|
|
|
367
367
|
} : {
|
|
368
368
|
isExactMatch: s,
|
|
369
369
|
fields: {
|
|
370
|
-
username:
|
|
371
|
-
custom_id:
|
|
370
|
+
username: P.username,
|
|
371
|
+
custom_id: P.custom_id
|
|
372
372
|
},
|
|
373
373
|
schema: t.config.filterSchema
|
|
374
374
|
};
|
|
375
|
-
}), { hasRecords:
|
|
376
|
-
() =>
|
|
377
|
-
),
|
|
378
|
-
fetcher:
|
|
379
|
-
fetcherState:
|
|
380
|
-
fetcherCacheKey:
|
|
381
|
-
} =
|
|
382
|
-
|
|
383
|
-
},
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
const
|
|
387
|
-
if (!d(
|
|
388
|
-
|
|
375
|
+
}), { hasRecords: j, handleStateChange: Q } = tt(U), K = w(() => j.value && t.config.app === "konnect"), ne = w(() => !t.enableV2EmptyStates && t.config.app === "konnect"), k = w(() => !!t.config.consumerGroupId), D = w(
|
|
376
|
+
() => k.value ? "kong-ui-entities-consumers-list-in-group-page" : "kong-ui-entities-consumers-list"
|
|
377
|
+
), R = w(() => k.value && !t.config.paginatedEndpoint ? "consumers" : void 0), {
|
|
378
|
+
fetcher: Z,
|
|
379
|
+
fetcherState: i,
|
|
380
|
+
fetcherCacheKey: r
|
|
381
|
+
} = ot({ ...t.config, cacheIdentifier: t.cacheIdentifier }, N.value, R.value), g = () => {
|
|
382
|
+
U.value = "";
|
|
383
|
+
}, T = () => {
|
|
384
|
+
r.value++;
|
|
385
|
+
}, h = (s) => s ?? "-", u = I(null), b = (s, d) => {
|
|
386
|
+
const y = s.id;
|
|
387
|
+
if (!d(y)) {
|
|
388
|
+
a("copy:error", {
|
|
389
389
|
entity: s,
|
|
390
390
|
field: "id",
|
|
391
391
|
message: n("consumers.errors.copy")
|
|
392
392
|
});
|
|
393
393
|
return;
|
|
394
394
|
}
|
|
395
|
-
|
|
395
|
+
a("copy:success", {
|
|
396
396
|
entity: s,
|
|
397
397
|
field: "id",
|
|
398
|
-
message: n("consumers.copy.success", { val:
|
|
398
|
+
message: n("consumers.copy.success", { val: y })
|
|
399
399
|
});
|
|
400
|
-
},
|
|
401
|
-
const
|
|
402
|
-
if (!d(
|
|
403
|
-
|
|
400
|
+
}, v = (s, d) => {
|
|
401
|
+
const y = JSON.stringify(s);
|
|
402
|
+
if (!d(y)) {
|
|
403
|
+
a("copy:error", {
|
|
404
404
|
entity: s,
|
|
405
405
|
message: n("consumers.errors.copy")
|
|
406
406
|
});
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
|
-
|
|
409
|
+
a("copy:success", {
|
|
410
410
|
entity: s,
|
|
411
411
|
message: n("consumers.copy.success_brief")
|
|
412
412
|
});
|
|
413
|
-
},
|
|
414
|
-
var
|
|
415
|
-
await ((
|
|
416
|
-
},
|
|
413
|
+
}, S = async (s) => {
|
|
414
|
+
var y;
|
|
415
|
+
await ((y = t.canRetrieve) == null ? void 0 : y.call(t, s)) && E.push(t.config.getViewRoute(s.id));
|
|
416
|
+
}, ee = (s) => ({
|
|
417
417
|
label: n("consumers.actions.view"),
|
|
418
418
|
to: t.config.getViewRoute(s)
|
|
419
|
-
}),
|
|
419
|
+
}), F = (s) => ({
|
|
420
420
|
label: n("consumers.actions.edit"),
|
|
421
421
|
to: t.config.getEditRoute(s)
|
|
422
|
-
}),
|
|
423
|
-
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
},
|
|
427
|
-
var s, d,
|
|
428
|
-
if ((s =
|
|
429
|
-
|
|
422
|
+
}), B = I(void 0), ae = I(!1), ie = I(!1), Ce = I(""), Ue = st(t.config, N.value), Fe = (s) => {
|
|
423
|
+
B.value = s, ae.value = !0;
|
|
424
|
+
}, Be = () => {
|
|
425
|
+
ae.value = !1;
|
|
426
|
+
}, Pe = async () => {
|
|
427
|
+
var s, d, y;
|
|
428
|
+
if ((s = B.value) != null && s.id) {
|
|
429
|
+
ie.value = !0;
|
|
430
430
|
try {
|
|
431
|
-
await G.delete(
|
|
432
|
-
} catch (
|
|
433
|
-
|
|
431
|
+
await G.delete(Ue(B.value.id)), ie.value = !1, ae.value = !1, r.value++, a("delete:success", B.value);
|
|
432
|
+
} catch ($) {
|
|
433
|
+
Ce.value = ((y = (d = $.response) == null ? void 0 : d.data) == null ? void 0 : y.message) || $.message || n("consumers.errors.delete"), a("error", $);
|
|
434
434
|
} finally {
|
|
435
|
-
|
|
435
|
+
ie.value = !1;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
|
|
442
|
-
},
|
|
443
|
-
d ||
|
|
444
|
-
},
|
|
445
|
-
|
|
446
|
-
}, q =
|
|
447
|
-
q.value = s,
|
|
448
|
-
},
|
|
449
|
-
|
|
450
|
-
},
|
|
451
|
-
var d,
|
|
452
|
-
let s = `${t.config.apiBaseUrl}${
|
|
453
|
-
return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((
|
|
454
|
-
}),
|
|
438
|
+
}, me = I(!1), _e = () => {
|
|
439
|
+
me.value = !0;
|
|
440
|
+
}, ke = () => {
|
|
441
|
+
me.value = !1;
|
|
442
|
+
}, Ie = (s, d) => {
|
|
443
|
+
d || ke(), r.value++, a("add:success", s);
|
|
444
|
+
}, Ke = () => {
|
|
445
|
+
k.value && _e();
|
|
446
|
+
}, q = I(void 0), pe = I(!1), qe = I(""), Oe = (s) => {
|
|
447
|
+
q.value = s, pe.value = !0;
|
|
448
|
+
}, we = () => {
|
|
449
|
+
pe.value = !1, q.value = void 0;
|
|
450
|
+
}, Ne = w(() => {
|
|
451
|
+
var d, y, $, L;
|
|
452
|
+
let s = `${t.config.apiBaseUrl}${Y.list[t.config.app].oneForConsumerGroup}`;
|
|
453
|
+
return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((d = t.config) == null ? void 0 : d.controlPlaneId) || "").replace(/{consumerGroupId}/gi, ((y = t.config) == null ? void 0 : y.consumerGroupId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, ($ = t.config) != null && $.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, ((L = t.config) == null ? void 0 : L.consumerGroupId) || "")), s;
|
|
454
|
+
}), $e = I(!1), je = async () => {
|
|
455
455
|
if (q.value) {
|
|
456
|
-
|
|
456
|
+
$e.value = !0;
|
|
457
457
|
try {
|
|
458
|
-
const s =
|
|
459
|
-
await G.delete(s),
|
|
458
|
+
const s = Ne.value.replace(/{consumerId}/gi, q.value.id);
|
|
459
|
+
await G.delete(s), a("remove:success", q.value), we(), r.value++;
|
|
460
460
|
} catch (s) {
|
|
461
|
-
|
|
461
|
+
qe.value = s.message || n("consumers.errors.delete"), a("error", s);
|
|
462
462
|
} finally {
|
|
463
|
-
|
|
463
|
+
$e.value = !1;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
};
|
|
467
|
-
|
|
468
|
-
var d,
|
|
469
|
-
if (s.status ===
|
|
470
|
-
|
|
467
|
+
ye(i, (s) => {
|
|
468
|
+
var d, y, $;
|
|
469
|
+
if (s.status === nt.Error) {
|
|
470
|
+
u.value = {
|
|
471
471
|
title: n("consumers.errors.general")
|
|
472
|
-
}, (
|
|
472
|
+
}, ($ = (y = (d = s.error) == null ? void 0 : d.response) == null ? void 0 : y.data) != null && $.message && (u.value.message = s.error.response.data.message), a("error", s.error);
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
|
-
|
|
475
|
+
u.value = null;
|
|
476
476
|
});
|
|
477
|
-
const
|
|
478
|
-
ctaPath:
|
|
477
|
+
const fe = I({
|
|
478
|
+
ctaPath: k.value ? void 0 : t.config.createRoute,
|
|
479
479
|
ctaText: void 0,
|
|
480
480
|
message: `${n("consumers.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
|
|
481
481
|
title: n("consumers.title")
|
|
482
482
|
});
|
|
483
|
-
return
|
|
484
|
-
await t.canCreate() && (
|
|
483
|
+
return ze(async () => {
|
|
484
|
+
await t.canCreate() && (fe.value.title = k.value ? n("consumers.list.empty_state.title_for_consumer_group") : n("consumers.list.empty_state.title"), fe.value.ctaText = k.value ? n("consumers.actions.add_consumer") : n("consumers.actions.create"));
|
|
485
485
|
}), (s, d) => {
|
|
486
|
-
const
|
|
487
|
-
return
|
|
488
|
-
c(o(
|
|
486
|
+
const y = O("KButton"), $ = O("KDropdownItem"), L = O("KClipboardProvider"), Le = O("KPrompt");
|
|
487
|
+
return x(), H("div", Mt, [
|
|
488
|
+
c(o(rt), {
|
|
489
489
|
"cache-identifier": e.cacheIdentifier,
|
|
490
|
-
"disable-sorting":
|
|
491
|
-
"empty-state-options":
|
|
490
|
+
"disable-sorting": V.value,
|
|
491
|
+
"empty-state-options": fe.value,
|
|
492
492
|
"enable-entity-actions": "",
|
|
493
|
-
"error-message":
|
|
494
|
-
fetcher: o(
|
|
495
|
-
"fetcher-cache-key": o(
|
|
496
|
-
"hide-pagination":
|
|
493
|
+
"error-message": u.value,
|
|
494
|
+
fetcher: o(Z),
|
|
495
|
+
"fetcher-cache-key": o(r),
|
|
496
|
+
"hide-pagination": k.value && !e.config.paginatedEndpoint,
|
|
497
497
|
"pagination-type": "offset",
|
|
498
|
-
"preferences-storage-key":
|
|
499
|
-
query:
|
|
500
|
-
"row-attributes":
|
|
498
|
+
"preferences-storage-key": D.value,
|
|
499
|
+
query: U.value,
|
|
500
|
+
"row-attributes": X,
|
|
501
501
|
"table-headers": o(p),
|
|
502
|
-
onClearSearchInput:
|
|
503
|
-
"onClick:row": d[
|
|
504
|
-
onEmptyStateCtaClicked:
|
|
505
|
-
onSort:
|
|
502
|
+
onClearSearchInput: g,
|
|
503
|
+
"onClick:row": d[4] || (d[4] = (f) => S(f)),
|
|
504
|
+
onEmptyStateCtaClicked: Ke,
|
|
505
|
+
onSort: T,
|
|
506
506
|
onState: o(Q)
|
|
507
|
-
},
|
|
507
|
+
}, Se({
|
|
508
508
|
"toolbar-filter": l(() => [
|
|
509
|
-
|
|
509
|
+
k.value ? W("", !0) : (x(), z(o(at), {
|
|
510
510
|
key: 0,
|
|
511
|
-
modelValue:
|
|
512
|
-
"onUpdate:modelValue": d[0] || (d[0] = (f) =>
|
|
513
|
-
config:
|
|
511
|
+
modelValue: U.value,
|
|
512
|
+
"onUpdate:modelValue": d[0] || (d[0] = (f) => U.value = f),
|
|
513
|
+
config: se.value
|
|
514
514
|
}, null, 8, ["modelValue", "config"]))
|
|
515
515
|
]),
|
|
516
516
|
"toolbar-button": l(() => [
|
|
517
|
-
(
|
|
517
|
+
(x(), z(Me, {
|
|
518
518
|
disabled: !e.useActionOutside,
|
|
519
519
|
to: "#kong-ui-app-page-header-action-button"
|
|
520
520
|
}, [
|
|
521
|
-
_("div",
|
|
522
|
-
!
|
|
521
|
+
_("div", Gt, [
|
|
522
|
+
!k.value && K.value ? (x(), z(y, {
|
|
523
523
|
key: 0,
|
|
524
524
|
appearance: "secondary",
|
|
525
525
|
class: "open-learning-hub",
|
|
@@ -528,22 +528,22 @@ const ce = {
|
|
|
528
528
|
onClick: d[1] || (d[1] = (f) => s.$emit("click:learn-more"))
|
|
529
529
|
}, {
|
|
530
530
|
default: l(() => [
|
|
531
|
-
c(o(
|
|
531
|
+
c(o(xe), { decorative: "" })
|
|
532
532
|
]),
|
|
533
533
|
_: 1
|
|
534
|
-
})) :
|
|
535
|
-
c(o(
|
|
534
|
+
})) : W("", !0),
|
|
535
|
+
c(o(le), {
|
|
536
536
|
"auth-function": () => e.canCreate()
|
|
537
537
|
}, {
|
|
538
538
|
default: l(() => [
|
|
539
|
-
c(
|
|
539
|
+
c(y, {
|
|
540
540
|
appearance: "primary",
|
|
541
541
|
"data-testid": "toolbar-add-consumer",
|
|
542
542
|
size: e.useActionOutside ? "medium" : "large",
|
|
543
|
-
onClick:
|
|
543
|
+
onClick: J
|
|
544
544
|
}, {
|
|
545
545
|
default: l(() => [
|
|
546
|
-
c(o(
|
|
546
|
+
c(o(We)),
|
|
547
547
|
re(" " + C(e.config.consumerGroupId ? o(n)("consumers.actions.add_consumer") : o(n)("consumers.list.toolbar_actions.new_consumer")), 1)
|
|
548
548
|
]),
|
|
549
549
|
_: 1
|
|
@@ -555,20 +555,20 @@ const ce = {
|
|
|
555
555
|
], 8, ["disabled"]))
|
|
556
556
|
]),
|
|
557
557
|
username: l(({ rowValue: f }) => [
|
|
558
|
-
_("b", null, C(
|
|
558
|
+
_("b", null, C(h(f)), 1)
|
|
559
559
|
]),
|
|
560
560
|
custom_id: l(({ rowValue: f }) => [
|
|
561
|
-
re(C(
|
|
561
|
+
re(C(h(f)), 1)
|
|
562
562
|
]),
|
|
563
563
|
tags: l(({ rowValue: f }) => [
|
|
564
|
-
c(o(
|
|
564
|
+
c(o(it), { tags: f }, null, 8, ["tags"])
|
|
565
565
|
]),
|
|
566
566
|
actions: l(({ row: f }) => [
|
|
567
|
-
c(
|
|
568
|
-
default: l(({ copyToClipboard:
|
|
569
|
-
c(
|
|
567
|
+
c(L, null, {
|
|
568
|
+
default: l(({ copyToClipboard: ge }) => [
|
|
569
|
+
c($, {
|
|
570
570
|
"data-testid": "action-entity-copy-id",
|
|
571
|
-
onClick: (
|
|
571
|
+
onClick: (He) => b(f, ge)
|
|
572
572
|
}, {
|
|
573
573
|
default: l(() => [
|
|
574
574
|
re(C(o(n)("consumers.actions.copy_id")), 1)
|
|
@@ -578,11 +578,11 @@ const ce = {
|
|
|
578
578
|
]),
|
|
579
579
|
_: 2
|
|
580
580
|
}, 1024),
|
|
581
|
-
c(
|
|
582
|
-
default: l(({ copyToClipboard:
|
|
583
|
-
c(
|
|
581
|
+
c(L, null, {
|
|
582
|
+
default: l(({ copyToClipboard: ge }) => [
|
|
583
|
+
c($, {
|
|
584
584
|
"data-testid": "action-entity-copy-json",
|
|
585
|
-
onClick: (
|
|
585
|
+
onClick: (He) => v(f, ge)
|
|
586
586
|
}, {
|
|
587
587
|
default: l(() => [
|
|
588
588
|
re(C(o(n)("consumers.actions.copy_json")), 1)
|
|
@@ -592,38 +592,38 @@ const ce = {
|
|
|
592
592
|
]),
|
|
593
593
|
_: 2
|
|
594
594
|
}, 1024),
|
|
595
|
-
c(o(
|
|
595
|
+
c(o(le), {
|
|
596
596
|
"auth-function": () => e.canRetrieve(f)
|
|
597
597
|
}, {
|
|
598
598
|
default: l(() => [
|
|
599
|
-
c(
|
|
599
|
+
c($, {
|
|
600
600
|
"data-testid": "action-entity-view",
|
|
601
601
|
"has-divider": "",
|
|
602
|
-
item:
|
|
602
|
+
item: ee(f.id)
|
|
603
603
|
}, null, 8, ["item"])
|
|
604
604
|
]),
|
|
605
605
|
_: 2
|
|
606
606
|
}, 1032, ["auth-function"]),
|
|
607
|
-
c(o(
|
|
607
|
+
c(o(le), {
|
|
608
608
|
"auth-function": () => e.canEdit(f)
|
|
609
609
|
}, {
|
|
610
610
|
default: l(() => [
|
|
611
|
-
c(
|
|
611
|
+
c($, {
|
|
612
612
|
"data-testid": "action-entity-edit",
|
|
613
|
-
item:
|
|
613
|
+
item: F(f.id)
|
|
614
614
|
}, null, 8, ["item"])
|
|
615
615
|
]),
|
|
616
616
|
_: 2
|
|
617
617
|
}, 1032, ["auth-function"]),
|
|
618
|
-
c(o(
|
|
618
|
+
c(o(le), {
|
|
619
619
|
"auth-function": () => e.canDelete(f)
|
|
620
620
|
}, {
|
|
621
621
|
default: l(() => [
|
|
622
|
-
c(
|
|
622
|
+
c($, {
|
|
623
623
|
danger: "",
|
|
624
624
|
"data-testid": "action-entity-delete",
|
|
625
625
|
"has-divider": "",
|
|
626
|
-
onClick: () => e.config.consumerGroupId ?
|
|
626
|
+
onClick: () => e.config.consumerGroupId ? Oe(f) : Fe(f)
|
|
627
627
|
}, {
|
|
628
628
|
default: l(() => [
|
|
629
629
|
re(C(e.config.consumerGroupId ? o(n)("consumers.actions.remove") : o(n)("consumers.actions.delete")), 1)
|
|
@@ -636,69 +636,92 @@ const ce = {
|
|
|
636
636
|
]),
|
|
637
637
|
_: 2
|
|
638
638
|
}, [
|
|
639
|
+
!o(j) && ne.value ? {
|
|
640
|
+
name: "outside-actions",
|
|
641
|
+
fn: l(() => [
|
|
642
|
+
(x(), z(Me, {
|
|
643
|
+
disabled: !e.useActionOutside,
|
|
644
|
+
to: "#kong-ui-app-page-header-action-button"
|
|
645
|
+
}, [
|
|
646
|
+
c(y, {
|
|
647
|
+
appearance: "secondary",
|
|
648
|
+
class: "open-learning-hub",
|
|
649
|
+
"data-testid": "consumers-learn-more-button",
|
|
650
|
+
icon: "",
|
|
651
|
+
onClick: d[2] || (d[2] = (f) => s.$emit("click:learn-more"))
|
|
652
|
+
}, {
|
|
653
|
+
default: l(() => [
|
|
654
|
+
c(o(xe), { decorative: "" })
|
|
655
|
+
]),
|
|
656
|
+
_: 1
|
|
657
|
+
})
|
|
658
|
+
], 8, ["disabled"]))
|
|
659
|
+
]),
|
|
660
|
+
key: "0"
|
|
661
|
+
} : void 0,
|
|
639
662
|
e.enableV2EmptyStates && e.config.app === "konnect" ? {
|
|
640
663
|
name: "empty-state",
|
|
641
664
|
fn: l(() => [
|
|
642
|
-
c(o(
|
|
665
|
+
c(o(lt), {
|
|
643
666
|
"action-button-text": o(n)("consumers.list.toolbar_actions.new_consumer"),
|
|
644
667
|
appearance: "secondary",
|
|
645
668
|
"can-create": () => e.canCreate(),
|
|
646
669
|
description: o(n)("consumers.list.empty_state_v2.description"),
|
|
647
670
|
"learn-more": e.config.app === "konnect",
|
|
648
671
|
title: o(n)("consumers.list.empty_state_v2.title"),
|
|
649
|
-
"onClick:create":
|
|
650
|
-
"onClick:learnMore": d[
|
|
672
|
+
"onClick:create": J,
|
|
673
|
+
"onClick:learnMore": d[3] || (d[3] = (f) => s.$emit("click:learn-more"))
|
|
651
674
|
}, {
|
|
652
675
|
image: l(() => [
|
|
653
|
-
_("div",
|
|
654
|
-
c(o(
|
|
655
|
-
color: o(
|
|
656
|
-
size: o(
|
|
676
|
+
_("div", xt, [
|
|
677
|
+
c(o(Ye), {
|
|
678
|
+
color: o(gt),
|
|
679
|
+
size: o(vt)
|
|
657
680
|
}, null, 8, ["color", "size"])
|
|
658
681
|
])
|
|
659
682
|
]),
|
|
660
683
|
_: 1
|
|
661
684
|
}, 8, ["action-button-text", "can-create", "description", "learn-more", "title"])
|
|
662
685
|
]),
|
|
663
|
-
key: "
|
|
686
|
+
key: "1"
|
|
664
687
|
} : void 0
|
|
665
688
|
]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "hide-pagination", "preferences-storage-key", "query", "table-headers", "onState"]),
|
|
666
|
-
c(o(
|
|
667
|
-
"action-button-disabled":
|
|
689
|
+
c(o(ut), {
|
|
690
|
+
"action-button-disabled": ie.value,
|
|
668
691
|
"data-testid": "delete-consumer-modal",
|
|
669
692
|
description: o(n)("consumers.delete.description"),
|
|
670
|
-
"entity-name":
|
|
671
|
-
"entity-type": o(
|
|
672
|
-
error:
|
|
693
|
+
"entity-name": B.value && (B.value.username || B.value.custom_id || B.value.id),
|
|
694
|
+
"entity-type": o(ct).Consumer,
|
|
695
|
+
error: Ce.value,
|
|
673
696
|
title: o(n)("consumers.delete.title"),
|
|
674
|
-
visible:
|
|
675
|
-
onCancel:
|
|
676
|
-
onProceed:
|
|
697
|
+
visible: ae.value,
|
|
698
|
+
onCancel: Be,
|
|
699
|
+
onProceed: Pe
|
|
677
700
|
}, null, 8, ["action-button-disabled", "description", "entity-name", "entity-type", "error", "title", "visible"]),
|
|
678
|
-
e.config.consumerGroupId ? (
|
|
701
|
+
e.config.consumerGroupId ? (x(), z(St, {
|
|
679
702
|
key: 0,
|
|
680
703
|
config: e.config,
|
|
681
704
|
"data-testid": "add-consumer-modal",
|
|
682
|
-
visible:
|
|
683
|
-
"onAdd:partialSuccess": d[
|
|
684
|
-
"onAdd:success": d[
|
|
685
|
-
onCancel:
|
|
686
|
-
}, null, 8, ["config", "visible"])) :
|
|
687
|
-
e.config.consumerGroupId && q.value ? (
|
|
705
|
+
visible: me.value,
|
|
706
|
+
"onAdd:partialSuccess": d[5] || (d[5] = (f) => Ie(f, !0)),
|
|
707
|
+
"onAdd:success": d[6] || (d[6] = (f) => Ie(f)),
|
|
708
|
+
onCancel: ke
|
|
709
|
+
}, null, 8, ["config", "visible"])) : W("", !0),
|
|
710
|
+
e.config.consumerGroupId && q.value ? (x(), z(Le, {
|
|
688
711
|
key: 1,
|
|
689
712
|
"action-button-appearance": "danger",
|
|
690
713
|
"data-testid": "remove-consumer-modal",
|
|
691
714
|
title: o(n)("consumers.consumer_groups.remove.title"),
|
|
692
|
-
visible:
|
|
693
|
-
onCancel:
|
|
694
|
-
onProceed:
|
|
715
|
+
visible: pe.value,
|
|
716
|
+
onCancel: we,
|
|
717
|
+
onProceed: je
|
|
695
718
|
}, {
|
|
696
719
|
default: l(() => [
|
|
697
|
-
c(o(
|
|
720
|
+
c(o(A), {
|
|
698
721
|
class: "message",
|
|
699
722
|
keypath: e.config.consumerGroupName ? "consumers.consumer_groups.remove.confirmation" : "consumers.consumer_groups.remove.confirmationNoCG",
|
|
700
723
|
tag: "p"
|
|
701
|
-
},
|
|
724
|
+
}, Se({
|
|
702
725
|
consumer: l(() => [
|
|
703
726
|
_("strong", null, C(q.value.username || q.value.custom_id || q.value.id), 1)
|
|
704
727
|
]),
|
|
@@ -715,35 +738,35 @@ const ce = {
|
|
|
715
738
|
_("p", null, C(o(n)("consumers.consumer_groups.remove.description")), 1)
|
|
716
739
|
]),
|
|
717
740
|
_: 1
|
|
718
|
-
}, 8, ["title", "visible"])) :
|
|
741
|
+
}, 8, ["title", "visible"])) : W("", !0)
|
|
719
742
|
]);
|
|
720
743
|
};
|
|
721
744
|
}
|
|
722
|
-
}),
|
|
745
|
+
}), Qt = /* @__PURE__ */ be(At, [["__scopeId", "data-v-c7796978"]]);
|
|
723
746
|
var M = [];
|
|
724
|
-
for (var
|
|
725
|
-
M.push((
|
|
726
|
-
function
|
|
747
|
+
for (var ve = 0; ve < 256; ++ve)
|
|
748
|
+
M.push((ve + 256).toString(16).slice(1));
|
|
749
|
+
function Dt(e, m = 0) {
|
|
727
750
|
return (M[e[m + 0]] + M[e[m + 1]] + M[e[m + 2]] + M[e[m + 3]] + "-" + M[e[m + 4]] + M[e[m + 5]] + "-" + M[e[m + 6]] + M[e[m + 7]] + "-" + M[e[m + 8]] + M[e[m + 9]] + "-" + M[e[m + 10]] + M[e[m + 11]] + M[e[m + 12]] + M[e[m + 13]] + M[e[m + 14]] + M[e[m + 15]]).toLowerCase();
|
|
728
751
|
}
|
|
729
|
-
var
|
|
730
|
-
function
|
|
731
|
-
if (!
|
|
752
|
+
var ue, Vt = new Uint8Array(16);
|
|
753
|
+
function Rt() {
|
|
754
|
+
if (!ue && (ue = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ue))
|
|
732
755
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
733
|
-
return
|
|
756
|
+
return ue(Vt);
|
|
734
757
|
}
|
|
735
|
-
var
|
|
736
|
-
const
|
|
737
|
-
randomUUID:
|
|
758
|
+
var Tt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
759
|
+
const Ve = {
|
|
760
|
+
randomUUID: Tt
|
|
738
761
|
};
|
|
739
|
-
function
|
|
740
|
-
if (
|
|
741
|
-
return
|
|
762
|
+
function Ut(e, m, a) {
|
|
763
|
+
if (Ve.randomUUID && !m && !e)
|
|
764
|
+
return Ve.randomUUID();
|
|
742
765
|
e = e || {};
|
|
743
|
-
var t = e.random || (e.rng ||
|
|
744
|
-
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128,
|
|
766
|
+
var t = e.random || (e.rng || Rt)();
|
|
767
|
+
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, Dt(t);
|
|
745
768
|
}
|
|
746
|
-
const
|
|
769
|
+
const Ft = { class: "kong-ui-entities-consumer-form" }, Bt = ["id"], Pt = { class: "fields-group-text" }, Kt = ["aria-labelledby"], qt = /* @__PURE__ */ ce({
|
|
747
770
|
__name: "ConsumerForm",
|
|
748
771
|
props: {
|
|
749
772
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -761,8 +784,8 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
761
784
|
},
|
|
762
785
|
emits: ["update", "error", "loading"],
|
|
763
786
|
setup(e, { emit: m }) {
|
|
764
|
-
var
|
|
765
|
-
const
|
|
787
|
+
var Z;
|
|
788
|
+
const a = e, t = m, { i18nT: A, i18n: { t: n } } = de.useI18n(), E = Re(), { axiosInstance: G } = he((Z = a.config) == null ? void 0 : Z.axiosRequestConfig), { getMessageFromError: V } = dt(), P = Ut(), p = Ge({
|
|
766
789
|
fields: {
|
|
767
790
|
username: "",
|
|
768
791
|
customId: "",
|
|
@@ -770,69 +793,69 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
770
793
|
},
|
|
771
794
|
readonly: !1,
|
|
772
795
|
errorMessage: ""
|
|
773
|
-
}),
|
|
796
|
+
}), X = Ge({
|
|
774
797
|
username: "",
|
|
775
798
|
customId: "",
|
|
776
799
|
tags: ""
|
|
777
|
-
}),
|
|
778
|
-
var
|
|
779
|
-
return (
|
|
780
|
-
}),
|
|
781
|
-
var
|
|
782
|
-
|
|
783
|
-
},
|
|
784
|
-
t("loading",
|
|
785
|
-
},
|
|
786
|
-
t("error",
|
|
787
|
-
},
|
|
788
|
-
var g,
|
|
789
|
-
p.fields.username = ((g =
|
|
790
|
-
const
|
|
791
|
-
p.fields.tags = (
|
|
792
|
-
}, Q = w(() =>
|
|
793
|
-
var g,
|
|
794
|
-
let
|
|
795
|
-
return ((
|
|
796
|
-
},
|
|
797
|
-
var
|
|
800
|
+
}), J = w(() => {
|
|
801
|
+
var i, r;
|
|
802
|
+
return (r = Y.form[(i = a.config) == null ? void 0 : i.app]) == null ? void 0 : r.edit;
|
|
803
|
+
}), N = () => {
|
|
804
|
+
var i;
|
|
805
|
+
E.push(((i = a.config) == null ? void 0 : i.cancelRoute) || { name: "consumer-list" });
|
|
806
|
+
}, U = (i) => {
|
|
807
|
+
t("loading", i);
|
|
808
|
+
}, se = (i) => {
|
|
809
|
+
t("error", i);
|
|
810
|
+
}, j = (i) => {
|
|
811
|
+
var g, T, h;
|
|
812
|
+
p.fields.username = ((g = i == null ? void 0 : i.item) == null ? void 0 : g.username) || (i == null ? void 0 : i.username) || "", p.fields.customId = ((T = i == null ? void 0 : i.item) == null ? void 0 : T.custom_id) || (i == null ? void 0 : i.custom_id) || "";
|
|
813
|
+
const r = ((h = i == null ? void 0 : i.item) == null ? void 0 : h.tags) || (i == null ? void 0 : i.tags) || [];
|
|
814
|
+
p.fields.tags = (r == null ? void 0 : r.join(", ")) || "", Object.assign(X, p.fields);
|
|
815
|
+
}, Q = w(() => a.consumerId ? Ae.Edit : Ae.Create), K = (i) => {
|
|
816
|
+
var g, T, h, u, b, v;
|
|
817
|
+
let r = `${(g = a.config) == null ? void 0 : g.apiBaseUrl}${Y.form[(T = a.config) == null ? void 0 : T.app][i]}`;
|
|
818
|
+
return ((h = a.config) == null ? void 0 : h.app) === "konnect" ? r = r.replace(/{controlPlaneId}/gi, ((u = a.config) == null ? void 0 : u.controlPlaneId) || "") : ((b = a.config) == null ? void 0 : b.app) === "kongManager" && (r = r.replace(/\/{workspace}/gi, (v = a.config) != null && v.workspace ? `/${a.config.workspace}` : "")), r = r.replace(/{id}/gi, a.consumerId), r;
|
|
819
|
+
}, ne = w(() => !!p.fields.username || !!p.fields.customId), k = w(() => JSON.stringify(p.fields) !== JSON.stringify(X)), D = w(() => {
|
|
820
|
+
var i, r;
|
|
798
821
|
return {
|
|
799
822
|
username: p.fields.username || null,
|
|
800
823
|
custom_id: p.fields.customId || null,
|
|
801
|
-
tags: (
|
|
824
|
+
tags: (r = (i = p.fields.tags.split(",")) == null ? void 0 : i.map((g) => String(g || "").trim())) == null ? void 0 : r.filter((g) => g !== "")
|
|
802
825
|
};
|
|
803
|
-
}),
|
|
804
|
-
var
|
|
826
|
+
}), R = async () => {
|
|
827
|
+
var i;
|
|
805
828
|
try {
|
|
806
829
|
p.readonly = !0;
|
|
807
|
-
let
|
|
808
|
-
await G.post(K("validate"),
|
|
809
|
-
} catch (
|
|
810
|
-
p.errorMessage =
|
|
830
|
+
let r;
|
|
831
|
+
await G.post(K("validate"), D.value), Q.value === "create" ? r = await G.post(K("create"), D.value) : Q.value === "edit" && (r = ((i = a.config) == null ? void 0 : i.app) === "konnect" ? await G.put(K("edit"), D.value) : await G.patch(K("edit"), D.value)), j(r == null ? void 0 : r.data), t("update", r == null ? void 0 : r.data);
|
|
832
|
+
} catch (r) {
|
|
833
|
+
p.errorMessage = V(r), t("error", r);
|
|
811
834
|
} finally {
|
|
812
835
|
p.readonly = !1;
|
|
813
836
|
}
|
|
814
837
|
};
|
|
815
|
-
return (
|
|
816
|
-
const g =
|
|
817
|
-
return
|
|
818
|
-
c(o(
|
|
819
|
-
"can-submit":
|
|
838
|
+
return (i, r) => {
|
|
839
|
+
const g = O("KInput"), T = O("KCard");
|
|
840
|
+
return x(), H("div", Ft, [
|
|
841
|
+
c(o(mt), {
|
|
842
|
+
"can-submit": ne.value && k.value,
|
|
820
843
|
config: e.config,
|
|
821
844
|
"edit-id": e.consumerId,
|
|
822
|
-
"entity-type": o(
|
|
845
|
+
"entity-type": o(Te).Consumer,
|
|
823
846
|
"error-message": p.errorMessage,
|
|
824
|
-
"fetch-url":
|
|
825
|
-
"form-fields":
|
|
847
|
+
"fetch-url": J.value,
|
|
848
|
+
"form-fields": D.value,
|
|
826
849
|
"is-readonly": p.readonly,
|
|
827
|
-
onCancel:
|
|
828
|
-
"onFetch:error":
|
|
829
|
-
"onFetch:success":
|
|
830
|
-
onLoading:
|
|
831
|
-
onSubmit:
|
|
850
|
+
onCancel: N,
|
|
851
|
+
"onFetch:error": r[3] || (r[3] = (h) => se(h)),
|
|
852
|
+
"onFetch:success": j,
|
|
853
|
+
onLoading: r[4] || (r[4] = (h) => U(h)),
|
|
854
|
+
onSubmit: R
|
|
832
855
|
}, {
|
|
833
856
|
default: l(() => [
|
|
834
857
|
_("div", null, [
|
|
835
|
-
c(o(
|
|
858
|
+
c(o(pt), {
|
|
836
859
|
description: o(n)("consumers.form.info.description"),
|
|
837
860
|
"has-divider": "",
|
|
838
861
|
title: o(n)("consumers.form.info.title")
|
|
@@ -840,19 +863,19 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
840
863
|
default: l(() => [
|
|
841
864
|
_("div", null, [
|
|
842
865
|
_("h3", {
|
|
843
|
-
id: `fields-group-title-${o(
|
|
866
|
+
id: `fields-group-title-${o(P)}`,
|
|
844
867
|
class: "fields-group-title"
|
|
845
|
-
}, C(o(n)("consumers.form.consumer_identification.title")) + "* ", 9,
|
|
868
|
+
}, C(o(n)("consumers.form.consumer_identification.title")) + "* ", 9, Bt),
|
|
846
869
|
_("p", Pt, C(o(n)("consumers.form.consumer_identification.description")), 1)
|
|
847
870
|
]),
|
|
848
|
-
c(
|
|
871
|
+
c(T, null, {
|
|
849
872
|
default: l(() => [
|
|
850
873
|
_("fieldset", {
|
|
851
|
-
"aria-labelledby": `fields-group-title-${o(
|
|
874
|
+
"aria-labelledby": `fields-group-title-${o(P)}`
|
|
852
875
|
}, [
|
|
853
876
|
c(g, {
|
|
854
877
|
modelValue: p.fields.username,
|
|
855
|
-
"onUpdate:modelValue":
|
|
878
|
+
"onUpdate:modelValue": r[0] || (r[0] = (h) => p.fields.username = h),
|
|
856
879
|
modelModifiers: { trim: !0 },
|
|
857
880
|
autocomplete: "off",
|
|
858
881
|
class: "username-field",
|
|
@@ -864,7 +887,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
864
887
|
type: "text"
|
|
865
888
|
}, {
|
|
866
889
|
"label-tooltip": l(() => [
|
|
867
|
-
c(o(
|
|
890
|
+
c(o(A), {
|
|
868
891
|
keypath: "consumers.fields.username.tooltip",
|
|
869
892
|
scope: "global"
|
|
870
893
|
}, {
|
|
@@ -878,7 +901,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
878
901
|
}, 8, ["modelValue", "label", "placeholder", "readonly"]),
|
|
879
902
|
c(g, {
|
|
880
903
|
modelValue: p.fields.customId,
|
|
881
|
-
"onUpdate:modelValue":
|
|
904
|
+
"onUpdate:modelValue": r[1] || (r[1] = (h) => p.fields.customId = h),
|
|
882
905
|
modelModifiers: { trim: !0 },
|
|
883
906
|
autocomplete: "off",
|
|
884
907
|
"data-testid": "consumer-form-custom-id",
|
|
@@ -889,7 +912,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
889
912
|
type: "text"
|
|
890
913
|
}, {
|
|
891
914
|
"label-tooltip": l(() => [
|
|
892
|
-
c(o(
|
|
915
|
+
c(o(A), {
|
|
893
916
|
keypath: "consumers.fields.custom_id.tooltip",
|
|
894
917
|
scope: "global"
|
|
895
918
|
}, {
|
|
@@ -901,13 +924,13 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
901
924
|
]),
|
|
902
925
|
_: 1
|
|
903
926
|
}, 8, ["modelValue", "label", "placeholder", "readonly"])
|
|
904
|
-
], 8,
|
|
927
|
+
], 8, Kt)
|
|
905
928
|
]),
|
|
906
929
|
_: 1
|
|
907
930
|
}),
|
|
908
931
|
c(g, {
|
|
909
932
|
modelValue: p.fields.tags,
|
|
910
|
-
"onUpdate:modelValue":
|
|
933
|
+
"onUpdate:modelValue": r[2] || (r[2] = (h) => p.fields.tags = h),
|
|
911
934
|
modelModifiers: { trim: !0 },
|
|
912
935
|
autocomplete: "off",
|
|
913
936
|
"data-testid": "consumer-form-tags",
|
|
@@ -931,7 +954,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
931
954
|
]);
|
|
932
955
|
};
|
|
933
956
|
}
|
|
934
|
-
}),
|
|
957
|
+
}), zt = /* @__PURE__ */ be(qt, [["__scopeId", "data-v-5580f86e"]]), Ot = { class: "kong-ui-consumer-entity-config-card" }, Wt = /* @__PURE__ */ ce({
|
|
935
958
|
__name: "ConsumerConfigCard",
|
|
936
959
|
props: {
|
|
937
960
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -958,23 +981,23 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
958
981
|
},
|
|
959
982
|
emits: ["loading", "fetch:error", "fetch:success"],
|
|
960
983
|
setup(e) {
|
|
961
|
-
const m = e, { i18n: { t:
|
|
984
|
+
const m = e, { i18n: { t: a }, i18nT: t } = de.useI18n(), A = w(() => Y.form[m.config.app].edit), n = I({
|
|
962
985
|
id: {},
|
|
963
986
|
username: {
|
|
964
|
-
section:
|
|
965
|
-
tooltip:
|
|
987
|
+
section: De.Basic,
|
|
988
|
+
tooltip: a("consumers.fields.username.tooltip"),
|
|
966
989
|
order: 1
|
|
967
990
|
},
|
|
968
991
|
custom_id: {
|
|
969
|
-
section:
|
|
970
|
-
tooltip:
|
|
971
|
-
label:
|
|
992
|
+
section: De.Basic,
|
|
993
|
+
tooltip: a("consumers.fields.custom_id.tooltip"),
|
|
994
|
+
label: a("consumers.fields.custom_id.label"),
|
|
972
995
|
order: 2
|
|
973
996
|
},
|
|
974
997
|
updated_at: {},
|
|
975
998
|
created_at: {},
|
|
976
999
|
tags: {
|
|
977
|
-
tooltip:
|
|
1000
|
+
tooltip: a("consumers.fields.tags.tooltip")
|
|
978
1001
|
},
|
|
979
1002
|
username_lower: {
|
|
980
1003
|
hidden: !0
|
|
@@ -983,17 +1006,17 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
983
1006
|
hidden: !0
|
|
984
1007
|
}
|
|
985
1008
|
});
|
|
986
|
-
return (
|
|
987
|
-
c(o(
|
|
1009
|
+
return (E, G) => (x(), H("div", Ot, [
|
|
1010
|
+
c(o(ft), {
|
|
988
1011
|
config: e.config,
|
|
989
1012
|
"config-card-doc": e.configCardDoc,
|
|
990
1013
|
"config-schema": n.value,
|
|
991
|
-
"entity-type": o(
|
|
992
|
-
"fetch-url":
|
|
1014
|
+
"entity-type": o(Te).Consumer,
|
|
1015
|
+
"fetch-url": A.value,
|
|
993
1016
|
"hide-title": e.hideTitle,
|
|
994
|
-
"onFetch:error": G[0] || (G[0] = (
|
|
995
|
-
"onFetch:success": G[1] || (G[1] = (
|
|
996
|
-
onLoading: G[2] || (G[2] = (
|
|
1017
|
+
"onFetch:error": G[0] || (G[0] = (V) => E.$emit("fetch:error", V)),
|
|
1018
|
+
"onFetch:success": G[1] || (G[1] = (V) => E.$emit("fetch:success", V)),
|
|
1019
|
+
onLoading: G[2] || (G[2] = (V) => E.$emit("loading", V))
|
|
997
1020
|
}, {
|
|
998
1021
|
"username-label-tooltip": l(() => [
|
|
999
1022
|
c(o(t), {
|
|
@@ -1001,7 +1024,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
1001
1024
|
scope: "global"
|
|
1002
1025
|
}, {
|
|
1003
1026
|
custom_id: l(() => [
|
|
1004
|
-
_("code", null, C(o(
|
|
1027
|
+
_("code", null, C(o(a)("consumers.fields.username.custom_id")), 1)
|
|
1005
1028
|
]),
|
|
1006
1029
|
_: 1
|
|
1007
1030
|
})
|
|
@@ -1012,7 +1035,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
1012
1035
|
scope: "global"
|
|
1013
1036
|
}, {
|
|
1014
1037
|
username: l(() => [
|
|
1015
|
-
_("code", null, C(o(
|
|
1038
|
+
_("code", null, C(o(a)("consumers.fields.custom_id.username")), 1)
|
|
1016
1039
|
]),
|
|
1017
1040
|
_: 1
|
|
1018
1041
|
})
|
|
@@ -1023,7 +1046,7 @@ const Ut = { class: "kong-ui-entities-consumer-form" }, Ft = ["id"], Pt = { clas
|
|
|
1023
1046
|
}
|
|
1024
1047
|
});
|
|
1025
1048
|
export {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1049
|
+
Wt as ConsumerConfigCard,
|
|
1050
|
+
zt as ConsumerForm,
|
|
1051
|
+
Qt as ConsumerList
|
|
1029
1052
|
};
|