@prorobotech/openapi-k8s-toolkit 1.5.0-alpha.4 → 1.5.0-alpha.6

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.
@@ -36046,6 +36046,7 @@ const PodTerminal$1 = ({
36046
36046
  cluster,
36047
36047
  namespace,
36048
36048
  podName,
36049
+ containerName,
36049
36050
  substractHeight,
36050
36051
  ...props
36051
36052
  } = data;
@@ -36057,6 +36058,7 @@ const PodTerminal$1 = ({
36057
36058
  const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
36058
36059
  const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
36059
36060
  const podNamePrepared = parseAll({ text: podName, replaceValues, multiQueryData });
36061
+ const containerNamePrepared = containerName ? parseAll({ text: containerName, replaceValues, multiQueryData }) : void 0;
36060
36062
  const {
36061
36063
  data: podInfoList,
36062
36064
  isError: isPodInfoError,
@@ -36096,6 +36098,7 @@ const PodTerminal$1 = ({
36096
36098
  cluster: clusterPrepared,
36097
36099
  namespace: namespacePrepared,
36098
36100
  podName: podNamePrepared,
36101
+ containerName: containerNamePrepared,
36099
36102
  containers,
36100
36103
  substractHeight: substractHeight || 340,
36101
36104
  ...props
@@ -78889,7 +78892,7 @@ const TolerationsModal = ({
78889
78892
  };
78890
78893
 
78891
78894
  const LazyEnrichedTableModal = lazy(
78892
- () => import('./index-DHTFNSby.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
78895
+ () => import('./index-sWQFraqw.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
78893
78896
  );
78894
78897
  const renderActiveType = (activeType, extraProps) => {
78895
78898
  if (!activeType) return null;
@@ -82271,6 +82274,70 @@ const TableFactory = ({ record, customProps, theme }) => {
82271
82274
  );
82272
82275
  };
82273
82276
 
82277
+ const DEFAULT_FIXED_NAME_COLUMN_WIDTH = 240;
82278
+ const DEFAULT_FIXED_ACTIONS_COLUMN_WIDTH = 60;
82279
+ const stringifyColumnValue = (value) => {
82280
+ if (typeof value === "string" || typeof value === "number") {
82281
+ return String(value).trim().toLowerCase();
82282
+ }
82283
+ return void 0;
82284
+ };
82285
+ const getColumnDataPath = (dataIndex) => {
82286
+ if (Array.isArray(dataIndex)) {
82287
+ return dataIndex.map(String).join(".").trim().toLowerCase();
82288
+ }
82289
+ return stringifyColumnValue(dataIndex);
82290
+ };
82291
+ const isNameColumn = (column) => {
82292
+ const key = stringifyColumnValue(column.key);
82293
+ const title = stringifyColumnValue(column.title);
82294
+ const dataPath = getColumnDataPath(column.dataIndex);
82295
+ return key === "name" || title === "name" || dataPath === "name" || dataPath === "metadata.name";
82296
+ };
82297
+ const hasFactoryItemOfType = (customProps, itemType) => {
82298
+ if (typeof customProps !== "object" || customProps === null) {
82299
+ return false;
82300
+ }
82301
+ if (!("items" in customProps) || !Array.isArray(customProps.items)) {
82302
+ return false;
82303
+ }
82304
+ return customProps.items.some(
82305
+ (item) => typeof item === "object" && item !== null && "type" in item && item.type === itemType
82306
+ );
82307
+ };
82308
+ const getFixedColumnSide = ({
82309
+ shouldFixNameColumn,
82310
+ shouldFixActionsColumn,
82311
+ currentFixed
82312
+ }) => {
82313
+ if (shouldFixNameColumn) {
82314
+ return "left";
82315
+ }
82316
+ if (shouldFixActionsColumn) {
82317
+ return "right";
82318
+ }
82319
+ return currentFixed;
82320
+ };
82321
+ const getFixedColumnWidth = ({
82322
+ possibleColWidth,
82323
+ currentWidth,
82324
+ shouldFixNameColumn,
82325
+ shouldFixActionsColumn
82326
+ }) => {
82327
+ if (possibleColWidth !== void 0) {
82328
+ return possibleColWidth;
82329
+ }
82330
+ if (currentWidth !== void 0) {
82331
+ return currentWidth;
82332
+ }
82333
+ if (shouldFixNameColumn) {
82334
+ return DEFAULT_FIXED_NAME_COLUMN_WIDTH;
82335
+ }
82336
+ if (shouldFixActionsColumn) {
82337
+ return DEFAULT_FIXED_ACTIONS_COLUMN_WIDTH;
82338
+ }
82339
+ return void 0;
82340
+ };
82274
82341
  const getCellRender = ({
82275
82342
  value,
82276
82343
  record,
@@ -82372,6 +82439,7 @@ const getEnrichedColumns = ({
82372
82439
  if (!columns) {
82373
82440
  return void 0;
82374
82441
  }
82442
+ let hasFixedNameColumn = false;
82375
82443
  return columns.map((el, colIndex) => {
82376
82444
  const possibleAdditionalPrinterColumnsCustomSortersAndFiltersType = additionalPrinterColumnsCustomSortersAndFilters?.find(({ key }) => key === el.key)?.type;
82377
82445
  const isSortersAndFiltersDisabled = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "disabled";
@@ -82383,6 +82451,11 @@ const getEnrichedColumns = ({
82383
82451
  const possibleTooltip = additionalPrinterColumnsTooltips?.find(({ key }) => key === el.key)?.value;
82384
82452
  const possibleCustomTypeWithProps = additionalPrinterColumnsKeyTypeProps && el.key ? additionalPrinterColumnsKeyTypeProps[el.key.toString()] : void 0;
82385
82453
  const originalRender = el.render;
82454
+ const shouldFixNameColumn = !hasFixedNameColumn && isNameColumn(el);
82455
+ const shouldFixActionsColumn = possibleCustomTypeWithProps?.type === "factory" && hasFactoryItemOfType(possibleCustomTypeWithProps.customProps, "ActionsDropdown");
82456
+ if (shouldFixNameColumn) {
82457
+ hasFixedNameColumn = true;
82458
+ }
82386
82459
  const useFactorySearch = possibleCustomTypeWithProps?.type === "factory";
82387
82460
  const colKey = el.key != null && String(el.key) || (Array.isArray(el.dataIndex) ? el.dataIndex.join(".") : String(el.dataIndex ?? colIndex));
82388
82461
  const getCellTextFromRecord = (record) => {
@@ -82481,7 +82554,17 @@ const getEnrichedColumns = ({
82481
82554
  theme
82482
82555
  });
82483
82556
  },
82484
- width: possibleColWidth,
82557
+ fixed: getFixedColumnSide({
82558
+ shouldFixNameColumn,
82559
+ shouldFixActionsColumn,
82560
+ currentFixed: el.fixed
82561
+ }),
82562
+ width: getFixedColumnWidth({
82563
+ possibleColWidth,
82564
+ currentWidth: el.width,
82565
+ shouldFixNameColumn,
82566
+ shouldFixActionsColumn
82567
+ }),
82485
82568
  // for factory search
82486
82569
  onCell: (record) => {
82487
82570
  const rowKey = getRowKey(record);
@@ -82612,6 +82695,7 @@ const getEnrichedColumnsWithControls = ({
82612
82695
  dataIndex: "internalDataForControls",
82613
82696
  key: "controls",
82614
82697
  className: "controls",
82698
+ fixed: "right",
82615
82699
  width: 60,
82616
82700
  render: (value) => {
82617
82701
  return (
@@ -82772,6 +82856,7 @@ const EnrichedTable = ({
82772
82856
  rowClassName,
82773
82857
  rowSelection: selectData ? {
82774
82858
  type: "checkbox",
82859
+ fixed: "left",
82775
82860
  columnWidth: 48,
82776
82861
  selectedRowKeys: selectData.selectedRowKeys,
82777
82862
  onChange: (selectedRowKeys, selectedRows) => {
@@ -90982,10 +91067,45 @@ const Styled$b = {
90982
91067
  CustomSelect: CustomSelect$3
90983
91068
  };
90984
91069
 
90985
- const PodTerminal = ({ cluster, namespace, podName, containers, substractHeight }) => {
90986
- const [currentContainer, setCurrentContainer] = useState(containers[0] || void 0);
91070
+ const getScopedContainerNames = (containers, containerName) => {
91071
+ const normalizedContainerName = containerName?.trim();
91072
+ if (!normalizedContainerName) {
91073
+ return containers;
91074
+ }
91075
+ return containers.filter((container) => container === normalizedContainerName);
91076
+ };
91077
+
91078
+ const PodTerminal = ({
91079
+ cluster,
91080
+ namespace,
91081
+ podName,
91082
+ containerName,
91083
+ containers,
91084
+ substractHeight
91085
+ }) => {
91086
+ const pinnedContainerName = containerName?.trim();
91087
+ const availableContainers = useMemo(
91088
+ () => getScopedContainerNames(containers, pinnedContainerName),
91089
+ [containers, pinnedContainerName]
91090
+ );
91091
+ const [currentContainer, setCurrentContainer] = useState(availableContainers[0] || void 0);
90987
91092
  const endpoint = `/api/clusters/${cluster}/openapi-bff-ws/terminal/terminalPod/terminalPod`;
90988
- if (containers.length === 0) {
91093
+ useEffect(() => {
91094
+ setCurrentContainer((prevContainer) => {
91095
+ if (prevContainer && availableContainers.includes(prevContainer)) {
91096
+ return prevContainer;
91097
+ }
91098
+ return availableContainers[0] || void 0;
91099
+ });
91100
+ }, [availableContainers]);
91101
+ if (pinnedContainerName && availableContainers.length === 0) {
91102
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
91103
+ 'Container "',
91104
+ pinnedContainerName,
91105
+ '" is not running'
91106
+ ] });
91107
+ }
91108
+ if (availableContainers.length === 0) {
90989
91109
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "No Running Containers" });
90990
91110
  }
90991
91111
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -90993,9 +91113,9 @@ const PodTerminal = ({ cluster, namespace, podName, containers, substractHeight
90993
91113
  Select,
90994
91114
  {
90995
91115
  placeholder: "Select container",
90996
- options: containers.map((container) => ({ value: container, label: container })),
91116
+ options: availableContainers.map((container) => ({ value: container, label: container })),
90997
91117
  filterOption: filterSelectOptions,
90998
- disabled: containers.length === 0,
91118
+ disabled: Boolean(pinnedContainerName),
90999
91119
  showSearch: true,
91000
91120
  value: currentContainer,
91001
91121
  onChange: (value) => {
@@ -94476,4 +94596,4 @@ const usePluginManifest = ({
94476
94596
  };
94477
94597
 
94478
94598
  export { useCrdResourceSingle as $, getBuiltinResources as A, getBuiltinResourceSingle as B, getCrdResources as C, DeleteIcon as D, EnrichedTableProvider as E, getCrdResourceSingle as F, getApiResourceTypes as G, getApiResourceTypesByApiGroup as H, getBuiltinResourceTypes as I, getCrdData as J, getDirectUnknownResource as K, checkPermission as L, getSwagger as M, filterIfApiInstanceNamespaceScoped as N, filterIfBuiltInInstanceNamespaceScoped as O, PerRequestError as P, checkIfApiInstanceNamespaceScoped as Q, ReadOnlyModal as R, checkIfBuiltInInstanceNamespaceScoped as S, getKinds as T, useClusterList as U, useApiResources as V, useApiResourceSingle as W, useBuiltinResources as X, useBuiltinResourceSingle as Y, useCrdResources as Z, _$1 as _, useTheme as a, DynamicRenderer as a$, useApisResourceTypes as a0, useApiResourceTypesByGroup as a1, useBuiltinResourceTypes as a2, useCrdData as a3, useListWatch as a4, useInfiniteSentinel as a5, useK8sVerbs as a6, useManyK8sSmartResource as a7, useSmartResourceParams as a8, useResourceScope as a9, ResourceLink as aA, ErrorBoundary as aB, ErrorBoundaryWithDataReset as aC, ManageableBreadcrumbsProvider as aD, prepareDataForManageableBreadcrumbs as aE, ManageableBreadcrumbs as aF, ManageableSidebarProvider as aG, prepareDataForManageableSidebar as aH, ManageableSidebar as aI, EnrichedTable as aJ, ClusterListTable as aK, getEnrichedColumns as aL, getEnrichedColumnsWithControls as aM, YamlEditorSingleton$1 as aN, BlackholeFormProvider as aO, BlackholeForm as aP, getObjectFormItemsDraft as aQ, MarketPlace as aR, MarketplaceCard as aS, ProjectInfoCard as aT, PodTerminal as aU, NodeTerminal as aV, PodLogs as aW, PodLogsMonaco as aX, VMVNC as aY, Search as aZ, Events as a_, useKinds as aa, useKindsRaw as ab, usePluginManifest as ac, Spacer$1 as ad, TreeWithSearch as ae, ConfirmModal as af, UpIcon as ag, DownIcon as ah, BackToDefaultIcon as ai, SuccessIcon as aj, feedbackIcons as ak, PlusIcon as al, MinusIcon as am, LockedIcon as an, UnlockedIcon as ao, PauseCircleIcon as ap, ResumeCircleIcon as aq, LookingGlassIcon as ar, EarthIcon as as, ContentCard$1 as at, FlexGrow as au, UncontrolledSelect as av, CustomSelect$4 as aw, CursorPointerTag as ax, CursorPointerTagMinContent as ay, CursorDefaultDiv as az, usePartsOfUrl as b, DynamicComponents as b0, DynamicRendererWithProviders as b1, prepareTemplate as b2, isFlatObject as b3, filterSelectOptions as b4, getStringByName as b5, floorToDecimal as b6, parseQuotaValue as b7, parseQuotaValueCpu as b8, parseQuotaValueMemoryAndStorage as b9, convertStorage as bA, parseValueWithUnit as bB, convertCores as bC, formatCoresAuto as bD, toCores as bE, convertCompute as bF, parseCoresWithUnit as bG, formatDateAuto as bH, isValidRFC3339 as bI, normalizeValuesForQuotasToNumber as ba, getAllPathsFromObj as bb, getPrefixSubarrays as bc, groupsToTreeData as bd, getBuiltinTreeData as be, getGroupsByCategory as bf, createContextFactory as bg, prepareUrlsToFetchForDynamicRenderer as bh, deepMerge as bi, getSortedKinds as bj, getSortedKindsAll as bk, hslFromString as bl, getUppercase as bm, kindByGvr as bn, pluralByKind as bo, namespacedByGvr as bp, getLinkToBuiltinForm as bq, getLinkToApiForm as br, isMultilineString as bs, isMultilineFromYaml as bt, includesArray as bu, getResourceLink as bv, getNamespaceLink as bw, convertBytes as bx, formatBytesAuto as by, toBytes as bz, useAutoPerRequestError as c, usePermissions as d, useDirectUnknownResource as e, useK8sSmartResource as f, jsxRuntimeExports as g, EditIcon as h, PaddingContainer as i, jp as j, getLinkToForm as k, DeleteModal as l, mergePerRequestErrors as m, DeleteModalMany as n, getClusterList as o, parseAll as p, createNewEntry as q, updateEntry as r, serializeLabelsWithNoEncoding$1 as s, deleteEntry as t, useMultiQuery as u, patchEntryWithReplaceOp as v, patchEntryWithMergePatch as w, patchEntryWithDeleteOp as x, getApiResources as y, getApiResourceSingle as z };
94479
- //# sourceMappingURL=index-D8riHM_k.mjs.map
94599
+ //# sourceMappingURL=index-C5cixTVm.mjs.map