@kong-ui-public/entities-consumer-credentials 3.2.28 → 3.2.29
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,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as X, computed as k, openBlock as _, createBlock as U, resolveDynamicComponent as fe, normalizeStyle as ye, withCtx as l, createElementBlock as M, toDisplayString as A, createCommentVNode as z, pushScopeId as ge, popScopeId as he, createElementVNode as V, ref as C, watch as se, renderSlot as G, unref as w, resolveComponent as L, createVNode as
|
|
1
|
+
import { defineComponent as X, computed as k, openBlock as _, createBlock as U, resolveDynamicComponent as fe, normalizeStyle as ye, withCtx as l, createElementBlock as M, toDisplayString as A, createCommentVNode as z, pushScopeId as ge, popScopeId as he, createElementVNode as V, ref as C, watch as se, renderSlot as G, unref as w, resolveComponent as L, createVNode as v, createSlots as je, withDirectives as $e, vShow as Ke, renderList as Fe, createTextVNode as P, inject as Ye, onMounted as Ze, onUnmounted as Ge, onBeforeMount as Xe, Teleport as Qe, Fragment as et, withModifiers as tt } from "vue";
|
|
2
2
|
import { createI18n as qe, i18nTComponent as Me } from "@kong-ui-public/i18n";
|
|
3
3
|
import ke from "axios";
|
|
4
4
|
import "@kong/kongponents";
|
|
@@ -470,7 +470,7 @@ function Pe() {
|
|
|
470
470
|
if (r.length !== a.length) return !1;
|
|
471
471
|
const n = /* @__PURE__ */ new Set([...r, ...a]);
|
|
472
472
|
for (const o of n) {
|
|
473
|
-
const i = r.filter((
|
|
473
|
+
const i = r.filter((y) => y === o).length, s = a.filter((y) => y === o).length;
|
|
474
474
|
if (i !== s) return !1;
|
|
475
475
|
}
|
|
476
476
|
return !0;
|
|
@@ -512,79 +512,75 @@ function Tt(e, t, r, a = {
|
|
|
512
512
|
searchKeys: ["id"]
|
|
513
513
|
}) {
|
|
514
514
|
r || (r = "1000");
|
|
515
|
-
const { axiosInstance: n } = me(e.axiosRequestConfig), { i18n: { t: o } } = ce(), { debounce: i } = gt(), s = i(async (
|
|
516
|
-
await q(
|
|
517
|
-
}, 200),
|
|
518
|
-
const
|
|
519
|
-
return e.app === "konnect" ?
|
|
515
|
+
const { axiosInstance: n } = me(e.axiosRequestConfig), { i18n: { t: o } } = ce(), { debounce: i } = gt(), s = i(async (g) => {
|
|
516
|
+
await q(g);
|
|
517
|
+
}, 200), y = C(!1), p = C(""), h = C(""), u = C([]), S = C([]), b = C(void 0), E = k(() => {
|
|
518
|
+
const g = `${e.apiBaseUrl}${w(t)}`;
|
|
519
|
+
return e.app === "konnect" ? g.replace(/{controlPlaneId}/gi, (e == null ? void 0 : e.controlPlaneId) || "") : e.app === "kongManager" ? g.replace(/\/{workspace}/gi, e != null && e.workspace ? `/${e.workspace}` : "") : g;
|
|
520
520
|
}), { isValidUuid: F } = Pe(), N = async () => {
|
|
521
521
|
try {
|
|
522
|
-
|
|
523
|
-
const { data:
|
|
524
|
-
|
|
522
|
+
y.value = !0;
|
|
523
|
+
const { data: g } = await n.get(`${E.value}?size=${r}`);
|
|
524
|
+
g != null && g.next || (b.value = a.fetchedItemsKey in g ? g[a.fetchedItemsKey] : []), S.value = a.fetchedItemsKey in g ? g[a.fetchedItemsKey] : [], u.value = S.value;
|
|
525
525
|
} catch {
|
|
526
|
-
|
|
526
|
+
u.value = [], p.value = o("debouncedFilter.errors.fetch");
|
|
527
527
|
} finally {
|
|
528
|
-
|
|
528
|
+
y.value = !1;
|
|
529
529
|
}
|
|
530
|
-
}, T = C(""), q = async (
|
|
531
|
-
var R, J,
|
|
532
|
-
if (T.value !==
|
|
533
|
-
if (
|
|
534
|
-
|
|
530
|
+
}, T = C(""), q = async (g) => {
|
|
531
|
+
var R, J, c;
|
|
532
|
+
if (T.value !== g) {
|
|
533
|
+
if (T.value = g ?? "", !g) {
|
|
534
|
+
u.value = S.value;
|
|
535
535
|
return;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
if (v.value === void 0)
|
|
536
|
+
}
|
|
537
|
+
if (b.value === void 0)
|
|
539
538
|
try {
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
F(d) && a.searchKeys.includes("id") ? p.push((async () => {
|
|
548
|
-
const { data: O } = await n.get(`${E.value}/${d}`);
|
|
539
|
+
if (y.value = !0, p.value = "", h.value = "", e.app === "konnect") {
|
|
540
|
+
const d = `${E.value}/${g}`, { data: I } = await n.get(`${d}?size=${r}`);
|
|
541
|
+
a.fetchedItemsKey in I ? u.value = I[a.fetchedItemsKey] : I != null && I[a.exactMatchKey ?? "id"] ? u.value = [I] : u.value = [];
|
|
542
|
+
} else {
|
|
543
|
+
const d = [];
|
|
544
|
+
F(g) && a.searchKeys.includes("id") ? d.push((async () => {
|
|
545
|
+
const { data: O } = await n.get(`${E.value}/${g}`);
|
|
549
546
|
return [O[a.fetchedItemsKey] ?? O];
|
|
550
|
-
})()) :
|
|
547
|
+
})()) : d.push(
|
|
551
548
|
...a.searchKeys.filter((O) => O !== "id").map(async (O) => {
|
|
552
|
-
const { data: D } = await n.get(`${E.value}?${O}=${
|
|
549
|
+
const { data: D } = await n.get(`${E.value}?${O}=${g}`);
|
|
553
550
|
return D[a.fetchedItemsKey];
|
|
554
551
|
})
|
|
555
552
|
);
|
|
556
|
-
const I = await Promise.all(
|
|
557
|
-
|
|
553
|
+
const I = await Promise.all(d), W = /* @__PURE__ */ new Set();
|
|
554
|
+
u.value = [], (R = I == null ? void 0 : I.forEach) == null || R.call(I, (O) => {
|
|
558
555
|
var D;
|
|
559
556
|
(D = O == null ? void 0 : O.forEach) == null || D.call(O, ($) => {
|
|
560
|
-
W.has($.id) || (W.add($.id),
|
|
557
|
+
W.has($.id) || (W.add($.id), u.value.push($));
|
|
561
558
|
});
|
|
562
559
|
});
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
((J = p == null ? void 0 : p.response) == null ? void 0 : J.status) === 404 ? h.value = o("debouncedFilter.errors.invalid") : (c.value = [], f.value = o("debouncedFilter.errors.fetch"));
|
|
560
|
+
}
|
|
561
|
+
} catch (d) {
|
|
562
|
+
((J = d == null ? void 0 : d.response) == null ? void 0 : J.status) === 404 ? h.value = o("debouncedFilter.errors.invalid") : (u.value = [], p.value = o("debouncedFilter.errors.fetch"));
|
|
567
563
|
} finally {
|
|
568
|
-
|
|
564
|
+
y.value = !1;
|
|
569
565
|
}
|
|
570
566
|
else
|
|
571
|
-
|
|
567
|
+
y.value = !0, h.value = "", u.value = (c = b.value) == null ? void 0 : c.filter((d) => {
|
|
572
568
|
var I;
|
|
573
569
|
let W = !1;
|
|
574
570
|
for (const O of a.searchKeys) {
|
|
575
|
-
const D = typeof
|
|
576
|
-
D != null && D.includes(
|
|
571
|
+
const D = typeof d[O] == "string" ? (I = d[O]) == null ? void 0 : I.toLowerCase() : d[O];
|
|
572
|
+
D != null && D.includes(g.toLowerCase()) && (W = !0);
|
|
577
573
|
}
|
|
578
574
|
return W;
|
|
579
|
-
}), (!
|
|
575
|
+
}), (!u.value || !u.value.length) && (h.value = o("debouncedFilter.errors.invalid")), y.value = !1;
|
|
580
576
|
}
|
|
581
577
|
};
|
|
582
578
|
return {
|
|
583
|
-
loading:
|
|
584
|
-
error:
|
|
579
|
+
loading: y,
|
|
580
|
+
error: p,
|
|
585
581
|
validationError: h,
|
|
586
|
-
results:
|
|
587
|
-
allRecords:
|
|
582
|
+
results: u,
|
|
583
|
+
allRecords: b,
|
|
588
584
|
loadItems: N,
|
|
589
585
|
debouncedQueryChange: s
|
|
590
586
|
};
|
|
@@ -643,14 +639,14 @@ function Le(e, t) {
|
|
|
643
639
|
() => a.value.startsWith("/") ? new URL(`${window.location.origin}${a.value}`) : new URL(a.value)
|
|
644
640
|
);
|
|
645
641
|
return (i) => {
|
|
646
|
-
const { page: s, pageSize:
|
|
642
|
+
const { page: s, pageSize: y, offset: p, sortColumnKey: h, sortColumnOrder: u, query: S } = i;
|
|
647
643
|
try {
|
|
648
|
-
let
|
|
649
|
-
return n.value && S ? (
|
|
650
|
-
|
|
651
|
-
}), h &&
|
|
652
|
-
} catch (
|
|
653
|
-
return console.error("RouteList(fetcher)",
|
|
644
|
+
let b = new URL(o.value.href);
|
|
645
|
+
return n.value && S ? (b.search = "", b = r.value.isExactMatch ? new URL(`${b.href}/${S}/`) : new URL(`${b.href}?filter[name][contains]=${S}`)) : (n.value || new URLSearchParams(S).forEach((E, F) => {
|
|
646
|
+
b.searchParams.append(F, E);
|
|
647
|
+
}), h && b.searchParams.append("sort_by", h), u === "desc" && b.searchParams.append("sort_desc", "1"), b.searchParams.append("size", String(y))), p && s !== 1 && b.searchParams.append("offset", String(p)), b.href;
|
|
648
|
+
} catch (b) {
|
|
649
|
+
return console.error("RouteList(fetcher)", b), a.value;
|
|
654
650
|
}
|
|
655
651
|
};
|
|
656
652
|
}
|
|
@@ -659,23 +655,23 @@ function $t(e, t, r = "data") {
|
|
|
659
655
|
status: ee.Idle
|
|
660
656
|
});
|
|
661
657
|
return { fetcher: async (s) => {
|
|
662
|
-
var
|
|
658
|
+
var y;
|
|
663
659
|
try {
|
|
664
660
|
i.value = { status: ee.Loading };
|
|
665
|
-
let
|
|
666
|
-
|
|
667
|
-
const h = await n.get(
|
|
661
|
+
let p = o(s);
|
|
662
|
+
p.includes("filter[name]") && (p = `${p}&page[size]=${s.pageSize}&page[number]=${s.page}`);
|
|
663
|
+
const h = await n.get(p);
|
|
668
664
|
if (h.status >= 400)
|
|
669
665
|
throw h;
|
|
670
|
-
const
|
|
671
|
-
let
|
|
672
|
-
|
|
666
|
+
const u = h.data, S = r && r.replace(/[^\w-_]/gi, "");
|
|
667
|
+
let b;
|
|
668
|
+
u[S] && Array.isArray(u[S]) ? b = u[S] : Array.isArray(u) ? b = u : b = Object.keys(u).length ? [u] : [];
|
|
673
669
|
const E = {
|
|
674
|
-
data:
|
|
675
|
-
total:
|
|
676
|
-
...
|
|
670
|
+
data: b,
|
|
671
|
+
total: b.length,
|
|
672
|
+
...u.offset ? {
|
|
677
673
|
pagination: {
|
|
678
|
-
offset:
|
|
674
|
+
offset: u.offset
|
|
679
675
|
}
|
|
680
676
|
} : null
|
|
681
677
|
};
|
|
@@ -683,19 +679,19 @@ function $t(e, t, r = "data") {
|
|
|
683
679
|
status: ee.Idle,
|
|
684
680
|
response: E
|
|
685
681
|
}, E;
|
|
686
|
-
} catch (
|
|
682
|
+
} catch (p) {
|
|
687
683
|
const h = {
|
|
688
684
|
data: [],
|
|
689
685
|
total: 0
|
|
690
686
|
};
|
|
691
|
-
return s.query && (((
|
|
687
|
+
return s.query && (((y = p.response) == null ? void 0 : y.status) === 404 || p.status === 404) ? (i.value = {
|
|
692
688
|
status: ee.NoResults,
|
|
693
689
|
response: h,
|
|
694
|
-
error:
|
|
690
|
+
error: p.response ? p : { response: p }
|
|
695
691
|
}, h) : (i.value = {
|
|
696
692
|
status: ee.Error,
|
|
697
693
|
response: h,
|
|
698
|
-
error:
|
|
694
|
+
error: p.response ? p : { response: p }
|
|
699
695
|
}, h);
|
|
700
696
|
}
|
|
701
697
|
}, fetcherState: i };
|
|
@@ -1184,16 +1180,16 @@ function Kr(e) {
|
|
|
1184
1180
|
return e === null ? !1 : He.exec(e) !== null || Ve.exec(e) !== null;
|
|
1185
1181
|
}
|
|
1186
1182
|
function Fr(e) {
|
|
1187
|
-
var t, r, a, n, o, i, s,
|
|
1183
|
+
var t, r, a, n, o, i, s, y = 0, p = null, h, u, S;
|
|
1188
1184
|
if (t = He.exec(e), t === null && (t = Ve.exec(e)), t === null) throw new Error("Date resolve error");
|
|
1189
1185
|
if (r = +t[1], a = +t[2] - 1, n = +t[3], !t[4])
|
|
1190
1186
|
return new Date(Date.UTC(r, a, n));
|
|
1191
1187
|
if (o = +t[4], i = +t[5], s = +t[6], t[7]) {
|
|
1192
|
-
for (
|
|
1193
|
-
|
|
1194
|
-
|
|
1188
|
+
for (y = t[7].slice(0, 3); y.length < 3; )
|
|
1189
|
+
y += "0";
|
|
1190
|
+
y = +y;
|
|
1195
1191
|
}
|
|
1196
|
-
return t[9] && (h = +t[10],
|
|
1192
|
+
return t[9] && (h = +t[10], u = +(t[11] || 0), p = (h * 60 + u) * 6e4, t[9] === "-" && (p = -p)), S = new Date(Date.UTC(r, a, n, o, i, s, y)), p && S.setTime(S.getTime() - p), S;
|
|
1197
1193
|
}
|
|
1198
1194
|
function qr(e) {
|
|
1199
1195
|
return e.toISOString();
|
|
@@ -1560,21 +1556,21 @@ const le = "24px", Je = (e, t) => {
|
|
|
1560
1556
|
let i;
|
|
1561
1557
|
const s = () => {
|
|
1562
1558
|
i && (i.disconnect(), i = void 0);
|
|
1563
|
-
},
|
|
1559
|
+
}, y = () => {
|
|
1564
1560
|
var N, T, q;
|
|
1565
|
-
let
|
|
1561
|
+
let g = ((N = r.value) == null ? void 0 : N.clientWidth) || 0;
|
|
1566
1562
|
if (r.value && "getComputedStyle" in window) {
|
|
1567
1563
|
const R = window.getComputedStyle(r.value);
|
|
1568
|
-
|
|
1564
|
+
g -= (parseFloat(R.paddingLeft) || 0) + (parseFloat(R.paddingRight) || 0);
|
|
1569
1565
|
}
|
|
1570
|
-
h.value = ((T = a.value) == null ? void 0 : T.getBoundingClientRect().width) || 0,
|
|
1571
|
-
},
|
|
1572
|
-
|
|
1566
|
+
h.value = ((T = a.value) == null ? void 0 : T.getBoundingClientRect().width) || 0, u.value = g, S.value = ((q = p.value) == null ? void 0 : q.innerText) || "";
|
|
1567
|
+
}, p = C({}), h = C(0), u = C(0), S = C(""), b = k(() => [a.value, r.value]), E = se(
|
|
1568
|
+
b,
|
|
1573
1569
|
(N) => {
|
|
1574
1570
|
if (o.value && (s(), "ResizeObserver" in window && window)) {
|
|
1575
1571
|
i = new ResizeObserver((T) => {
|
|
1576
1572
|
window.requestAnimationFrame(() => {
|
|
1577
|
-
!Array.isArray(T) || !T.length ||
|
|
1573
|
+
!Array.isArray(T) || !T.length || y();
|
|
1578
1574
|
});
|
|
1579
1575
|
});
|
|
1580
1576
|
for (const T of N)
|
|
@@ -1582,23 +1578,23 @@ const le = "24px", Je = (e, t) => {
|
|
|
1582
1578
|
}
|
|
1583
1579
|
},
|
|
1584
1580
|
{ immediate: !0, flush: "post", deep: !0 }
|
|
1585
|
-
), F = k(() => o.value ? h.value >
|
|
1581
|
+
), F = k(() => o.value ? h.value > u.value : !1);
|
|
1586
1582
|
return Ze(() => {
|
|
1587
|
-
|
|
1583
|
+
y();
|
|
1588
1584
|
}), Ge(() => {
|
|
1589
1585
|
E();
|
|
1590
1586
|
}), (N, T) => {
|
|
1591
1587
|
const q = L("KTooltip");
|
|
1592
1588
|
return _(), M("span", {
|
|
1593
1589
|
ref_key: "contentRef",
|
|
1594
|
-
ref:
|
|
1590
|
+
ref: p,
|
|
1595
1591
|
class: "content-wrapper"
|
|
1596
1592
|
}, [
|
|
1597
1593
|
o.value ? (_(), M("span", {
|
|
1598
1594
|
key: 0,
|
|
1599
1595
|
"data-truncate": o.value || void 0
|
|
1600
1596
|
}, [
|
|
1601
|
-
|
|
1597
|
+
v(q, {
|
|
1602
1598
|
"max-width": "300",
|
|
1603
1599
|
placement: "bottom-start",
|
|
1604
1600
|
text: F.value ? S.value : ""
|
|
@@ -1734,67 +1730,67 @@ const le = "24px", Je = (e, t) => {
|
|
|
1734
1730
|
emits: ["click:row", "sort", "clear-search-input", "empty-state-cta-clicked"],
|
|
1735
1731
|
setup(e, { emit: t }) {
|
|
1736
1732
|
const r = e, a = t, { i18n: { t: n } } = ve.useI18n(), o = k(() => {
|
|
1737
|
-
var
|
|
1733
|
+
var c, d;
|
|
1738
1734
|
return typeof r.errorMessage == "string" ? {
|
|
1739
1735
|
hasError: !!r.errorMessage,
|
|
1740
1736
|
title: r.errorMessage,
|
|
1741
1737
|
message: void 0
|
|
1742
1738
|
} : {
|
|
1743
1739
|
hasError: !!r.errorMessage,
|
|
1744
|
-
title: (
|
|
1745
|
-
message: (
|
|
1740
|
+
title: (c = r.errorMessage) == null ? void 0 : c.title,
|
|
1741
|
+
message: (d = r.errorMessage) == null ? void 0 : d.message
|
|
1746
1742
|
};
|
|
1747
|
-
}), i = k(() => r.cacheIdentifier || r.preferencesStorageKey), s = (
|
|
1748
|
-
const
|
|
1749
|
-
return Object.keys(r.tableHeaders).forEach((
|
|
1750
|
-
const I = r.tableHeaders[
|
|
1751
|
-
|
|
1752
|
-
label: I.label ??
|
|
1753
|
-
key:
|
|
1743
|
+
}), i = k(() => r.cacheIdentifier || r.preferencesStorageKey), s = (c) => c.hasData || !!r.query, y = k(() => {
|
|
1744
|
+
const c = [];
|
|
1745
|
+
return Object.keys(r.tableHeaders).forEach((d) => {
|
|
1746
|
+
const I = r.tableHeaders[d];
|
|
1747
|
+
c.push({
|
|
1748
|
+
label: I.label ?? d,
|
|
1749
|
+
key: d,
|
|
1754
1750
|
sortable: I.sortable ?? !1,
|
|
1755
1751
|
hidable: I.hidable ?? !0
|
|
1756
1752
|
});
|
|
1757
|
-
}), r.enableEntityActions &&
|
|
1753
|
+
}), r.enableEntityActions && c.push({
|
|
1758
1754
|
key: "actions",
|
|
1759
1755
|
hideLabel: !0
|
|
1760
|
-
}),
|
|
1761
|
-
}),
|
|
1762
|
-
"data-rowid":
|
|
1763
|
-
"data-testid":
|
|
1764
|
-
...r.rowAttributes(
|
|
1765
|
-
}), h = C({}),
|
|
1766
|
-
var
|
|
1767
|
-
return (
|
|
1768
|
-
}, S = (
|
|
1769
|
-
const
|
|
1770
|
-
"data-testid":
|
|
1771
|
-
...r.cellAttributes(
|
|
1756
|
+
}), c;
|
|
1757
|
+
}), p = (c) => ({
|
|
1758
|
+
"data-rowid": c.id,
|
|
1759
|
+
"data-testid": c.name,
|
|
1760
|
+
...r.rowAttributes(c)
|
|
1761
|
+
}), h = C({}), u = (c) => {
|
|
1762
|
+
var d;
|
|
1763
|
+
return (d = h.value) == null ? void 0 : d.$el.querySelector(`[data-rowid="${c.id}"]`);
|
|
1764
|
+
}, S = (c) => {
|
|
1765
|
+
const d = {
|
|
1766
|
+
"data-testid": c.headerKey,
|
|
1767
|
+
...r.cellAttributes(c)
|
|
1772
1768
|
};
|
|
1773
|
-
return
|
|
1769
|
+
return c.colIndex === 0 && (d.style = {
|
|
1774
1770
|
maxWidth: "250px",
|
|
1775
1771
|
overflowX: "hidden",
|
|
1776
1772
|
textOverflow: "ellipsis"
|
|
1777
|
-
}),
|
|
1778
|
-
},
|
|
1773
|
+
}), d;
|
|
1774
|
+
}, b = () => {
|
|
1779
1775
|
a("empty-state-cta-clicked"), E();
|
|
1780
1776
|
}, E = () => {
|
|
1781
1777
|
a("clear-search-input");
|
|
1782
|
-
}, F = k(() => r.disableRowClick ? void 0 : (
|
|
1783
|
-
a("click:row",
|
|
1784
|
-
}), N = (
|
|
1785
|
-
a("sort",
|
|
1786
|
-
}, { setTablePreferences: T, getTablePreferences: q } = mt(),
|
|
1787
|
-
const
|
|
1778
|
+
}, F = k(() => r.disableRowClick ? void 0 : (c, d) => {
|
|
1779
|
+
a("click:row", d);
|
|
1780
|
+
}), N = (c) => {
|
|
1781
|
+
a("sort", c);
|
|
1782
|
+
}, { setTablePreferences: T, getTablePreferences: q } = mt(), g = C(q(i.value)), R = k(() => {
|
|
1783
|
+
const c = q(i.value);
|
|
1788
1784
|
return {
|
|
1789
1785
|
...r.initialFetcherParams,
|
|
1790
|
-
...
|
|
1786
|
+
...c
|
|
1791
1787
|
};
|
|
1792
|
-
}), J = (
|
|
1793
|
-
|
|
1794
|
-
!("hidable" in
|
|
1795
|
-
}), i.value && T(i.value,
|
|
1788
|
+
}), J = (c) => {
|
|
1789
|
+
g.value = c, y.value.forEach((d) => {
|
|
1790
|
+
!("hidable" in d) || !g.value.columnVisibility || d.hidable === !1 && (g.value.columnVisibility[d.key] = !0);
|
|
1791
|
+
}), i.value && T(i.value, c);
|
|
1796
1792
|
};
|
|
1797
|
-
return (
|
|
1793
|
+
return (c, d) => {
|
|
1798
1794
|
const I = L("KButton"), W = L("KDropdown"), O = L("KTable"), D = L("KCard");
|
|
1799
1795
|
return _(), U(D, {
|
|
1800
1796
|
class: "kong-ui-entity-base-table",
|
|
@@ -1802,7 +1798,7 @@ const le = "24px", Je = (e, t) => {
|
|
|
1802
1798
|
"title-tag": e.titleTag
|
|
1803
1799
|
}, {
|
|
1804
1800
|
default: l(() => [
|
|
1805
|
-
|
|
1801
|
+
v(O, {
|
|
1806
1802
|
ref_key: "tableRefs",
|
|
1807
1803
|
ref: h,
|
|
1808
1804
|
"cache-identifier": i.value,
|
|
@@ -1819,27 +1815,27 @@ const le = "24px", Je = (e, t) => {
|
|
|
1819
1815
|
"error-state-title": o.value.title,
|
|
1820
1816
|
fetcher: e.fetcher,
|
|
1821
1817
|
"fetcher-cache-key": String(e.fetcherCacheKey),
|
|
1822
|
-
headers:
|
|
1818
|
+
headers: y.value,
|
|
1823
1819
|
"hide-pagination-when-optional": "",
|
|
1824
1820
|
"initial-fetcher-params": R.value,
|
|
1825
1821
|
loading: e.isLoading,
|
|
1826
1822
|
"pagination-offset": e.paginationType === "offset",
|
|
1827
1823
|
"resize-columns": "",
|
|
1828
|
-
"row-attrs":
|
|
1824
|
+
"row-attrs": p,
|
|
1829
1825
|
"search-input": e.query,
|
|
1830
1826
|
"sort-handler-function": e.enableClientSort ? e.sortHandlerFunction : void 0,
|
|
1831
1827
|
sortable: !e.disableSorting,
|
|
1832
|
-
"table-preferences":
|
|
1833
|
-
onEmptyStateActionClick:
|
|
1828
|
+
"table-preferences": g.value,
|
|
1829
|
+
onEmptyStateActionClick: b,
|
|
1834
1830
|
"onRow:click": F.value,
|
|
1835
|
-
onSort:
|
|
1831
|
+
onSort: d[0] || (d[0] = ($) => N($)),
|
|
1836
1832
|
"onUpdate:tablePreferences": J
|
|
1837
1833
|
}, je({
|
|
1838
1834
|
toolbar: l(({ state: $ }) => [
|
|
1839
1835
|
$e(V("div", Ca, [
|
|
1840
|
-
G(
|
|
1841
|
-
|
|
1842
|
-
G(
|
|
1836
|
+
G(c.$slots, "toolbar-filter", {}, void 0, !0),
|
|
1837
|
+
c.$slots["toolbar-button"] ? (_(), M("div", ka, [
|
|
1838
|
+
G(c.$slots, "toolbar-button", {}, void 0, !0)
|
|
1843
1839
|
])) : z("", !0)
|
|
1844
1840
|
], 512), [
|
|
1845
1841
|
[Ke, s($)]
|
|
@@ -1850,19 +1846,19 @@ const le = "24px", Je = (e, t) => {
|
|
|
1850
1846
|
class: "actions-container",
|
|
1851
1847
|
"data-testid": $.name
|
|
1852
1848
|
}, [
|
|
1853
|
-
|
|
1849
|
+
v(W, {
|
|
1854
1850
|
"kpop-attributes": { placement: "bottom-end" },
|
|
1855
1851
|
width: e.dropdownMenuWidth
|
|
1856
1852
|
}, {
|
|
1857
1853
|
items: l(() => [
|
|
1858
|
-
G(
|
|
1854
|
+
G(c.$slots, "actions", {
|
|
1859
1855
|
row: $,
|
|
1860
1856
|
rowKey: Y,
|
|
1861
1857
|
rowValue: Q
|
|
1862
1858
|
}, void 0, !0)
|
|
1863
1859
|
]),
|
|
1864
1860
|
default: l(() => [
|
|
1865
|
-
|
|
1861
|
+
v(I, {
|
|
1866
1862
|
appearance: "tertiary",
|
|
1867
1863
|
class: "actions-trigger",
|
|
1868
1864
|
"data-testid": "overflow-actions-button",
|
|
@@ -1870,7 +1866,7 @@ const le = "24px", Je = (e, t) => {
|
|
|
1870
1866
|
size: "small"
|
|
1871
1867
|
}, {
|
|
1872
1868
|
default: l(() => [
|
|
1873
|
-
|
|
1869
|
+
v(w(ma))
|
|
1874
1870
|
]),
|
|
1875
1871
|
_: 1
|
|
1876
1872
|
})
|
|
@@ -1883,16 +1879,16 @@ const le = "24px", Je = (e, t) => {
|
|
|
1883
1879
|
}, [
|
|
1884
1880
|
Fe(e.tableHeaders, ($, Y) => ({
|
|
1885
1881
|
name: Y,
|
|
1886
|
-
fn: l(({ row: Q, rowKey:
|
|
1887
|
-
|
|
1882
|
+
fn: l(({ row: Q, rowKey: f, rowValue: x }) => [
|
|
1883
|
+
v(wa, {
|
|
1888
1884
|
"key-name": String(Y),
|
|
1889
|
-
"row-el":
|
|
1885
|
+
"row-el": u(Q),
|
|
1890
1886
|
tooltip: $.tooltip
|
|
1891
1887
|
}, {
|
|
1892
1888
|
default: l(() => [
|
|
1893
|
-
G(
|
|
1889
|
+
G(c.$slots, Y, {
|
|
1894
1890
|
row: Q,
|
|
1895
|
-
rowKey:
|
|
1891
|
+
rowKey: f,
|
|
1896
1892
|
rowValue: x
|
|
1897
1893
|
}, () => [
|
|
1898
1894
|
P(A(x), 1)
|
|
@@ -1905,7 +1901,7 @@ const le = "24px", Je = (e, t) => {
|
|
|
1905
1901
|
e.query ? void 0 : {
|
|
1906
1902
|
name: "empty-state-action-icon",
|
|
1907
1903
|
fn: l(() => [
|
|
1908
|
-
|
|
1904
|
+
v(w(da))
|
|
1909
1905
|
]),
|
|
1910
1906
|
key: "0"
|
|
1911
1907
|
}
|
|
@@ -1965,9 +1961,9 @@ const le = "24px", Je = (e, t) => {
|
|
|
1965
1961
|
}, s = () => {
|
|
1966
1962
|
n("proceed");
|
|
1967
1963
|
};
|
|
1968
|
-
return (
|
|
1969
|
-
const h = L("KAlert"),
|
|
1970
|
-
return _(), U(
|
|
1964
|
+
return (y, p) => {
|
|
1965
|
+
const h = L("KAlert"), u = L("KPrompt");
|
|
1966
|
+
return _(), U(u, {
|
|
1971
1967
|
"action-button-appearance": "danger",
|
|
1972
1968
|
"action-button-disabled": e.actionPending,
|
|
1973
1969
|
"action-button-text": "Yes, delete",
|
|
@@ -1980,14 +1976,14 @@ const le = "24px", Je = (e, t) => {
|
|
|
1980
1976
|
}, {
|
|
1981
1977
|
default: l(() => [
|
|
1982
1978
|
e.error ? (_(), M("div", Na, [
|
|
1983
|
-
|
|
1979
|
+
v(h, { appearance: "danger" }, {
|
|
1984
1980
|
default: l(() => [
|
|
1985
1981
|
P(A(e.error), 1)
|
|
1986
1982
|
]),
|
|
1987
1983
|
_: 1
|
|
1988
1984
|
})
|
|
1989
1985
|
])) : z("", !0),
|
|
1990
|
-
|
|
1986
|
+
v(w(r), {
|
|
1991
1987
|
class: "message",
|
|
1992
1988
|
keypath: a.entityName ? "deleteModal.messageWithName" : "deleteModal.message",
|
|
1993
1989
|
tag: "p"
|
|
@@ -2005,8 +2001,8 @@ const le = "24px", Je = (e, t) => {
|
|
|
2005
2001
|
key: "0"
|
|
2006
2002
|
} : void 0
|
|
2007
2003
|
]), 1032, ["keypath"]),
|
|
2008
|
-
a.description ||
|
|
2009
|
-
G(
|
|
2004
|
+
a.description || y.$slots.description ? (_(), M("div", Aa, [
|
|
2005
|
+
G(y.$slots, "description", {}, () => [
|
|
2010
2006
|
V("p", null, A(a.description), 1)
|
|
2011
2007
|
], !0)
|
|
2012
2008
|
])) : z("", !0)
|
|
@@ -2090,7 +2086,7 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2090
2086
|
emits: ["error", "copy:success", "copy:error", "delete:success"],
|
|
2091
2087
|
setup(e, { emit: t }) {
|
|
2092
2088
|
var Q;
|
|
2093
|
-
const r = t, a = e, { i18n: { t: n, formatUnixTimeStamp: o } } = pt.useI18n(), { axiosInstance: i } = Oa((Q = a.config) == null ? void 0 : Q.axiosRequestConfig), s = C(1),
|
|
2089
|
+
const r = t, a = e, { i18n: { t: n, formatUnixTimeStamp: o } } = pt.useI18n(), { axiosInstance: i } = Oa((Q = a.config) == null ? void 0 : Q.axiosRequestConfig), s = C(1), y = {
|
|
2094
2090
|
acls: {
|
|
2095
2091
|
group: { label: n("credentials.list.table_headers.acls.group") },
|
|
2096
2092
|
created_at: { label: n("credentials.list.table_headers.acls.created_at") },
|
|
@@ -2131,56 +2127,56 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2131
2127
|
created_at: { label: n("credentials.list.table_headers.jwt.created_at") },
|
|
2132
2128
|
tags: { label: n("credentials.list.table_headers.jwt.tags") }
|
|
2133
2129
|
}
|
|
2134
|
-
},
|
|
2135
|
-
let
|
|
2136
|
-
return a.config.app === "konnect" ?
|
|
2137
|
-
}), { fetcher:
|
|
2130
|
+
}, p = k(() => y[a.config.plugin]), h = k(() => {
|
|
2131
|
+
let f = `${a.config.apiBaseUrl}${ft.list[a.config.app]}`;
|
|
2132
|
+
return a.config.app === "konnect" ? f = f.replace(/{controlPlaneId}/gi, a.config.controlPlaneId || "").replace(/{consumerId}/gi, a.config.consumerId || "").replace(/{plugin}/gi, a.config.plugin || "") : a.config.app === "kongManager" && (f = f.replace(/\/{workspace}/gi, a.config.workspace ? `/${a.config.workspace}` : "").replace(/{consumerId}/gi, a.config.consumerId || "").replace(/{plugin}/gi, a.config.plugin || "")), f;
|
|
2133
|
+
}), { fetcher: u, fetcherState: S } = $a(a.config, h), b = () => {
|
|
2138
2134
|
s.value++;
|
|
2139
|
-
}, E = C(null), F = (
|
|
2140
|
-
const B = x ?
|
|
2135
|
+
}, E = C(null), F = (f, x, H) => {
|
|
2136
|
+
const B = x ? f[x] : JSON.stringify(f);
|
|
2141
2137
|
if (!H(B)) {
|
|
2142
|
-
T(
|
|
2138
|
+
T(f, x);
|
|
2143
2139
|
return;
|
|
2144
2140
|
}
|
|
2145
|
-
N(
|
|
2146
|
-
}, N = (
|
|
2141
|
+
N(f, x);
|
|
2142
|
+
}, N = (f, x) => {
|
|
2147
2143
|
r("copy:success", {
|
|
2148
|
-
entity:
|
|
2144
|
+
entity: f,
|
|
2149
2145
|
field: x,
|
|
2150
|
-
message: x && !["password", "key", "client_secret", "secret"].includes(x) ? n("credentials.copy.success", { val:
|
|
2146
|
+
message: x && !["password", "key", "client_secret", "secret"].includes(x) ? n("credentials.copy.success", { val: f[x] }) : n("credentials.copy.success_brief")
|
|
2151
2147
|
});
|
|
2152
|
-
}, T = (
|
|
2148
|
+
}, T = (f, x) => {
|
|
2153
2149
|
r("copy:error", {
|
|
2154
|
-
entity:
|
|
2150
|
+
entity: f,
|
|
2155
2151
|
field: x,
|
|
2156
2152
|
message: n("credentials.error.copy")
|
|
2157
2153
|
});
|
|
2158
|
-
}, q = (
|
|
2154
|
+
}, q = (f) => ({
|
|
2159
2155
|
label: n("credentials.actions.edit"),
|
|
2160
|
-
to: a.config.getEditRoute(
|
|
2161
|
-
}),
|
|
2162
|
-
|
|
2156
|
+
to: a.config.getEditRoute(f)
|
|
2157
|
+
}), g = C(void 0), R = C(!1), J = C(!1), c = C(""), d = ja(a.config, h.value), I = k(() => Be[a.config.plugin]), W = (f) => {
|
|
2158
|
+
g.value = f, R.value = !0;
|
|
2163
2159
|
}, O = () => {
|
|
2164
2160
|
R.value = !1;
|
|
2165
2161
|
}, D = async () => {
|
|
2166
|
-
var
|
|
2167
|
-
if ((
|
|
2162
|
+
var f, x, H;
|
|
2163
|
+
if ((f = g.value) != null && f.id) {
|
|
2168
2164
|
J.value = !0;
|
|
2169
2165
|
try {
|
|
2170
|
-
await i.delete(
|
|
2166
|
+
await i.delete(d(g.value.id)), J.value = !1, R.value = !1, s.value++, r("delete:success", g.value);
|
|
2171
2167
|
} catch (B) {
|
|
2172
|
-
|
|
2168
|
+
c.value = ((H = (x = B.response) == null ? void 0 : x.data) == null ? void 0 : H.message) || B.message || n("credentials.error.delete"), r("error", B);
|
|
2173
2169
|
} finally {
|
|
2174
2170
|
J.value = !1;
|
|
2175
2171
|
}
|
|
2176
2172
|
}
|
|
2177
2173
|
}, $ = C(!1);
|
|
2178
|
-
se(S, (
|
|
2174
|
+
se(S, (f) => {
|
|
2179
2175
|
var x, H, B, oe;
|
|
2180
|
-
if (Array.isArray((x =
|
|
2176
|
+
if (Array.isArray((x = f == null ? void 0 : f.response) == null ? void 0 : x.data) && ($.value = f.response.data.length > 0), f.status === ee.Error) {
|
|
2181
2177
|
E.value = {
|
|
2182
2178
|
title: n("credentials.error.general")
|
|
2183
|
-
}, (oe = (B = (H =
|
|
2179
|
+
}, (oe = (B = (H = f.error) == null ? void 0 : H.response) == null ? void 0 : B.data) != null && oe.message && (E.value.message = f.error.response.data.message), r("error", f.error);
|
|
2184
2180
|
return;
|
|
2185
2181
|
}
|
|
2186
2182
|
E.value = null;
|
|
@@ -2193,10 +2189,10 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2193
2189
|
});
|
|
2194
2190
|
return Xe(async () => {
|
|
2195
2191
|
await a.canCreate() && (Y.value.title = n(`credentials.list.empty_state.${a.config.plugin}.title`), Y.value.ctaText = n(`credentials.list.empty_state.${a.config.plugin}.cta`));
|
|
2196
|
-
}), (
|
|
2192
|
+
}), (f, x) => {
|
|
2197
2193
|
const H = L("KButton"), B = L("KCopy"), oe = L("KBadge"), We = L("KTruncate"), Z = L("KDropdownItem"), re = L("KClipboardProvider");
|
|
2198
2194
|
return _(), M("div", Ka, [
|
|
2199
|
-
|
|
2195
|
+
v(w(xa), {
|
|
2200
2196
|
"cache-identifier": e.cacheIdentifier,
|
|
2201
2197
|
"disable-pagination-page-jump": "",
|
|
2202
2198
|
"disable-row-click": "",
|
|
@@ -2204,31 +2200,31 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2204
2200
|
"empty-state-options": Y.value,
|
|
2205
2201
|
"enable-entity-actions": "",
|
|
2206
2202
|
"error-message": E.value,
|
|
2207
|
-
fetcher: w(
|
|
2203
|
+
fetcher: w(u),
|
|
2208
2204
|
"fetcher-cache-key": s.value,
|
|
2209
2205
|
"pagination-type": "offset",
|
|
2210
2206
|
"preferences-storage-key": "kong-ui-entities-consumer-credentials-list",
|
|
2211
|
-
"table-headers":
|
|
2207
|
+
"table-headers": p.value,
|
|
2212
2208
|
"use-action-outside": e.useActionOutside,
|
|
2213
|
-
onSort:
|
|
2209
|
+
onSort: b
|
|
2214
2210
|
}, {
|
|
2215
2211
|
"toolbar-button": l(() => [
|
|
2216
2212
|
(_(), U(Qe, {
|
|
2217
2213
|
disabled: !e.useActionOutside,
|
|
2218
2214
|
to: "#kong-ui-app-page-header-action-button"
|
|
2219
2215
|
}, [
|
|
2220
|
-
|
|
2216
|
+
v(w(de), {
|
|
2221
2217
|
"auth-function": () => e.canCreate()
|
|
2222
2218
|
}, {
|
|
2223
2219
|
default: l(() => [
|
|
2224
|
-
$e(
|
|
2220
|
+
$e(v(H, {
|
|
2225
2221
|
appearance: "primary",
|
|
2226
2222
|
"data-testid": "toolbar-add-credential",
|
|
2227
2223
|
size: "large",
|
|
2228
2224
|
to: e.config.createRoute
|
|
2229
2225
|
}, {
|
|
2230
2226
|
default: l(() => [
|
|
2231
|
-
|
|
2227
|
+
v(w(st)),
|
|
2232
2228
|
P(" " + A(w(n)(`credentials.list.toolbar_actions.${e.config.plugin}.new`)), 1)
|
|
2233
2229
|
]),
|
|
2234
2230
|
_: 1
|
|
@@ -2250,28 +2246,28 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2250
2246
|
V("span", null, A(m ?? "-"), 1)
|
|
2251
2247
|
]),
|
|
2252
2248
|
password: l(({ rowValue: m }) => [
|
|
2253
|
-
|
|
2249
|
+
v(B, {
|
|
2254
2250
|
format: "redacted",
|
|
2255
2251
|
text: m,
|
|
2256
2252
|
truncate: ""
|
|
2257
2253
|
}, null, 8, ["text"])
|
|
2258
2254
|
]),
|
|
2259
2255
|
key: l(({ rowValue: m }) => [
|
|
2260
|
-
|
|
2256
|
+
v(B, {
|
|
2261
2257
|
format: "redacted",
|
|
2262
2258
|
text: m,
|
|
2263
2259
|
truncate: ""
|
|
2264
2260
|
}, null, 8, ["text"])
|
|
2265
2261
|
]),
|
|
2266
2262
|
client_secret: l(({ rowValue: m }) => [
|
|
2267
|
-
|
|
2263
|
+
v(B, {
|
|
2268
2264
|
format: "redacted",
|
|
2269
2265
|
text: m,
|
|
2270
2266
|
truncate: ""
|
|
2271
2267
|
}, null, 8, ["text"])
|
|
2272
2268
|
]),
|
|
2273
2269
|
secret: l(({ rowValue: m }) => [
|
|
2274
|
-
|
|
2270
|
+
v(B, {
|
|
2275
2271
|
format: "redacted",
|
|
2276
2272
|
text: m,
|
|
2277
2273
|
truncate: ""
|
|
@@ -2298,9 +2294,9 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2298
2294
|
}, 1024)) : (_(), M("span", Fa, "-"))
|
|
2299
2295
|
]),
|
|
2300
2296
|
actions: l(({ row: m }) => [
|
|
2301
|
-
|
|
2297
|
+
v(re, null, {
|
|
2302
2298
|
default: l(({ copyToClipboard: K }) => [
|
|
2303
|
-
|
|
2299
|
+
v(Z, {
|
|
2304
2300
|
"data-testid": "action-entity-copy-id",
|
|
2305
2301
|
onClick: (ne) => F(m, "id", K)
|
|
2306
2302
|
}, {
|
|
@@ -2314,7 +2310,7 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2314
2310
|
}, 1024),
|
|
2315
2311
|
e.config.plugin === "basic-auth" ? (_(), U(re, { key: 0 }, {
|
|
2316
2312
|
default: l(({ copyToClipboard: K }) => [
|
|
2317
|
-
|
|
2313
|
+
v(Z, {
|
|
2318
2314
|
"data-testid": "action-entity-copy-credential",
|
|
2319
2315
|
onClick: (ne) => F(m, "password", K)
|
|
2320
2316
|
}, {
|
|
@@ -2328,7 +2324,7 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2328
2324
|
}, 1024)) : z("", !0),
|
|
2329
2325
|
["key-auth", "key-auth-enc", "jwt"].includes(e.config.plugin) ? (_(), U(re, { key: 1 }, {
|
|
2330
2326
|
default: l(({ copyToClipboard: K }) => [
|
|
2331
|
-
|
|
2327
|
+
v(Z, {
|
|
2332
2328
|
"data-testid": "action-entity-copy-key",
|
|
2333
2329
|
onClick: (ne) => F(m, "key", K)
|
|
2334
2330
|
}, {
|
|
@@ -2342,7 +2338,7 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2342
2338
|
}, 1024)) : z("", !0),
|
|
2343
2339
|
e.config.plugin === "oauth2" ? (_(), U(re, { key: 2 }, {
|
|
2344
2340
|
default: l(({ copyToClipboard: K }) => [
|
|
2345
|
-
|
|
2341
|
+
v(Z, {
|
|
2346
2342
|
"data-testid": "action-entity-copy-secret",
|
|
2347
2343
|
onClick: (ne) => F(m, "client_secret", K)
|
|
2348
2344
|
}, {
|
|
@@ -2356,7 +2352,7 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2356
2352
|
}, 1024)) : z("", !0),
|
|
2357
2353
|
e.config.plugin === "hmac-auth" ? (_(), U(re, { key: 3 }, {
|
|
2358
2354
|
default: l(({ copyToClipboard: K }) => [
|
|
2359
|
-
|
|
2355
|
+
v(Z, {
|
|
2360
2356
|
"data-testid": "action-entity-copy-secret",
|
|
2361
2357
|
onClick: (ne) => F(m, "secret", K)
|
|
2362
2358
|
}, {
|
|
@@ -2368,9 +2364,9 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2368
2364
|
]),
|
|
2369
2365
|
_: 2
|
|
2370
2366
|
}, 1024)) : z("", !0),
|
|
2371
|
-
|
|
2367
|
+
v(re, null, {
|
|
2372
2368
|
default: l(({ copyToClipboard: K }) => [
|
|
2373
|
-
|
|
2369
|
+
v(Z, {
|
|
2374
2370
|
"data-testid": "action-entity-copy-json",
|
|
2375
2371
|
onClick: (ne) => F(m, void 0, K)
|
|
2376
2372
|
}, {
|
|
@@ -2382,11 +2378,11 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2382
2378
|
]),
|
|
2383
2379
|
_: 2
|
|
2384
2380
|
}, 1024),
|
|
2385
|
-
|
|
2381
|
+
v(w(de), {
|
|
2386
2382
|
"auth-function": () => e.canEdit(m)
|
|
2387
2383
|
}, {
|
|
2388
2384
|
default: l(() => [
|
|
2389
|
-
|
|
2385
|
+
v(Z, {
|
|
2390
2386
|
"data-testid": "action-entity-edit",
|
|
2391
2387
|
"has-divider": "",
|
|
2392
2388
|
item: q(m.id)
|
|
@@ -2394,11 +2390,11 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2394
2390
|
]),
|
|
2395
2391
|
_: 2
|
|
2396
2392
|
}, 1032, ["auth-function"]),
|
|
2397
|
-
|
|
2393
|
+
v(w(de), {
|
|
2398
2394
|
"auth-function": () => e.canDelete(m)
|
|
2399
2395
|
}, {
|
|
2400
2396
|
default: l(() => [
|
|
2401
|
-
|
|
2397
|
+
v(Z, {
|
|
2402
2398
|
danger: "",
|
|
2403
2399
|
"data-testid": "action-entity-delete",
|
|
2404
2400
|
"has-divider": "",
|
|
@@ -2415,11 +2411,11 @@ const { useAxios: Oa, useDeleteUrlBuilder: ja, useErrors: Da, useExternalLinkCre
|
|
|
2415
2411
|
]),
|
|
2416
2412
|
_: 1
|
|
2417
2413
|
}, 8, ["cache-identifier", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "table-headers", "use-action-outside"]),
|
|
2418
|
-
|
|
2414
|
+
v(w(Ta), {
|
|
2419
2415
|
"action-pending": J.value,
|
|
2420
2416
|
description: w(n)("credentials.delete.description"),
|
|
2421
2417
|
"entity-type": I.value,
|
|
2422
|
-
error:
|
|
2418
|
+
error: c.value,
|
|
2423
2419
|
title: w(n)(`credentials.delete.${e.config.plugin}.title`),
|
|
2424
2420
|
visible: R.value,
|
|
2425
2421
|
onCancel: O,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function($,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@kong-ui-public/i18n"),require("axios"),require("@kong/kongponents"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","axios","@kong/kongponents","vue-router"],t):($=typeof globalThis<"u"?globalThis:$||self,t($["kong-ui-public-entities-consumer-credentials"]={},$.Vue,$["kong-ui-public-i18n"],$.axios))})(this,function($,t,J,ie){"use strict";const oe="24px",_e=(e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n},Ie=e=>(t.pushScopeId("data-v-c1f7c39c"),e=e(),t.popScopeId(),e),Te=["aria-hidden"],Ae={key:0,"data-testid":"kui-icon-svg-title"},Ee=Ie(()=>t.createElementVNode("path",{d:"M11 19V13H5V11H11V5H13V11H19V13H13V19H11Z",fill:"currentColor"},null,-1)),Be=_e(t.defineComponent({__name:"AddIcon",props:{title:{type:String,required:!1,default:""},color:{type:String,required:!1,default:"currentColor"},display:{type:String,required:!1,default:"block"},decorative:{type:Boolean,required:!1,default:!1},size:{type:[Number,String],required:!1,default:oe,validator:e=>{if(typeof e=="number"&&e>0)return!0;if(typeof e=="string"){const r=String(e).replace(/px/gi,""),n=Number(r);if(n&&!isNaN(n)&&Number.isInteger(n)&&n>0)return!0}return!1}},as:{type:String,required:!1,default:"span"}},setup(e){const r=e,n=t.computed(()=>{if(typeof r.size=="number"&&r.size>0)return`${r.size}px`;if(typeof r.size=="string"){const i=String(r.size).replace(/px/gi,""),l=Number(i);if(l&&!isNaN(l)&&Number.isInteger(l)&&l>0)return`${l}px`}return oe}),a=t.computed(()=>({boxSizing:"border-box",color:r.color,display:r.display,flexShrink:"0",height:n.value,lineHeight:"0",width:n.value}));return(i,l)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.as),{"aria-hidden":e.decorative?"true":void 0,class:"kui-icon add-icon","data-testid":"kui-icon-wrapper-add-icon",style:t.normalizeStyle(a.value)},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{"aria-hidden":e.decorative?"true":void 0,"data-testid":"kui-icon-svg-add-icon",fill:"none",height:"100%",role:"img",viewBox:"0 0 24 24",width:"100%",xmlns:"http://www.w3.org/2000/svg"},[e.title?(t.openBlock(),t.createElementBlock("title",Ae,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),Ee],8,Te))]),_:1},8,["aria-hidden","style"]))}}),[["__scopeId","data-v-c1f7c39c"]]),ve={credentials:{title:"Consumer Credentials",list:{toolbar_actions:{acls:{new:"New ACL Credential"},"basic-auth":{new:"New Basic Auth Credential"},"key-auth":{new:"New Key Auth Credential"},"key-auth-enc":{new:"New Key Auth Encrypted Credential"},oauth2:{new:"New OAuth 2.0 Credential"},"hmac-auth":{new:"New HMAC Credential"},jwt:{new:"New JWT Credential"}},table_headers:{acls:{group:"Group",created_at:"Created At",tags:"Tags"},"basic-auth":{password:"Credential",username:"Username",created_at:"Created at",tags:"Tags"},"key-auth":{key:"Key",created_at:"Created at",tags:"Tags"},"key-auth-enc":{key:"Key",created_at:"Created at",tags:"Tags"},oauth2:{name:"Name",client_id:"Client ID",client_secret:"Client secret",created_at:"Created at",tags:"Tags"},"hmac-auth":{username:"Username",secret:"Secret",created_at:"Created at",tags:"Tags"},jwt:{key:"Key",algorithm:"Algorithm",created_at:"Created at",tags:"Tags"}},empty_state:{acls:{title:"Configure a New ACL Credential",cta:"New ACL Credential"},"basic-auth":{title:"Configure a New Basic Auth Credential",cta:"New Basic Auth Credential"},"key-auth":{title:"Configure a New Key Auth Credential",cta:"New Key Auth Credential"},"key-auth-enc":{title:"Configure a New Key Auth Encrypted Credential",cta:"New Key Auth Encrypted Credential"},oauth2:{title:"Configure a New OAuth 2.0 Credential",cta:"New OAuth 2.0 Credential"},"hmac-auth":{title:"Configure a New HMAC Credential",cta:"New HMAC Credential"},jwt:{title:"Configure a New JWT Credential",cta:"New JWT Credential"}}},actions:{copy_id:"Copy ID",copy_credential:"Copy Credential",copy_key:"Copy Key",copy_secret:"Copy Secret",copy_json:"Copy JSON",edit:"Edit",delete:"Delete"},delete:{acls:{title:"Delete an ACL Credential"},"basic-auth":{title:"Delete a Basic Auth Credential"},"key-auth":{title:"Delete a Key Auth Credential"},"key-auth-enc":{title:"Delete a Key Auth Encrypted Credential"},oauth2:{title:"Delete an OAuth 2.0 Credential"},"hmac-auth":{title:"Delete an HMAC Credential"},jwt:{title:"Delete a JWT Credential"},description:"This action cannot be reversed."},error:{general:"Credentials could not be retrieved",delete:"The credential could not be deleted at this time.",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}}};function Ve(){const e=J.createI18n("en-us",ve);return{i18n:e,i18nT:J.i18nTComponent(e)}}const Oe={useI18n:Ve},je={list:{konnect:"/v2/control-planes/{controlPlaneId}/core-entities/consumers/{consumerId}/{plugin}",kongManager:"/{workspace}/consumers/{consumerId}/{plugin}"}};var le=(e=>(e.GatewayService="service",e.Route="route",e.Consumer="consumer",e.ConsumerGroup="consumer group",e.Plugin="plugin",e.Upstream="upstream",e.Certificate="certificate",e.CACertificate="ca certificate",e.SNI="SNI",e.Key="key",e.KeySet="key set",e.Vault="vault",e.Application="application",e.Developer="developer",e.acls="ACL Credential",e["basic-auth"]="Basic Auth Credential",e["key-auth"]="Key Auth Credential",e["key-auth-enc"]="Key Auth Encrypted Credential",e.oauth2="OAuth 2.0 Credential",e["hmac-auth"]="HMAC Credential",e.jwt="JWT Credential",e.Target="target",e.Policy="policy",e.Secret="secret",e))(le||{}),M=(e=>(e[e.Loading=0]="Loading",e[e.Idle=1]="Idle",e[e.NoResults=2]="NoResults",e[e.Error=3]="Error",e))(M||{});function $e(){return{getAxiosInstance:(e={})=>{try{const r=t.inject("get-axios-instance",void 0);return typeof r=="function"?r(e):ie.create({withCredentials:!0,timeout:3e4,...e})}catch(r){return console.warn("getAxiosInstance:",r.message||r),ie.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var r;return((r=e==null?void 0:e.response)==null?void 0:r.headers["x-datadog-trace-id"])||""}}}function De(){return{debounce:(e,r)=>{let n;return(...a)=>{clearTimeout(n),n=window==null?void 0:window.setTimeout(()=>{e(...a)},r)}}}}const G="khcp-user-table-preferences",Ke={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnWidths:{},columnVisibility:{}};function qe(){const e=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(a){console.error("useTablePreferences(tryParseJson)",a);return}},r=()=>{const n=e(localStorage.getItem(G));return!n||!Object.keys(n).length?new Map:new Map(Object.entries(n))};return{setTablePreferences:(n,a)=>{try{const i=r();i.set(n,a),localStorage.setItem(G,JSON.stringify(Object.fromEntries(i.entries())))}catch(i){console.error("useTablePreferences(setTablePreferences)",i)}},getTablePreferences:n=>{const a=r();return(a==null?void 0:a.get(n))||void 0||Ke},deleteAllTablePreferences:()=>{localStorage.removeItem(G)}}}function X(e={}){const{getAxiosInstance:r}=$e();return{axiosInstance:r(e)}}const Fe={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},Me={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},Pe={actions:{viewConfiguration:"View Configuration",save:"Save",cancel:"Cancel",back:"Back"},configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",yaml:"YAML",json:"JSON"},errors:{edit:"The entity could not be edited at this time."}},Le={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},Re={title:"Configuration",actions:{copy:"Copy JSON"},sections:{advanced:"Advanced",plugin:"Plugin Specific Configuration"},commonFields:{id_label:"ID",name_label:"Name",enabled_label:"Enabled",enabled_tooltip:"Enabled is FTW",updated_at_label:"Last Updated",created_at_label:"Created",tags_label:"Tags",link:"Link"},statusBadge:{enabledLabel:"Enabled",disabledLabel:"Disabled"},copy:{tooltip:"Copy {label}",success:"Copied!"},errors:{load:"The entity configuration data could not be loaded at this time.",copy:"Failed to copy to clipboard"},general:{entryTitle:"Entry {index}",structuredFormat:"Structured"}},Ue={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},ze={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},He={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},Je={utf8Name:"The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."},We={enable:{title:"Enable {entityType}",message:"Are you sure you want to enable the {entityType} {entityName}?",confirmText:"Yes, enable"},disable:{title:"Disable {entityType}",message:"Are you sure you want to disable the {entityType} {entityName}?",confirmText:"Yes, disable"}},Ye={global:Fe,deleteModal:Me,baseForm:Pe,baseTable:Le,baseConfigCard:Re,filter:Ue,debouncedFilter:ze,errors:He,validationErrors:Je,toggleModal:We};function W(){const e=J.createI18n("en-us",Ye);return{i18n:e,i18nT:J.i18nTComponent(e)}}function se(){const e=(n,a)=>(a==null?void 0:a[n])??void 0,r=(n,a)=>{if(n.length!==a.length)return!1;const i=new Set([...n,...a]);for(const l of i){const o=n.filter(h=>h===l).length,s=a.filter(h=>h===l).length;if(o!==s)return!1}return!0};return{getPropValue:e,objectsAreEqual:(n,a,i)=>{if(i){if(Object.keys(n).length===Object.keys(a).length)for(const l in n)if(Array.isArray(n[l])&&Array.isArray(a[l])){if(r(n[l],a[l]))continue;return!1}else{if(n[l]===a[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(n)===JSON.stringify(a)}catch{return!1}},sortAlpha:n=>(a,i)=>{let l=a[n]===void 0||a[n]===null?"":a[n],o=i[n]===void 0||i[n]===null?"":i[n];return Array.isArray(a[n])&&(l=a[n][0]),Array.isArray(i[n])&&(o=i[n][0]),l.localeCompare(o)},isValidUuid:n=>n?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(n):!1}}function Ze(e,r,n,a={fetchedItemsKey:"data",searchKeys:["id"]}){n||(n="1000");const{axiosInstance:i}=X(e.axiosRequestConfig),{i18n:{t:l}}=W(),{debounce:o}=De(),s=o(async u=>{await B(u)},200),h=t.ref(!1),f=t.ref(""),g=t.ref(""),c=t.ref([]),w=t.ref([]),b=t.ref(void 0),S=t.computed(()=>{const u=`${e.apiBaseUrl}${t.unref(r)}`;return e.app==="konnect"?u.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||""):e.app==="kongManager"?u.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:""):u}),{isValidUuid:E}=se(),k=async()=>{try{h.value=!0;const{data:u}=await i.get(`${S.value}?size=${n}`);u!=null&&u.next||(b.value=a.fetchedItemsKey in u?u[a.fetchedItemsKey]:[]),w.value=a.fetchedItemsKey in u?u[a.fetchedItemsKey]:[],c.value=w.value}catch{c.value=[],f.value=l("debouncedFilter.errors.fetch")}finally{h.value=!1}},N=t.ref(""),B=async u=>{var V,D,d;if(N.value!==u){if(u===""){c.value=w.value;return}else N.value=u||"";if(b.value===void 0)try{if(h.value=!0,f.value="",g.value="",e.app==="konnect"){let p=S.value+"";u&&(p+=`/${u}`);const{data:x}=await i.get(`${p}?size=${n}`);a.fetchedItemsKey in x?c.value=x[a.fetchedItemsKey]:x!=null&&x[a.exactMatchKey??"id"]?c.value=[x]:c.value=[]}else if(u){const p=[];E(u)&&a.searchKeys.includes("id")?p.push((async()=>{const{data:_}=await i.get(`${S.value}/${u}`);return[_[a.fetchedItemsKey]??_]})()):p.push(...a.searchKeys.filter(_=>_!=="id").map(async _=>{const{data:O}=await i.get(`${S.value}?${_}=${u}`);return O[a.fetchedItemsKey]}));const x=await Promise.all(p),K=new Set;c.value=[],(V=x==null?void 0:x.forEach)==null||V.call(x,_=>{var O;(O=_==null?void 0:_.forEach)==null||O.call(_,T=>{K.has(T.id)||(K.add(T.id),c.value.push(T))})})}else c.value=w.value}catch(p){((D=p==null?void 0:p.response)==null?void 0:D.status)===404?g.value=l("debouncedFilter.errors.invalid"):(c.value=[],f.value=l("debouncedFilter.errors.fetch"))}finally{h.value=!1}else h.value=!0,g.value="",u?(c.value=(d=b.value)==null?void 0:d.filter(p=>{var x;let K=!1;for(const _ of a.searchKeys){const O=typeof p[_]=="string"?(x=p[_])==null?void 0:x.toLowerCase():p[_];O!=null&&O.includes(u.toLowerCase())&&(K=!0)}return K}),(!c.value||!c.value.length)&&(g.value=l("debouncedFilter.errors.invalid"))):c.value=b.value,h.value=!1}};return{loading:h,error:f,validationError:g,results:c,allRecords:b,loadItems:k,debouncedQueryChange:s}}function Ge(e,r){const n=t.unref(r),a=t.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${n}`):new URL(n));return a.value.search="",i=>`${a.value.href}/${i}`}function Xe(){const{i18n:{t:e}}=W();return{getMessageFromError:r=>{var n,a,i,l;if(!r)return e("errors.unexpected");if(((n=r==null?void 0:r.response)==null?void 0:n.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((a=r==null?void 0:r.response)!=null&&a.data){if(r.response.data.detail)return r.response.data.detail;if((i=r.response.data.details)!=null&&i.length)return r.response.data.details.map(o=>{let s=e("errors.unexpected");return o.messages&&typeof o.messages=="object"&&o.messages.length&&(s=o.messages.join(", ")),o.field?`${o.field} - ${s}`:s}).join("; ");if(r.response.data.message){const{message:o}=r.response.data;return Array.isArray(o)?(l=o[0])!=null&&l.constraints?Object.values(o[0].constraints)[0]:o[0]:o}if(typeof r.response.data=="string")return r.response.data;if(typeof r.response.data=="object")return Object.keys(r.response.data).map(o=>`${o} ${r.response.data[o]}`).join(", ")}return r.message||e("errors.unexpected")}}}function Qe(e){const r=window.location.origin,n=r.endsWith("/")?r:`${r}/`;try{const a=e.join("/"),i=`${n}${a}`,l=e.some(o=>o.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(i)&&!l&&new URL(i))return`${n}${a}`;throw new Error("Invalid url")}catch(a){return console.warn("Failed to build valid URL:",a),""}}function ce(e,r){const n=t.ref(t.unref(e)),a=t.ref(t.unref(r)),i=t.computed(()=>!!(n.value.app==="konnect"||n.value.isExactMatch)),l=t.computed(()=>a.value.startsWith("/")?new URL(`${window.location.origin}${a.value}`):new URL(a.value));return o=>{const{page:s,pageSize:h,offset:f,sortColumnKey:g,sortColumnOrder:c,query:w}=o;try{let b=new URL(l.value.href);return i.value&&w?(b.search="",b=n.value.isExactMatch?new URL(`${b.href}/${w}/`):new URL(`${b.href}?filter[name][contains]=${w}`)):(i.value||new URLSearchParams(w).forEach((S,E)=>{b.searchParams.append(E,S)}),g&&b.searchParams.append("sort_by",g),c==="desc"&&b.searchParams.append("sort_desc","1"),b.searchParams.append("size",String(h))),f&&s!==1&&b.searchParams.append("offset",String(f)),b.href}catch(b){return console.error("RouteList(fetcher)",b),a.value}}}function et(e,r,n="data"){const a=t.unref(r),{axiosInstance:i}=X(e.axiosRequestConfig),l=ce(e,a),o=t.ref({status:M.Idle});return{fetcher:async s=>{var h;try{o.value={status:M.Loading};let f=l(s);f.includes("filter[name]")&&(f=`${f}&page[size]=${s.pageSize}&page[number]=${s.page}`);const g=await i.get(f);if(g.status>=400)throw g;const c=g.data,w=n&&n.replace(/[^\w-_]/gi,"");let b;c[w]&&Array.isArray(c[w])?b=c[w]:Array.isArray(c)?b=c:b=Object.keys(c).length?[c]:[];const S={data:b,total:b.length,...c.offset?{pagination:{offset:c.offset}}:null};return o.value={status:M.Idle,response:S},S}catch(f){const g={data:[],total:0};return s.query&&(((h=f.response)==null?void 0:h.status)===404||f.status===404)?(o.value={status:M.NoResults,response:g,error:f.response?f:{response:f}},g):(o.value={status:M.Error,response:g,error:f.response?f:{response:f}},g)}},fetcherState:o}}function tt(){const e=(n,a="_")=>n?n.split(a).map(i=>i.toLowerCase()==="id"?i.toUpperCase():i.charAt(0).toUpperCase()+i.substring(1)).join(" "):"",r=/(?:^|[\s-:'"])\w/g;return{capitalize:n=>n?n.replace(r,a=>a.toUpperCase()):"",convertKeyToTitle:e}}const de=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,ue=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const r=e.match(de);if(!r)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return r.shift(),r},pe=e=>e==="*"||e==="x"||e==="X",fe=e=>{const r=parseInt(e,10);return isNaN(r)?e:r},rt=(e,r)=>typeof e!=typeof r?[String(e),String(r)]:[e,r],nt=(e,r)=>{if(pe(e)||pe(r))return 0;const[n,a]=rt(fe(e),fe(r));return n>a?1:n<a?-1:0},ye=(e,r)=>{for(let n=0;n<Math.max(e.length,r.length);n++){const a=nt(e[n]||"0",r[n]||"0");if(a!==0)return a}return 0},at=(e,r)=>{const n=ue(e),a=ue(r),i=n.pop(),l=a.pop(),o=ye(n,a);return o!==0?o:i&&l?ye(i.split("."),l.split(".")):i||l?i?-1:1:0},he=(e,r,n)=>{it(n);const a=at(e,r);return ge[n].includes(a)},ge={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},me=Object.keys(ge),it=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(me.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${me.join("|")}`)},ot=e=>typeof e=="string"&&/^[v\d]/.test(e)&&de.test(e);function lt(e){const{gatewayInfo:r,supportedRange:n}=e;if(!r)return!0;const{edition:a,version:i}=r;if(!ot(i))return console.error("Invalid version"),!1;const l=n[a];if(!l)return!1;const[o,s]=l;return!(o&&he(i,o,"<")||s&&he(i,s,">"))}function st(e){const r=t.ref(0),n=t.ref(0),a=t.ref(!1);return t.watch(e,i=>{i&&!a.value&&(r.value=i.offsetWidth,n.value=i.scrollWidth,a.value=!0)}),{isTruncated:t.computed(()=>r.value<n.value)}}function ct(){const{i18n:{t:e}}=W();return{utf8Name:r=>/^[\p{N}\p{L}.\-_~]*$/u.test(r)?"":e("validationErrors.utf8Name")}}const Q={useAxios:X,useDebouncedFilter:Ze,useDeleteUrlBuilder:Ge,useErrors:Xe,useExternalLinkCreator:Qe,useFetcher:et,useFetchUrlBuilder:ce,useHelpers:se,useStringHelpers:tt,useI18n:W,useGatewayFeatureSupported:lt,useTruncationDetector:st,useValidators:ct},ee=(e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n};/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function be(e){return typeof e>"u"||e===null}function dt(e){return typeof e=="object"&&e!==null}function ut(e){return Array.isArray(e)?e:be(e)?[]:[e]}function pt(e,r){var n,a,i,l;if(r)for(l=Object.keys(r),n=0,a=l.length;n<a;n+=1)i=l[n],e[i]=r[i];return e}function ft(e,r){var n="",a;for(a=0;a<r;a+=1)n+=e;return n}function yt(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ht=be,gt=dt,mt=ut,bt=ft,wt=yt,Ct=pt,te={isNothing:ht,isObject:gt,toArray:mt,repeat:bt,isNegativeZero:wt,extend:Ct};function we(e,r){var n="",a=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
|
|
1
|
+
(function($,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@kong-ui-public/i18n"),require("axios"),require("@kong/kongponents"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","axios","@kong/kongponents","vue-router"],t):($=typeof globalThis<"u"?globalThis:$||self,t($["kong-ui-public-entities-consumer-credentials"]={},$.Vue,$["kong-ui-public-i18n"],$.axios))})(this,function($,t,J,ie){"use strict";const oe="24px",_e=(e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n},Te=e=>(t.pushScopeId("data-v-c1f7c39c"),e=e(),t.popScopeId(),e),Ie=["aria-hidden"],Ae={key:0,"data-testid":"kui-icon-svg-title"},Ee=Te(()=>t.createElementVNode("path",{d:"M11 19V13H5V11H11V5H13V11H19V13H13V19H11Z",fill:"currentColor"},null,-1)),Be=_e(t.defineComponent({__name:"AddIcon",props:{title:{type:String,required:!1,default:""},color:{type:String,required:!1,default:"currentColor"},display:{type:String,required:!1,default:"block"},decorative:{type:Boolean,required:!1,default:!1},size:{type:[Number,String],required:!1,default:oe,validator:e=>{if(typeof e=="number"&&e>0)return!0;if(typeof e=="string"){const r=String(e).replace(/px/gi,""),n=Number(r);if(n&&!isNaN(n)&&Number.isInteger(n)&&n>0)return!0}return!1}},as:{type:String,required:!1,default:"span"}},setup(e){const r=e,n=t.computed(()=>{if(typeof r.size=="number"&&r.size>0)return`${r.size}px`;if(typeof r.size=="string"){const i=String(r.size).replace(/px/gi,""),l=Number(i);if(l&&!isNaN(l)&&Number.isInteger(l)&&l>0)return`${l}px`}return oe}),a=t.computed(()=>({boxSizing:"border-box",color:r.color,display:r.display,flexShrink:"0",height:n.value,lineHeight:"0",width:n.value}));return(i,l)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.as),{"aria-hidden":e.decorative?"true":void 0,class:"kui-icon add-icon","data-testid":"kui-icon-wrapper-add-icon",style:t.normalizeStyle(a.value)},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{"aria-hidden":e.decorative?"true":void 0,"data-testid":"kui-icon-svg-add-icon",fill:"none",height:"100%",role:"img",viewBox:"0 0 24 24",width:"100%",xmlns:"http://www.w3.org/2000/svg"},[e.title?(t.openBlock(),t.createElementBlock("title",Ae,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),Ee],8,Ie))]),_:1},8,["aria-hidden","style"]))}}),[["__scopeId","data-v-c1f7c39c"]]),Ve={credentials:{title:"Consumer Credentials",list:{toolbar_actions:{acls:{new:"New ACL Credential"},"basic-auth":{new:"New Basic Auth Credential"},"key-auth":{new:"New Key Auth Credential"},"key-auth-enc":{new:"New Key Auth Encrypted Credential"},oauth2:{new:"New OAuth 2.0 Credential"},"hmac-auth":{new:"New HMAC Credential"},jwt:{new:"New JWT Credential"}},table_headers:{acls:{group:"Group",created_at:"Created At",tags:"Tags"},"basic-auth":{password:"Credential",username:"Username",created_at:"Created at",tags:"Tags"},"key-auth":{key:"Key",created_at:"Created at",tags:"Tags"},"key-auth-enc":{key:"Key",created_at:"Created at",tags:"Tags"},oauth2:{name:"Name",client_id:"Client ID",client_secret:"Client secret",created_at:"Created at",tags:"Tags"},"hmac-auth":{username:"Username",secret:"Secret",created_at:"Created at",tags:"Tags"},jwt:{key:"Key",algorithm:"Algorithm",created_at:"Created at",tags:"Tags"}},empty_state:{acls:{title:"Configure a New ACL Credential",cta:"New ACL Credential"},"basic-auth":{title:"Configure a New Basic Auth Credential",cta:"New Basic Auth Credential"},"key-auth":{title:"Configure a New Key Auth Credential",cta:"New Key Auth Credential"},"key-auth-enc":{title:"Configure a New Key Auth Encrypted Credential",cta:"New Key Auth Encrypted Credential"},oauth2:{title:"Configure a New OAuth 2.0 Credential",cta:"New OAuth 2.0 Credential"},"hmac-auth":{title:"Configure a New HMAC Credential",cta:"New HMAC Credential"},jwt:{title:"Configure a New JWT Credential",cta:"New JWT Credential"}}},actions:{copy_id:"Copy ID",copy_credential:"Copy Credential",copy_key:"Copy Key",copy_secret:"Copy Secret",copy_json:"Copy JSON",edit:"Edit",delete:"Delete"},delete:{acls:{title:"Delete an ACL Credential"},"basic-auth":{title:"Delete a Basic Auth Credential"},"key-auth":{title:"Delete a Key Auth Credential"},"key-auth-enc":{title:"Delete a Key Auth Encrypted Credential"},oauth2:{title:"Delete an OAuth 2.0 Credential"},"hmac-auth":{title:"Delete an HMAC Credential"},jwt:{title:"Delete a JWT Credential"},description:"This action cannot be reversed."},error:{general:"Credentials could not be retrieved",delete:"The credential could not be deleted at this time.",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}}};function ve(){const e=J.createI18n("en-us",Ve);return{i18n:e,i18nT:J.i18nTComponent(e)}}const Oe={useI18n:ve},je={list:{konnect:"/v2/control-planes/{controlPlaneId}/core-entities/consumers/{consumerId}/{plugin}",kongManager:"/{workspace}/consumers/{consumerId}/{plugin}"}};var le=(e=>(e.GatewayService="service",e.Route="route",e.Consumer="consumer",e.ConsumerGroup="consumer group",e.Plugin="plugin",e.Upstream="upstream",e.Certificate="certificate",e.CACertificate="ca certificate",e.SNI="SNI",e.Key="key",e.KeySet="key set",e.Vault="vault",e.Application="application",e.Developer="developer",e.acls="ACL Credential",e["basic-auth"]="Basic Auth Credential",e["key-auth"]="Key Auth Credential",e["key-auth-enc"]="Key Auth Encrypted Credential",e.oauth2="OAuth 2.0 Credential",e["hmac-auth"]="HMAC Credential",e.jwt="JWT Credential",e.Target="target",e.Policy="policy",e.Secret="secret",e))(le||{}),M=(e=>(e[e.Loading=0]="Loading",e[e.Idle=1]="Idle",e[e.NoResults=2]="NoResults",e[e.Error=3]="Error",e))(M||{});function $e(){return{getAxiosInstance:(e={})=>{try{const r=t.inject("get-axios-instance",void 0);return typeof r=="function"?r(e):ie.create({withCredentials:!0,timeout:3e4,...e})}catch(r){return console.warn("getAxiosInstance:",r.message||r),ie.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var r;return((r=e==null?void 0:e.response)==null?void 0:r.headers["x-datadog-trace-id"])||""}}}function De(){return{debounce:(e,r)=>{let n;return(...a)=>{clearTimeout(n),n=window==null?void 0:window.setTimeout(()=>{e(...a)},r)}}}}const G="khcp-user-table-preferences",Ke={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnWidths:{},columnVisibility:{}};function qe(){const e=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(a){console.error("useTablePreferences(tryParseJson)",a);return}},r=()=>{const n=e(localStorage.getItem(G));return!n||!Object.keys(n).length?new Map:new Map(Object.entries(n))};return{setTablePreferences:(n,a)=>{try{const i=r();i.set(n,a),localStorage.setItem(G,JSON.stringify(Object.fromEntries(i.entries())))}catch(i){console.error("useTablePreferences(setTablePreferences)",i)}},getTablePreferences:n=>{const a=r();return(a==null?void 0:a.get(n))||void 0||Ke},deleteAllTablePreferences:()=>{localStorage.removeItem(G)}}}function X(e={}){const{getAxiosInstance:r}=$e();return{axiosInstance:r(e)}}const Fe={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},Me={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},Pe={actions:{viewConfiguration:"View Configuration",save:"Save",cancel:"Cancel",back:"Back"},configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",yaml:"YAML",json:"JSON"},errors:{edit:"The entity could not be edited at this time."}},Le={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},Re={title:"Configuration",actions:{copy:"Copy JSON"},sections:{advanced:"Advanced",plugin:"Plugin Specific Configuration"},commonFields:{id_label:"ID",name_label:"Name",enabled_label:"Enabled",enabled_tooltip:"Enabled is FTW",updated_at_label:"Last Updated",created_at_label:"Created",tags_label:"Tags",link:"Link"},statusBadge:{enabledLabel:"Enabled",disabledLabel:"Disabled"},copy:{tooltip:"Copy {label}",success:"Copied!"},errors:{load:"The entity configuration data could not be loaded at this time.",copy:"Failed to copy to clipboard"},general:{entryTitle:"Entry {index}",structuredFormat:"Structured"}},Ue={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},ze={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},He={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},Je={utf8Name:"The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."},We={enable:{title:"Enable {entityType}",message:"Are you sure you want to enable the {entityType} {entityName}?",confirmText:"Yes, enable"},disable:{title:"Disable {entityType}",message:"Are you sure you want to disable the {entityType} {entityName}?",confirmText:"Yes, disable"}},Ye={global:Fe,deleteModal:Me,baseForm:Pe,baseTable:Le,baseConfigCard:Re,filter:Ue,debouncedFilter:ze,errors:He,validationErrors:Je,toggleModal:We};function W(){const e=J.createI18n("en-us",Ye);return{i18n:e,i18nT:J.i18nTComponent(e)}}function se(){const e=(n,a)=>(a==null?void 0:a[n])??void 0,r=(n,a)=>{if(n.length!==a.length)return!1;const i=new Set([...n,...a]);for(const l of i){const o=n.filter(y=>y===l).length,s=a.filter(y=>y===l).length;if(o!==s)return!1}return!0};return{getPropValue:e,objectsAreEqual:(n,a,i)=>{if(i){if(Object.keys(n).length===Object.keys(a).length)for(const l in n)if(Array.isArray(n[l])&&Array.isArray(a[l])){if(r(n[l],a[l]))continue;return!1}else{if(n[l]===a[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(n)===JSON.stringify(a)}catch{return!1}},sortAlpha:n=>(a,i)=>{let l=a[n]===void 0||a[n]===null?"":a[n],o=i[n]===void 0||i[n]===null?"":i[n];return Array.isArray(a[n])&&(l=a[n][0]),Array.isArray(i[n])&&(o=i[n][0]),l.localeCompare(o)},isValidUuid:n=>n?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(n):!1}}function Ze(e,r,n,a={fetchedItemsKey:"data",searchKeys:["id"]}){n||(n="1000");const{axiosInstance:i}=X(e.axiosRequestConfig),{i18n:{t:l}}=W(),{debounce:o}=De(),s=o(async h=>{await B(h)},200),y=t.ref(!1),p=t.ref(""),g=t.ref(""),d=t.ref([]),w=t.ref([]),b=t.ref(void 0),S=t.computed(()=>{const h=`${e.apiBaseUrl}${t.unref(r)}`;return e.app==="konnect"?h.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||""):e.app==="kongManager"?h.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:""):h}),{isValidUuid:E}=se(),k=async()=>{try{y.value=!0;const{data:h}=await i.get(`${S.value}?size=${n}`);h!=null&&h.next||(b.value=a.fetchedItemsKey in h?h[a.fetchedItemsKey]:[]),w.value=a.fetchedItemsKey in h?h[a.fetchedItemsKey]:[],d.value=w.value}catch{d.value=[],p.value=l("debouncedFilter.errors.fetch")}finally{y.value=!1}},N=t.ref(""),B=async h=>{var v,D,c;if(N.value!==h){if(N.value=h??"",!h){d.value=w.value;return}if(b.value===void 0)try{if(y.value=!0,p.value="",g.value="",e.app==="konnect"){const u=`${S.value}/${h}`,{data:x}=await i.get(`${u}?size=${n}`);a.fetchedItemsKey in x?d.value=x[a.fetchedItemsKey]:x!=null&&x[a.exactMatchKey??"id"]?d.value=[x]:d.value=[]}else{const u=[];E(h)&&a.searchKeys.includes("id")?u.push((async()=>{const{data:_}=await i.get(`${S.value}/${h}`);return[_[a.fetchedItemsKey]??_]})()):u.push(...a.searchKeys.filter(_=>_!=="id").map(async _=>{const{data:O}=await i.get(`${S.value}?${_}=${h}`);return O[a.fetchedItemsKey]}));const x=await Promise.all(u),K=new Set;d.value=[],(v=x==null?void 0:x.forEach)==null||v.call(x,_=>{var O;(O=_==null?void 0:_.forEach)==null||O.call(_,I=>{K.has(I.id)||(K.add(I.id),d.value.push(I))})})}}catch(u){((D=u==null?void 0:u.response)==null?void 0:D.status)===404?g.value=l("debouncedFilter.errors.invalid"):(d.value=[],p.value=l("debouncedFilter.errors.fetch"))}finally{y.value=!1}else y.value=!0,g.value="",d.value=(c=b.value)==null?void 0:c.filter(u=>{var x;let K=!1;for(const _ of a.searchKeys){const O=typeof u[_]=="string"?(x=u[_])==null?void 0:x.toLowerCase():u[_];O!=null&&O.includes(h.toLowerCase())&&(K=!0)}return K}),(!d.value||!d.value.length)&&(g.value=l("debouncedFilter.errors.invalid")),y.value=!1}};return{loading:y,error:p,validationError:g,results:d,allRecords:b,loadItems:k,debouncedQueryChange:s}}function Ge(e,r){const n=t.unref(r),a=t.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${n}`):new URL(n));return a.value.search="",i=>`${a.value.href}/${i}`}function Xe(){const{i18n:{t:e}}=W();return{getMessageFromError:r=>{var n,a,i,l;if(!r)return e("errors.unexpected");if(((n=r==null?void 0:r.response)==null?void 0:n.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((a=r==null?void 0:r.response)!=null&&a.data){if(r.response.data.detail)return r.response.data.detail;if((i=r.response.data.details)!=null&&i.length)return r.response.data.details.map(o=>{let s=e("errors.unexpected");return o.messages&&typeof o.messages=="object"&&o.messages.length&&(s=o.messages.join(", ")),o.field?`${o.field} - ${s}`:s}).join("; ");if(r.response.data.message){const{message:o}=r.response.data;return Array.isArray(o)?(l=o[0])!=null&&l.constraints?Object.values(o[0].constraints)[0]:o[0]:o}if(typeof r.response.data=="string")return r.response.data;if(typeof r.response.data=="object")return Object.keys(r.response.data).map(o=>`${o} ${r.response.data[o]}`).join(", ")}return r.message||e("errors.unexpected")}}}function Qe(e){const r=window.location.origin,n=r.endsWith("/")?r:`${r}/`;try{const a=e.join("/"),i=`${n}${a}`,l=e.some(o=>o.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(i)&&!l&&new URL(i))return`${n}${a}`;throw new Error("Invalid url")}catch(a){return console.warn("Failed to build valid URL:",a),""}}function ce(e,r){const n=t.ref(t.unref(e)),a=t.ref(t.unref(r)),i=t.computed(()=>!!(n.value.app==="konnect"||n.value.isExactMatch)),l=t.computed(()=>a.value.startsWith("/")?new URL(`${window.location.origin}${a.value}`):new URL(a.value));return o=>{const{page:s,pageSize:y,offset:p,sortColumnKey:g,sortColumnOrder:d,query:w}=o;try{let b=new URL(l.value.href);return i.value&&w?(b.search="",b=n.value.isExactMatch?new URL(`${b.href}/${w}/`):new URL(`${b.href}?filter[name][contains]=${w}`)):(i.value||new URLSearchParams(w).forEach((S,E)=>{b.searchParams.append(E,S)}),g&&b.searchParams.append("sort_by",g),d==="desc"&&b.searchParams.append("sort_desc","1"),b.searchParams.append("size",String(y))),p&&s!==1&&b.searchParams.append("offset",String(p)),b.href}catch(b){return console.error("RouteList(fetcher)",b),a.value}}}function et(e,r,n="data"){const a=t.unref(r),{axiosInstance:i}=X(e.axiosRequestConfig),l=ce(e,a),o=t.ref({status:M.Idle});return{fetcher:async s=>{var y;try{o.value={status:M.Loading};let p=l(s);p.includes("filter[name]")&&(p=`${p}&page[size]=${s.pageSize}&page[number]=${s.page}`);const g=await i.get(p);if(g.status>=400)throw g;const d=g.data,w=n&&n.replace(/[^\w-_]/gi,"");let b;d[w]&&Array.isArray(d[w])?b=d[w]:Array.isArray(d)?b=d:b=Object.keys(d).length?[d]:[];const S={data:b,total:b.length,...d.offset?{pagination:{offset:d.offset}}:null};return o.value={status:M.Idle,response:S},S}catch(p){const g={data:[],total:0};return s.query&&(((y=p.response)==null?void 0:y.status)===404||p.status===404)?(o.value={status:M.NoResults,response:g,error:p.response?p:{response:p}},g):(o.value={status:M.Error,response:g,error:p.response?p:{response:p}},g)}},fetcherState:o}}function tt(){const e=(n,a="_")=>n?n.split(a).map(i=>i.toLowerCase()==="id"?i.toUpperCase():i.charAt(0).toUpperCase()+i.substring(1)).join(" "):"",r=/(?:^|[\s-:'"])\w/g;return{capitalize:n=>n?n.replace(r,a=>a.toUpperCase()):"",convertKeyToTitle:e}}const de=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,ue=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const r=e.match(de);if(!r)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return r.shift(),r},pe=e=>e==="*"||e==="x"||e==="X",fe=e=>{const r=parseInt(e,10);return isNaN(r)?e:r},rt=(e,r)=>typeof e!=typeof r?[String(e),String(r)]:[e,r],nt=(e,r)=>{if(pe(e)||pe(r))return 0;const[n,a]=rt(fe(e),fe(r));return n>a?1:n<a?-1:0},ye=(e,r)=>{for(let n=0;n<Math.max(e.length,r.length);n++){const a=nt(e[n]||"0",r[n]||"0");if(a!==0)return a}return 0},at=(e,r)=>{const n=ue(e),a=ue(r),i=n.pop(),l=a.pop(),o=ye(n,a);return o!==0?o:i&&l?ye(i.split("."),l.split(".")):i||l?i?-1:1:0},he=(e,r,n)=>{it(n);const a=at(e,r);return ge[n].includes(a)},ge={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},me=Object.keys(ge),it=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(me.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${me.join("|")}`)},ot=e=>typeof e=="string"&&/^[v\d]/.test(e)&&de.test(e);function lt(e){const{gatewayInfo:r,supportedRange:n}=e;if(!r)return!0;const{edition:a,version:i}=r;if(!ot(i))return console.error("Invalid version"),!1;const l=n[a];if(!l)return!1;const[o,s]=l;return!(o&&he(i,o,"<")||s&&he(i,s,">"))}function st(e){const r=t.ref(0),n=t.ref(0),a=t.ref(!1);return t.watch(e,i=>{i&&!a.value&&(r.value=i.offsetWidth,n.value=i.scrollWidth,a.value=!0)}),{isTruncated:t.computed(()=>r.value<n.value)}}function ct(){const{i18n:{t:e}}=W();return{utf8Name:r=>/^[\p{N}\p{L}.\-_~]*$/u.test(r)?"":e("validationErrors.utf8Name")}}const Q={useAxios:X,useDebouncedFilter:Ze,useDeleteUrlBuilder:Ge,useErrors:Xe,useExternalLinkCreator:Qe,useFetcher:et,useFetchUrlBuilder:ce,useHelpers:se,useStringHelpers:tt,useI18n:W,useGatewayFeatureSupported:lt,useTruncationDetector:st,useValidators:ct},ee=(e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n};/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function be(e){return typeof e>"u"||e===null}function dt(e){return typeof e=="object"&&e!==null}function ut(e){return Array.isArray(e)?e:be(e)?[]:[e]}function pt(e,r){var n,a,i,l;if(r)for(l=Object.keys(r),n=0,a=l.length;n<a;n+=1)i=l[n],e[i]=r[i];return e}function ft(e,r){var n="",a;for(a=0;a<r;a+=1)n+=e;return n}function yt(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ht=be,gt=dt,mt=ut,bt=ft,wt=yt,Ct=pt,te={isNothing:ht,isObject:gt,toArray:mt,repeat:bt,isNegativeZero:wt,extend:Ct};function we(e,r){var n="",a=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!r&&e.mark.snippet&&(n+=`
|
|
2
2
|
|
|
3
|
-
`+e.mark.snippet),a+" "+n):a}function z(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=we(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}z.prototype=Object.create(Error.prototype),z.prototype.constructor=z,z.prototype.toString=function(e){return this.name+": "+we(this,e)};var P=z,kt=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],xt=["scalar","sequence","mapping"];function Nt(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(a){r[String(a)]=n})}),r}function St(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(kt.indexOf(n)===-1)throw new P('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Nt(r.styleAliases||null),xt.indexOf(this.kind)===-1)throw new P('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var
|
|
4
|
-
\r`;function lr(e){if(e===null)return!1;var r,n,a=0,i=e.length,l=ne;for(n=0;n<i;n++)if(r=l.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;a+=6}return a%8===0}function sr(e){var r,n,a=e.replace(/[\r\n=]/g,""),i=a.length,l=ne,o=0,s=[];for(r=0;r<i;r++)r%4===0&&r&&(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)),o=o<<6|l.indexOf(a.charAt(r));return n=i%4*6,n===0?(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)):n===18?(s.push(o>>10&255),s.push(o>>2&255)):n===12&&s.push(o>>4&255),new Uint8Array(s)}function cr(e){var r="",n=0,a,i,l=e.length,o=ne;for(a=0;a<l;a++)a%3===0&&a&&(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]),n=(n<<8)+e[a];return i=l%3,i===0?(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]):i===2?(r+=o[n>>10&63],r+=o[n>>4&63],r+=o[n<<2&63],r+=o[64]):i===1&&(r+=o[n>>2&63],r+=o[n<<4&63],r+=o[64],r+=o[64]),r}function dr(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var ur=new
|
|
5
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}for(var _r=new Array(256),Ir=new Array(256),R=0;R<256;R++)_r[R]=Ne(R)?1:0,Ir[R]=Ne(R);const Y="24px",Se=(e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n},Tr=e=>(t.pushScopeId("data-v-c1f7c39c"),e=e(),t.popScopeId(),e),Ar=["aria-hidden"],Er={key:0,"data-testid":"kui-icon-svg-title"},Br=Tr(()=>t.createElementVNode("path",{d:"M11 19V13H5V11H11V5H13V11H19V13H13V19H11Z",fill:"currentColor"},null,-1)),vr=t.defineComponent({__name:"AddIcon",props:{title:{type:String,required:!1,default:""},color:{type:String,required:!1,default:"currentColor"},display:{type:String,required:!1,default:"block"},decorative:{type:Boolean,required:!1,default:!1},size:{type:[Number,String],required:!1,default:Y,validator:e=>{if(typeof e=="number"&&e>0)return!0;if(typeof e=="string"){const r=String(e).replace(/px/gi,""),n=Number(r);if(n&&!isNaN(n)&&Number.isInteger(n)&&n>0)return!0}return!1}},as:{type:String,required:!1,default:"span"}},setup(e){const r=e,n=t.computed(()=>{if(typeof r.size=="number"&&r.size>0)return`${r.size}px`;if(typeof r.size=="string"){const i=String(r.size).replace(/px/gi,""),l=Number(i);if(l&&!isNaN(l)&&Number.isInteger(l)&&l>0)return`${l}px`}return Y}),a=t.computed(()=>({boxSizing:"border-box",color:r.color,display:r.display,flexShrink:"0",height:n.value,lineHeight:"0",width:n.value}));return(i,l)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.as),{"aria-hidden":e.decorative?"true":void 0,class:"kui-icon add-icon","data-testid":"kui-icon-wrapper-add-icon",style:t.normalizeStyle(a.value)},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{"aria-hidden":e.decorative?"true":void 0,"data-testid":"kui-icon-svg-add-icon",fill:"none",height:"100%",role:"img",viewBox:"0 0 24 24",width:"100%",xmlns:"http://www.w3.org/2000/svg"},[e.title?(t.openBlock(),t.createElementBlock("title",Er,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),Br],8,Ar))]),_:1},8,["aria-hidden","style"]))}}),Vr=Se(vr,[["__scopeId","data-v-c1f7c39c"]]),Or=e=>(t.pushScopeId("data-v-d9894a05"),e=e(),t.popScopeId(),e),jr=["aria-hidden"],$r={key:0,"data-testid":"kui-icon-svg-title"},Dr=Or(()=>t.createElementVNode("path",{d:"M12 20C11.45 20 10.9792 19.8042 10.5875 19.4125C10.1958 19.0208 10 18.55 10 18C10 17.45 10.1958 16.9792 10.5875 16.5875C10.9792 16.1958 11.45 16 12 16C12.55 16 13.0208 16.1958 13.4125 16.5875C13.8042 16.9792 14 17.45 14 18C14 18.55 13.8042 19.0208 13.4125 19.4125C13.0208 19.8042 12.55 20 12 20ZM12 14C11.45 14 10.9792 13.8042 10.5875 13.4125C10.1958 13.0208 10 12.55 10 12C10 11.45 10.1958 10.9792 10.5875 10.5875C10.9792 10.1958 11.45 10 12 10C12.55 10 13.0208 10.1958 13.4125 10.5875C13.8042 10.9792 14 11.45 14 12C14 12.55 13.8042 13.0208 13.4125 13.4125C13.0208 13.8042 12.55 14 12 14ZM12 8C11.45 8 10.9792 7.80417 10.5875 7.4125C10.1958 7.02083 10 6.55 10 6C10 5.45 10.1958 4.97917 10.5875 4.5875C10.9792 4.19583 11.45 4 12 4C12.55 4 13.0208 4.19583 13.4125 4.5875C13.8042 4.97917 14 5.45 14 6C14 6.55 13.8042 7.02083 13.4125 7.4125C13.0208 7.80417 12.55 8 12 8Z",fill:"currentColor"},null,-1)),Kr=t.defineComponent({__name:"MoreIcon",props:{title:{type:String,required:!1,default:""},color:{type:String,required:!1,default:"currentColor"},display:{type:String,required:!1,default:"block"},decorative:{type:Boolean,required:!1,default:!1},size:{type:[Number,String],required:!1,default:Y,validator:e=>{if(typeof e=="number"&&e>0)return!0;if(typeof e=="string"){const r=String(e).replace(/px/gi,""),n=Number(r);if(n&&!isNaN(n)&&Number.isInteger(n)&&n>0)return!0}return!1}},as:{type:String,required:!1,default:"span"}},setup(e){const r=e,n=t.computed(()=>{if(typeof r.size=="number"&&r.size>0)return`${r.size}px`;if(typeof r.size=="string"){const i=String(r.size).replace(/px/gi,""),l=Number(i);if(l&&!isNaN(l)&&Number.isInteger(l)&&l>0)return`${l}px`}return Y}),a=t.computed(()=>({boxSizing:"border-box",color:r.color,display:r.display,flexShrink:"0",height:n.value,lineHeight:"0",width:n.value}));return(i,l)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.as),{"aria-hidden":e.decorative?"true":void 0,class:"kui-icon more-icon","data-testid":"kui-icon-wrapper-more-icon",style:t.normalizeStyle(a.value)},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{"aria-hidden":e.decorative?"true":void 0,"data-testid":"kui-icon-svg-more-icon",fill:"none",height:"100%",role:"img",viewBox:"0 0 24 24",width:"100%",xmlns:"http://www.w3.org/2000/svg"},[e.title?(t.openBlock(),t.createElementBlock("title",$r,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),Dr],8,jr))]),_:1},8,["aria-hidden","style"]))}}),qr=Se(Kr,[["__scopeId","data-v-d9894a05"]]),Fr=["data-truncate"],Mr=t.defineComponent({__name:"EntityBaseTableCell",props:{keyName:{type:String,required:!0},rowEl:{type:[Object,null],required:!0},tooltip:{type:Boolean,default:!1}},setup(e){const r=e,n=t.computed(()=>{var k;return((k=r.rowEl)==null?void 0:k.querySelector(`[data-testid="${r.keyName}"]`))||null}),a=t.computed(()=>{var k;return((k=n.value)==null?void 0:k.querySelector('[data-truncate="true"]'))||null}),i=t.computed(()=>{var k,N;const B=(k=r.rowEl)==null?void 0:k.querySelectorAll("td");return B?((N=B[0])==null?void 0:N.getAttribute("data-testid"))===r.keyName:!0}),l=t.computed(()=>i.value||r.tooltip);let o;const s=()=>{o&&(o.disconnect(),o=void 0)},h=()=>{var k,N,B;let u=((k=n.value)==null?void 0:k.clientWidth)||0;if(n.value&&"getComputedStyle"in window){const V=window.getComputedStyle(n.value);u-=(parseFloat(V.paddingLeft)||0)+(parseFloat(V.paddingRight)||0)}g.value=((N=a.value)==null?void 0:N.getBoundingClientRect().width)||0,c.value=u,w.value=((B=f.value)==null?void 0:B.innerText)||""},f=t.ref({}),g=t.ref(0),c=t.ref(0),w=t.ref(""),b=t.computed(()=>[a.value,n.value]),S=t.watch(b,k=>{if(l.value&&(s(),"ResizeObserver"in window&&window)){o=new ResizeObserver(N=>{window.requestAnimationFrame(()=>{!Array.isArray(N)||!N.length||h()})});for(const N of k)N&&o.observe(N)}},{immediate:!0,flush:"post",deep:!0}),E=t.computed(()=>l.value?g.value>c.value:!1);return t.onMounted(()=>{h()}),t.onUnmounted(()=>{S()}),(k,N)=>{const B=t.resolveComponent("KTooltip");return t.openBlock(),t.createElementBlock("span",{ref_key:"contentRef",ref:f,class:"content-wrapper"},[l.value?(t.openBlock(),t.createElementBlock("span",{key:0,"data-truncate":l.value||void 0},[t.createVNode(B,{"max-width":"300",placement:"bottom-start",text:E.value?w.value:""},{default:t.withCtx(()=>[t.renderSlot(k.$slots,"default",{},void 0,!0)]),_:3},8,["text"])],8,Fr)):t.renderSlot(k.$slots,"default",{key:1},void 0,!0)],512)}}}),Pr=ee(Mr,[["__scopeId","data-v-b252463e"]]),Lr={class:"toolbar-container"},Rr={key:0,class:"toolbar-button-container"},Ur=["data-testid"],zr=t.defineComponent({__name:"EntityBaseTable",props:{tableHeaders:{type:Object,required:!0,default:()=>({})},fetcher:{type:Function,required:!0,default:async()=>({data:[],total:0})},initialFetcherParams:{type:Object,default:null},cacheIdentifier:{type:String,default:""},fetcherCacheKey:{type:Number,default:1},isLoading:{type:Boolean,default:!1},query:{type:String,default:""},enableClientSort:{type:Boolean,default:!1},sortHandlerFunction:{type:Function,default:()=>({})},enableEntityActions:{type:Boolean,default:!0},emptyStateOptions:{type:Object,default:()=>({})},errorMessage:{type:[String,Object],default:null},disablePaginationPageJump:{type:Boolean,default:void 0},disableSorting:{type:Boolean,default:void 0},paginationType:{type:String,default:void 0},cellAttributes:{type:Function,default:()=>({})},rowAttributes:{type:Function,default:()=>({})},preferencesStorageKey:{type:String,default:"",required:!0},dropdownMenuWidth:{type:String,default:"",required:!1},title:{type:String,default:""},titleTag:{type:String,default:"h2"},disableRowClick:{type:Boolean,default:!1}},emits:["click:row","sort","clear-search-input","empty-state-cta-clicked"],setup(e,{emit:r}){const n=e,a=r,{i18n:{t:i}}=Q.useI18n(),l=t.computed(()=>{var d,p;return typeof n.errorMessage=="string"?{hasError:!!n.errorMessage,title:n.errorMessage,message:void 0}:{hasError:!!n.errorMessage,title:(d=n.errorMessage)==null?void 0:d.title,message:(p=n.errorMessage)==null?void 0:p.message}}),o=t.computed(()=>n.cacheIdentifier||n.preferencesStorageKey),s=d=>d.hasData||!!n.query,h=t.computed(()=>{const d=[];return Object.keys(n.tableHeaders).forEach(p=>{const x=n.tableHeaders[p];d.push({label:x.label??p,key:p,sortable:x.sortable??!1,hidable:x.hidable??!0})}),n.enableEntityActions&&d.push({key:"actions",hideLabel:!0}),d}),f=d=>({"data-rowid":d.id,"data-testid":d.name,...n.rowAttributes(d)}),g=t.ref({}),c=d=>{var p;return(p=g.value)==null?void 0:p.$el.querySelector(`[data-rowid="${d.id}"]`)},w=d=>{const p={"data-testid":d.headerKey,...n.cellAttributes(d)};return d.colIndex===0&&(p.style={maxWidth:"250px",overflowX:"hidden",textOverflow:"ellipsis"}),p},b=()=>{a("empty-state-cta-clicked"),S()},S=()=>{a("clear-search-input")},E=t.computed(()=>n.disableRowClick?void 0:(d,p)=>{a("click:row",p)}),k=d=>{a("sort",d)},{setTablePreferences:N,getTablePreferences:B}=qe(),u=t.ref(B(o.value)),V=t.computed(()=>{const d=B(o.value);return{...n.initialFetcherParams,...d}}),D=d=>{u.value=d,h.value.forEach(p=>{!("hidable"in p)||!u.value.columnVisibility||p.hidable===!1&&(u.value.columnVisibility[p.key]=!0)}),o.value&&N(o.value,d)};return(d,p)=>{const x=t.resolveComponent("KButton"),K=t.resolveComponent("KDropdown"),_=t.resolveComponent("KTable"),O=t.resolveComponent("KCard");return t.openBlock(),t.createBlock(O,{class:"kong-ui-entity-base-table",title:e.title,"title-tag":e.titleTag},{default:t.withCtx(()=>[t.createVNode(_,{ref_key:"tableRefs",ref:g,"cache-identifier":o.value,"cell-attrs":w,"client-sort":e.enableClientSort,"disable-pagination-page-jump":e.disablePaginationPageJump,"empty-state-action-message":e.query?t.unref(i)("baseTable.emptyState.noSearchResultsCtaText"):e.emptyStateOptions.ctaText,"empty-state-action-route":e.query?void 0:e.emptyStateOptions.ctaPath,"empty-state-icon-variant":e.query?"search":"kong","empty-state-message":e.query?t.unref(i)("baseTable.emptyState.noSearchResultsMessage"):e.emptyStateOptions.message,"empty-state-title":e.query?t.unref(i)("baseTable.emptyState.noSearchResultsTitle"):e.emptyStateOptions.title,error:l.value.hasError,"error-state-message":l.value.message,"error-state-title":l.value.title,fetcher:e.fetcher,"fetcher-cache-key":String(e.fetcherCacheKey),headers:h.value,"hide-pagination-when-optional":"","initial-fetcher-params":V.value,loading:e.isLoading,"pagination-offset":e.paginationType==="offset","resize-columns":"","row-attrs":f,"search-input":e.query,"sort-handler-function":e.enableClientSort?e.sortHandlerFunction:void 0,sortable:!e.disableSorting,"table-preferences":u.value,onEmptyStateActionClick:b,"onRow:click":E.value,onSort:p[0]||(p[0]=T=>k(T)),"onUpdate:tablePreferences":D},t.createSlots({toolbar:t.withCtx(({state:T})=>[t.withDirectives(t.createElementVNode("div",Lr,[t.renderSlot(d.$slots,"toolbar-filter",{},void 0,!0),d.$slots["toolbar-button"]?(t.openBlock(),t.createElementBlock("div",Rr,[t.renderSlot(d.$slots,"toolbar-button",{},void 0,!0)])):t.createCommentVNode("",!0)],512),[[t.vShow,s(T)]])]),actions:t.withCtx(({row:T,rowKey:q,rowValue:L})=>[t.createElementVNode("div",{class:"actions-container","data-testid":T.name},[t.createVNode(K,{"kpop-attributes":{placement:"bottom-end"},width:e.dropdownMenuWidth},{items:t.withCtx(()=>[t.renderSlot(d.$slots,"actions",{row:T,rowKey:q,rowValue:L},void 0,!0)]),default:t.withCtx(()=>[t.createVNode(x,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:t.withCtx(()=>[t.createVNode(t.unref(qr))]),_:1})]),_:2},1032,["width"])],8,Ur)]),_:2},[t.renderList(e.tableHeaders,(T,q)=>({name:q,fn:t.withCtx(({row:L,rowKey:y,rowValue:C})=>[t.createVNode(Pr,{"key-name":String(q),"row-el":c(L),tooltip:T.tooltip},{default:t.withCtx(()=>[t.renderSlot(d.$slots,q,{row:L,rowKey:y,rowValue:C},()=>[t.createTextVNode(t.toDisplayString(C),1)],!0)]),_:2},1032,["key-name","row-el","tooltip"])])})),e.query?void 0:{name:"empty-state-action-icon",fn:t.withCtx(()=>[t.createVNode(t.unref(Vr))]),key:"0"}]),1032,["cache-identifier","client-sort","disable-pagination-page-jump","empty-state-action-message","empty-state-action-route","empty-state-icon-variant","empty-state-message","empty-state-title","error","error-state-message","error-state-title","fetcher","fetcher-cache-key","headers","initial-fetcher-params","loading","pagination-offset","search-input","sort-handler-function","sortable","table-preferences","onRow:click"])]),_:3},8,["title","title-tag"])}}}),Hr=ee(zr,[["__scopeId","data-v-71b4425a"]]),Jr={key:0,class:"kong-ui-entity-delete-error"},Wr={key:1,class:"description"},Yr=t.defineComponent({__name:"EntityDeleteModal",props:{visible:{type:Boolean,required:!0,default:!1},title:{type:String,default:"Delete"},entityType:{type:String,required:!0},entityName:{type:String,default:""},needConfirm:{type:Boolean,default:!0},description:{type:String,default:""},actionPending:{type:Boolean,default:!1},error:{type:String,default:""}},emits:["cancel","proceed"],setup(e,{emit:r}){const{i18nT:n}=Q.useI18n(),a=e,i=r,l=t.computed(()=>a.needConfirm?a.entityName:""),o=()=>{i("cancel")},s=()=>{i("proceed")};return(h,f)=>{const g=t.resolveComponent("KAlert"),c=t.resolveComponent("KPrompt");return t.openBlock(),t.createBlock(c,{"action-button-appearance":"danger","action-button-disabled":e.actionPending,"action-button-text":"Yes, delete",class:"kong-ui-entity-delete-modal","confirmation-text":l.value,title:e.title,visible:e.visible,onCancel:o,onProceed:s},{default:t.withCtx(()=>[e.error?(t.openBlock(),t.createElementBlock("div",Jr,[t.createVNode(g,{appearance:"danger"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.error),1)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(t.unref(n),{class:"message",keypath:a.entityName?"deleteModal.messageWithName":"deleteModal.message",tag:"p"},t.createSlots({entityType:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.entityType),1)]),_:2},[a.entityName?{name:"entityName",fn:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(a.entityName),1)]),key:"0"}:void 0]),1032,["keypath"]),a.description||h.$slots.description?(t.openBlock(),t.createElementBlock("div",Wr,[t.renderSlot(h.$slots,"description",{},()=>[t.createElementVNode("p",null,t.toDisplayString(a.description),1)],!0)])):t.createCommentVNode("",!0)]),_:3},8,["action-button-disabled","confirmation-text","title","visible"])}}}),Zr=ee(Yr,[["__scopeId","data-v-4361d622"]]),ae=t.defineComponent({__name:"PermissionsWrapper",props:{authFunction:{type:Function,required:!0,default:async()=>!0},forceShow:{type:Boolean,default:!1}},setup(e){const r=e,n=t.ref(void 0),a=t.computed(()=>n.value===!0||n.value!==void 0&&r.forceShow===!0);return t.watch(()=>r.authFunction,async()=>{n.value=await r.authFunction()},{immediate:!0}),(i,l)=>a.value?t.renderSlot(i.$slots,"default",{key:0,isAllowed:n.value}):t.createCommentVNode("",!0)}}),Gr=[];for(let e=0;e<256;++e)Gr.push((e+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const{useAxios:Xr,useDeleteUrlBuilder:Qr,useErrors:sn,useExternalLinkCreator:cn,useFetchUrlBuilder:dn,useFetcher:en,useDebouncedFilter:un,useStringHelpers:pn,useHelpers:fn,useGatewayFeatureSupported:yn,useTruncationDetector:hn,useValidators:gn}=Q,tn={class:"kong-ui-entities-consumer-credentials-list"},rn={key:1},nn=((e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n})(t.defineComponent({__name:"ConsumerCredentialList",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.createRoute||!e.getEditRoute)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(e,{emit:r}){var L;const n=r,a=e,{i18n:{t:i,formatUnixTimeStamp:l}}=Oe.useI18n(),{axiosInstance:o}=Xr((L=a.config)==null?void 0:L.axiosRequestConfig),s=t.ref(1),h={acls:{group:{label:i("credentials.list.table_headers.acls.group")},created_at:{label:i("credentials.list.table_headers.acls.created_at")},tags:{label:i("credentials.list.table_headers.acls.tags")}},"basic-auth":{password:{label:i("credentials.list.table_headers.basic-auth.password")},username:{label:i("credentials.list.table_headers.basic-auth.username")},created_at:{label:i("credentials.list.table_headers.basic-auth.created_at")},tags:{label:i("credentials.list.table_headers.basic-auth.tags")}},"key-auth":{key:{label:i("credentials.list.table_headers.key-auth.key")},created_at:{label:i("credentials.list.table_headers.key-auth.created_at")},tags:{label:i("credentials.list.table_headers.key-auth.tags")}},"key-auth-enc":{key:{label:i("credentials.list.table_headers.key-auth-enc.key")},created_at:{label:i("credentials.list.table_headers.key-auth-enc.created_at")},tags:{label:i("credentials.list.table_headers.key-auth-enc.tags")}},oauth2:{name:{label:i("credentials.list.table_headers.oauth2.name")},client_id:{label:i("credentials.list.table_headers.oauth2.client_id")},client_secret:{label:i("credentials.list.table_headers.oauth2.client_secret")},created_at:{label:i("credentials.list.table_headers.oauth2.created_at")},tags:{label:i("credentials.list.table_headers.oauth2.tags")}},"hmac-auth":{username:{label:i("credentials.list.table_headers.hmac-auth.username")},secret:{label:i("credentials.list.table_headers.hmac-auth.secret")},created_at:{label:i("credentials.list.table_headers.hmac-auth.created_at")},tags:{label:i("credentials.list.table_headers.hmac-auth.tags")}},jwt:{key:{label:i("credentials.list.table_headers.jwt.key")},algorithm:{label:i("credentials.list.table_headers.jwt.algorithm")},created_at:{label:i("credentials.list.table_headers.jwt.created_at")},tags:{label:i("credentials.list.table_headers.jwt.tags")}}},f=t.computed(()=>h[a.config.plugin]),g=t.computed(()=>{let y=`${a.config.apiBaseUrl}${je.list[a.config.app]}`;return a.config.app==="konnect"?y=y.replace(/{controlPlaneId}/gi,a.config.controlPlaneId||"").replace(/{consumerId}/gi,a.config.consumerId||"").replace(/{plugin}/gi,a.config.plugin||""):a.config.app==="kongManager"&&(y=y.replace(/\/{workspace}/gi,a.config.workspace?`/${a.config.workspace}`:"").replace(/{consumerId}/gi,a.config.consumerId||"").replace(/{plugin}/gi,a.config.plugin||"")),y}),{fetcher:c,fetcherState:w}=en(a.config,g),b=()=>{s.value++},S=t.ref(null),E=(y,C,j)=>{const v=C?y[C]:JSON.stringify(y);if(!j(v)){N(y,C);return}k(y,C)},k=(y,C)=>{n("copy:success",{entity:y,field:C,message:C&&!["password","key","client_secret","secret"].includes(C)?i("credentials.copy.success",{val:y[C]}):i("credentials.copy.success_brief")})},N=(y,C)=>{n("copy:error",{entity:y,field:C,message:i("credentials.error.copy")})},B=y=>({label:i("credentials.actions.edit"),to:a.config.getEditRoute(y)}),u=t.ref(void 0),V=t.ref(!1),D=t.ref(!1),d=t.ref(""),p=Qr(a.config,g.value),x=t.computed(()=>le[a.config.plugin]),K=y=>{u.value=y,V.value=!0},_=()=>{V.value=!1},O=async()=>{var y,C,j;if((y=u.value)!=null&&y.id){D.value=!0;try{await o.delete(p(u.value.id)),D.value=!1,V.value=!1,s.value++,n("delete:success",u.value)}catch(v){d.value=((j=(C=v.response)==null?void 0:C.data)==null?void 0:j.message)||v.message||i("credentials.error.delete"),n("error",v)}finally{D.value=!1}}},T=t.ref(!1);t.watch(w,y=>{var C,j,v,Z;if(Array.isArray((C=y==null?void 0:y.response)==null?void 0:C.data)&&(T.value=y.response.data.length>0),y.status===M.Error){S.value={title:i("credentials.error.general")},(Z=(v=(j=y.error)==null?void 0:j.response)==null?void 0:v.data)!=null&&Z.message&&(S.value.message=y.error.response.data.message),n("error",y.error);return}S.value=null});const q=t.ref({ctaPath:a.config.createRoute,ctaText:void 0,message:"",title:i("credentials.title")});return t.onBeforeMount(async()=>{await a.canCreate()&&(q.value.title=i(`credentials.list.empty_state.${a.config.plugin}.title`),q.value.ctaText=i(`credentials.list.empty_state.${a.config.plugin}.cta`))}),(y,C)=>{const j=t.resolveComponent("KButton"),v=t.resolveComponent("KCopy"),Z=t.resolveComponent("KBadge"),an=t.resolveComponent("KTruncate"),F=t.resolveComponent("KDropdownItem"),U=t.resolveComponent("KClipboardProvider");return t.openBlock(),t.createElementBlock("div",tn,[t.createVNode(t.unref(Hr),{"cache-identifier":e.cacheIdentifier,"disable-pagination-page-jump":"","disable-row-click":"","disable-sorting":"","empty-state-options":q.value,"enable-entity-actions":"","error-message":S.value,fetcher:t.unref(c),"fetcher-cache-key":s.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-consumer-credentials-list","table-headers":f.value,"use-action-outside":e.useActionOutside,onSort:b},{"toolbar-button":t.withCtx(()=>[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!e.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[t.createVNode(t.unref(ae),{"auth-function":()=>e.canCreate()},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(j,{appearance:"primary","data-testid":"toolbar-add-credential",size:"large",to:e.config.createRoute},{default:t.withCtx(()=>[t.createVNode(t.unref(Be)),t.createTextVNode(" "+t.toDisplayString(t.unref(i)(`credentials.list.toolbar_actions.${e.config.plugin}.new`)),1)]),_:1},8,["to"]),[[t.vShow,T.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),group:t.withCtx(({rowValue:m})=>[t.createElementVNode("b",null,t.toDisplayString(m??"-"),1)]),name:t.withCtx(({rowValue:m})=>[t.createElementVNode("b",null,t.toDisplayString(m??"-"),1)]),username:t.withCtx(({rowValue:m})=>[t.createElementVNode("span",null,t.toDisplayString(m??"-"),1)]),password:t.withCtx(({rowValue:m})=>[t.createVNode(v,{format:"redacted",text:m,truncate:""},null,8,["text"])]),key:t.withCtx(({rowValue:m})=>[t.createVNode(v,{format:"redacted",text:m,truncate:""},null,8,["text"])]),client_secret:t.withCtx(({rowValue:m})=>[t.createVNode(v,{format:"redacted",text:m,truncate:""},null,8,["text"])]),secret:t.withCtx(({rowValue:m})=>[t.createVNode(v,{format:"redacted",text:m,truncate:""},null,8,["text"])]),created_at:t.withCtx(({rowValue:m})=>[t.createTextVNode(t.toDisplayString(t.unref(l)(m)),1)]),tags:t.withCtx(({rowValue:m})=>[(m==null?void 0:m.length)>0?(t.openBlock(),t.createBlock(an,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m,A=>(t.openBlock(),t.createBlock(Z,{key:A,onClick:C[0]||(C[0]=t.withModifiers(()=>{},["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(A),1)]),_:2},1024))),128))]),_:2},1024)):(t.openBlock(),t.createElementBlock("span",rn,"-"))]),actions:t.withCtx(({row:m})=>[t.createVNode(U,null,{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-id",onClick:H=>E(m,"id",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.config.plugin==="basic-auth"?(t.openBlock(),t.createBlock(U,{key:0},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-credential",onClick:H=>E(m,"password",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_credential")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),["key-auth","key-auth-enc","jwt"].includes(e.config.plugin)?(t.openBlock(),t.createBlock(U,{key:1},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-key",onClick:H=>E(m,"key",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_key")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),e.config.plugin==="oauth2"?(t.openBlock(),t.createBlock(U,{key:2},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-secret",onClick:H=>E(m,"client_secret",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_secret")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),e.config.plugin==="hmac-auth"?(t.openBlock(),t.createBlock(U,{key:3},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-secret",onClick:H=>E(m,"secret",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_secret")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(U,null,{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-json",onClick:H=>E(m,void 0,A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(t.unref(ae),{"auth-function":()=>e.canEdit(m)},{default:t.withCtx(()=>[t.createVNode(F,{"data-testid":"action-entity-edit","has-divider":"",item:B(m.id)},null,8,["item"])]),_:2},1032,["auth-function"]),t.createVNode(t.unref(ae),{"auth-function":()=>e.canDelete(m)},{default:t.withCtx(()=>[t.createVNode(F,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:A=>K(m)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","empty-state-options","error-message","fetcher","fetcher-cache-key","table-headers","use-action-outside"]),t.createVNode(t.unref(Zr),{"action-pending":D.value,description:t.unref(i)("credentials.delete.description"),"entity-type":x.value,error:d.value,title:t.unref(i)(`credentials.delete.${e.config.plugin}.title`),visible:V.value,onCancel:_,onProceed:O},null,8,["action-pending","description","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-4450bd28"]]);$.ConsumerCredentialList=nn,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|
|
3
|
+
`+e.mark.snippet),a+" "+n):a}function z(e,r){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=r,this.message=we(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}z.prototype=Object.create(Error.prototype),z.prototype.constructor=z,z.prototype.toString=function(e){return this.name+": "+we(this,e)};var P=z,kt=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],xt=["scalar","sequence","mapping"];function Nt(e){var r={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(a){r[String(a)]=n})}),r}function St(e,r){if(r=r||{},Object.keys(r).forEach(function(n){if(kt.indexOf(n)===-1)throw new P('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=r,this.tag=e,this.kind=r.kind||null,this.resolve=r.resolve||function(){return!0},this.construct=r.construct||function(n){return n},this.instanceOf=r.instanceOf||null,this.predicate=r.predicate||null,this.represent=r.represent||null,this.representName=r.representName||null,this.defaultStyle=r.defaultStyle||null,this.multi=r.multi||!1,this.styleAliases=Nt(r.styleAliases||null),xt.indexOf(this.kind)===-1)throw new P('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var T=St;function Ce(e,r){var n=[];return e[r].forEach(function(a){var i=n.length;n.forEach(function(l,o){l.tag===a.tag&&l.kind===a.kind&&l.multi===a.multi&&(i=o)}),n[i]=a}),n}function _t(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},r,n;function a(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(r=0,n=arguments.length;r<n;r+=1)arguments[r].forEach(a);return e}function re(e){return this.extend(e)}re.prototype.extend=function(e){var r=[],n=[];if(e instanceof T)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new P("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(i){if(!(i instanceof T))throw new P("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new P("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new P("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(i){if(!(i instanceof T))throw new P("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var a=Object.create(re.prototype);return a.implicit=(this.implicit||[]).concat(r),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Ce(a,"implicit"),a.compiledExplicit=Ce(a,"explicit"),a.compiledTypeMap=_t(a.compiledImplicit,a.compiledExplicit),a};var Tt=re,It=new T("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),At=new T("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Et=new T("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Bt=new Tt({explicit:[It,At,Et]});function Vt(e){if(e===null)return!0;var r=e.length;return r===1&&e==="~"||r===4&&(e==="null"||e==="Null"||e==="NULL")}function vt(){return null}function Ot(e){return e===null}var jt=new T("tag:yaml.org,2002:null",{kind:"scalar",resolve:Vt,construct:vt,predicate:Ot,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function $t(e){if(e===null)return!1;var r=e.length;return r===4&&(e==="true"||e==="True"||e==="TRUE")||r===5&&(e==="false"||e==="False"||e==="FALSE")}function Dt(e){return e==="true"||e==="True"||e==="TRUE"}function Kt(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var qt=new T("tag:yaml.org,2002:bool",{kind:"scalar",resolve:$t,construct:Dt,predicate:Kt,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Ft(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Mt(e){return 48<=e&&e<=55}function Pt(e){return 48<=e&&e<=57}function Lt(e){if(e===null)return!1;var r=e.length,n=0,a=!1,i;if(!r)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===r)return!0;if(i=e[++n],i==="b"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;a=!0}return a&&i!=="_"}if(i==="x"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!Ft(e.charCodeAt(n)))return!1;a=!0}return a&&i!=="_"}if(i==="o"){for(n++;n<r;n++)if(i=e[n],i!=="_"){if(!Mt(e.charCodeAt(n)))return!1;a=!0}return a&&i!=="_"}}if(i==="_")return!1;for(;n<r;n++)if(i=e[n],i!=="_"){if(!Pt(e.charCodeAt(n)))return!1;a=!0}return!(!a||i==="_")}function Rt(e){var r=e,n=1,a;if(r.indexOf("_")!==-1&&(r=r.replace(/_/g,"")),a=r[0],(a==="-"||a==="+")&&(a==="-"&&(n=-1),r=r.slice(1),a=r[0]),r==="0")return 0;if(a==="0"){if(r[1]==="b")return n*parseInt(r.slice(2),2);if(r[1]==="x")return n*parseInt(r.slice(2),16);if(r[1]==="o")return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)}function Ut(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!te.isNegativeZero(e)}var zt=new T("tag:yaml.org,2002:int",{kind:"scalar",resolve:Lt,construct:Rt,predicate:Ut,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ht=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Jt(e){return!(e===null||!Ht.test(e)||e[e.length-1]==="_")}function Wt(e){var r,n;return r=e.replace(/_/g,"").toLowerCase(),n=r[0]==="-"?-1:1,"+-".indexOf(r[0])>=0&&(r=r.slice(1)),r===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:r===".nan"?NaN:n*parseFloat(r,10)}var Yt=/^[-+]?[0-9]+e/;function Zt(e,r){var n;if(isNaN(e))switch(r){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(r){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(r){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(te.isNegativeZero(e))return"-0.0";return n=e.toString(10),Yt.test(n)?n.replace("e",".e"):n}function Gt(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||te.isNegativeZero(e))}var Xt=new T("tag:yaml.org,2002:float",{kind:"scalar",resolve:Jt,construct:Wt,predicate:Gt,represent:Zt,defaultStyle:"lowercase"}),Qt=Bt.extend({implicit:[jt,qt,zt,Xt]}),er=Qt,ke=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),xe=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function tr(e){return e===null?!1:ke.exec(e)!==null||xe.exec(e)!==null}function rr(e){var r,n,a,i,l,o,s,y=0,p=null,g,d,w;if(r=ke.exec(e),r===null&&(r=xe.exec(e)),r===null)throw new Error("Date resolve error");if(n=+r[1],a=+r[2]-1,i=+r[3],!r[4])return new Date(Date.UTC(n,a,i));if(l=+r[4],o=+r[5],s=+r[6],r[7]){for(y=r[7].slice(0,3);y.length<3;)y+="0";y=+y}return r[9]&&(g=+r[10],d=+(r[11]||0),p=(g*60+d)*6e4,r[9]==="-"&&(p=-p)),w=new Date(Date.UTC(n,a,i,l,o,s,y)),p&&w.setTime(w.getTime()-p),w}function nr(e){return e.toISOString()}var ar=new T("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:tr,construct:rr,instanceOf:Date,represent:nr});function ir(e){return e==="<<"||e===null}var or=new T("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ir}),ne=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
4
|
+
\r`;function lr(e){if(e===null)return!1;var r,n,a=0,i=e.length,l=ne;for(n=0;n<i;n++)if(r=l.indexOf(e.charAt(n)),!(r>64)){if(r<0)return!1;a+=6}return a%8===0}function sr(e){var r,n,a=e.replace(/[\r\n=]/g,""),i=a.length,l=ne,o=0,s=[];for(r=0;r<i;r++)r%4===0&&r&&(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)),o=o<<6|l.indexOf(a.charAt(r));return n=i%4*6,n===0?(s.push(o>>16&255),s.push(o>>8&255),s.push(o&255)):n===18?(s.push(o>>10&255),s.push(o>>2&255)):n===12&&s.push(o>>4&255),new Uint8Array(s)}function cr(e){var r="",n=0,a,i,l=e.length,o=ne;for(a=0;a<l;a++)a%3===0&&a&&(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]),n=(n<<8)+e[a];return i=l%3,i===0?(r+=o[n>>18&63],r+=o[n>>12&63],r+=o[n>>6&63],r+=o[n&63]):i===2?(r+=o[n>>10&63],r+=o[n>>4&63],r+=o[n<<2&63],r+=o[64]):i===1&&(r+=o[n>>2&63],r+=o[n<<4&63],r+=o[64],r+=o[64]),r}function dr(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var ur=new T("tag:yaml.org,2002:binary",{kind:"scalar",resolve:lr,construct:sr,predicate:dr,represent:cr}),pr=Object.prototype.hasOwnProperty,fr=Object.prototype.toString;function yr(e){if(e===null)return!0;var r=[],n,a,i,l,o,s=e;for(n=0,a=s.length;n<a;n+=1){if(i=s[n],o=!1,fr.call(i)!=="[object Object]")return!1;for(l in i)if(pr.call(i,l))if(!o)o=!0;else return!1;if(!o)return!1;if(r.indexOf(l)===-1)r.push(l);else return!1}return!0}function hr(e){return e!==null?e:[]}var gr=new T("tag:yaml.org,2002:omap",{kind:"sequence",resolve:yr,construct:hr}),mr=Object.prototype.toString;function br(e){if(e===null)return!0;var r,n,a,i,l,o=e;for(l=new Array(o.length),r=0,n=o.length;r<n;r+=1){if(a=o[r],mr.call(a)!=="[object Object]"||(i=Object.keys(a),i.length!==1))return!1;l[r]=[i[0],a[i[0]]]}return!0}function wr(e){if(e===null)return[];var r,n,a,i,l,o=e;for(l=new Array(o.length),r=0,n=o.length;r<n;r+=1)a=o[r],i=Object.keys(a),l[r]=[i[0],a[i[0]]];return l}var Cr=new T("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:br,construct:wr}),kr=Object.prototype.hasOwnProperty;function xr(e){if(e===null)return!0;var r,n=e;for(r in n)if(kr.call(n,r)&&n[r]!==null)return!1;return!0}function Nr(e){return e!==null?e:{}}var Sr=new T("tag:yaml.org,2002:set",{kind:"mapping",resolve:xr,construct:Nr});er.extend({implicit:[ar,or],explicit:[ur,gr,Cr,Sr]});function Ne(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
5
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}for(var _r=new Array(256),Tr=new Array(256),R=0;R<256;R++)_r[R]=Ne(R)?1:0,Tr[R]=Ne(R);const Y="24px",Se=(e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n},Ir=e=>(t.pushScopeId("data-v-c1f7c39c"),e=e(),t.popScopeId(),e),Ar=["aria-hidden"],Er={key:0,"data-testid":"kui-icon-svg-title"},Br=Ir(()=>t.createElementVNode("path",{d:"M11 19V13H5V11H11V5H13V11H19V13H13V19H11Z",fill:"currentColor"},null,-1)),Vr=t.defineComponent({__name:"AddIcon",props:{title:{type:String,required:!1,default:""},color:{type:String,required:!1,default:"currentColor"},display:{type:String,required:!1,default:"block"},decorative:{type:Boolean,required:!1,default:!1},size:{type:[Number,String],required:!1,default:Y,validator:e=>{if(typeof e=="number"&&e>0)return!0;if(typeof e=="string"){const r=String(e).replace(/px/gi,""),n=Number(r);if(n&&!isNaN(n)&&Number.isInteger(n)&&n>0)return!0}return!1}},as:{type:String,required:!1,default:"span"}},setup(e){const r=e,n=t.computed(()=>{if(typeof r.size=="number"&&r.size>0)return`${r.size}px`;if(typeof r.size=="string"){const i=String(r.size).replace(/px/gi,""),l=Number(i);if(l&&!isNaN(l)&&Number.isInteger(l)&&l>0)return`${l}px`}return Y}),a=t.computed(()=>({boxSizing:"border-box",color:r.color,display:r.display,flexShrink:"0",height:n.value,lineHeight:"0",width:n.value}));return(i,l)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.as),{"aria-hidden":e.decorative?"true":void 0,class:"kui-icon add-icon","data-testid":"kui-icon-wrapper-add-icon",style:t.normalizeStyle(a.value)},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{"aria-hidden":e.decorative?"true":void 0,"data-testid":"kui-icon-svg-add-icon",fill:"none",height:"100%",role:"img",viewBox:"0 0 24 24",width:"100%",xmlns:"http://www.w3.org/2000/svg"},[e.title?(t.openBlock(),t.createElementBlock("title",Er,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),Br],8,Ar))]),_:1},8,["aria-hidden","style"]))}}),vr=Se(Vr,[["__scopeId","data-v-c1f7c39c"]]),Or=e=>(t.pushScopeId("data-v-d9894a05"),e=e(),t.popScopeId(),e),jr=["aria-hidden"],$r={key:0,"data-testid":"kui-icon-svg-title"},Dr=Or(()=>t.createElementVNode("path",{d:"M12 20C11.45 20 10.9792 19.8042 10.5875 19.4125C10.1958 19.0208 10 18.55 10 18C10 17.45 10.1958 16.9792 10.5875 16.5875C10.9792 16.1958 11.45 16 12 16C12.55 16 13.0208 16.1958 13.4125 16.5875C13.8042 16.9792 14 17.45 14 18C14 18.55 13.8042 19.0208 13.4125 19.4125C13.0208 19.8042 12.55 20 12 20ZM12 14C11.45 14 10.9792 13.8042 10.5875 13.4125C10.1958 13.0208 10 12.55 10 12C10 11.45 10.1958 10.9792 10.5875 10.5875C10.9792 10.1958 11.45 10 12 10C12.55 10 13.0208 10.1958 13.4125 10.5875C13.8042 10.9792 14 11.45 14 12C14 12.55 13.8042 13.0208 13.4125 13.4125C13.0208 13.8042 12.55 14 12 14ZM12 8C11.45 8 10.9792 7.80417 10.5875 7.4125C10.1958 7.02083 10 6.55 10 6C10 5.45 10.1958 4.97917 10.5875 4.5875C10.9792 4.19583 11.45 4 12 4C12.55 4 13.0208 4.19583 13.4125 4.5875C13.8042 4.97917 14 5.45 14 6C14 6.55 13.8042 7.02083 13.4125 7.4125C13.0208 7.80417 12.55 8 12 8Z",fill:"currentColor"},null,-1)),Kr=t.defineComponent({__name:"MoreIcon",props:{title:{type:String,required:!1,default:""},color:{type:String,required:!1,default:"currentColor"},display:{type:String,required:!1,default:"block"},decorative:{type:Boolean,required:!1,default:!1},size:{type:[Number,String],required:!1,default:Y,validator:e=>{if(typeof e=="number"&&e>0)return!0;if(typeof e=="string"){const r=String(e).replace(/px/gi,""),n=Number(r);if(n&&!isNaN(n)&&Number.isInteger(n)&&n>0)return!0}return!1}},as:{type:String,required:!1,default:"span"}},setup(e){const r=e,n=t.computed(()=>{if(typeof r.size=="number"&&r.size>0)return`${r.size}px`;if(typeof r.size=="string"){const i=String(r.size).replace(/px/gi,""),l=Number(i);if(l&&!isNaN(l)&&Number.isInteger(l)&&l>0)return`${l}px`}return Y}),a=t.computed(()=>({boxSizing:"border-box",color:r.color,display:r.display,flexShrink:"0",height:n.value,lineHeight:"0",width:n.value}));return(i,l)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.as),{"aria-hidden":e.decorative?"true":void 0,class:"kui-icon more-icon","data-testid":"kui-icon-wrapper-more-icon",style:t.normalizeStyle(a.value)},{default:t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",{"aria-hidden":e.decorative?"true":void 0,"data-testid":"kui-icon-svg-more-icon",fill:"none",height:"100%",role:"img",viewBox:"0 0 24 24",width:"100%",xmlns:"http://www.w3.org/2000/svg"},[e.title?(t.openBlock(),t.createElementBlock("title",$r,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),Dr],8,jr))]),_:1},8,["aria-hidden","style"]))}}),qr=Se(Kr,[["__scopeId","data-v-d9894a05"]]),Fr=["data-truncate"],Mr=t.defineComponent({__name:"EntityBaseTableCell",props:{keyName:{type:String,required:!0},rowEl:{type:[Object,null],required:!0},tooltip:{type:Boolean,default:!1}},setup(e){const r=e,n=t.computed(()=>{var k;return((k=r.rowEl)==null?void 0:k.querySelector(`[data-testid="${r.keyName}"]`))||null}),a=t.computed(()=>{var k;return((k=n.value)==null?void 0:k.querySelector('[data-truncate="true"]'))||null}),i=t.computed(()=>{var k,N;const B=(k=r.rowEl)==null?void 0:k.querySelectorAll("td");return B?((N=B[0])==null?void 0:N.getAttribute("data-testid"))===r.keyName:!0}),l=t.computed(()=>i.value||r.tooltip);let o;const s=()=>{o&&(o.disconnect(),o=void 0)},y=()=>{var k,N,B;let h=((k=n.value)==null?void 0:k.clientWidth)||0;if(n.value&&"getComputedStyle"in window){const v=window.getComputedStyle(n.value);h-=(parseFloat(v.paddingLeft)||0)+(parseFloat(v.paddingRight)||0)}g.value=((N=a.value)==null?void 0:N.getBoundingClientRect().width)||0,d.value=h,w.value=((B=p.value)==null?void 0:B.innerText)||""},p=t.ref({}),g=t.ref(0),d=t.ref(0),w=t.ref(""),b=t.computed(()=>[a.value,n.value]),S=t.watch(b,k=>{if(l.value&&(s(),"ResizeObserver"in window&&window)){o=new ResizeObserver(N=>{window.requestAnimationFrame(()=>{!Array.isArray(N)||!N.length||y()})});for(const N of k)N&&o.observe(N)}},{immediate:!0,flush:"post",deep:!0}),E=t.computed(()=>l.value?g.value>d.value:!1);return t.onMounted(()=>{y()}),t.onUnmounted(()=>{S()}),(k,N)=>{const B=t.resolveComponent("KTooltip");return t.openBlock(),t.createElementBlock("span",{ref_key:"contentRef",ref:p,class:"content-wrapper"},[l.value?(t.openBlock(),t.createElementBlock("span",{key:0,"data-truncate":l.value||void 0},[t.createVNode(B,{"max-width":"300",placement:"bottom-start",text:E.value?w.value:""},{default:t.withCtx(()=>[t.renderSlot(k.$slots,"default",{},void 0,!0)]),_:3},8,["text"])],8,Fr)):t.renderSlot(k.$slots,"default",{key:1},void 0,!0)],512)}}}),Pr=ee(Mr,[["__scopeId","data-v-b252463e"]]),Lr={class:"toolbar-container"},Rr={key:0,class:"toolbar-button-container"},Ur=["data-testid"],zr=t.defineComponent({__name:"EntityBaseTable",props:{tableHeaders:{type:Object,required:!0,default:()=>({})},fetcher:{type:Function,required:!0,default:async()=>({data:[],total:0})},initialFetcherParams:{type:Object,default:null},cacheIdentifier:{type:String,default:""},fetcherCacheKey:{type:Number,default:1},isLoading:{type:Boolean,default:!1},query:{type:String,default:""},enableClientSort:{type:Boolean,default:!1},sortHandlerFunction:{type:Function,default:()=>({})},enableEntityActions:{type:Boolean,default:!0},emptyStateOptions:{type:Object,default:()=>({})},errorMessage:{type:[String,Object],default:null},disablePaginationPageJump:{type:Boolean,default:void 0},disableSorting:{type:Boolean,default:void 0},paginationType:{type:String,default:void 0},cellAttributes:{type:Function,default:()=>({})},rowAttributes:{type:Function,default:()=>({})},preferencesStorageKey:{type:String,default:"",required:!0},dropdownMenuWidth:{type:String,default:"",required:!1},title:{type:String,default:""},titleTag:{type:String,default:"h2"},disableRowClick:{type:Boolean,default:!1}},emits:["click:row","sort","clear-search-input","empty-state-cta-clicked"],setup(e,{emit:r}){const n=e,a=r,{i18n:{t:i}}=Q.useI18n(),l=t.computed(()=>{var c,u;return typeof n.errorMessage=="string"?{hasError:!!n.errorMessage,title:n.errorMessage,message:void 0}:{hasError:!!n.errorMessage,title:(c=n.errorMessage)==null?void 0:c.title,message:(u=n.errorMessage)==null?void 0:u.message}}),o=t.computed(()=>n.cacheIdentifier||n.preferencesStorageKey),s=c=>c.hasData||!!n.query,y=t.computed(()=>{const c=[];return Object.keys(n.tableHeaders).forEach(u=>{const x=n.tableHeaders[u];c.push({label:x.label??u,key:u,sortable:x.sortable??!1,hidable:x.hidable??!0})}),n.enableEntityActions&&c.push({key:"actions",hideLabel:!0}),c}),p=c=>({"data-rowid":c.id,"data-testid":c.name,...n.rowAttributes(c)}),g=t.ref({}),d=c=>{var u;return(u=g.value)==null?void 0:u.$el.querySelector(`[data-rowid="${c.id}"]`)},w=c=>{const u={"data-testid":c.headerKey,...n.cellAttributes(c)};return c.colIndex===0&&(u.style={maxWidth:"250px",overflowX:"hidden",textOverflow:"ellipsis"}),u},b=()=>{a("empty-state-cta-clicked"),S()},S=()=>{a("clear-search-input")},E=t.computed(()=>n.disableRowClick?void 0:(c,u)=>{a("click:row",u)}),k=c=>{a("sort",c)},{setTablePreferences:N,getTablePreferences:B}=qe(),h=t.ref(B(o.value)),v=t.computed(()=>{const c=B(o.value);return{...n.initialFetcherParams,...c}}),D=c=>{h.value=c,y.value.forEach(u=>{!("hidable"in u)||!h.value.columnVisibility||u.hidable===!1&&(h.value.columnVisibility[u.key]=!0)}),o.value&&N(o.value,c)};return(c,u)=>{const x=t.resolveComponent("KButton"),K=t.resolveComponent("KDropdown"),_=t.resolveComponent("KTable"),O=t.resolveComponent("KCard");return t.openBlock(),t.createBlock(O,{class:"kong-ui-entity-base-table",title:e.title,"title-tag":e.titleTag},{default:t.withCtx(()=>[t.createVNode(_,{ref_key:"tableRefs",ref:g,"cache-identifier":o.value,"cell-attrs":w,"client-sort":e.enableClientSort,"disable-pagination-page-jump":e.disablePaginationPageJump,"empty-state-action-message":e.query?t.unref(i)("baseTable.emptyState.noSearchResultsCtaText"):e.emptyStateOptions.ctaText,"empty-state-action-route":e.query?void 0:e.emptyStateOptions.ctaPath,"empty-state-icon-variant":e.query?"search":"kong","empty-state-message":e.query?t.unref(i)("baseTable.emptyState.noSearchResultsMessage"):e.emptyStateOptions.message,"empty-state-title":e.query?t.unref(i)("baseTable.emptyState.noSearchResultsTitle"):e.emptyStateOptions.title,error:l.value.hasError,"error-state-message":l.value.message,"error-state-title":l.value.title,fetcher:e.fetcher,"fetcher-cache-key":String(e.fetcherCacheKey),headers:y.value,"hide-pagination-when-optional":"","initial-fetcher-params":v.value,loading:e.isLoading,"pagination-offset":e.paginationType==="offset","resize-columns":"","row-attrs":p,"search-input":e.query,"sort-handler-function":e.enableClientSort?e.sortHandlerFunction:void 0,sortable:!e.disableSorting,"table-preferences":h.value,onEmptyStateActionClick:b,"onRow:click":E.value,onSort:u[0]||(u[0]=I=>k(I)),"onUpdate:tablePreferences":D},t.createSlots({toolbar:t.withCtx(({state:I})=>[t.withDirectives(t.createElementVNode("div",Lr,[t.renderSlot(c.$slots,"toolbar-filter",{},void 0,!0),c.$slots["toolbar-button"]?(t.openBlock(),t.createElementBlock("div",Rr,[t.renderSlot(c.$slots,"toolbar-button",{},void 0,!0)])):t.createCommentVNode("",!0)],512),[[t.vShow,s(I)]])]),actions:t.withCtx(({row:I,rowKey:q,rowValue:L})=>[t.createElementVNode("div",{class:"actions-container","data-testid":I.name},[t.createVNode(K,{"kpop-attributes":{placement:"bottom-end"},width:e.dropdownMenuWidth},{items:t.withCtx(()=>[t.renderSlot(c.$slots,"actions",{row:I,rowKey:q,rowValue:L},void 0,!0)]),default:t.withCtx(()=>[t.createVNode(x,{appearance:"tertiary",class:"actions-trigger","data-testid":"overflow-actions-button",icon:"",size:"small"},{default:t.withCtx(()=>[t.createVNode(t.unref(qr))]),_:1})]),_:2},1032,["width"])],8,Ur)]),_:2},[t.renderList(e.tableHeaders,(I,q)=>({name:q,fn:t.withCtx(({row:L,rowKey:f,rowValue:C})=>[t.createVNode(Pr,{"key-name":String(q),"row-el":d(L),tooltip:I.tooltip},{default:t.withCtx(()=>[t.renderSlot(c.$slots,q,{row:L,rowKey:f,rowValue:C},()=>[t.createTextVNode(t.toDisplayString(C),1)],!0)]),_:2},1032,["key-name","row-el","tooltip"])])})),e.query?void 0:{name:"empty-state-action-icon",fn:t.withCtx(()=>[t.createVNode(t.unref(vr))]),key:"0"}]),1032,["cache-identifier","client-sort","disable-pagination-page-jump","empty-state-action-message","empty-state-action-route","empty-state-icon-variant","empty-state-message","empty-state-title","error","error-state-message","error-state-title","fetcher","fetcher-cache-key","headers","initial-fetcher-params","loading","pagination-offset","search-input","sort-handler-function","sortable","table-preferences","onRow:click"])]),_:3},8,["title","title-tag"])}}}),Hr=ee(zr,[["__scopeId","data-v-71b4425a"]]),Jr={key:0,class:"kong-ui-entity-delete-error"},Wr={key:1,class:"description"},Yr=t.defineComponent({__name:"EntityDeleteModal",props:{visible:{type:Boolean,required:!0,default:!1},title:{type:String,default:"Delete"},entityType:{type:String,required:!0},entityName:{type:String,default:""},needConfirm:{type:Boolean,default:!0},description:{type:String,default:""},actionPending:{type:Boolean,default:!1},error:{type:String,default:""}},emits:["cancel","proceed"],setup(e,{emit:r}){const{i18nT:n}=Q.useI18n(),a=e,i=r,l=t.computed(()=>a.needConfirm?a.entityName:""),o=()=>{i("cancel")},s=()=>{i("proceed")};return(y,p)=>{const g=t.resolveComponent("KAlert"),d=t.resolveComponent("KPrompt");return t.openBlock(),t.createBlock(d,{"action-button-appearance":"danger","action-button-disabled":e.actionPending,"action-button-text":"Yes, delete",class:"kong-ui-entity-delete-modal","confirmation-text":l.value,title:e.title,visible:e.visible,onCancel:o,onProceed:s},{default:t.withCtx(()=>[e.error?(t.openBlock(),t.createElementBlock("div",Jr,[t.createVNode(g,{appearance:"danger"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.error),1)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(t.unref(n),{class:"message",keypath:a.entityName?"deleteModal.messageWithName":"deleteModal.message",tag:"p"},t.createSlots({entityType:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.entityType),1)]),_:2},[a.entityName?{name:"entityName",fn:t.withCtx(()=>[t.createElementVNode("strong",null,t.toDisplayString(a.entityName),1)]),key:"0"}:void 0]),1032,["keypath"]),a.description||y.$slots.description?(t.openBlock(),t.createElementBlock("div",Wr,[t.renderSlot(y.$slots,"description",{},()=>[t.createElementVNode("p",null,t.toDisplayString(a.description),1)],!0)])):t.createCommentVNode("",!0)]),_:3},8,["action-button-disabled","confirmation-text","title","visible"])}}}),Zr=ee(Yr,[["__scopeId","data-v-4361d622"]]),ae=t.defineComponent({__name:"PermissionsWrapper",props:{authFunction:{type:Function,required:!0,default:async()=>!0},forceShow:{type:Boolean,default:!1}},setup(e){const r=e,n=t.ref(void 0),a=t.computed(()=>n.value===!0||n.value!==void 0&&r.forceShow===!0);return t.watch(()=>r.authFunction,async()=>{n.value=await r.authFunction()},{immediate:!0}),(i,l)=>a.value?t.renderSlot(i.$slots,"default",{key:0,isAllowed:n.value}):t.createCommentVNode("",!0)}}),Gr=[];for(let e=0;e<256;++e)Gr.push((e+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const{useAxios:Xr,useDeleteUrlBuilder:Qr,useErrors:sn,useExternalLinkCreator:cn,useFetchUrlBuilder:dn,useFetcher:en,useDebouncedFilter:un,useStringHelpers:pn,useHelpers:fn,useGatewayFeatureSupported:yn,useTruncationDetector:hn,useValidators:gn}=Q,tn={class:"kong-ui-entities-consumer-credentials-list"},rn={key:1},nn=((e,r)=>{const n=e.__vccOpts||e;for(const[a,i]of r)n[a]=i;return n})(t.defineComponent({__name:"ConsumerCredentialList",props:{config:{type:Object,required:!0,validator:e=>!(!e||!["konnect","kongManager"].includes(e==null?void 0:e.app)||!e.createRoute||!e.getEditRoute)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(e,{emit:r}){var L;const n=r,a=e,{i18n:{t:i,formatUnixTimeStamp:l}}=Oe.useI18n(),{axiosInstance:o}=Xr((L=a.config)==null?void 0:L.axiosRequestConfig),s=t.ref(1),y={acls:{group:{label:i("credentials.list.table_headers.acls.group")},created_at:{label:i("credentials.list.table_headers.acls.created_at")},tags:{label:i("credentials.list.table_headers.acls.tags")}},"basic-auth":{password:{label:i("credentials.list.table_headers.basic-auth.password")},username:{label:i("credentials.list.table_headers.basic-auth.username")},created_at:{label:i("credentials.list.table_headers.basic-auth.created_at")},tags:{label:i("credentials.list.table_headers.basic-auth.tags")}},"key-auth":{key:{label:i("credentials.list.table_headers.key-auth.key")},created_at:{label:i("credentials.list.table_headers.key-auth.created_at")},tags:{label:i("credentials.list.table_headers.key-auth.tags")}},"key-auth-enc":{key:{label:i("credentials.list.table_headers.key-auth-enc.key")},created_at:{label:i("credentials.list.table_headers.key-auth-enc.created_at")},tags:{label:i("credentials.list.table_headers.key-auth-enc.tags")}},oauth2:{name:{label:i("credentials.list.table_headers.oauth2.name")},client_id:{label:i("credentials.list.table_headers.oauth2.client_id")},client_secret:{label:i("credentials.list.table_headers.oauth2.client_secret")},created_at:{label:i("credentials.list.table_headers.oauth2.created_at")},tags:{label:i("credentials.list.table_headers.oauth2.tags")}},"hmac-auth":{username:{label:i("credentials.list.table_headers.hmac-auth.username")},secret:{label:i("credentials.list.table_headers.hmac-auth.secret")},created_at:{label:i("credentials.list.table_headers.hmac-auth.created_at")},tags:{label:i("credentials.list.table_headers.hmac-auth.tags")}},jwt:{key:{label:i("credentials.list.table_headers.jwt.key")},algorithm:{label:i("credentials.list.table_headers.jwt.algorithm")},created_at:{label:i("credentials.list.table_headers.jwt.created_at")},tags:{label:i("credentials.list.table_headers.jwt.tags")}}},p=t.computed(()=>y[a.config.plugin]),g=t.computed(()=>{let f=`${a.config.apiBaseUrl}${je.list[a.config.app]}`;return a.config.app==="konnect"?f=f.replace(/{controlPlaneId}/gi,a.config.controlPlaneId||"").replace(/{consumerId}/gi,a.config.consumerId||"").replace(/{plugin}/gi,a.config.plugin||""):a.config.app==="kongManager"&&(f=f.replace(/\/{workspace}/gi,a.config.workspace?`/${a.config.workspace}`:"").replace(/{consumerId}/gi,a.config.consumerId||"").replace(/{plugin}/gi,a.config.plugin||"")),f}),{fetcher:d,fetcherState:w}=en(a.config,g),b=()=>{s.value++},S=t.ref(null),E=(f,C,j)=>{const V=C?f[C]:JSON.stringify(f);if(!j(V)){N(f,C);return}k(f,C)},k=(f,C)=>{n("copy:success",{entity:f,field:C,message:C&&!["password","key","client_secret","secret"].includes(C)?i("credentials.copy.success",{val:f[C]}):i("credentials.copy.success_brief")})},N=(f,C)=>{n("copy:error",{entity:f,field:C,message:i("credentials.error.copy")})},B=f=>({label:i("credentials.actions.edit"),to:a.config.getEditRoute(f)}),h=t.ref(void 0),v=t.ref(!1),D=t.ref(!1),c=t.ref(""),u=Qr(a.config,g.value),x=t.computed(()=>le[a.config.plugin]),K=f=>{h.value=f,v.value=!0},_=()=>{v.value=!1},O=async()=>{var f,C,j;if((f=h.value)!=null&&f.id){D.value=!0;try{await o.delete(u(h.value.id)),D.value=!1,v.value=!1,s.value++,n("delete:success",h.value)}catch(V){c.value=((j=(C=V.response)==null?void 0:C.data)==null?void 0:j.message)||V.message||i("credentials.error.delete"),n("error",V)}finally{D.value=!1}}},I=t.ref(!1);t.watch(w,f=>{var C,j,V,Z;if(Array.isArray((C=f==null?void 0:f.response)==null?void 0:C.data)&&(I.value=f.response.data.length>0),f.status===M.Error){S.value={title:i("credentials.error.general")},(Z=(V=(j=f.error)==null?void 0:j.response)==null?void 0:V.data)!=null&&Z.message&&(S.value.message=f.error.response.data.message),n("error",f.error);return}S.value=null});const q=t.ref({ctaPath:a.config.createRoute,ctaText:void 0,message:"",title:i("credentials.title")});return t.onBeforeMount(async()=>{await a.canCreate()&&(q.value.title=i(`credentials.list.empty_state.${a.config.plugin}.title`),q.value.ctaText=i(`credentials.list.empty_state.${a.config.plugin}.cta`))}),(f,C)=>{const j=t.resolveComponent("KButton"),V=t.resolveComponent("KCopy"),Z=t.resolveComponent("KBadge"),an=t.resolveComponent("KTruncate"),F=t.resolveComponent("KDropdownItem"),U=t.resolveComponent("KClipboardProvider");return t.openBlock(),t.createElementBlock("div",tn,[t.createVNode(t.unref(Hr),{"cache-identifier":e.cacheIdentifier,"disable-pagination-page-jump":"","disable-row-click":"","disable-sorting":"","empty-state-options":q.value,"enable-entity-actions":"","error-message":S.value,fetcher:t.unref(d),"fetcher-cache-key":s.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-consumer-credentials-list","table-headers":p.value,"use-action-outside":e.useActionOutside,onSort:b},{"toolbar-button":t.withCtx(()=>[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!e.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[t.createVNode(t.unref(ae),{"auth-function":()=>e.canCreate()},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(j,{appearance:"primary","data-testid":"toolbar-add-credential",size:"large",to:e.config.createRoute},{default:t.withCtx(()=>[t.createVNode(t.unref(Be)),t.createTextVNode(" "+t.toDisplayString(t.unref(i)(`credentials.list.toolbar_actions.${e.config.plugin}.new`)),1)]),_:1},8,["to"]),[[t.vShow,I.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),group:t.withCtx(({rowValue:m})=>[t.createElementVNode("b",null,t.toDisplayString(m??"-"),1)]),name:t.withCtx(({rowValue:m})=>[t.createElementVNode("b",null,t.toDisplayString(m??"-"),1)]),username:t.withCtx(({rowValue:m})=>[t.createElementVNode("span",null,t.toDisplayString(m??"-"),1)]),password:t.withCtx(({rowValue:m})=>[t.createVNode(V,{format:"redacted",text:m,truncate:""},null,8,["text"])]),key:t.withCtx(({rowValue:m})=>[t.createVNode(V,{format:"redacted",text:m,truncate:""},null,8,["text"])]),client_secret:t.withCtx(({rowValue:m})=>[t.createVNode(V,{format:"redacted",text:m,truncate:""},null,8,["text"])]),secret:t.withCtx(({rowValue:m})=>[t.createVNode(V,{format:"redacted",text:m,truncate:""},null,8,["text"])]),created_at:t.withCtx(({rowValue:m})=>[t.createTextVNode(t.toDisplayString(t.unref(l)(m)),1)]),tags:t.withCtx(({rowValue:m})=>[(m==null?void 0:m.length)>0?(t.openBlock(),t.createBlock(an,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m,A=>(t.openBlock(),t.createBlock(Z,{key:A,onClick:C[0]||(C[0]=t.withModifiers(()=>{},["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(A),1)]),_:2},1024))),128))]),_:2},1024)):(t.openBlock(),t.createElementBlock("span",rn,"-"))]),actions:t.withCtx(({row:m})=>[t.createVNode(U,null,{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-id",onClick:H=>E(m,"id",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.config.plugin==="basic-auth"?(t.openBlock(),t.createBlock(U,{key:0},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-credential",onClick:H=>E(m,"password",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_credential")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),["key-auth","key-auth-enc","jwt"].includes(e.config.plugin)?(t.openBlock(),t.createBlock(U,{key:1},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-key",onClick:H=>E(m,"key",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_key")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),e.config.plugin==="oauth2"?(t.openBlock(),t.createBlock(U,{key:2},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-secret",onClick:H=>E(m,"client_secret",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_secret")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),e.config.plugin==="hmac-auth"?(t.openBlock(),t.createBlock(U,{key:3},{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-secret",onClick:H=>E(m,"secret",A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_secret")),1)]),_:2},1032,["onClick"])]),_:2},1024)):t.createCommentVNode("",!0),t.createVNode(U,null,{default:t.withCtx(({copyToClipboard:A})=>[t.createVNode(F,{"data-testid":"action-entity-copy-json",onClick:H=>E(m,void 0,A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(t.unref(ae),{"auth-function":()=>e.canEdit(m)},{default:t.withCtx(()=>[t.createVNode(F,{"data-testid":"action-entity-edit","has-divider":"",item:B(m.id)},null,8,["item"])]),_:2},1032,["auth-function"]),t.createVNode(t.unref(ae),{"auth-function":()=>e.canDelete(m)},{default:t.withCtx(()=>[t.createVNode(F,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:A=>K(m)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("credentials.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","empty-state-options","error-message","fetcher","fetcher-cache-key","table-headers","use-action-outside"]),t.createVNode(t.unref(Zr),{"action-pending":D.value,description:t.unref(i)("credentials.delete.description"),"entity-type":x.value,error:c.value,title:t.unref(i)(`credentials.delete.${e.config.plugin}.title`),visible:v.value,onCancel:_,onProceed:O},null,8,["action-pending","description","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-4450bd28"]]);$.ConsumerCredentialList=nn,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/entities-consumer-credentials",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/entities-consumer-credentials.umd.js",
|
|
6
6
|
"module": "./dist/entities-consumer-credentials.es.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@kong/icons": "^1.15.1",
|
|
54
|
-
"@kong-ui-public/entities-shared": "^3.6.
|
|
54
|
+
"@kong-ui-public/entities-shared": "^3.6.3"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"dev": "cross-env USE_SANDBOX=true vite",
|