@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.12 → 1.2.0-alpha.14

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.
@@ -8614,8 +8614,7 @@ const ManageableBreadcrumbs = ({ data }) => {
8614
8614
  };
8615
8615
 
8616
8616
  const getKinds = async ({ cluster }) => {
8617
- const result = await axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
8618
- return result.data;
8617
+ return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
8619
8618
  };
8620
8619
 
8621
8620
  const kindByGvr = (entries) => (gvr) => {
@@ -9387,7 +9386,7 @@ const useK8sSmartResource = (params) => {
9387
9386
  if (cancelled) {
9388
9387
  return;
9389
9388
  }
9390
- setKindsWithVersion(getSortedKindsAll(data));
9389
+ setKindsWithVersion(getSortedKindsAll(data.data));
9391
9390
  }).catch(() => {
9392
9391
  if (!cancelled) {
9393
9392
  setKindsWithVersion(void 0);
@@ -46470,6 +46469,23 @@ const pluralByKind = (entries) => (kind, apiVersion) => {
46470
46469
  return uniq.length === 1 ? uniq[0] : void 0;
46471
46470
  };
46472
46471
 
46472
+ const useKinds = ({
46473
+ cluster,
46474
+ refetchInterval,
46475
+ isEnabled
46476
+ }) => {
46477
+ return useQuery({
46478
+ queryKey: ["useKinds", cluster],
46479
+ queryFn: () => getKinds({ cluster }),
46480
+ select: (data) => ({
46481
+ kindIndex: data.data,
46482
+ kindsWithVersion: getSortedKindsAll(data.data)
46483
+ }),
46484
+ refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
46485
+ enabled: isEnabled
46486
+ });
46487
+ };
46488
+
46473
46489
  const findOwnerReferencePath = (rawObject, jsonPathToArrayOfRefs, reference) => {
46474
46490
  if (!rawObject || !jsonPathToArrayOfRefs) return void 0;
46475
46491
  let arrayJsonPath = jsonPathToArrayOfRefs.trim();
@@ -46601,16 +46617,7 @@ const RefsList = ({
46601
46617
  baseNavigationName,
46602
46618
  listFlexProps
46603
46619
  }) => {
46604
- const [kindIndex, setKindIndex] = useState();
46605
- const [kindsWithVersion, setKindWithVersion] = useState();
46606
- useEffect(() => {
46607
- getKinds({ cluster }).then((data) => {
46608
- setKindIndex(data);
46609
- setKindWithVersion(getSortedKindsAll(data));
46610
- }).catch((error) => {
46611
- console.error(error);
46612
- });
46613
- }, [cluster]);
46620
+ const { data: kindsData } = useKinds({ cluster });
46614
46621
  const { data: navigationDataArr } = useK8sSmartResource({
46615
46622
  cluster,
46616
46623
  apiGroup: "front.in-cloud.io",
@@ -46618,7 +46625,7 @@ const RefsList = ({
46618
46625
  plural: baseNavigationPlural,
46619
46626
  fieldSelector: `metadata.name=${baseNavigationName}`
46620
46627
  });
46621
- const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
46628
+ const getPlural = kindsData?.kindsWithVersion ? pluralByKind(kindsData?.kindsWithVersion) : void 0;
46622
46629
  const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
46623
46630
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { vertical: true, gap: 8, ...listFlexProps, children: refsArr.map((ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
46624
46631
  RefElement,
@@ -54898,16 +54905,7 @@ const Events = ({
54898
54905
  baseNavigationName
54899
54906
  }) => {
54900
54907
  const { token } = theme.useToken();
54901
- const [kindIndex, setKindIndex] = useState();
54902
- const [kindsWithVersion, setKindWithVersion] = useState();
54903
- useEffect(() => {
54904
- getKinds({ cluster }).then((data) => {
54905
- setKindIndex(data);
54906
- setKindWithVersion(getSortedKindsAll(data));
54907
- }).catch((error) => {
54908
- console.error(error);
54909
- });
54910
- }, [cluster]);
54908
+ const { data: kindsData } = useKinds({ cluster });
54911
54909
  const { data: navigationDataArr } = useK8sSmartResource({
54912
54910
  cluster,
54913
54911
  apiGroup: "front.in-cloud.io",
@@ -55126,7 +55124,7 @@ const Events = ({
55126
55124
  if (nearBottom && hasMore) sendScroll();
55127
55125
  }, [hasMore, sendScroll]);
55128
55126
  const total = state.order.length;
55129
- const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
55127
+ const getPlural = kindsData?.kindsWithVersion ? pluralByKind(kindsData?.kindsWithVersion) : void 0;
55130
55128
  const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
55131
55129
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Root, { $substractHeight: substractHeight || 340, children: [
55132
55130
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Header, { children: [
@@ -55823,5 +55821,5 @@ const useResourceScope = ({ plural, cluster, apiGroup, apiVersion }) => {
55823
55821
  });
55824
55822
  };
55825
55823
 
55826
- 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, VMVNC, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, convertBytes, convertCompute, convertCores, convertStorage, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, formatBytesAuto, formatCoresAuto, 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, parseCoresWithUnit, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, parseValueWithUnit, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, toBytes, toCores, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useResourceScope, useSmartResourceParams };
55824
+ 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, VMVNC, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, convertBytes, convertCompute, convertCores, convertStorage, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, formatBytesAuto, formatCoresAuto, 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, parseCoresWithUnit, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, parseValueWithUnit, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, toBytes, toCores, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useKinds, useListWatch, useManyK8sSmartResource, usePermissions, useResourceScope, useSmartResourceParams };
55827
55825
  //# sourceMappingURL=openapi-k8s-toolkit.es.js.map