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