@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.18 → 1.4.0-alpha.19
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/{index-BW_pcmSW.mjs → index-BLeZv2uT.mjs} +112 -23
- package/dist/{index-BW_pcmSW.mjs.map → index-BLeZv2uT.mjs.map} +1 -1
- package/dist/{index-DVkzeOTz.mjs → index-Cs_5F1Gd.mjs} +2 -2
- package/dist/{index-DVkzeOTz.mjs.map → index-Cs_5F1Gd.mjs.map} +1 -1
- package/dist/openapi-k8s-toolkit.es.js +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +110 -21
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/Events/Events.error.test.d.ts +2 -0
- package/dist/types/components/molecules/Events/types.d.ts +12 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/EnrichedTable/EnrichedTable.error.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/Events/Events.permissions.test.d.ts +2 -0
- package/dist/types/hooks/useDirectUnknownResource.d.ts +2 -1
- package/dist/types/hooks/useListThenWatch/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -8754,6 +8754,7 @@ const useDirectUnknownResource = ({
|
|
|
8754
8754
|
uri,
|
|
8755
8755
|
queryKey,
|
|
8756
8756
|
refetchInterval,
|
|
8757
|
+
staleTime,
|
|
8757
8758
|
isEnabled
|
|
8758
8759
|
}) => {
|
|
8759
8760
|
return useQuery({
|
|
@@ -8769,6 +8770,7 @@ const useDirectUnknownResource = ({
|
|
|
8769
8770
|
return data;
|
|
8770
8771
|
},
|
|
8771
8772
|
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3,
|
|
8773
|
+
staleTime,
|
|
8772
8774
|
enabled: isEnabled
|
|
8773
8775
|
});
|
|
8774
8776
|
};
|
|
@@ -8789,6 +8791,7 @@ const useK8sVerbs = ({
|
|
|
8789
8791
|
uri,
|
|
8790
8792
|
queryKey: ["k8s-verbs", cluster, group || "", version, plural],
|
|
8791
8793
|
refetchInterval: false,
|
|
8794
|
+
staleTime: 5 * 60 * 1e3,
|
|
8792
8795
|
isEnabled: Boolean(isEnabled && cluster && version && plural)
|
|
8793
8796
|
});
|
|
8794
8797
|
const verbs = data?.verbs || [];
|
|
@@ -9122,8 +9125,14 @@ const useListWatch = ({
|
|
|
9122
9125
|
return;
|
|
9123
9126
|
}
|
|
9124
9127
|
if (frame.type === "INITIAL_ERROR") {
|
|
9125
|
-
const
|
|
9128
|
+
const needsCodeSuffix = typeof frame.statusCode === "number" && !frame.message.includes(`(${frame.statusCode})`);
|
|
9129
|
+
const msg = needsCodeSuffix ? `${frame.message} (${frame.statusCode})` : frame.message;
|
|
9126
9130
|
setErrorSafe(msg);
|
|
9131
|
+
console.error("[useListWatch][initial]", {
|
|
9132
|
+
message: frame.message,
|
|
9133
|
+
statusCode: frame.statusCode,
|
|
9134
|
+
reason: frame.reason
|
|
9135
|
+
});
|
|
9127
9136
|
return;
|
|
9128
9137
|
}
|
|
9129
9138
|
if (frame.type === "INITIAL") {
|
|
@@ -9429,10 +9438,11 @@ const useK8sSmartResourceWithoutKinds = ({
|
|
|
9429
9438
|
[watchEnabled, state, mapListWatchState]
|
|
9430
9439
|
);
|
|
9431
9440
|
const used = !isEnabled ? "disabled" : verbsLoading ? "verbs-loading" : verbsIsError ? "verbs-error" : watchEnabled ? "watch" : restEnabled ? "list" : "disabled";
|
|
9432
|
-
const
|
|
9441
|
+
const watchHasBlockingError = used === "watch" && Boolean(lastError) && (!hasInitial || status === "closed");
|
|
9442
|
+
const isLoading = isEnabled && verbsLoading || used === "watch" && status === "connecting" || used === "watch" && status === "open" && !hasInitial && !watchHasBlockingError || used === "list" && restLoading;
|
|
9433
9443
|
let error;
|
|
9434
9444
|
if (verbsIsError) error = verbsErrorObj;
|
|
9435
|
-
else if (
|
|
9445
|
+
else if (watchHasBlockingError) error = lastError;
|
|
9436
9446
|
else if (used === "list" && restIsError) error = restError;
|
|
9437
9447
|
const isError = Boolean(error);
|
|
9438
9448
|
const data = used === "watch" ? watchData : used === "list" ? restData : void 0;
|
|
@@ -35734,7 +35744,7 @@ const EnrichedTable$1 = ({
|
|
|
35734
35744
|
if (k8sResourceToFetchPrepared && fetchedDataSocketError) {
|
|
35735
35745
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
35736
35746
|
"Error: ",
|
|
35737
|
-
JSON.stringify(
|
|
35747
|
+
JSON.stringify(fetchedDataSocketError)
|
|
35738
35748
|
] });
|
|
35739
35749
|
}
|
|
35740
35750
|
const dataFromOneOfHooks = fetchedData || fetchedDataSocket || {};
|
|
@@ -47383,6 +47393,18 @@ const serializeLabelsWithNoEncoding = (input) => {
|
|
|
47383
47393
|
return entries.map(([k, v]) => `${k}=${v}`).join(",");
|
|
47384
47394
|
};
|
|
47385
47395
|
|
|
47396
|
+
const extractStatusCode = (error) => {
|
|
47397
|
+
const asRecord = (value) => typeof value === "object" && value !== null ? value : void 0;
|
|
47398
|
+
const toCode = (value) => {
|
|
47399
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
47400
|
+
if (typeof value === "string" && /^\d+$/.test(value)) return Number(value);
|
|
47401
|
+
return void 0;
|
|
47402
|
+
};
|
|
47403
|
+
const root = asRecord(error) || {};
|
|
47404
|
+
const response = asRecord(root.response) || {};
|
|
47405
|
+
const body = asRecord(root.body) || {};
|
|
47406
|
+
return toCode(response.status) ?? toCode(root.statusCode) ?? toCode(root.status) ?? toCode(root.code) ?? toCode(body.code);
|
|
47407
|
+
};
|
|
47386
47408
|
const Events$1 = ({
|
|
47387
47409
|
data,
|
|
47388
47410
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -47451,9 +47473,48 @@ const Events$1 = ({
|
|
|
47451
47473
|
}
|
|
47452
47474
|
const searchParams = params.toString();
|
|
47453
47475
|
const wsUrlWithParams = `${wsUrlPrepared}${searchParams ? `?${searchParams}` : ""}`;
|
|
47476
|
+
const namespaceFromWsUrl = (() => {
|
|
47477
|
+
try {
|
|
47478
|
+
const parsedUrl = new URL(wsUrlWithParams, window.location.origin);
|
|
47479
|
+
const namespace = parsedUrl.searchParams.get("namespace");
|
|
47480
|
+
return namespace && namespace.length > 0 ? namespace : void 0;
|
|
47481
|
+
} catch {
|
|
47482
|
+
return void 0;
|
|
47483
|
+
}
|
|
47484
|
+
})();
|
|
47485
|
+
const isPermissionCheckEnabled = Boolean(!isMultiqueryLoading && clusterPrepared);
|
|
47486
|
+
const listPermission = usePermissions({
|
|
47487
|
+
cluster: clusterPrepared || "",
|
|
47488
|
+
namespace: namespaceFromWsUrl,
|
|
47489
|
+
apiGroup: "events.k8s.io",
|
|
47490
|
+
plural: "events",
|
|
47491
|
+
verb: "list",
|
|
47492
|
+
refetchInterval: false,
|
|
47493
|
+
enabler: isPermissionCheckEnabled
|
|
47494
|
+
});
|
|
47495
|
+
const watchPermission = usePermissions({
|
|
47496
|
+
cluster: clusterPrepared || "",
|
|
47497
|
+
namespace: namespaceFromWsUrl,
|
|
47498
|
+
apiGroup: "events.k8s.io",
|
|
47499
|
+
plural: "events",
|
|
47500
|
+
verb: "watch",
|
|
47501
|
+
refetchInterval: false,
|
|
47502
|
+
enabler: isPermissionCheckEnabled
|
|
47503
|
+
});
|
|
47454
47504
|
if (isMultiqueryLoading) {
|
|
47455
47505
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
47456
47506
|
}
|
|
47507
|
+
if (isPermissionCheckEnabled && (listPermission.isPending || watchPermission.isPending)) {
|
|
47508
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "info", message: "Checking permissions for events stream...", showIcon: true }) });
|
|
47509
|
+
}
|
|
47510
|
+
if (isPermissionCheckEnabled && (listPermission.isError || watchPermission.isError)) {
|
|
47511
|
+
const statusCode = extractStatusCode(listPermission.error) ?? extractStatusCode(watchPermission.error);
|
|
47512
|
+
const message = statusCode ? `Failed to check permissions for events stream (${statusCode})` : "Failed to check permissions for events stream";
|
|
47513
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message, showIcon: true }) });
|
|
47514
|
+
}
|
|
47515
|
+
if (isPermissionCheckEnabled && (listPermission.data?.status?.allowed !== true || watchPermission.data?.status?.allowed !== true)) {
|
|
47516
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: "Access denied (403)", showIcon: true }) });
|
|
47517
|
+
}
|
|
47457
47518
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
47458
47519
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47459
47520
|
Events,
|
|
@@ -78618,7 +78679,7 @@ const TolerationsModal = ({
|
|
|
78618
78679
|
};
|
|
78619
78680
|
|
|
78620
78681
|
const LazyEnrichedTableModal = lazy(
|
|
78621
|
-
() => import('./index-
|
|
78682
|
+
() => import('./index-Cs_5F1Gd.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
|
|
78622
78683
|
);
|
|
78623
78684
|
const renderActiveType = (activeType, extraProps) => {
|
|
78624
78685
|
if (!activeType) return null;
|
|
@@ -89996,6 +90057,7 @@ const Events = ({
|
|
|
89996
90057
|
const [hasMore, setHasMore] = useState(false);
|
|
89997
90058
|
const [connStatus, setConnStatus] = useState("connecting");
|
|
89998
90059
|
const [lastError, setLastError] = useState(void 0);
|
|
90060
|
+
const [fatalError, setFatalError] = useState(void 0);
|
|
89999
90061
|
const wsRef = useRef(null);
|
|
90000
90062
|
const listRef = useRef(null);
|
|
90001
90063
|
const sentinelRef = useRef(null);
|
|
@@ -90041,11 +90103,31 @@ const Events = ({
|
|
|
90041
90103
|
return;
|
|
90042
90104
|
}
|
|
90043
90105
|
if (!frame) return;
|
|
90106
|
+
if (frame.type === "SERVER_LOG") {
|
|
90107
|
+
const level = frame.level || "info";
|
|
90108
|
+
const msg = frame.message;
|
|
90109
|
+
(console[level] || console.log).call(console, "[Events][server]", msg);
|
|
90110
|
+
return;
|
|
90111
|
+
}
|
|
90112
|
+
if (frame.type === "INITIAL_ERROR") {
|
|
90113
|
+
const needsCodeSuffix = typeof frame.statusCode === "number" && !frame.message.includes(`(${frame.statusCode})`);
|
|
90114
|
+
const msg = needsCodeSuffix ? `${frame.message} (${frame.statusCode})` : frame.message;
|
|
90115
|
+
setFatalError(msg);
|
|
90116
|
+
setLastError(msg);
|
|
90117
|
+
fetchingRef.current = false;
|
|
90118
|
+
console.error("[Events][initial]", {
|
|
90119
|
+
message: frame.message,
|
|
90120
|
+
statusCode: frame.statusCode,
|
|
90121
|
+
reason: frame.reason
|
|
90122
|
+
});
|
|
90123
|
+
return;
|
|
90124
|
+
}
|
|
90044
90125
|
if (frame.type === "INITIAL") {
|
|
90045
90126
|
dispatch({ type: "RESET", items: frame.items });
|
|
90046
90127
|
setContToken(frame.continue);
|
|
90047
90128
|
setHasMore(Boolean(frame.continue));
|
|
90048
90129
|
setLastError(void 0);
|
|
90130
|
+
setFatalError(void 0);
|
|
90049
90131
|
fetchingRef.current = false;
|
|
90050
90132
|
const snapshotRV = frame.resourceVersion || getMaxRV(frame.items);
|
|
90051
90133
|
if (snapshotRV) {
|
|
@@ -90193,6 +90275,29 @@ const Events = ({
|
|
|
90193
90275
|
const total = state.order.length;
|
|
90194
90276
|
const getPlural = kindsData?.kindsWithVersion ? pluralByKind(kindsData?.kindsWithVersion) : void 0;
|
|
90195
90277
|
const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
|
|
90278
|
+
const listContent = (() => {
|
|
90279
|
+
if (fatalError && state.order.length === 0) return /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { type: "error", message: fatalError, showIcon: true });
|
|
90280
|
+
if (state.order.length > 0) {
|
|
90281
|
+
return state.order.map((k) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
90282
|
+
EventRow,
|
|
90283
|
+
{
|
|
90284
|
+
e: state.byKey[k],
|
|
90285
|
+
theme: theme$1,
|
|
90286
|
+
baseprefix,
|
|
90287
|
+
cluster,
|
|
90288
|
+
getPlural,
|
|
90289
|
+
baseFactoryNamespacedAPIKey,
|
|
90290
|
+
baseFactoryClusterSceopedAPIKey,
|
|
90291
|
+
baseFactoryNamespacedBuiltinKey,
|
|
90292
|
+
baseFactoryClusterSceopedBuiltinKey,
|
|
90293
|
+
baseNamespaceFactoryKey,
|
|
90294
|
+
baseFactoriesMapping
|
|
90295
|
+
},
|
|
90296
|
+
k
|
|
90297
|
+
));
|
|
90298
|
+
}
|
|
90299
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Empty, { description: "No events" });
|
|
90300
|
+
})();
|
|
90196
90301
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Root, { $substractHeight: substractHeight || 340, children: [
|
|
90197
90302
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Header, { children: [
|
|
90198
90303
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled.HeaderLeftSide, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { justify: "start", align: "center", gap: 10, children: [
|
|
@@ -90241,23 +90346,7 @@ const Events = ({
|
|
|
90241
90346
|
] })
|
|
90242
90347
|
] }),
|
|
90243
90348
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.List, { ref: listRef, onScroll, children: [
|
|
90244
|
-
|
|
90245
|
-
EventRow,
|
|
90246
|
-
{
|
|
90247
|
-
e: state.byKey[k],
|
|
90248
|
-
theme: theme$1,
|
|
90249
|
-
baseprefix,
|
|
90250
|
-
cluster,
|
|
90251
|
-
getPlural,
|
|
90252
|
-
baseFactoryNamespacedAPIKey,
|
|
90253
|
-
baseFactoryClusterSceopedAPIKey,
|
|
90254
|
-
baseFactoryNamespacedBuiltinKey,
|
|
90255
|
-
baseFactoryClusterSceopedBuiltinKey,
|
|
90256
|
-
baseNamespaceFactoryKey,
|
|
90257
|
-
baseFactoriesMapping
|
|
90258
|
-
},
|
|
90259
|
-
k
|
|
90260
|
-
)) : /* @__PURE__ */ jsxRuntimeExports.jsx(Empty, { description: "No events" }),
|
|
90349
|
+
listContent,
|
|
90261
90350
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled.Sentinel, { ref: sentinelRef })
|
|
90262
90351
|
] }),
|
|
90263
90352
|
state.order.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.Timeline, { $colorText: token.colorText, $substractHeight: substractHeight || 340 })
|
|
@@ -90899,4 +90988,4 @@ const usePluginManifest = ({
|
|
|
90899
90988
|
};
|
|
90900
90989
|
|
|
90901
90990
|
export { useInfiniteSentinel as $, getBuiltinResourceTypes as A, getCrdData as B, getDirectUnknownResource as C, DeleteIcon as D, EnrichedTableProvider as E, checkPermission as F, getSwagger as G, filterIfApiInstanceNamespaceScoped as H, filterIfBuiltInInstanceNamespaceScoped as I, checkIfApiInstanceNamespaceScoped as J, checkIfBuiltInInstanceNamespaceScoped as K, getKinds as L, useClusterList as M, useApiResources as N, useApiResourceSingle as O, PaddingContainer as P, useBuiltinResources as Q, ReadOnlyModal as R, useBuiltinResourceSingle as S, useCrdResources as T, useCrdResourceSingle as U, useApisResourceTypes as V, useApiResourceTypesByGroup as W, useBuiltinResourceTypes as X, useCrdData as Y, useListWatch as Z, _$1 as _, useTheme as a, parseQuotaValueCpu as a$, useK8sVerbs as a0, useManyK8sSmartResource as a1, useSmartResourceParams as a2, useResourceScope as a3, useKinds as a4, usePluginManifest as a5, Spacer$1 as a6, TreeWithSearch as a7, ConfirmModal as a8, UpIcon as a9, EnrichedTable as aA, ClusterListTable as aB, getEnrichedColumns as aC, getEnrichedColumnsWithControls as aD, YamlEditorSingleton$1 as aE, BlackholeFormProvider as aF, BlackholeForm as aG, getObjectFormItemsDraft as aH, MarketPlace as aI, MarketplaceCard as aJ, ProjectInfoCard as aK, PodTerminal as aL, NodeTerminal as aM, PodLogs as aN, PodLogsMonaco as aO, VMVNC as aP, Search as aQ, Events as aR, DynamicRenderer as aS, DynamicComponents as aT, DynamicRendererWithProviders as aU, prepareTemplate as aV, isFlatObject as aW, filterSelectOptions as aX, getStringByName as aY, floorToDecimal as aZ, parseQuotaValue as a_, DownIcon as aa, BackToDefaultIcon as ab, SuccessIcon as ac, feedbackIcons as ad, PlusIcon as ae, MinusIcon as af, LockedIcon as ag, UnlockedIcon as ah, PauseCircleIcon as ai, ResumeCircleIcon as aj, LookingGlassIcon as ak, EarthIcon as al, ContentCard$1 as am, FlexGrow as an, UncontrolledSelect as ao, CustomSelect$4 as ap, CursorPointerTag as aq, CursorPointerTagMinContent as ar, CursorDefaultDiv as as, ResourceLink as at, ManageableBreadcrumbsProvider as au, prepareDataForManageableBreadcrumbs as av, ManageableBreadcrumbs as aw, ManageableSidebarProvider as ax, prepareDataForManageableSidebar as ay, ManageableSidebar as az, usePartsOfUrl as b, parseQuotaValueMemoryAndStorage as b0, normalizeValuesForQuotasToNumber as b1, getAllPathsFromObj as b2, getPrefixSubarrays as b3, groupsToTreeData as b4, getBuiltinTreeData as b5, getGroupsByCategory as b6, createContextFactory as b7, prepareUrlsToFetchForDynamicRenderer as b8, deepMerge as b9, getSortedKinds as ba, getSortedKindsAll as bb, hslFromString as bc, getUppercase as bd, kindByGvr as be, pluralByKind as bf, namespacedByGvr as bg, getLinkToBuiltinForm as bh, getLinkToApiForm as bi, isMultilineString as bj, isMultilineFromYaml as bk, includesArray as bl, getResourceLink as bm, getNamespaceLink as bn, convertBytes as bo, formatBytesAuto as bp, toBytes as bq, convertStorage as br, parseValueWithUnit as bs, convertCores as bt, formatCoresAuto as bu, toCores as bv, convertCompute as bw, parseCoresWithUnit as bx, formatDateAuto as by, isValidRFC3339 as bz, usePermissions as c, useDirectUnknownResource as d, useK8sSmartResource as e, jsxRuntimeExports as f, EditIcon as g, getLinkToForm as h, DeleteModal as i, jp as j, DeleteModalMany as k, getClusterList as l, createNewEntry as m, updateEntry as n, deleteEntry as o, parseAll as p, getApiResources as q, getApiResourceSingle as r, serializeLabelsWithNoEncoding$1 as s, getBuiltinResources as t, useMultiQuery as u, getBuiltinResourceSingle as v, getCrdResources as w, getCrdResourceSingle as x, getApiResourceTypes as y, getApiResourceTypesByApiGroup as z };
|
|
90902
|
-
//# sourceMappingURL=index-
|
|
90991
|
+
//# sourceMappingURL=index-BLeZv2uT.mjs.map
|