@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.34 → 1.4.0-alpha.35
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-DYHfFWOs.mjs → index-BTlqy90S.mjs} +2 -2
- package/dist/{index-DYHfFWOs.mjs.map → index-BTlqy90S.mjs.map} +1 -1
- package/dist/{index-bM0NLvVb.mjs → index-DZxEKtGA.mjs} +78 -26
- package/dist/index-DZxEKtGA.mjs.map +1 -0
- package/dist/openapi-k8s-toolkit.es.js +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +76 -24
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/AntdResult/utils.d.ts +21 -0
- package/dist/types/components/organisms/DynamicComponents/types/antdComponents.d.ts +5 -3
- package/dist/types/components/organisms/DynamicRendererWithProviders/DynamicRendererWithProviders.d.ts +2 -0
- package/dist/types/components/organisms/DynamicRendererWithProviders/EffectiveAntdResultWrapper/EffectiveAntdResultWrapper.d.ts +8 -0
- package/dist/types/components/organisms/DynamicRendererWithProviders/EffectiveAntdResultWrapper/EffectiveAntdResultWrapper.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicRendererWithProviders/EffectiveAntdResultWrapper/index.d.ts +1 -0
- package/dist/types/localTypes/dynamicRender.d.ts +4 -0
- package/package.json +1 -1
- package/dist/index-bM0NLvVb.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { af as BackToDefaultIcon, aM as BlackholeForm, aL as BlackholeFormProvider, aH as ClusterListTable, ac as ConfirmModal, aq as ContentCard, aw as CursorDefaultDiv, au as CursorPointerTag, av as CursorPointerTagMinContent, at as CustomSelect, D as DeleteIcon, l as DeleteModal, n as DeleteModalMany, ae as DownIcon, aZ as DynamicComponents, aY as DynamicRenderer, a_ as DynamicRendererWithProviders, ap as EarthIcon, h as EditIcon, aG as EnrichedTable, E as EnrichedTableProvider, ay as ErrorBoundary, az as ErrorBoundaryWithDataReset, aX as Events, ar as FlexGrow, ak as LockedIcon, ao as LookingGlassIcon, aC as ManageableBreadcrumbs, aA as ManageableBreadcrumbsProvider, aF as ManageableSidebar, aD as ManageableSidebarProvider, aO as MarketPlace, aP as MarketplaceCard, aj as MinusIcon, aS as NodeTerminal, i as PaddingContainer, am as PauseCircleIcon, ai as PlusIcon, aT as PodLogs, aU as PodLogsMonaco, aR as PodTerminal, aQ as ProjectInfoCard, ax as ResourceLink, an as ResumeCircleIcon, aW as Search, aa as Spacer, ag as SuccessIcon, ab as TreeWithSearch, as as UncontrolledSelect, al as UnlockedIcon, ad as UpIcon, aV as VMVNC, aK as YamlEditorSingleton, M as checkIfApiInstanceNamespaceScoped, N as checkIfBuiltInInstanceNamespaceScoped, I as checkPermission, bu as convertBytes, bC as convertCompute, bz as convertCores, bx as convertStorage, bd as createContextFactory, q as createNewEntry, bf as deepMerge, t as deleteEntry, ah as feedbackIcons, K as filterIfApiInstanceNamespaceScoped, L as filterIfBuiltInInstanceNamespaceScoped, b1 as filterSelectOptions, b3 as floorToDecimal, bv as formatBytesAuto, bA as formatCoresAuto, bE as formatDateAuto, b8 as getAllPathsFromObj, w as getApiResourceSingle, B as getApiResourceTypes, C as getApiResourceTypesByApiGroup, v as getApiResources, y as getBuiltinResourceSingle, F as getBuiltinResourceTypes, x as getBuiltinResources, bb as getBuiltinTreeData, o as getClusterList, G as getCrdData, A as getCrdResourceSingle, z as getCrdResources, H as getDirectUnknownResource, aI as getEnrichedColumns, aJ as getEnrichedColumnsWithControls, bc as getGroupsByCategory, O as getKinds, bo as getLinkToApiForm, bn as getLinkToBuiltinForm, k as getLinkToForm, bt as getNamespaceLink, aN as getObjectFormItemsDraft, b9 as getPrefixSubarrays, bs as getResourceLink, bg as getSortedKinds, bh as getSortedKindsAll, b2 as getStringByName, J as getSwagger, bj as getUppercase, ba as groupsToTreeData, bi as hslFromString, br as includesArray, b0 as isFlatObject, bq as isMultilineFromYaml, bp as isMultilineString, bF as isValidRFC3339, bk as kindByGvr, bm as namespacedByGvr, b7 as normalizeValuesForQuotasToNumber, bD as parseCoresWithUnit, b4 as parseQuotaValue, b5 as parseQuotaValueCpu, b6 as parseQuotaValueMemoryAndStorage, by as parseValueWithUnit, bl as pluralByKind, aB as prepareDataForManageableBreadcrumbs, aE as prepareDataForManageableSidebar, a$ as prepareTemplate, be as prepareUrlsToFetchForDynamicRenderer, bw as toBytes, bB as toCores, r as updateEntry, T as useApiResourceSingle, Z as useApiResourceTypesByGroup, S as useApiResources, Y as useApisResourceTypes, V as useBuiltinResourceSingle, $ as useBuiltinResourceTypes, U as useBuiltinResources, Q as useClusterList, a0 as useCrdData, X as useCrdResourceSingle, W as useCrdResources, e as useDirectUnknownResource, a2 as useInfiniteSentinel, f as useK8sSmartResource, a3 as useK8sVerbs, a7 as useKinds, a8 as useKindsRaw, a1 as useListWatch, a4 as useManyK8sSmartResource, d as usePermissions, a9 as usePluginManifest, a6 as useResourceScope, a5 as useSmartResourceParams } from './index-
|
|
1
|
+
export { af as BackToDefaultIcon, aM as BlackholeForm, aL as BlackholeFormProvider, aH as ClusterListTable, ac as ConfirmModal, aq as ContentCard, aw as CursorDefaultDiv, au as CursorPointerTag, av as CursorPointerTagMinContent, at as CustomSelect, D as DeleteIcon, l as DeleteModal, n as DeleteModalMany, ae as DownIcon, aZ as DynamicComponents, aY as DynamicRenderer, a_ as DynamicRendererWithProviders, ap as EarthIcon, h as EditIcon, aG as EnrichedTable, E as EnrichedTableProvider, ay as ErrorBoundary, az as ErrorBoundaryWithDataReset, aX as Events, ar as FlexGrow, ak as LockedIcon, ao as LookingGlassIcon, aC as ManageableBreadcrumbs, aA as ManageableBreadcrumbsProvider, aF as ManageableSidebar, aD as ManageableSidebarProvider, aO as MarketPlace, aP as MarketplaceCard, aj as MinusIcon, aS as NodeTerminal, i as PaddingContainer, am as PauseCircleIcon, ai as PlusIcon, aT as PodLogs, aU as PodLogsMonaco, aR as PodTerminal, aQ as ProjectInfoCard, ax as ResourceLink, an as ResumeCircleIcon, aW as Search, aa as Spacer, ag as SuccessIcon, ab as TreeWithSearch, as as UncontrolledSelect, al as UnlockedIcon, ad as UpIcon, aV as VMVNC, aK as YamlEditorSingleton, M as checkIfApiInstanceNamespaceScoped, N as checkIfBuiltInInstanceNamespaceScoped, I as checkPermission, bu as convertBytes, bC as convertCompute, bz as convertCores, bx as convertStorage, bd as createContextFactory, q as createNewEntry, bf as deepMerge, t as deleteEntry, ah as feedbackIcons, K as filterIfApiInstanceNamespaceScoped, L as filterIfBuiltInInstanceNamespaceScoped, b1 as filterSelectOptions, b3 as floorToDecimal, bv as formatBytesAuto, bA as formatCoresAuto, bE as formatDateAuto, b8 as getAllPathsFromObj, w as getApiResourceSingle, B as getApiResourceTypes, C as getApiResourceTypesByApiGroup, v as getApiResources, y as getBuiltinResourceSingle, F as getBuiltinResourceTypes, x as getBuiltinResources, bb as getBuiltinTreeData, o as getClusterList, G as getCrdData, A as getCrdResourceSingle, z as getCrdResources, H as getDirectUnknownResource, aI as getEnrichedColumns, aJ as getEnrichedColumnsWithControls, bc as getGroupsByCategory, O as getKinds, bo as getLinkToApiForm, bn as getLinkToBuiltinForm, k as getLinkToForm, bt as getNamespaceLink, aN as getObjectFormItemsDraft, b9 as getPrefixSubarrays, bs as getResourceLink, bg as getSortedKinds, bh as getSortedKindsAll, b2 as getStringByName, J as getSwagger, bj as getUppercase, ba as groupsToTreeData, bi as hslFromString, br as includesArray, b0 as isFlatObject, bq as isMultilineFromYaml, bp as isMultilineString, bF as isValidRFC3339, bk as kindByGvr, bm as namespacedByGvr, b7 as normalizeValuesForQuotasToNumber, bD as parseCoresWithUnit, b4 as parseQuotaValue, b5 as parseQuotaValueCpu, b6 as parseQuotaValueMemoryAndStorage, by as parseValueWithUnit, bl as pluralByKind, aB as prepareDataForManageableBreadcrumbs, aE as prepareDataForManageableSidebar, a$ as prepareTemplate, be as prepareUrlsToFetchForDynamicRenderer, bw as toBytes, bB as toCores, r as updateEntry, T as useApiResourceSingle, Z as useApiResourceTypesByGroup, S as useApiResources, Y as useApisResourceTypes, V as useBuiltinResourceSingle, $ as useBuiltinResourceTypes, U as useBuiltinResources, Q as useClusterList, a0 as useCrdData, X as useCrdResourceSingle, W as useCrdResources, e as useDirectUnknownResource, a2 as useInfiniteSentinel, f as useK8sSmartResource, a3 as useK8sVerbs, a7 as useKinds, a8 as useKindsRaw, a1 as useListWatch, a4 as useManyK8sSmartResource, d as usePermissions, a9 as usePluginManifest, a6 as useResourceScope, a5 as useSmartResourceParams } from './index-DZxEKtGA.mjs';
|
|
2
2
|
//# sourceMappingURL=openapi-k8s-toolkit.es.js.map
|
|
@@ -35722,6 +35722,50 @@
|
|
|
35722
35722
|
const value = getValueByPath(reqData, path);
|
|
35723
35723
|
return Array.isArray(value) && value.length === 0;
|
|
35724
35724
|
};
|
|
35725
|
+
const STATUS_SEVERITY = {
|
|
35726
|
+
"500": 3,
|
|
35727
|
+
"403": 2,
|
|
35728
|
+
"404": 1,
|
|
35729
|
+
error: 0
|
|
35730
|
+
};
|
|
35731
|
+
const httpStatusToResultStatus = (statusCode) => {
|
|
35732
|
+
if (statusCode === 403) return "403";
|
|
35733
|
+
if (statusCode === 404) return "404";
|
|
35734
|
+
if (statusCode && statusCode >= 500) return "500";
|
|
35735
|
+
return "error";
|
|
35736
|
+
};
|
|
35737
|
+
const getDefaultTitle = (status) => {
|
|
35738
|
+
if (status === "403") return "Access Denied";
|
|
35739
|
+
if (status === "404") return "Not Found";
|
|
35740
|
+
if (status === "500") return "Server Error";
|
|
35741
|
+
return "Error";
|
|
35742
|
+
};
|
|
35743
|
+
const resolveItemsPath = (itemsPath, index) => {
|
|
35744
|
+
if (Array.isArray(itemsPath)) return itemsPath[index] ?? ".items";
|
|
35745
|
+
return itemsPath ?? ".items";
|
|
35746
|
+
};
|
|
35747
|
+
const checkReqIndex = (reqIndex, multiQueryData, getErrorForReq, shouldCheckEmpty, itemsPath) => {
|
|
35748
|
+
const error = getErrorForReq(reqIndex);
|
|
35749
|
+
const emptyListDetected = !error && shouldCheckEmpty && isEmptyAtPath(multiQueryData, reqIndex, itemsPath);
|
|
35750
|
+
if (!error && !emptyListDetected) return null;
|
|
35751
|
+
const httpStatus = emptyListDetected ? 404 : extractHttpStatus(error);
|
|
35752
|
+
const resultStatus = httpStatusToResultStatus(httpStatus);
|
|
35753
|
+
const severity = STATUS_SEVERITY[resultStatus] ?? 0;
|
|
35754
|
+
const message = emptyListDetected ? "The requested resource was not found" : extractErrorMessage(error);
|
|
35755
|
+
return { resultStatus, severity, message };
|
|
35756
|
+
};
|
|
35757
|
+
const findWorstError = (reqIndexes, multiQueryData, getErrorForReq, shouldCheckEmpty, itemsPath) => reqIndexes.reduce(
|
|
35758
|
+
(worst, reqIndex, index) => {
|
|
35759
|
+
const resolved = resolveItemsPath(itemsPath, index);
|
|
35760
|
+
const result = checkReqIndex(reqIndex, multiQueryData, getErrorForReq, shouldCheckEmpty, resolved);
|
|
35761
|
+
if (!result) return worst;
|
|
35762
|
+
if (!worst || result.severity > worst.severity) {
|
|
35763
|
+
return { resultStatus: result.resultStatus, message: result.message, severity: result.severity };
|
|
35764
|
+
}
|
|
35765
|
+
return worst;
|
|
35766
|
+
},
|
|
35767
|
+
null
|
|
35768
|
+
);
|
|
35725
35769
|
|
|
35726
35770
|
const isValidLabelSelectorObject = (input) => {
|
|
35727
35771
|
if (typeof input !== "object" || input === null || Array.isArray(input) || Object.getPrototypeOf(input) !== Object.prototype) {
|
|
@@ -81968,18 +82012,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
81968
82012
|
] });
|
|
81969
82013
|
};
|
|
81970
82014
|
|
|
81971
|
-
const httpStatusToResultStatus = (statusCode) => {
|
|
81972
|
-
if (statusCode === 403) return "403";
|
|
81973
|
-
if (statusCode === 404) return "404";
|
|
81974
|
-
if (statusCode && statusCode >= 500) return "500";
|
|
81975
|
-
return "error";
|
|
81976
|
-
};
|
|
81977
|
-
const getDefaultTitle = (status) => {
|
|
81978
|
-
if (status === "403") return "Access Denied";
|
|
81979
|
-
if (status === "404") return "Not Found";
|
|
81980
|
-
if (status === "500") return "Server Error";
|
|
81981
|
-
return "Error";
|
|
81982
|
-
};
|
|
81983
82015
|
const AntdResult = ({ data, children }) => {
|
|
81984
82016
|
const { data: multiQueryData, isLoading, getErrorForReq } = useMultiQuery();
|
|
81985
82017
|
const partsOfUrl = usePartsOfUrl();
|
|
@@ -81990,20 +82022,26 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
81990
82022
|
acc[index.toString()] = value;
|
|
81991
82023
|
return acc;
|
|
81992
82024
|
}, {});
|
|
82025
|
+
const shouldCheckEmpty = data.checkEmpty !== false;
|
|
81993
82026
|
if (typeof data.reqIndex === "number") {
|
|
81994
|
-
const
|
|
81995
|
-
const
|
|
81996
|
-
|
|
81997
|
-
|
|
81998
|
-
|
|
82027
|
+
const itemsPath = resolveItemsPath(data.itemsPath, 0);
|
|
82028
|
+
const result = checkReqIndex(data.reqIndex, multiQueryData, getErrorForReq, shouldCheckEmpty, itemsPath);
|
|
82029
|
+
if (!result) {
|
|
82030
|
+
return children ?? null;
|
|
82031
|
+
}
|
|
82032
|
+
const status = data.status ?? result.resultStatus;
|
|
82033
|
+
const title = data.title ? parseAll({ text: data.title, replaceValues, multiQueryData }) : getDefaultTitle(status);
|
|
82034
|
+
const subTitle = data.subTitle ? parseAll({ text: data.subTitle, replaceValues, multiQueryData }) : result.message;
|
|
82035
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Result, { status, title, subTitle, style: data.style });
|
|
82036
|
+
}
|
|
82037
|
+
if (Array.isArray(data.reqIndex)) {
|
|
82038
|
+
const worst = findWorstError(data.reqIndex, multiQueryData, getErrorForReq, shouldCheckEmpty, data.itemsPath);
|
|
82039
|
+
if (!worst) {
|
|
81999
82040
|
return children ?? null;
|
|
82000
82041
|
}
|
|
82001
|
-
const
|
|
82002
|
-
const autoStatus = httpStatusToResultStatus(httpStatus);
|
|
82003
|
-
const autoMessage = emptyListDetected ? "The requested resource was not found" : extractErrorMessage(error);
|
|
82004
|
-
const status = data.status ?? autoStatus;
|
|
82042
|
+
const status = data.status ?? worst.resultStatus;
|
|
82005
82043
|
const title = data.title ? parseAll({ text: data.title, replaceValues, multiQueryData }) : getDefaultTitle(status);
|
|
82006
|
-
const subTitle = data.subTitle ? parseAll({ text: data.subTitle, replaceValues, multiQueryData }) :
|
|
82044
|
+
const subTitle = data.subTitle ? parseAll({ text: data.subTitle, replaceValues, multiQueryData }) : worst.message;
|
|
82007
82045
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Result, { status, title, subTitle, style: data.style });
|
|
82008
82046
|
}
|
|
82009
82047
|
const parsedTitle = data.title ? parseAll({ text: data.title, replaceValues, multiQueryData }) : void 0;
|
|
@@ -82087,6 +82125,12 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
82087
82125
|
const FactoryConfigContextProvider = factoryConfigContext.Provider;
|
|
82088
82126
|
factoryConfigContext.useTypedContext;
|
|
82089
82127
|
|
|
82128
|
+
const EffectiveAntdResultWrapper = ({
|
|
82129
|
+
effectiveReqIndexes,
|
|
82130
|
+
itemsPath,
|
|
82131
|
+
children
|
|
82132
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(AntdResult, { data: { id: "effective-antd-result", reqIndex: effectiveReqIndexes, itemsPath }, children });
|
|
82133
|
+
|
|
82090
82134
|
const STRING_KEYS = [
|
|
82091
82135
|
"cluster",
|
|
82092
82136
|
"apiGroup",
|
|
@@ -82098,7 +82142,15 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
82098
82142
|
];
|
|
82099
82143
|
const DynamicRendererWithProviders = (props) => {
|
|
82100
82144
|
const location = reactRouterDom.useLocation();
|
|
82101
|
-
const {
|
|
82145
|
+
const {
|
|
82146
|
+
urlsToFetch,
|
|
82147
|
+
dataToApplyToContext,
|
|
82148
|
+
theme,
|
|
82149
|
+
nodeTerminalDefaultProfile,
|
|
82150
|
+
disableEventBubbling,
|
|
82151
|
+
effectiveReqIndexes,
|
|
82152
|
+
effectiveItemsPath
|
|
82153
|
+
} = props;
|
|
82102
82154
|
const directUrls = urlsToFetch.filter((el) => typeof el === "string");
|
|
82103
82155
|
const k8sResourcesUrls = urlsToFetch.filter((el) => typeof el !== "string");
|
|
82104
82156
|
const preparedUrlsToFetch = prepareUrlsToFetchForDynamicRenderer({
|
|
@@ -82133,7 +82185,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
82133
82185
|
{
|
|
82134
82186
|
items: [...preparedK8sResoucesUrls, ...preparedUrlsToFetch],
|
|
82135
82187
|
dataToApplyToContext,
|
|
82136
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundaryWithDataReset, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props }) })
|
|
82188
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundaryWithDataReset, { children: effectiveReqIndexes && effectiveReqIndexes.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(EffectiveAntdResultWrapper, { effectiveReqIndexes, itemsPath: effectiveItemsPath, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DynamicRenderer, { ...props }) })
|
|
82137
82189
|
}
|
|
82138
82190
|
) }) }) })
|
|
82139
82191
|
}
|