@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.16 → 1.1.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/openapi-k8s-toolkit.es.js +174 -103
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +174 -103
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/hooks/useK8sSmartResource/index.d.ts +2 -0
- package/dist/types/hooks/useK8sSmartResource/useK8sSmartResource.d.ts +28 -0
- package/dist/types/hooks/{useK8sSmartResource.d.ts → useK8sSmartResource/useK8sSmartResourceWithoutKinds.d.ts} +2 -2
- package/package.json +1 -1
|
@@ -8611,6 +8611,63 @@
|
|
|
8611
8611
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$w.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
|
|
8612
8612
|
};
|
|
8613
8613
|
|
|
8614
|
+
const getKinds = async ({ cluster }) => {
|
|
8615
|
+
const result = await axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
8616
|
+
return result.data;
|
|
8617
|
+
};
|
|
8618
|
+
|
|
8619
|
+
const kindByGvr = (entries) => (gvr) => {
|
|
8620
|
+
const [group = "", v = "", resource = ""] = gvr.split("~", 3);
|
|
8621
|
+
const norm = (s) => s.trim();
|
|
8622
|
+
const kinds = entries.filter((e) => norm(e.group) === norm(group) && e.version.version === v && e.version.resource === resource).map((e) => e.kind);
|
|
8623
|
+
const uniq = Array.from(new Set(kinds));
|
|
8624
|
+
return uniq.length === 1 ? uniq[0] : void 0;
|
|
8625
|
+
};
|
|
8626
|
+
|
|
8627
|
+
const parseK8sVersion$1 = (raw) => {
|
|
8628
|
+
const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
|
|
8629
|
+
if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
|
|
8630
|
+
const stage = (m.groups.stage ?? "").toLowerCase();
|
|
8631
|
+
const major = Number(m.groups.major);
|
|
8632
|
+
const stageNum = m.groups.stageNum ? Number(m.groups.stageNum) : 0;
|
|
8633
|
+
const rank = stage === "" ? 3 : stage === "beta" ? 2 : 1;
|
|
8634
|
+
return { rank, major, stageNum };
|
|
8635
|
+
};
|
|
8636
|
+
const versionToken$1 = (e) => e.version || (e.groupVersion?.split("/").pop() ?? "");
|
|
8637
|
+
const compareK8sVersionDesc$1 = (a, b) => {
|
|
8638
|
+
const pa = parseK8sVersion$1(versionToken$1(a));
|
|
8639
|
+
const pb = parseK8sVersion$1(versionToken$1(b));
|
|
8640
|
+
return pb.rank - pa.rank || pb.major - pa.major || pb.stageNum - pa.stageNum;
|
|
8641
|
+
};
|
|
8642
|
+
const orderVersions = (versions) => {
|
|
8643
|
+
const preferredIdx = versions.findIndex((v) => v.preferred === true);
|
|
8644
|
+
if (preferredIdx >= 0) {
|
|
8645
|
+
const preferred = versions[preferredIdx];
|
|
8646
|
+
const rest = versions.filter((_, i) => i !== preferredIdx).slice().sort(compareK8sVersionDesc$1);
|
|
8647
|
+
return [preferred, ...rest];
|
|
8648
|
+
}
|
|
8649
|
+
return versions.slice().sort(compareK8sVersionDesc$1);
|
|
8650
|
+
};
|
|
8651
|
+
const getSortedKindsAll = (index) => {
|
|
8652
|
+
const counts = index.items.reduce(
|
|
8653
|
+
(acc, item) => ({ ...acc, [item.kind]: (acc[item.kind] ?? 0) + 1 }),
|
|
8654
|
+
{}
|
|
8655
|
+
);
|
|
8656
|
+
const rows = index.items.flatMap((item) => {
|
|
8657
|
+
const ordered = orderVersions(item.versions);
|
|
8658
|
+
return ordered.map((v) => ({
|
|
8659
|
+
group: item.group,
|
|
8660
|
+
kind: item.kind,
|
|
8661
|
+
// clone to drop Readonly<> without changing fields (incl. preferred)
|
|
8662
|
+
version: { ...v },
|
|
8663
|
+
...counts[item.kind] > 1 ? { notUnique: true } : {}
|
|
8664
|
+
}));
|
|
8665
|
+
});
|
|
8666
|
+
return rows.sort(
|
|
8667
|
+
(a, b) => a.kind.localeCompare(b.kind, void 0, { sensitivity: "base" }) || a.group.localeCompare(b.group, void 0, { sensitivity: "base" })
|
|
8668
|
+
);
|
|
8669
|
+
};
|
|
8670
|
+
|
|
8614
8671
|
const getDirectUnknownResource = async ({ uri }) => {
|
|
8615
8672
|
return axios.get(uri);
|
|
8616
8673
|
};
|
|
@@ -9201,7 +9258,7 @@
|
|
|
9201
9258
|
if (limit) params.append("limit", String(limit));
|
|
9202
9259
|
return params.toString() ? `${base}?${params.toString()}` : base;
|
|
9203
9260
|
};
|
|
9204
|
-
const
|
|
9261
|
+
const useK8sSmartResourceWithoutKinds = ({
|
|
9205
9262
|
cluster,
|
|
9206
9263
|
apiGroup,
|
|
9207
9264
|
apiVersion,
|
|
@@ -9298,6 +9355,82 @@
|
|
|
9298
9355
|
return { data, isLoading, isError, error, _meta: { used } };
|
|
9299
9356
|
};
|
|
9300
9357
|
|
|
9358
|
+
const hasItemsArray = (value) => {
|
|
9359
|
+
if (!value || typeof value !== "object") {
|
|
9360
|
+
return false;
|
|
9361
|
+
}
|
|
9362
|
+
if (!("items" in value)) {
|
|
9363
|
+
return false;
|
|
9364
|
+
}
|
|
9365
|
+
const { items } = value;
|
|
9366
|
+
return Array.isArray(items);
|
|
9367
|
+
};
|
|
9368
|
+
const useK8sSmartResource = (params) => {
|
|
9369
|
+
const { cluster, apiGroup, apiVersion, plural } = params;
|
|
9370
|
+
const base = useK8sSmartResourceWithoutKinds(params);
|
|
9371
|
+
const [kindsWithVersion, setKindsWithVersion] = K.useState(void 0);
|
|
9372
|
+
K.useEffect(() => {
|
|
9373
|
+
let cancelled = false;
|
|
9374
|
+
if (!cluster) {
|
|
9375
|
+
setKindsWithVersion(void 0);
|
|
9376
|
+
return void 0;
|
|
9377
|
+
}
|
|
9378
|
+
getKinds({ cluster }).then((data) => {
|
|
9379
|
+
if (cancelled) {
|
|
9380
|
+
return;
|
|
9381
|
+
}
|
|
9382
|
+
setKindsWithVersion(getSortedKindsAll(data));
|
|
9383
|
+
}).catch(() => {
|
|
9384
|
+
if (!cancelled) {
|
|
9385
|
+
setKindsWithVersion(void 0);
|
|
9386
|
+
}
|
|
9387
|
+
});
|
|
9388
|
+
return () => {
|
|
9389
|
+
cancelled = true;
|
|
9390
|
+
};
|
|
9391
|
+
}, [cluster]);
|
|
9392
|
+
const resolveKindByGvr = K.useMemo(
|
|
9393
|
+
() => kindsWithVersion ? kindByGvr(kindsWithVersion) : void 0,
|
|
9394
|
+
[kindsWithVersion]
|
|
9395
|
+
);
|
|
9396
|
+
const gvr = K.useMemo(
|
|
9397
|
+
() => `${(apiGroup ?? "").trim()}~${apiVersion.trim()}~${plural.trim()}`,
|
|
9398
|
+
[apiGroup, apiVersion, plural]
|
|
9399
|
+
);
|
|
9400
|
+
const fullApiVersion = K.useMemo(() => {
|
|
9401
|
+
const g = (apiGroup ?? "").trim();
|
|
9402
|
+
const v = apiVersion.trim();
|
|
9403
|
+
if (!g || g === "core") {
|
|
9404
|
+
return v;
|
|
9405
|
+
}
|
|
9406
|
+
return `${g}/${v}`;
|
|
9407
|
+
}, [apiGroup, apiVersion]);
|
|
9408
|
+
const dataWithKinds = K.useMemo(() => {
|
|
9409
|
+
if (!base.data) return void 0;
|
|
9410
|
+
if (!hasItemsArray(base.data)) {
|
|
9411
|
+
return base.data;
|
|
9412
|
+
}
|
|
9413
|
+
const resolvedKind = resolveKindByGvr?.(gvr);
|
|
9414
|
+
const shouldAddKind = Boolean(resolvedKind);
|
|
9415
|
+
const itemsWithKindAndApiVersion = base.data.items.map((item) => {
|
|
9416
|
+
const typedItem = item;
|
|
9417
|
+
return {
|
|
9418
|
+
...typedItem,
|
|
9419
|
+
kind: typedItem.kind ?? (shouldAddKind ? resolvedKind : void 0),
|
|
9420
|
+
apiVersion: typedItem.apiVersion ?? fullApiVersion
|
|
9421
|
+
};
|
|
9422
|
+
});
|
|
9423
|
+
return {
|
|
9424
|
+
...base.data,
|
|
9425
|
+
items: itemsWithKindAndApiVersion
|
|
9426
|
+
};
|
|
9427
|
+
}, [base.data, resolveKindByGvr, gvr, fullApiVersion]);
|
|
9428
|
+
return {
|
|
9429
|
+
...base,
|
|
9430
|
+
data: dataWithKinds
|
|
9431
|
+
};
|
|
9432
|
+
};
|
|
9433
|
+
|
|
9301
9434
|
const prepareTemplate = ({
|
|
9302
9435
|
template,
|
|
9303
9436
|
replaceValues
|
|
@@ -9399,7 +9532,7 @@
|
|
|
9399
9532
|
if (!result) {
|
|
9400
9533
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$v.HeightDiv, {});
|
|
9401
9534
|
}
|
|
9402
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableBreadcrumbs, { data: result });
|
|
9535
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableBreadcrumbs, { data: result }, JSON.stringify(idToCompare));
|
|
9403
9536
|
};
|
|
9404
9537
|
|
|
9405
9538
|
const CustomMenu = styled(antd.Menu)`
|
|
@@ -33986,7 +34119,7 @@
|
|
|
33986
34119
|
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
33987
34120
|
(m) => m[1]
|
|
33988
34121
|
);
|
|
33989
|
-
const value = _$1.get(multiQueryData[`req${reqIndex}`], path, fallback !== void 0 ? fallback : void 0);
|
|
34122
|
+
const value = _$1.get(multiQueryData[`req${reqIndex}`] || {}, path, fallback !== void 0 ? fallback : void 0);
|
|
33990
34123
|
if (value == null && !customFallback) {
|
|
33991
34124
|
return fallback ?? "Undefined with no fallback";
|
|
33992
34125
|
}
|
|
@@ -34019,7 +34152,7 @@
|
|
|
34019
34152
|
if (jsonRoot === void 0 && customFallback) {
|
|
34020
34153
|
return customFallback;
|
|
34021
34154
|
}
|
|
34022
|
-
const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
|
|
34155
|
+
const results = jp.query(jsonRoot || {}, `$${jsonPathExpr}`);
|
|
34023
34156
|
if (results.length === 0 || results[0] == null || results[0] === void 0) {
|
|
34024
34157
|
if (customFallback) {
|
|
34025
34158
|
return customFallback;
|
|
@@ -34571,7 +34704,7 @@
|
|
|
34571
34704
|
}
|
|
34572
34705
|
if (labelSelectorFull) {
|
|
34573
34706
|
const root = multiQueryData[`req${labelSelectorFull.reqIndex}`];
|
|
34574
|
-
const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root, labelSelectorFull.pathToLabels) : jp.query(root, `$${labelSelectorFull.pathToLabels}`)[0];
|
|
34707
|
+
const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root || {}, labelSelectorFull.pathToLabels) : jp.query(root || {}, `$${labelSelectorFull.pathToLabels}`)[0];
|
|
34575
34708
|
const serializedLabels = serializeLabelsWithNoEncoding$1(value);
|
|
34576
34709
|
if (serializedLabels.length > 0) sParams.set("labelSelector", serializedLabels);
|
|
34577
34710
|
}
|
|
@@ -34635,14 +34768,9 @@
|
|
|
34635
34768
|
JSON.stringify(fetchedDataError)
|
|
34636
34769
|
] });
|
|
34637
34770
|
}
|
|
34638
|
-
const dataFromOneOfHooks = fetchedData || fetchedDataSocket;
|
|
34639
|
-
const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks, pathToItems) : jp.query(dataFromOneOfHooks, `$${pathToItems}`)[0];
|
|
34640
|
-
|
|
34641
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
34642
|
-
"No data on this path ",
|
|
34643
|
-
JSON.stringify(pathToItems)
|
|
34644
|
-
] });
|
|
34645
|
-
}
|
|
34771
|
+
const dataFromOneOfHooks = fetchedData || fetchedDataSocket || {};
|
|
34772
|
+
const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks || {}, pathToItems) : jp.query(dataFromOneOfHooks || {}, `$${pathToItems}`)[0];
|
|
34773
|
+
const itemsAlwaysArr = Array.isArray(items) ? items : [];
|
|
34646
34774
|
const clearSelected = () => {
|
|
34647
34775
|
setSelectedRowKeys([]);
|
|
34648
34776
|
setSelectedRowsData([]);
|
|
@@ -34659,7 +34787,7 @@
|
|
|
34659
34787
|
cluster: clusterPrepared,
|
|
34660
34788
|
namespace: namespacePrepared,
|
|
34661
34789
|
theme,
|
|
34662
|
-
dataItems:
|
|
34790
|
+
dataItems: itemsAlwaysArr,
|
|
34663
34791
|
tableProps: {
|
|
34664
34792
|
borderless: true,
|
|
34665
34793
|
paginationPosition: ["bottomRight"],
|
|
@@ -34941,7 +35069,7 @@
|
|
|
34941
35069
|
prefillValuesRaw,
|
|
34942
35070
|
pathToData
|
|
34943
35071
|
}) => {
|
|
34944
|
-
return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw, pathToData) : jp.query(prefillValuesRaw, `$${pathToData}`)[0];
|
|
35072
|
+
return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw || {}, pathToData) : jp.query(prefillValuesRaw || {}, `$${pathToData}`)[0];
|
|
34945
35073
|
};
|
|
34946
35074
|
const getPrefillValuesWithForces = ({
|
|
34947
35075
|
prefillValues,
|
|
@@ -35129,7 +35257,7 @@
|
|
|
35129
35257
|
if (jsonRoot === void 0) {
|
|
35130
35258
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
35131
35259
|
}
|
|
35132
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
|
|
35260
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
35133
35261
|
const { data: arrayOfObjects, error: errorArrayOfObjects } = parseArrayOfAny$2(anythingForNow);
|
|
35134
35262
|
if (!arrayOfObjects) {
|
|
35135
35263
|
if (errorArrayOfObjects) {
|
|
@@ -35201,7 +35329,7 @@
|
|
|
35201
35329
|
console.log(`Item Counter: ${id}: No root for json path`);
|
|
35202
35330
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
35203
35331
|
}
|
|
35204
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
|
|
35332
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
35205
35333
|
const { counter, error: errorArrayOfObjects } = getItemsInside$4(anythingForNow);
|
|
35206
35334
|
if (errorArrayOfObjects) {
|
|
35207
35335
|
console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
|
|
@@ -35258,7 +35386,7 @@
|
|
|
35258
35386
|
console.log(`Key Counter: ${id}: No root for json path`);
|
|
35259
35387
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
35260
35388
|
}
|
|
35261
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
|
|
35389
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
|
|
35262
35390
|
const { counter, error: errorArrayOfObjects } = getItemsInside$3(anythingForNow);
|
|
35263
35391
|
if (errorArrayOfObjects) {
|
|
35264
35392
|
console.log(`Key Counter: ${id}: ${errorArrayOfObjects}`);
|
|
@@ -35638,7 +35766,7 @@
|
|
|
35638
35766
|
if (jsonRoot === void 0) {
|
|
35639
35767
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
35640
35768
|
}
|
|
35641
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
|
|
35769
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToLabels}`);
|
|
35642
35770
|
const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny$1(anythingForNow);
|
|
35643
35771
|
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
35644
35772
|
text: notificationSuccessMessage,
|
|
@@ -35913,7 +36041,7 @@
|
|
|
35913
36041
|
if (jsonRoot === void 0) {
|
|
35914
36042
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
35915
36043
|
}
|
|
35916
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
|
|
36044
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToLabels}`);
|
|
35917
36045
|
const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny(anythingForNow);
|
|
35918
36046
|
const linkPrefixPrepared = parseAll({ text: linkPrefix, replaceValues, multiQueryData });
|
|
35919
36047
|
if (!labelsRaw) {
|
|
@@ -36183,7 +36311,7 @@
|
|
|
36183
36311
|
console.log(`Item Counter: ${id}: No root for json path`);
|
|
36184
36312
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
36185
36313
|
}
|
|
36186
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
|
|
36314
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
36187
36315
|
const { counter, taints, error: errorArrayOfObjects } = getItemsInside$2(anythingForNow);
|
|
36188
36316
|
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
36189
36317
|
text: notificationSuccessMessage,
|
|
@@ -36561,7 +36689,7 @@
|
|
|
36561
36689
|
console.log(`Item Counter: ${id}: No root for json path`);
|
|
36562
36690
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
|
|
36563
36691
|
}
|
|
36564
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
|
|
36692
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
36565
36693
|
const { counter, tolerations, error: errorArrayOfObjects } = getItemsInside$1(anythingForNow);
|
|
36566
36694
|
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
36567
36695
|
text: notificationSuccessMessage,
|
|
@@ -36842,7 +36970,7 @@
|
|
|
36842
36970
|
console.log(`Item Counter: ${id}: No root for json path`);
|
|
36843
36971
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
|
|
36844
36972
|
}
|
|
36845
|
-
const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
|
|
36973
|
+
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
|
|
36846
36974
|
const { counter, annotations, error: errorArrayOfObjects } = getItemsInside(anythingForNow);
|
|
36847
36975
|
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
36848
36976
|
text: notificationSuccessMessage,
|
|
@@ -38055,7 +38183,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38055
38183
|
}
|
|
38056
38184
|
if (labelSelectorFull) {
|
|
38057
38185
|
const root = multiQueryData[`req${labelSelectorFull.reqIndex}`];
|
|
38058
|
-
const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root, labelSelectorFull.pathToLabels) : jp.query(root, `$${labelSelectorFull.pathToLabels}`)[0];
|
|
38186
|
+
const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root || {}, labelSelectorFull.pathToLabels) : jp.query(root || {}, `$${labelSelectorFull.pathToLabels}`)[0];
|
|
38059
38187
|
const serializedLabels = serializeLabelsWithNoEncoding(value);
|
|
38060
38188
|
if (serializedLabels.length > 0) params.set("labelSelector", serializedLabels);
|
|
38061
38189
|
}
|
|
@@ -38100,55 +38228,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38100
38228
|
] });
|
|
38101
38229
|
};
|
|
38102
38230
|
|
|
38103
|
-
const getKinds = async ({ cluster }) => {
|
|
38104
|
-
const result = await axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
38105
|
-
return result.data;
|
|
38106
|
-
};
|
|
38107
|
-
|
|
38108
|
-
const parseK8sVersion$1 = (raw) => {
|
|
38109
|
-
const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
|
|
38110
|
-
if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
|
|
38111
|
-
const stage = (m.groups.stage ?? "").toLowerCase();
|
|
38112
|
-
const major = Number(m.groups.major);
|
|
38113
|
-
const stageNum = m.groups.stageNum ? Number(m.groups.stageNum) : 0;
|
|
38114
|
-
const rank = stage === "" ? 3 : stage === "beta" ? 2 : 1;
|
|
38115
|
-
return { rank, major, stageNum };
|
|
38116
|
-
};
|
|
38117
|
-
const versionToken$1 = (e) => e.version || (e.groupVersion?.split("/").pop() ?? "");
|
|
38118
|
-
const compareK8sVersionDesc$1 = (a, b) => {
|
|
38119
|
-
const pa = parseK8sVersion$1(versionToken$1(a));
|
|
38120
|
-
const pb = parseK8sVersion$1(versionToken$1(b));
|
|
38121
|
-
return pb.rank - pa.rank || pb.major - pa.major || pb.stageNum - pa.stageNum;
|
|
38122
|
-
};
|
|
38123
|
-
const orderVersions = (versions) => {
|
|
38124
|
-
const preferredIdx = versions.findIndex((v) => v.preferred === true);
|
|
38125
|
-
if (preferredIdx >= 0) {
|
|
38126
|
-
const preferred = versions[preferredIdx];
|
|
38127
|
-
const rest = versions.filter((_, i) => i !== preferredIdx).slice().sort(compareK8sVersionDesc$1);
|
|
38128
|
-
return [preferred, ...rest];
|
|
38129
|
-
}
|
|
38130
|
-
return versions.slice().sort(compareK8sVersionDesc$1);
|
|
38131
|
-
};
|
|
38132
|
-
const getSortedKindsAll = (index) => {
|
|
38133
|
-
const counts = index.items.reduce(
|
|
38134
|
-
(acc, item) => ({ ...acc, [item.kind]: (acc[item.kind] ?? 0) + 1 }),
|
|
38135
|
-
{}
|
|
38136
|
-
);
|
|
38137
|
-
const rows = index.items.flatMap((item) => {
|
|
38138
|
-
const ordered = orderVersions(item.versions);
|
|
38139
|
-
return ordered.map((v) => ({
|
|
38140
|
-
group: item.group,
|
|
38141
|
-
kind: item.kind,
|
|
38142
|
-
// clone to drop Readonly<> without changing fields (incl. preferred)
|
|
38143
|
-
version: { ...v },
|
|
38144
|
-
...counts[item.kind] > 1 ? { notUnique: true } : {}
|
|
38145
|
-
}));
|
|
38146
|
-
});
|
|
38147
|
-
return rows.sort(
|
|
38148
|
-
(a, b) => a.kind.localeCompare(b.kind, void 0, { sensitivity: "base" }) || a.group.localeCompare(b.group, void 0, { sensitivity: "base" })
|
|
38149
|
-
);
|
|
38150
|
-
};
|
|
38151
|
-
|
|
38152
38231
|
const parseApiVersion = (apiVersion) => {
|
|
38153
38232
|
const parts = apiVersion.trim().split("/");
|
|
38154
38233
|
return parts.length === 1 ? { group: "", version: parts[0] } : { group: parts[0], version: parts[1] };
|
|
@@ -38238,7 +38317,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38238
38317
|
let forcedName;
|
|
38239
38318
|
let objectNamespace;
|
|
38240
38319
|
if (keysToForcedLabel && rawObjectToFindLabel) {
|
|
38241
|
-
forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel, keysToForcedLabel) : jp.query(rawObjectToFindLabel, `$${keysToForcedLabel}`)[0];
|
|
38320
|
+
forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel || {}, keysToForcedLabel) : jp.query(rawObjectToFindLabel || {}, `$${keysToForcedLabel}`)[0];
|
|
38242
38321
|
}
|
|
38243
38322
|
if (forcedRelatedValuePath && rawObjectToFindLabel) {
|
|
38244
38323
|
try {
|
|
@@ -38250,15 +38329,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38250
38329
|
);
|
|
38251
38330
|
const relatedPath = forcedRelatedValuePath && ownerRefPathSegs ? resolveFormPath$1(forcedRelatedValuePath, ownerRefPathSegs) : void 0;
|
|
38252
38331
|
if (relatedPath) {
|
|
38253
|
-
forcedName = _$1.get(rawObjectToFindLabel, relatedPath);
|
|
38332
|
+
forcedName = _$1.get(rawObjectToFindLabel || {}, relatedPath);
|
|
38254
38333
|
}
|
|
38255
38334
|
} catch {
|
|
38256
38335
|
}
|
|
38257
38336
|
}
|
|
38258
38337
|
if (rawObjectToFindLabel) {
|
|
38259
38338
|
try {
|
|
38260
|
-
const defaultFetched = _$1.get(rawObjectToFindLabel, ["metadata", "namespace"]);
|
|
38261
|
-
const socketFetched = _$1.get(rawObjectToFindLabel, ["items", 0, "metadata", "namespace"]);
|
|
38339
|
+
const defaultFetched = _$1.get(rawObjectToFindLabel || {}, ["metadata", "namespace"]);
|
|
38340
|
+
const socketFetched = _$1.get(rawObjectToFindLabel || {}, ["items", 0, "metadata", "namespace"]);
|
|
38262
38341
|
objectNamespace = socketFetched || defaultFetched;
|
|
38263
38342
|
} catch {
|
|
38264
38343
|
}
|
|
@@ -38413,7 +38492,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38413
38492
|
if (jsonRoot === void 0) {
|
|
38414
38493
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
|
|
38415
38494
|
}
|
|
38416
|
-
const refsArr = jp.query(jsonRoot, `$${jsonPathToArrayOfRefs}`).flat();
|
|
38495
|
+
const refsArr = jp.query(jsonRoot || {}, `$${jsonPathToArrayOfRefs}`).flat();
|
|
38417
38496
|
if (!Array.isArray(refsArr)) {
|
|
38418
38497
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: notArrayErrorText });
|
|
38419
38498
|
}
|
|
@@ -38498,7 +38577,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38498
38577
|
if (jsonRoot === void 0) {
|
|
38499
38578
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
38500
38579
|
}
|
|
38501
|
-
const valueToCompare = jp.query(jsonRoot, `$${jsonPathToValue}`)[0];
|
|
38580
|
+
const valueToCompare = jp.query(jsonRoot || {}, `$${jsonPathToValue}`)[0];
|
|
38502
38581
|
let valueToSwitch = false;
|
|
38503
38582
|
if (criteria.type === "forSuccess") {
|
|
38504
38583
|
if (criteria.operator === "exists") {
|
|
@@ -38651,7 +38730,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38651
38730
|
if (jsonRoot === void 0) {
|
|
38652
38731
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
38653
38732
|
}
|
|
38654
|
-
const valueToCompare = jp.query(jsonRoot, `$${jsonPathToValue}`)[0];
|
|
38733
|
+
const valueToCompare = jp.query(jsonRoot || {}, `$${jsonPathToValue}`)[0];
|
|
38655
38734
|
const valueToSegmented = valuesMap?.find((el) => el.value === valueToCompare)?.renderedValue;
|
|
38656
38735
|
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
38657
38736
|
text: notificationSuccessMessage,
|
|
@@ -39193,16 +39272,16 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
39193
39272
|
return {
|
|
39194
39273
|
onClick: () => {
|
|
39195
39274
|
if (pathToNavigate && recordKeysForNavigation) {
|
|
39196
|
-
const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record, `$${recordKeysForNavigation}`)[0];
|
|
39275
|
+
const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record || {}, `$${recordKeysForNavigation}`)[0];
|
|
39197
39276
|
let recordValueRawSecond = "";
|
|
39198
39277
|
if (recordKeysForNavigationSecond) {
|
|
39199
|
-
recordValueRawSecond = Array.isArray(recordKeysForNavigationSecond) ? lodashExports.get(record, recordKeysForNavigationSecond) : jp.query(record, `$${recordKeysForNavigationSecond}`)[0];
|
|
39278
|
+
recordValueRawSecond = Array.isArray(recordKeysForNavigationSecond) ? lodashExports.get(record, recordKeysForNavigationSecond) : jp.query(record || {}, `$${recordKeysForNavigationSecond}`)[0];
|
|
39200
39279
|
} else {
|
|
39201
39280
|
recordValueRawSecond = "no-second-record-keys";
|
|
39202
39281
|
}
|
|
39203
39282
|
let recordValueRawThird = "";
|
|
39204
39283
|
if (recordKeysForNavigationThird) {
|
|
39205
|
-
recordValueRawThird = Array.isArray(recordKeysForNavigationThird) ? lodashExports.get(record, recordKeysForNavigationThird) : jp.query(record, `$${recordKeysForNavigationThird}`)[0];
|
|
39284
|
+
recordValueRawThird = Array.isArray(recordKeysForNavigationThird) ? lodashExports.get(record, recordKeysForNavigationThird) : jp.query(record || {}, `$${recordKeysForNavigationThird}`)[0];
|
|
39206
39285
|
} else {
|
|
39207
39286
|
recordValueRawThird = "no-second-record-keys";
|
|
39208
39287
|
}
|
|
@@ -39307,7 +39386,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
39307
39386
|
dataSource = dataSource.map((el) => {
|
|
39308
39387
|
const newFieldsForComplexJsonPath = {};
|
|
39309
39388
|
customFields.forEach(({ dataIndex, jsonPath }) => {
|
|
39310
|
-
const jpQueryResult = jp.query(el, `$${jsonPath}`);
|
|
39389
|
+
const jpQueryResult = jp.query(el || {}, `$${jsonPath}`);
|
|
39311
39390
|
newFieldsForComplexJsonPath[dataIndex] = Array.isArray(jpQueryResult) && jpQueryResult.length === 1 ? jpQueryResult[0] : jpQueryResult;
|
|
39312
39391
|
});
|
|
39313
39392
|
if (typeof el === "object") {
|
|
@@ -39326,7 +39405,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
39326
39405
|
if (!el || typeof el !== "object" || Array.isArray(el)) {
|
|
39327
39406
|
return;
|
|
39328
39407
|
}
|
|
39329
|
-
const mapValue = jp.query(el, `$${flatMapColumn.jsonPath}`)[0];
|
|
39408
|
+
const mapValue = jp.query(el || {}, `$${flatMapColumn.jsonPath}`)[0];
|
|
39330
39409
|
if (mapValue && typeof mapValue === "object" && !Array.isArray(mapValue) && mapValue !== null) {
|
|
39331
39410
|
const mapEntries = Object.entries(mapValue);
|
|
39332
39411
|
if (mapEntries.length > 0) {
|
|
@@ -47734,14 +47813,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47734
47813
|
const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
|
|
47735
47814
|
memoryPaths.forEach((path) => {
|
|
47736
47815
|
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
47737
|
-
const value = _$1.get(newObject, cleanPath);
|
|
47816
|
+
const value = _$1.get(newObject || {}, cleanPath);
|
|
47738
47817
|
if (value || value === 0) {
|
|
47739
47818
|
_$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
|
|
47740
47819
|
}
|
|
47741
47820
|
});
|
|
47742
47821
|
cpuPaths.forEach((path) => {
|
|
47743
47822
|
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
47744
|
-
const value = _$1.get(newObject, cleanPath);
|
|
47823
|
+
const value = _$1.get(newObject || {}, cleanPath);
|
|
47745
47824
|
if (value || value === 0) {
|
|
47746
47825
|
_$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
|
|
47747
47826
|
}
|
|
@@ -48023,9 +48102,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
48023
48102
|
if (isErrorOptionsObj && (!customProps.relatedValuePath || customProps.relatedValuePath && !!relatedFieldValue)) {
|
|
48024
48103
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(HeightContainer, { $height: 64, children: "Error" });
|
|
48025
48104
|
}
|
|
48026
|
-
const items = !isErrorOptionsObj && !isLoadingOptionsObj && optionsObj ? _$1.get(optionsObj, ["items"]) : [];
|
|
48105
|
+
const items = !isErrorOptionsObj && !isLoadingOptionsObj && optionsObj ? _$1.get(optionsObj || {}, ["items"]) : [];
|
|
48027
48106
|
const filteredItems = customProps.criteria ? items.filter((item) => {
|
|
48028
|
-
const objValue = Array.isArray(customProps.criteria?.keysToValue) ? _$1.get(item, customProps.criteria?.keysToValue || []) : jp.query(item, `$${customProps.criteria?.keysToValue}`)[0];
|
|
48107
|
+
const objValue = Array.isArray(customProps.criteria?.keysToValue) ? _$1.get(item || {}, customProps.criteria?.keysToValue || []) : jp.query(item || {}, `$${customProps.criteria?.keysToValue}`)[0];
|
|
48029
48108
|
if (customProps.criteria?.type === "equals") {
|
|
48030
48109
|
return objValue === customProps.criteria?.value;
|
|
48031
48110
|
}
|
|
@@ -48033,18 +48112,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
48033
48112
|
}) : items;
|
|
48034
48113
|
const itemForPrefilledValue = customProps.criteria?.keepPrefilled !== false ? items.find((item) => {
|
|
48035
48114
|
if (Array.isArray(customProps.keysToValue)) {
|
|
48036
|
-
return _$1.get(item, customProps.keysToValue) === fieldValue;
|
|
48115
|
+
return _$1.get(item || {}, customProps.keysToValue) === fieldValue;
|
|
48037
48116
|
}
|
|
48038
|
-
return jp.query(item, `$${customProps.keysToValue}`)[0] === fieldValue;
|
|
48117
|
+
return jp.query(item || {}, `$${customProps.keysToValue}`)[0] === fieldValue;
|
|
48039
48118
|
}) : void 0;
|
|
48040
48119
|
const filteredItemsAndPrefilledValue = itemForPrefilledValue ? [itemForPrefilledValue, ...filteredItems] : filteredItems;
|
|
48041
48120
|
const options = Array.isArray(filteredItemsAndPrefilledValue) ? filteredItemsAndPrefilledValue.map((item) => {
|
|
48042
|
-
const value = Array.isArray(customProps.keysToValue) ? _$1.get(item, customProps.keysToValue) : jp.query(item, `$${customProps.keysToValue}`)[0];
|
|
48121
|
+
const value = Array.isArray(customProps.keysToValue) ? _$1.get(item || {}, customProps.keysToValue) : jp.query(item || {}, `$${customProps.keysToValue}`)[0];
|
|
48043
48122
|
let label = "";
|
|
48044
48123
|
if (customProps.keysToLabel) {
|
|
48045
|
-
label = Array.isArray(customProps.keysToLabel) ? _$1.get(item, customProps.keysToLabel) : jp.query(item, `$${customProps.keysToLabel}`)[0];
|
|
48124
|
+
label = Array.isArray(customProps.keysToLabel) ? _$1.get(item || {}, customProps.keysToLabel) : jp.query(item || {}, `$${customProps.keysToLabel}`)[0];
|
|
48046
48125
|
} else {
|
|
48047
|
-
label = Array.isArray(customProps.keysToValue) ? _$1.get(item, customProps.keysToValue) : jp.query(item, `$${customProps.keysToValue}`)[0];
|
|
48126
|
+
label = Array.isArray(customProps.keysToValue) ? _$1.get(item || {}, customProps.keysToValue) : jp.query(item || {}, `$${customProps.keysToValue}`)[0];
|
|
48048
48127
|
}
|
|
48049
48128
|
return {
|
|
48050
48129
|
value,
|
|
@@ -48104,7 +48183,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
48104
48183
|
keysToValue,
|
|
48105
48184
|
logic
|
|
48106
48185
|
}) => {
|
|
48107
|
-
const dirtyValue = Array.isArray(keysToValue) ? _$1.get(valueObj, keysToValue) : jp.query(valueObj, `$${keysToValue}`)[0];
|
|
48186
|
+
const dirtyValue = Array.isArray(keysToValue) ? _$1.get(valueObj || {}, keysToValue) : jp.query(valueObj || {}, `$${keysToValue}`)[0];
|
|
48108
48187
|
if (logic === "cpuLike") {
|
|
48109
48188
|
return parseQuotaValueCpu(dirtyValue);
|
|
48110
48189
|
}
|
|
@@ -52795,14 +52874,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
52795
52874
|
] });
|
|
52796
52875
|
};
|
|
52797
52876
|
|
|
52798
|
-
const kindByGvr = (entries) => (gvr) => {
|
|
52799
|
-
const [group = "", v = "", resource = ""] = gvr.split("~", 3);
|
|
52800
|
-
const norm = (s) => s.trim();
|
|
52801
|
-
const kinds = entries.filter((e) => norm(e.group) === norm(group) && e.version.version === v && e.version.resource === resource).map((e) => e.kind);
|
|
52802
|
-
const uniq = Array.from(new Set(kinds));
|
|
52803
|
-
return uniq.length === 1 ? uniq[0] : void 0;
|
|
52804
|
-
};
|
|
52805
|
-
|
|
52806
52877
|
const SelectTag = styled(antd.Tag)`
|
|
52807
52878
|
margin-inline-end: 4px;
|
|
52808
52879
|
padding: 4px 6px;
|