@kong-ui-public/entities-consumers 4.6.3 → 4.7.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.
- package/dist/entities-consumers.es.js +380 -377
- package/dist/entities-consumers.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/ConsumerList.vue.d.ts.map +1 -1
- package/dist/types/consumers-endpoints.d.ts +1 -0
- package/dist/types/consumers-endpoints.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { defineComponent as ae, ref as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { BookIcon as
|
|
4
|
-
import { createI18n as
|
|
5
|
-
import { useAxios as
|
|
6
|
-
const
|
|
7
|
-
consumers:
|
|
1
|
+
import { defineComponent as ae, ref as y, computed as h, watch as ve, resolveComponent as P, openBlock as E, createBlock as z, unref as o, withCtx as a, createElementVNode as b, toDisplayString as p, createVNode as i, createElementBlock as O, createCommentVNode as j, Fragment as Je, renderList as Qe, onBeforeMount as We, createSlots as ge, createTextVNode as N, Teleport as ze, renderSlot as Ee, reactive as Se } from "vue";
|
|
2
|
+
import { useRouter as Fe } from "vue-router";
|
|
3
|
+
import { BookIcon as Ge, AddIcon as Me, TeamIcon as Ye } from "@kong/icons";
|
|
4
|
+
import { createI18n as Xe, i18nTComponent as Ze } from "@kong-ui-public/i18n";
|
|
5
|
+
import { useAxios as ye, useDebouncedFilter as et, useTableState as tt, useFetcher as ot, useDeleteUrlBuilder as st, FetcherStatus as nt, EntityBaseTable as rt, PermissionsWrapper as re, TableTags as at, EntityFilter as it, EntityDeleteModal as lt, EntityTypes as ct, useErrors as ut, EntityBaseFormType as xe, EntityBaseForm as dt, SupportedEntityType as De, EntityFormSection as mt, ConfigurationSchemaSection as Ae, EntityBaseConfigCard as pt } from "@kong-ui-public/entities-shared";
|
|
6
|
+
const ft = { list: { table_headers: { username: "Username", custom_id: "Custom ID", tags: "Tags", id: "ID" }, empty_state: { title: "Configure a new consumer", description: "Consumers are the end users of a service.", title_for_consumer_group: "Configure a new consumer" }, empty_state_v2: { title: "Configure your first consumer", group: "Consumers created in gateways within this group will automatically appear here.", description: "Consumers represent users or apps accessing your APIs, allowing for tailored authentication and individual access control.", learn_more: "Learn more" }, toolbar_actions: { new_consumer: "New consumer" } }, title: "Consumers", search: { placeholder: { konnect: "Filter by name", kongManager: "Filter by exact username or ID" } }, actions: { add_consumer: "Add consumer", create: "New consumer", copy_id: "Copy ID", copy_json: "Copy JSON", edit: "Edit", delete: "Delete", remove: "Remove", view: "View details" }, delete: { title: "Delete a consumer", description: "Deleting this consumer will also remove this consumer from any associated consumer group and delete all its plugins. This action cannot be reversed." }, consumer_groups: { add: { title: "Add consumers", ctaText: "Add consumers to this group", consumers_label: "Consumers", consumer_placeholder: "Add consumer", footer: "Search by exact name or ID to find consumers not included in the list" }, remove: { title: "Remove a consumer", confirmation: "Are you sure you want to remove this consumer {consumer} from consumer group {consumerGroup}?", confirmationNoCG: "Are you sure you want to remove this consumer {consumer} from this consumer group?", description: "Removing this consumer from the group could change the rate limit policy applied to this consumer." } }, errors: { general: "Consumers could not be retrieved", delete: "The consumer could not be deleted at this time.", copy: "Failed to copy to clipboard", add: "Some consumers could not be added at this time.", already_added: "This consumer has already been added to the consumer group" }, copy: { success: "Copied {val} to clipboard", success_brief: "Successfully copied to clipboard" }, form: { title: "Consumer identification", info: { title: "General information", description: "General information will help identify and manage added consumer." }, consumer_identification: { title: "Consumer identification", description: "A consumer can have both unique username and unique custom ID or one of them." } }, fields: { username: { label: "Username", placeholder: "Enter a unique username", tooltip: "The unique username of the consumer. You must send either this field or {custom_id} with the request.", custom_id: "custom_id" }, custom_id: { label: "Custom ID", placeholder: "Enter a unique custom ID", tooltip: "Field for storing an existing unique ID for the consumer - useful for mapping Kong with users in your existing database. You must send either this field or {username} with the request.", username: "username" }, tags: { label: "Tags", placeholder: "Enter a list of tags separated by comma", help: "e.g. tag1, tag2, tag3", tooltip: "An optional set of strings associated with the consumer for grouping and filtering." } } }, gt = {
|
|
7
|
+
consumers: ft
|
|
8
8
|
};
|
|
9
|
-
function
|
|
10
|
-
const e =
|
|
9
|
+
function vt() {
|
|
10
|
+
const e = Xe("en-us", gt);
|
|
11
11
|
return {
|
|
12
12
|
i18n: e,
|
|
13
|
-
i18nT:
|
|
13
|
+
i18nT: Ze(e)
|
|
14
14
|
// Translation component <i18n-t>
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
const ie = {
|
|
18
|
-
useI18n:
|
|
19
|
-
},
|
|
18
|
+
useI18n: vt
|
|
19
|
+
}, X = "/v2/control-planes/{controlPlaneId}/core-entities/{workspace}", oe = "/{workspace}", L = {
|
|
20
20
|
list: {
|
|
21
21
|
konnect: {
|
|
22
|
-
all: `${
|
|
23
|
-
forConsumerGroup: `${
|
|
24
|
-
oneForConsumerGroup: `${
|
|
22
|
+
all: `${X}/consumers`,
|
|
23
|
+
forConsumerGroup: `${X}/consumer_groups/{consumerGroupId}/consumers`,
|
|
24
|
+
oneForConsumerGroup: `${X}/consumer_groups/{consumerGroupId}/consumers/{consumerId}`,
|
|
25
|
+
search: `${X}/consumers/search`
|
|
25
26
|
},
|
|
26
27
|
kongManager: {
|
|
27
28
|
all: `${oe}/consumers`,
|
|
@@ -31,21 +32,21 @@ const ie = {
|
|
|
31
32
|
},
|
|
32
33
|
form: {
|
|
33
34
|
konnect: {
|
|
34
|
-
create: `${
|
|
35
|
-
edit: `${
|
|
35
|
+
create: `${X}/consumers`,
|
|
36
|
+
edit: `${X}/consumers/{id}`
|
|
36
37
|
},
|
|
37
38
|
kongManager: {
|
|
38
39
|
create: `${oe}/consumers`,
|
|
39
40
|
edit: `${oe}/consumers/{id}`
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
+
}, yt = { class: "add-consumer-form-container" }, ht = { class: "add-consumer-form-cta" }, bt = { class: "select-item-label" }, _t = {
|
|
43
44
|
key: 0,
|
|
44
45
|
class: "select-item-desc"
|
|
45
|
-
},
|
|
46
|
+
}, Ct = {
|
|
46
47
|
key: 0,
|
|
47
48
|
class: "kong-ui-entity-add-consumers-error"
|
|
48
|
-
},
|
|
49
|
+
}, kt = { key: 0 }, It = /* @__PURE__ */ ae({
|
|
49
50
|
__name: "AddConsumerModal",
|
|
50
51
|
props: {
|
|
51
52
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -61,129 +62,129 @@ const ie = {
|
|
|
61
62
|
},
|
|
62
63
|
emits: ["cancel", "add:success", "add:partial-success", "error"],
|
|
63
64
|
setup(e, { emit: c }) {
|
|
64
|
-
const { i18n: { t: r } } = ie.useI18n(),
|
|
65
|
-
debouncedQueryChange:
|
|
66
|
-
loading:
|
|
67
|
-
allRecords:
|
|
68
|
-
error:
|
|
69
|
-
loadItems:
|
|
65
|
+
const { i18n: { t: r } } = ie.useI18n(), t = e, S = c, { axiosInstance: n } = ye(t.config?.axiosRequestConfig), C = y([]), {
|
|
66
|
+
debouncedQueryChange: $,
|
|
67
|
+
loading: x,
|
|
68
|
+
allRecords: T,
|
|
69
|
+
error: u,
|
|
70
|
+
loadItems: Y,
|
|
70
71
|
results: H
|
|
71
|
-
} =
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
} = et(
|
|
73
|
+
t.config,
|
|
74
|
+
L.list[t.config.app].all,
|
|
74
75
|
"",
|
|
75
76
|
{
|
|
76
77
|
fetchedItemsKey: "data",
|
|
77
78
|
searchKeys: ["username", "id"]
|
|
78
79
|
}
|
|
79
|
-
),
|
|
80
|
-
label:
|
|
81
|
-
value:
|
|
82
|
-
selected:
|
|
83
|
-
data:
|
|
80
|
+
), K = (d) => d, J = h(() => u.value ? r("consumers.errors.general") : ""), Z = y(0), G = h(() => T.value === void 0), Q = h(() => H.value.map((d) => ({
|
|
81
|
+
label: d.username || d.customId,
|
|
82
|
+
value: d.id,
|
|
83
|
+
selected: C.value.includes(d.id),
|
|
84
|
+
data: d
|
|
84
85
|
// we need this to determine whether or not to show the description text
|
|
85
|
-
}))),
|
|
86
|
-
const
|
|
87
|
-
return
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
if (!
|
|
92
|
-
|
|
86
|
+
}))), U = (d) => {
|
|
87
|
+
const w = G.value ? H.value.find((_) => _.id === d) : T.value?.find((_) => _.id === d);
|
|
88
|
+
return w ? w.username || w.custom_id : d;
|
|
89
|
+
}, ee = () => {
|
|
90
|
+
A.value = "", F.value = [], I.value = [], S("cancel");
|
|
91
|
+
}, F = y([]), g = y(!1), A = y(""), l = async () => {
|
|
92
|
+
if (!C.value.length) {
|
|
93
|
+
A.value = "", I.value = [], S("cancel");
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
+
g.value = !0, A.value = "", F.value = [], I.value = [];
|
|
96
97
|
try {
|
|
97
|
-
const
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}),
|
|
98
|
+
const d = C.value.map((D) => W(D)), w = await Promise.allSettled(d);
|
|
99
|
+
let _ = !0;
|
|
100
|
+
w.forEach((D) => {
|
|
101
|
+
D.status !== "fulfilled" && (_ = !1);
|
|
102
|
+
}), _ ? (F.value = [], I.value = [], S("add:success", C.value), C.value = []) : (F.value.length && S("add:partial-success", F.value), C.value = [], M(w));
|
|
102
103
|
} catch {
|
|
103
|
-
|
|
104
|
+
A.value = r("consumers.errors.add"), S("error", A.value);
|
|
104
105
|
} finally {
|
|
105
|
-
|
|
106
|
+
g.value = !1;
|
|
106
107
|
}
|
|
107
|
-
},
|
|
108
|
-
let
|
|
109
|
-
return
|
|
110
|
-
}), W = async (
|
|
111
|
-
const
|
|
112
|
-
consumer:
|
|
108
|
+
}, v = h(() => {
|
|
109
|
+
let d = `${t.config.apiBaseUrl}${L.list[t.config.app].forConsumerGroup}`;
|
|
110
|
+
return t.config.app === "konnect" && (d = d.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), d.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, t.config?.consumerGroupId || "");
|
|
111
|
+
}), W = async (d) => {
|
|
112
|
+
const w = {
|
|
113
|
+
consumer: d
|
|
113
114
|
};
|
|
114
115
|
try {
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
-
} catch (
|
|
118
|
-
let
|
|
119
|
-
return
|
|
116
|
+
const _ = await n.post(v.value, w);
|
|
117
|
+
return F.value.push(d), _;
|
|
118
|
+
} catch (_) {
|
|
119
|
+
let D = `${U(d)} - ${_.message}`;
|
|
120
|
+
return _.response.status === 409 && (D = `${U(d)} - ${r("consumers.errors.already_added")}`), Promise.reject(Error(D));
|
|
120
121
|
}
|
|
121
|
-
},
|
|
122
|
-
|
|
122
|
+
}, I = y([]), M = (d) => {
|
|
123
|
+
I.value = d.map((w) => w.reason?.message).filter(Boolean);
|
|
123
124
|
};
|
|
124
|
-
return
|
|
125
|
+
return ve(Q, () => {
|
|
125
126
|
Z.value++;
|
|
126
|
-
}, { immediate: !0, deep: !0 }),
|
|
127
|
-
|
|
128
|
-
}, { immediate: !0 }), (
|
|
129
|
-
const
|
|
130
|
-
return
|
|
131
|
-
"action-button-disabled":
|
|
127
|
+
}, { immediate: !0, deep: !0 }), ve(() => t.visible, () => {
|
|
128
|
+
t.visible && Y();
|
|
129
|
+
}, { immediate: !0 }), (d, w) => {
|
|
130
|
+
const _ = P("KMultiselect"), D = P("KAlert"), le = P("KPrompt");
|
|
131
|
+
return E(), z(le, {
|
|
132
|
+
"action-button-disabled": g.value,
|
|
132
133
|
class: "kong-ui-entities-add-consumers-modal",
|
|
133
134
|
"data-testid": "add-consumer-modal",
|
|
134
|
-
title:
|
|
135
|
+
title: o(r)("consumers.consumer_groups.add.title"),
|
|
135
136
|
visible: e.visible,
|
|
136
|
-
onCancel:
|
|
137
|
-
onProceed:
|
|
137
|
+
onCancel: ee,
|
|
138
|
+
onProceed: l
|
|
138
139
|
}, {
|
|
139
140
|
default: a(() => [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
i(
|
|
143
|
-
modelValue:
|
|
144
|
-
"onUpdate:modelValue":
|
|
141
|
+
b("div", yt, [
|
|
142
|
+
b("p", ht, p(o(r)("consumers.consumer_groups.add.ctaText")), 1),
|
|
143
|
+
i(_, {
|
|
144
|
+
modelValue: C.value,
|
|
145
|
+
"onUpdate:modelValue": w[0] || (w[0] = (R) => C.value = R),
|
|
145
146
|
autosuggest: "",
|
|
146
147
|
"data-testid": "add-consumers-multiselect",
|
|
147
|
-
"dropdown-footer-text":
|
|
148
|
+
"dropdown-footer-text": G.value ? o(r)("consumers.consumer_groups.add.footer") : void 0,
|
|
148
149
|
items: Q.value,
|
|
149
|
-
label:
|
|
150
|
-
loading:
|
|
151
|
-
placeholder:
|
|
152
|
-
readonly:
|
|
150
|
+
label: o(r)("consumers.consumer_groups.add.consumers_label"),
|
|
151
|
+
loading: o(x),
|
|
152
|
+
placeholder: o(r)("consumers.consumer_groups.add.consumer_placeholder"),
|
|
153
|
+
readonly: g.value,
|
|
153
154
|
required: "",
|
|
154
155
|
width: "100%",
|
|
155
|
-
onQueryChange:
|
|
156
|
+
onQueryChange: o($)
|
|
156
157
|
}, {
|
|
157
|
-
"item-template": a(({ item:
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
"item-template": a(({ item: R }) => [
|
|
159
|
+
b("div", bt, p(R.label), 1),
|
|
160
|
+
K(R).data.username && K(R).data.custom_id ? (E(), O("div", _t, p(K(R).data.custom_id), 1)) : j("", !0)
|
|
160
161
|
]),
|
|
161
162
|
_: 1
|
|
162
163
|
}, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"]),
|
|
163
|
-
|
|
164
|
-
i(
|
|
164
|
+
A.value || J.value || I.value.length ? (E(), O("div", Ct, [
|
|
165
|
+
i(D, { appearance: "danger" }, {
|
|
165
166
|
default: a(() => [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
(
|
|
169
|
-
])) :
|
|
170
|
-
|
|
167
|
+
b("p", null, p(o(r)("consumers.errors.add")), 1),
|
|
168
|
+
I.value.length ? (E(), O("ul", kt, [
|
|
169
|
+
(E(!0), O(Je, null, Qe(I.value, (R, ce) => (E(), O("li", { key: ce }, p(R), 1))), 128))
|
|
170
|
+
])) : j("", !0),
|
|
171
|
+
b("div", null, p(A.value || J.value), 1)
|
|
171
172
|
]),
|
|
172
173
|
_: 1
|
|
173
174
|
})
|
|
174
|
-
])) :
|
|
175
|
+
])) : j("", !0)
|
|
175
176
|
])
|
|
176
177
|
]),
|
|
177
178
|
_: 1
|
|
178
179
|
}, 8, ["action-button-disabled", "title", "visible"]);
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
|
-
}),
|
|
182
|
+
}), he = (e, c) => {
|
|
182
183
|
const r = e.__vccOpts || e;
|
|
183
|
-
for (const [
|
|
184
|
-
r[
|
|
184
|
+
for (const [t, S] of c)
|
|
185
|
+
r[t] = S;
|
|
185
186
|
return r;
|
|
186
|
-
},
|
|
187
|
+
}, wt = /* @__PURE__ */ he(It, [["__scopeId", "data-v-ee085540"]]), $t = { class: "kong-ui-entities-consumers-list" }, Et = { class: "button-row" }, St = { class: "empty-state-wrapper" }, Gt = /* @__PURE__ */ ae({
|
|
187
188
|
__name: "ConsumerList",
|
|
188
189
|
props: {
|
|
189
190
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -229,44 +230,46 @@ const ie = {
|
|
|
229
230
|
},
|
|
230
231
|
emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "add:success", "remove:success"],
|
|
231
232
|
setup(e, { emit: c }) {
|
|
232
|
-
const r = c,
|
|
233
|
+
const r = c, t = e, { i18nT: S, i18n: { t: n } } = ie.useI18n(), C = Fe(), { axiosInstance: $ } = ye(t.config?.axiosRequestConfig), x = h(() => t.config.app !== "kongManager" || !!t.config.disableSorting), T = {
|
|
233
234
|
// the Username column is non-hidable
|
|
234
235
|
username: { label: n("consumers.list.table_headers.username"), searchable: !0, sortable: !0, hidable: !1 },
|
|
235
236
|
custom_id: { label: n("consumers.list.table_headers.custom_id"), searchable: !0, sortable: !0 },
|
|
236
237
|
tags: { label: n("consumers.list.table_headers.tags"), sortable: !1 }
|
|
237
|
-
},
|
|
238
|
+
}, u = T, Y = (s) => ({
|
|
238
239
|
"data-testid": s.username ?? s.custom_id ?? s.id
|
|
239
240
|
}), H = () => {
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
let
|
|
243
|
-
return
|
|
244
|
-
}
|
|
245
|
-
|
|
241
|
+
t.config.consumerGroupId ? _e() : C.push(t.config.createRoute);
|
|
242
|
+
}, K = (s) => {
|
|
243
|
+
let f = `${t.config.apiBaseUrl}${s}`;
|
|
244
|
+
return t.config.app === "konnect" && (f = f.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), f.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, t.config?.consumerGroupId || "");
|
|
245
|
+
}, J = h(() => K(
|
|
246
|
+
L.list[t.config.app][g.value ? "forConsumerGroup" : "all"]
|
|
247
|
+
)), Z = h(() => t.config.app === "konnect" && t.config.workspace && G.value ? K(L.list.konnect.search) : J.value), G = y(""), Q = h(() => {
|
|
248
|
+
const s = t.config.app === "konnect" || t.config.isExactMatch;
|
|
246
249
|
return s ? {
|
|
247
250
|
isExactMatch: s,
|
|
248
|
-
placeholder: n(`consumers.search.placeholder.${
|
|
251
|
+
placeholder: n(`consumers.search.placeholder.${t.config.app}`)
|
|
249
252
|
} : {
|
|
250
253
|
isExactMatch: s,
|
|
251
254
|
fields: {
|
|
252
|
-
username:
|
|
253
|
-
custom_id:
|
|
255
|
+
username: T.username,
|
|
256
|
+
custom_id: T.custom_id
|
|
254
257
|
},
|
|
255
|
-
schema:
|
|
258
|
+
schema: t.config.filterSchema
|
|
256
259
|
};
|
|
257
|
-
}), { hasRecords:
|
|
258
|
-
() =>
|
|
259
|
-
),
|
|
260
|
-
fetcher:
|
|
261
|
-
fetcherState:
|
|
262
|
-
fetcherCacheKey:
|
|
263
|
-
} =
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
},
|
|
268
|
-
const
|
|
269
|
-
if (!await
|
|
260
|
+
}), { hasRecords: U, handleStateChange: ee } = tt(G), F = h(() => U.value && t.config.app === "konnect"), g = h(() => !!t.config.consumerGroupId), A = h(
|
|
261
|
+
() => g.value ? "kong-ui-entities-consumers-list-in-group-page" : "kong-ui-entities-consumers-list"
|
|
262
|
+
), l = h(() => g.value && !t.config.paginatedEndpoint ? "consumers" : void 0), {
|
|
263
|
+
fetcher: v,
|
|
264
|
+
fetcherState: W,
|
|
265
|
+
fetcherCacheKey: I
|
|
266
|
+
} = ot(h(() => ({ ...t.config, cacheIdentifier: t.cacheIdentifier })), Z, l), M = () => {
|
|
267
|
+
G.value = "";
|
|
268
|
+
}, d = () => {
|
|
269
|
+
I.value++;
|
|
270
|
+
}, w = (s) => s ?? "-", _ = y(null), D = async (s, f) => {
|
|
271
|
+
const B = s.id;
|
|
272
|
+
if (!await f(B)) {
|
|
270
273
|
r("copy:error", {
|
|
271
274
|
entity: s,
|
|
272
275
|
field: "id",
|
|
@@ -277,11 +280,11 @@ const ie = {
|
|
|
277
280
|
r("copy:success", {
|
|
278
281
|
entity: s,
|
|
279
282
|
field: "id",
|
|
280
|
-
message: n("consumers.copy.success", { val:
|
|
283
|
+
message: n("consumers.copy.success", { val: B })
|
|
281
284
|
});
|
|
282
|
-
},
|
|
283
|
-
const
|
|
284
|
-
if (!
|
|
285
|
+
}, le = (s, f) => {
|
|
286
|
+
const B = JSON.stringify(s);
|
|
287
|
+
if (!f(B)) {
|
|
285
288
|
r("copy:error", {
|
|
286
289
|
entity: s,
|
|
287
290
|
message: n("consumers.errors.copy")
|
|
@@ -292,138 +295,138 @@ const ie = {
|
|
|
292
295
|
entity: s,
|
|
293
296
|
message: n("consumers.copy.success_brief")
|
|
294
297
|
});
|
|
295
|
-
},
|
|
296
|
-
await
|
|
297
|
-
},
|
|
298
|
+
}, R = async (s) => {
|
|
299
|
+
await t.canRetrieve?.(s) && C.push(t.config.getViewRoute(s.id));
|
|
300
|
+
}, ce = (s) => ({
|
|
298
301
|
label: n("consumers.actions.view"),
|
|
299
|
-
to:
|
|
300
|
-
}),
|
|
302
|
+
to: t.config.getViewRoute(s)
|
|
303
|
+
}), Re = (s) => ({
|
|
301
304
|
label: n("consumers.actions.edit"),
|
|
302
|
-
to:
|
|
303
|
-
}),
|
|
304
|
-
|
|
305
|
-
},
|
|
305
|
+
to: t.config.getEditRoute(s)
|
|
306
|
+
}), q = y(void 0), se = y(!1), ne = y(!1), be = y(""), Pe = st(t.config, J.value), Te = (s) => {
|
|
307
|
+
q.value = s, se.value = !0;
|
|
308
|
+
}, Ve = () => {
|
|
306
309
|
se.value = !1;
|
|
307
|
-
},
|
|
308
|
-
if (
|
|
310
|
+
}, Be = async () => {
|
|
311
|
+
if (q.value?.id) {
|
|
309
312
|
ne.value = !0;
|
|
310
313
|
try {
|
|
311
|
-
await
|
|
314
|
+
await $.delete(Pe(q.value.id)), ne.value = !1, se.value = !1, I.value++, r("delete:success", q.value);
|
|
312
315
|
} catch (s) {
|
|
313
|
-
|
|
316
|
+
be.value = s.response?.data?.message || s.message || n("consumers.errors.delete"), r("error", s);
|
|
314
317
|
} finally {
|
|
315
318
|
ne.value = !1;
|
|
316
319
|
}
|
|
317
320
|
}
|
|
318
|
-
}, ue =
|
|
321
|
+
}, ue = y(!1), _e = () => {
|
|
319
322
|
ue.value = !0;
|
|
320
|
-
},
|
|
323
|
+
}, Ce = () => {
|
|
321
324
|
ue.value = !1;
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
},
|
|
329
|
-
|
|
330
|
-
},
|
|
331
|
-
let s = `${
|
|
332
|
-
return
|
|
333
|
-
}),
|
|
334
|
-
if (
|
|
335
|
-
|
|
325
|
+
}, ke = (s, f) => {
|
|
326
|
+
f || Ce(), I.value++, r("add:success", s);
|
|
327
|
+
}, Ke = () => {
|
|
328
|
+
g.value && _e();
|
|
329
|
+
}, V = y(void 0), de = y(!1), Ue = y(""), qe = (s) => {
|
|
330
|
+
V.value = s, de.value = !0;
|
|
331
|
+
}, Ie = () => {
|
|
332
|
+
de.value = !1, V.value = void 0;
|
|
333
|
+
}, Ne = h(() => {
|
|
334
|
+
let s = `${t.config.apiBaseUrl}${L.list[t.config.app].oneForConsumerGroup}`;
|
|
335
|
+
return t.config.app === "konnect" && (s = s.replace(/{controlPlaneId}/gi, t.config?.controlPlaneId || "")), s.replace(/\/{workspace}/gi, t.config?.workspace ? `/${t.config.workspace}` : "").replace(/{consumerGroupId}/gi, t.config?.consumerGroupId || "");
|
|
336
|
+
}), we = y(!1), Oe = async () => {
|
|
337
|
+
if (V.value) {
|
|
338
|
+
we.value = !0;
|
|
336
339
|
try {
|
|
337
|
-
const s =
|
|
338
|
-
await
|
|
340
|
+
const s = Ne.value.replace(/{consumerId}/gi, V.value.id);
|
|
341
|
+
await $.delete(s), r("remove:success", V.value), Ie(), I.value++;
|
|
339
342
|
} catch (s) {
|
|
340
|
-
|
|
343
|
+
Ue.value = s.message || n("consumers.errors.delete"), r("error", s);
|
|
341
344
|
} finally {
|
|
342
|
-
|
|
345
|
+
we.value = !1;
|
|
343
346
|
}
|
|
344
347
|
}
|
|
345
348
|
};
|
|
346
|
-
|
|
347
|
-
if (s.status ===
|
|
348
|
-
|
|
349
|
+
ve(W, (s) => {
|
|
350
|
+
if (s.status === nt.Error) {
|
|
351
|
+
_.value = {
|
|
349
352
|
title: n("consumers.errors.general")
|
|
350
|
-
}, s.error?.response?.data?.message && (
|
|
353
|
+
}, s.error?.response?.data?.message && (_.value.message = s.error.response.data.message), r("error", s.error);
|
|
351
354
|
return;
|
|
352
355
|
}
|
|
353
|
-
|
|
356
|
+
_.value = null;
|
|
354
357
|
});
|
|
355
|
-
const
|
|
356
|
-
ctaPath:
|
|
358
|
+
const me = y({
|
|
359
|
+
ctaPath: g.value ? void 0 : t.config.createRoute,
|
|
357
360
|
ctaText: void 0,
|
|
358
|
-
message: `${n("consumers.list.empty_state.description")}${
|
|
361
|
+
message: `${n("consumers.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
|
|
359
362
|
title: n("consumers.title")
|
|
360
|
-
}),
|
|
361
|
-
return
|
|
362
|
-
|
|
363
|
-
}), (s,
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
i(
|
|
363
|
+
}), pe = y(!1);
|
|
364
|
+
return We(async () => {
|
|
365
|
+
pe.value = await t.canCreate(), pe.value && (me.value.title = g.value ? n("consumers.list.empty_state.title_for_consumer_group") : n("consumers.list.empty_state.title"), me.value.ctaText = g.value ? n("consumers.actions.add_consumer") : n("consumers.actions.create"));
|
|
366
|
+
}), (s, f) => {
|
|
367
|
+
const B = P("KButton"), je = P("KEmptyState"), te = P("KDropdownItem"), $e = P("KClipboardProvider"), Le = P("KPrompt");
|
|
368
|
+
return E(), O("div", $t, [
|
|
369
|
+
i(o(rt), {
|
|
367
370
|
"cache-identifier": e.cacheIdentifier,
|
|
368
|
-
"disable-sorting":
|
|
369
|
-
"empty-state-options":
|
|
371
|
+
"disable-sorting": x.value,
|
|
372
|
+
"empty-state-options": me.value,
|
|
370
373
|
"enable-entity-actions": "",
|
|
371
|
-
"error-message":
|
|
372
|
-
fetcher:
|
|
373
|
-
"fetcher-cache-key":
|
|
374
|
-
"hide-pagination":
|
|
374
|
+
"error-message": _.value,
|
|
375
|
+
fetcher: o(v),
|
|
376
|
+
"fetcher-cache-key": o(I),
|
|
377
|
+
"hide-pagination": g.value && !e.config.paginatedEndpoint,
|
|
375
378
|
"pagination-type": "offset",
|
|
376
|
-
"preferences-storage-key":
|
|
377
|
-
query:
|
|
378
|
-
"row-attributes":
|
|
379
|
-
"table-headers":
|
|
380
|
-
onClearSearchInput:
|
|
381
|
-
"onClick:row":
|
|
382
|
-
onEmptyStateCtaClicked:
|
|
383
|
-
onSort:
|
|
384
|
-
onState:
|
|
385
|
-
},
|
|
379
|
+
"preferences-storage-key": A.value,
|
|
380
|
+
query: G.value,
|
|
381
|
+
"row-attributes": Y,
|
|
382
|
+
"table-headers": o(u),
|
|
383
|
+
onClearSearchInput: M,
|
|
384
|
+
"onClick:row": f[3] || (f[3] = (m) => R(m)),
|
|
385
|
+
onEmptyStateCtaClicked: Ke,
|
|
386
|
+
onSort: d,
|
|
387
|
+
onState: o(ee)
|
|
388
|
+
}, ge({
|
|
386
389
|
"toolbar-filter": a(() => [
|
|
387
|
-
|
|
388
|
-
|
|
390
|
+
Ee(s.$slots, "toolbar-filter", {}, void 0, !0),
|
|
391
|
+
g.value ? j("", !0) : (E(), z(o(it), {
|
|
389
392
|
key: 0,
|
|
390
|
-
modelValue:
|
|
391
|
-
"onUpdate:modelValue":
|
|
392
|
-
config:
|
|
393
|
+
modelValue: G.value,
|
|
394
|
+
"onUpdate:modelValue": f[0] || (f[0] = (m) => G.value = m),
|
|
395
|
+
config: Q.value
|
|
393
396
|
}, null, 8, ["modelValue", "config"]))
|
|
394
397
|
]),
|
|
395
398
|
"toolbar-button": a(() => [
|
|
396
|
-
(
|
|
399
|
+
(E(), z(ze, {
|
|
397
400
|
disabled: !e.useActionOutside,
|
|
398
401
|
to: "#kong-ui-app-page-header-action-button"
|
|
399
402
|
}, [
|
|
400
|
-
|
|
401
|
-
!
|
|
403
|
+
b("div", Et, [
|
|
404
|
+
!g.value && F.value ? (E(), z(B, {
|
|
402
405
|
key: 0,
|
|
403
406
|
appearance: "secondary",
|
|
404
407
|
class: "open-learning-hub",
|
|
405
408
|
"data-testid": "consumers-learn-more-button",
|
|
406
409
|
icon: "",
|
|
407
|
-
onClick:
|
|
410
|
+
onClick: f[1] || (f[1] = (m) => s.$emit("click:learn-more"))
|
|
408
411
|
}, {
|
|
409
412
|
default: a(() => [
|
|
410
|
-
i(
|
|
413
|
+
i(o(Ge), { decorative: "" })
|
|
411
414
|
]),
|
|
412
415
|
_: 1
|
|
413
|
-
})) :
|
|
414
|
-
i(
|
|
416
|
+
})) : j("", !0),
|
|
417
|
+
i(o(re), {
|
|
415
418
|
"auth-function": () => e.canCreate()
|
|
416
419
|
}, {
|
|
417
420
|
default: a(() => [
|
|
418
|
-
i(
|
|
421
|
+
i(B, {
|
|
419
422
|
appearance: "primary",
|
|
420
423
|
"data-testid": "toolbar-add-consumer",
|
|
421
424
|
size: e.useActionOutside ? "medium" : "large",
|
|
422
425
|
onClick: H
|
|
423
426
|
}, {
|
|
424
427
|
default: a(() => [
|
|
425
|
-
i(
|
|
426
|
-
|
|
428
|
+
i(o(Me)),
|
|
429
|
+
N(" " + p(e.config.consumerGroupId ? o(n)("consumers.actions.add_consumer") : o(n)("consumers.list.toolbar_actions.new_consumer")), 1)
|
|
427
430
|
]),
|
|
428
431
|
_: 1
|
|
429
432
|
}, 8, ["size"])
|
|
@@ -434,78 +437,78 @@ const ie = {
|
|
|
434
437
|
], 8, ["disabled"]))
|
|
435
438
|
]),
|
|
436
439
|
username: a(({ rowValue: m }) => [
|
|
437
|
-
|
|
440
|
+
b("b", null, p(w(m)), 1)
|
|
438
441
|
]),
|
|
439
442
|
custom_id: a(({ rowValue: m }) => [
|
|
440
|
-
|
|
443
|
+
N(p(w(m)), 1)
|
|
441
444
|
]),
|
|
442
445
|
tags: a(({ rowValue: m }) => [
|
|
443
|
-
i(
|
|
446
|
+
i(o(at), { tags: m }, null, 8, ["tags"])
|
|
444
447
|
]),
|
|
445
448
|
actions: a(({ row: m }) => [
|
|
446
|
-
i(
|
|
447
|
-
default: a(({ copyToClipboard:
|
|
448
|
-
i(
|
|
449
|
+
i($e, null, {
|
|
450
|
+
default: a(({ copyToClipboard: fe }) => [
|
|
451
|
+
i(te, {
|
|
449
452
|
"data-testid": "action-entity-copy-id",
|
|
450
|
-
onClick: (
|
|
453
|
+
onClick: (He) => D(m, fe)
|
|
451
454
|
}, {
|
|
452
455
|
default: a(() => [
|
|
453
|
-
|
|
456
|
+
N(p(o(n)("consumers.actions.copy_id")), 1)
|
|
454
457
|
]),
|
|
455
458
|
_: 1
|
|
456
459
|
}, 8, ["onClick"])
|
|
457
460
|
]),
|
|
458
461
|
_: 2
|
|
459
462
|
}, 1024),
|
|
460
|
-
i(
|
|
461
|
-
default: a(({ copyToClipboard:
|
|
462
|
-
i(
|
|
463
|
+
i($e, null, {
|
|
464
|
+
default: a(({ copyToClipboard: fe }) => [
|
|
465
|
+
i(te, {
|
|
463
466
|
"data-testid": "action-entity-copy-json",
|
|
464
|
-
onClick: (
|
|
467
|
+
onClick: (He) => le(m, fe)
|
|
465
468
|
}, {
|
|
466
469
|
default: a(() => [
|
|
467
|
-
|
|
470
|
+
N(p(o(n)("consumers.actions.copy_json")), 1)
|
|
468
471
|
]),
|
|
469
472
|
_: 1
|
|
470
473
|
}, 8, ["onClick"])
|
|
471
474
|
]),
|
|
472
475
|
_: 2
|
|
473
476
|
}, 1024),
|
|
474
|
-
i(
|
|
477
|
+
i(o(re), {
|
|
475
478
|
"auth-function": () => e.canRetrieve(m)
|
|
476
479
|
}, {
|
|
477
480
|
default: a(() => [
|
|
478
|
-
i(
|
|
481
|
+
i(te, {
|
|
479
482
|
"data-testid": "action-entity-view",
|
|
480
483
|
"has-divider": "",
|
|
481
|
-
item:
|
|
484
|
+
item: ce(m.id)
|
|
482
485
|
}, null, 8, ["item"])
|
|
483
486
|
]),
|
|
484
487
|
_: 2
|
|
485
488
|
}, 1032, ["auth-function"]),
|
|
486
|
-
i(
|
|
489
|
+
i(o(re), {
|
|
487
490
|
"auth-function": () => e.canEdit(m)
|
|
488
491
|
}, {
|
|
489
492
|
default: a(() => [
|
|
490
|
-
i(
|
|
493
|
+
i(te, {
|
|
491
494
|
"data-testid": "action-entity-edit",
|
|
492
|
-
item:
|
|
495
|
+
item: Re(m.id)
|
|
493
496
|
}, null, 8, ["item"])
|
|
494
497
|
]),
|
|
495
498
|
_: 2
|
|
496
499
|
}, 1032, ["auth-function"]),
|
|
497
|
-
i(
|
|
500
|
+
i(o(re), {
|
|
498
501
|
"auth-function": () => e.canDelete(m)
|
|
499
502
|
}, {
|
|
500
503
|
default: a(() => [
|
|
501
|
-
i(
|
|
504
|
+
i(te, {
|
|
502
505
|
danger: "",
|
|
503
506
|
"data-testid": "action-entity-delete",
|
|
504
507
|
"has-divider": "",
|
|
505
|
-
onClick: () => e.config.consumerGroupId ?
|
|
508
|
+
onClick: () => e.config.consumerGroupId ? qe(m) : Te(m)
|
|
506
509
|
}, {
|
|
507
510
|
default: a(() => [
|
|
508
|
-
|
|
511
|
+
N(p(e.config.consumerGroupId ? o(n)("consumers.actions.remove") : o(n)("consumers.actions.delete")), 1)
|
|
509
512
|
]),
|
|
510
513
|
_: 1
|
|
511
514
|
}, 8, ["onClick"])
|
|
@@ -515,40 +518,40 @@ const ie = {
|
|
|
515
518
|
]),
|
|
516
519
|
_: 2
|
|
517
520
|
}, [
|
|
518
|
-
!
|
|
521
|
+
!G.value && e.config.app === "konnect" ? {
|
|
519
522
|
name: "empty-state",
|
|
520
523
|
fn: a(() => [
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
i(
|
|
524
|
+
b("div", St, [
|
|
525
|
+
Ee(s.$slots, "empty-state-toolbar", {}, void 0, !0),
|
|
526
|
+
i(je, {
|
|
524
527
|
"data-testid": e.config.consumerGroupId ? "nested-consumers-entity-empty-state" : "consumers-entity-empty-state",
|
|
525
528
|
"icon-background": "",
|
|
526
|
-
message:
|
|
527
|
-
title:
|
|
528
|
-
},
|
|
529
|
+
message: o(n)("consumers.list.empty_state_v2.description"),
|
|
530
|
+
title: o(n)("consumers.list.empty_state_v2.title")
|
|
531
|
+
}, ge({
|
|
529
532
|
icon: a(() => [
|
|
530
|
-
i(
|
|
533
|
+
i(o(Ye), { decorative: "" })
|
|
531
534
|
]),
|
|
532
535
|
action: a(() => [
|
|
533
|
-
|
|
536
|
+
pe.value ? (E(), z(B, {
|
|
534
537
|
key: 0,
|
|
535
538
|
"data-testid": "entity-create-button",
|
|
536
539
|
onClick: H
|
|
537
540
|
}, {
|
|
538
541
|
default: a(() => [
|
|
539
|
-
i(
|
|
540
|
-
|
|
542
|
+
i(o(Me), { decorative: "" }),
|
|
543
|
+
N(" " + p(o(n)("consumers.list.toolbar_actions.new_consumer")), 1)
|
|
541
544
|
]),
|
|
542
545
|
_: 1
|
|
543
|
-
})) :
|
|
544
|
-
i(
|
|
546
|
+
})) : j("", !0),
|
|
547
|
+
i(B, {
|
|
545
548
|
appearance: "secondary",
|
|
546
549
|
"data-testid": "entity-learn-more-button",
|
|
547
|
-
onClick:
|
|
550
|
+
onClick: f[2] || (f[2] = (m) => s.$emit("click:learn-more"))
|
|
548
551
|
}, {
|
|
549
552
|
default: a(() => [
|
|
550
|
-
i(
|
|
551
|
-
|
|
553
|
+
i(o(Ge), { decorative: "" }),
|
|
554
|
+
N(" " + p(o(n)("consumers.list.empty_state_v2.learn_more")), 1)
|
|
552
555
|
]),
|
|
553
556
|
_: 1
|
|
554
557
|
})
|
|
@@ -558,7 +561,7 @@ const ie = {
|
|
|
558
561
|
e.config?.isControlPlaneGroup ? {
|
|
559
562
|
name: "default",
|
|
560
563
|
fn: a(() => [
|
|
561
|
-
|
|
564
|
+
N(p(o(n)("consumers.list.empty_state_v2.group")), 1)
|
|
562
565
|
]),
|
|
563
566
|
key: "0"
|
|
564
567
|
} : void 0
|
|
@@ -568,83 +571,83 @@ const ie = {
|
|
|
568
571
|
key: "0"
|
|
569
572
|
} : void 0
|
|
570
573
|
]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "hide-pagination", "preferences-storage-key", "query", "table-headers", "onState"]),
|
|
571
|
-
i(
|
|
574
|
+
i(o(lt), {
|
|
572
575
|
"action-button-disabled": ne.value,
|
|
573
576
|
"data-testid": "delete-consumer-modal",
|
|
574
|
-
description:
|
|
575
|
-
"entity-name":
|
|
576
|
-
"entity-type":
|
|
577
|
-
error:
|
|
578
|
-
title:
|
|
577
|
+
description: o(n)("consumers.delete.description"),
|
|
578
|
+
"entity-name": q.value && (q.value.username || q.value.custom_id || q.value.id),
|
|
579
|
+
"entity-type": o(ct).Consumer,
|
|
580
|
+
error: be.value,
|
|
581
|
+
title: o(n)("consumers.delete.title"),
|
|
579
582
|
visible: se.value,
|
|
580
|
-
onCancel:
|
|
581
|
-
onProceed:
|
|
583
|
+
onCancel: Ve,
|
|
584
|
+
onProceed: Be
|
|
582
585
|
}, null, 8, ["action-button-disabled", "description", "entity-name", "entity-type", "error", "title", "visible"]),
|
|
583
|
-
e.config.consumerGroupId ? (
|
|
586
|
+
e.config.consumerGroupId ? (E(), z(wt, {
|
|
584
587
|
key: 0,
|
|
585
588
|
config: e.config,
|
|
586
589
|
"data-testid": "add-consumer-modal",
|
|
587
590
|
visible: ue.value,
|
|
588
|
-
"onAdd:partialSuccess":
|
|
589
|
-
"onAdd:success":
|
|
590
|
-
onCancel:
|
|
591
|
-
}, null, 8, ["config", "visible"])) :
|
|
592
|
-
e.config.consumerGroupId &&
|
|
591
|
+
"onAdd:partialSuccess": f[4] || (f[4] = (m) => ke(m, !0)),
|
|
592
|
+
"onAdd:success": f[5] || (f[5] = (m) => ke(m)),
|
|
593
|
+
onCancel: Ce
|
|
594
|
+
}, null, 8, ["config", "visible"])) : j("", !0),
|
|
595
|
+
e.config.consumerGroupId && V.value ? (E(), z(Le, {
|
|
593
596
|
key: 1,
|
|
594
597
|
"action-button-appearance": "danger",
|
|
595
598
|
"data-testid": "remove-consumer-modal",
|
|
596
|
-
title:
|
|
597
|
-
visible:
|
|
598
|
-
onCancel:
|
|
599
|
-
onProceed:
|
|
599
|
+
title: o(n)("consumers.consumer_groups.remove.title"),
|
|
600
|
+
visible: de.value,
|
|
601
|
+
onCancel: Ie,
|
|
602
|
+
onProceed: Oe
|
|
600
603
|
}, {
|
|
601
604
|
default: a(() => [
|
|
602
|
-
i(
|
|
605
|
+
i(o(S), {
|
|
603
606
|
class: "message",
|
|
604
607
|
keypath: e.config.consumerGroupName ? "consumers.consumer_groups.remove.confirmation" : "consumers.consumer_groups.remove.confirmationNoCG",
|
|
605
608
|
tag: "p"
|
|
606
|
-
},
|
|
609
|
+
}, ge({
|
|
607
610
|
consumer: a(() => [
|
|
608
|
-
|
|
611
|
+
b("strong", null, p(V.value.username || V.value.custom_id || V.value.id), 1)
|
|
609
612
|
]),
|
|
610
613
|
_: 2
|
|
611
614
|
}, [
|
|
612
615
|
e.config.consumerGroupName ? {
|
|
613
616
|
name: "consumerGroup",
|
|
614
617
|
fn: a(() => [
|
|
615
|
-
|
|
618
|
+
b("strong", null, p(e.config.consumerGroupName), 1)
|
|
616
619
|
]),
|
|
617
620
|
key: "0"
|
|
618
621
|
} : void 0
|
|
619
622
|
]), 1032, ["keypath"]),
|
|
620
|
-
|
|
623
|
+
b("p", null, p(o(n)("consumers.consumer_groups.remove.description")), 1)
|
|
621
624
|
]),
|
|
622
625
|
_: 1
|
|
623
|
-
}, 8, ["title", "visible"])) :
|
|
626
|
+
}, 8, ["title", "visible"])) : j("", !0)
|
|
624
627
|
]);
|
|
625
628
|
};
|
|
626
629
|
}
|
|
627
|
-
}),
|
|
630
|
+
}), Lt = /* @__PURE__ */ he(Gt, [["__scopeId", "data-v-eb0fde3b"]]), k = [];
|
|
628
631
|
for (let e = 0; e < 256; ++e)
|
|
629
|
-
|
|
630
|
-
function
|
|
631
|
-
return (
|
|
632
|
+
k.push((e + 256).toString(16).slice(1));
|
|
633
|
+
function Mt(e, c = 0) {
|
|
634
|
+
return (k[e[c + 0]] + k[e[c + 1]] + k[e[c + 2]] + k[e[c + 3]] + "-" + k[e[c + 4]] + k[e[c + 5]] + "-" + k[e[c + 6]] + k[e[c + 7]] + "-" + k[e[c + 8]] + k[e[c + 9]] + "-" + k[e[c + 10]] + k[e[c + 11]] + k[e[c + 12]] + k[e[c + 13]] + k[e[c + 14]] + k[e[c + 15]]).toLowerCase();
|
|
632
635
|
}
|
|
633
|
-
const
|
|
634
|
-
function
|
|
635
|
-
return crypto.getRandomValues(
|
|
636
|
+
const xt = new Uint8Array(16);
|
|
637
|
+
function At() {
|
|
638
|
+
return crypto.getRandomValues(xt);
|
|
636
639
|
}
|
|
637
|
-
function
|
|
638
|
-
return crypto.randomUUID ? crypto.randomUUID() :
|
|
640
|
+
function Ft(e, c, r) {
|
|
641
|
+
return crypto.randomUUID ? crypto.randomUUID() : Dt(e);
|
|
639
642
|
}
|
|
640
|
-
function
|
|
643
|
+
function Dt(e, c, r) {
|
|
641
644
|
e = e || {};
|
|
642
|
-
const
|
|
643
|
-
if (
|
|
645
|
+
const t = e.random ?? e.rng?.() ?? At();
|
|
646
|
+
if (t.length < 16)
|
|
644
647
|
throw new Error("Random bytes length must be >= 16");
|
|
645
|
-
return
|
|
648
|
+
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, Mt(t);
|
|
646
649
|
}
|
|
647
|
-
const
|
|
650
|
+
const Rt = { class: "kong-ui-entities-consumer-form" }, Pt = ["id"], Tt = { class: "fields-group-text" }, Vt = ["aria-labelledby"], Bt = /* @__PURE__ */ ae({
|
|
648
651
|
__name: "ConsumerForm",
|
|
649
652
|
props: {
|
|
650
653
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -662,7 +665,7 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
662
665
|
},
|
|
663
666
|
emits: ["update", "error", "loading"],
|
|
664
667
|
setup(e, { emit: c }) {
|
|
665
|
-
const r = e,
|
|
668
|
+
const r = e, t = c, { i18nT: S, i18n: { t: n } } = ie.useI18n(), C = Fe(), { axiosInstance: $ } = ye(r.config?.axiosRequestConfig), { getMessageFromError: x } = ut(), T = Ft(), u = Se({
|
|
666
669
|
fields: {
|
|
667
670
|
username: "",
|
|
668
671
|
customId: "",
|
|
@@ -670,96 +673,96 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
670
673
|
},
|
|
671
674
|
readonly: !1,
|
|
672
675
|
errorMessage: ""
|
|
673
|
-
}),
|
|
676
|
+
}), Y = Se({
|
|
674
677
|
username: "",
|
|
675
678
|
customId: "",
|
|
676
679
|
tags: ""
|
|
677
|
-
}), H = h(() =>
|
|
678
|
-
|
|
679
|
-
},
|
|
680
|
-
|
|
681
|
-
}, Z = (
|
|
682
|
-
|
|
683
|
-
},
|
|
684
|
-
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
}, Q = h(() => r.consumerId ?
|
|
688
|
-
let
|
|
689
|
-
return r.config?.app === "konnect" && (
|
|
690
|
-
},
|
|
691
|
-
username:
|
|
692
|
-
custom_id:
|
|
693
|
-
tags:
|
|
694
|
-
})),
|
|
680
|
+
}), H = h(() => L.form[r.config?.app]?.edit), K = () => {
|
|
681
|
+
C.push(r.config?.cancelRoute || { name: "consumer-list" });
|
|
682
|
+
}, J = (l) => {
|
|
683
|
+
t("loading", l);
|
|
684
|
+
}, Z = (l) => {
|
|
685
|
+
t("error", l);
|
|
686
|
+
}, G = (l) => {
|
|
687
|
+
u.fields.username = l?.item?.username || l?.username || "", u.fields.customId = l?.item?.custom_id || l?.custom_id || "";
|
|
688
|
+
const v = l?.item?.tags || l?.tags || [];
|
|
689
|
+
u.fields.tags = v?.join(", ") || "", Object.assign(Y, u.fields);
|
|
690
|
+
}, Q = h(() => r.consumerId ? xe.Edit : xe.Create), U = (l) => {
|
|
691
|
+
let v = `${r.config?.apiBaseUrl}${L.form[r.config?.app][l]}`;
|
|
692
|
+
return r.config?.app === "konnect" && (v = v.replace(/{controlPlaneId}/gi, r.config?.controlPlaneId || "")), v.replace(/\/{workspace}/gi, r.config?.workspace ? `/${r.config.workspace}` : "").replace(/{id}/gi, r.consumerId ?? "");
|
|
693
|
+
}, ee = h(() => !!u.fields.username || !!u.fields.customId), F = h(() => JSON.stringify(u.fields) !== JSON.stringify(Y)), g = h(() => ({
|
|
694
|
+
username: u.fields.username || null,
|
|
695
|
+
custom_id: u.fields.customId || null,
|
|
696
|
+
tags: u.fields.tags.split(",")?.map((l) => String(l || "").trim())?.filter((l) => l !== "")
|
|
697
|
+
})), A = async () => {
|
|
695
698
|
try {
|
|
696
|
-
|
|
697
|
-
let
|
|
698
|
-
Q.value === "create" ?
|
|
699
|
-
} catch (
|
|
700
|
-
|
|
699
|
+
u.readonly = !0;
|
|
700
|
+
let l;
|
|
701
|
+
Q.value === "create" ? l = await $.post(U("create"), g.value) : Q.value === "edit" && (l = r.config?.app === "konnect" ? await $.put(U("edit"), g.value) : await $.patch(U("edit"), g.value)), G(l?.data), t("update", l?.data);
|
|
702
|
+
} catch (l) {
|
|
703
|
+
u.errorMessage = x(l), t("error", l);
|
|
701
704
|
} finally {
|
|
702
|
-
|
|
705
|
+
u.readonly = !1;
|
|
703
706
|
}
|
|
704
707
|
};
|
|
705
|
-
return (
|
|
706
|
-
const W =
|
|
707
|
-
return
|
|
708
|
-
i(
|
|
709
|
-
"can-submit":
|
|
708
|
+
return (l, v) => {
|
|
709
|
+
const W = P("KInput"), I = P("KCard");
|
|
710
|
+
return E(), O("div", Rt, [
|
|
711
|
+
i(o(dt), {
|
|
712
|
+
"can-submit": ee.value && F.value,
|
|
710
713
|
config: e.config,
|
|
711
714
|
"edit-id": e.consumerId,
|
|
712
|
-
"entity-type":
|
|
713
|
-
"error-message":
|
|
715
|
+
"entity-type": o(De).Consumer,
|
|
716
|
+
"error-message": u.errorMessage,
|
|
714
717
|
"fetch-url": H.value,
|
|
715
|
-
"form-fields":
|
|
716
|
-
"is-readonly":
|
|
717
|
-
onCancel:
|
|
718
|
-
"onFetch:error":
|
|
719
|
-
"onFetch:success":
|
|
720
|
-
onLoading:
|
|
721
|
-
onSubmit:
|
|
718
|
+
"form-fields": g.value,
|
|
719
|
+
"is-readonly": u.readonly,
|
|
720
|
+
onCancel: K,
|
|
721
|
+
"onFetch:error": v[3] || (v[3] = (M) => Z(M)),
|
|
722
|
+
"onFetch:success": G,
|
|
723
|
+
onLoading: v[4] || (v[4] = (M) => J(M)),
|
|
724
|
+
onSubmit: A
|
|
722
725
|
}, {
|
|
723
726
|
default: a(() => [
|
|
724
|
-
|
|
725
|
-
i(
|
|
726
|
-
description:
|
|
727
|
+
b("div", null, [
|
|
728
|
+
i(o(mt), {
|
|
729
|
+
description: o(n)("consumers.form.info.description"),
|
|
727
730
|
"has-divider": "",
|
|
728
|
-
title:
|
|
731
|
+
title: o(n)("consumers.form.info.title")
|
|
729
732
|
}, {
|
|
730
733
|
default: a(() => [
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
id: `fields-group-title-${
|
|
734
|
+
b("div", null, [
|
|
735
|
+
b("h3", {
|
|
736
|
+
id: `fields-group-title-${o(T)}`,
|
|
734
737
|
class: "fields-group-title"
|
|
735
|
-
},
|
|
736
|
-
|
|
738
|
+
}, p(o(n)("consumers.form.consumer_identification.title")) + "* ", 9, Pt),
|
|
739
|
+
b("p", Tt, p(o(n)("consumers.form.consumer_identification.description")), 1)
|
|
737
740
|
]),
|
|
738
|
-
i(
|
|
741
|
+
i(I, null, {
|
|
739
742
|
default: a(() => [
|
|
740
|
-
|
|
741
|
-
"aria-labelledby": `fields-group-title-${
|
|
743
|
+
b("fieldset", {
|
|
744
|
+
"aria-labelledby": `fields-group-title-${o(T)}`
|
|
742
745
|
}, [
|
|
743
746
|
i(W, {
|
|
744
|
-
modelValue:
|
|
745
|
-
"onUpdate:modelValue":
|
|
747
|
+
modelValue: u.fields.username,
|
|
748
|
+
"onUpdate:modelValue": v[0] || (v[0] = (M) => u.fields.username = M),
|
|
746
749
|
modelModifiers: { trim: !0 },
|
|
747
750
|
autocomplete: "off",
|
|
748
751
|
class: "username-field",
|
|
749
752
|
"data-testid": "consumer-form-username",
|
|
750
|
-
label:
|
|
753
|
+
label: o(n)("consumers.fields.username.label"),
|
|
751
754
|
"label-attributes": { tooltipAttributes: { maxWidth: "400" } },
|
|
752
|
-
placeholder:
|
|
753
|
-
readonly:
|
|
755
|
+
placeholder: o(n)("consumers.fields.username.placeholder"),
|
|
756
|
+
readonly: u.readonly,
|
|
754
757
|
type: "text"
|
|
755
758
|
}, {
|
|
756
759
|
"label-tooltip": a(() => [
|
|
757
|
-
i(
|
|
760
|
+
i(o(S), {
|
|
758
761
|
keypath: "consumers.fields.username.tooltip",
|
|
759
762
|
scope: "global"
|
|
760
763
|
}, {
|
|
761
764
|
custom_id: a(() => [
|
|
762
|
-
|
|
765
|
+
b("code", null, p(o(n)("consumers.fields.username.custom_id")), 1)
|
|
763
766
|
]),
|
|
764
767
|
_: 1
|
|
765
768
|
})
|
|
@@ -767,48 +770,48 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
767
770
|
_: 1
|
|
768
771
|
}, 8, ["modelValue", "label", "placeholder", "readonly"]),
|
|
769
772
|
i(W, {
|
|
770
|
-
modelValue:
|
|
771
|
-
"onUpdate:modelValue":
|
|
773
|
+
modelValue: u.fields.customId,
|
|
774
|
+
"onUpdate:modelValue": v[1] || (v[1] = (M) => u.fields.customId = M),
|
|
772
775
|
modelModifiers: { trim: !0 },
|
|
773
776
|
autocomplete: "off",
|
|
774
777
|
"data-testid": "consumer-form-custom-id",
|
|
775
|
-
label:
|
|
778
|
+
label: o(n)("consumers.fields.custom_id.label"),
|
|
776
779
|
"label-attributes": { tooltipAttributes: { maxWidth: "400" } },
|
|
777
|
-
placeholder:
|
|
778
|
-
readonly:
|
|
780
|
+
placeholder: o(n)("consumers.fields.custom_id.placeholder"),
|
|
781
|
+
readonly: u.readonly,
|
|
779
782
|
type: "text"
|
|
780
783
|
}, {
|
|
781
784
|
"label-tooltip": a(() => [
|
|
782
|
-
i(
|
|
785
|
+
i(o(S), {
|
|
783
786
|
keypath: "consumers.fields.custom_id.tooltip",
|
|
784
787
|
scope: "global"
|
|
785
788
|
}, {
|
|
786
789
|
username: a(() => [
|
|
787
|
-
|
|
790
|
+
b("code", null, p(o(n)("consumers.fields.custom_id.username")), 1)
|
|
788
791
|
]),
|
|
789
792
|
_: 1
|
|
790
793
|
})
|
|
791
794
|
]),
|
|
792
795
|
_: 1
|
|
793
796
|
}, 8, ["modelValue", "label", "placeholder", "readonly"])
|
|
794
|
-
], 8,
|
|
797
|
+
], 8, Vt)
|
|
795
798
|
]),
|
|
796
799
|
_: 1
|
|
797
800
|
}),
|
|
798
801
|
i(W, {
|
|
799
|
-
modelValue:
|
|
800
|
-
"onUpdate:modelValue":
|
|
802
|
+
modelValue: u.fields.tags,
|
|
803
|
+
"onUpdate:modelValue": v[2] || (v[2] = (M) => u.fields.tags = M),
|
|
801
804
|
modelModifiers: { trim: !0 },
|
|
802
805
|
autocomplete: "off",
|
|
803
806
|
"data-testid": "consumer-form-tags",
|
|
804
|
-
help:
|
|
805
|
-
label:
|
|
807
|
+
help: o(n)("consumers.fields.tags.help"),
|
|
808
|
+
label: o(n)("consumers.fields.tags.label"),
|
|
806
809
|
"label-attributes": {
|
|
807
|
-
info:
|
|
810
|
+
info: o(n)("consumers.fields.tags.tooltip"),
|
|
808
811
|
tooltipAttributes: { maxWidth: "400" }
|
|
809
812
|
},
|
|
810
|
-
placeholder:
|
|
811
|
-
readonly:
|
|
813
|
+
placeholder: o(n)("consumers.fields.tags.placeholder"),
|
|
814
|
+
readonly: u.readonly,
|
|
812
815
|
type: "text"
|
|
813
816
|
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
|
|
814
817
|
]),
|
|
@@ -821,7 +824,7 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
821
824
|
]);
|
|
822
825
|
};
|
|
823
826
|
}
|
|
824
|
-
}),
|
|
827
|
+
}), Ht = /* @__PURE__ */ he(Bt, [["__scopeId", "data-v-a0873f95"]]), Kt = { class: "kong-ui-consumer-entity-config-card" }, Jt = /* @__PURE__ */ ae({
|
|
825
828
|
__name: "ConsumerConfigCard",
|
|
826
829
|
props: {
|
|
827
830
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -848,15 +851,15 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
848
851
|
},
|
|
849
852
|
emits: ["loading", "fetch:error", "fetch:success"],
|
|
850
853
|
setup(e) {
|
|
851
|
-
const c = e, { i18n: { t: r }, i18nT:
|
|
854
|
+
const c = e, { i18n: { t: r }, i18nT: t } = ie.useI18n(), S = h(() => L.form[c.config.app].edit), n = y({
|
|
852
855
|
id: {},
|
|
853
856
|
username: {
|
|
854
|
-
section:
|
|
857
|
+
section: Ae.Basic,
|
|
855
858
|
tooltip: r("consumers.fields.username.tooltip"),
|
|
856
859
|
order: 1
|
|
857
860
|
},
|
|
858
861
|
custom_id: {
|
|
859
|
-
section:
|
|
862
|
+
section: Ae.Basic,
|
|
860
863
|
tooltip: r("consumers.fields.custom_id.tooltip"),
|
|
861
864
|
label: r("consumers.fields.custom_id.label"),
|
|
862
865
|
order: 2
|
|
@@ -873,36 +876,36 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
873
876
|
hidden: !0
|
|
874
877
|
}
|
|
875
878
|
});
|
|
876
|
-
return (
|
|
877
|
-
i(
|
|
879
|
+
return (C, $) => (E(), O("div", Kt, [
|
|
880
|
+
i(o(pt), {
|
|
878
881
|
config: e.config,
|
|
879
882
|
"config-card-doc": e.configCardDoc,
|
|
880
883
|
"config-schema": n.value,
|
|
881
|
-
"entity-type":
|
|
882
|
-
"fetch-url":
|
|
884
|
+
"entity-type": o(De).Consumer,
|
|
885
|
+
"fetch-url": S.value,
|
|
883
886
|
"hide-title": e.hideTitle,
|
|
884
|
-
"onFetch:error":
|
|
885
|
-
"onFetch:success":
|
|
886
|
-
onLoading:
|
|
887
|
+
"onFetch:error": $[0] || ($[0] = (x) => C.$emit("fetch:error", x)),
|
|
888
|
+
"onFetch:success": $[1] || ($[1] = (x) => C.$emit("fetch:success", x)),
|
|
889
|
+
onLoading: $[2] || ($[2] = (x) => C.$emit("loading", x))
|
|
887
890
|
}, {
|
|
888
891
|
"username-label-tooltip": a(() => [
|
|
889
|
-
i(t
|
|
892
|
+
i(o(t), {
|
|
890
893
|
keypath: "consumers.fields.username.tooltip",
|
|
891
894
|
scope: "global"
|
|
892
895
|
}, {
|
|
893
896
|
custom_id: a(() => [
|
|
894
|
-
|
|
897
|
+
b("code", null, p(o(r)("consumers.fields.username.custom_id")), 1)
|
|
895
898
|
]),
|
|
896
899
|
_: 1
|
|
897
900
|
})
|
|
898
901
|
]),
|
|
899
902
|
"custom_id-label-tooltip": a(() => [
|
|
900
|
-
i(t
|
|
903
|
+
i(o(t), {
|
|
901
904
|
keypath: "consumers.fields.custom_id.tooltip",
|
|
902
905
|
scope: "global"
|
|
903
906
|
}, {
|
|
904
907
|
username: a(() => [
|
|
905
|
-
|
|
908
|
+
b("code", null, p(o(r)("consumers.fields.custom_id.username")), 1)
|
|
906
909
|
]),
|
|
907
910
|
_: 1
|
|
908
911
|
})
|
|
@@ -913,7 +916,7 @@ const Dt = { class: "kong-ui-entities-consumer-form" }, Rt = ["id"], Ft = { clas
|
|
|
913
916
|
}
|
|
914
917
|
});
|
|
915
918
|
export {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
+
Jt as ConsumerConfigCard,
|
|
920
|
+
Ht as ConsumerForm,
|
|
921
|
+
Lt as ConsumerList
|
|
919
922
|
};
|