@prorobotech/openapi-k8s-toolkit 1.0.3 → 1.1.0-alpha.10

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.
Files changed (213) hide show
  1. package/dist/openapi-k8s-toolkit.es.js +1764 -463
  2. package/dist/openapi-k8s-toolkit.es.js.map +1 -1
  3. package/dist/openapi-k8s-toolkit.umd.js +1775 -467
  4. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  5. package/dist/types/components/atoms/CursorDefaultDiv/CursorDefaultDiv.d.ts +2 -2
  6. package/dist/types/components/atoms/CursorDefaultDiv/index.d.ts +1 -1
  7. package/dist/types/components/atoms/CursorPointerTag/index.d.ts +1 -1
  8. package/dist/types/components/atoms/CursorPointerTagMinContent/index.d.ts +1 -1
  9. package/dist/types/components/atoms/CustomSelect/index.d.ts +1 -1
  10. package/dist/types/components/atoms/FlexGrow/index.d.ts +1 -1
  11. package/dist/types/components/atoms/PaddingContainer/index.d.ts +1 -1
  12. package/dist/types/components/atoms/ResourceLink/ResourceLink.d.ts +19 -0
  13. package/dist/types/components/atoms/ResourceLink/index.d.ts +1 -0
  14. package/dist/types/components/atoms/ResourceLink/styled.d.ts +8 -0
  15. package/dist/types/components/atoms/UncontrolledSelect/index.d.ts +1 -1
  16. package/dist/types/components/atoms/index.d.ts +19 -13
  17. package/dist/types/components/molecules/BlackholeForm/atoms/ArrayInsideContainer/ArrayInsideContainer.d.ts +2 -2
  18. package/dist/types/components/molecules/BlackholeForm/atoms/ArrayInsideContainer/index.d.ts +1 -1
  19. package/dist/types/components/molecules/BlackholeForm/atoms/CustomCollapse/index.d.ts +1 -1
  20. package/dist/types/components/molecules/BlackholeForm/atoms/CustomSizeTitle/index.d.ts +1 -1
  21. package/dist/types/components/molecules/BlackholeForm/atoms/DebugNameViewer/index.d.ts +1 -1
  22. package/dist/types/components/molecules/BlackholeForm/atoms/HeightContainer/index.d.ts +1 -1
  23. package/dist/types/components/molecules/BlackholeForm/atoms/HiddenContainer/HiddenContainer.d.ts +4 -2
  24. package/dist/types/components/molecules/BlackholeForm/atoms/HiddenContainer/index.d.ts +1 -1
  25. package/dist/types/components/molecules/BlackholeForm/atoms/PersistedCheckbox/index.d.ts +1 -1
  26. package/dist/types/components/molecules/BlackholeForm/atoms/PossibleHiddenContainer/index.d.ts +1 -1
  27. package/dist/types/components/molecules/BlackholeForm/atoms/ResetedFormItem/index.d.ts +1 -1
  28. package/dist/types/components/molecules/BlackholeForm/atoms/index.d.ts +9 -9
  29. package/dist/types/components/molecules/BlackholeForm/index.d.ts +2 -1
  30. package/dist/types/components/molecules/BlackholeForm/molecules/FormArrayHeader/index.d.ts +1 -1
  31. package/dist/types/components/molecules/BlackholeForm/molecules/FormBooleanInput/index.d.ts +1 -1
  32. package/dist/types/components/molecules/BlackholeForm/molecules/FormEnumStringInput/index.d.ts +1 -1
  33. package/dist/types/components/molecules/BlackholeForm/molecules/FormInlineYamlEditor/FormInlineYamlEditor.d.ts +4 -2
  34. package/dist/types/components/molecules/BlackholeForm/molecules/FormInlineYamlEditor/index.d.ts +1 -1
  35. package/dist/types/components/molecules/BlackholeForm/molecules/FormListInput/index.d.ts +1 -1
  36. package/dist/types/components/molecules/BlackholeForm/molecules/FormNamespaceInput/index.d.ts +1 -1
  37. package/dist/types/components/molecules/BlackholeForm/molecules/FormNumberInput/index.d.ts +1 -1
  38. package/dist/types/components/molecules/BlackholeForm/molecules/FormObjectFromSwagger/index.d.ts +1 -1
  39. package/dist/types/components/molecules/BlackholeForm/molecules/FormRangeInput/index.d.ts +1 -1
  40. package/dist/types/components/molecules/BlackholeForm/molecules/FormRangeInput/molecules/RangeInput/index.d.ts +1 -1
  41. package/dist/types/components/molecules/BlackholeForm/molecules/FormRangeInput/molecules/index.d.ts +1 -1
  42. package/dist/types/components/molecules/BlackholeForm/molecules/FormStringInput/index.d.ts +1 -1
  43. package/dist/types/components/molecules/BlackholeForm/molecules/FormStringMultilineInput/index.d.ts +1 -1
  44. package/dist/types/components/molecules/BlackholeForm/molecules/YamlEditor/index.d.ts +1 -1
  45. package/dist/types/components/molecules/BlackholeForm/molecules/YamlEditorSingleton/index.d.ts +1 -1
  46. package/dist/types/components/molecules/BlackholeForm/molecules/index.d.ts +13 -13
  47. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/BlackholeForm.d.ts +2 -3
  48. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/index.d.ts +1 -0
  49. package/dist/types/components/molecules/BlackholeForm/organisms/{BlackholeFormDataProvider/BlackholeFormDataProvider.d.ts → BlackholeFormProvider/BlackholeFormProvider.d.ts} +2 -2
  50. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeFormProvider/index.d.ts +2 -0
  51. package/dist/types/components/molecules/BlackholeForm/organisms/index.d.ts +4 -2
  52. package/dist/types/components/molecules/EnrichedTable/index.d.ts +2 -1
  53. package/dist/types/components/molecules/EnrichedTable/molecules/index.d.ts +1 -1
  54. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/FilterDropdown/index.d.ts +1 -1
  55. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/ShortenedTextWithTooltip/index.d.ts +1 -1
  56. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/TableComponents/index.d.ts +1 -1
  57. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/TextAlignContainer/index.d.ts +1 -1
  58. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/TinyButton/index.d.ts +1 -1
  59. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/TrimmedTags/index.d.ts +1 -1
  60. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/atoms/index.d.ts +6 -6
  61. package/dist/types/components/molecules/EnrichedTable/organisms/index.d.ts +4 -2
  62. package/dist/types/components/molecules/Events/Events.d.ts +3 -2
  63. package/dist/types/components/molecules/Events/index.d.ts +1 -0
  64. package/dist/types/components/molecules/Events/molecules/EventRow/EventRow.d.ts +1 -0
  65. package/dist/types/components/molecules/Events/molecules/EventRow/utils.d.ts +0 -20
  66. package/dist/types/components/molecules/ManageableBreadcrumbs/index.d.ts +2 -3
  67. package/dist/types/components/molecules/ManageableBreadcrumbs/molecules/CollapsibleBreadcrumb/index.d.ts +1 -1
  68. package/dist/types/components/molecules/ManageableBreadcrumbs/molecules/index.d.ts +1 -1
  69. package/dist/types/components/molecules/ManageableBreadcrumbs/organisms/ManageableBreadcrumbs/ManageableBreadcrumbs.d.ts +8 -0
  70. package/dist/types/components/molecules/ManageableBreadcrumbs/organisms/ManageableBreadcrumbs/index.d.ts +2 -0
  71. package/dist/types/components/molecules/ManageableBreadcrumbs/organisms/ManageableBreadcrumbsProvider/ManageableBreadcrumbsProvider.d.ts +12 -0
  72. package/dist/types/components/molecules/ManageableBreadcrumbs/organisms/ManageableBreadcrumbsProvider/index.d.ts +3 -0
  73. package/dist/types/components/molecules/ManageableBreadcrumbs/organisms/ManageableBreadcrumbsProvider/styled.d.ts +276 -0
  74. package/dist/types/components/molecules/ManageableBreadcrumbs/{utils.d.ts → organisms/ManageableBreadcrumbsProvider/utils.d.ts} +2 -2
  75. package/dist/types/components/molecules/ManageableBreadcrumbs/organisms/index.d.ts +4 -0
  76. package/dist/types/components/molecules/ManageableSidebar/index.d.ts +2 -3
  77. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebar/ManageableSidebar.d.ts +10 -0
  78. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebar/index.d.ts +2 -0
  79. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/ManageableSidebarProvider.d.ts +15 -0
  80. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/index.d.ts +3 -0
  81. package/dist/types/components/molecules/ManageableSidebar/organisms/index.d.ts +4 -0
  82. package/dist/types/components/molecules/MarketPlace/atoms/AddCard/index.d.ts +1 -1
  83. package/dist/types/components/molecules/MarketPlace/atoms/index.d.ts +1 -1
  84. package/dist/types/components/molecules/MarketPlace/molecules/AddEditFormModal/index.d.ts +1 -1
  85. package/dist/types/components/molecules/MarketPlace/molecules/MarketplaceCard/index.d.ts +2 -1
  86. package/dist/types/components/molecules/MarketPlace/molecules/SearchTextInput/index.d.ts +1 -1
  87. package/dist/types/components/molecules/MarketPlace/molecules/index.d.ts +4 -3
  88. package/dist/types/components/molecules/ProjectInfoCard/molecules/DropdownAccessGroups/index.d.ts +1 -1
  89. package/dist/types/components/molecules/ProjectInfoCard/molecules/DropdownActions/index.d.ts +1 -1
  90. package/dist/types/components/molecules/ProjectInfoCard/molecules/index.d.ts +2 -2
  91. package/dist/types/components/molecules/Search/Search.d.ts +1 -2
  92. package/dist/types/components/molecules/Search/index.d.ts +1 -0
  93. package/dist/types/components/molecules/Terminals/NodeTerminal/molecules/XTerminal/index.d.ts +1 -1
  94. package/dist/types/components/molecules/Terminals/NodeTerminal/molecules/index.d.ts +1 -1
  95. package/dist/types/components/molecules/Terminals/PodLogs/molecules/XTerminal/index.d.ts +1 -1
  96. package/dist/types/components/molecules/Terminals/PodLogs/molecules/index.d.ts +1 -1
  97. package/dist/types/components/molecules/Terminals/PodLogsMonaco/molecules/MonacoEditor/index.d.ts +1 -1
  98. package/dist/types/components/molecules/Terminals/PodLogsMonaco/molecules/index.d.ts +1 -1
  99. package/dist/types/components/molecules/Terminals/PodTerminal/molecules/XTerminal/index.d.ts +1 -1
  100. package/dist/types/components/molecules/Terminals/PodTerminal/molecules/index.d.ts +1 -1
  101. package/dist/types/components/molecules/Terminals/index.d.ts +8 -4
  102. package/dist/types/components/molecules/index.d.ts +18 -9
  103. package/dist/types/components/organisms/DynamicComponents/molecules/Annotations/index.d.ts +1 -1
  104. package/dist/types/components/organisms/DynamicComponents/molecules/Annotations/molecules/EditModal/index.d.ts +1 -1
  105. package/dist/types/components/organisms/DynamicComponents/molecules/Annotations/molecules/index.d.ts +1 -1
  106. package/dist/types/components/organisms/DynamicComponents/molecules/AntdButton/index.d.ts +1 -1
  107. package/dist/types/components/organisms/DynamicComponents/molecules/AntdCard/index.d.ts +1 -1
  108. package/dist/types/components/organisms/DynamicComponents/molecules/AntdCol/index.d.ts +1 -1
  109. package/dist/types/components/organisms/DynamicComponents/molecules/AntdFlex/index.d.ts +1 -1
  110. package/dist/types/components/organisms/DynamicComponents/molecules/AntdLink/index.d.ts +1 -1
  111. package/dist/types/components/organisms/DynamicComponents/molecules/AntdRow/index.d.ts +1 -1
  112. package/dist/types/components/organisms/DynamicComponents/molecules/AntdTabs/index.d.ts +1 -1
  113. package/dist/types/components/organisms/DynamicComponents/molecules/AntdText/index.d.ts +1 -1
  114. package/dist/types/components/organisms/DynamicComponents/molecules/ArrayOfObjectsToKeyValues/index.d.ts +1 -1
  115. package/dist/types/components/organisms/DynamicComponents/molecules/ContentCard/index.d.ts +1 -1
  116. package/dist/types/components/organisms/DynamicComponents/molecules/ConverterBytes/index.d.ts +1 -1
  117. package/dist/types/components/organisms/DynamicComponents/molecules/DefaultDiv/index.d.ts +1 -1
  118. package/dist/types/components/organisms/DynamicComponents/molecules/EnrichedTable/index.d.ts +1 -1
  119. package/dist/types/components/organisms/DynamicComponents/molecules/Events/index.d.ts +1 -1
  120. package/dist/types/components/organisms/DynamicComponents/molecules/ItemCounter/index.d.ts +1 -1
  121. package/dist/types/components/organisms/DynamicComponents/molecules/KeyCounter/index.d.ts +1 -1
  122. package/dist/types/components/organisms/DynamicComponents/molecules/Labels/index.d.ts +1 -1
  123. package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/EditModal/index.d.ts +1 -1
  124. package/dist/types/components/organisms/DynamicComponents/molecules/Labels/molecules/index.d.ts +1 -1
  125. package/dist/types/components/organisms/DynamicComponents/molecules/LabelsToSearchParams/index.d.ts +1 -1
  126. package/dist/types/components/organisms/DynamicComponents/molecules/MarketplaceCard/index.d.ts +1 -1
  127. package/dist/types/components/organisms/DynamicComponents/molecules/MultiQuery/index.d.ts +1 -1
  128. package/dist/types/components/organisms/DynamicComponents/molecules/NodeTerminal/index.d.ts +1 -1
  129. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/OwnerRefs.d.ts +6 -0
  130. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/guard.d.ts +2 -0
  131. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/index.d.ts +1 -0
  132. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/RefsList.d.ts +22 -0
  133. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/index.d.ts +1 -0
  134. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/molecules/RefElement/RefElement.d.ts +21 -0
  135. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/molecules/RefElement/index.d.ts +1 -0
  136. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/molecules/RefElement/utils.d.ts +5 -0
  137. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/molecules/index.d.ts +1 -0
  138. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/types.d.ts +6 -0
  139. package/dist/types/components/organisms/DynamicComponents/molecules/ParsedText/index.d.ts +1 -1
  140. package/dist/types/components/organisms/DynamicComponents/molecules/PartsOfUrl/index.d.ts +1 -1
  141. package/dist/types/components/organisms/DynamicComponents/molecules/PodLogs/index.d.ts +1 -1
  142. package/dist/types/components/organisms/DynamicComponents/molecules/PodTerminal/index.d.ts +1 -1
  143. package/dist/types/components/organisms/DynamicComponents/molecules/ProjectInfoCard/index.d.ts +1 -1
  144. package/dist/types/components/organisms/DynamicComponents/molecules/ResourceBadge/index.d.ts +1 -1
  145. package/dist/types/components/organisms/DynamicComponents/molecules/SecretBase64Plain/index.d.ts +1 -1
  146. package/dist/types/components/organisms/DynamicComponents/molecules/SidebarProvider/index.d.ts +1 -1
  147. package/dist/types/components/organisms/DynamicComponents/molecules/Spacer/index.d.ts +1 -1
  148. package/dist/types/components/organisms/DynamicComponents/molecules/StatusText/index.d.ts +1 -1
  149. package/dist/types/components/organisms/DynamicComponents/molecules/Taints/index.d.ts +1 -1
  150. package/dist/types/components/organisms/DynamicComponents/molecules/Taints/molecules/EditModal/index.d.ts +1 -1
  151. package/dist/types/components/organisms/DynamicComponents/molecules/Taints/molecules/index.d.ts +1 -1
  152. package/dist/types/components/organisms/DynamicComponents/molecules/Tolerations/index.d.ts +1 -1
  153. package/dist/types/components/organisms/DynamicComponents/molecules/Tolerations/molecules/EditModal/index.d.ts +1 -1
  154. package/dist/types/components/organisms/DynamicComponents/molecules/Tolerations/molecules/index.d.ts +1 -1
  155. package/dist/types/components/organisms/DynamicComponents/molecules/VisibilityContainer/index.d.ts +1 -1
  156. package/dist/types/components/organisms/DynamicComponents/molecules/YamlEditorSingleton/index.d.ts +1 -1
  157. package/dist/types/components/organisms/DynamicComponents/molecules/YamlEditorSingleton/utils.d.ts +10 -0
  158. package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +37 -36
  159. package/dist/types/components/organisms/DynamicComponents/types.d.ts +37 -5
  160. package/dist/types/components/organisms/DynamicRendererWithProviders/DynamicRendererWithProviders.d.ts +2 -1
  161. package/dist/types/components/organisms/DynamicRendererWithProviders/hybridDataProvider.d.ts +22 -0
  162. package/dist/types/components/organisms/DynamicRendererWithProviders/multiK8sProvider.d.ts +22 -0
  163. package/dist/types/components/organisms/index.d.ts +5 -3
  164. package/dist/types/hooks/useApiResource.d.ts +1 -0
  165. package/dist/types/hooks/useBuiltinResource.d.ts +1 -0
  166. package/dist/types/hooks/useCrdResource.d.ts +1 -0
  167. package/dist/types/hooks/useK8sSmartResource.d.ts +29 -0
  168. package/dist/types/hooks/useK8sVerbs.d.ts +13 -0
  169. package/dist/types/hooks/useListThenWatch/index.d.ts +3 -0
  170. package/dist/types/hooks/useListThenWatch/reducer.d.ts +20 -0
  171. package/dist/types/hooks/useListThenWatch/types.d.ts +39 -0
  172. package/dist/types/hooks/useListThenWatch/useInfiniteSentinel.d.ts +2 -0
  173. package/dist/types/hooks/useListThenWatch/useListWatch.d.ts +72 -0
  174. package/dist/types/hooks/useListThenWatch/utils.d.ts +11 -0
  175. package/dist/types/index.d.ts +5 -0
  176. package/dist/types/localTypes/bff/table.d.ts +1 -0
  177. package/dist/types/localTypes/dynamicRender.d.ts +2 -1
  178. package/dist/types/localTypes/k8s.d.ts +1 -0
  179. package/dist/types/localTypes/navigations.d.ts +24 -0
  180. package/dist/types/utils/createContextFactory/index.d.ts +1 -1
  181. package/dist/types/utils/deepMerge/index.d.ts +1 -1
  182. package/dist/types/utils/filterSelectOptions/index.d.ts +1 -1
  183. package/dist/types/utils/getAllPathsFromObj/index.d.ts +1 -1
  184. package/dist/types/utils/getGroupsByCategory/index.d.ts +1 -1
  185. package/dist/types/utils/getPrefixSubArrays/index.d.ts +1 -1
  186. package/dist/types/utils/getResourceLink/getResourceLink.d.ts +27 -0
  187. package/dist/types/utils/getResourceLink/index.d.ts +1 -0
  188. package/dist/types/utils/getSortedKinds/index.d.ts +1 -1
  189. package/dist/types/utils/getSortedKindsAll/index.d.ts +1 -1
  190. package/dist/types/utils/getStringByName/index.d.ts +1 -1
  191. package/dist/types/utils/getUppercase/index.d.ts +1 -1
  192. package/dist/types/utils/groupsToTreeData/index.d.ts +2 -1
  193. package/dist/types/utils/hslFromString/index.d.ts +1 -1
  194. package/dist/types/utils/index.d.ts +25 -22
  195. package/dist/types/utils/isFlatObject/index.d.ts +1 -1
  196. package/dist/types/utils/kindByGvr/index.d.ts +1 -1
  197. package/dist/types/utils/namespacedByGvr/index.d.ts +1 -1
  198. package/dist/types/utils/nestedStringsArrayInclude/index.d.ts +1 -1
  199. package/dist/types/utils/normalizeValuesForQuotas/index.d.ts +1 -1
  200. package/dist/types/utils/parseForQuotaValues/index.d.ts +1 -1
  201. package/dist/types/utils/pluralByKind/index.d.ts +1 -1
  202. package/dist/types/utils/prepareTemplate/index.d.ts +1 -1
  203. package/dist/types/utils/prepareUrlsToFetchForDynamicRenderer/index.d.ts +1 -1
  204. package/dist/types/utils/tableLocations/index.d.ts +1 -1
  205. package/package.json +1 -1
  206. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeFormDataProvider/index.d.ts +0 -2
  207. package/dist/types/components/molecules/ManageableBreadcrumbs/ManageableBreadcrumbs.d.ts +0 -17
  208. package/dist/types/components/molecules/ManageableSidebar/ManageableSidebar.d.ts +0 -22
  209. /package/dist/types/components/molecules/ManageableBreadcrumbs/{styled.d.ts → organisms/ManageableBreadcrumbs/styled.d.ts} +0 -0
  210. /package/dist/types/components/molecules/ManageableBreadcrumbs/{types.d.ts → organisms/ManageableBreadcrumbsProvider/types.d.ts} +0 -0
  211. /package/dist/types/components/molecules/ManageableSidebar/{styled.d.ts → organisms/ManageableSidebar/styled.d.ts} +0 -0
  212. /package/dist/types/components/molecules/ManageableSidebar/{types.d.ts → organisms/ManageableSidebarProvider/types.d.ts} +0 -0
  213. /package/dist/types/components/molecules/ManageableSidebar/{utils.d.ts → organisms/ManageableSidebarProvider/utils.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('styled-components'), require('react'), require('antd'), require('@ant-design/icons'), require('@tanstack/react-query'), require('react-router-dom')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'styled-components', 'react', 'antd', '@ant-design/icons', '@tanstack/react-query', 'react-router-dom'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@prorobotech/openapi-k8s-toolkit"] = {}, global.styled, global.React, global.antd, global.antdIcons, global.reactQuery, global.ReactRouterDOM));
5
- })(this, (function (exports, styled, K, antd, icons, reactQuery, reactRouterDom) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('styled-components'), require('react'), require('antd'), require('@ant-design/icons'), require('react-router-dom'), require('@tanstack/react-query')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'styled-components', 'react', 'antd', '@ant-design/icons', 'react-router-dom', '@tanstack/react-query'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@prorobotech/openapi-k8s-toolkit"] = {}, global.styled, global.React, global.antd, global.antdIcons, global.ReactRouterDOM, global.reactQuery));
5
+ })(this, (function (exports, styled, K, antd, icons, reactRouterDom, reactQuery) { 'use strict';
6
6
 
7
7
  const Spacer$1 = styled.div`
8
8
  height: ${({ $space, $spaceMob, $samespace }) => {
@@ -1573,7 +1573,7 @@
1573
1573
  justify-content: center;
1574
1574
  }
1575
1575
  `;
1576
- const Styled$A = {
1576
+ const Styled$C = {
1577
1577
  CustomTreeProvider
1578
1578
  };
1579
1579
 
@@ -1638,7 +1638,7 @@
1638
1638
  });
1639
1639
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1640
1640
  /* @__PURE__ */ jsxRuntimeExports.jsx(Search$1, { style: { marginBottom: 8 }, placeholder: "Search", onChange }),
1641
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$A.CustomTreeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1641
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$C.CustomTreeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1642
1642
  antd.Tree,
1643
1643
  {
1644
1644
  treeData: loop(treeData),
@@ -8167,14 +8167,14 @@
8167
8167
  display: ${({ $displayFlex }) => $displayFlex ? "flex" : "block"};
8168
8168
  flex-flow: ${({ $flexFlow }) => $flexFlow};
8169
8169
  `;
8170
- const Styled$z = {
8170
+ const Styled$B = {
8171
8171
  ContentContainer
8172
8172
  };
8173
8173
 
8174
8174
  const ContentCard$1 = ({ children, flexGrow, displayFlex, flexFlow, maxHeight }) => {
8175
8175
  const { token } = antd.theme.useToken();
8176
8176
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8177
- Styled$z.ContentContainer,
8177
+ Styled$B.ContentContainer,
8178
8178
  {
8179
8179
  $flexGrow: flexGrow,
8180
8180
  $bgColor: token.colorBgContainer,
@@ -8235,13 +8235,13 @@
8235
8235
  padding-inline: 8px;
8236
8236
  }
8237
8237
  `;
8238
- const Styled$y = {
8238
+ const Styled$A = {
8239
8239
  UncontrolledSelect: UncontrolledSelect$1
8240
8240
  };
8241
8241
 
8242
8242
  const UncontrolledSelect = (props) => {
8243
8243
  const { isCursorPointer } = props;
8244
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$y.UncontrolledSelect, { ...props, $isCursorPointer: isCursorPointer });
8244
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$A.UncontrolledSelect, { ...props, $isCursorPointer: isCursorPointer });
8245
8245
  };
8246
8246
 
8247
8247
  const CustomSelect$5 = styled(antd.Select)`
@@ -8289,13 +8289,13 @@
8289
8289
  margin-block: 0 !important;
8290
8290
  }
8291
8291
  `;
8292
- const Styled$x = {
8292
+ const Styled$z = {
8293
8293
  CustomSelect: CustomSelect$5
8294
8294
  };
8295
8295
 
8296
8296
  const CustomSelect$4 = (props) => {
8297
8297
  const { paddingContainerEnd, ...rest } = props;
8298
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$x.CustomSelect, { $paddingContainerEnd: paddingContainerEnd, ...rest });
8298
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$z.CustomSelect, { $paddingContainerEnd: paddingContainerEnd, ...rest });
8299
8299
  };
8300
8300
 
8301
8301
  const CursorPointerTag = styled(antd.Tag)`
@@ -8315,6 +8315,273 @@
8315
8315
  padding: ${({ $padding }) => $padding};
8316
8316
  `;
8317
8317
 
8318
+ const getUppercase = (s) => {
8319
+ const uppercases = [...s].filter((c) => c >= "A" && c <= "Z").join("");
8320
+ return uppercases.length > 0 ? uppercases : s[0].toUpperCase();
8321
+ };
8322
+
8323
+ const fnv1a32 = (str) => {
8324
+ let h = 2166136261;
8325
+ for (const ch of str) {
8326
+ h ^= ch.codePointAt(0);
8327
+ h = (h >>> 0) * 16777619;
8328
+ }
8329
+ return h >>> 0;
8330
+ };
8331
+ const pickInRange = (u32, min, max) => min + u32 % (max - min + 1);
8332
+ const hslFromString = (value, theme) => {
8333
+ const hash = fnv1a32(value);
8334
+ const hue = hash % 345;
8335
+ const [sMin, sMax] = theme === "light" ? [90, 100] : [78, 80];
8336
+ const [lMin, lMax] = theme === "light" ? [78, 80] : [25, 35];
8337
+ const s = pickInRange(hash >>> 8, sMin, sMax);
8338
+ const l = pickInRange(hash >>> 16, lMin, lMax);
8339
+ return `hsl(${hue}, ${s}%, ${l}%)`;
8340
+ };
8341
+
8342
+ const parseApiVersion$1 = (apiVersion) => {
8343
+ const parts = apiVersion.split("/");
8344
+ if (parts.length === 1) {
8345
+ return {
8346
+ apiGroup: void 0,
8347
+ apiVersion: parts[0]
8348
+ };
8349
+ }
8350
+ return {
8351
+ apiGroup: parts[0],
8352
+ apiVersion: parts[1]
8353
+ };
8354
+ };
8355
+ const getFactoryKey = ({
8356
+ apiGroup,
8357
+ apiVersion,
8358
+ resource,
8359
+ namespace,
8360
+ baseFactoriesMapping,
8361
+ baseFactoryNamespacedAPIKey,
8362
+ baseFactoryClusterSceopedAPIKey,
8363
+ baseFactoryNamespacedBuiltinKey,
8364
+ baseFactoryClusterSceopedBuiltinKey
8365
+ }) => {
8366
+ if (namespace) {
8367
+ if (apiGroup) {
8368
+ const forcedMapping3 = baseFactoriesMapping?.[`${baseFactoryNamespacedAPIKey}-${apiGroup}-${apiVersion}-${resource}`];
8369
+ return forcedMapping3 || baseFactoryNamespacedAPIKey || "";
8370
+ }
8371
+ const forcedMapping2 = baseFactoriesMapping?.[`${baseFactoryNamespacedBuiltinKey}-${apiVersion}-${resource}`];
8372
+ return forcedMapping2 || baseFactoryNamespacedBuiltinKey || "";
8373
+ }
8374
+ if (apiGroup) {
8375
+ const forcedMapping2 = baseFactoriesMapping?.[`${baseFactoryClusterSceopedAPIKey}-${apiGroup}-${apiVersion}-${resource}`];
8376
+ return forcedMapping2 || baseFactoryClusterSceopedAPIKey || "";
8377
+ }
8378
+ const forcedMapping = baseFactoriesMapping?.[`${baseFactoryClusterSceopedBuiltinKey}-${apiVersion}-${resource}`];
8379
+ return forcedMapping || baseFactoryClusterSceopedBuiltinKey || "";
8380
+ };
8381
+ const getResourceLink = ({
8382
+ baseprefix,
8383
+ cluster,
8384
+ namespace,
8385
+ apiGroupVersion,
8386
+ pluralName,
8387
+ name,
8388
+ baseFactoryNamespacedAPIKey,
8389
+ baseFactoryClusterSceopedAPIKey,
8390
+ baseFactoryNamespacedBuiltinKey,
8391
+ baseFactoryClusterSceopedBuiltinKey,
8392
+ baseFactoriesMapping
8393
+ }) => {
8394
+ if (!pluralName || !name) {
8395
+ return void 0;
8396
+ }
8397
+ const { apiGroup, apiVersion } = parseApiVersion$1(apiGroupVersion);
8398
+ if (apiGroupVersion === "v1") {
8399
+ return `${baseprefix}/${cluster}${namespace ? `/${namespace}` : ""}/factory/${getFactoryKey({
8400
+ apiGroup,
8401
+ apiVersion,
8402
+ resource: pluralName,
8403
+ namespace,
8404
+ baseFactoriesMapping,
8405
+ baseFactoryNamespacedAPIKey,
8406
+ baseFactoryClusterSceopedAPIKey,
8407
+ baseFactoryNamespacedBuiltinKey,
8408
+ baseFactoryClusterSceopedBuiltinKey
8409
+ })}/${apiGroupVersion}/${pluralName}/${name}`;
8410
+ }
8411
+ return `${baseprefix}/${cluster}${namespace ? `/${namespace}` : ""}/factory/${getFactoryKey({
8412
+ apiGroup,
8413
+ apiVersion,
8414
+ resource: pluralName,
8415
+ namespace,
8416
+ baseFactoriesMapping,
8417
+ baseFactoryNamespacedAPIKey,
8418
+ baseFactoryClusterSceopedAPIKey,
8419
+ baseFactoryNamespacedBuiltinKey,
8420
+ baseFactoryClusterSceopedBuiltinKey
8421
+ })}/${apiGroupVersion}/${pluralName}/${name}`;
8422
+ };
8423
+ const getNamespaceLink = ({
8424
+ baseprefix,
8425
+ cluster,
8426
+ apiGroupVersion,
8427
+ pluralName,
8428
+ namespace,
8429
+ baseNamespaceFactoryKey
8430
+ }) => {
8431
+ if (!namespace) {
8432
+ return void 0;
8433
+ }
8434
+ return `${baseprefix}/${cluster}/factory/${baseNamespaceFactoryKey}/${apiGroupVersion}/${pluralName}/${namespace}`;
8435
+ };
8436
+
8437
+ const Abbr$2 = styled.span`
8438
+ background-color: ${({ $bgColor }) => $bgColor};
8439
+ border-radius: 13px;
8440
+ padding: 1px 5px;
8441
+ font-size: 13px;
8442
+ height: min-content;
8443
+ margin-right: 4px;
8444
+ `;
8445
+ const Styled$y = {
8446
+ Abbr: Abbr$2
8447
+ };
8448
+
8449
+ const ResourceLink = ({
8450
+ kind,
8451
+ apiVersion,
8452
+ namespace,
8453
+ name,
8454
+ forcedName,
8455
+ theme,
8456
+ baseprefix,
8457
+ cluster,
8458
+ getPlural,
8459
+ baseFactoryNamespacedAPIKey,
8460
+ baseFactoryClusterSceopedAPIKey,
8461
+ baseFactoryNamespacedBuiltinKey,
8462
+ baseFactoryClusterSceopedBuiltinKey,
8463
+ baseFactoriesMapping
8464
+ }) => {
8465
+ const navigate = reactRouterDom.useNavigate();
8466
+ const abbr = kind ? getUppercase(kind) : void 0;
8467
+ const bgColor = kind && abbr ? hslFromString(kind, theme) : "initial";
8468
+ const parsedKind = kind;
8469
+ const parsedApiVersion = apiVersion;
8470
+ const pluralName = parsedKind && parsedApiVersion ? getPlural?.(parsedKind, parsedApiVersion) : void 0;
8471
+ const resourceLink = getResourceLink({
8472
+ baseprefix,
8473
+ cluster,
8474
+ namespace,
8475
+ apiGroupVersion: parsedApiVersion,
8476
+ pluralName,
8477
+ name,
8478
+ baseFactoryNamespacedAPIKey,
8479
+ baseFactoryClusterSceopedAPIKey,
8480
+ baseFactoryNamespacedBuiltinKey,
8481
+ baseFactoryClusterSceopedBuiltinKey,
8482
+ baseFactoriesMapping
8483
+ });
8484
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 8, children: [
8485
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$y.Abbr, { $bgColor: bgColor, children: abbr }),
8486
+ resourceLink ? /* @__PURE__ */ jsxRuntimeExports.jsx(
8487
+ antd.Typography.Link,
8488
+ {
8489
+ onClick: (e) => {
8490
+ e.preventDefault();
8491
+ navigate(resourceLink);
8492
+ },
8493
+ children: forcedName || name
8494
+ }
8495
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { children: forcedName || name })
8496
+ ] });
8497
+ };
8498
+
8499
+ const PositionRelativeContainer = styled.div`
8500
+ position: relative;
8501
+ `;
8502
+ const FullWidthContainer = styled.div`
8503
+ width: 100%;
8504
+
8505
+ .ant-dropdown-trigger svg {
8506
+ display: none;
8507
+ }
8508
+ `;
8509
+ const NoWrapContainer = styled.div`
8510
+ position: absolute;
8511
+ visibility: hidden;
8512
+ pointer-events: none;
8513
+
8514
+ /* stylelint-disable declaration-no-important */
8515
+
8516
+ * {
8517
+ white-space: nowrap !important;
8518
+ }
8519
+
8520
+ ol {
8521
+ flex-wrap: nowrap !important;
8522
+ }
8523
+ `;
8524
+ const Styled$x = {
8525
+ PositionRelativeContainer,
8526
+ FullWidthContainer,
8527
+ NoWrapContainer
8528
+ };
8529
+
8530
+ const CollapsibleBreadcrumb = ({ items }) => {
8531
+ const [isCollapsed, setIsCollapsed] = K.useState(false);
8532
+ const containerRef = K.useRef(null);
8533
+ const breadcrumbRef = K.useRef(null);
8534
+ K.useLayoutEffect(() => {
8535
+ const checkWidth = () => {
8536
+ if (containerRef.current && breadcrumbRef.current) {
8537
+ const containerWidth = containerRef.current.clientWidth;
8538
+ const breadcrumbWidth = breadcrumbRef.current.scrollWidth;
8539
+ setIsCollapsed(breadcrumbWidth > containerWidth);
8540
+ }
8541
+ };
8542
+ checkWidth();
8543
+ window.addEventListener("resize", checkWidth);
8544
+ return () => window.removeEventListener("resize", checkWidth);
8545
+ }, [items]);
8546
+ const renderItems = () => {
8547
+ if (!isCollapsed) {
8548
+ return items;
8549
+ }
8550
+ if (items.length <= 2) {
8551
+ return items;
8552
+ }
8553
+ const firstItem = items[0];
8554
+ const lastItem = items[items.length - 1];
8555
+ const hiddenItems = items.slice(1, -1);
8556
+ const menuItems = hiddenItems.map((item, index) => ({
8557
+ key: String(index),
8558
+ label: item.href ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: item.href, children: item.title }) : item.title
8559
+ }));
8560
+ const ellipsisItem = {
8561
+ title: "...",
8562
+ menu: { items: menuItems },
8563
+ dropdownProps: { arrow: false }
8564
+ };
8565
+ return [firstItem, ellipsisItem, lastItem];
8566
+ };
8567
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$x.PositionRelativeContainer, { children: [
8568
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$x.FullWidthContainer, { ref: containerRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Breadcrumb, { separator: ">", items: renderItems() }) }),
8569
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$x.NoWrapContainer, { ref: breadcrumbRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Breadcrumb, { separator: ">", items, style: { display: "flex", flexWrap: "nowrap" } }) })
8570
+ ] });
8571
+ };
8572
+
8573
+ const HeightDiv$1 = styled.div`
8574
+ min-height: 22px;
8575
+ width: 100%;
8576
+ `;
8577
+ const Styled$w = {
8578
+ HeightDiv: HeightDiv$1
8579
+ };
8580
+
8581
+ const ManageableBreadcrumbs = ({ data }) => {
8582
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$w.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
8583
+ };
8584
+
8318
8585
  const getDirectUnknownResource = async ({ uri }) => {
8319
8586
  return axios.get(uri);
8320
8587
  };
@@ -8342,6 +8609,666 @@
8342
8609
  });
8343
8610
  };
8344
8611
 
8612
+ const useK8sVerbs = ({
8613
+ cluster,
8614
+ group,
8615
+ version,
8616
+ plural,
8617
+ isEnabled = true
8618
+ }) => {
8619
+ const uri = `/api/clusters/${cluster}/openapi-bff/verbs/getResourceVerbs?${new URLSearchParams({
8620
+ ...group ? { group } : {},
8621
+ version,
8622
+ plural
8623
+ }).toString()}`;
8624
+ const { data, isError, isLoading, error } = useDirectUnknownResource({
8625
+ uri,
8626
+ queryKey: ["k8s-verbs", cluster, group || "", version, plural],
8627
+ refetchInterval: false,
8628
+ isEnabled: Boolean(isEnabled && cluster && version && plural)
8629
+ });
8630
+ const verbs = data?.verbs || [];
8631
+ const canList = verbs.includes("list");
8632
+ const canWatch = verbs.includes("watch");
8633
+ return {
8634
+ canList,
8635
+ canWatch,
8636
+ isError,
8637
+ isLoading,
8638
+ error
8639
+ };
8640
+ };
8641
+
8642
+ const eventKey$1 = (e) => e.metadata?.uid ?? `${e.metadata?.namespace ?? ""}/${e.metadata?.name ?? ""}`;
8643
+ const compareRV$1 = (a, b) => {
8644
+ if (a.length !== b.length) return a.length > b.length ? 1 : -1;
8645
+ return a > b ? 1 : a < b ? -1 : 0;
8646
+ };
8647
+ const getRV$1 = (item) => item?.metadata?.resourceVersion;
8648
+
8649
+ const reducer$1 = (state, action) => {
8650
+ switch (action.type) {
8651
+ case "RESET": {
8652
+ const order = action.items.map(eventKey$1);
8653
+ const byKey = {};
8654
+ action.items.forEach((it) => byKey[eventKey$1(it)] = it);
8655
+ return { order, byKey };
8656
+ }
8657
+ case "APPEND_PAGE": {
8658
+ const next = { ...state.byKey };
8659
+ const addKeys = [];
8660
+ action.items.forEach((it) => {
8661
+ const k = eventKey$1(it);
8662
+ if (!next[k]) addKeys.push(k);
8663
+ next[k] = it;
8664
+ });
8665
+ return { order: [...state.order, ...addKeys], byKey: next };
8666
+ }
8667
+ case "UPSERT": {
8668
+ const k = eventKey$1(action.item);
8669
+ const exists = Boolean(state.byKey[k]);
8670
+ const byKey = { ...state.byKey, [k]: action.item };
8671
+ const order = exists ? state.order : [k, ...state.order];
8672
+ return { order, byKey };
8673
+ }
8674
+ case "REMOVE": {
8675
+ if (!state.byKey[action.key]) return state;
8676
+ const byKey = { ...state.byKey };
8677
+ delete byKey[action.key];
8678
+ return { order: state.order.filter((k) => k !== action.key), byKey };
8679
+ }
8680
+ default:
8681
+ return state;
8682
+ }
8683
+ };
8684
+
8685
+ const isRecord = (v) => typeof v === "object" && v !== null;
8686
+ const readString = (obj, key) => {
8687
+ const val = obj[key];
8688
+ return typeof val === "string" ? val : void 0;
8689
+ };
8690
+ const itemRV = (it) => {
8691
+ const fromUtil = getRV$1(it);
8692
+ if (fromUtil) return fromUtil;
8693
+ if (!isRecord(it)) return void 0;
8694
+ const rvTop = readString(it, "resourceVersion");
8695
+ const mdRaw = isRecord(it["metadata"]) ? it["metadata"] : void 0;
8696
+ const rvMeta = mdRaw ? readString(mdRaw, "resourceVersion") : void 0;
8697
+ return rvTop ?? rvMeta;
8698
+ };
8699
+ const getMaxRV$1 = (items) => (items ?? []).reduce((max, it) => {
8700
+ const rv = itemRV(it);
8701
+ return rv && (!max || compareRV$1(rv, max) > 0) ? rv : max;
8702
+ }, void 0);
8703
+ const makeResId = (q) => `${q.apiGroup ?? ""}|${q.apiVersion}|${q.plural}|${q.namespace ?? ""}|${q.fieldSelector ?? ""}|${q.labelSelector ?? ""}`;
8704
+ const useListWatch = ({
8705
+ wsUrl,
8706
+ pageSize,
8707
+ paused = false,
8708
+ ignoreRemove = false,
8709
+ onStatus,
8710
+ onError,
8711
+ autoDrain = false,
8712
+ preserveStateOnUrlChange = true,
8713
+ isEnabled = true,
8714
+ // NEW default: socket gated by this flag
8715
+ query
8716
+ }) => {
8717
+ const resId = `${query.apiGroup ?? ""}|${query.apiVersion}|${query.plural}|${query.namespace ?? ""}|${query.fieldSelector ?? ""}|${query.labelSelector ?? ""}`;
8718
+ const resIdRef = K.useRef(resId);
8719
+ const [state, dispatch] = K.useReducer(reducer$1, { order: [], byKey: {} });
8720
+ const [contToken, setContToken] = K.useState();
8721
+ const [hasMore, setHasMore] = K.useState(false);
8722
+ const [status, setStatus] = K.useState(isEnabled ? "connecting" : "closed");
8723
+ const [lastError, setLastError] = K.useState(void 0);
8724
+ const [isPaused, setIsPaused] = K.useState(paused);
8725
+ const [isRemoveIgnored, setIsRemoveIgnored] = K.useState(ignoreRemove);
8726
+ const [hasInitial, setHasInitial] = K.useState(false);
8727
+ const queryRef = K.useRef(query);
8728
+ const wsRef = K.useRef(null);
8729
+ const connectingRef = K.useRef(false);
8730
+ const mountedRef = K.useRef(true);
8731
+ const startedRef = K.useRef(false);
8732
+ const reconnectTimerRef = K.useRef(null);
8733
+ const backoffRef = K.useRef(750);
8734
+ const urlRef = K.useRef(wsUrl);
8735
+ const onMessageRef = K.useRef(() => {
8736
+ });
8737
+ const connectRef = K.useRef(() => {
8738
+ });
8739
+ const fetchingRef = K.useRef(false);
8740
+ const anchorRVRef = K.useRef(void 0);
8741
+ const haveAnchorRef = K.useRef(false);
8742
+ const enabledRef = K.useRef(isEnabled);
8743
+ const intentionalCloseRef = K.useRef(false);
8744
+ const suppressErrorsRef = K.useRef(false);
8745
+ const pausedRef = K.useRef(isPaused);
8746
+ const ignoreRemoveRef = K.useRef(isRemoveIgnored);
8747
+ K.useEffect(() => {
8748
+ pausedRef.current = isPaused;
8749
+ }, [isPaused]);
8750
+ K.useEffect(() => {
8751
+ ignoreRemoveRef.current = isRemoveIgnored;
8752
+ }, [isRemoveIgnored]);
8753
+ K.useEffect(() => {
8754
+ enabledRef.current = isEnabled;
8755
+ }, [isEnabled]);
8756
+ const clearErrorSafe = K.useCallback(() => {
8757
+ setLastError(void 0);
8758
+ }, []);
8759
+ const setStatusSafe = K.useCallback(
8760
+ (s) => {
8761
+ setStatus(s);
8762
+ onStatus?.(s);
8763
+ },
8764
+ [onStatus]
8765
+ );
8766
+ const setErrorSafe = K.useCallback(
8767
+ (msg) => {
8768
+ setLastError(msg);
8769
+ if (msg) onError?.(msg);
8770
+ },
8771
+ [onError]
8772
+ );
8773
+ const applyParam = (sp, key, v) => {
8774
+ if (v === void 0 || v === null || v === "") {
8775
+ sp.delete(key);
8776
+ return;
8777
+ }
8778
+ sp.set(key, String(v));
8779
+ };
8780
+ const buildWsUrl = K.useCallback((raw) => {
8781
+ let u;
8782
+ const base = window.location.origin;
8783
+ try {
8784
+ const hasScheme = /^[a-z]+:/i.test(raw);
8785
+ u = hasScheme ? new URL(raw) : new URL(raw.startsWith("/") ? raw : `/${raw}`, base);
8786
+ if (u.protocol === "http:") u.protocol = "ws:";
8787
+ if (u.protocol === "https:") u.protocol = "wss:";
8788
+ if (u.protocol !== "ws:" && u.protocol !== "wss:") {
8789
+ u = new URL(u.pathname + u.search + u.hash, base);
8790
+ u.protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
8791
+ }
8792
+ } catch {
8793
+ const origin = window.location.origin.replace(/^http/, "ws");
8794
+ u = new URL(raw.startsWith("/") ? raw : `/${raw}`, origin);
8795
+ }
8796
+ const q = queryRef.current;
8797
+ applyParam(u.searchParams, "namespace", q.namespace);
8798
+ applyParam(u.searchParams, "limit", q.initialLimit);
8799
+ applyParam(u.searchParams, "_continue", q.initialContinue);
8800
+ applyParam(u.searchParams, "apiGroup", q.apiGroup);
8801
+ applyParam(u.searchParams, "apiVersion", q.apiVersion);
8802
+ applyParam(u.searchParams, "plural", q.plural);
8803
+ applyParam(u.searchParams, "fieldSelector", q.fieldSelector);
8804
+ applyParam(u.searchParams, "labelSelector", q.labelSelector);
8805
+ if (haveAnchorRef.current && anchorRVRef.current) {
8806
+ u.searchParams.set("sinceRV", anchorRVRef.current);
8807
+ } else {
8808
+ u.searchParams.delete("sinceRV");
8809
+ }
8810
+ return u.toString();
8811
+ }, []);
8812
+ const closeWS = K.useCallback(() => {
8813
+ try {
8814
+ wsRef.current?.close();
8815
+ } catch {
8816
+ }
8817
+ wsRef.current = null;
8818
+ }, []);
8819
+ const scheduleReconnect = K.useCallback(() => {
8820
+ if (intentionalCloseRef.current) {
8821
+ intentionalCloseRef.current = false;
8822
+ return;
8823
+ }
8824
+ if (!enabledRef.current) {
8825
+ setStatusSafe("closed");
8826
+ connectingRef.current = false;
8827
+ return;
8828
+ }
8829
+ setStatusSafe("closed");
8830
+ connectingRef.current = false;
8831
+ const baseDelay = Math.min(backoffRef.current, 8e3);
8832
+ const jitter = Math.random() * 0.4 + 0.8;
8833
+ const wait = Math.floor(baseDelay * jitter);
8834
+ const next = Math.min(baseDelay * 2, 12e3);
8835
+ backoffRef.current = next;
8836
+ if (reconnectTimerRef.current) {
8837
+ window.clearTimeout(reconnectTimerRef.current);
8838
+ reconnectTimerRef.current = null;
8839
+ }
8840
+ reconnectTimerRef.current = window.setTimeout(() => {
8841
+ if (!mountedRef.current || !enabledRef.current) return;
8842
+ connectRef.current();
8843
+ }, wait);
8844
+ }, [setStatusSafe]);
8845
+ const connect = K.useCallback(() => {
8846
+ if (!mountedRef.current) return;
8847
+ if (!enabledRef.current) {
8848
+ setStatusSafe("closed");
8849
+ return;
8850
+ }
8851
+ if (connectingRef.current) return;
8852
+ if (wsRef.current && (wsRef.current.readyState === WebSocket.OPEN || wsRef.current.readyState === WebSocket.CONNECTING)) {
8853
+ return;
8854
+ }
8855
+ connectingRef.current = true;
8856
+ setStatusSafe("connecting");
8857
+ setErrorSafe(void 0);
8858
+ const url = buildWsUrl(urlRef.current);
8859
+ console.debug("[useListWatch] connecting to", url);
8860
+ const ws = new WebSocket(url);
8861
+ wsRef.current = ws;
8862
+ ws.addEventListener("open", () => {
8863
+ if (!mountedRef.current || !enabledRef.current) return;
8864
+ backoffRef.current = 750;
8865
+ fetchingRef.current = false;
8866
+ setStatusSafe("open");
8867
+ connectingRef.current = false;
8868
+ suppressErrorsRef.current = false;
8869
+ });
8870
+ ws.addEventListener("message", (ev) => onMessageRef.current(ev));
8871
+ ws.addEventListener("close", scheduleReconnect);
8872
+ ws.addEventListener("error", () => {
8873
+ if (intentionalCloseRef.current || suppressErrorsRef.current) return;
8874
+ setErrorSafe("WebSocket error");
8875
+ });
8876
+ }, [buildWsUrl, scheduleReconnect, setErrorSafe, setStatusSafe]);
8877
+ K.useEffect(() => {
8878
+ connectRef.current = connect;
8879
+ }, [connect]);
8880
+ const reconnect = K.useCallback(() => {
8881
+ if (!enabledRef.current) {
8882
+ closeWS();
8883
+ setStatusSafe("closed");
8884
+ return;
8885
+ }
8886
+ if (reconnectTimerRef.current) {
8887
+ window.clearTimeout(reconnectTimerRef.current);
8888
+ reconnectTimerRef.current = null;
8889
+ }
8890
+ intentionalCloseRef.current = true;
8891
+ try {
8892
+ wsRef.current?.close();
8893
+ } catch {
8894
+ }
8895
+ wsRef.current = null;
8896
+ connect();
8897
+ }, [closeWS, connect, setStatusSafe]);
8898
+ const setUrl = K.useCallback(
8899
+ (next) => {
8900
+ const changed = next !== urlRef.current;
8901
+ urlRef.current = next;
8902
+ if (changed) {
8903
+ clearErrorSafe();
8904
+ suppressErrorsRef.current = true;
8905
+ if (!preserveStateOnUrlChange) {
8906
+ dispatch({ type: "RESET", items: [] });
8907
+ setContToken(void 0);
8908
+ setHasMore(false);
8909
+ anchorRVRef.current = void 0;
8910
+ haveAnchorRef.current = false;
8911
+ setHasInitial(false);
8912
+ }
8913
+ if (enabledRef.current) reconnect();
8914
+ }
8915
+ },
8916
+ [preserveStateOnUrlChange, reconnect, clearErrorSafe]
8917
+ );
8918
+ const setQuery = K.useCallback(
8919
+ (q) => {
8920
+ clearErrorSafe();
8921
+ suppressErrorsRef.current = true;
8922
+ const prev = queryRef.current;
8923
+ const prevId = makeResId(prev);
8924
+ const nextId = makeResId(q);
8925
+ queryRef.current = q;
8926
+ if (!preserveStateOnUrlChange) {
8927
+ dispatch({ type: "RESET", items: [] });
8928
+ setContToken(void 0);
8929
+ setHasMore(false);
8930
+ setHasInitial(false);
8931
+ }
8932
+ if (prevId !== nextId) {
8933
+ anchorRVRef.current = void 0;
8934
+ haveAnchorRef.current = false;
8935
+ }
8936
+ if (enabledRef.current && prevId !== nextId) {
8937
+ reconnect();
8938
+ }
8939
+ },
8940
+ [clearErrorSafe, preserveStateOnUrlChange, reconnect]
8941
+ );
8942
+ const total = state.order.length;
8943
+ const continueToken = contToken;
8944
+ K.useEffect(() => {
8945
+ onMessageRef.current = (ev) => {
8946
+ let frame;
8947
+ try {
8948
+ frame = JSON.parse(String(ev.data));
8949
+ } catch {
8950
+ return;
8951
+ }
8952
+ if (!frame) return;
8953
+ if (frame.type === "SERVER_LOG") {
8954
+ const level = frame.level || "info";
8955
+ const msg = frame.message;
8956
+ (console[level] || console.log).call(console, "[useListWatch][server]", msg);
8957
+ return;
8958
+ }
8959
+ if (frame.type === "INITIAL_ERROR") {
8960
+ const msg = frame.message;
8961
+ setErrorSafe(msg);
8962
+ return;
8963
+ }
8964
+ if (frame.type === "INITIAL") {
8965
+ dispatch({ type: "RESET", items: frame.items });
8966
+ setContToken(frame.continue);
8967
+ setHasMore(Boolean(frame.continue));
8968
+ setErrorSafe(void 0);
8969
+ fetchingRef.current = false;
8970
+ suppressErrorsRef.current = false;
8971
+ const snapshotRV = frame.resourceVersion || getMaxRV$1(frame.items);
8972
+ if (snapshotRV) {
8973
+ anchorRVRef.current = snapshotRV;
8974
+ haveAnchorRef.current = true;
8975
+ }
8976
+ setHasInitial(true);
8977
+ return;
8978
+ }
8979
+ if (frame.type === "PAGE") {
8980
+ dispatch({ type: "APPEND_PAGE", items: frame.items });
8981
+ setContToken(frame.continue);
8982
+ setHasMore(Boolean(frame.continue));
8983
+ fetchingRef.current = false;
8984
+ const batchRV = getMaxRV$1(frame.items);
8985
+ if (batchRV && (!anchorRVRef.current || compareRV$1(batchRV, anchorRVRef.current) > 0)) {
8986
+ anchorRVRef.current = batchRV;
8987
+ }
8988
+ return;
8989
+ }
8990
+ if (frame.type === "PAGE_ERROR") {
8991
+ setErrorSafe(frame.error || "Failed to load next page");
8992
+ fetchingRef.current = false;
8993
+ return;
8994
+ }
8995
+ if (frame.type === "ADDED" || frame.type === "MODIFIED" || frame.type === "DELETED") {
8996
+ const rv = itemRV(frame.item);
8997
+ if (rv && (!anchorRVRef.current || compareRV$1(rv, anchorRVRef.current) > 0)) {
8998
+ anchorRVRef.current = rv;
8999
+ }
9000
+ }
9001
+ if (!pausedRef.current) {
9002
+ if (frame.type === "ADDED" || frame.type === "MODIFIED") {
9003
+ dispatch({ type: "UPSERT", item: frame.item });
9004
+ }
9005
+ if (!ignoreRemoveRef.current && frame.type === "DELETED") {
9006
+ dispatch({ type: "REMOVE", key: eventKey$1(frame.item) });
9007
+ }
9008
+ }
9009
+ };
9010
+ }, [setErrorSafe]);
9011
+ K.useEffect(() => {
9012
+ if (startedRef.current) return void 0;
9013
+ startedRef.current = true;
9014
+ mountedRef.current = true;
9015
+ if (isEnabled) {
9016
+ connect();
9017
+ } else {
9018
+ setStatusSafe("closed");
9019
+ }
9020
+ return () => {
9021
+ mountedRef.current = false;
9022
+ startedRef.current = false;
9023
+ if (reconnectTimerRef.current) {
9024
+ window.clearTimeout(reconnectTimerRef.current);
9025
+ reconnectTimerRef.current = null;
9026
+ }
9027
+ closeWS();
9028
+ wsRef.current = null;
9029
+ connectingRef.current = false;
9030
+ };
9031
+ }, []);
9032
+ K.useEffect(() => {
9033
+ if (wsUrl !== urlRef.current) setUrl(wsUrl);
9034
+ }, [wsUrl, setUrl]);
9035
+ K.useEffect(() => {
9036
+ if (!mountedRef.current) return;
9037
+ if (isEnabled) {
9038
+ connect();
9039
+ } else {
9040
+ if (reconnectTimerRef.current) {
9041
+ window.clearTimeout(reconnectTimerRef.current);
9042
+ reconnectTimerRef.current = null;
9043
+ }
9044
+ closeWS();
9045
+ setStatusSafe("closed");
9046
+ }
9047
+ }, [isEnabled, closeWS, connect, setStatusSafe]);
9048
+ K.useEffect(() => {
9049
+ if (resIdRef.current !== resId) {
9050
+ clearErrorSafe();
9051
+ suppressErrorsRef.current = true;
9052
+ anchorRVRef.current = void 0;
9053
+ haveAnchorRef.current = false;
9054
+ setHasInitial(false);
9055
+ resIdRef.current = resId;
9056
+ queryRef.current = query;
9057
+ if (enabledRef.current) reconnect();
9058
+ }
9059
+ }, [resId, query, reconnect, clearErrorSafe]);
9060
+ const pageSizeRef = K.useRef(pageSize);
9061
+ K.useEffect(() => {
9062
+ pageSizeRef.current = pageSize;
9063
+ }, [pageSize]);
9064
+ const sendScroll = K.useCallback(() => {
9065
+ if (!enabledRef.current) return;
9066
+ const token = contToken;
9067
+ if (!wsRef.current || wsRef.current.readyState !== WebSocket.OPEN) return;
9068
+ if (!token || fetchingRef.current) return;
9069
+ fetchingRef.current = true;
9070
+ const msg = { type: "SCROLL", continue: token, limit: pageSizeRef.current };
9071
+ wsRef.current.send(JSON.stringify(msg));
9072
+ }, [contToken]);
9073
+ const drainAll = K.useCallback(
9074
+ async (opts) => {
9075
+ if (!enabledRef.current) return 0;
9076
+ const maxPages = opts?.maxPages ?? 999;
9077
+ const maxItems = opts?.maxItems ?? Number.POSITIVE_INFINITY;
9078
+ let pages = 0;
9079
+ let added = 0;
9080
+ const awaitOnce = () => new Promise((resolve) => {
9081
+ const handler = (ev) => {
9082
+ try {
9083
+ const f = JSON.parse(String(ev.data));
9084
+ if (f.type === "PAGE") {
9085
+ const newCount = (f.items || []).reduce((acc, it) => {
9086
+ const k = eventKey$1(it);
9087
+ return state.byKey[k] ? acc : acc + 1;
9088
+ }, 0);
9089
+ added += newCount;
9090
+ const ws2 = wsRef.current;
9091
+ if (!ws2) {
9092
+ resolve("STOP");
9093
+ return;
9094
+ }
9095
+ resolve("PAGE");
9096
+ }
9097
+ } catch {
9098
+ }
9099
+ };
9100
+ const ws = wsRef.current;
9101
+ if (!ws) {
9102
+ resolve("STOP");
9103
+ return;
9104
+ }
9105
+ const stopCheck = () => {
9106
+ if (!hasMore || !contToken) {
9107
+ resolve("STOP");
9108
+ }
9109
+ };
9110
+ ws.addEventListener("message", handler, { once: true });
9111
+ setTimeout(stopCheck, 0);
9112
+ });
9113
+ while (pages < maxPages && hasMore && contToken && wsRef.current?.readyState === WebSocket.OPEN) {
9114
+ if (added >= maxItems) break;
9115
+ if (!fetchingRef.current) sendScroll();
9116
+ const r = await awaitOnce();
9117
+ if (r === "STOP") break;
9118
+ pages += 1;
9119
+ }
9120
+ return added;
9121
+ },
9122
+ [contToken, hasMore, sendScroll, state.byKey]
9123
+ );
9124
+ K.useEffect(() => {
9125
+ if (!autoDrain) return;
9126
+ if (!enabledRef.current) return;
9127
+ if (status === "open" && haveAnchorRef.current) {
9128
+ drainAll().catch(() => {
9129
+ });
9130
+ }
9131
+ }, [autoDrain, drainAll, status]);
9132
+ return {
9133
+ state,
9134
+ total,
9135
+ hasMore,
9136
+ continueToken,
9137
+ status,
9138
+ lastError,
9139
+ hasInitial,
9140
+ setPaused: setIsPaused,
9141
+ setIgnoreRemove: setIsRemoveIgnored,
9142
+ sendScroll,
9143
+ drainAll,
9144
+ reconnect,
9145
+ setUrl,
9146
+ setQuery
9147
+ };
9148
+ };
9149
+
9150
+ const buildApiPrefix = (group, version) => {
9151
+ const g = (group ?? "").trim();
9152
+ const v = (version ?? "").trim();
9153
+ const isCore = !g || g === "core" || g === "v1";
9154
+ return isCore ? `/api/${v}` : `/apis/${g}/${v}`;
9155
+ };
9156
+ const buildListUri = ({
9157
+ cluster,
9158
+ group,
9159
+ version,
9160
+ plural,
9161
+ namespace,
9162
+ fieldSelector,
9163
+ labelSelector,
9164
+ limit
9165
+ }) => {
9166
+ const prefix = buildApiPrefix(group, version);
9167
+ const ns = namespace ? `/namespaces/${namespace}` : "";
9168
+ const base = `/api/clusters/${cluster}/k8s${prefix}${ns}/${plural}/`;
9169
+ const params = new URLSearchParams();
9170
+ if (fieldSelector) params.append("fieldSelector", fieldSelector);
9171
+ if (labelSelector) params.append("labelSelector", labelSelector);
9172
+ if (limit) params.append("limit", String(limit));
9173
+ return params.toString() ? `${base}?${params.toString()}` : base;
9174
+ };
9175
+ const useK8sSmartResource = ({
9176
+ cluster,
9177
+ group,
9178
+ version,
9179
+ plural,
9180
+ namespace,
9181
+ fieldSelector,
9182
+ labelSelector,
9183
+ isEnabled = true,
9184
+ listRefetchInterval = 5e3,
9185
+ limit,
9186
+ mapListWatchState
9187
+ }) => {
9188
+ const {
9189
+ canList,
9190
+ canWatch,
9191
+ isLoading: verbsLoading,
9192
+ isError: verbsIsError,
9193
+ error: verbsErrorObj
9194
+ } = useK8sVerbs({
9195
+ cluster,
9196
+ group,
9197
+ version,
9198
+ plural,
9199
+ isEnabled: Boolean(isEnabled && cluster && cluster.length > 0)
9200
+ });
9201
+ const listUri = buildListUri({
9202
+ cluster,
9203
+ group,
9204
+ version,
9205
+ plural,
9206
+ namespace,
9207
+ fieldSelector,
9208
+ labelSelector,
9209
+ limit
9210
+ });
9211
+ const restEnabled = Boolean(
9212
+ cluster && cluster.length > 0 && isEnabled && canList && !canWatch && !verbsLoading && !verbsIsError
9213
+ );
9214
+ const {
9215
+ data: restData,
9216
+ isLoading: restLoading,
9217
+ isError: restIsError,
9218
+ error: restError
9219
+ } = useDirectUnknownResource({
9220
+ uri: listUri,
9221
+ queryKey: [
9222
+ "k8s-list",
9223
+ cluster,
9224
+ group || "",
9225
+ version,
9226
+ namespace || "",
9227
+ plural,
9228
+ fieldSelector || "",
9229
+ labelSelector || ""
9230
+ ],
9231
+ refetchInterval: listRefetchInterval,
9232
+ isEnabled: restEnabled
9233
+ });
9234
+ const watchEnabled = Boolean(
9235
+ cluster && cluster.length > 0 && isEnabled && canList && canWatch && !verbsLoading && !verbsIsError
9236
+ );
9237
+ const { state, status, hasInitial, lastError } = useListWatch({
9238
+ wsUrl: `/api/clusters/${cluster}/openapi-bff-ws/listThenWatch/listWatchWs`,
9239
+ paused: false,
9240
+ ignoreRemove: false,
9241
+ autoDrain: true,
9242
+ preserveStateOnUrlChange: true,
9243
+ isEnabled: watchEnabled,
9244
+ pageSize: limit,
9245
+ query: {
9246
+ apiGroup: group,
9247
+ apiVersion: version,
9248
+ plural,
9249
+ namespace,
9250
+ fieldSelector,
9251
+ labelSelector
9252
+ }
9253
+ });
9254
+ const defaultMap = (s) => ({ items: s.order.map((k) => s.byKey[k]) });
9255
+ const watchData = K.useMemo(
9256
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9257
+ () => watchEnabled ? (mapListWatchState ?? defaultMap)(state) : void 0,
9258
+ // eslint-disable-next-line react-hooks/exhaustive-deps
9259
+ [watchEnabled, state, mapListWatchState]
9260
+ );
9261
+ const used = !isEnabled ? "disabled" : verbsLoading ? "verbs-loading" : verbsIsError ? "verbs-error" : watchEnabled ? "watch" : restEnabled ? "list" : "disabled";
9262
+ const isLoading = isEnabled && verbsLoading || used === "watch" && status === "connecting" || used === "watch" && status === "open" && !hasInitial || used === "list" && restLoading;
9263
+ let error;
9264
+ if (verbsIsError) error = verbsErrorObj;
9265
+ else if (used === "watch" && status === "closed" && lastError) error = lastError;
9266
+ else if (used === "list" && restIsError) error = restError;
9267
+ const isError = Boolean(error);
9268
+ const data = used === "watch" ? watchData : used === "list" ? restData : void 0;
9269
+ return { data, isLoading, isError, error, _meta: { used } };
9270
+ };
9271
+
8345
9272
  const prepareTemplate = ({
8346
9273
  template,
8347
9274
  replaceValues
@@ -8380,7 +9307,7 @@
8380
9307
  replaceValues,
8381
9308
  idToCompare
8382
9309
  }) => {
8383
- const foundData = data.find((el) => el.id === idToCompare);
9310
+ const foundData = data.find((el) => el?.id === idToCompare);
8384
9311
  if (!foundData) {
8385
9312
  return void 0;
8386
9313
  }
@@ -8393,80 +9320,6 @@
8393
9320
  return result;
8394
9321
  };
8395
9322
 
8396
- const PositionRelativeContainer = styled.div`
8397
- position: relative;
8398
- `;
8399
- const FullWidthContainer = styled.div`
8400
- width: 100%;
8401
-
8402
- .ant-dropdown-trigger svg {
8403
- display: none;
8404
- }
8405
- `;
8406
- const NoWrapContainer = styled.div`
8407
- position: absolute;
8408
- visibility: hidden;
8409
- pointer-events: none;
8410
-
8411
- /* stylelint-disable declaration-no-important */
8412
-
8413
- * {
8414
- white-space: nowrap !important;
8415
- }
8416
-
8417
- ol {
8418
- flex-wrap: nowrap !important;
8419
- }
8420
- `;
8421
- const Styled$w = {
8422
- PositionRelativeContainer,
8423
- FullWidthContainer,
8424
- NoWrapContainer
8425
- };
8426
-
8427
- const CollapsibleBreadcrumb = ({ items }) => {
8428
- const [isCollapsed, setIsCollapsed] = K.useState(false);
8429
- const containerRef = K.useRef(null);
8430
- const breadcrumbRef = K.useRef(null);
8431
- K.useLayoutEffect(() => {
8432
- const checkWidth = () => {
8433
- if (containerRef.current && breadcrumbRef.current) {
8434
- const containerWidth = containerRef.current.clientWidth;
8435
- const breadcrumbWidth = breadcrumbRef.current.scrollWidth;
8436
- setIsCollapsed(breadcrumbWidth > containerWidth);
8437
- }
8438
- };
8439
- checkWidth();
8440
- window.addEventListener("resize", checkWidth);
8441
- return () => window.removeEventListener("resize", checkWidth);
8442
- }, [items]);
8443
- const renderItems = () => {
8444
- if (!isCollapsed) {
8445
- return items;
8446
- }
8447
- if (items.length <= 2) {
8448
- return items;
8449
- }
8450
- const firstItem = items[0];
8451
- const lastItem = items[items.length - 1];
8452
- const hiddenItems = items.slice(1, -1);
8453
- const menuItems = hiddenItems.map((item, index) => ({
8454
- key: String(index),
8455
- label: item.href ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: item.href, children: item.title }) : item.title
8456
- }));
8457
- const ellipsisItem = {
8458
- title: "...",
8459
- menu: { items: menuItems },
8460
- dropdownProps: { arrow: false }
8461
- };
8462
- return [firstItem, ellipsisItem, lastItem];
8463
- };
8464
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled$w.PositionRelativeContainer, { children: [
8465
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$w.FullWidthContainer, { ref: containerRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Breadcrumb, { separator: ">", items: renderItems() }) }),
8466
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$w.NoWrapContainer, { ref: breadcrumbRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Breadcrumb, { separator: ">", items, style: { display: "flex", flexWrap: "nowrap" } }) })
8467
- ] });
8468
- };
8469
-
8470
9323
  const HeightDiv = styled.div`
8471
9324
  min-height: 22px;
8472
9325
  width: 100%;
@@ -8475,12 +9328,11 @@
8475
9328
  HeightDiv
8476
9329
  };
8477
9330
 
8478
- const ManageableBreadcrumbs = ({ data }) => {
8479
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$v.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
8480
- };
8481
- const ManageableBreadcrumbsWithDataProvider = ({
8482
- uri,
8483
- refetchInterval,
9331
+ const ManageableBreadcrumbsProvider = ({
9332
+ cluster,
9333
+ apiGroup,
9334
+ apiVersion,
9335
+ plural,
8484
9336
  isEnabled,
8485
9337
  replaceValues,
8486
9338
  pathname,
@@ -8490,10 +9342,11 @@
8490
9342
  data: rawData,
8491
9343
  isError: rawDataError,
8492
9344
  isLoading: rawDataLoading
8493
- } = useDirectUnknownResource({
8494
- uri,
8495
- refetchInterval,
8496
- queryKey: ["breadcrumb", uri],
9345
+ } = useK8sSmartResource({
9346
+ cluster: cluster || "",
9347
+ group: apiGroup,
9348
+ version: apiVersion,
9349
+ plural,
8497
9350
  isEnabled
8498
9351
  });
8499
9352
  if (rawDataError) {
@@ -8520,6 +9373,73 @@
8520
9373
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableBreadcrumbs, { data: result });
8521
9374
  };
8522
9375
 
9376
+ const CustomMenu = styled(antd.Menu)`
9377
+ margin-top: ${({ $noMarginTop }) => $noMarginTop ? "0" : "16px"};
9378
+ font-size: 14px;
9379
+ line-height: 24px;
9380
+ border: 0;
9381
+ /* stylelint-disable declaration-no-important */
9382
+ border-inline-end: 0 !important;
9383
+ /* stylelint-enable declaration-no-important */
9384
+
9385
+ .ant-menu-submenu-expand-icon {
9386
+ width: 16px;
9387
+ }
9388
+
9389
+ && .ant-menu-item-only-child {
9390
+ /* stylelint-disable declaration-no-important */
9391
+
9392
+ /* padding-left: 24px !important; */
9393
+ }
9394
+
9395
+ && .ant-menu-sub .ant-menu-item {
9396
+ margin: 0 !important;
9397
+ }
9398
+ `;
9399
+ const Styled$u = {
9400
+ CustomMenu
9401
+ };
9402
+
9403
+ const ManageableSidebar = ({ data, noMarginTop }) => {
9404
+ const [selectedKeys, setSelectedKeys] = K.useState([]);
9405
+ const [openKeys, setOpenKeys] = K.useState(() => {
9406
+ try {
9407
+ const saved = localStorage.getItem("menuOpenKeys");
9408
+ return saved ? JSON.parse(saved) : [];
9409
+ } catch (error) {
9410
+ console.error("Failed to parse stored menu keys", error);
9411
+ return [];
9412
+ }
9413
+ });
9414
+ const handleOpenChange = (keys) => {
9415
+ setOpenKeys(keys);
9416
+ try {
9417
+ localStorage.setItem("menuOpenKeys", JSON.stringify(keys));
9418
+ } catch (error) {
9419
+ console.error("Failed to save menu keys to localStorage", error);
9420
+ }
9421
+ };
9422
+ K.useEffect(() => {
9423
+ setSelectedKeys(data.selectedKeys);
9424
+ }, [data.selectedKeys]);
9425
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
9426
+ Styled$u.CustomMenu,
9427
+ {
9428
+ selectedKeys,
9429
+ onSelect: () => {
9430
+ },
9431
+ onDeselect: () => {
9432
+ },
9433
+ defaultOpenKeys: data.selectedKeys,
9434
+ openKeys,
9435
+ onOpenChange: handleOpenChange,
9436
+ mode: "inline",
9437
+ items: data.menuItems,
9438
+ $noMarginTop: noMarginTop
9439
+ }
9440
+ );
9441
+ };
9442
+
8523
9443
  const getLabel = ({
8524
9444
  preparedLink,
8525
9445
  label,
@@ -8614,75 +9534,11 @@
8614
9534
  return { ...result, selectedKeys: stringedOpenedKeys };
8615
9535
  };
8616
9536
 
8617
- const CustomMenu = styled(antd.Menu)`
8618
- margin-top: ${({ $noMarginTop }) => $noMarginTop ? "0" : "16px"};
8619
- font-size: 14px;
8620
- line-height: 24px;
8621
- border: 0;
8622
- /* stylelint-disable declaration-no-important */
8623
- border-inline-end: 0 !important;
8624
- /* stylelint-enable declaration-no-important */
8625
-
8626
- .ant-menu-submenu-expand-icon {
8627
- width: 16px;
8628
- }
8629
-
8630
- && .ant-menu-item-only-child {
8631
- /* stylelint-disable declaration-no-important */
8632
-
8633
- /* padding-left: 24px !important; */
8634
- }
8635
-
8636
- && .ant-menu-sub .ant-menu-item {
8637
- margin: 0 !important;
8638
- }
8639
- `;
8640
- const Styled$u = {
8641
- CustomMenu
8642
- };
8643
-
8644
- const ManageableSidebar = ({ data, noMarginTop }) => {
8645
- const [selectedKeys, setSelectedKeys] = K.useState([]);
8646
- const [openKeys, setOpenKeys] = K.useState(() => {
8647
- try {
8648
- const saved = localStorage.getItem("menuOpenKeys");
8649
- return saved ? JSON.parse(saved) : [];
8650
- } catch (error) {
8651
- console.error("Failed to parse stored menu keys", error);
8652
- return [];
8653
- }
8654
- });
8655
- const handleOpenChange = (keys) => {
8656
- setOpenKeys(keys);
8657
- try {
8658
- localStorage.setItem("menuOpenKeys", JSON.stringify(keys));
8659
- } catch (error) {
8660
- console.error("Failed to save menu keys to localStorage", error);
8661
- }
8662
- };
8663
- K.useEffect(() => {
8664
- setSelectedKeys(data.selectedKeys);
8665
- }, [data.selectedKeys]);
8666
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
8667
- Styled$u.CustomMenu,
8668
- {
8669
- selectedKeys,
8670
- onSelect: () => {
8671
- },
8672
- onDeselect: () => {
8673
- },
8674
- defaultOpenKeys: data.selectedKeys,
8675
- openKeys,
8676
- onOpenChange: handleOpenChange,
8677
- mode: "inline",
8678
- items: data.menuItems,
8679
- $noMarginTop: noMarginTop
8680
- }
8681
- );
8682
- };
8683
- const ManageableSidebarWithDataProvider = ({
8684
- uri,
8685
- refetchInterval,
9537
+ const ManageableSidebarProvider = ({
9538
+ cluster,
9539
+ apiGroup,
9540
+ apiVersion,
9541
+ plural,
8686
9542
  isEnabled,
8687
9543
  replaceValues,
8688
9544
  pathname,
@@ -8695,10 +9551,11 @@
8695
9551
  data: rawData,
8696
9552
  isError: rawDataError,
8697
9553
  isLoading: rawDataLoading
8698
- } = useDirectUnknownResource({
8699
- uri,
8700
- refetchInterval,
8701
- queryKey: ["sidebar", uri],
9554
+ } = useK8sSmartResource({
9555
+ cluster,
9556
+ group: apiGroup,
9557
+ version: apiVersion,
9558
+ plural,
8702
9559
  isEnabled
8703
9560
  });
8704
9561
  if (rawDataError) {
@@ -32959,49 +33816,97 @@
32959
33816
  };
32960
33817
 
32961
33818
  const MultiQueryContext = K.createContext(void 0);
32962
- const MultiQueryProvider = ({ urls, dataToApplyToContext, children }) => {
32963
- const queries = reactQuery.useQueries({
32964
- queries: urls.map((url, index) => ({
32965
- queryKey: ["multi", index, url],
32966
- queryFn: async () => {
32967
- const response = await axios.get(url);
32968
- return response.data;
33819
+ const makeEmptyEntry = () => ({
33820
+ data: void 0,
33821
+ isLoading: false,
33822
+ isError: false,
33823
+ error: null
33824
+ });
33825
+ const aggReducer = (state, action) => {
33826
+ switch (action.type) {
33827
+ case "RESET":
33828
+ return { entries: Array.from({ length: action.total }, makeEmptyEntry) };
33829
+ case "SET_ENTRY": {
33830
+ const entries = state.entries.slice();
33831
+ entries[action.index] = action.entry;
33832
+ return { entries };
33833
+ }
33834
+ default:
33835
+ return state;
33836
+ }
33837
+ };
33838
+ const K8sFetcher = ({ index, params, dispatch }) => {
33839
+ const res = useK8sSmartResource(params);
33840
+ K.useEffect(() => {
33841
+ dispatch({
33842
+ type: "SET_ENTRY",
33843
+ index,
33844
+ entry: {
33845
+ data: res.data,
33846
+ isLoading: res.isLoading,
33847
+ isError: res.isError,
33848
+ error: res.error ?? null
32969
33849
  }
32970
- }))
32971
- });
32972
- const data = {};
32973
- const errors = [];
32974
- let isLoading;
32975
- let isError;
32976
- if (!dataToApplyToContext) {
32977
- queries.forEach((q, i) => {
32978
- data[`req${i}`] = q.data;
32979
- errors[i] = q.error ?? null;
32980
33850
  });
32981
- isLoading = queries.some((q) => q.isLoading);
32982
- isError = queries.some((q) => q.isError);
32983
- } else {
32984
- data.req0 = dataToApplyToContext;
32985
- isLoading = false;
32986
- isError = false;
32987
- }
32988
- const value = K.useMemo(
32989
- () => ({ data, isLoading, isError, errors }),
32990
- /*
32991
- We use JSON.stringify(data) and JSON.stringify(errors) as dependencies to safely memoize when values deeply change (since data is a new object every render).
32992
- Alternatively, you could use a deep comparison hook or lodash.isEqual if needed.
32993
- */
32994
- // eslint-disable-next-line react-hooks/exhaustive-deps
32995
- [JSON.stringify(data), isLoading, isError, JSON.stringify(errors)]
33851
+ }, [index, res.data, res.isLoading, res.isError, res.error, dispatch]);
33852
+ return null;
33853
+ };
33854
+ const MultiQueryProvider = ({ items, dataToApplyToContext, children }) => {
33855
+ const k8sItems = K.useMemo(
33856
+ () => items.filter((x) => typeof x !== "string"),
33857
+ [items]
32996
33858
  );
32997
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryContext.Provider, { value, children });
33859
+ const urlItems = K.useMemo(() => items.filter((x) => typeof x === "string"), [items]);
33860
+ const k8sCount = k8sItems.length;
33861
+ const urlCount = urlItems.length;
33862
+ const [state, dispatch] = K.useReducer(aggReducer, { entries: Array.from({ length: k8sCount }, makeEmptyEntry) });
33863
+ K.useEffect(() => {
33864
+ dispatch({ type: "RESET", total: k8sCount });
33865
+ }, [k8sCount]);
33866
+ const urlQueries = reactQuery.useQueries({
33867
+ queries: urlItems.map((url, i) => ({
33868
+ queryKey: ["multi-url", i, url],
33869
+ queryFn: async () => {
33870
+ const res = await axios.get(url);
33871
+ return structuredClone(res.data);
33872
+ },
33873
+ structuralSharing: false,
33874
+ refetchInterval: 5e3
33875
+ }))
33876
+ });
33877
+ const value = (() => {
33878
+ if (typeof dataToApplyToContext !== "undefined") {
33879
+ return { data: { req0: dataToApplyToContext }, isLoading: false, isError: false, errors: [] };
33880
+ }
33881
+ const data = {};
33882
+ const errors = [];
33883
+ for (let i = 0; i < k8sCount; i++) {
33884
+ const e = state.entries[i] ?? makeEmptyEntry();
33885
+ data[`req${i}`] = e.data;
33886
+ errors[i] = e.isError ? e.error : null;
33887
+ }
33888
+ for (let i = 0; i < urlCount; i++) {
33889
+ const q = urlQueries[i];
33890
+ const idx = k8sCount + i;
33891
+ data[`req${idx}`] = q?.data;
33892
+ errors[idx] = q?.isError ? q.error ?? null : null;
33893
+ }
33894
+ const isLoading = state.entries.some((e) => e.isLoading) || urlQueries.some((q) => q.isLoading);
33895
+ const isError = state.entries.some((e) => e.isError) || urlQueries.some((q) => q.isError);
33896
+ return { data, isLoading, isError, errors };
33897
+ })();
33898
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(MultiQueryContext.Provider, { value, children: [
33899
+ k8sItems.map((params, i) => (
33900
+ // eslint-disable-next-line react/no-array-index-key
33901
+ /* @__PURE__ */ jsxRuntimeExports.jsx(K8sFetcher, { index: i, params, dispatch }, i)
33902
+ )),
33903
+ children
33904
+ ] });
32998
33905
  };
32999
33906
  const useMultiQuery = () => {
33000
- const context = K.useContext(MultiQueryContext);
33001
- if (!context) {
33002
- throw new Error("useMultiQuery must be used within a MultiQueryProvider");
33003
- }
33004
- return context;
33907
+ const ctx = K.useContext(MultiQueryContext);
33908
+ if (!ctx) throw new Error("useMultiQuery must be used within a MultiQueryProvider");
33909
+ return ctx;
33005
33910
  };
33006
33911
 
33007
33912
  const createContextFactory = () => {
@@ -33229,7 +34134,7 @@
33229
34134
  if (isError) {
33230
34135
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33231
34136
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
33232
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
34137
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
33233
34138
  ] });
33234
34139
  }
33235
34140
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: preparedText });
@@ -33259,7 +34164,7 @@
33259
34164
  if (isError) {
33260
34165
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33261
34166
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
33262
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
34167
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
33263
34168
  ] });
33264
34169
  }
33265
34170
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -33296,7 +34201,7 @@
33296
34201
  if (isError) {
33297
34202
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33298
34203
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
33299
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
34204
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
33300
34205
  ] });
33301
34206
  }
33302
34207
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ProjectInfoCard, { clusterName, namespace, accessGroups: parsedAccessGroups, ...props, children });
@@ -33413,7 +34318,7 @@
33413
34318
  if (isError) {
33414
34319
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33415
34320
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
33416
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
34321
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
33417
34322
  ] });
33418
34323
  }
33419
34324
  const { type, text } = getResult({
@@ -33445,7 +34350,7 @@
33445
34350
  acc[index.toString()] = value;
33446
34351
  return acc;
33447
34352
  }, {});
33448
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableSidebarWithDataProvider, { replaceValues, ...props });
34353
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableSidebarProvider, { replaceValues, ...props });
33449
34354
  };
33450
34355
 
33451
34356
  const checkPermission = async ({
@@ -33579,6 +34484,7 @@
33579
34484
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
33580
34485
  id,
33581
34486
  fetchUrl,
34487
+ k8sResourceToFetch,
33582
34488
  pathToItems,
33583
34489
  clusterNamePartOfUrl,
33584
34490
  labelSelector,
@@ -33622,7 +34528,13 @@
33622
34528
  verb: "create",
33623
34529
  refetchInterval: false
33624
34530
  });
33625
- const fetchUrlPrepared = parseAll({ text: fetchUrl, replaceValues, multiQueryData });
34531
+ const fetchUrlPrepared = fetchUrl ? parseAll({ text: fetchUrl, replaceValues, multiQueryData }) : void 0;
34532
+ const k8sResourceToFetchPrepared = k8sResourceToFetch ? {
34533
+ group: k8sResourceToFetch.group ? parseAll({ text: k8sResourceToFetch.group, replaceValues, multiQueryData }) : void 0,
34534
+ version: parseAll({ text: k8sResourceToFetch.version, replaceValues, multiQueryData }),
34535
+ plural: parseAll({ text: k8sResourceToFetch.plural, replaceValues, multiQueryData }),
34536
+ namespace: k8sResourceToFetch.namespace ? parseAll({ text: k8sResourceToFetch.namespace, replaceValues, multiQueryData }) : void 0
34537
+ } : void 0;
33626
34538
  const sParams = new URLSearchParams();
33627
34539
  if (labelSelector && Object.keys(labelSelector).length > 0) {
33628
34540
  const parsedObject = Object.fromEntries(
@@ -33659,21 +34571,48 @@
33659
34571
  } = useDirectUnknownResource({
33660
34572
  uri: `${fetchUrlPrepared}${searchParams ? `?${searchParams}` : ""}`,
33661
34573
  queryKey: [`${fetchUrlPrepared}${searchParams ? `?${searchParams}` : ""}`],
33662
- isEnabled: !isMultiqueryLoading
34574
+ isEnabled: Boolean(!isMultiqueryLoading && fetchUrlPrepared)
33663
34575
  });
33664
- if (isMultiqueryLoading) {
34576
+ const {
34577
+ data: fetchedDataSocket,
34578
+ isLoading: isFetchedDataSocketLoading,
34579
+ error: fetchedDataSocketError
34580
+ } = useK8sSmartResource({
34581
+ cluster: clusterName || "",
34582
+ namespace: k8sResourceToFetchPrepared?.namespace,
34583
+ group: k8sResourceToFetchPrepared?.group,
34584
+ version: k8sResourceToFetchPrepared?.version || "",
34585
+ plural: k8sResourceToFetchPrepared?.plural || "",
34586
+ fieldSelector: sParams.get("fieldSelector") || void 0,
34587
+ labelSelector: sParams.get("labelSelector") || void 0,
34588
+ isEnabled: Boolean(!isMultiqueryLoading && k8sResourceToFetchPrepared)
34589
+ });
34590
+ if (fetchUrlPrepared && isMultiqueryLoading) {
34591
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
34592
+ }
34593
+ if (k8sResourceToFetchPrepared && isMultiqueryLoading) {
33665
34594
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
33666
34595
  }
33667
- if (isFetchedDataLoading) {
34596
+ if (fetchUrlPrepared && isFetchedDataLoading) {
34597
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {}) });
34598
+ }
34599
+ if (k8sResourceToFetchPrepared && isFetchedDataSocketLoading) {
33668
34600
  return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {}) });
33669
34601
  }
33670
- if (fetchedDataError) {
34602
+ if (fetchUrlPrepared && fetchedDataError) {
33671
34603
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33672
34604
  "Error: ",
33673
34605
  JSON.stringify(fetchedDataError)
33674
34606
  ] });
33675
34607
  }
33676
- const items = Array.isArray(pathToItems) ? _$1.get(fetchedData, pathToItems) : jp.query(fetchedData, `$${pathToItems}`)[0];
34608
+ if (k8sResourceToFetchPrepared && fetchedDataSocketError) {
34609
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34610
+ "Error: ",
34611
+ JSON.stringify(fetchedDataError)
34612
+ ] });
34613
+ }
34614
+ const dataFromOneOfHooks = fetchedData || fetchedDataSocket;
34615
+ const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks, pathToItems) : jp.query(dataFromOneOfHooks, `$${pathToItems}`)[0];
33677
34616
  if (!items) {
33678
34617
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33679
34618
  "No data on this path ",
@@ -33808,15 +34747,18 @@
33808
34747
  const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
33809
34748
  const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
33810
34749
  const {
33811
- data: podInfo,
34750
+ data: podInfoList,
33812
34751
  isError: isPodInfoError,
33813
34752
  isLoading: isLoadingPodInfo
33814
- } = useDirectUnknownResource({
33815
- uri: `/api/clusters/${clusterPrepared}/k8s/api/v1/namespaces/${namespacePrepared}/pods/${podNamePrepared}`,
33816
- refetchInterval: 5e3,
33817
- queryKey: [clusterPrepared || "no-cluster", "pods", podNamePrepared],
34753
+ } = useK8sSmartResource({
34754
+ cluster: clusterPrepared,
34755
+ namespace: namespacePrepared,
34756
+ version: "v1",
34757
+ plural: "pods",
34758
+ fieldSelector: `metadata.name=${podNamePrepared}`,
33818
34759
  isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
33819
34760
  });
34761
+ const podInfo = podInfoList?.items && podInfoList.items.length > 0 ? podInfoList.items[0] : void 0;
33820
34762
  if (isMultiqueryLoading) {
33821
34763
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
33822
34764
  }
@@ -33924,15 +34866,18 @@
33924
34866
  const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
33925
34867
  const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
33926
34868
  const {
33927
- data: podInfo,
34869
+ data: podInfoList,
33928
34870
  isError: isPodInfoError,
33929
34871
  isLoading: isLoadingPodInfo
33930
- } = useDirectUnknownResource({
33931
- uri: `/api/clusters/${clusterPrepared}/k8s/api/v1/namespaces/${namespacePrepared}/pods/${podNamePrepared}`,
33932
- refetchInterval: 5e3,
33933
- queryKey: [clusterPrepared || "no-cluster", "pods", podNamePrepared],
34872
+ } = useK8sSmartResource({
34873
+ cluster: clusterPrepared,
34874
+ namespace: namespacePrepared,
34875
+ version: "v1",
34876
+ plural: "pods",
34877
+ fieldSelector: `metadata.name=${podNamePrepared}`,
33934
34878
  isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
33935
34879
  });
34880
+ const podInfo = podInfoList?.items && podInfoList.items.length > 0 ? podInfoList.items[0] : void 0;
33936
34881
  if (isMultiqueryLoading) {
33937
34882
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
33938
34883
  }
@@ -33968,6 +34913,37 @@
33968
34913
  ] });
33969
34914
  };
33970
34915
 
34916
+ const getDataByPath = ({
34917
+ prefillValuesRaw,
34918
+ pathToData
34919
+ }) => {
34920
+ return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw, pathToData) : jp.query(prefillValuesRaw, `$${pathToData}`)[0];
34921
+ };
34922
+ const getPrefillValuesWithForces = ({
34923
+ prefillValues,
34924
+ forcedKind,
34925
+ apiGroup,
34926
+ apiVersion
34927
+ }) => {
34928
+ if (!forcedKind) {
34929
+ return prefillValues;
34930
+ }
34931
+ const newValues = { ...prefillValues };
34932
+ if (typeof newValues === "object" && newValues !== null) {
34933
+ if ("kind" in newValues) {
34934
+ delete newValues.kind;
34935
+ }
34936
+ if ("apiVersion" in newValues) {
34937
+ delete newValues.apiVersion;
34938
+ }
34939
+ }
34940
+ return {
34941
+ kind: forcedKind,
34942
+ apiVersion: `${apiGroup ? `${apiGroup}/` : ""}${apiVersion}`,
34943
+ ...newValues
34944
+ };
34945
+ };
34946
+
33971
34947
  const YamlEditorSingleton$1 = ({
33972
34948
  data,
33973
34949
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -33983,7 +34959,9 @@
33983
34959
  apiGroup,
33984
34960
  apiVersion,
33985
34961
  typeName,
34962
+ forcedKind,
33986
34963
  prefillValuesRequestIndex,
34964
+ pathToData,
33987
34965
  substractHeight,
33988
34966
  ...props
33989
34967
  } = data;
@@ -34009,7 +34987,9 @@
34009
34987
  const apiGroupPrepared = apiGroup ? parseAll({ text: apiGroup, replaceValues, multiQueryData }) : "no-api-group";
34010
34988
  const apiVersionPrepared = apiVersion ? parseAll({ text: apiVersion, replaceValues, multiQueryData }) : "no-api-version";
34011
34989
  const typeNamePrepared = parseAll({ text: typeName, replaceValues, multiQueryData });
34012
- const prefillValues = multiQueryData[`req${prefillValuesRequestIndex}`];
34990
+ const prefillValuesRaw = multiQueryData[`req${prefillValuesRequestIndex}`];
34991
+ const prefillValues = pathToData ? getDataByPath({ prefillValuesRaw, pathToData }) : prefillValuesRaw;
34992
+ const prefillValuesWithForces = getPrefillValuesWithForces({ prefillValues, forcedKind, apiGroup, apiVersion });
34013
34993
  if (isMultiqueryLoading) {
34014
34994
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
34015
34995
  }
@@ -34019,7 +34999,7 @@
34019
34999
  {
34020
35000
  cluster: clusterPrepared,
34021
35001
  theme,
34022
- prefillValuesSchema: prefillValues,
35002
+ prefillValuesSchema: prefillValuesWithForces,
34023
35003
  isNameSpaced,
34024
35004
  isCreate: false,
34025
35005
  type,
@@ -34118,7 +35098,7 @@
34118
35098
  if (isMultiQueryErrors) {
34119
35099
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34120
35100
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34121
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
35101
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34122
35102
  ] });
34123
35103
  }
34124
35104
  const jsonRoot = multiQueryData[`req${reqIndex}`];
@@ -34185,7 +35165,7 @@
34185
35165
  if (isMultiQueryErrors) {
34186
35166
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34187
35167
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34188
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
35168
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34189
35169
  ] });
34190
35170
  }
34191
35171
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -34242,7 +35222,7 @@
34242
35222
  if (isMultiQueryErrors) {
34243
35223
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34244
35224
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34245
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
35225
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34246
35226
  ] });
34247
35227
  }
34248
35228
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -34420,11 +35400,7 @@
34420
35400
  p === void 0 ? void 0 : Array.isArray(p) ? p : [p]
34421
35401
  );
34422
35402
 
34423
- const HiddenContainer = ({
34424
- name,
34425
- secondName,
34426
- children
34427
- }) => {
35403
+ const HiddenContainer = ({ name, secondName, children }) => {
34428
35404
  const hiddenPaths = useHiddenPathsLayout();
34429
35405
  const nameArr = toArray(name);
34430
35406
  const secondArr = toArray(secondName);
@@ -34627,7 +35603,7 @@
34627
35603
  if (isMultiQueryErrors) {
34628
35604
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34629
35605
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34630
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
35606
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34631
35607
  ] });
34632
35608
  }
34633
35609
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -34902,7 +35878,7 @@
34902
35878
  if (isMultiQueryErrors) {
34903
35879
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34904
35880
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34905
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
35881
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34906
35882
  ] });
34907
35883
  }
34908
35884
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -35171,7 +36147,7 @@
35171
36147
  if (isMultiQueryErrors) {
35172
36148
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
35173
36149
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
35174
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
36150
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
35175
36151
  ] });
35176
36152
  }
35177
36153
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -35415,10 +36391,15 @@
35415
36391
  ...restField,
35416
36392
  name: [name, "operator"],
35417
36393
  rules: [
35418
- { required: true, message: "Operator is required." },
35419
- {
35420
- validator: (_, v) => v && operatorOptions.includes(v) ? Promise.resolve() : Promise.reject(new Error("Select a valid operator."))
35421
- }
36394
+ ({ getFieldValue }) => ({
36395
+ validator(_, v) {
36396
+ const nameV = getFieldValue(["tolerations", name, "key"]);
36397
+ if ((nameV === "nameV" || !nameV) && (!v || v !== "Exists")) {
36398
+ return Promise.reject(new Error("Operator must be Exists when `key` is empty"));
36399
+ }
36400
+ return Promise.resolve();
36401
+ }
36402
+ })
35422
36403
  ],
35423
36404
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
35424
36405
  antd.Select,
@@ -35544,7 +36525,7 @@
35544
36525
  if (isMultiQueryErrors) {
35545
36526
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
35546
36527
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
35547
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
36528
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
35548
36529
  ] });
35549
36530
  }
35550
36531
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -35825,7 +36806,7 @@
35825
36806
  if (isMultiQueryErrors) {
35826
36807
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
35827
36808
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
35828
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
36809
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
35829
36810
  ] });
35830
36811
  }
35831
36812
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -36043,7 +37024,7 @@
36043
37024
  if (isError) {
36044
37025
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
36045
37026
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
36046
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
37027
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
36047
37028
  ] });
36048
37029
  }
36049
37030
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -36860,7 +37841,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
36860
37841
  if (isError) {
36861
37842
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
36862
37843
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
36863
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
37844
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
36864
37845
  ] });
36865
37846
  }
36866
37847
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
@@ -36934,30 +37915,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
36934
37915
  ] });
36935
37916
  };
36936
37917
 
36937
- const fnv1a32 = (str) => {
36938
- let h = 2166136261;
36939
- for (const ch of str) {
36940
- h ^= ch.codePointAt(0);
36941
- h = (h >>> 0) * 16777619;
36942
- }
36943
- return h >>> 0;
36944
- };
36945
- const pickInRange = (u32, min, max) => min + u32 % (max - min + 1);
36946
- const hslFromString = (value, theme) => {
36947
- const hash = fnv1a32(value);
36948
- const hue = hash % 345;
36949
- const [sMin, sMax] = theme === "light" ? [90, 100] : [78, 80];
36950
- const [lMin, lMax] = theme === "light" ? [78, 80] : [25, 35];
36951
- const s = pickInRange(hash >>> 8, sMin, sMax);
36952
- const l = pickInRange(hash >>> 16, lMin, lMax);
36953
- return `hsl(${hue}, ${s}%, ${l}%)`;
36954
- };
36955
-
36956
- const getUppercase = (s) => {
36957
- const uppercases = [...s].filter((c) => c >= "A" && c <= "Z").join("");
36958
- return uppercases.length > 0 ? uppercases : s[0].toUpperCase();
36959
- };
36960
-
36961
37918
  const RoundSpan = styled.span`
36962
37919
  background-color: ${({ $bgColor }) => $bgColor || "none"};
36963
37920
  border-radius: 13px;
@@ -36992,7 +37949,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
36992
37949
  if (isError) {
36993
37950
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
36994
37951
  /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
36995
- /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: e.message }, i)) })
37952
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
36996
37953
  ] });
36997
37954
  }
36998
37955
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value2, index) => {
@@ -37047,6 +38004,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37047
38004
  baseFactoryNamespacedBuiltinKey,
37048
38005
  baseFactoryClusterSceopedBuiltinKey,
37049
38006
  baseNamespaceFactoryKey,
38007
+ baseNavigationPluralName,
38008
+ baseNavigationSpecificName,
37050
38009
  ...props
37051
38010
  } = data;
37052
38011
  const theme = useTheme();
@@ -37111,6 +38070,354 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37111
38070
  baseFactoryNamespacedBuiltinKey,
37112
38071
  baseFactoryClusterSceopedBuiltinKey,
37113
38072
  baseNamespaceFactoryKey,
38073
+ baseNavigationPluralName,
38074
+ baseNavigationSpecificName,
38075
+ ...props
38076
+ }
38077
+ ),
38078
+ children
38079
+ ] });
38080
+ };
38081
+
38082
+ const getKinds = async ({ clusterName }) => {
38083
+ const result = await axios.get(`/api/clusters/${clusterName}/openapi-bff/search/kinds/getKinds`);
38084
+ return result.data;
38085
+ };
38086
+
38087
+ const parseK8sVersion$1 = (raw) => {
38088
+ const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
38089
+ if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
38090
+ const stage = (m.groups.stage ?? "").toLowerCase();
38091
+ const major = Number(m.groups.major);
38092
+ const stageNum = m.groups.stageNum ? Number(m.groups.stageNum) : 0;
38093
+ const rank = stage === "" ? 3 : stage === "beta" ? 2 : 1;
38094
+ return { rank, major, stageNum };
38095
+ };
38096
+ const versionToken$1 = (e) => e.version || (e.groupVersion?.split("/").pop() ?? "");
38097
+ const compareK8sVersionDesc$1 = (a, b) => {
38098
+ const pa = parseK8sVersion$1(versionToken$1(a));
38099
+ const pb = parseK8sVersion$1(versionToken$1(b));
38100
+ return pb.rank - pa.rank || pb.major - pa.major || pb.stageNum - pa.stageNum;
38101
+ };
38102
+ const orderVersions = (versions) => {
38103
+ const preferredIdx = versions.findIndex((v) => v.preferred === true);
38104
+ if (preferredIdx >= 0) {
38105
+ const preferred = versions[preferredIdx];
38106
+ const rest = versions.filter((_, i) => i !== preferredIdx).slice().sort(compareK8sVersionDesc$1);
38107
+ return [preferred, ...rest];
38108
+ }
38109
+ return versions.slice().sort(compareK8sVersionDesc$1);
38110
+ };
38111
+ const getSortedKindsAll = (index) => {
38112
+ const counts = index.items.reduce(
38113
+ (acc, item) => ({ ...acc, [item.kind]: (acc[item.kind] ?? 0) + 1 }),
38114
+ {}
38115
+ );
38116
+ const rows = index.items.flatMap((item) => {
38117
+ const ordered = orderVersions(item.versions);
38118
+ return ordered.map((v) => ({
38119
+ group: item.group,
38120
+ kind: item.kind,
38121
+ // clone to drop Readonly<> without changing fields (incl. preferred)
38122
+ version: { ...v },
38123
+ ...counts[item.kind] > 1 ? { notUnique: true } : {}
38124
+ }));
38125
+ });
38126
+ return rows.sort(
38127
+ (a, b) => a.kind.localeCompare(b.kind, void 0, { sensitivity: "base" }) || a.group.localeCompare(b.group, void 0, { sensitivity: "base" })
38128
+ );
38129
+ };
38130
+
38131
+ const parseApiVersion = (apiVersion) => {
38132
+ const parts = apiVersion.trim().split("/");
38133
+ return parts.length === 1 ? { group: "", version: parts[0] } : { group: parts[0], version: parts[1] };
38134
+ };
38135
+ const pluralByKind = (entries) => (kind, apiVersion) => {
38136
+ const norm = (s) => s.trim();
38137
+ const kindNorm = norm(kind);
38138
+ const gv = apiVersion ? parseApiVersion(apiVersion) : void 0;
38139
+ const candidates = entries.filter((e) => norm(e.kind) === kindNorm);
38140
+ if (candidates.length === 0) return void 0;
38141
+ const filtered = gv ? candidates.filter((e) => norm(e.group) === norm(gv.group) && e.version.version === gv.version) : candidates;
38142
+ if (filtered.length === 0) return void 0;
38143
+ const preferredFirst = gv ? filtered : [...filtered.filter((e) => e.version.preferred), ...filtered.filter((e) => !e.version.preferred)];
38144
+ const resources = preferredFirst.map((e) => e.version.resource).filter(Boolean);
38145
+ const uniq = Array.from(new Set(resources));
38146
+ if (!gv && uniq.length > 1) {
38147
+ const first = preferredFirst[0]?.version.resource;
38148
+ return first ?? void 0;
38149
+ }
38150
+ return uniq.length === 1 ? uniq[0] : void 0;
38151
+ };
38152
+
38153
+ const findOwnerReferencePath = (rawObject, jsonPathToArrayOfRefs, reference) => {
38154
+ if (!rawObject || !jsonPathToArrayOfRefs) return void 0;
38155
+ let arrayJsonPath = jsonPathToArrayOfRefs.trim();
38156
+ if (arrayJsonPath.startsWith(".")) {
38157
+ arrayJsonPath = `$${arrayJsonPath}`;
38158
+ }
38159
+ if (!arrayJsonPath.startsWith("$")) {
38160
+ arrayJsonPath = `$${arrayJsonPath}`;
38161
+ }
38162
+ arrayJsonPath = arrayJsonPath.replace(/\[\*\]$/, "");
38163
+ const nodes = jp.nodes(rawObject, arrayJsonPath);
38164
+ if (!nodes.length) return void 0;
38165
+ const arrayNode = nodes[0];
38166
+ const arr = arrayNode.value;
38167
+ if (!Array.isArray(arr)) return void 0;
38168
+ const index = arr.findIndex((item) => {
38169
+ if (!item) return false;
38170
+ return item.name === reference.name && item.kind === reference.kind && item.apiVersion === reference.apiVersion;
38171
+ });
38172
+ if (index === -1) return void 0;
38173
+ const basePathSegs = arrayNode.path.slice(1);
38174
+ return [...basePathSegs, index];
38175
+ };
38176
+ const parseDotPath$1 = (dotPath) => dotPath.split(".").filter(Boolean).map((seg) => seg.match(/^\d+$/) ? Number(seg) : seg);
38177
+ const resolveFormPath$1 = (pathInput, basePathForRelative) => {
38178
+ if (!pathInput) return [];
38179
+ if (Array.isArray(pathInput)) return pathInput;
38180
+ const pathStr = String(pathInput);
38181
+ const isRelative = pathStr.startsWith("./") || pathStr.startsWith("../");
38182
+ if (!isRelative) {
38183
+ return parseDotPath$1(pathStr);
38184
+ }
38185
+ let resolved = [...basePathForRelative];
38186
+ const parts = pathStr.split("/").filter(Boolean);
38187
+ for (const part of parts) {
38188
+ if (part === ".") {
38189
+ continue;
38190
+ }
38191
+ if (part === "..") {
38192
+ resolved = resolved.slice(0, -1);
38193
+ continue;
38194
+ }
38195
+ resolved.push(...parseDotPath$1(part));
38196
+ }
38197
+ return resolved;
38198
+ };
38199
+
38200
+ const RefElement = ({
38201
+ reference,
38202
+ keysToForcedLabel,
38203
+ forcedRelatedValuePath,
38204
+ rawObjectToFindLabel,
38205
+ jsonPathToArrayOfRefs,
38206
+ forcedNamespace,
38207
+ theme,
38208
+ baseprefix,
38209
+ cluster,
38210
+ getPlural,
38211
+ baseFactoryNamespacedAPIKey,
38212
+ baseFactoryClusterSceopedAPIKey,
38213
+ baseFactoryNamespacedBuiltinKey,
38214
+ baseFactoryClusterSceopedBuiltinKey,
38215
+ baseFactoriesMapping
38216
+ }) => {
38217
+ let forcedName;
38218
+ let objectNamespace;
38219
+ if (keysToForcedLabel && rawObjectToFindLabel) {
38220
+ forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel, keysToForcedLabel) : jp.query(rawObjectToFindLabel, `$${keysToForcedLabel}`)[0];
38221
+ }
38222
+ if (forcedRelatedValuePath && rawObjectToFindLabel) {
38223
+ try {
38224
+ const ownerRefPathSegs = findOwnerReferencePath(
38225
+ rawObjectToFindLabel,
38226
+ jsonPathToArrayOfRefs,
38227
+ // ".spec.customRef"
38228
+ reference
38229
+ );
38230
+ const relatedPath = forcedRelatedValuePath && ownerRefPathSegs ? resolveFormPath$1(forcedRelatedValuePath, ownerRefPathSegs) : void 0;
38231
+ if (relatedPath) {
38232
+ forcedName = _$1.get(rawObjectToFindLabel, relatedPath);
38233
+ }
38234
+ } catch {
38235
+ }
38236
+ }
38237
+ if (rawObjectToFindLabel) {
38238
+ try {
38239
+ const defaultFetched = _$1.get(rawObjectToFindLabel, ["metadata", "namespace"]);
38240
+ const socketFetched = _$1.get(rawObjectToFindLabel, ["items", 0, "metadata", "namespace"]);
38241
+ objectNamespace = socketFetched || defaultFetched;
38242
+ } catch {
38243
+ }
38244
+ }
38245
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
38246
+ ResourceLink,
38247
+ {
38248
+ kind: reference.kind,
38249
+ apiVersion: reference.apiVersion,
38250
+ namespace: forcedNamespace || reference.namespace || objectNamespace,
38251
+ forcedName,
38252
+ name: reference.name,
38253
+ theme,
38254
+ baseprefix,
38255
+ cluster,
38256
+ getPlural,
38257
+ baseFactoryNamespacedAPIKey,
38258
+ baseFactoryClusterSceopedAPIKey,
38259
+ baseFactoryNamespacedBuiltinKey,
38260
+ baseFactoryClusterSceopedBuiltinKey,
38261
+ baseFactoriesMapping
38262
+ }
38263
+ );
38264
+ };
38265
+
38266
+ const RefsList = ({
38267
+ theme,
38268
+ baseprefix,
38269
+ cluster,
38270
+ refsArr,
38271
+ keysToForcedLabel,
38272
+ forcedRelatedValuePath,
38273
+ rawObjectToFindLabel,
38274
+ jsonPathToArrayOfRefs,
38275
+ forcedNamespace,
38276
+ baseFactoryNamespacedAPIKey,
38277
+ baseFactoryClusterSceopedAPIKey,
38278
+ baseFactoryNamespacedBuiltinKey,
38279
+ baseFactoryClusterSceopedBuiltinKey,
38280
+ baseNavigationPluralName,
38281
+ baseNavigationSpecificName,
38282
+ listFlexProps
38283
+ }) => {
38284
+ const [kindIndex, setKindIndex] = K.useState();
38285
+ const [kindsWithVersion, setKindWithVersion] = K.useState();
38286
+ K.useEffect(() => {
38287
+ getKinds({ clusterName: cluster }).then((data) => {
38288
+ setKindIndex(data);
38289
+ setKindWithVersion(getSortedKindsAll(data));
38290
+ }).catch((error) => {
38291
+ console.error(error);
38292
+ });
38293
+ }, [cluster]);
38294
+ const { data: navigationDataArr } = useK8sSmartResource({
38295
+ cluster,
38296
+ group: "front.in-cloud.io",
38297
+ version: "v1alpha1",
38298
+ plural: baseNavigationPluralName,
38299
+ fieldSelector: `metadata.name=${baseNavigationSpecificName}`
38300
+ });
38301
+ const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
38302
+ const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
38303
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Flex, { vertical: true, gap: 8, ...listFlexProps, children: refsArr.map((ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
38304
+ RefElement,
38305
+ {
38306
+ reference: ref,
38307
+ keysToForcedLabel,
38308
+ forcedRelatedValuePath,
38309
+ rawObjectToFindLabel,
38310
+ jsonPathToArrayOfRefs,
38311
+ forcedNamespace,
38312
+ theme,
38313
+ baseprefix,
38314
+ cluster,
38315
+ getPlural,
38316
+ baseFactoryNamespacedAPIKey,
38317
+ baseFactoryClusterSceopedAPIKey,
38318
+ baseFactoryNamespacedBuiltinKey,
38319
+ baseFactoryClusterSceopedBuiltinKey,
38320
+ baseFactoriesMapping
38321
+ },
38322
+ JSON.stringify(ref)
38323
+ )) });
38324
+ };
38325
+
38326
+ const isOwnerReference = (value) => {
38327
+ if (!value || typeof value !== "object") {
38328
+ return false;
38329
+ }
38330
+ if (value === null) {
38331
+ return false;
38332
+ }
38333
+ if (!("apiVersion" in value) || typeof value.apiVersion !== "string" || !("kind" in value) || typeof value.kind !== "string" || !("name" in value) || typeof value.name !== "string") {
38334
+ return false;
38335
+ }
38336
+ return true;
38337
+ };
38338
+
38339
+ const OwnerRefs = ({
38340
+ data,
38341
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38342
+ children
38343
+ }) => {
38344
+ const { data: multiQueryData, isLoading: isMultiqueryLoading } = useMultiQuery();
38345
+ const {
38346
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38347
+ id,
38348
+ baseprefix,
38349
+ clusterNamePartOfUrl,
38350
+ reqIndex,
38351
+ errorText,
38352
+ notArrayErrorText,
38353
+ emptyArrayErrorText,
38354
+ isNotRefsArrayErrorText,
38355
+ containerStyle,
38356
+ listFlexProps,
38357
+ keysToForcedLabel,
38358
+ forcedRelatedValuePath,
38359
+ jsonPathToArrayOfRefs,
38360
+ forcedNamespace,
38361
+ baseFactoryNamespacedAPIKey,
38362
+ baseFactoryClusterSceopedAPIKey,
38363
+ baseFactoryNamespacedBuiltinKey,
38364
+ baseFactoryClusterSceopedBuiltinKey,
38365
+ baseNavigationPluralName,
38366
+ baseNavigationSpecificName,
38367
+ ...props
38368
+ } = data;
38369
+ const theme = useTheme();
38370
+ const partsOfUrl = usePartsOfUrl();
38371
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
38372
+ acc[index.toString()] = value;
38373
+ return acc;
38374
+ }, {});
38375
+ const clusterName = prepareTemplate({
38376
+ template: clusterNamePartOfUrl,
38377
+ replaceValues
38378
+ });
38379
+ const preparedForcedNamespace = forcedNamespace ? prepareTemplate({
38380
+ template: forcedNamespace,
38381
+ replaceValues
38382
+ }) : void 0;
38383
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
38384
+ if (jsonRoot === void 0) {
38385
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
38386
+ }
38387
+ const refsArr = jp.query(jsonRoot, `$${jsonPathToArrayOfRefs}`)[0];
38388
+ if (!Array.isArray(refsArr)) {
38389
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: notArrayErrorText });
38390
+ }
38391
+ if (refsArr.length === 0) {
38392
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: emptyArrayErrorText });
38393
+ }
38394
+ if (refsArr.some((el) => !isOwnerReference(el))) {
38395
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: isNotRefsArrayErrorText });
38396
+ }
38397
+ const guardedRefsArr = refsArr;
38398
+ if (isMultiqueryLoading) {
38399
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
38400
+ }
38401
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
38402
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
38403
+ RefsList,
38404
+ {
38405
+ theme,
38406
+ baseprefix,
38407
+ cluster: clusterName,
38408
+ refsArr: guardedRefsArr,
38409
+ keysToForcedLabel,
38410
+ forcedRelatedValuePath,
38411
+ jsonPathToArrayOfRefs,
38412
+ forcedNamespace: preparedForcedNamespace,
38413
+ rawObjectToFindLabel: jsonRoot,
38414
+ baseFactoryNamespacedAPIKey,
38415
+ baseFactoryClusterSceopedAPIKey,
38416
+ baseFactoryNamespacedBuiltinKey,
38417
+ baseFactoryClusterSceopedBuiltinKey,
38418
+ baseNavigationPluralName,
38419
+ baseNavigationSpecificName,
38420
+ listFlexProps,
37114
38421
  ...props
37115
38422
  }
37116
38423
  ),
@@ -37154,7 +38461,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37154
38461
  ConverterBytes,
37155
38462
  SecretBase64Plain,
37156
38463
  ResourceBadge,
37157
- Events: Events$1
38464
+ Events: Events$1,
38465
+ OwnerRefs
37158
38466
  };
37159
38467
 
37160
38468
  const prepareUrlsToFetchForDynamicRenderer = ({
@@ -37173,13 +38481,30 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37173
38481
  );
37174
38482
  };
37175
38483
 
38484
+ const STRING_KEYS = ["cluster", "group", "version", "plural", "namespace", "fieldSelector", "labelSelector"];
37176
38485
  const DynamicRendererWithProviders = (props) => {
37177
38486
  const location = reactRouterDom.useLocation();
37178
38487
  const { urlsToFetch, dataToApplyToContext, theme, nodeTerminalDefaultProfile, disableEventBubbling } = props;
38488
+ const directUrls = urlsToFetch.filter((el) => typeof el === "string");
38489
+ const k8sResourcesUrls = urlsToFetch.filter((el) => typeof el !== "string");
37179
38490
  const preparedUrlsToFetch = prepareUrlsToFetchForDynamicRenderer({
37180
- urls: urlsToFetch,
38491
+ urls: directUrls,
37181
38492
  locationPathname: location.pathname
37182
38493
  });
38494
+ const preparedK8sResoucesUrls = k8sResourcesUrls.map((res) => {
38495
+ let next = { ...res };
38496
+ for (const key of STRING_KEYS) {
38497
+ const val = next[key];
38498
+ if (typeof val === "string" && val.length > 0) {
38499
+ const prepared = prepareUrlsToFetchForDynamicRenderer({
38500
+ urls: [val],
38501
+ locationPathname: location.pathname
38502
+ });
38503
+ next = { ...next, [key]: prepared[0] ?? val };
38504
+ }
38505
+ }
38506
+ return next;
38507
+ });
37183
38508
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
37184
38509
  CursorDefaultDiv,
37185
38510
  {
@@ -37189,7 +38514,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37189
38514
  e.stopPropagation();
37190
38515
  }
37191
38516
  },
37192
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FactoryConfigContextProvider, { value: { nodeTerminalDefaultProfile }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PartsOfUrlProvider, { value: { partsOfUrl: location.pathname.split("/") }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MultiQueryProvider, { urls: preparedUrlsToFetch, dataToApplyToContext, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props }) }) }) }) })
38517
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FactoryConfigContextProvider, { value: { nodeTerminalDefaultProfile }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PartsOfUrlProvider, { value: { partsOfUrl: location.pathname.split("/") }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
38518
+ MultiQueryProvider,
38519
+ {
38520
+ items: [...preparedK8sResoucesUrls, ...preparedUrlsToFetch],
38521
+ dataToApplyToContext,
38522
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props })
38523
+ }
38524
+ ) }) }) })
37193
38525
  }
37194
38526
  );
37195
38527
  };
@@ -37798,6 +39130,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37798
39130
  setIsError(void 0);
37799
39131
  setIsLoading(true);
37800
39132
  const payload = {
39133
+ clusterName: cluster,
37801
39134
  customizationId,
37802
39135
  tableMappingsReplaceValues,
37803
39136
  forceDefaultAdditionalPrinterColumns,
@@ -46115,9 +47448,56 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
46115
47448
  const [yamlData, setYamlData] = K.useState("");
46116
47449
  const [isLoading, setIsLoading] = K.useState(false);
46117
47450
  const [error, setError] = K.useState();
47451
+ const initialPrefillYamlRef = K.useRef(null);
47452
+ const latestPrefillYamlRef = K.useRef(null);
47453
+ const firstLoadRef = K.useRef(true);
47454
+ const handleReload = () => {
47455
+ const nextYaml = latestPrefillYamlRef.current ?? initialPrefillYamlRef.current;
47456
+ if (nextYaml !== null) {
47457
+ setYamlData(nextYaml);
47458
+ }
47459
+ };
47460
+ const openNotificationYamlChanged = K.useCallback(() => {
47461
+ const key = `open${Date.now()}`;
47462
+ const btn = /* @__PURE__ */ jsxRuntimeExports.jsx(
47463
+ antd.Button,
47464
+ {
47465
+ type: "primary",
47466
+ size: "small",
47467
+ onClick: () => {
47468
+ handleReload();
47469
+ api.destroy(key);
47470
+ },
47471
+ children: "Reload"
47472
+ }
47473
+ );
47474
+ api.info({
47475
+ message: "Data changed",
47476
+ description: "Reload will flush changes and reload data to latest",
47477
+ btn,
47478
+ key,
47479
+ onClose: () => console.log("Notification closed"),
47480
+ placement: "bottomRight",
47481
+ duration: 30
47482
+ // keep it open until user closes
47483
+ });
47484
+ }, [api]);
46118
47485
  K.useEffect(() => {
46119
- setYamlData(stringify(prefillValuesSchema));
46120
- }, [prefillValuesSchema]);
47486
+ if (prefillValuesSchema === void 0) return;
47487
+ console.log(prefillValuesSchema);
47488
+ const nextYaml = stringify(prefillValuesSchema);
47489
+ if (firstLoadRef.current) {
47490
+ initialPrefillYamlRef.current = nextYaml;
47491
+ latestPrefillYamlRef.current = nextYaml;
47492
+ setYamlData(nextYaml);
47493
+ firstLoadRef.current = false;
47494
+ return;
47495
+ }
47496
+ if (nextYaml !== latestPrefillYamlRef.current) {
47497
+ openNotificationYamlChanged();
47498
+ }
47499
+ latestPrefillYamlRef.current = nextYaml;
47500
+ }, [prefillValuesSchema, openNotificationYamlChanged]);
46121
47501
  const onSubmit = () => {
46122
47502
  setIsLoading(true);
46123
47503
  setError(void 0);
@@ -46189,7 +47569,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
46189
47569
  ) }),
46190
47570
  !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.ControlsRowContainer, { $bgColor: token.colorPrimaryBg, $designNewLayout: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: designNewLayout ? 10 : 16, align: "center", children: [
46191
47571
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
46192
- backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: () => navigate(backlink), children: "Cancel" })
47572
+ backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: () => navigate(backlink), children: "Cancel" }),
47573
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: handleReload, children: "Reload" })
46193
47574
  ] }) }),
46194
47575
  error && /* @__PURE__ */ jsxRuntimeExports.jsxs(
46195
47576
  antd.Modal,
@@ -49282,7 +50663,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49282
50663
  ] });
49283
50664
  };
49284
50665
 
49285
- const BlackholeFormDataProvider = ({
50666
+ const BlackholeFormProvider = ({
49286
50667
  theme,
49287
50668
  cluster,
49288
50669
  urlParams,
@@ -49640,22 +51021,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49640
51021
  }
49641
51022
  return `/${baseprefix}/${clusterName}/${namespace}/forms/builtin/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
49642
51023
  };
49643
- const getListPath = ({
49644
- clusterName,
49645
- namespace,
49646
- type,
49647
- typeName,
49648
- apiGroup,
49649
- apiVersion
49650
- }) => {
49651
- if (type === "crd") {
49652
- return `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${typeName}`;
49653
- }
49654
- if (type === "nonCrd") {
49655
- return `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${typeName}`;
49656
- }
49657
- return `/api/clusters/${clusterName}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${typeName}`;
49658
- };
49659
51024
 
49660
51025
  const CustomCard$4 = styled(antd.Card)`
49661
51026
  position: relative;
@@ -49788,19 +51153,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49788
51153
  apiVersion,
49789
51154
  baseprefix
49790
51155
  });
49791
- const listUrl = addedMode && type !== "direct" ? getListPath({
49792
- clusterName,
51156
+ const { data: k8sList, error: k8sListError } = useK8sSmartResource({
51157
+ cluster: clusterName || "",
49793
51158
  namespace,
49794
- type,
49795
- typeName,
49796
- apiGroup,
49797
- apiVersion
49798
- }) : void 0;
49799
- const { data: k8sList, error: k8sListError } = useDirectUnknownResource({
49800
- uri: listUrl || "",
49801
- queryKey: [listUrl || ""],
49802
- refetchInterval: false,
49803
- isEnabled: addedMode && listUrl !== void 0
51159
+ group: apiGroup,
51160
+ version: apiVersion || "",
51161
+ plural: type,
51162
+ isEnabled: Boolean(apiVersion && addedMode && type !== "direct")
49804
51163
  });
49805
51164
  if (addedMode && (k8sListError || type === "direct") && !showZeroResources) {
49806
51165
  return null;
@@ -49934,11 +51293,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49934
51293
  data: marketplacePanels,
49935
51294
  isLoading,
49936
51295
  error
49937
- } = useDirectUnknownResource({
49938
- uri: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}/`,
49939
- refetchInterval: 5e3,
49940
- queryKey: ["marketplacePanels", clusterName || "no-cluster"],
49941
- isEnabled: clusterName !== void 0
51296
+ } = useK8sSmartResource({
51297
+ cluster: clusterName || "",
51298
+ group: baseApiGroup,
51299
+ version: baseApiVersion,
51300
+ plural: mpResourceName,
51301
+ isEnabled: Boolean(clusterName !== void 0)
49942
51302
  });
49943
51303
  const createPermission = usePermissions({
49944
51304
  group: baseApiGroup,
@@ -50242,22 +51602,26 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50242
51602
  data: marketplacePanels,
50243
51603
  isLoading: marketplaceIsLoading
50244
51604
  // error: marketplaceError,
50245
- } = useDirectUnknownResource({
50246
- uri: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}/`,
50247
- refetchInterval: 5e3,
50248
- queryKey: ["marketplacePanels", clusterName || "no-cluster"],
50249
- isEnabled: clusterName !== void 0
51605
+ } = useK8sSmartResource({
51606
+ cluster: clusterName || "",
51607
+ group: baseApiGroup,
51608
+ version: baseApiVersion,
51609
+ plural: mpResourceName,
51610
+ isEnabled: Boolean(clusterName !== void 0)
50250
51611
  });
50251
51612
  const {
50252
- data: project,
51613
+ data: projectArr,
50253
51614
  isLoading,
50254
51615
  error
50255
- } = useDirectUnknownResource({
50256
- uri: `/api/clusters/${clusterName}/k8s/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectResourceName}/${namespace}`,
50257
- refetchInterval: 5e3,
50258
- queryKey: ["projects", clusterName || "no-cluster"],
50259
- isEnabled: clusterName !== void 0
51616
+ } = useK8sSmartResource({
51617
+ cluster: clusterName || "",
51618
+ group: baseProjectApiGroup,
51619
+ version: baseProjectVersion,
51620
+ plural: projectResourceName,
51621
+ fieldSelector: `metadata.name=${namespace}`,
51622
+ isEnabled: Boolean(clusterName !== void 0)
50260
51623
  });
51624
+ const project = projectArr && projectArr.items && projectArr.items.length > 0 ? projectArr.items[0] : void 0;
50261
51625
  const [isDeleteModalOpen, setIsDeleteModalOpen] = K.useState(false);
50262
51626
  const updatePermission = usePermissions({
50263
51627
  group: baseProjectApiGroup,
@@ -51563,77 +52927,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51563
52927
  );
51564
52928
  };
51565
52929
 
51566
- const getKinds = async ({ clusterName }) => {
51567
- const result = await axios.get(`/api/clusters/${clusterName}/openapi-bff/search/kinds/getKinds`);
51568
- return result.data;
51569
- };
51570
-
51571
- const parseK8sVersion$1 = (raw) => {
51572
- const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
51573
- if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
51574
- const stage = (m.groups.stage ?? "").toLowerCase();
51575
- const major = Number(m.groups.major);
51576
- const stageNum = m.groups.stageNum ? Number(m.groups.stageNum) : 0;
51577
- const rank = stage === "" ? 3 : stage === "beta" ? 2 : 1;
51578
- return { rank, major, stageNum };
51579
- };
51580
- const versionToken$1 = (e) => e.version || (e.groupVersion?.split("/").pop() ?? "");
51581
- const compareK8sVersionDesc$1 = (a, b) => {
51582
- const pa = parseK8sVersion$1(versionToken$1(a));
51583
- const pb = parseK8sVersion$1(versionToken$1(b));
51584
- return pb.rank - pa.rank || pb.major - pa.major || pb.stageNum - pa.stageNum;
51585
- };
51586
- const orderVersions = (versions) => {
51587
- const preferredIdx = versions.findIndex((v) => v.preferred === true);
51588
- if (preferredIdx >= 0) {
51589
- const preferred = versions[preferredIdx];
51590
- const rest = versions.filter((_, i) => i !== preferredIdx).slice().sort(compareK8sVersionDesc$1);
51591
- return [preferred, ...rest];
51592
- }
51593
- return versions.slice().sort(compareK8sVersionDesc$1);
51594
- };
51595
- const getSortedKindsAll = (index) => {
51596
- const counts = index.items.reduce(
51597
- (acc, item) => ({ ...acc, [item.kind]: (acc[item.kind] ?? 0) + 1 }),
51598
- {}
51599
- );
51600
- const rows = index.items.flatMap((item) => {
51601
- const ordered = orderVersions(item.versions);
51602
- return ordered.map((v) => ({
51603
- group: item.group,
51604
- kind: item.kind,
51605
- // clone to drop Readonly<> without changing fields (incl. preferred)
51606
- version: { ...v },
51607
- ...counts[item.kind] > 1 ? { notUnique: true } : {}
51608
- }));
51609
- });
51610
- return rows.sort(
51611
- (a, b) => a.kind.localeCompare(b.kind, void 0, { sensitivity: "base" }) || a.group.localeCompare(b.group, void 0, { sensitivity: "base" })
51612
- );
51613
- };
51614
-
51615
- const parseApiVersion = (apiVersion) => {
51616
- const parts = apiVersion.trim().split("/");
51617
- return parts.length === 1 ? { group: "", version: parts[0] } : { group: parts[0], version: parts[1] };
51618
- };
51619
- const pluralByKind = (entries) => (kind, apiVersion) => {
51620
- const norm = (s) => s.trim();
51621
- const kindNorm = norm(kind);
51622
- const gv = apiVersion ? parseApiVersion(apiVersion) : void 0;
51623
- const candidates = entries.filter((e) => norm(e.kind) === kindNorm);
51624
- if (candidates.length === 0) return void 0;
51625
- const filtered = gv ? candidates.filter((e) => norm(e.group) === norm(gv.group) && e.version.version === gv.version) : candidates;
51626
- if (filtered.length === 0) return void 0;
51627
- const preferredFirst = gv ? filtered : [...filtered.filter((e) => e.version.preferred), ...filtered.filter((e) => !e.version.preferred)];
51628
- const resources = preferredFirst.map((e) => e.version.resource).filter(Boolean);
51629
- const uniq = Array.from(new Set(resources));
51630
- if (!gv && uniq.length > 1) {
51631
- const first = preferredFirst[0]?.version.resource;
51632
- return first ?? void 0;
51633
- }
51634
- return uniq.length === 1 ? uniq[0] : void 0;
51635
- };
51636
-
51637
52930
  const eventKey = (e) => {
51638
52931
  const n = e.metadata?.name ?? "";
51639
52932
  const ns = e.metadata?.namespace ?? "";
@@ -51703,39 +52996,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51703
52996
  }
51704
52997
  return new Date(iso).toLocaleString();
51705
52998
  };
51706
- const getResourceLink = ({
51707
- baseprefix,
51708
- cluster,
51709
- namespace,
51710
- apiGroupVersion,
51711
- pluralName,
51712
- name,
51713
- baseFactoryNamespacedAPIKey,
51714
- baseFactoryClusterSceopedAPIKey,
51715
- baseFactoryNamespacedBuiltinKey,
51716
- baseFactoryClusterSceopedBuiltinKey
51717
- }) => {
51718
- if (!pluralName || !name) {
51719
- return void 0;
51720
- }
51721
- if (apiGroupVersion === "v1") {
51722
- return `${baseprefix}/${cluster}${namespace ? `/${namespace}` : ""}/factory/${namespace ? baseFactoryNamespacedBuiltinKey : baseFactoryClusterSceopedBuiltinKey}/${apiGroupVersion}/${pluralName}/${name}`;
51723
- }
51724
- return `${baseprefix}/${cluster}${namespace ? `/${namespace}` : ""}/factory/${namespace ? baseFactoryNamespacedAPIKey : baseFactoryClusterSceopedAPIKey}/${apiGroupVersion}/${pluralName}/${name}`;
51725
- };
51726
- const getNamespaceLink = ({
51727
- baseprefix,
51728
- cluster,
51729
- apiGroupVersion,
51730
- pluralName,
51731
- namespace,
51732
- baseNamespaceFactoryKey
51733
- }) => {
51734
- if (!namespace) {
51735
- return void 0;
51736
- }
51737
- return `${baseprefix}/${cluster}/factory/${baseNamespaceFactoryKey}/${apiGroupVersion}/${pluralName}/${namespace}`;
51738
- };
51739
52999
  const formatEventSummary = (event) => {
51740
53000
  if (!event.deprecatedCount || !event.deprecatedFirstTimestamp) {
51741
53001
  return void 0;
@@ -51814,28 +53074,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51814
53074
  baseFactoryClusterSceopedAPIKey,
51815
53075
  baseFactoryNamespacedBuiltinKey,
51816
53076
  baseFactoryClusterSceopedBuiltinKey,
51817
- baseNamespaceFactoryKey
53077
+ baseNamespaceFactoryKey,
53078
+ baseFactoriesMapping
51818
53079
  }) => {
51819
53080
  const { token } = antd.theme.useToken();
51820
53081
  const navigate = reactRouterDom.useNavigate();
51821
- const abbr = e.regarding?.kind ? getUppercase(e.regarding.kind) : void 0;
51822
- const bgColor = e.regarding?.kind && abbr ? hslFromString(e.regarding?.kind, theme) : "initial";
51823
53082
  const bgColorNamespace = hslFromString("Namespace", theme);
51824
- const regardingKind = e.regarding?.kind;
51825
- const regardingApiVersion = e.regarding?.apiVersion || "v1";
51826
- const pluralName = regardingKind && regardingApiVersion ? getPlural?.(regardingKind, regardingApiVersion) : void 0;
51827
- const resourceLink = getResourceLink({
51828
- baseprefix,
51829
- cluster,
51830
- namespace: e.regarding?.namespace,
51831
- apiGroupVersion: regardingApiVersion,
51832
- pluralName,
51833
- name: e.regarding?.name,
51834
- baseFactoryNamespacedAPIKey,
51835
- baseFactoryClusterSceopedAPIKey,
51836
- baseFactoryNamespacedBuiltinKey,
51837
- baseFactoryClusterSceopedBuiltinKey
51838
- });
51839
53083
  const namespaceLink = getNamespaceLink({
51840
53084
  baseprefix,
51841
53085
  cluster,
@@ -51852,19 +53096,24 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51852
53096
  children: [
51853
53097
  /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { justify: "space-between", align: "center", children: [
51854
53098
  /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 16, children: [
51855
- /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 8, children: [
51856
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$1.Abbr, { $bgColor: bgColor, children: abbr }),
51857
- resourceLink ? /* @__PURE__ */ jsxRuntimeExports.jsx(
51858
- antd.Typography.Link,
51859
- {
51860
- onClick: (e2) => {
51861
- e2.preventDefault();
51862
- navigate(resourceLink);
51863
- },
51864
- children: e.regarding?.name
51865
- }
51866
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { children: e.regarding?.name })
51867
- ] }),
53099
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
53100
+ ResourceLink,
53101
+ {
53102
+ kind: e.regarding?.kind,
53103
+ apiVersion: e.regarding?.apiVersion || "v1",
53104
+ namespace: e.regarding?.namespace,
53105
+ name: e.regarding?.name,
53106
+ theme,
53107
+ baseprefix,
53108
+ cluster,
53109
+ getPlural,
53110
+ baseFactoryNamespacedAPIKey,
53111
+ baseFactoryClusterSceopedAPIKey,
53112
+ baseFactoryNamespacedBuiltinKey,
53113
+ baseFactoryClusterSceopedBuiltinKey,
53114
+ baseFactoriesMapping
53115
+ }
53116
+ ),
51868
53117
  e.regarding?.namespace && /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 8, children: [
51869
53118
  /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$1.Abbr, { $bgColor: bgColorNamespace, children: "NS" }),
51870
53119
  namespaceLink ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -51994,7 +53243,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51994
53243
  baseFactoryClusterSceopedAPIKey,
51995
53244
  baseFactoryNamespacedBuiltinKey,
51996
53245
  baseFactoryClusterSceopedBuiltinKey,
51997
- baseNamespaceFactoryKey
53246
+ baseNamespaceFactoryKey,
53247
+ baseNavigationPluralName,
53248
+ baseNavigationSpecificName
51998
53249
  }) => {
51999
53250
  const { token } = antd.theme.useToken();
52000
53251
  const [kindIndex, setKindIndex] = K.useState();
@@ -52007,6 +53258,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52007
53258
  console.error(error);
52008
53259
  });
52009
53260
  }, [cluster]);
53261
+ const { data: navigationDataArr } = useK8sSmartResource({
53262
+ cluster,
53263
+ group: "front.in-cloud.io",
53264
+ version: "v1alpha1",
53265
+ plural: baseNavigationPluralName,
53266
+ fieldSelector: `metadata.name=${baseNavigationSpecificName}`
53267
+ });
52010
53268
  const [isPaused, setIsPaused] = K.useState(false);
52011
53269
  const pausedRef = K.useRef(isPaused);
52012
53270
  K.useEffect(() => {
@@ -52219,6 +53477,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52219
53477
  }, [hasMore, sendScroll]);
52220
53478
  const total = state.order.length;
52221
53479
  const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
53480
+ const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
52222
53481
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Root, { $substractHeight: substractHeight || 340, children: [
52223
53482
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Header, { children: [
52224
53483
  /* @__PURE__ */ jsxRuntimeExports.jsx(Styled.HeaderLeftSide, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { justify: "start", align: "center", gap: 10, children: [
@@ -52279,7 +53538,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52279
53538
  baseFactoryClusterSceopedAPIKey,
52280
53539
  baseFactoryNamespacedBuiltinKey,
52281
53540
  baseFactoryClusterSceopedBuiltinKey,
52282
- baseNamespaceFactoryKey
53541
+ baseNamespaceFactoryKey,
53542
+ baseFactoriesMapping
52283
53543
  },
52284
53544
  k
52285
53545
  )) : /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Empty, { description: "No events" }),
@@ -52478,6 +53738,34 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52478
53738
  }
52479
53739
  };
52480
53740
 
53741
+ const arraysEqual = (arr1, arr2) => {
53742
+ if (arr1.length !== arr2.length) {
53743
+ return false;
53744
+ }
53745
+ for (let i = 0; i < arr1.length; i++) {
53746
+ if (typeof arr2[i] === "number") {
53747
+ if (arr1[i] !== String(arr2[i])) {
53748
+ return false;
53749
+ }
53750
+ }
53751
+ if (arr1[i] !== arr2[i]) {
53752
+ return false;
53753
+ }
53754
+ }
53755
+ return true;
53756
+ };
53757
+ const includesArray = (matrix, target) => {
53758
+ if (!matrix) {
53759
+ return false;
53760
+ }
53761
+ for (const row of matrix) {
53762
+ if (arraysEqual(row, target)) {
53763
+ return true;
53764
+ }
53765
+ }
53766
+ return false;
53767
+ };
53768
+
52481
53769
  const getClusterList = async () => {
52482
53770
  return axios.get("/clusterlist");
52483
53771
  };
@@ -52899,9 +54187,22 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52899
54187
  });
52900
54188
  };
52901
54189
 
54190
+ const useInfiniteSentinel = (sentinelRef, hasMore, onNeedMore) => {
54191
+ K.useEffect(() => {
54192
+ const el = sentinelRef.current;
54193
+ if (!el) return void 0;
54194
+ const io = new IntersectionObserver((entries) => {
54195
+ const visible = entries.some((e) => e.isIntersecting);
54196
+ if (visible && hasMore) onNeedMore();
54197
+ });
54198
+ io.observe(el);
54199
+ return () => io.disconnect();
54200
+ }, [sentinelRef, hasMore, onNeedMore]);
54201
+ };
54202
+
52902
54203
  exports.BackToDefaultIcon = BackToDefaultIcon;
52903
54204
  exports.BlackholeForm = BlackholeForm;
52904
- exports.BlackholeFormDataProvider = BlackholeFormDataProvider;
54205
+ exports.BlackholeFormProvider = BlackholeFormProvider;
52905
54206
  exports.ContentCard = ContentCard$1;
52906
54207
  exports.CursorDefaultDiv = CursorDefaultDiv;
52907
54208
  exports.CursorPointerTag = CursorPointerTag;
@@ -52923,9 +54224,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52923
54224
  exports.LockedIcon = LockedIcon;
52924
54225
  exports.LookingGlassIcon = LookingGlassIcon;
52925
54226
  exports.ManageableBreadcrumbs = ManageableBreadcrumbs;
52926
- exports.ManageableBreadcrumbsWithDataProvider = ManageableBreadcrumbsWithDataProvider;
54227
+ exports.ManageableBreadcrumbsProvider = ManageableBreadcrumbsProvider;
52927
54228
  exports.ManageableSidebar = ManageableSidebar;
52928
- exports.ManageableSidebarWithDataProvider = ManageableSidebarWithDataProvider;
54229
+ exports.ManageableSidebarProvider = ManageableSidebarProvider;
52929
54230
  exports.MarketPlace = MarketPlace;
52930
54231
  exports.MarketplaceCard = MarketplaceCard;
52931
54232
  exports.MinusIcon = MinusIcon;
@@ -52937,6 +54238,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52937
54238
  exports.PodLogsMonaco = PodLogsMonaco;
52938
54239
  exports.PodTerminal = PodTerminal;
52939
54240
  exports.ProjectInfoCard = ProjectInfoCard;
54241
+ exports.ResourceLink = ResourceLink;
52940
54242
  exports.ResumeCircleIcon = ResumeCircleIcon;
52941
54243
  exports.Search = Search;
52942
54244
  exports.Spacer = Spacer$1;
@@ -52963,7 +54265,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52963
54265
  exports.getApiResourceTypes = getApiResourceTypes;
52964
54266
  exports.getApiResourceTypesByApiGroup = getApiResourceTypesByApiGroup;
52965
54267
  exports.getApiResources = getApiResources;
52966
- exports.getBackLinkToTable = getBackLinkToTable;
52967
54268
  exports.getBuiltinResourceSingle = getBuiltinResourceSingle;
52968
54269
  exports.getBuiltinResourceTypes = getBuiltinResourceTypes;
52969
54270
  exports.getBuiltinResources = getBuiltinResources;
@@ -52980,8 +54281,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52980
54281
  exports.getLinkToApiForm = getLinkToApiForm;
52981
54282
  exports.getLinkToBuiltinForm = getLinkToBuiltinForm;
52982
54283
  exports.getLinkToForm = getLinkToForm;
54284
+ exports.getNamespaceLink = getNamespaceLink;
52983
54285
  exports.getObjectFormItemsDraft = getObjectFormItemsDraft;
52984
54286
  exports.getPrefixSubarrays = getPrefixSubarrays;
54287
+ exports.getResourceLink = getResourceLink;
52985
54288
  exports.getSortedKinds = getSortedKinds;
52986
54289
  exports.getSortedKindsAll = getSortedKindsAll;
52987
54290
  exports.getStringByName = getStringByName;
@@ -52989,6 +54292,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52989
54292
  exports.getUppercase = getUppercase;
52990
54293
  exports.groupsToTreeData = groupsToTreeData;
52991
54294
  exports.hslFromString = hslFromString;
54295
+ exports.includesArray = includesArray;
52992
54296
  exports.isFlatObject = isFlatObject;
52993
54297
  exports.isMultilineFromYaml = isMultilineFromYaml;
52994
54298
  exports.isMultilineString = isMultilineString;
@@ -53016,6 +54320,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53016
54320
  exports.useCrdResourceSingle = useCrdResourceSingle;
53017
54321
  exports.useCrdResources = useCrdResources;
53018
54322
  exports.useDirectUnknownResource = useDirectUnknownResource;
54323
+ exports.useInfiniteSentinel = useInfiniteSentinel;
54324
+ exports.useK8sSmartResource = useK8sSmartResource;
54325
+ exports.useK8sVerbs = useK8sVerbs;
54326
+ exports.useListWatch = useListWatch;
53019
54327
  exports.usePermissions = usePermissions;
53020
54328
 
53021
54329
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });