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