@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.12 → 1.4.0-alpha.13
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-CWMOa8gQ.mjs → index-C5QXAXXJ.mjs} +125 -12
- package/dist/index-C5QXAXXJ.mjs.map +1 -0
- package/dist/{index-DlJkWTNK.mjs → index-D_swkE1M.mjs} +2 -2
- package/dist/{index-DlJkWTNK.mjs.map → index-D_swkE1M.mjs.map} +1 -1
- package/dist/openapi-k8s-toolkit.es.js +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +123 -9
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/EnrichedTable/index.d.ts +2 -2
- package/dist/types/components/molecules/EnrichedTable/organisms/ClusterListTable/ClusterListTable.d.ts +24 -0
- package/dist/types/components/molecules/EnrichedTable/organisms/ClusterListTable/index.d.ts +2 -0
- package/dist/types/components/molecules/EnrichedTable/organisms/index.d.ts +2 -0
- package/dist/types/components/molecules/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/index-CWMOa8gQ.mjs.map +0 -1
|
@@ -78551,7 +78551,7 @@ const TolerationsModal = ({
|
|
|
78551
78551
|
};
|
|
78552
78552
|
|
|
78553
78553
|
const LazyEnrichedTableModal = lazy(
|
|
78554
|
-
() => import('./index-
|
|
78554
|
+
() => import('./index-D_swkE1M.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
|
|
78555
78555
|
);
|
|
78556
78556
|
const renderActiveType = (activeType, extraProps) => {
|
|
78557
78557
|
if (!activeType) return null;
|
|
@@ -80935,15 +80935,35 @@ const getEnrichedColumns = ({
|
|
|
80935
80935
|
const possibleCustomTypeWithProps = additionalPrinterColumnsKeyTypeProps && el.key ? additionalPrinterColumnsKeyTypeProps[el.key.toString()] : void 0;
|
|
80936
80936
|
const useFactorySearch = possibleCustomTypeWithProps?.type === "factory";
|
|
80937
80937
|
const colKey = el.key != null && String(el.key) || (Array.isArray(el.dataIndex) ? el.dataIndex.join(".") : String(el.dataIndex ?? colIndex));
|
|
80938
|
+
const getCellTextFromRecord = (record) => {
|
|
80939
|
+
const { dataIndex } = el;
|
|
80940
|
+
if (!dataIndex) return "";
|
|
80941
|
+
const entry = Array.isArray(dataIndex) ? lodashExports.get(record, dataIndex) : record?.[dataIndex];
|
|
80942
|
+
if (entry === null || entry === void 0) return "";
|
|
80943
|
+
if (typeof entry === "string") return entry.trim().toLowerCase();
|
|
80944
|
+
if (typeof entry === "number" || typeof entry === "boolean") return String(entry).toLowerCase();
|
|
80945
|
+
if (Array.isArray(entry))
|
|
80946
|
+
return entry.map((item) => String(item)).join(", ").trim().toLowerCase();
|
|
80947
|
+
if (typeof entry === "object") return JSON.stringify(entry).trim().toLowerCase();
|
|
80948
|
+
return String(entry).trim().toLowerCase();
|
|
80949
|
+
};
|
|
80938
80950
|
const getCellTextFromDOM = (record) => {
|
|
80951
|
+
if (typeof document === "undefined") return "";
|
|
80939
80952
|
const rowKey = getRowKey(record);
|
|
80940
|
-
const
|
|
80941
|
-
const
|
|
80942
|
-
|
|
80943
|
-
|
|
80953
|
+
const rowKeyStr = String(rowKey);
|
|
80954
|
+
const colKeyStr = String(colKey);
|
|
80955
|
+
const cells = document.querySelectorAll("td[data-rowkey][data-colkey]");
|
|
80956
|
+
for (let i = 0; i < cells.length; i += 1) {
|
|
80957
|
+
const cell = cells[i];
|
|
80958
|
+
if (cell.getAttribute("data-rowkey") === rowKeyStr && cell.getAttribute("data-colkey") === colKeyStr) {
|
|
80959
|
+
return (cell.innerText || cell.textContent || "").trim().toLowerCase();
|
|
80960
|
+
}
|
|
80961
|
+
}
|
|
80962
|
+
return "";
|
|
80944
80963
|
};
|
|
80964
|
+
const getComparableCellText = (record) => getCellTextFromDOM(record) || getCellTextFromRecord(record);
|
|
80945
80965
|
const getMemoryInBytes = (record) => {
|
|
80946
|
-
const text =
|
|
80966
|
+
const text = getComparableCellText(record);
|
|
80947
80967
|
if (!text) return 0;
|
|
80948
80968
|
const parsed = parseValueWithUnit(text);
|
|
80949
80969
|
if (!parsed) return 0;
|
|
@@ -80954,7 +80974,7 @@ const getEnrichedColumns = ({
|
|
|
80954
80974
|
return parsed.value;
|
|
80955
80975
|
};
|
|
80956
80976
|
const getCpuInCores = (record) => {
|
|
80957
|
-
const text =
|
|
80977
|
+
const text = getComparableCellText(record);
|
|
80958
80978
|
if (!text) return 0;
|
|
80959
80979
|
const parsed = parseCoresWithUnit(text);
|
|
80960
80980
|
if (!parsed) return 0;
|
|
@@ -81031,7 +81051,7 @@ const getEnrichedColumns = ({
|
|
|
81031
81051
|
return false;
|
|
81032
81052
|
}
|
|
81033
81053
|
if (useFactorySearch) {
|
|
81034
|
-
const text =
|
|
81054
|
+
const text = getComparableCellText(record);
|
|
81035
81055
|
return text.includes(String(value).toLowerCase());
|
|
81036
81056
|
}
|
|
81037
81057
|
const { dataIndex } = el;
|
|
@@ -81066,8 +81086,8 @@ const getEnrichedColumns = ({
|
|
|
81066
81086
|
return safeNumericCompare(aCores, bCores);
|
|
81067
81087
|
}
|
|
81068
81088
|
if (useFactorySearch) {
|
|
81069
|
-
const aText =
|
|
81070
|
-
const bText =
|
|
81089
|
+
const aText = getComparableCellText(a);
|
|
81090
|
+
const bText = getComparableCellText(b);
|
|
81071
81091
|
return aText.localeCompare(bText);
|
|
81072
81092
|
}
|
|
81073
81093
|
const { dataIndex } = el;
|
|
@@ -81307,6 +81327,99 @@ const EnrichedTable = ({
|
|
|
81307
81327
|
);
|
|
81308
81328
|
};
|
|
81309
81329
|
|
|
81330
|
+
const ClusterListTable = ({
|
|
81331
|
+
theme,
|
|
81332
|
+
dataSource,
|
|
81333
|
+
columns,
|
|
81334
|
+
pathToNavigate,
|
|
81335
|
+
recordKeysForNavigation,
|
|
81336
|
+
navigationSettings,
|
|
81337
|
+
tableProps
|
|
81338
|
+
}) => {
|
|
81339
|
+
const navigate = useNavigate();
|
|
81340
|
+
if (!columns) {
|
|
81341
|
+
return null;
|
|
81342
|
+
}
|
|
81343
|
+
const rowKey = (record) => record.key;
|
|
81344
|
+
const enrichedColumns = getEnrichedColumns({
|
|
81345
|
+
columns,
|
|
81346
|
+
theme,
|
|
81347
|
+
getRowKey: rowKey
|
|
81348
|
+
});
|
|
81349
|
+
if (!enrichedColumns) {
|
|
81350
|
+
return null;
|
|
81351
|
+
}
|
|
81352
|
+
const showTotal = (total) => `Total: ${total}`;
|
|
81353
|
+
const tryGetPathFromNavigationResource = async (clusterName) => {
|
|
81354
|
+
const resolvedCluster = clusterName;
|
|
81355
|
+
const resolvedApiGroup = navigationSettings?.apiGroup;
|
|
81356
|
+
const resolvedApiVersion = navigationSettings?.apiVersion;
|
|
81357
|
+
const resolvedPlural = navigationSettings?.plural;
|
|
81358
|
+
const resolvedResourceName = navigationSettings?.resourceName;
|
|
81359
|
+
if (!resolvedCluster || !resolvedApiGroup || !resolvedApiVersion || !resolvedPlural || !resolvedResourceName) {
|
|
81360
|
+
return void 0;
|
|
81361
|
+
}
|
|
81362
|
+
try {
|
|
81363
|
+
const { data } = await axios.get(
|
|
81364
|
+
`/api/clusters/${resolvedCluster}/k8s/apis/${resolvedApiGroup}/${resolvedApiVersion}/${resolvedPlural}`,
|
|
81365
|
+
{
|
|
81366
|
+
params: {
|
|
81367
|
+
fieldSelector: `metadata.name=${resolvedResourceName}`
|
|
81368
|
+
}
|
|
81369
|
+
}
|
|
81370
|
+
);
|
|
81371
|
+
const spec = data?.items?.[0]?.spec;
|
|
81372
|
+
return spec?.pathToNavigateFromClusterList;
|
|
81373
|
+
} catch {
|
|
81374
|
+
return void 0;
|
|
81375
|
+
}
|
|
81376
|
+
};
|
|
81377
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
81378
|
+
TableComponents.TableContainer,
|
|
81379
|
+
{
|
|
81380
|
+
$isDark: theme === "dark",
|
|
81381
|
+
$isCursorPointer: !!recordKeysForNavigation && (!!pathToNavigate || !!navigationSettings),
|
|
81382
|
+
$borderless: tableProps?.borderless,
|
|
81383
|
+
$isTotalLeft: tableProps?.isTotalLeft,
|
|
81384
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(TableComponents.HideableControls, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
81385
|
+
Table,
|
|
81386
|
+
{
|
|
81387
|
+
rowKey,
|
|
81388
|
+
dataSource,
|
|
81389
|
+
columns: enrichedColumns,
|
|
81390
|
+
pagination: tableProps?.disablePagination ? false : {
|
|
81391
|
+
position: tableProps?.paginationPosition || ["bottomLeft"],
|
|
81392
|
+
showSizeChanger: true,
|
|
81393
|
+
defaultPageSize: 10,
|
|
81394
|
+
hideOnSinglePage: false,
|
|
81395
|
+
showTotal
|
|
81396
|
+
},
|
|
81397
|
+
scroll: { x: "max-content", y: tableProps?.maxHeight },
|
|
81398
|
+
virtual: tableProps?.virtual,
|
|
81399
|
+
onRow: (record) => {
|
|
81400
|
+
return {
|
|
81401
|
+
onClick: async () => {
|
|
81402
|
+
if (recordKeysForNavigation) {
|
|
81403
|
+
const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record || {}, `$${recordKeysForNavigation}`)[0];
|
|
81404
|
+
const clusterName = typeof recordValueRaw === "string" ? recordValueRaw : void 0;
|
|
81405
|
+
const recordValue = typeof recordValueRaw === "string" ? recordValueRaw : JSON.stringify(recordValueRaw);
|
|
81406
|
+
const fetchedPathToNavigate = await tryGetPathFromNavigationResource(clusterName);
|
|
81407
|
+
const finalPathToNavigate = fetchedPathToNavigate || pathToNavigate;
|
|
81408
|
+
if (!finalPathToNavigate) {
|
|
81409
|
+
return;
|
|
81410
|
+
}
|
|
81411
|
+
const newPath = finalPathToNavigate.replaceAll("~recordValue~", recordValue);
|
|
81412
|
+
navigate(newPath);
|
|
81413
|
+
}
|
|
81414
|
+
}
|
|
81415
|
+
};
|
|
81416
|
+
}
|
|
81417
|
+
}
|
|
81418
|
+
) })
|
|
81419
|
+
}
|
|
81420
|
+
);
|
|
81421
|
+
};
|
|
81422
|
+
|
|
81310
81423
|
const prepare = ({
|
|
81311
81424
|
dataItems,
|
|
81312
81425
|
pathToKey,
|
|
@@ -90130,5 +90243,5 @@ const usePluginManifest = ({
|
|
|
90130
90243
|
});
|
|
90131
90244
|
};
|
|
90132
90245
|
|
|
90133
|
-
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,
|
|
90134
|
-
//# sourceMappingURL=index-
|
|
90246
|
+
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, parseQuotaValueCpu 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, ClusterListTable as aB, getEnrichedColumns as aC, getEnrichedColumnsWithControls as aD, YamlEditorSingleton$1 as aE, BlackholeFormProvider as aF, BlackholeForm as aG, getObjectFormItemsDraft as aH, MarketPlace as aI, MarketplaceCard as aJ, ProjectInfoCard as aK, PodTerminal as aL, NodeTerminal as aM, PodLogs as aN, PodLogsMonaco as aO, VMVNC as aP, Search as aQ, Events as aR, DynamicRenderer as aS, DynamicComponents as aT, DynamicRendererWithProviders as aU, prepareTemplate as aV, isFlatObject as aW, filterSelectOptions as aX, getStringByName as aY, floorToDecimal as aZ, parseQuotaValue 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, parseQuotaValueMemoryAndStorage as b0, normalizeValuesForQuotasToNumber as b1, getAllPathsFromObj as b2, getPrefixSubarrays as b3, groupsToTreeData as b4, getBuiltinTreeData as b5, getGroupsByCategory as b6, createContextFactory as b7, prepareUrlsToFetchForDynamicRenderer as b8, deepMerge as b9, getSortedKinds as ba, getSortedKindsAll as bb, hslFromString as bc, getUppercase as bd, kindByGvr as be, pluralByKind as bf, namespacedByGvr as bg, getLinkToBuiltinForm as bh, getLinkToApiForm as bi, isMultilineString as bj, isMultilineFromYaml as bk, includesArray as bl, getResourceLink as bm, getNamespaceLink as bn, convertBytes as bo, formatBytesAuto as bp, toBytes as bq, convertStorage as br, parseValueWithUnit as bs, convertCores as bt, formatCoresAuto as bu, toCores as bv, convertCompute as bw, parseCoresWithUnit as bx, formatDateAuto as by, isValidRFC3339 as bz, 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 };
|
|
90247
|
+
//# sourceMappingURL=index-C5QXAXXJ.mjs.map
|