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