@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.17 → 1.2.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.
|
@@ -8630,10 +8630,6 @@
|
|
|
8630
8630
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$y.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
|
|
8631
8631
|
};
|
|
8632
8632
|
|
|
8633
|
-
const getKinds = async ({ cluster }) => {
|
|
8634
|
-
return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
8635
|
-
};
|
|
8636
|
-
|
|
8637
8633
|
const kindByGvr = (entries) => (gvr) => {
|
|
8638
8634
|
const [group = "", v = "", resource = ""] = gvr.split("~", 3);
|
|
8639
8635
|
const norm = (s) => s.trim();
|
|
@@ -8642,6 +8638,10 @@
|
|
|
8642
8638
|
return uniq.length === 1 ? uniq[0] : void 0;
|
|
8643
8639
|
};
|
|
8644
8640
|
|
|
8641
|
+
const getKinds = async ({ cluster }) => {
|
|
8642
|
+
return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
8643
|
+
};
|
|
8644
|
+
|
|
8645
8645
|
const parseK8sVersion$1 = (raw) => {
|
|
8646
8646
|
const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
|
|
8647
8647
|
if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
|
|
@@ -8686,6 +8686,23 @@
|
|
|
8686
8686
|
);
|
|
8687
8687
|
};
|
|
8688
8688
|
|
|
8689
|
+
const useKinds = ({
|
|
8690
|
+
cluster,
|
|
8691
|
+
refetchInterval,
|
|
8692
|
+
isEnabled
|
|
8693
|
+
}) => {
|
|
8694
|
+
return reactQuery.useQuery({
|
|
8695
|
+
queryKey: ["useKinds", cluster],
|
|
8696
|
+
queryFn: () => getKinds({ cluster }),
|
|
8697
|
+
select: (data) => ({
|
|
8698
|
+
kindIndex: data.data,
|
|
8699
|
+
kindsWithVersion: getSortedKindsAll(data.data)
|
|
8700
|
+
}),
|
|
8701
|
+
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
|
|
8702
|
+
enabled: isEnabled
|
|
8703
|
+
});
|
|
8704
|
+
};
|
|
8705
|
+
|
|
8689
8706
|
const getDirectUnknownResource = async ({ uri }) => {
|
|
8690
8707
|
return axios.get(uri);
|
|
8691
8708
|
};
|
|
@@ -9392,27 +9409,11 @@
|
|
|
9392
9409
|
const useK8sSmartResource = (params) => {
|
|
9393
9410
|
const { cluster, apiGroup, apiVersion, plural } = params;
|
|
9394
9411
|
const base = useK8sSmartResourceWithoutKinds(params);
|
|
9395
|
-
const
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
return void 0;
|
|
9401
|
-
}
|
|
9402
|
-
getKinds({ cluster }).then((data) => {
|
|
9403
|
-
if (cancelled) {
|
|
9404
|
-
return;
|
|
9405
|
-
}
|
|
9406
|
-
setKindsWithVersion(getSortedKindsAll(data.data));
|
|
9407
|
-
}).catch(() => {
|
|
9408
|
-
if (!cancelled) {
|
|
9409
|
-
setKindsWithVersion(void 0);
|
|
9410
|
-
}
|
|
9411
|
-
});
|
|
9412
|
-
return () => {
|
|
9413
|
-
cancelled = true;
|
|
9414
|
-
};
|
|
9415
|
-
}, [cluster]);
|
|
9412
|
+
const { data: kindsData } = useKinds({
|
|
9413
|
+
cluster,
|
|
9414
|
+
isEnabled: !!cluster
|
|
9415
|
+
});
|
|
9416
|
+
const kindsWithVersion = kindsData?.kindsWithVersion;
|
|
9416
9417
|
const resolveKindByGvr = React$1.useMemo(
|
|
9417
9418
|
() => kindsWithVersion ? kindByGvr(kindsWithVersion) : void 0,
|
|
9418
9419
|
[kindsWithVersion]
|
|
@@ -46511,23 +46512,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
46511
46512
|
return uniq.length === 1 ? uniq[0] : void 0;
|
|
46512
46513
|
};
|
|
46513
46514
|
|
|
46514
|
-
const useKinds = ({
|
|
46515
|
-
cluster,
|
|
46516
|
-
refetchInterval,
|
|
46517
|
-
isEnabled
|
|
46518
|
-
}) => {
|
|
46519
|
-
return reactQuery.useQuery({
|
|
46520
|
-
queryKey: ["useKinds", cluster],
|
|
46521
|
-
queryFn: () => getKinds({ cluster }),
|
|
46522
|
-
select: (data) => ({
|
|
46523
|
-
kindIndex: data.data,
|
|
46524
|
-
kindsWithVersion: getSortedKindsAll(data.data)
|
|
46525
|
-
}),
|
|
46526
|
-
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
|
|
46527
|
-
enabled: isEnabled
|
|
46528
|
-
});
|
|
46529
|
-
};
|
|
46530
|
-
|
|
46531
46515
|
const findOwnerReferencePath = (rawObject, jsonPathToArrayOfRefs, reference) => {
|
|
46532
46516
|
if (!rawObject || !jsonPathToArrayOfRefs) return void 0;
|
|
46533
46517
|
let arrayJsonPath = jsonPathToArrayOfRefs.trim();
|