@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.22 → 1.4.0-alpha.23

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.
@@ -9550,8 +9550,13 @@ const checkIfBuiltInInstanceNamespaceScoped = async ({
9550
9550
  return data;
9551
9551
  };
9552
9552
 
9553
- const useSmartResourceParams = ({ cluster, namespace }) => {
9553
+ const useSmartResourceParams = ({
9554
+ cluster,
9555
+ namespace,
9556
+ enabler
9557
+ }) => {
9554
9558
  const [searchParams] = useSearchParams();
9559
+ const clusterPrepared = cluster ?? "";
9555
9560
  const rawEntries = useMemo(() => {
9556
9561
  const raw = searchParams.get("resources");
9557
9562
  if (!raw) return [];
@@ -9559,19 +9564,20 @@ const useSmartResourceParams = ({ cluster, namespace }) => {
9559
9564
  const [apiGroup = "", apiVersion = "", plural = ""] = entry.split("/");
9560
9565
  const normalizedGroup = apiGroup === "builtin" || apiGroup === "" ? void 0 : apiGroup;
9561
9566
  return {
9562
- cluster,
9567
+ cluster: clusterPrepared,
9563
9568
  plural,
9564
9569
  apiGroup: normalizedGroup,
9565
9570
  apiVersion
9566
9571
  };
9567
9572
  }).filter((e) => Boolean(e.plural));
9568
- }, [searchParams, cluster]);
9573
+ }, [searchParams, clusterPrepared]);
9569
9574
  const scopeQueries = useQueries({
9570
9575
  queries: rawEntries.map((e) => {
9571
9576
  const isApi = Boolean(e.apiGroup);
9577
+ const scopeEnabler = Boolean((enabler ?? true) && e.cluster && e.plural && (!isApi || e.apiVersion));
9572
9578
  return {
9573
9579
  queryKey: ["resource-scope", e.cluster, isApi ? e.apiGroup : "builtin", e.apiVersion ?? "", e.plural],
9574
- enabled: Boolean(e.cluster && e.plural && (!isApi || e.apiVersion)),
9580
+ enabled: scopeEnabler,
9575
9581
  queryFn: () => {
9576
9582
  if (isApi) {
9577
9583
  return checkIfApiInstanceNamespaceScoped({
@@ -78649,7 +78655,7 @@ const TolerationsModal = ({
78649
78655
  };
78650
78656
 
78651
78657
  const LazyEnrichedTableModal = lazy(
78652
- () => import('./index-CR0966Fg.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
78658
+ () => import('./index-oRwnOGcM.mjs').then((mod) => ({ default: mod.EnrichedTableModal }))
78653
78659
  );
78654
78660
  const renderActiveType = (activeType, extraProps) => {
78655
78661
  if (!activeType) return null;
@@ -85396,6 +85402,7 @@ const buildConcretePathForNewItem = (tpl, arrayPath, newIndex) => {
85396
85402
  const result = [...realizedPrefix, newIndex, ...w.slice(arrayPath.length + 1)];
85397
85403
  return result;
85398
85404
  };
85405
+ const getConcretePathsForNewArrayItem = (templates, arrayPath, newIndex) => templates.filter((tpl) => templateMatchesArray(tpl, arrayPath)).map((tpl) => buildConcretePathForNewItem(tpl, arrayPath, newIndex));
85399
85406
  const scrubLiteralWildcardKeys = (input) => {
85400
85407
  if (Array.isArray(input)) return input.map(scrubLiteralWildcardKeys);
85401
85408
  if (_$1.isPlainObject(input)) {
@@ -85593,7 +85600,15 @@ const BlackholeForm = ({
85593
85600
  return value;
85594
85601
  });
85595
85602
  };
85596
- const [persistedKeys, setPersistedKeys] = useState(persistedPaths || []);
85603
+ const exactPersistedPaths = useMemo(
85604
+ () => (persistedPaths || []).filter((path) => !path.some((seg) => seg === "*")),
85605
+ [persistedPaths]
85606
+ );
85607
+ const persistedWildcardTemplates = useMemo(
85608
+ () => (persistedPaths || []).filter((path) => path.some((seg) => seg === "*")).map((path) => ({ wildcardPath: sanitizeWildcardPath(path) })),
85609
+ [persistedPaths]
85610
+ );
85611
+ const [persistedKeys, setPersistedKeys] = useState(exactPersistedPaths);
85597
85612
  const [resolvedHiddenPaths, setResolvedHiddenPaths] = useState([]);
85598
85613
  const blockedPathsRef = useRef(/* @__PURE__ */ new Set());
85599
85614
  const manualBlockedPathsRef = useRef(/* @__PURE__ */ new Set());
@@ -85778,6 +85793,29 @@ const BlackholeForm = ({
85778
85793
  },
85779
85794
  [form, prefillTemplates]
85780
85795
  );
85796
+ const applyPersistedForNewArrayItem = useCallback(
85797
+ (arrayPath, newIndex) => {
85798
+ const concretePaths = getConcretePathsForNewArrayItem(
85799
+ persistedWildcardTemplates,
85800
+ arrayPath,
85801
+ newIndex
85802
+ );
85803
+ if (!concretePaths.length) return;
85804
+ setPersistedKeys((prev) => {
85805
+ const seen = new Set(prev.map((x) => JSON.stringify(x)));
85806
+ const merged = [...prev];
85807
+ concretePaths.forEach((path) => {
85808
+ const key = JSON.stringify(path);
85809
+ if (!seen.has(key)) {
85810
+ seen.add(key);
85811
+ merged.push(path);
85812
+ }
85813
+ });
85814
+ return merged;
85815
+ });
85816
+ },
85817
+ [persistedWildcardTemplates]
85818
+ );
85781
85819
  const hiddenWildcardTemplates = useMemo(() => {
85782
85820
  const raw = hiddenPaths ?? [];
85783
85821
  raw.forEach((p, i) => wdbg(`#${i}`, p));
@@ -85814,7 +85852,26 @@ const BlackholeForm = ({
85814
85852
  }
85815
85853
  return merged;
85816
85854
  });
85817
- }, [initialValues, hiddenWildcardTemplates, expandedWildcardTemplates]);
85855
+ const persistedResolved = expandWildcardTemplates(
85856
+ persistedWildcardTemplates.map((tpl) => tpl.wildcardPath),
85857
+ initialValues,
85858
+ {
85859
+ includeMissingFinalForWildcard: true
85860
+ }
85861
+ );
85862
+ setPersistedKeys((prev) => {
85863
+ const seen = new Set(prev.map((x) => JSON.stringify(x)));
85864
+ const merged = [...prev];
85865
+ for (const p of persistedResolved) {
85866
+ const k = JSON.stringify(p);
85867
+ if (!seen.has(k)) {
85868
+ seen.add(k);
85869
+ merged.push(p);
85870
+ }
85871
+ }
85872
+ return merged;
85873
+ });
85874
+ }, [initialValues, hiddenWildcardTemplates, expandedWildcardTemplates, persistedWildcardTemplates]);
85818
85875
  const resolvedHiddenStringPaths = useMemo(
85819
85876
  () => resolvedHiddenPaths.map(toStringPath),
85820
85877
  [resolvedHiddenPaths]
@@ -85956,6 +86013,7 @@ const BlackholeForm = ({
85956
86013
  }
85957
86014
  blockedPathsRef.current.delete(JSON.stringify(itemPath));
85958
86015
  applyPrefillForNewArrayItem(arrayPath, i);
86016
+ applyPersistedForNewArrayItem(arrayPath, i);
85959
86017
  }
85960
86018
  }
85961
86019
  }
@@ -85968,6 +86026,7 @@ const BlackholeForm = ({
85968
86026
  const arrayPath = JSON.parse(k);
85969
86027
  for (let i = prevLen; i < newLen; i++) {
85970
86028
  applyPrefillForNewArrayItem(arrayPath, i);
86029
+ applyPersistedForNewArrayItem(arrayPath, i);
85971
86030
  }
85972
86031
  }
85973
86032
  }
@@ -85986,6 +86045,7 @@ const BlackholeForm = ({
85986
86045
  persistedKeys,
85987
86046
  debouncedPostValuesToYaml,
85988
86047
  applyPrefillForNewArrayItem,
86048
+ applyPersistedForNewArrayItem,
85989
86049
  hiddenWildcardTemplates,
85990
86050
  expandedWildcardTemplates
85991
86051
  ]
@@ -86401,6 +86461,13 @@ const BlackholeFormProvider = ({
86401
86461
  plural: "customformsoverrides",
86402
86462
  isEnabled: Boolean(cluster && forcingCustomization.baseApiGroup && forcingCustomization.baseApiVersion)
86403
86463
  });
86464
+ const { data: prefillsData, isLoading: prefillsLoading } = useK8sSmartResource({
86465
+ cluster,
86466
+ apiGroup: forcingCustomization.baseApiGroup,
86467
+ apiVersion: forcingCustomization.baseApiVersion,
86468
+ plural: "customformsprefills",
86469
+ isEnabled: Boolean(cluster && forcingCustomization.baseApiGroup && forcingCustomization.baseApiVersion)
86470
+ });
86404
86471
  const { data: mappingData, isLoading: mappingLoading } = useK8sSmartResource({
86405
86472
  cluster,
86406
86473
  apiGroup: forcingCustomization.baseApiGroup,
@@ -86436,20 +86503,28 @@ const BlackholeFormProvider = ({
86436
86503
  const hasForcedMatchingOverride = Boolean(
86437
86504
  forcedCustomizationId && overridesData?.items?.some((item) => item?.spec?.customizationId === forcedCustomizationId)
86438
86505
  );
86439
- const isResolutionReady = !customizationId || !overridesLoading && !mappingLoading;
86506
+ const hasMatchingPrefill = Boolean(
86507
+ customizationId && prefillsData?.items?.some((item) => item?.spec?.customizationId === customizationId)
86508
+ );
86509
+ const hasForcedMatchingPrefill = Boolean(
86510
+ forcedCustomizationId && prefillsData?.items?.some((item) => item?.spec?.customizationId === forcedCustomizationId)
86511
+ );
86512
+ const isResolutionReady = !customizationId || !overridesLoading && !prefillsLoading && !mappingLoading;
86440
86513
  const resolvedCustomizationId = isResolutionReady ? hasMatchingOverride ? customizationId : hasForcedMatchingOverride ? forcedCustomizationId : forcingCustomization.fallbackId : void 0;
86514
+ const resolvedCustomizationIdPrefill = isResolutionReady ? hasMatchingPrefill ? customizationId : hasForcedMatchingPrefill ? forcedCustomizationId : forcingCustomization.fallbackId : void 0;
86441
86515
  useEffect(() => {
86442
86516
  if (!cluster) {
86443
86517
  setIsLoading(false);
86444
86518
  return;
86445
86519
  }
86446
86520
  if (!isResolutionReady) return;
86447
- if (customizationId && !resolvedCustomizationId) return;
86521
+ if (customizationId && (!resolvedCustomizationId || !resolvedCustomizationIdPrefill)) return;
86448
86522
  setIsLoading(true);
86449
86523
  const payload = {
86450
86524
  data,
86451
86525
  cluster,
86452
- customizationId: resolvedCustomizationId
86526
+ customizationId: resolvedCustomizationId,
86527
+ customizationIdPrefill: resolvedCustomizationIdPrefill
86453
86528
  };
86454
86529
  axios.post(`/api/clusters/${cluster}/openapi-bff/forms/formPrepare/prepareFormProps`, payload).then(({ data: data2 }) => {
86455
86530
  if (data2.isNamespaced) {
@@ -86487,6 +86562,7 @@ const BlackholeFormProvider = ({
86487
86562
  data,
86488
86563
  customizationId,
86489
86564
  resolvedCustomizationId,
86565
+ resolvedCustomizationIdPrefill,
86490
86566
  isResolutionReady,
86491
86567
  fallbackToManualMode,
86492
86568
  applyForceViewMode
@@ -90859,7 +90935,8 @@ const useApiResourceSingle = ({
90859
90935
  apiVersion,
90860
90936
  plural,
90861
90937
  name,
90862
- refetchInterval
90938
+ refetchInterval,
90939
+ enabler
90863
90940
  }) => {
90864
90941
  return useQuery({
90865
90942
  queryKey: ["useApiResourceSingle", cluster, namespace, apiGroup, apiVersion, plural, name],
@@ -90871,7 +90948,8 @@ const useApiResourceSingle = ({
90871
90948
  plural,
90872
90949
  name
90873
90950
  })).data,
90874
- refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
90951
+ refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3,
90952
+ enabled: enabler ?? true
90875
90953
  });
90876
90954
  };
90877
90955
 
@@ -90913,12 +90991,14 @@ const useBuiltinResourceSingle = ({
90913
90991
  namespace,
90914
90992
  plural,
90915
90993
  name,
90916
- refetchInterval
90994
+ refetchInterval,
90995
+ enabler
90917
90996
  }) => {
90918
90997
  return useQuery({
90919
90998
  queryKey: ["useBuiltinResourceSingle", cluster, namespace, plural, name],
90920
90999
  queryFn: async () => (await getBuiltinResourceSingle({ cluster, namespace, plural, name })).data,
90921
- refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
91000
+ refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3,
91001
+ enabled: enabler ?? true
90922
91002
  });
90923
91003
  };
90924
91004
 
@@ -90974,7 +91054,7 @@ const useCrdResourceSingle = ({
90974
91054
  });
90975
91055
  };
90976
91056
 
90977
- const useApisResourceTypes = ({ cluster }) => {
91057
+ const useApisResourceTypes = ({ cluster, enabler }) => {
90978
91058
  return useQuery({
90979
91059
  queryKey: ["useApisResourceTypes", cluster],
90980
91060
  queryFn: async () => {
@@ -90985,13 +91065,15 @@ const useApisResourceTypes = ({ cluster }) => {
90985
91065
  }
90986
91066
  return data;
90987
91067
  },
90988
- refetchInterval: 5e3
91068
+ refetchInterval: 5e3,
91069
+ enabled: enabler ?? true
90989
91070
  });
90990
91071
  };
90991
91072
  const useApiResourceTypesByGroup = ({
90992
91073
  cluster,
90993
91074
  apiGroup,
90994
- apiVersion
91075
+ apiVersion,
91076
+ enabler
90995
91077
  }) => {
90996
91078
  return useQuery({
90997
91079
  queryKey: ["useApiResourceTypesByGroup", cluster, apiGroup, apiVersion],
@@ -91007,11 +91089,12 @@ const useApiResourceTypesByGroup = ({
91007
91089
  }
91008
91090
  return data;
91009
91091
  },
91010
- refetchInterval: 5e3
91092
+ refetchInterval: 5e3,
91093
+ enabled: enabler ?? true
91011
91094
  });
91012
91095
  };
91013
91096
 
91014
- const useBuiltinResourceTypes = ({ cluster }) => {
91097
+ const useBuiltinResourceTypes = ({ cluster, enabler }) => {
91015
91098
  return useQuery({
91016
91099
  queryKey: ["useBuiltinResourceTypes", cluster],
91017
91100
  queryFn: async () => {
@@ -91022,7 +91105,8 @@ const useBuiltinResourceTypes = ({ cluster }) => {
91022
91105
  }
91023
91106
  return data;
91024
91107
  },
91025
- refetchInterval: 5e3
91108
+ refetchInterval: 5e3,
91109
+ enabled: enabler ?? true
91026
91110
  });
91027
91111
  };
91028
91112
 
@@ -91049,9 +91133,9 @@ const useCrdData = ({
91049
91133
  });
91050
91134
  };
91051
91135
 
91052
- const useResourceScope = ({ plural, cluster, apiGroup, apiVersion }) => {
91136
+ const useResourceScope = ({ plural, cluster, apiGroup, apiVersion, enabler }) => {
91053
91137
  const computedResourceType = apiGroup ? "api" : "builtin";
91054
- const enabled = Boolean(cluster) && Boolean(plural) && (computedResourceType === "builtin" || Boolean(apiVersion));
91138
+ const enabled = (enabler ?? true) && Boolean(cluster) && Boolean(plural) && (computedResourceType === "builtin" || Boolean(apiVersion));
91055
91139
  return useQuery({
91056
91140
  queryKey: ["resource-scope", computedResourceType, cluster, plural, apiGroup, apiVersion],
91057
91141
  enabled,
@@ -91094,4 +91178,4 @@ const usePluginManifest = ({
91094
91178
  };
91095
91179
 
91096
91180
  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 };
91097
- //# sourceMappingURL=index-q08n_WgU.mjs.map
91181
+ //# sourceMappingURL=index-C3GT20Hj.mjs.map