@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.6 → 1.4.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-DclFY72w.mjs → index-DGEm7Wqt.mjs} +586 -338
- package/dist/index-DGEm7Wqt.mjs.map +1 -0
- package/dist/{index-eI1hWaeQ.mjs → index-DPPcb4Gw.mjs} +2 -2
- package/dist/{index-eI1hWaeQ.mjs.map → index-DPPcb4Gw.mjs.map} +1 -1
- package/dist/openapi-k8s-toolkit.es.js +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +583 -335
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/BlackholeForm/molecules/helpers/validation.d.ts +6 -0
- package/dist/types/components/molecules/BlackholeForm/molecules/helpers/validation.test.d.ts +1 -0
- package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/ManageableSidebarProvider.d.ts +1 -0
- package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/types.d.ts +10 -0
- package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/utils.d.ts +23 -1
- package/dist/types/components/molecules/MarketPlace/MarketPlace.d.ts +1 -1
- package/dist/types/components/organisms/DynamicComponents/types/MarketplaceCard.d.ts +1 -1
- package/dist/types/localTypes/bff/form.d.ts +2 -0
- package/package.json +1 -1
- package/dist/index-DclFY72w.mjs.map +0 -1
|
@@ -3,7 +3,7 @@ import * as React$1 from 'react';
|
|
|
3
3
|
import React__default, { useState, useRef, useLayoutEffect, useReducer, useEffect, useCallback, useMemo, Fragment, createContext, useContext, memo, createElement, isValidElement, cloneElement, useInsertionEffect, useSyncExternalStore, forwardRef, useImperativeHandle, PureComponent, Children, Component, lazy, Suspense } from 'react';
|
|
4
4
|
import { Input, Tree, Modal, Alert, theme, Select, Tag, Flex, Typography, Breadcrumb, Spin, Menu, Tooltip as Tooltip$1, Space, Button, Card as Card$2, Row, Col, Tabs, notification, Form, Popover, Switch, Segmented, Table, Progress, Statistic, message, Dropdown, Slider, InputNumber, Result, DatePicker, Radio, Checkbox, Empty } from 'antd';
|
|
5
5
|
import * as AntIcons from '@ant-design/icons';
|
|
6
|
-
import { LoadingOutlined, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled, PlusOutlined, ClearOutlined, MinusOutlined, CaretDownOutlined, CaretRightOutlined, InfoCircleOutlined, SearchOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined, WarningOutlined, MoreOutlined, DownOutlined, CheckOutlined, CloseOutlined, BugOutlined, EllipsisOutlined, PoweroffOutlined, FullscreenExitOutlined, FullscreenOutlined, SettingOutlined, ReloadOutlined } from '@ant-design/icons';
|
|
6
|
+
import { LoadingOutlined, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled, PlusOutlined, ClearOutlined, MinusOutlined, CaretDownOutlined, CaretRightOutlined, InfoCircleOutlined, SearchOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined, WarningOutlined, MoreOutlined, DownOutlined, CheckOutlined, CloseOutlined, QuestionCircleOutlined, BugOutlined, EllipsisOutlined, PoweroffOutlined, FullscreenExitOutlined, FullscreenOutlined, SettingOutlined, ReloadOutlined } from '@ant-design/icons';
|
|
7
7
|
import { useNavigate, useSearchParams, Link, useLocation, useParams } from 'react-router-dom';
|
|
8
8
|
import { useQuery, useQueries, useQueryClient } from '@tanstack/react-query';
|
|
9
9
|
import RFB from 'novnc-next';
|
|
@@ -9760,178 +9760,6 @@ const ManageableSidebar = ({ data, noMarginTop }) => {
|
|
|
9760
9760
|
);
|
|
9761
9761
|
};
|
|
9762
9762
|
|
|
9763
|
-
const getLabel$1 = ({
|
|
9764
|
-
preparedLink,
|
|
9765
|
-
label,
|
|
9766
|
-
key,
|
|
9767
|
-
externalKeys,
|
|
9768
|
-
replaceValues
|
|
9769
|
-
}) => {
|
|
9770
|
-
const preparedLabel = prepareTemplate({ template: label, replaceValues });
|
|
9771
|
-
if (preparedLink) {
|
|
9772
|
-
if (externalKeys && externalKeys.includes(key)) {
|
|
9773
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9774
|
-
"a",
|
|
9775
|
-
{
|
|
9776
|
-
onClick: (e) => {
|
|
9777
|
-
e.preventDefault();
|
|
9778
|
-
e.stopPropagation();
|
|
9779
|
-
const url = preparedLink.startsWith("/") ? `${window.location.origin}${preparedLink}` : preparedLink;
|
|
9780
|
-
window.open(url);
|
|
9781
|
-
},
|
|
9782
|
-
children: preparedLabel
|
|
9783
|
-
}
|
|
9784
|
-
);
|
|
9785
|
-
}
|
|
9786
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: preparedLink, children: preparedLabel });
|
|
9787
|
-
}
|
|
9788
|
-
return preparedLabel;
|
|
9789
|
-
};
|
|
9790
|
-
const mapLinksFromRaw = ({
|
|
9791
|
-
rawLinks,
|
|
9792
|
-
replaceValues,
|
|
9793
|
-
externalKeys
|
|
9794
|
-
}) => {
|
|
9795
|
-
return rawLinks.map(({ key, label, link, children }) => {
|
|
9796
|
-
const preparedLink = link ? prepareTemplate({ template: link, replaceValues }) : void 0;
|
|
9797
|
-
return {
|
|
9798
|
-
key,
|
|
9799
|
-
label: getLabel$1({ preparedLink, label, key, externalKeys, replaceValues }),
|
|
9800
|
-
internalMetaLink: preparedLink,
|
|
9801
|
-
children: children ? mapLinksFromRaw({
|
|
9802
|
-
rawLinks: children,
|
|
9803
|
-
replaceValues,
|
|
9804
|
-
externalKeys
|
|
9805
|
-
}) : void 0
|
|
9806
|
-
};
|
|
9807
|
-
});
|
|
9808
|
-
};
|
|
9809
|
-
const findMatchingItems = ({
|
|
9810
|
-
items,
|
|
9811
|
-
pathname,
|
|
9812
|
-
searchParams,
|
|
9813
|
-
tags
|
|
9814
|
-
}) => {
|
|
9815
|
-
const normalizePath = (value) => {
|
|
9816
|
-
if (!value) {
|
|
9817
|
-
return void 0;
|
|
9818
|
-
}
|
|
9819
|
-
return value.startsWith("/") ? value.slice(1) : value;
|
|
9820
|
-
};
|
|
9821
|
-
const traverse = (nodes, parents) => nodes.flatMap((node) => {
|
|
9822
|
-
const currentPath = [...parents, node.key ? node.key : String(node.key)];
|
|
9823
|
-
const cleanNodeInternalMetaLink = normalizePath(node.internalMetaLink);
|
|
9824
|
-
const cleanPathname = normalizePath(pathname.split("?")[0]);
|
|
9825
|
-
let searchSuffix;
|
|
9826
|
-
if (searchParams && searchParams.length > 0) {
|
|
9827
|
-
searchSuffix = searchParams.startsWith("?") ? searchParams : `?${searchParams}`;
|
|
9828
|
-
}
|
|
9829
|
-
let pathnameWithSearch;
|
|
9830
|
-
if (searchSuffix) {
|
|
9831
|
-
pathnameWithSearch = `${pathname}${searchSuffix}`;
|
|
9832
|
-
} else if (pathname.includes("?")) {
|
|
9833
|
-
pathnameWithSearch = pathname;
|
|
9834
|
-
}
|
|
9835
|
-
const cleanPathnameWithSearch = normalizePath(pathnameWithSearch);
|
|
9836
|
-
const matched = cleanNodeInternalMetaLink === cleanPathname || cleanPathnameWithSearch && cleanNodeInternalMetaLink === cleanPathnameWithSearch ? currentPath : [];
|
|
9837
|
-
const tagsToMatch = tags && tags.keysAndTags && node.key ? tags.keysAndTags[typeof node.key === "string" ? node.key : String(node.key)] : void 0;
|
|
9838
|
-
const matchedByTags = tags && tags.currentTags && tagsToMatch && tagsToMatch.some((tag) => tags.currentTags?.includes(tag)) ? currentPath : [];
|
|
9839
|
-
let childrenResults = [];
|
|
9840
|
-
if ("children" in node && node.children) {
|
|
9841
|
-
childrenResults = traverse(node.children, currentPath);
|
|
9842
|
-
}
|
|
9843
|
-
return [...matched, ...matchedByTags, ...childrenResults];
|
|
9844
|
-
});
|
|
9845
|
-
return traverse(items, []);
|
|
9846
|
-
};
|
|
9847
|
-
const prepareDataForManageableSidebar = ({
|
|
9848
|
-
data,
|
|
9849
|
-
replaceValues,
|
|
9850
|
-
pathname,
|
|
9851
|
-
searchParams,
|
|
9852
|
-
idToCompare,
|
|
9853
|
-
fallbackIdToCompare,
|
|
9854
|
-
currentTags
|
|
9855
|
-
}) => {
|
|
9856
|
-
const foundData = data.find((el) => el.id === idToCompare) || (fallbackIdToCompare ? data.find((el) => el.id === fallbackIdToCompare) : void 0);
|
|
9857
|
-
if (!foundData) {
|
|
9858
|
-
return void 0;
|
|
9859
|
-
}
|
|
9860
|
-
const preparedCurrentTags = currentTags && currentTags.length > 0 ? currentTags.map((el) => prepareTemplate({ template: el, replaceValues })) : void 0;
|
|
9861
|
-
const result = {
|
|
9862
|
-
menuItems: mapLinksFromRaw({
|
|
9863
|
-
rawLinks: foundData.menuItems,
|
|
9864
|
-
replaceValues,
|
|
9865
|
-
externalKeys: foundData.externalKeys
|
|
9866
|
-
})
|
|
9867
|
-
};
|
|
9868
|
-
const openedKeys = result?.menuItems ? findMatchingItems({
|
|
9869
|
-
items: result?.menuItems,
|
|
9870
|
-
pathname,
|
|
9871
|
-
searchParams,
|
|
9872
|
-
tags: { keysAndTags: foundData.keysAndTags, currentTags: preparedCurrentTags }
|
|
9873
|
-
}) : [];
|
|
9874
|
-
const stringedOpenedKeys = openedKeys.map((el) => typeof el === "string" ? el : String(el));
|
|
9875
|
-
return { ...result, selectedKeys: stringedOpenedKeys };
|
|
9876
|
-
};
|
|
9877
|
-
|
|
9878
|
-
const ManageableSidebarProvider = ({
|
|
9879
|
-
cluster,
|
|
9880
|
-
apiGroup,
|
|
9881
|
-
apiVersion,
|
|
9882
|
-
plural,
|
|
9883
|
-
isEnabled,
|
|
9884
|
-
replaceValues,
|
|
9885
|
-
pathname,
|
|
9886
|
-
searchParams,
|
|
9887
|
-
idToCompare,
|
|
9888
|
-
fallbackIdToCompare,
|
|
9889
|
-
currentTags,
|
|
9890
|
-
hidden,
|
|
9891
|
-
noMarginTop
|
|
9892
|
-
}) => {
|
|
9893
|
-
const {
|
|
9894
|
-
data: rawData,
|
|
9895
|
-
isError: rawDataError,
|
|
9896
|
-
isLoading: rawDataLoading
|
|
9897
|
-
} = useK8sSmartResource({
|
|
9898
|
-
cluster,
|
|
9899
|
-
apiGroup,
|
|
9900
|
-
apiVersion,
|
|
9901
|
-
plural,
|
|
9902
|
-
isEnabled
|
|
9903
|
-
});
|
|
9904
|
-
if (rawDataError) {
|
|
9905
|
-
return null;
|
|
9906
|
-
}
|
|
9907
|
-
if (rawDataLoading) {
|
|
9908
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {});
|
|
9909
|
-
}
|
|
9910
|
-
if (!rawData) {
|
|
9911
|
-
return null;
|
|
9912
|
-
}
|
|
9913
|
-
if (hidden) {
|
|
9914
|
-
return null;
|
|
9915
|
-
}
|
|
9916
|
-
const parsedData = rawData?.items.map(({ spec }) => spec);
|
|
9917
|
-
if (!parsedData) {
|
|
9918
|
-
return null;
|
|
9919
|
-
}
|
|
9920
|
-
const result = prepareDataForManageableSidebar({
|
|
9921
|
-
data: parsedData,
|
|
9922
|
-
replaceValues,
|
|
9923
|
-
pathname,
|
|
9924
|
-
searchParams,
|
|
9925
|
-
idToCompare,
|
|
9926
|
-
fallbackIdToCompare,
|
|
9927
|
-
currentTags
|
|
9928
|
-
});
|
|
9929
|
-
if (!result) {
|
|
9930
|
-
return null;
|
|
9931
|
-
}
|
|
9932
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableSidebar, { data: result, noMarginTop });
|
|
9933
|
-
};
|
|
9934
|
-
|
|
9935
9763
|
function commonjsRequire(path) {
|
|
9936
9764
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
9937
9765
|
}
|
|
@@ -33947,6 +33775,509 @@ lodash.exports;
|
|
|
33947
33775
|
var lodashExports = lodash.exports;
|
|
33948
33776
|
const _$1 = /*@__PURE__*/getDefaultExportFromCjs(lodashExports);
|
|
33949
33777
|
|
|
33778
|
+
const parsePartsOfUrl = ({
|
|
33779
|
+
template,
|
|
33780
|
+
replaceValues
|
|
33781
|
+
}) => {
|
|
33782
|
+
return prepareTemplate({ template, replaceValues });
|
|
33783
|
+
};
|
|
33784
|
+
const parseMutliqueryText = ({
|
|
33785
|
+
text,
|
|
33786
|
+
multiQueryData,
|
|
33787
|
+
customFallback
|
|
33788
|
+
}) => {
|
|
33789
|
+
if (!text) {
|
|
33790
|
+
return "";
|
|
33791
|
+
}
|
|
33792
|
+
return text.replace(
|
|
33793
|
+
/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\](?:\[\s*['"]([^'"]+)['"]\s*\])?\}/g,
|
|
33794
|
+
(_match, reqIndexStr, rawPath, fallback) => {
|
|
33795
|
+
try {
|
|
33796
|
+
const reqIndex = parseInt(reqIndexStr, 10);
|
|
33797
|
+
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
33798
|
+
(m) => m[1]
|
|
33799
|
+
);
|
|
33800
|
+
const value = _$1.get(multiQueryData[`req${reqIndex}`] || {}, path, fallback !== void 0 ? fallback : void 0);
|
|
33801
|
+
if (value == null && !customFallback) {
|
|
33802
|
+
return fallback ?? "Undefined with no fallback";
|
|
33803
|
+
}
|
|
33804
|
+
if (customFallback && (value === void 0 || value === null)) {
|
|
33805
|
+
return customFallback;
|
|
33806
|
+
}
|
|
33807
|
+
return String(value);
|
|
33808
|
+
} catch {
|
|
33809
|
+
return _match;
|
|
33810
|
+
}
|
|
33811
|
+
}
|
|
33812
|
+
);
|
|
33813
|
+
};
|
|
33814
|
+
const parseJsonPathTemplate = ({
|
|
33815
|
+
text,
|
|
33816
|
+
multiQueryData,
|
|
33817
|
+
customFallback,
|
|
33818
|
+
replaceValues
|
|
33819
|
+
}) => {
|
|
33820
|
+
if (!text) return "";
|
|
33821
|
+
const placeholderRegex = /\{reqsJsonPath\[(\d+)\]\s*\[\s*(['"])([\s\S]*?)\2\s*\](?:\s*\[\s*(['"])([\s\S]*?)\4\s*\])?\}/g;
|
|
33822
|
+
const resolve = (input) => input.replace(
|
|
33823
|
+
placeholderRegex,
|
|
33824
|
+
(match, reqIndexStr, _quote, rawJsonPathExpr, _fallbackQuote, inlineFallback = "Undefined with no fallback") => {
|
|
33825
|
+
try {
|
|
33826
|
+
const reqIndex = Number(reqIndexStr);
|
|
33827
|
+
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
33828
|
+
let jsonPathExpr = rawJsonPathExpr;
|
|
33829
|
+
let previous2 = null;
|
|
33830
|
+
let loopGuard = 0;
|
|
33831
|
+
while (previous2 !== jsonPathExpr && loopGuard < 10) {
|
|
33832
|
+
previous2 = jsonPathExpr;
|
|
33833
|
+
jsonPathExpr = resolve(jsonPathExpr);
|
|
33834
|
+
loopGuard++;
|
|
33835
|
+
}
|
|
33836
|
+
if (replaceValues) {
|
|
33837
|
+
jsonPathExpr = prepareTemplate({
|
|
33838
|
+
template: jsonPathExpr,
|
|
33839
|
+
replaceValues
|
|
33840
|
+
});
|
|
33841
|
+
}
|
|
33842
|
+
if (jsonRoot === void 0 && customFallback) return customFallback;
|
|
33843
|
+
if (jsonRoot === void 0) return inlineFallback;
|
|
33844
|
+
const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
|
|
33845
|
+
const value = results?.[0];
|
|
33846
|
+
if (value == null) {
|
|
33847
|
+
return customFallback ?? inlineFallback;
|
|
33848
|
+
}
|
|
33849
|
+
return String(value);
|
|
33850
|
+
} catch {
|
|
33851
|
+
return match;
|
|
33852
|
+
}
|
|
33853
|
+
}
|
|
33854
|
+
);
|
|
33855
|
+
let result = text;
|
|
33856
|
+
let previous = null;
|
|
33857
|
+
let iterations = 0;
|
|
33858
|
+
while (result !== previous && iterations < 10) {
|
|
33859
|
+
previous = result;
|
|
33860
|
+
result = resolve(result);
|
|
33861
|
+
iterations++;
|
|
33862
|
+
}
|
|
33863
|
+
return result;
|
|
33864
|
+
};
|
|
33865
|
+
const parseWithoutPartsOfUrl = ({
|
|
33866
|
+
text,
|
|
33867
|
+
multiQueryData,
|
|
33868
|
+
customFallback
|
|
33869
|
+
}) => {
|
|
33870
|
+
return parseJsonPathTemplate({
|
|
33871
|
+
text: parseMutliqueryText({
|
|
33872
|
+
text,
|
|
33873
|
+
multiQueryData,
|
|
33874
|
+
customFallback
|
|
33875
|
+
}),
|
|
33876
|
+
multiQueryData,
|
|
33877
|
+
customFallback
|
|
33878
|
+
});
|
|
33879
|
+
};
|
|
33880
|
+
const parseAll = ({
|
|
33881
|
+
text,
|
|
33882
|
+
replaceValues,
|
|
33883
|
+
multiQueryData
|
|
33884
|
+
}) => {
|
|
33885
|
+
return parsePartsOfUrl({
|
|
33886
|
+
template: parseJsonPathTemplate({
|
|
33887
|
+
text: parseMutliqueryText({
|
|
33888
|
+
text,
|
|
33889
|
+
multiQueryData
|
|
33890
|
+
}),
|
|
33891
|
+
multiQueryData,
|
|
33892
|
+
replaceValues
|
|
33893
|
+
}),
|
|
33894
|
+
replaceValues
|
|
33895
|
+
});
|
|
33896
|
+
};
|
|
33897
|
+
const parsePromTemplate = ({
|
|
33898
|
+
text,
|
|
33899
|
+
replaceValues,
|
|
33900
|
+
multiQueryData
|
|
33901
|
+
}) => {
|
|
33902
|
+
const parsed = parseJsonPathTemplate({
|
|
33903
|
+
text: parseMutliqueryText({
|
|
33904
|
+
text,
|
|
33905
|
+
multiQueryData
|
|
33906
|
+
}),
|
|
33907
|
+
multiQueryData,
|
|
33908
|
+
replaceValues
|
|
33909
|
+
});
|
|
33910
|
+
return parsed.replace(/\{(\d+)\}/g, (_2, key) => replaceValues[key] || "");
|
|
33911
|
+
};
|
|
33912
|
+
|
|
33913
|
+
const collectLinksWithResourcesList = ({
|
|
33914
|
+
items,
|
|
33915
|
+
parentPath = "",
|
|
33916
|
+
replaceValues,
|
|
33917
|
+
multiQueryData,
|
|
33918
|
+
isEnabled
|
|
33919
|
+
}) => items.flatMap((item) => {
|
|
33920
|
+
const nodePath = parentPath ? `${parentPath}/${item.key}` : item.key;
|
|
33921
|
+
const self = item.resourcesList ? (() => {
|
|
33922
|
+
const clusterPrepared = parseAll({
|
|
33923
|
+
text: item.resourcesList.cluster,
|
|
33924
|
+
replaceValues,
|
|
33925
|
+
multiQueryData
|
|
33926
|
+
});
|
|
33927
|
+
const apiGroupPrepared = item.resourcesList.apiGroup ? parseAll({
|
|
33928
|
+
text: item.resourcesList.apiGroup,
|
|
33929
|
+
replaceValues,
|
|
33930
|
+
multiQueryData
|
|
33931
|
+
}) : void 0;
|
|
33932
|
+
const apiVersionPrepared = parseAll({
|
|
33933
|
+
text: item.resourcesList.apiVersion,
|
|
33934
|
+
replaceValues,
|
|
33935
|
+
multiQueryData
|
|
33936
|
+
});
|
|
33937
|
+
const pluralPrepared = parseAll({
|
|
33938
|
+
text: item.resourcesList.plural,
|
|
33939
|
+
replaceValues,
|
|
33940
|
+
multiQueryData
|
|
33941
|
+
});
|
|
33942
|
+
const namespacePrepared = item.resourcesList.namespace ? parseAll({
|
|
33943
|
+
text: item.resourcesList.namespace,
|
|
33944
|
+
replaceValues,
|
|
33945
|
+
multiQueryData
|
|
33946
|
+
}) : void 0;
|
|
33947
|
+
return [
|
|
33948
|
+
{
|
|
33949
|
+
nodePath,
|
|
33950
|
+
k8sParams: {
|
|
33951
|
+
cluster: clusterPrepared,
|
|
33952
|
+
apiGroup: apiGroupPrepared,
|
|
33953
|
+
apiVersion: apiVersionPrepared,
|
|
33954
|
+
plural: pluralPrepared,
|
|
33955
|
+
namespace: namespacePrepared,
|
|
33956
|
+
isEnabled: Boolean(clusterPrepared && apiVersionPrepared && pluralPrepared && isEnabled !== false)
|
|
33957
|
+
}
|
|
33958
|
+
}
|
|
33959
|
+
];
|
|
33960
|
+
})() : [];
|
|
33961
|
+
const nested = item.children ? collectLinksWithResourcesList({
|
|
33962
|
+
items: item.children,
|
|
33963
|
+
parentPath: nodePath,
|
|
33964
|
+
replaceValues,
|
|
33965
|
+
multiQueryData,
|
|
33966
|
+
isEnabled
|
|
33967
|
+
}) : [];
|
|
33968
|
+
return [...self, ...nested];
|
|
33969
|
+
});
|
|
33970
|
+
const getLabel$1 = ({
|
|
33971
|
+
preparedLink,
|
|
33972
|
+
label,
|
|
33973
|
+
key,
|
|
33974
|
+
externalKeys,
|
|
33975
|
+
replaceValues,
|
|
33976
|
+
multiQueryData
|
|
33977
|
+
}) => {
|
|
33978
|
+
const preparedLabel = parseAll({ text: label, replaceValues, multiQueryData });
|
|
33979
|
+
if (preparedLink) {
|
|
33980
|
+
if (externalKeys && externalKeys.includes(key)) {
|
|
33981
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
33982
|
+
"a",
|
|
33983
|
+
{
|
|
33984
|
+
onClick: (e) => {
|
|
33985
|
+
e.preventDefault();
|
|
33986
|
+
e.stopPropagation();
|
|
33987
|
+
const url = preparedLink.startsWith("/") ? `${window.location.origin}${preparedLink}` : preparedLink;
|
|
33988
|
+
window.open(url);
|
|
33989
|
+
},
|
|
33990
|
+
children: preparedLabel
|
|
33991
|
+
}
|
|
33992
|
+
);
|
|
33993
|
+
}
|
|
33994
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { to: preparedLink, children: preparedLabel });
|
|
33995
|
+
}
|
|
33996
|
+
return preparedLabel;
|
|
33997
|
+
};
|
|
33998
|
+
const mapLinksFromRaw = ({
|
|
33999
|
+
rawLinks,
|
|
34000
|
+
replaceValues,
|
|
34001
|
+
multiQueryData,
|
|
34002
|
+
externalKeys,
|
|
34003
|
+
resourcesListData,
|
|
34004
|
+
parentPath = ""
|
|
34005
|
+
}) => {
|
|
34006
|
+
return rawLinks.map(({ key, label, link, children, resourcesList }) => {
|
|
34007
|
+
const nodePath = parentPath ? `${parentPath}/${key}` : key;
|
|
34008
|
+
const preparedLink = link ? parseAll({ text: link, replaceValues, multiQueryData }) : void 0;
|
|
34009
|
+
const staticChildren = children ? mapLinksFromRaw({
|
|
34010
|
+
rawLinks: children,
|
|
34011
|
+
replaceValues,
|
|
34012
|
+
multiQueryData,
|
|
34013
|
+
externalKeys,
|
|
34014
|
+
resourcesListData,
|
|
34015
|
+
parentPath: nodePath
|
|
34016
|
+
}) : [];
|
|
34017
|
+
const dynamicChildrenRaw = resourcesList ? (resourcesListData?.[nodePath]?.items || []).map((item, index) => {
|
|
34018
|
+
const resourceName = (() => {
|
|
34019
|
+
try {
|
|
34020
|
+
const value = jp.query(item, `$${resourcesList.jsonPathToName}`)[0];
|
|
34021
|
+
return value !== void 0 && value !== null ? String(value) : void 0;
|
|
34022
|
+
} catch {
|
|
34023
|
+
return void 0;
|
|
34024
|
+
}
|
|
34025
|
+
})();
|
|
34026
|
+
if (!resourceName) {
|
|
34027
|
+
return void 0;
|
|
34028
|
+
}
|
|
34029
|
+
const childLink = parseAll({
|
|
34030
|
+
text: resourcesList.linkToResource,
|
|
34031
|
+
replaceValues: { ...replaceValues, resourceName },
|
|
34032
|
+
multiQueryData
|
|
34033
|
+
});
|
|
34034
|
+
const childKey = `${key}-${resourceName}-${index}`;
|
|
34035
|
+
return {
|
|
34036
|
+
key: childKey,
|
|
34037
|
+
label: getLabel$1({
|
|
34038
|
+
preparedLink: childLink,
|
|
34039
|
+
label: resourceName,
|
|
34040
|
+
key: childKey,
|
|
34041
|
+
externalKeys,
|
|
34042
|
+
replaceValues,
|
|
34043
|
+
multiQueryData
|
|
34044
|
+
}),
|
|
34045
|
+
internalMetaLink: childLink
|
|
34046
|
+
};
|
|
34047
|
+
}).filter(Boolean) : [];
|
|
34048
|
+
const dynamicChildren = dynamicChildrenRaw;
|
|
34049
|
+
const mergedChildren = [...staticChildren, ...dynamicChildren];
|
|
34050
|
+
return {
|
|
34051
|
+
key,
|
|
34052
|
+
label: getLabel$1({ preparedLink, label, key, externalKeys, replaceValues, multiQueryData }),
|
|
34053
|
+
internalMetaLink: preparedLink,
|
|
34054
|
+
children: mergedChildren.length > 0 ? mergedChildren : void 0
|
|
34055
|
+
};
|
|
34056
|
+
});
|
|
34057
|
+
};
|
|
34058
|
+
const findMatchingItems = ({
|
|
34059
|
+
items,
|
|
34060
|
+
pathname,
|
|
34061
|
+
searchParams,
|
|
34062
|
+
tags
|
|
34063
|
+
}) => {
|
|
34064
|
+
const normalizePath = (value) => {
|
|
34065
|
+
if (!value) {
|
|
34066
|
+
return void 0;
|
|
34067
|
+
}
|
|
34068
|
+
return value.startsWith("/") ? value.slice(1) : value;
|
|
34069
|
+
};
|
|
34070
|
+
const traverse = (nodes, parents) => nodes.flatMap((node) => {
|
|
34071
|
+
const currentPath = [...parents, node.key ? node.key : String(node.key)];
|
|
34072
|
+
const cleanNodeInternalMetaLink = normalizePath(node.internalMetaLink);
|
|
34073
|
+
const cleanPathname = normalizePath(pathname.split("?")[0]);
|
|
34074
|
+
let searchSuffix;
|
|
34075
|
+
if (searchParams && searchParams.length > 0) {
|
|
34076
|
+
searchSuffix = searchParams.startsWith("?") ? searchParams : `?${searchParams}`;
|
|
34077
|
+
}
|
|
34078
|
+
let pathnameWithSearch;
|
|
34079
|
+
if (searchSuffix) {
|
|
34080
|
+
pathnameWithSearch = `${pathname}${searchSuffix}`;
|
|
34081
|
+
} else if (pathname.includes("?")) {
|
|
34082
|
+
pathnameWithSearch = pathname;
|
|
34083
|
+
}
|
|
34084
|
+
const cleanPathnameWithSearch = normalizePath(pathnameWithSearch);
|
|
34085
|
+
const matched = cleanNodeInternalMetaLink === cleanPathname || cleanPathnameWithSearch && cleanNodeInternalMetaLink === cleanPathnameWithSearch ? currentPath : [];
|
|
34086
|
+
const tagsToMatch = tags && tags.keysAndTags && node.key ? tags.keysAndTags[typeof node.key === "string" ? node.key : String(node.key)] : void 0;
|
|
34087
|
+
const matchedByTags = tags && tags.currentTags && tagsToMatch && tagsToMatch.some((tag) => tags.currentTags?.includes(tag)) ? currentPath : [];
|
|
34088
|
+
let childrenResults = [];
|
|
34089
|
+
if ("children" in node && node.children) {
|
|
34090
|
+
childrenResults = traverse(node.children, currentPath);
|
|
34091
|
+
}
|
|
34092
|
+
return [...matched, ...matchedByTags, ...childrenResults];
|
|
34093
|
+
});
|
|
34094
|
+
return traverse(items, []);
|
|
34095
|
+
};
|
|
34096
|
+
const stripInternalMetaFromItems = (items) => items.map((item) => {
|
|
34097
|
+
if (!item) {
|
|
34098
|
+
return item;
|
|
34099
|
+
}
|
|
34100
|
+
const rest = { ...item };
|
|
34101
|
+
delete rest.internalMetaLink;
|
|
34102
|
+
if ("children" in rest && Array.isArray(rest.children)) {
|
|
34103
|
+
return {
|
|
34104
|
+
...rest,
|
|
34105
|
+
children: stripInternalMetaFromItems(rest.children)
|
|
34106
|
+
};
|
|
34107
|
+
}
|
|
34108
|
+
return rest;
|
|
34109
|
+
});
|
|
34110
|
+
const prepareDataForManageableSidebar = ({
|
|
34111
|
+
data,
|
|
34112
|
+
replaceValues,
|
|
34113
|
+
multiQueryData = {},
|
|
34114
|
+
pathname,
|
|
34115
|
+
searchParams,
|
|
34116
|
+
idToCompare,
|
|
34117
|
+
fallbackIdToCompare,
|
|
34118
|
+
currentTags,
|
|
34119
|
+
resourcesListData
|
|
34120
|
+
}) => {
|
|
34121
|
+
const foundData = data.find((el) => el.id === idToCompare) || (fallbackIdToCompare ? data.find((el) => el.id === fallbackIdToCompare) : void 0);
|
|
34122
|
+
if (!foundData) {
|
|
34123
|
+
return void 0;
|
|
34124
|
+
}
|
|
34125
|
+
const preparedCurrentTags = currentTags && currentTags.length > 0 ? currentTags.map((el) => parseAll({ text: el, replaceValues, multiQueryData })) : void 0;
|
|
34126
|
+
const result = {
|
|
34127
|
+
menuItems: mapLinksFromRaw({
|
|
34128
|
+
rawLinks: foundData.menuItems,
|
|
34129
|
+
replaceValues,
|
|
34130
|
+
multiQueryData,
|
|
34131
|
+
externalKeys: foundData.externalKeys,
|
|
34132
|
+
resourcesListData
|
|
34133
|
+
})
|
|
34134
|
+
};
|
|
34135
|
+
const openedKeys = result?.menuItems ? findMatchingItems({
|
|
34136
|
+
items: result?.menuItems,
|
|
34137
|
+
pathname,
|
|
34138
|
+
searchParams,
|
|
34139
|
+
tags: { keysAndTags: foundData.keysAndTags, currentTags: preparedCurrentTags }
|
|
34140
|
+
}) : [];
|
|
34141
|
+
const stringedOpenedKeys = openedKeys.map((el) => typeof el === "string" ? el : String(el));
|
|
34142
|
+
return { menuItems: stripInternalMetaFromItems(result.menuItems), selectedKeys: stringedOpenedKeys };
|
|
34143
|
+
};
|
|
34144
|
+
|
|
34145
|
+
const ResourcesListFetcher = ({ nodePath, params, onUpdate }) => {
|
|
34146
|
+
const { data, isLoading } = useK8sSmartResource(params);
|
|
34147
|
+
useEffect(() => {
|
|
34148
|
+
const maybeItems = data?.items;
|
|
34149
|
+
const preparedItems = Array.isArray(maybeItems) ? maybeItems : [];
|
|
34150
|
+
onUpdate({
|
|
34151
|
+
nodePath,
|
|
34152
|
+
entry: {
|
|
34153
|
+
items: preparedItems,
|
|
34154
|
+
isLoading
|
|
34155
|
+
}
|
|
34156
|
+
});
|
|
34157
|
+
}, [nodePath, data?.items, isLoading, onUpdate]);
|
|
34158
|
+
return null;
|
|
34159
|
+
};
|
|
34160
|
+
const ManageableSidebarProvider = ({
|
|
34161
|
+
cluster,
|
|
34162
|
+
apiGroup,
|
|
34163
|
+
apiVersion,
|
|
34164
|
+
plural,
|
|
34165
|
+
isEnabled,
|
|
34166
|
+
replaceValues,
|
|
34167
|
+
multiQueryData,
|
|
34168
|
+
pathname,
|
|
34169
|
+
searchParams,
|
|
34170
|
+
idToCompare,
|
|
34171
|
+
fallbackIdToCompare,
|
|
34172
|
+
currentTags,
|
|
34173
|
+
hidden,
|
|
34174
|
+
noMarginTop
|
|
34175
|
+
}) => {
|
|
34176
|
+
const safeMultiQueryData = useMemo(() => multiQueryData || {}, [multiQueryData]);
|
|
34177
|
+
const {
|
|
34178
|
+
data: rawData,
|
|
34179
|
+
isError: rawDataError,
|
|
34180
|
+
isLoading: rawDataLoading
|
|
34181
|
+
} = useK8sSmartResource({
|
|
34182
|
+
cluster,
|
|
34183
|
+
apiGroup,
|
|
34184
|
+
apiVersion,
|
|
34185
|
+
plural,
|
|
34186
|
+
isEnabled
|
|
34187
|
+
});
|
|
34188
|
+
const parsedData = rawData?.items.map(({ spec }) => spec) || [];
|
|
34189
|
+
const foundData = parsedData.find((el) => el.id === idToCompare) || (fallbackIdToCompare ? parsedData.find((el) => el.id === fallbackIdToCompare) : void 0);
|
|
34190
|
+
const linksWithResourcesList = useMemo(
|
|
34191
|
+
() => collectLinksWithResourcesList({
|
|
34192
|
+
items: foundData?.menuItems || [],
|
|
34193
|
+
replaceValues,
|
|
34194
|
+
multiQueryData: safeMultiQueryData,
|
|
34195
|
+
isEnabled
|
|
34196
|
+
}),
|
|
34197
|
+
[foundData?.menuItems, replaceValues, safeMultiQueryData, isEnabled]
|
|
34198
|
+
);
|
|
34199
|
+
const [resourcesByPath, setResourcesByPath] = useState({});
|
|
34200
|
+
useEffect(() => {
|
|
34201
|
+
setResourcesByPath((prev) => {
|
|
34202
|
+
const next = linksWithResourcesList.reduce(
|
|
34203
|
+
(acc, { nodePath, k8sParams }) => {
|
|
34204
|
+
acc[nodePath] = prev[nodePath] || { items: [], isLoading: Boolean(k8sParams.isEnabled) };
|
|
34205
|
+
return acc;
|
|
34206
|
+
},
|
|
34207
|
+
{}
|
|
34208
|
+
);
|
|
34209
|
+
return next;
|
|
34210
|
+
});
|
|
34211
|
+
}, [linksWithResourcesList]);
|
|
34212
|
+
const handleResourceUpdate = useCallback(({ nodePath, entry }) => {
|
|
34213
|
+
setResourcesByPath((prev) => {
|
|
34214
|
+
const previous = prev[nodePath];
|
|
34215
|
+
if (previous && previous.items === entry.items && previous.isLoading === entry.isLoading) {
|
|
34216
|
+
return prev;
|
|
34217
|
+
}
|
|
34218
|
+
return { ...prev, [nodePath]: entry };
|
|
34219
|
+
});
|
|
34220
|
+
}, []);
|
|
34221
|
+
const isResourcesLoading = linksWithResourcesList.some(({ nodePath, k8sParams }) => {
|
|
34222
|
+
if (!k8sParams.isEnabled) {
|
|
34223
|
+
return false;
|
|
34224
|
+
}
|
|
34225
|
+
return resourcesByPath[nodePath]?.isLoading !== false;
|
|
34226
|
+
});
|
|
34227
|
+
if (isResourcesLoading) {
|
|
34228
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
34229
|
+
linksWithResourcesList.map(({ nodePath, k8sParams }) => /* @__PURE__ */ jsxRuntimeExports.jsx(ResourcesListFetcher, { nodePath, params: k8sParams, onUpdate: handleResourceUpdate }, nodePath)),
|
|
34230
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {})
|
|
34231
|
+
] });
|
|
34232
|
+
}
|
|
34233
|
+
if (rawDataError) {
|
|
34234
|
+
return null;
|
|
34235
|
+
}
|
|
34236
|
+
if (rawDataLoading) {
|
|
34237
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {});
|
|
34238
|
+
}
|
|
34239
|
+
if (!rawData) {
|
|
34240
|
+
return null;
|
|
34241
|
+
}
|
|
34242
|
+
if (hidden) {
|
|
34243
|
+
return null;
|
|
34244
|
+
}
|
|
34245
|
+
if (!parsedData || parsedData.length === 0) {
|
|
34246
|
+
return null;
|
|
34247
|
+
}
|
|
34248
|
+
if (!foundData) {
|
|
34249
|
+
return null;
|
|
34250
|
+
}
|
|
34251
|
+
const resourcesListData = linksWithResourcesList.reduce(
|
|
34252
|
+
(acc, { nodePath }) => {
|
|
34253
|
+
const result2 = resourcesByPath[nodePath];
|
|
34254
|
+
acc[nodePath] = {
|
|
34255
|
+
items: Array.isArray(result2?.items) ? result2.items : []
|
|
34256
|
+
};
|
|
34257
|
+
return acc;
|
|
34258
|
+
},
|
|
34259
|
+
{}
|
|
34260
|
+
);
|
|
34261
|
+
const result = prepareDataForManageableSidebar({
|
|
34262
|
+
data: parsedData,
|
|
34263
|
+
replaceValues,
|
|
34264
|
+
multiQueryData: safeMultiQueryData,
|
|
34265
|
+
pathname,
|
|
34266
|
+
searchParams,
|
|
34267
|
+
idToCompare,
|
|
34268
|
+
fallbackIdToCompare,
|
|
34269
|
+
currentTags,
|
|
34270
|
+
resourcesListData
|
|
34271
|
+
});
|
|
34272
|
+
if (!result) {
|
|
34273
|
+
return null;
|
|
34274
|
+
}
|
|
34275
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
34276
|
+
linksWithResourcesList.map(({ nodePath, k8sParams }) => /* @__PURE__ */ jsxRuntimeExports.jsx(ResourcesListFetcher, { nodePath, params: k8sParams, onUpdate: handleResourceUpdate }, nodePath)),
|
|
34277
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ManageableSidebar, { data: result, noMarginTop })
|
|
34278
|
+
] });
|
|
34279
|
+
};
|
|
34280
|
+
|
|
33950
34281
|
const ShortenedText = styled.div`
|
|
33951
34282
|
max-width: ${({ $maxWidth }) => $maxWidth}px;
|
|
33952
34283
|
overflow: hidden;
|
|
@@ -34593,141 +34924,6 @@ const partsOfUrlContext = createContextFactory();
|
|
|
34593
34924
|
const PartsOfUrlProvider = partsOfUrlContext.Provider;
|
|
34594
34925
|
const usePartsOfUrl = partsOfUrlContext.useTypedContext;
|
|
34595
34926
|
|
|
34596
|
-
const parsePartsOfUrl = ({
|
|
34597
|
-
template,
|
|
34598
|
-
replaceValues
|
|
34599
|
-
}) => {
|
|
34600
|
-
return prepareTemplate({ template, replaceValues });
|
|
34601
|
-
};
|
|
34602
|
-
const parseMutliqueryText = ({
|
|
34603
|
-
text,
|
|
34604
|
-
multiQueryData,
|
|
34605
|
-
customFallback
|
|
34606
|
-
}) => {
|
|
34607
|
-
if (!text) {
|
|
34608
|
-
return "";
|
|
34609
|
-
}
|
|
34610
|
-
return text.replace(
|
|
34611
|
-
/\{reqs\[(\d+)\]\[((?:\s*['"][^'"]+['"]\s*,?)+)\](?:\[\s*['"]([^'"]+)['"]\s*\])?\}/g,
|
|
34612
|
-
(_match, reqIndexStr, rawPath, fallback) => {
|
|
34613
|
-
try {
|
|
34614
|
-
const reqIndex = parseInt(reqIndexStr, 10);
|
|
34615
|
-
const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
|
|
34616
|
-
(m) => m[1]
|
|
34617
|
-
);
|
|
34618
|
-
const value = _$1.get(multiQueryData[`req${reqIndex}`] || {}, path, fallback !== void 0 ? fallback : void 0);
|
|
34619
|
-
if (value == null && !customFallback) {
|
|
34620
|
-
return fallback ?? "Undefined with no fallback";
|
|
34621
|
-
}
|
|
34622
|
-
if (customFallback && (value === void 0 || value === null)) {
|
|
34623
|
-
return customFallback;
|
|
34624
|
-
}
|
|
34625
|
-
return String(value);
|
|
34626
|
-
} catch {
|
|
34627
|
-
return _match;
|
|
34628
|
-
}
|
|
34629
|
-
}
|
|
34630
|
-
);
|
|
34631
|
-
};
|
|
34632
|
-
const parseJsonPathTemplate = ({
|
|
34633
|
-
text,
|
|
34634
|
-
multiQueryData,
|
|
34635
|
-
customFallback,
|
|
34636
|
-
replaceValues
|
|
34637
|
-
}) => {
|
|
34638
|
-
if (!text) return "";
|
|
34639
|
-
const placeholderRegex = /\{reqsJsonPath\[(\d+)\]\s*\[\s*(['"])([\s\S]*?)\2\s*\](?:\s*\[\s*(['"])([\s\S]*?)\4\s*\])?\}/g;
|
|
34640
|
-
const resolve = (input) => input.replace(
|
|
34641
|
-
placeholderRegex,
|
|
34642
|
-
(match, reqIndexStr, _quote, rawJsonPathExpr, _fallbackQuote, inlineFallback = "Undefined with no fallback") => {
|
|
34643
|
-
try {
|
|
34644
|
-
const reqIndex = Number(reqIndexStr);
|
|
34645
|
-
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
34646
|
-
let jsonPathExpr = rawJsonPathExpr;
|
|
34647
|
-
let previous2 = null;
|
|
34648
|
-
let loopGuard = 0;
|
|
34649
|
-
while (previous2 !== jsonPathExpr && loopGuard < 10) {
|
|
34650
|
-
previous2 = jsonPathExpr;
|
|
34651
|
-
jsonPathExpr = resolve(jsonPathExpr);
|
|
34652
|
-
loopGuard++;
|
|
34653
|
-
}
|
|
34654
|
-
if (replaceValues) {
|
|
34655
|
-
jsonPathExpr = prepareTemplate({
|
|
34656
|
-
template: jsonPathExpr,
|
|
34657
|
-
replaceValues
|
|
34658
|
-
});
|
|
34659
|
-
}
|
|
34660
|
-
if (jsonRoot === void 0 && customFallback) return customFallback;
|
|
34661
|
-
if (jsonRoot === void 0) return inlineFallback;
|
|
34662
|
-
const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
|
|
34663
|
-
const value = results?.[0];
|
|
34664
|
-
if (value == null) {
|
|
34665
|
-
return customFallback ?? inlineFallback;
|
|
34666
|
-
}
|
|
34667
|
-
return String(value);
|
|
34668
|
-
} catch {
|
|
34669
|
-
return match;
|
|
34670
|
-
}
|
|
34671
|
-
}
|
|
34672
|
-
);
|
|
34673
|
-
let result = text;
|
|
34674
|
-
let previous = null;
|
|
34675
|
-
let iterations = 0;
|
|
34676
|
-
while (result !== previous && iterations < 10) {
|
|
34677
|
-
previous = result;
|
|
34678
|
-
result = resolve(result);
|
|
34679
|
-
iterations++;
|
|
34680
|
-
}
|
|
34681
|
-
return result;
|
|
34682
|
-
};
|
|
34683
|
-
const parseWithoutPartsOfUrl = ({
|
|
34684
|
-
text,
|
|
34685
|
-
multiQueryData,
|
|
34686
|
-
customFallback
|
|
34687
|
-
}) => {
|
|
34688
|
-
return parseJsonPathTemplate({
|
|
34689
|
-
text: parseMutliqueryText({
|
|
34690
|
-
text,
|
|
34691
|
-
multiQueryData,
|
|
34692
|
-
customFallback
|
|
34693
|
-
}),
|
|
34694
|
-
multiQueryData,
|
|
34695
|
-
customFallback
|
|
34696
|
-
});
|
|
34697
|
-
};
|
|
34698
|
-
const parseAll = ({
|
|
34699
|
-
text,
|
|
34700
|
-
replaceValues,
|
|
34701
|
-
multiQueryData
|
|
34702
|
-
}) => {
|
|
34703
|
-
return parsePartsOfUrl({
|
|
34704
|
-
template: parseJsonPathTemplate({
|
|
34705
|
-
text: parseMutliqueryText({
|
|
34706
|
-
text,
|
|
34707
|
-
multiQueryData
|
|
34708
|
-
}),
|
|
34709
|
-
multiQueryData,
|
|
34710
|
-
replaceValues
|
|
34711
|
-
}),
|
|
34712
|
-
replaceValues
|
|
34713
|
-
});
|
|
34714
|
-
};
|
|
34715
|
-
const parsePromTemplate = ({
|
|
34716
|
-
text,
|
|
34717
|
-
replaceValues,
|
|
34718
|
-
multiQueryData
|
|
34719
|
-
}) => {
|
|
34720
|
-
const parsed = parseJsonPathTemplate({
|
|
34721
|
-
text: parseMutliqueryText({
|
|
34722
|
-
text,
|
|
34723
|
-
multiQueryData
|
|
34724
|
-
}),
|
|
34725
|
-
multiQueryData,
|
|
34726
|
-
replaceValues
|
|
34727
|
-
});
|
|
34728
|
-
return parsed.replace(/\{(\d+)\}/g, (_2, key) => replaceValues[key] || "");
|
|
34729
|
-
};
|
|
34730
|
-
|
|
34731
34927
|
const isExternalHref = (href) => {
|
|
34732
34928
|
if (!href) {
|
|
34733
34929
|
return false;
|
|
@@ -77970,7 +78166,7 @@ const TolerationsModal = ({
|
|
|
77970
78166
|
};
|
|
77971
78167
|
|
|
77972
78168
|
const LazyEnrichedTableModal = lazy(
|
|
77973
|
-
() => import('./index-
|
|
78169
|
+
() => import('./index-DPPcb4Gw.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
|
|
77974
78170
|
);
|
|
77975
78171
|
const renderActiveType = (activeType, extraProps) => {
|
|
77976
78172
|
if (!activeType) return null;
|
|
@@ -81283,6 +81479,16 @@ const resolveFormPath = (pathInput, basePathForRelative) => {
|
|
|
81283
81479
|
};
|
|
81284
81480
|
const normalizeNameToPath = (name) => Array.isArray(name) ? name : [name];
|
|
81285
81481
|
|
|
81482
|
+
const prettyFieldPath = (name) => {
|
|
81483
|
+
return Array.isArray(name) ? name.map((segment) => String(segment)).join(".") : String(name);
|
|
81484
|
+
};
|
|
81485
|
+
const getRequiredRule = (isRequired, name) => {
|
|
81486
|
+
return {
|
|
81487
|
+
required: isRequired,
|
|
81488
|
+
message: `Please enter ${prettyFieldPath(name)}`
|
|
81489
|
+
};
|
|
81490
|
+
};
|
|
81491
|
+
|
|
81286
81492
|
const FormListInput = ({
|
|
81287
81493
|
name,
|
|
81288
81494
|
arrKey,
|
|
@@ -81312,6 +81518,9 @@ const FormListInput = ({
|
|
|
81312
81518
|
const rawRelatedFieldValue = Form.useWatch(relatedPath, form);
|
|
81313
81519
|
const relatedFieldValue = relatedPath ? rawRelatedFieldValue : void 0;
|
|
81314
81520
|
const relatedTouched = relatedPath ? form.isFieldTouched(relatedPath) : "~";
|
|
81521
|
+
const isWaitingForRelatedValue = Boolean(relatedPath && !rawRelatedFieldValue);
|
|
81522
|
+
const relatedPathLabel = relatedPath?.join(".");
|
|
81523
|
+
const relatedValueTooltip = relatedPathLabel ? isWaitingForRelatedValue ? `Please select ${relatedPathLabel} first` : `Depends on ${relatedPathLabel}` : void 0;
|
|
81315
81524
|
const hasFiredRef = useRef(false);
|
|
81316
81525
|
const relatedFieldValuePrev = useRef("unset");
|
|
81317
81526
|
const hasSeededRef = useRef(false);
|
|
@@ -81428,21 +81637,25 @@ const FormListInput = ({
|
|
|
81428
81637
|
ResetedFormItem$1,
|
|
81429
81638
|
{
|
|
81430
81639
|
name: arrName || fixedName,
|
|
81431
|
-
rules: [
|
|
81640
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
81432
81641
|
validateTrigger: "onBlur",
|
|
81433
81642
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
81434
|
-
children: /* @__PURE__ */ jsxRuntimeExports.
|
|
81435
|
-
|
|
81436
|
-
|
|
81437
|
-
|
|
81438
|
-
|
|
81439
|
-
|
|
81440
|
-
|
|
81441
|
-
|
|
81442
|
-
|
|
81443
|
-
|
|
81444
|
-
|
|
81445
|
-
|
|
81643
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { gap: 8, align: "center", children: [
|
|
81644
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
81645
|
+
Select,
|
|
81646
|
+
{
|
|
81647
|
+
mode: customProps.mode,
|
|
81648
|
+
placeholder: "Select",
|
|
81649
|
+
options: uniqueOptions,
|
|
81650
|
+
filterOption: filterSelectOptions,
|
|
81651
|
+
disabled: isWaitingForRelatedValue,
|
|
81652
|
+
allowClear: true,
|
|
81653
|
+
showSearch: true,
|
|
81654
|
+
style: { width: "100%" }
|
|
81655
|
+
}
|
|
81656
|
+
),
|
|
81657
|
+
relatedValueTooltip && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: relatedValueTooltip, children: /* @__PURE__ */ jsxRuntimeExports.jsx(QuestionCircleOutlined, {}) })
|
|
81658
|
+
] })
|
|
81446
81659
|
},
|
|
81447
81660
|
arrKey !== void 0 ? arrKey : Array.isArray(name) ? name.slice(-1)[0] : name
|
|
81448
81661
|
)
|
|
@@ -81612,7 +81825,7 @@ const RangeInput = ({
|
|
|
81612
81825
|
ResetedFormItem$1,
|
|
81613
81826
|
{
|
|
81614
81827
|
name: arrName || name,
|
|
81615
|
-
rules: [
|
|
81828
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
81616
81829
|
validateTrigger: "onBlur",
|
|
81617
81830
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
81618
81831
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Slider, { min, max, step, ...props })
|
|
@@ -81628,7 +81841,7 @@ const RangeInput = ({
|
|
|
81628
81841
|
ResetedFormItem$1,
|
|
81629
81842
|
{
|
|
81630
81843
|
name: arrName || name,
|
|
81631
|
-
rules: [
|
|
81844
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
81632
81845
|
validateTrigger: "onBlur",
|
|
81633
81846
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
81634
81847
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { min, max, step, value, disabled: props.disabled })
|
|
@@ -81857,7 +82070,7 @@ const FormNamespaceInput = ({
|
|
|
81857
82070
|
ResetedFormItem$1,
|
|
81858
82071
|
{
|
|
81859
82072
|
name,
|
|
81860
|
-
rules: [
|
|
82073
|
+
rules: [getRequiredRule(true, name)],
|
|
81861
82074
|
validateTrigger: "onBlur",
|
|
81862
82075
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
81863
82076
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -81908,7 +82121,7 @@ const FormStringInput = ({
|
|
|
81908
82121
|
ResetedFormItem$1,
|
|
81909
82122
|
{
|
|
81910
82123
|
name: arrName || fixedName,
|
|
81911
|
-
rules: [
|
|
82124
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
81912
82125
|
validateTrigger: "onBlur",
|
|
81913
82126
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
81914
82127
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { placeholder: getStringByName(name) })
|
|
@@ -81989,7 +82202,7 @@ const FormStringMultilineInput = ({
|
|
|
81989
82202
|
ResetedFormItem$1,
|
|
81990
82203
|
{
|
|
81991
82204
|
name: arrName || fixedName,
|
|
81992
|
-
rules: [
|
|
82205
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
81993
82206
|
validateTrigger: "onBlur",
|
|
81994
82207
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
81995
82208
|
style: {
|
|
@@ -82115,7 +82328,7 @@ const FormEnumStringInput = ({
|
|
|
82115
82328
|
ResetedFormItem$1,
|
|
82116
82329
|
{
|
|
82117
82330
|
name: arrName || fixedName,
|
|
82118
|
-
rules: [
|
|
82331
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
82119
82332
|
validateTrigger: "onBlur",
|
|
82120
82333
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
82121
82334
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Select, { options: options.map((el) => ({ value: el, label: el })), placeholder: getStringByName(name) })
|
|
@@ -82157,7 +82370,7 @@ const FormNumberInput = ({
|
|
|
82157
82370
|
ResetedFormItem$1,
|
|
82158
82371
|
{
|
|
82159
82372
|
name: arrName || name,
|
|
82160
|
-
rules: [
|
|
82373
|
+
rules: [getRequiredRule(forceNonRequired === false && !!required?.includes(getStringByName(name)), name)],
|
|
82161
82374
|
validateTrigger: "onBlur",
|
|
82162
82375
|
hasFeedback: designNewLayout ? { icons: feedbackIcons } : true,
|
|
82163
82376
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { placeholder: getStringByName(name), step: isNumber ? 0.1 : 1 })
|
|
@@ -82777,7 +82990,7 @@ const getArrayFormItemFromSwagger = ({
|
|
|
82777
82990
|
{
|
|
82778
82991
|
validator: async (_, value) => {
|
|
82779
82992
|
if (!value || value.length < 1) {
|
|
82780
|
-
return Promise.reject(new Error(
|
|
82993
|
+
return Promise.reject(new Error(`Please enter ${prettyFieldPath(name)}`));
|
|
82781
82994
|
}
|
|
82782
82995
|
}
|
|
82783
82996
|
}
|
|
@@ -84378,6 +84591,18 @@ const BlackholeFormProvider = ({
|
|
|
84378
84591
|
modeData.onDisabled();
|
|
84379
84592
|
}
|
|
84380
84593
|
}, [modeData]);
|
|
84594
|
+
const applyForceViewMode = useCallback(
|
|
84595
|
+
(forceViewMode) => {
|
|
84596
|
+
if (!modeData || !forceViewMode) return;
|
|
84597
|
+
if (forceViewMode === "Manual") {
|
|
84598
|
+
modeData.onChange("Manual");
|
|
84599
|
+
modeData.onDisabled();
|
|
84600
|
+
return;
|
|
84601
|
+
}
|
|
84602
|
+
modeData.onChange("OpenAPI");
|
|
84603
|
+
},
|
|
84604
|
+
[modeData]
|
|
84605
|
+
);
|
|
84381
84606
|
const forcedCustomizationId = customizationId ? mappingData?.items?.[0]?.spec?.mappings?.[customizationId] : void 0;
|
|
84382
84607
|
const hasMatchingOverride = Boolean(
|
|
84383
84608
|
customizationId && overridesData?.items?.some((item) => item?.spec?.customizationId === customizationId)
|
|
@@ -84388,6 +84613,10 @@ const BlackholeFormProvider = ({
|
|
|
84388
84613
|
const isResolutionReady = !customizationId || !overridesLoading && !mappingLoading;
|
|
84389
84614
|
const resolvedCustomizationId = isResolutionReady ? hasMatchingOverride ? customizationId : hasForcedMatchingOverride ? forcedCustomizationId : forcingCustomization.fallbackId : void 0;
|
|
84390
84615
|
useEffect(() => {
|
|
84616
|
+
if (!cluster) {
|
|
84617
|
+
setIsLoading(false);
|
|
84618
|
+
return;
|
|
84619
|
+
}
|
|
84391
84620
|
if (!isResolutionReady) return;
|
|
84392
84621
|
if (customizationId && !resolvedCustomizationId) return;
|
|
84393
84622
|
setIsLoading(true);
|
|
@@ -84403,8 +84632,13 @@ const BlackholeFormProvider = ({
|
|
|
84403
84632
|
if (data2.result === "error") {
|
|
84404
84633
|
setIsError(data2.error);
|
|
84405
84634
|
console.warn(data2.error);
|
|
84406
|
-
|
|
84635
|
+
if (data2.forceViewMode) {
|
|
84636
|
+
applyForceViewMode(data2.forceViewMode);
|
|
84637
|
+
} else {
|
|
84638
|
+
fallbackToManualMode();
|
|
84639
|
+
}
|
|
84407
84640
|
} else {
|
|
84641
|
+
applyForceViewMode(data2.forceViewMode);
|
|
84408
84642
|
setPreparedData({
|
|
84409
84643
|
properties: data2.properties,
|
|
84410
84644
|
required: data2.required || [],
|
|
@@ -84423,7 +84657,15 @@ const BlackholeFormProvider = ({
|
|
|
84423
84657
|
}).finally(() => {
|
|
84424
84658
|
setIsLoading(false);
|
|
84425
84659
|
});
|
|
84426
|
-
}, [
|
|
84660
|
+
}, [
|
|
84661
|
+
cluster,
|
|
84662
|
+
data,
|
|
84663
|
+
customizationId,
|
|
84664
|
+
resolvedCustomizationId,
|
|
84665
|
+
isResolutionReady,
|
|
84666
|
+
fallbackToManualMode,
|
|
84667
|
+
applyForceViewMode
|
|
84668
|
+
]);
|
|
84427
84669
|
if (isLoading) {
|
|
84428
84670
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {});
|
|
84429
84671
|
}
|
|
@@ -84828,7 +85070,7 @@ const MarketplaceCard = ({
|
|
|
84828
85070
|
onEditClick,
|
|
84829
85071
|
addedMode,
|
|
84830
85072
|
standalone,
|
|
84831
|
-
showZeroResources
|
|
85073
|
+
showZeroResources = false
|
|
84832
85074
|
}) => {
|
|
84833
85075
|
const { useToken } = theme;
|
|
84834
85076
|
const { token } = useToken();
|
|
@@ -84866,7 +85108,13 @@ const MarketplaceCard = ({
|
|
|
84866
85108
|
plural: type,
|
|
84867
85109
|
isEnabled: Boolean(apiVersion && addedMode && type !== "direct")
|
|
84868
85110
|
});
|
|
84869
|
-
|
|
85111
|
+
const isAddedMode = Boolean(addedMode);
|
|
85112
|
+
const isDirectType = type === "direct";
|
|
85113
|
+
const hasK8sListError = Boolean(k8sListError);
|
|
85114
|
+
const isUncountable = isAddedMode && (hasK8sListError || isDirectType);
|
|
85115
|
+
const itemsCount = k8sList?.items?.length ?? 0;
|
|
85116
|
+
const isCountableZero = isAddedMode && !isUncountable && itemsCount === 0;
|
|
85117
|
+
if (showZeroResources === false && (isUncountable || isCountableZero)) {
|
|
84870
85118
|
return null;
|
|
84871
85119
|
}
|
|
84872
85120
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -84904,7 +85152,7 @@ const MarketplaceCard = ({
|
|
|
84904
85152
|
" ",
|
|
84905
85153
|
addedMode && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
84906
85154
|
"x",
|
|
84907
|
-
|
|
85155
|
+
itemsCount
|
|
84908
85156
|
] })
|
|
84909
85157
|
] }),
|
|
84910
85158
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$f.TagsContainer, { children: tags.map((tag) => /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$f.CustomTag, { children: tag }, tag)) }),
|
|
@@ -84981,7 +85229,7 @@ const MarketPlace = ({
|
|
|
84981
85229
|
marketplaceKind,
|
|
84982
85230
|
baseprefix,
|
|
84983
85231
|
standalone,
|
|
84984
|
-
|
|
85232
|
+
addedMode,
|
|
84985
85233
|
showZeroResources
|
|
84986
85234
|
}) => {
|
|
84987
85235
|
const [api, contextHolder] = notification.useNotification();
|
|
@@ -85134,7 +85382,7 @@ const MarketPlace = ({
|
|
|
85134
85382
|
setIsAddEditOpen(marketplacePanels.items.find(({ spec }) => spec.name === name) || false);
|
|
85135
85383
|
},
|
|
85136
85384
|
standalone,
|
|
85137
|
-
addedMode
|
|
85385
|
+
addedMode,
|
|
85138
85386
|
showZeroResources
|
|
85139
85387
|
},
|
|
85140
85388
|
name
|
|
@@ -88981,4 +89229,4 @@ const usePluginManifest = ({
|
|
|
88981
89229
|
};
|
|
88982
89230
|
|
|
88983
89231
|
export { useInfiniteSentinel as $, getBuiltinResourceTypes as A, getCrdData as B, getDirectUnknownResource as C, DeleteIcon as D, EnrichedTableProvider as E, checkPermission as F, getSwagger as G, filterIfApiInstanceNamespaceScoped as H, filterIfBuiltInInstanceNamespaceScoped as I, checkIfApiInstanceNamespaceScoped as J, checkIfBuiltInInstanceNamespaceScoped as K, getKinds as L, useClusterList as M, useApiResources as N, useApiResourceSingle as O, PaddingContainer as P, useBuiltinResources as Q, ReadOnlyModal as R, useBuiltinResourceSingle as S, useCrdResources as T, useCrdResourceSingle as U, useApisResourceTypes as V, useApiResourceTypesByGroup as W, useBuiltinResourceTypes as X, useCrdData as Y, useListWatch as Z, _$1 as _, useTheme as a, parseQuotaValueMemoryAndStorage as a$, useK8sVerbs as a0, useManyK8sSmartResource as a1, useSmartResourceParams as a2, useResourceScope as a3, useKinds as a4, usePluginManifest as a5, Spacer$1 as a6, TreeWithSearch as a7, ConfirmModal as a8, UpIcon as a9, EnrichedTable as aA, getEnrichedColumns as aB, getEnrichedColumnsWithControls as aC, YamlEditorSingleton$1 as aD, BlackholeFormProvider as aE, BlackholeForm as aF, getObjectFormItemsDraft as aG, MarketPlace as aH, MarketplaceCard as aI, ProjectInfoCard as aJ, PodTerminal as aK, NodeTerminal as aL, PodLogs as aM, PodLogsMonaco as aN, VMVNC as aO, Search as aP, Events as aQ, DynamicRenderer as aR, DynamicComponents as aS, DynamicRendererWithProviders as aT, prepareTemplate as aU, isFlatObject as aV, filterSelectOptions as aW, getStringByName as aX, floorToDecimal as aY, parseQuotaValue as aZ, parseQuotaValueCpu as a_, DownIcon as aa, BackToDefaultIcon as ab, SuccessIcon as ac, feedbackIcons as ad, PlusIcon as ae, MinusIcon as af, LockedIcon as ag, UnlockedIcon as ah, PauseCircleIcon as ai, ResumeCircleIcon as aj, LookingGlassIcon as ak, EarthIcon as al, ContentCard$1 as am, FlexGrow as an, UncontrolledSelect as ao, CustomSelect$4 as ap, CursorPointerTag as aq, CursorPointerTagMinContent as ar, CursorDefaultDiv as as, ResourceLink as at, ManageableBreadcrumbsProvider as au, prepareDataForManageableBreadcrumbs as av, ManageableBreadcrumbs as aw, ManageableSidebarProvider as ax, prepareDataForManageableSidebar as ay, ManageableSidebar as az, usePartsOfUrl as b, normalizeValuesForQuotasToNumber as b0, getAllPathsFromObj as b1, getPrefixSubarrays as b2, groupsToTreeData as b3, getBuiltinTreeData as b4, getGroupsByCategory as b5, createContextFactory as b6, prepareUrlsToFetchForDynamicRenderer as b7, deepMerge as b8, getSortedKinds as b9, getSortedKindsAll as ba, hslFromString as bb, getUppercase as bc, kindByGvr as bd, pluralByKind as be, namespacedByGvr as bf, getLinkToBuiltinForm as bg, getLinkToApiForm as bh, isMultilineString as bi, isMultilineFromYaml as bj, includesArray as bk, getResourceLink as bl, getNamespaceLink as bm, convertBytes as bn, formatBytesAuto as bo, toBytes as bp, convertStorage as bq, parseValueWithUnit as br, convertCores as bs, formatCoresAuto as bt, toCores as bu, convertCompute as bv, parseCoresWithUnit as bw, formatDateAuto as bx, isValidRFC3339 as by, usePermissions as c, useDirectUnknownResource as d, useK8sSmartResource as e, jsxRuntimeExports as f, EditIcon as g, getLinkToForm as h, DeleteModal as i, jp as j, DeleteModalMany as k, getClusterList as l, createNewEntry as m, updateEntry as n, deleteEntry as o, parseAll as p, getApiResources as q, getApiResourceSingle as r, serializeLabelsWithNoEncoding$1 as s, getBuiltinResources as t, useMultiQuery as u, getBuiltinResourceSingle as v, getCrdResources as w, getCrdResourceSingle as x, getApiResourceTypes as y, getApiResourceTypesByApiGroup as z };
|
|
88984
|
-
//# sourceMappingURL=index-
|
|
89232
|
+
//# sourceMappingURL=index-DGEm7Wqt.mjs.map
|