@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.4 → 1.1.0-alpha.5
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 +57 -21
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +57 -21
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +7 -1
- package/dist/types/hooks/useApiResource.d.ts +1 -0
- package/dist/types/hooks/useBuiltinResource.d.ts +1 -0
- package/dist/types/hooks/useCrdResource.d.ts +1 -0
- package/dist/types/localTypes/k8s.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8373,11 +8373,7 @@ const useK8sVerbs = ({
|
|
|
8373
8373
|
};
|
|
8374
8374
|
};
|
|
8375
8375
|
|
|
8376
|
-
const eventKey$1 = (e) => {
|
|
8377
|
-
const n = e.metadata?.name ?? "";
|
|
8378
|
-
const ns = e.metadata?.namespace ?? "";
|
|
8379
|
-
return `${ns}/${n}`;
|
|
8380
|
-
};
|
|
8376
|
+
const eventKey$1 = (e) => e.metadata?.uid ?? `${e.metadata?.namespace ?? ""}/${e.metadata?.name ?? ""}`;
|
|
8381
8377
|
const compareRV$1 = (a, b) => {
|
|
8382
8378
|
if (a.length !== b.length) return a.length > b.length ? 1 : -1;
|
|
8383
8379
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
@@ -34275,6 +34271,7 @@ const EnrichedTable$1 = ({
|
|
|
34275
34271
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34276
34272
|
id,
|
|
34277
34273
|
fetchUrl,
|
|
34274
|
+
k8sResourceToFetch,
|
|
34278
34275
|
pathToItems,
|
|
34279
34276
|
clusterNamePartOfUrl,
|
|
34280
34277
|
labelSelector,
|
|
@@ -34318,7 +34315,13 @@ const EnrichedTable$1 = ({
|
|
|
34318
34315
|
verb: "create",
|
|
34319
34316
|
refetchInterval: false
|
|
34320
34317
|
});
|
|
34321
|
-
const fetchUrlPrepared = parseAll({ text: fetchUrl, replaceValues, multiQueryData });
|
|
34318
|
+
const fetchUrlPrepared = fetchUrl ? parseAll({ text: fetchUrl, replaceValues, multiQueryData }) : void 0;
|
|
34319
|
+
const k8sResourceToFetchPrepared = k8sResourceToFetch ? {
|
|
34320
|
+
group: k8sResourceToFetch.group ? parseAll({ text: k8sResourceToFetch.group, replaceValues, multiQueryData }) : void 0,
|
|
34321
|
+
version: parseAll({ text: k8sResourceToFetch.version, replaceValues, multiQueryData }),
|
|
34322
|
+
plural: parseAll({ text: k8sResourceToFetch.plural, replaceValues, multiQueryData }),
|
|
34323
|
+
namespace: k8sResourceToFetch.namespace ? parseAll({ text: k8sResourceToFetch.namespace, replaceValues, multiQueryData }) : void 0
|
|
34324
|
+
} : void 0;
|
|
34322
34325
|
const sParams = new URLSearchParams();
|
|
34323
34326
|
if (labelSelector && Object.keys(labelSelector).length > 0) {
|
|
34324
34327
|
const parsedObject = Object.fromEntries(
|
|
@@ -34355,21 +34358,48 @@ const EnrichedTable$1 = ({
|
|
|
34355
34358
|
} = useDirectUnknownResource({
|
|
34356
34359
|
uri: `${fetchUrlPrepared}${searchParams ? `?${searchParams}` : ""}`,
|
|
34357
34360
|
queryKey: [`${fetchUrlPrepared}${searchParams ? `?${searchParams}` : ""}`],
|
|
34358
|
-
isEnabled: !isMultiqueryLoading
|
|
34361
|
+
isEnabled: Boolean(!isMultiqueryLoading && fetchUrlPrepared)
|
|
34359
34362
|
});
|
|
34360
|
-
|
|
34363
|
+
const {
|
|
34364
|
+
data: fetchedDataSocket,
|
|
34365
|
+
isLoading: isFetchedDataSocketLoading,
|
|
34366
|
+
error: fetchedDataSocketError
|
|
34367
|
+
} = useK8sSmartResource({
|
|
34368
|
+
cluster: clusterName || "",
|
|
34369
|
+
namespace: k8sResourceToFetchPrepared?.namespace,
|
|
34370
|
+
group: k8sResourceToFetchPrepared?.group,
|
|
34371
|
+
version: k8sResourceToFetchPrepared?.version || "",
|
|
34372
|
+
plural: k8sResourceToFetchPrepared?.plural || "",
|
|
34373
|
+
fieldSelector: sParams.get("fieldSelector") || void 0,
|
|
34374
|
+
labelSelector: sParams.get("labelSelector") || void 0,
|
|
34375
|
+
isEnabled: Boolean(!isMultiqueryLoading && k8sResourceToFetchPrepared)
|
|
34376
|
+
});
|
|
34377
|
+
if (fetchUrlPrepared && isMultiqueryLoading) {
|
|
34361
34378
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
34362
34379
|
}
|
|
34363
|
-
if (
|
|
34380
|
+
if (k8sResourceToFetchPrepared && isMultiqueryLoading) {
|
|
34381
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
34382
|
+
}
|
|
34383
|
+
if (fetchUrlPrepared && isFetchedDataLoading) {
|
|
34364
34384
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {}) });
|
|
34365
34385
|
}
|
|
34366
|
-
if (
|
|
34386
|
+
if (k8sResourceToFetchPrepared && isFetchedDataSocketLoading) {
|
|
34387
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {}) });
|
|
34388
|
+
}
|
|
34389
|
+
if (fetchUrlPrepared && fetchedDataError) {
|
|
34390
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
34391
|
+
"Error: ",
|
|
34392
|
+
JSON.stringify(fetchedDataError)
|
|
34393
|
+
] });
|
|
34394
|
+
}
|
|
34395
|
+
if (k8sResourceToFetchPrepared && fetchedDataSocketError) {
|
|
34367
34396
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
34368
34397
|
"Error: ",
|
|
34369
34398
|
JSON.stringify(fetchedDataError)
|
|
34370
34399
|
] });
|
|
34371
34400
|
}
|
|
34372
|
-
const
|
|
34401
|
+
const dataFromOneOfHooks = fetchedData || fetchedDataSocket?.items;
|
|
34402
|
+
const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks, pathToItems) : jp.query(dataFromOneOfHooks, `$${pathToItems}`)[0];
|
|
34373
34403
|
if (!items) {
|
|
34374
34404
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
34375
34405
|
"No data on this path ",
|
|
@@ -34504,15 +34534,18 @@ const PodTerminal$1 = ({
|
|
|
34504
34534
|
const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
|
|
34505
34535
|
const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
|
|
34506
34536
|
const {
|
|
34507
|
-
data:
|
|
34537
|
+
data: podInfoList,
|
|
34508
34538
|
isError: isPodInfoError,
|
|
34509
34539
|
isLoading: isLoadingPodInfo
|
|
34510
|
-
} =
|
|
34511
|
-
|
|
34512
|
-
|
|
34513
|
-
|
|
34540
|
+
} = useK8sSmartResource({
|
|
34541
|
+
cluster: clusterPrepared,
|
|
34542
|
+
namespace: namespacePrepared,
|
|
34543
|
+
version: "v1",
|
|
34544
|
+
plural: "pods",
|
|
34545
|
+
fieldSelector: `metadata.name=${podNamePrepared}`,
|
|
34514
34546
|
isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
|
|
34515
34547
|
});
|
|
34548
|
+
const podInfo = podInfoList?.items && podInfoList.items.length > 0 ? podInfoList.items[0] : void 0;
|
|
34516
34549
|
if (isMultiqueryLoading) {
|
|
34517
34550
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
34518
34551
|
}
|
|
@@ -34620,15 +34653,18 @@ const PodLogs$1 = ({
|
|
|
34620
34653
|
const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
|
|
34621
34654
|
const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
|
|
34622
34655
|
const {
|
|
34623
|
-
data:
|
|
34656
|
+
data: podInfoList,
|
|
34624
34657
|
isError: isPodInfoError,
|
|
34625
34658
|
isLoading: isLoadingPodInfo
|
|
34626
|
-
} =
|
|
34627
|
-
|
|
34628
|
-
|
|
34629
|
-
|
|
34659
|
+
} = useK8sSmartResource({
|
|
34660
|
+
cluster: clusterPrepared,
|
|
34661
|
+
namespace: namespacePrepared,
|
|
34662
|
+
version: "v1",
|
|
34663
|
+
plural: "pods",
|
|
34664
|
+
fieldSelector: `metadata.name=${podNamePrepared}`,
|
|
34630
34665
|
isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
|
|
34631
34666
|
});
|
|
34667
|
+
const podInfo = podInfoList?.items && podInfoList.items.length > 0 ? podInfoList.items[0] : void 0;
|
|
34632
34668
|
if (isMultiqueryLoading) {
|
|
34633
34669
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
34634
34670
|
}
|