@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.20 → 1.1.0-alpha.21
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 +52 -10
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +52 -8
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +1 -0
- package/dist/types/hooks/useK8sSmartResource/index.d.ts +2 -0
- package/dist/types/hooks/useK8sSmartResource/useManyK8sSmartResource.d.ts +17 -0
- package/dist/types/hooks/useK8sSmartResource/useSmartResourceParams.d.ts +9 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import styled, { createGlobalStyle } from 'styled-components';
|
|
|
2
2
|
import K, { useState, useRef, useLayoutEffect, useReducer, useEffect, useCallback, useMemo, Fragment, createContext, useContext, createElement, isValidElement, cloneElement, useInsertionEffect, useSyncExternalStore, memo, Suspense } from 'react';
|
|
3
3
|
import { Input, Tree, Modal, Alert, theme, Select, Tag, Flex, Typography, Breadcrumb, Spin, Menu, Tooltip, Space, Button, Card as Card$1, Row, Col, Tabs, Form, Popover, notification, Switch, Segmented, Dropdown, Table, Slider, InputNumber, Result, Progress, Checkbox, Empty } from 'antd';
|
|
4
4
|
import { LoadingOutlined, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled, PlusOutlined, ClearOutlined, MinusOutlined, CaretDownOutlined, CaretRightOutlined, InfoCircleOutlined, EyeOutlined, EyeInvisibleOutlined, SearchOutlined, MoreOutlined, CheckOutlined, CloseOutlined, BugOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
5
|
-
import { useNavigate, Link, useLocation, useParams
|
|
5
|
+
import { useNavigate, useSearchParams, Link, useLocation, useParams } from 'react-router-dom';
|
|
6
6
|
import { useQuery, useQueries, useQueryClient } from '@tanstack/react-query';
|
|
7
7
|
|
|
8
8
|
const Spacer$1 = styled.div`
|
|
@@ -9432,6 +9432,32 @@ const useK8sSmartResource = (params) => {
|
|
|
9432
9432
|
};
|
|
9433
9433
|
};
|
|
9434
9434
|
|
|
9435
|
+
const useManyK8sSmartResource = (paramsList) => {
|
|
9436
|
+
const results = [];
|
|
9437
|
+
for (let i = 0; i < paramsList.length; i++) {
|
|
9438
|
+
results[i] = useK8sSmartResource(paramsList[i]);
|
|
9439
|
+
}
|
|
9440
|
+
return results;
|
|
9441
|
+
};
|
|
9442
|
+
|
|
9443
|
+
const useSmartResourceParams = ({ cluster, namespace }) => {
|
|
9444
|
+
const [searchParams] = useSearchParams();
|
|
9445
|
+
return useMemo(() => {
|
|
9446
|
+
const raw = searchParams.get("resources");
|
|
9447
|
+
if (!raw) return [];
|
|
9448
|
+
return raw.split(",").map((entry) => {
|
|
9449
|
+
const [apiGroup = "", apiVersion = "", plural] = entry.split("/");
|
|
9450
|
+
return {
|
|
9451
|
+
cluster,
|
|
9452
|
+
namespace,
|
|
9453
|
+
apiGroup: apiGroup === "builtin" ? void 0 : apiGroup,
|
|
9454
|
+
apiVersion,
|
|
9455
|
+
plural
|
|
9456
|
+
};
|
|
9457
|
+
});
|
|
9458
|
+
}, [searchParams, cluster, namespace]);
|
|
9459
|
+
};
|
|
9460
|
+
|
|
9435
9461
|
const prepareTemplate = ({
|
|
9436
9462
|
template,
|
|
9437
9463
|
replaceValues
|
|
@@ -34041,22 +34067,26 @@ const MultiQueryProvider = ({ items, dataToApplyToContext, children }) => {
|
|
|
34041
34067
|
}))
|
|
34042
34068
|
});
|
|
34043
34069
|
const value = (() => {
|
|
34044
|
-
if (typeof dataToApplyToContext !== "undefined") {
|
|
34045
|
-
return { data: { req0: dataToApplyToContext }, isLoading: false, isError: false, errors: [] };
|
|
34046
|
-
}
|
|
34047
34070
|
const data = {};
|
|
34048
34071
|
const errors = [];
|
|
34072
|
+
const hasExtraReq0 = typeof dataToApplyToContext !== "undefined";
|
|
34073
|
+
const baseIndex = hasExtraReq0 ? 1 : 0;
|
|
34049
34074
|
for (let i = 0; i < k8sCount; i++) {
|
|
34050
34075
|
const e = state.entries[i] ?? makeEmptyEntry();
|
|
34051
|
-
|
|
34052
|
-
|
|
34076
|
+
const idx = baseIndex + i;
|
|
34077
|
+
data[`req${idx}`] = e.data;
|
|
34078
|
+
errors[idx] = e.isError ? e.error : null;
|
|
34053
34079
|
}
|
|
34054
34080
|
for (let i = 0; i < urlCount; i++) {
|
|
34055
34081
|
const q = urlQueries[i];
|
|
34056
|
-
const idx = k8sCount + i;
|
|
34082
|
+
const idx = baseIndex + k8sCount + i;
|
|
34057
34083
|
data[`req${idx}`] = q?.data;
|
|
34058
34084
|
errors[idx] = q?.isError ? q.error ?? null : null;
|
|
34059
34085
|
}
|
|
34086
|
+
if (hasExtraReq0) {
|
|
34087
|
+
data.req0 = dataToApplyToContext;
|
|
34088
|
+
errors[0] = null;
|
|
34089
|
+
}
|
|
34060
34090
|
const isLoading = state.entries.some((e) => e.isLoading) || urlQueries.some((q) => q.isLoading);
|
|
34061
34091
|
const isError = state.entries.some((e) => e.isError) || urlQueries.some((q) => q.isError);
|
|
34062
34092
|
return { data, isLoading, isError, errors };
|
|
@@ -34647,6 +34677,7 @@ const EnrichedTable$1 = ({
|
|
|
34647
34677
|
fetchUrl,
|
|
34648
34678
|
k8sResourceToFetch,
|
|
34649
34679
|
pathToItems,
|
|
34680
|
+
additionalReqsDataToEachItem,
|
|
34650
34681
|
cluster,
|
|
34651
34682
|
labelSelector,
|
|
34652
34683
|
labelSelectorFull,
|
|
@@ -34772,6 +34803,17 @@ const EnrichedTable$1 = ({
|
|
|
34772
34803
|
const dataFromOneOfHooks = fetchedData || fetchedDataSocket || {};
|
|
34773
34804
|
const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks || {}, pathToItems) : jp.query(dataFromOneOfHooks || {}, `$${pathToItems}`)[0];
|
|
34774
34805
|
const itemsAlwaysArr = Array.isArray(items) ? items : [];
|
|
34806
|
+
let additionalReqsData = [];
|
|
34807
|
+
if (additionalReqsDataToEachItem) {
|
|
34808
|
+
additionalReqsDataToEachItem.forEach((item) => {
|
|
34809
|
+
additionalReqsData?.push(multiQueryData[`req${item}`]);
|
|
34810
|
+
});
|
|
34811
|
+
}
|
|
34812
|
+
additionalReqsData = additionalReqsData.length > 0 ? additionalReqsData : void 0;
|
|
34813
|
+
const itemsAlwaysArrWithAdditionalData = itemsAlwaysArr.map((el) => ({
|
|
34814
|
+
...el,
|
|
34815
|
+
...additionalReqsData ? { additionalReqsData } : {}
|
|
34816
|
+
}));
|
|
34775
34817
|
const clearSelected = () => {
|
|
34776
34818
|
setSelectedRowKeys([]);
|
|
34777
34819
|
setSelectedRowsData([]);
|
|
@@ -34788,7 +34830,7 @@ const EnrichedTable$1 = ({
|
|
|
34788
34830
|
cluster: clusterPrepared,
|
|
34789
34831
|
namespace: namespacePrepared,
|
|
34790
34832
|
theme,
|
|
34791
|
-
dataItems:
|
|
34833
|
+
dataItems: itemsAlwaysArrWithAdditionalData,
|
|
34792
34834
|
tableProps: {
|
|
34793
34835
|
borderless: true,
|
|
34794
34836
|
paginationPosition: ["bottomRight"],
|
|
@@ -38916,7 +38958,7 @@ const TableFactory = ({ record, customProps, theme }) => {
|
|
|
38916
38958
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
38917
38959
|
DynamicRendererWithProviders,
|
|
38918
38960
|
{
|
|
38919
|
-
urlsToFetch: [],
|
|
38961
|
+
urlsToFetch: customProps.urlsToFetch || [],
|
|
38920
38962
|
dataToApplyToContext: record,
|
|
38921
38963
|
theme,
|
|
38922
38964
|
disableEventBubbling: customProps.disableEventBubbling,
|
|
@@ -54555,5 +54597,5 @@ const useInfiniteSentinel = (sentinelRef, hasMore, onNeedMore) => {
|
|
|
54555
54597
|
}, [sentinelRef, hasMore, onNeedMore]);
|
|
54556
54598
|
};
|
|
54557
54599
|
|
|
54558
|
-
export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, usePermissions };
|
|
54600
|
+
export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useSmartResourceParams };
|
|
54559
54601
|
//# sourceMappingURL=openapi-k8s-toolkit.es.js.map
|