@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.9 → 1.2.0-alpha.2

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.
Files changed (66) hide show
  1. package/dist/openapi-k8s-toolkit.es.js +1884 -1416
  2. package/dist/openapi-k8s-toolkit.es.js.map +1 -1
  3. package/dist/openapi-k8s-toolkit.umd.js +1942 -1472
  4. package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
  5. package/dist/types/api/bff/scopes/checkScopes.d.ts +6 -6
  6. package/dist/types/api/bff/scopes/filterScopes.d.ts +4 -4
  7. package/dist/types/api/bff/search/getKinds.d.ts +2 -2
  8. package/dist/types/api/bff/swagger/getSwagger.d.ts +2 -2
  9. package/dist/types/api/forms.d.ts +4 -0
  10. package/dist/types/api/getApiResource.d.ts +8 -8
  11. package/dist/types/api/getApiResourceTypes.d.ts +4 -4
  12. package/dist/types/api/getBuiltinResource.d.ts +8 -8
  13. package/dist/types/api/getBuiltinResourceTypes.d.ts +2 -2
  14. package/dist/types/api/getCrdData.d.ts +2 -2
  15. package/dist/types/api/getCrdResource.d.ts +5 -5
  16. package/dist/types/api/permissions.d.ts +4 -4
  17. package/dist/types/components/molecules/BlackholeForm/index.d.ts +0 -1
  18. package/dist/types/components/molecules/BlackholeForm/molecules/index.d.ts +0 -1
  19. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/BlackholeForm.d.ts +3 -3
  20. package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeFormProvider/BlackholeFormProvider.d.ts +3 -3
  21. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/types.d.ts +2 -2
  22. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/EnrichedTableProvider.d.ts +2 -2
  23. package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.d.ts +1 -1
  24. package/dist/types/components/molecules/Events/Events.d.ts +2 -2
  25. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/ManageableSidebarProvider.d.ts +1 -0
  26. package/dist/types/components/molecules/ManageableSidebar/organisms/ManageableSidebarProvider/utils.d.ts +2 -1
  27. package/dist/types/components/molecules/MarketPlace/MarketPlace.d.ts +3 -3
  28. package/dist/types/components/molecules/MarketPlace/molecules/AddEditFormModal/AddEditFormModal.d.ts +3 -3
  29. package/dist/types/components/molecules/MarketPlace/molecules/MarketplaceCard/MarketplaceCard.d.ts +1 -1
  30. package/dist/types/components/molecules/MarketPlace/molecules/MarketplaceCard/utils.d.ts +9 -9
  31. package/dist/types/components/molecules/ProjectInfoCard/ProjectInfoCard.d.ts +3 -3
  32. package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/YamlEditorSingleton.d.ts +2 -2
  33. package/dist/types/components/molecules/index.d.ts +2 -1
  34. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/RefsList.d.ts +3 -2
  35. package/dist/types/components/organisms/DynamicComponents/molecules/OwnerRefs/organsisms/RefsList/molecules/RefElement/RefElement.d.ts +1 -0
  36. package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/Toggler.d.ts +6 -0
  37. package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/index.d.ts +1 -0
  38. package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/TogglerSegmented.d.ts +6 -0
  39. package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/index.d.ts +1 -0
  40. package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +2 -0
  41. package/dist/types/components/organisms/DynamicComponents/molecules/utils.d.ts +2 -1
  42. package/dist/types/components/organisms/DynamicComponents/molecules/utils.test.d.ts +1 -0
  43. package/dist/types/components/organisms/DynamicComponents/types.d.ts +63 -18
  44. package/dist/types/hooks/useApiResource.d.ts +8 -8
  45. package/dist/types/hooks/useApisResourceTypes.d.ts +4 -4
  46. package/dist/types/hooks/useBuiltinResource.d.ts +8 -8
  47. package/dist/types/hooks/useBuiltinResourceTypes.d.ts +2 -2
  48. package/dist/types/hooks/useCrdData.d.ts +2 -2
  49. package/dist/types/hooks/useCrdResource.d.ts +5 -5
  50. package/dist/types/hooks/useK8sSmartResource/index.d.ts +4 -0
  51. package/dist/types/hooks/useK8sSmartResource/useK8sSmartResource.d.ts +28 -0
  52. package/dist/types/hooks/{useK8sSmartResource.d.ts → useK8sSmartResource/useK8sSmartResourceWithoutKinds.d.ts} +4 -4
  53. package/dist/types/hooks/useK8sSmartResource/useManyK8sSmartResource.d.ts +17 -0
  54. package/dist/types/hooks/useK8sSmartResource/useSmartResourceParams.d.ts +9 -0
  55. package/dist/types/hooks/usePermissions.d.ts +4 -4
  56. package/dist/types/index.d.ts +1 -1
  57. package/dist/types/localTypes/bff/form.d.ts +5 -5
  58. package/dist/types/localTypes/bff/scopes.d.ts +6 -6
  59. package/dist/types/localTypes/bff/table.d.ts +2 -2
  60. package/dist/types/localTypes/form.d.ts +2 -2
  61. package/dist/types/localTypes/marketplace.d.ts +1 -1
  62. package/dist/types/utils/getGroupsByCategory/getGroupsByCategory.d.ts +2 -2
  63. package/dist/types/utils/tableLocations/tableLocations.d.ts +5 -5
  64. package/package.json +1 -1
  65. /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/index.d.ts +0 -0
  66. /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/styled.d.ts +0 -0
@@ -7886,19 +7886,48 @@
7886
7886
  pathToValue,
7887
7887
  body
7888
7888
  }) => {
7889
- const patchData = [
7889
+ const config = {
7890
+ headers: {
7891
+ "Content-Type": "application/json-patch+json"
7892
+ }
7893
+ };
7894
+ const addOp = [
7895
+ {
7896
+ op: "add",
7897
+ path: pathToValue,
7898
+ value: body
7899
+ }
7900
+ ];
7901
+ const replaceOp = [
7890
7902
  {
7891
7903
  op: "replace",
7892
7904
  path: pathToValue,
7893
7905
  value: body
7894
7906
  }
7895
7907
  ];
7896
- return axios.patch(endpoint, patchData, {
7897
- method: "PATCH",
7908
+ try {
7909
+ await axios.patch(endpoint, addOp, config);
7910
+ } catch (error) {
7911
+ console.error(`Error trying to add: ${error}`);
7912
+ }
7913
+ return axios.patch(endpoint, replaceOp, config);
7914
+ };
7915
+ const patchEntryWithDeleteOp = async ({
7916
+ endpoint,
7917
+ pathToValue
7918
+ }) => {
7919
+ const config = {
7898
7920
  headers: {
7899
7921
  "Content-Type": "application/json-patch+json"
7900
7922
  }
7901
- });
7923
+ };
7924
+ const replaceOp = [
7925
+ {
7926
+ op: "remove",
7927
+ path: pathToValue
7928
+ }
7929
+ ];
7930
+ return axios.patch(endpoint, replaceOp, config);
7902
7931
  };
7903
7932
 
7904
7933
  const DeleteModal = ({ name, onClose, endpoint }) => {
@@ -8582,6 +8611,63 @@
8582
8611
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$w.HeightDiv, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleBreadcrumb, { items: data.breadcrumbItems }) });
8583
8612
  };
8584
8613
 
8614
+ const getKinds = async ({ cluster }) => {
8615
+ const result = await axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
8616
+ return result.data;
8617
+ };
8618
+
8619
+ const kindByGvr = (entries) => (gvr) => {
8620
+ const [group = "", v = "", resource = ""] = gvr.split("~", 3);
8621
+ const norm = (s) => s.trim();
8622
+ const kinds = entries.filter((e) => norm(e.group) === norm(group) && e.version.version === v && e.version.resource === resource).map((e) => e.kind);
8623
+ const uniq = Array.from(new Set(kinds));
8624
+ return uniq.length === 1 ? uniq[0] : void 0;
8625
+ };
8626
+
8627
+ const parseK8sVersion$1 = (raw) => {
8628
+ const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
8629
+ if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
8630
+ const stage = (m.groups.stage ?? "").toLowerCase();
8631
+ const major = Number(m.groups.major);
8632
+ const stageNum = m.groups.stageNum ? Number(m.groups.stageNum) : 0;
8633
+ const rank = stage === "" ? 3 : stage === "beta" ? 2 : 1;
8634
+ return { rank, major, stageNum };
8635
+ };
8636
+ const versionToken$1 = (e) => e.version || (e.groupVersion?.split("/").pop() ?? "");
8637
+ const compareK8sVersionDesc$1 = (a, b) => {
8638
+ const pa = parseK8sVersion$1(versionToken$1(a));
8639
+ const pb = parseK8sVersion$1(versionToken$1(b));
8640
+ return pb.rank - pa.rank || pb.major - pa.major || pb.stageNum - pa.stageNum;
8641
+ };
8642
+ const orderVersions = (versions) => {
8643
+ const preferredIdx = versions.findIndex((v) => v.preferred === true);
8644
+ if (preferredIdx >= 0) {
8645
+ const preferred = versions[preferredIdx];
8646
+ const rest = versions.filter((_, i) => i !== preferredIdx).slice().sort(compareK8sVersionDesc$1);
8647
+ return [preferred, ...rest];
8648
+ }
8649
+ return versions.slice().sort(compareK8sVersionDesc$1);
8650
+ };
8651
+ const getSortedKindsAll = (index) => {
8652
+ const counts = index.items.reduce(
8653
+ (acc, item) => ({ ...acc, [item.kind]: (acc[item.kind] ?? 0) + 1 }),
8654
+ {}
8655
+ );
8656
+ const rows = index.items.flatMap((item) => {
8657
+ const ordered = orderVersions(item.versions);
8658
+ return ordered.map((v) => ({
8659
+ group: item.group,
8660
+ kind: item.kind,
8661
+ // clone to drop Readonly<> without changing fields (incl. preferred)
8662
+ version: { ...v },
8663
+ ...counts[item.kind] > 1 ? { notUnique: true } : {}
8664
+ }));
8665
+ });
8666
+ return rows.sort(
8667
+ (a, b) => a.kind.localeCompare(b.kind, void 0, { sensitivity: "base" }) || a.group.localeCompare(b.group, void 0, { sensitivity: "base" })
8668
+ );
8669
+ };
8670
+
8585
8671
  const getDirectUnknownResource = async ({ uri }) => {
8586
8672
  return axios.get(uri);
8587
8673
  };
@@ -9147,23 +9233,23 @@
9147
9233
  };
9148
9234
  };
9149
9235
 
9150
- const buildApiPrefix = (group, version) => {
9151
- const g = (group ?? "").trim();
9152
- const v = (version ?? "").trim();
9236
+ const buildApiPrefix = (apiGroup, apiVersion) => {
9237
+ const g = (apiGroup ?? "").trim();
9238
+ const v = (apiVersion ?? "").trim();
9153
9239
  const isCore = !g || g === "core" || g === "v1";
9154
9240
  return isCore ? `/api/${v}` : `/apis/${g}/${v}`;
9155
9241
  };
9156
9242
  const buildListUri = ({
9157
9243
  cluster,
9158
- group,
9159
- version,
9244
+ apiGroup,
9245
+ apiVersion,
9160
9246
  plural,
9161
9247
  namespace,
9162
9248
  fieldSelector,
9163
9249
  labelSelector,
9164
9250
  limit
9165
9251
  }) => {
9166
- const prefix = buildApiPrefix(group, version);
9252
+ const prefix = buildApiPrefix(apiGroup, apiVersion);
9167
9253
  const ns = namespace ? `/namespaces/${namespace}` : "";
9168
9254
  const base = `/api/clusters/${cluster}/k8s${prefix}${ns}/${plural}/`;
9169
9255
  const params = new URLSearchParams();
@@ -9172,10 +9258,10 @@
9172
9258
  if (limit) params.append("limit", String(limit));
9173
9259
  return params.toString() ? `${base}?${params.toString()}` : base;
9174
9260
  };
9175
- const useK8sSmartResource = ({
9261
+ const useK8sSmartResourceWithoutKinds = ({
9176
9262
  cluster,
9177
- group,
9178
- version,
9263
+ apiGroup,
9264
+ apiVersion,
9179
9265
  plural,
9180
9266
  namespace,
9181
9267
  fieldSelector,
@@ -9193,15 +9279,15 @@
9193
9279
  error: verbsErrorObj
9194
9280
  } = useK8sVerbs({
9195
9281
  cluster,
9196
- group,
9197
- version,
9282
+ group: apiGroup,
9283
+ version: apiVersion,
9198
9284
  plural,
9199
9285
  isEnabled: Boolean(isEnabled && cluster && cluster.length > 0)
9200
9286
  });
9201
9287
  const listUri = buildListUri({
9202
9288
  cluster,
9203
- group,
9204
- version,
9289
+ apiGroup,
9290
+ apiVersion,
9205
9291
  plural,
9206
9292
  namespace,
9207
9293
  fieldSelector,
@@ -9221,8 +9307,8 @@
9221
9307
  queryKey: [
9222
9308
  "k8s-list",
9223
9309
  cluster,
9224
- group || "",
9225
- version,
9310
+ apiGroup || "",
9311
+ apiVersion,
9226
9312
  namespace || "",
9227
9313
  plural,
9228
9314
  fieldSelector || "",
@@ -9243,8 +9329,8 @@
9243
9329
  isEnabled: watchEnabled,
9244
9330
  pageSize: limit,
9245
9331
  query: {
9246
- apiGroup: group,
9247
- apiVersion: version,
9332
+ apiGroup,
9333
+ apiVersion,
9248
9334
  plural,
9249
9335
  namespace,
9250
9336
  fieldSelector,
@@ -9269,6 +9355,108 @@
9269
9355
  return { data, isLoading, isError, error, _meta: { used } };
9270
9356
  };
9271
9357
 
9358
+ const hasItemsArray = (value) => {
9359
+ if (!value || typeof value !== "object") {
9360
+ return false;
9361
+ }
9362
+ if (!("items" in value)) {
9363
+ return false;
9364
+ }
9365
+ const { items } = value;
9366
+ return Array.isArray(items);
9367
+ };
9368
+ const useK8sSmartResource = (params) => {
9369
+ const { cluster, apiGroup, apiVersion, plural } = params;
9370
+ const base = useK8sSmartResourceWithoutKinds(params);
9371
+ const [kindsWithVersion, setKindsWithVersion] = K.useState(void 0);
9372
+ K.useEffect(() => {
9373
+ let cancelled = false;
9374
+ if (!cluster) {
9375
+ setKindsWithVersion(void 0);
9376
+ return void 0;
9377
+ }
9378
+ getKinds({ cluster }).then((data) => {
9379
+ if (cancelled) {
9380
+ return;
9381
+ }
9382
+ setKindsWithVersion(getSortedKindsAll(data));
9383
+ }).catch(() => {
9384
+ if (!cancelled) {
9385
+ setKindsWithVersion(void 0);
9386
+ }
9387
+ });
9388
+ return () => {
9389
+ cancelled = true;
9390
+ };
9391
+ }, [cluster]);
9392
+ const resolveKindByGvr = K.useMemo(
9393
+ () => kindsWithVersion ? kindByGvr(kindsWithVersion) : void 0,
9394
+ [kindsWithVersion]
9395
+ );
9396
+ const gvr = K.useMemo(
9397
+ () => `${(apiGroup ?? "").trim()}~${(apiVersion ?? "").trim()}~${(plural ?? "").trim()}`,
9398
+ [apiGroup, apiVersion, plural]
9399
+ );
9400
+ const fullApiVersion = K.useMemo(() => {
9401
+ const g = (apiGroup ?? "").trim();
9402
+ const v = (apiVersion ?? "").trim();
9403
+ if (!g || g === "core") {
9404
+ return v;
9405
+ }
9406
+ return `${g}/${v}`;
9407
+ }, [apiGroup, apiVersion]);
9408
+ const dataWithKinds = K.useMemo(() => {
9409
+ if (!base.data) return void 0;
9410
+ if (!hasItemsArray(base.data)) {
9411
+ return base.data;
9412
+ }
9413
+ const resolvedKind = resolveKindByGvr?.(gvr);
9414
+ const shouldAddKind = Boolean(resolvedKind);
9415
+ const itemsWithKindAndApiVersion = base.data.items.map((item) => {
9416
+ const typedItem = item;
9417
+ return {
9418
+ ...typedItem,
9419
+ kind: typedItem.kind ?? (shouldAddKind ? resolvedKind : void 0),
9420
+ apiVersion: typedItem.apiVersion ?? fullApiVersion
9421
+ };
9422
+ });
9423
+ return {
9424
+ ...base.data,
9425
+ items: itemsWithKindAndApiVersion
9426
+ };
9427
+ }, [base.data, resolveKindByGvr, gvr, fullApiVersion]);
9428
+ return {
9429
+ ...base,
9430
+ data: dataWithKinds
9431
+ };
9432
+ };
9433
+
9434
+ const useManyK8sSmartResource = (paramsList) => {
9435
+ const results = [];
9436
+ for (let i = 0; i < paramsList.length; i++) {
9437
+ results[i] = useK8sSmartResource(paramsList[i]);
9438
+ }
9439
+ return results;
9440
+ };
9441
+
9442
+ const useSmartResourceParams = ({ cluster, namespace }) => {
9443
+ const [searchParams] = reactRouterDom.useSearchParams();
9444
+ return K.useMemo(() => {
9445
+ const raw = searchParams.get("resources");
9446
+ if (!raw) return [];
9447
+ return raw.split(",").map((entry) => {
9448
+ const [apiGroup = "", apiVersion = "", plural] = entry.split("/");
9449
+ return {
9450
+ cluster,
9451
+ namespace,
9452
+ apiGroup: apiGroup === "builtin" ? void 0 : apiGroup,
9453
+ apiVersion,
9454
+ plural
9455
+ };
9456
+ });
9457
+ }, [searchParams, cluster, namespace]);
9458
+ };
9459
+
9272
9460
  const prepareTemplate = ({
9273
9461
  template,
9274
9462
  replaceValues
@@ -9343,9 +9531,9 @@
9343
9531
  isError: rawDataError,
9344
9532
  isLoading: rawDataLoading
9345
9533
  } = useK8sSmartResource({
9346
- cluster: cluster || "",
9347
- group: apiGroup,
9348
- version: apiVersion,
9534
+ cluster,
9535
+ apiGroup,
9536
+ apiVersion,
9349
9537
  plural,
9350
9538
  isEnabled
9351
9539
  });
@@ -9370,7 +9558,7 @@
9370
9558
  if (!result) {
9371
9559
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$v.HeightDiv, {});
9372
9560
  }
9373
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableBreadcrumbs, { data: result });
9561
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ManageableBreadcrumbs, { data: result }, JSON.stringify(idToCompare));
9374
9562
  };
9375
9563
 
9376
9564
  const CustomMenu = styled(antd.Menu)`
@@ -9511,9 +9699,10 @@
9511
9699
  replaceValues,
9512
9700
  pathname,
9513
9701
  idToCompare,
9702
+ fallbackIdToCompare,
9514
9703
  currentTags
9515
9704
  }) => {
9516
- const foundData = data.find((el) => el.id === idToCompare);
9705
+ const foundData = data.find((el) => el.id === idToCompare) || (fallbackIdToCompare ? data.find((el) => el.id === fallbackIdToCompare) : void 0);
9517
9706
  if (!foundData) {
9518
9707
  return void 0;
9519
9708
  }
@@ -9543,6 +9732,7 @@
9543
9732
  replaceValues,
9544
9733
  pathname,
9545
9734
  idToCompare,
9735
+ fallbackIdToCompare,
9546
9736
  currentTags,
9547
9737
  hidden,
9548
9738
  noMarginTop
@@ -9553,8 +9743,8 @@
9553
9743
  isLoading: rawDataLoading
9554
9744
  } = useK8sSmartResource({
9555
9745
  cluster,
9556
- group: apiGroup,
9557
- version: apiVersion,
9746
+ apiGroup,
9747
+ apiVersion,
9558
9748
  plural,
9559
9749
  isEnabled
9560
9750
  });
@@ -9579,6 +9769,7 @@
9579
9769
  replaceValues,
9580
9770
  pathname,
9581
9771
  idToCompare,
9772
+ fallbackIdToCompare,
9582
9773
  currentTags
9583
9774
  });
9584
9775
  if (!result) {
@@ -33868,31 +34059,37 @@
33868
34059
  queryKey: ["multi-url", i, url],
33869
34060
  queryFn: async () => {
33870
34061
  const res = await axios.get(url);
33871
- return res.data;
33872
- }
34062
+ return structuredClone(res.data);
34063
+ },
34064
+ structuralSharing: false,
34065
+ refetchInterval: 5e3
33873
34066
  }))
33874
34067
  });
33875
- const value = K.useMemo(() => {
33876
- if (typeof dataToApplyToContext !== "undefined") {
33877
- return { data: { req0: dataToApplyToContext }, isLoading: false, isError: false, errors: [] };
33878
- }
34068
+ const value = (() => {
33879
34069
  const data = {};
33880
34070
  const errors = [];
34071
+ const hasExtraReq0 = typeof dataToApplyToContext !== "undefined";
34072
+ const baseIndex = hasExtraReq0 ? 1 : 0;
33881
34073
  for (let i = 0; i < k8sCount; i++) {
33882
34074
  const e = state.entries[i] ?? makeEmptyEntry();
33883
- data[`req${i}`] = e.data;
33884
- errors[i] = e.isError ? e.error : null;
34075
+ const idx = baseIndex + i;
34076
+ data[`req${idx}`] = e.data;
34077
+ errors[idx] = e.isError ? e.error : null;
33885
34078
  }
33886
34079
  for (let i = 0; i < urlCount; i++) {
33887
34080
  const q = urlQueries[i];
33888
- const idx = k8sCount + i;
34081
+ const idx = baseIndex + k8sCount + i;
33889
34082
  data[`req${idx}`] = q?.data;
33890
34083
  errors[idx] = q?.isError ? q.error ?? null : null;
33891
34084
  }
34085
+ if (hasExtraReq0) {
34086
+ data.req0 = dataToApplyToContext;
34087
+ errors[0] = null;
34088
+ }
33892
34089
  const isLoading = state.entries.some((e) => e.isLoading) || urlQueries.some((q) => q.isLoading);
33893
34090
  const isError = state.entries.some((e) => e.isError) || urlQueries.some((q) => q.isError);
33894
34091
  return { data, isLoading, isError, errors };
33895
- }, [dataToApplyToContext, k8sCount, urlCount, state.entries, urlQueries]);
34092
+ })();
33896
34093
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(MultiQueryContext.Provider, { value, children: [
33897
34094
  k8sItems.map((params, i) => (
33898
34095
  // eslint-disable-next-line react/no-array-index-key
@@ -33952,7 +34149,7 @@
33952
34149
  const path = Array.from(rawPath.matchAll(/['"]([^'"]+)['"]/g)).map(
33953
34150
  (m) => m[1]
33954
34151
  );
33955
- const value = _$1.get(multiQueryData[`req${reqIndex}`], path, fallback !== void 0 ? fallback : void 0);
34152
+ const value = _$1.get(multiQueryData[`req${reqIndex}`] || {}, path, fallback !== void 0 ? fallback : void 0);
33956
34153
  if (value == null && !customFallback) {
33957
34154
  return fallback ?? "Undefined with no fallback";
33958
34155
  }
@@ -33969,35 +34166,53 @@
33969
34166
  const parseJsonPathTemplate = ({
33970
34167
  text,
33971
34168
  multiQueryData,
33972
- customFallback
34169
+ customFallback,
34170
+ replaceValues
33973
34171
  }) => {
33974
34172
  if (!text) return "";
33975
34173
  const placeholderRegex = /\{reqsJsonPath\[(\d+)\]\s*\[\s*(['"])([\s\S]*?)\2\s*\](?:\s*\[\s*(['"])([\s\S]*?)\4\s*\])?\}/g;
33976
- return text.replace(
34174
+ const resolve = (input) => input.replace(
33977
34175
  placeholderRegex,
33978
- (match, reqIndexStr, _quote, jsonPathExpr, _smth, fallback = "Undefined with no fallback") => {
34176
+ (match, reqIndexStr, _quote, rawJsonPathExpr, _fallbackQuote, inlineFallback = "Undefined with no fallback") => {
33979
34177
  try {
33980
- const reqIndex = parseInt(reqIndexStr, 10);
34178
+ const reqIndex = Number(reqIndexStr);
33981
34179
  const jsonRoot = multiQueryData[`req${reqIndex}`];
33982
- if (jsonRoot === void 0 && !customFallback) {
33983
- return fallback;
33984
- }
33985
- if (jsonRoot === void 0 && customFallback) {
33986
- return customFallback;
34180
+ let jsonPathExpr = rawJsonPathExpr;
34181
+ let previous2 = null;
34182
+ let loopGuard = 0;
34183
+ while (previous2 !== jsonPathExpr && loopGuard < 10) {
34184
+ previous2 = jsonPathExpr;
34185
+ jsonPathExpr = resolve(jsonPathExpr);
34186
+ loopGuard++;
34187
+ }
34188
+ if (replaceValues) {
34189
+ jsonPathExpr = prepareTemplate({
34190
+ template: jsonPathExpr,
34191
+ replaceValues
34192
+ });
33987
34193
  }
34194
+ if (jsonRoot === void 0 && customFallback) return customFallback;
34195
+ if (jsonRoot === void 0) return inlineFallback;
33988
34196
  const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
33989
- if (results.length === 0 || results[0] == null || results[0] === void 0) {
33990
- if (customFallback) {
33991
- return customFallback;
33992
- }
33993
- return fallback;
34197
+ const value = results?.[0];
34198
+ if (value == null) {
34199
+ return customFallback ?? inlineFallback;
33994
34200
  }
33995
- return String(results[0]);
34201
+ return String(value);
33996
34202
  } catch {
33997
34203
  return match;
33998
34204
  }
33999
34205
  }
34000
34206
  );
34207
+ let result = text;
34208
+ let previous = null;
34209
+ let iterations = 0;
34210
+ while (result !== previous && iterations < 10) {
34211
+ previous = result;
34212
+ result = resolve(result);
34213
+ iterations++;
34214
+ }
34215
+ return result;
34001
34216
  };
34002
34217
  const parseWithoutPartsOfUrl = ({
34003
34218
  text,
@@ -34025,7 +34240,8 @@
34025
34240
  text,
34026
34241
  multiQueryData
34027
34242
  }),
34028
- multiQueryData
34243
+ multiQueryData,
34244
+ replaceValues
34029
34245
  }),
34030
34246
  replaceValues
34031
34247
  });
@@ -34178,21 +34394,15 @@
34178
34394
  data,
34179
34395
  children
34180
34396
  }) => {
34181
- const { id, clusterNamePartOfUrl, namespacePartOfUrl, accessGroups, ...props } = data;
34397
+ const { id, cluster, namespace, accessGroups, ...props } = data;
34182
34398
  const { data: multiQueryData, isError, errors } = useMultiQuery();
34183
34399
  const partsOfUrl = usePartsOfUrl();
34184
34400
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
34185
34401
  acc[index.toString()] = value;
34186
34402
  return acc;
34187
34403
  }, {});
34188
- const clusterName = prepareTemplate({
34189
- template: clusterNamePartOfUrl,
34190
- replaceValues
34191
- });
34192
- const namespace = prepareTemplate({
34193
- template: namespacePartOfUrl,
34194
- replaceValues
34195
- });
34404
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34405
+ const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
34196
34406
  const parsedAccessGroups = accessGroups.map(
34197
34407
  (accessGroup) => parseAll({ text: accessGroup, replaceValues, multiQueryData })
34198
34408
  );
@@ -34202,7 +34412,7 @@
34202
34412
  /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34203
34413
  ] });
34204
34414
  }
34205
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ProjectInfoCard, { clusterName, namespace, accessGroups: parsedAccessGroups, ...props, children });
34415
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ProjectInfoCard, { cluster: clusterPrepared, namespace: namespacePrepared, accessGroups: parsedAccessGroups, ...props, children });
34206
34416
  };
34207
34417
 
34208
34418
  const MarketplaceCard$1 = ({
@@ -34210,21 +34420,22 @@
34210
34420
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
34211
34421
  children
34212
34422
  }) => {
34213
- const { id, clusterNamePartOfUrl, namespacePartOfUrl, ...props } = data;
34423
+ const { id, cluster, namespace, ...props } = data;
34424
+ const { data: multiQueryData, isError, errors } = useMultiQuery();
34214
34425
  const partsOfUrl = usePartsOfUrl();
34215
34426
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
34216
34427
  acc[index.toString()] = value;
34217
34428
  return acc;
34218
34429
  }, {});
34219
- const clusterName = prepareTemplate({
34220
- template: clusterNamePartOfUrl,
34221
- replaceValues
34222
- });
34223
- const namespace = prepareTemplate({
34224
- template: namespacePartOfUrl,
34225
- replaceValues
34226
- });
34227
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MarketPlace, { clusterName, namespace, ...props });
34430
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34431
+ const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
34432
+ if (isError) {
34433
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34434
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34435
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34436
+ ] });
34437
+ }
34438
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MarketPlace, { cluster: clusterPrepared, namespace: namespacePrepared, ...props });
34228
34439
  };
34229
34440
 
34230
34441
  const ContentCard = ({
@@ -34352,7 +34563,7 @@
34352
34563
  };
34353
34564
 
34354
34565
  const checkPermission = async ({
34355
- clusterName,
34566
+ cluster,
34356
34567
  body
34357
34568
  }) => {
34358
34569
  const data = JSON.stringify({
@@ -34360,15 +34571,15 @@
34360
34571
  kind: "SelfSubjectAccessReview",
34361
34572
  spec: {
34362
34573
  resourceAttributes: {
34363
- ...body.group ? { group: body.group } : {},
34364
- resource: body.resource,
34574
+ ...body.apiGroup ? { group: body.apiGroup } : {},
34575
+ resource: body.plural,
34365
34576
  verb: body.verb,
34366
34577
  ...body.namespace ? { namespace: body.namespace } : {},
34367
34578
  ...body.name ? { name: body.name } : {}
34368
34579
  }
34369
34580
  }
34370
34581
  });
34371
- return axios.post(`/api/clusters/${clusterName}/k8s/apis/authorization.k8s.io/v1/selfsubjectaccessreviews`, data, {
34582
+ return axios.post(`/api/clusters/${cluster}/k8s/apis/authorization.k8s.io/v1/selfsubjectaccessreviews`, data, {
34372
34583
  method: "POST",
34373
34584
  headers: {
34374
34585
  "Content-Type": "application/json"
@@ -34377,23 +34588,23 @@
34377
34588
  };
34378
34589
 
34379
34590
  const usePermissions = ({
34380
- clusterName,
34591
+ cluster,
34381
34592
  namespace,
34382
- group,
34383
- resource,
34593
+ apiGroup,
34594
+ plural,
34384
34595
  verb,
34385
34596
  name,
34386
34597
  refetchInterval,
34387
34598
  enabler
34388
34599
  }) => {
34389
34600
  return reactQuery.useQuery({
34390
- queryKey: ["usePermissions", clusterName, namespace, group, resource, verb, name],
34601
+ queryKey: ["usePermissions", cluster, namespace, apiGroup, plural, verb, name],
34391
34602
  queryFn: async () => (await checkPermission({
34392
- clusterName,
34603
+ cluster,
34393
34604
  body: {
34394
34605
  namespace,
34395
- group,
34396
- resource,
34606
+ apiGroup,
34607
+ plural,
34397
34608
  verb
34398
34609
  }
34399
34610
  })).data,
@@ -34410,7 +34621,7 @@
34410
34621
  baseprefix,
34411
34622
  namespace,
34412
34623
  syntheticProject,
34413
- typeName,
34624
+ plural,
34414
34625
  inside,
34415
34626
  fullPath
34416
34627
  }) => {
@@ -34419,7 +34630,7 @@
34419
34630
  const backlink = getBackLinkToTable({
34420
34631
  fullPath
34421
34632
  });
34422
- return `${mainRoute}/forms/builtin/v1/${typeName}?backlink=${backlink}`;
34633
+ return `${mainRoute}/forms/builtin/v1/${plural}?backlink=${backlink}`;
34423
34634
  };
34424
34635
  const getLinkToApiForm = ({
34425
34636
  cluster,
@@ -34428,7 +34639,7 @@
34428
34639
  syntheticProject,
34429
34640
  apiGroup,
34430
34641
  apiVersion,
34431
- typeName,
34642
+ plural,
34432
34643
  inside,
34433
34644
  fullPath
34434
34645
  }) => {
@@ -34437,7 +34648,7 @@
34437
34648
  const backlink = getBackLinkToTable({
34438
34649
  fullPath
34439
34650
  });
34440
- return `${mainRoute}/forms/apis/${apiGroup}/${apiVersion}/${typeName}?backlink=${backlink}`;
34651
+ return `${mainRoute}/forms/apis/${apiGroup}/${apiVersion}/${plural}?backlink=${backlink}`;
34441
34652
  };
34442
34653
  const getLinkToForm = ({
34443
34654
  apiGroup,
@@ -34484,7 +34695,8 @@
34484
34695
  fetchUrl,
34485
34696
  k8sResourceToFetch,
34486
34697
  pathToItems,
34487
- clusterNamePartOfUrl,
34698
+ additionalReqsDataToEachItem,
34699
+ cluster,
34488
34700
  labelSelector,
34489
34701
  labelSelectorFull,
34490
34702
  fieldSelector,
@@ -34500,36 +34712,33 @@
34500
34712
  acc[index.toString()] = value;
34501
34713
  return acc;
34502
34714
  }, {});
34503
- const clusterName = prepareTemplate({
34504
- template: clusterNamePartOfUrl,
34505
- replaceValues
34506
- });
34715
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34507
34716
  const namespacePrepared = namespace ? parseAll({ text: namespace, replaceValues, multiQueryData }) : void 0;
34508
34717
  const k8sResourcePrePrepared = k8sResource ? {
34509
34718
  apiGroup: k8sResource.apiGroup ? parseAll({ text: k8sResource.apiGroup, replaceValues, multiQueryData }) : void 0,
34510
34719
  apiVersion: parseAll({ text: k8sResource.apiVersion, replaceValues, multiQueryData }),
34511
- resource: parseAll({ text: k8sResource.resource, replaceValues, multiQueryData })
34720
+ plural: parseAll({ text: k8sResource.plural, replaceValues, multiQueryData })
34512
34721
  } : void 0;
34513
- const k8sResourcePrepared = k8sResourcePrePrepared?.apiGroup === "-" ? { apiVersion: k8sResourcePrePrepared.apiVersion, resource: k8sResourcePrePrepared.resource } : k8sResourcePrePrepared;
34722
+ const k8sResourcePrepared = k8sResourcePrePrepared?.apiGroup === "-" ? { apiVersion: k8sResourcePrePrepared.apiVersion, plural: k8sResourcePrePrepared.plural } : k8sResourcePrePrepared;
34514
34723
  const dataForControlsPrepared = dataForControls ? {
34515
- cluster: clusterName,
34724
+ cluster: clusterPrepared,
34516
34725
  syntheticProject: dataForControls.syntheticProject ? parseAll({ text: dataForControls.syntheticProject, replaceValues, multiQueryData }) : void 0,
34517
- resource: parseAll({ text: dataForControls.resource, replaceValues, multiQueryData }),
34726
+ plural: parseAll({ text: dataForControls.plural, replaceValues, multiQueryData }),
34518
34727
  apiGroup: dataForControls.apiGroup ? parseAll({ text: dataForControls.apiGroup, replaceValues, multiQueryData }) : void 0,
34519
34728
  apiVersion: parseAll({ text: dataForControls.apiVersion, replaceValues, multiQueryData })
34520
34729
  } : void 0;
34521
34730
  const createPermission = usePermissions({
34522
- group: dataForControlsPrepared?.apiGroup,
34523
- resource: dataForControlsPrepared?.resource || "",
34731
+ apiGroup: dataForControlsPrepared?.apiGroup,
34732
+ plural: dataForControlsPrepared?.plural || "",
34524
34733
  namespace: namespacePrepared,
34525
- clusterName,
34734
+ cluster: clusterPrepared,
34526
34735
  verb: "create",
34527
34736
  refetchInterval: false
34528
34737
  });
34529
34738
  const fetchUrlPrepared = fetchUrl ? parseAll({ text: fetchUrl, replaceValues, multiQueryData }) : void 0;
34530
34739
  const k8sResourceToFetchPrepared = k8sResourceToFetch ? {
34531
- group: k8sResourceToFetch.group ? parseAll({ text: k8sResourceToFetch.group, replaceValues, multiQueryData }) : void 0,
34532
- version: parseAll({ text: k8sResourceToFetch.version, replaceValues, multiQueryData }),
34740
+ apiGroup: k8sResourceToFetch.apiGroup ? parseAll({ text: k8sResourceToFetch.apiGroup, replaceValues, multiQueryData }) : void 0,
34741
+ apiVersion: parseAll({ text: k8sResourceToFetch.apiVersion, replaceValues, multiQueryData }),
34533
34742
  plural: parseAll({ text: k8sResourceToFetch.plural, replaceValues, multiQueryData }),
34534
34743
  namespace: k8sResourceToFetch.namespace ? parseAll({ text: k8sResourceToFetch.namespace, replaceValues, multiQueryData }) : void 0
34535
34744
  } : void 0;
@@ -34545,7 +34754,7 @@
34545
34754
  }
34546
34755
  if (labelSelectorFull) {
34547
34756
  const root = multiQueryData[`req${labelSelectorFull.reqIndex}`];
34548
- const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root, labelSelectorFull.pathToLabels) : jp.query(root, `$${labelSelectorFull.pathToLabels}`)[0];
34757
+ const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root || {}, labelSelectorFull.pathToLabels) : jp.query(root || {}, `$${labelSelectorFull.pathToLabels}`)[0];
34549
34758
  const serializedLabels = serializeLabelsWithNoEncoding$1(value);
34550
34759
  if (serializedLabels.length > 0) sParams.set("labelSelector", serializedLabels);
34551
34760
  }
@@ -34576,10 +34785,10 @@
34576
34785
  isLoading: isFetchedDataSocketLoading,
34577
34786
  error: fetchedDataSocketError
34578
34787
  } = useK8sSmartResource({
34579
- cluster: clusterName || "",
34788
+ cluster: clusterPrepared || "",
34580
34789
  namespace: k8sResourceToFetchPrepared?.namespace,
34581
- group: k8sResourceToFetchPrepared?.group,
34582
- version: k8sResourceToFetchPrepared?.version || "",
34790
+ apiGroup: k8sResourceToFetchPrepared?.apiGroup,
34791
+ apiVersion: k8sResourceToFetchPrepared?.apiVersion || "",
34583
34792
  plural: k8sResourceToFetchPrepared?.plural || "",
34584
34793
  fieldSelector: sParams.get("fieldSelector") || void 0,
34585
34794
  labelSelector: sParams.get("labelSelector") || void 0,
@@ -34609,14 +34818,20 @@
34609
34818
  JSON.stringify(fetchedDataError)
34610
34819
  ] });
34611
34820
  }
34612
- const dataFromOneOfHooks = fetchedData || fetchedDataSocket;
34613
- const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks, pathToItems) : jp.query(dataFromOneOfHooks, `$${pathToItems}`)[0];
34614
- if (!items) {
34615
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34616
- "No data on this path ",
34617
- JSON.stringify(pathToItems)
34618
- ] });
34821
+ const dataFromOneOfHooks = fetchedData || fetchedDataSocket || {};
34822
+ const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks || {}, pathToItems) : jp.query(dataFromOneOfHooks || {}, `$${pathToItems}`)[0];
34823
+ const itemsAlwaysArr = Array.isArray(items) ? items : [];
34824
+ let additionalReqsData = [];
34825
+ if (additionalReqsDataToEachItem) {
34826
+ additionalReqsDataToEachItem.forEach((item) => {
34827
+ additionalReqsData?.push(multiQueryData[`req${item}`]);
34828
+ });
34619
34829
  }
34830
+ additionalReqsData = additionalReqsData.length > 0 ? additionalReqsData : void 0;
34831
+ const itemsAlwaysArrWithAdditionalData = itemsAlwaysArr.map((el) => ({
34832
+ ...el,
34833
+ ...additionalReqsData ? { additionalReqsData } : {}
34834
+ }));
34620
34835
  const clearSelected = () => {
34621
34836
  setSelectedRowKeys([]);
34622
34837
  setSelectedRowsData([]);
@@ -34630,10 +34845,10 @@
34630
34845
  EnrichedTableProvider,
34631
34846
  {
34632
34847
  tableMappingsReplaceValues: replaceValues,
34633
- cluster: clusterName,
34848
+ cluster: clusterPrepared,
34634
34849
  namespace: namespacePrepared,
34635
34850
  theme,
34636
- dataItems: items,
34851
+ dataItems: itemsAlwaysArrWithAdditionalData,
34637
34852
  tableProps: {
34638
34853
  borderless: true,
34639
34854
  paginationPosition: ["bottomRight"],
@@ -34664,13 +34879,13 @@
34664
34879
  type: "primary",
34665
34880
  onClick: () => {
34666
34881
  const url = getLinkToForm({
34667
- cluster: clusterName,
34882
+ cluster: clusterPrepared,
34668
34883
  baseprefix,
34669
34884
  namespace: namespacePrepared,
34670
34885
  syntheticProject: params.syntheticProject,
34671
34886
  apiGroup: dataForControlsPrepared.apiGroup,
34672
34887
  apiVersion: dataForControlsPrepared.apiVersion,
34673
- typeName: dataForControlsPrepared.resource,
34888
+ plural: dataForControlsPrepared.plural,
34674
34889
  fullPath
34675
34890
  });
34676
34891
  navigate(url);
@@ -34751,7 +34966,7 @@
34751
34966
  } = useK8sSmartResource({
34752
34967
  cluster: clusterPrepared,
34753
34968
  namespace: namespacePrepared,
34754
- version: "v1",
34969
+ apiVersion: "v1",
34755
34970
  plural: "pods",
34756
34971
  fieldSelector: `metadata.name=${podNamePrepared}`,
34757
34972
  isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
@@ -34870,7 +35085,7 @@
34870
35085
  } = useK8sSmartResource({
34871
35086
  cluster: clusterPrepared,
34872
35087
  namespace: namespacePrepared,
34873
- version: "v1",
35088
+ apiVersion: "v1",
34874
35089
  plural: "pods",
34875
35090
  fieldSelector: `metadata.name=${podNamePrepared}`,
34876
35091
  isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
@@ -34915,7 +35130,7 @@
34915
35130
  prefillValuesRaw,
34916
35131
  pathToData
34917
35132
  }) => {
34918
- return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw, pathToData) : jp.query(prefillValuesRaw, `$${pathToData}`)[0];
35133
+ return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw || {}, pathToData) : jp.query(prefillValuesRaw || {}, `$${pathToData}`)[0];
34919
35134
  };
34920
35135
  const getPrefillValuesWithForces = ({
34921
35136
  prefillValues,
@@ -34956,7 +35171,7 @@
34956
35171
  type,
34957
35172
  apiGroup,
34958
35173
  apiVersion,
34959
- typeName,
35174
+ plural,
34960
35175
  forcedKind,
34961
35176
  prefillValuesRequestIndex,
34962
35177
  pathToData,
@@ -34984,7 +35199,7 @@
34984
35199
  const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34985
35200
  const apiGroupPrepared = apiGroup ? parseAll({ text: apiGroup, replaceValues, multiQueryData }) : "no-api-group";
34986
35201
  const apiVersionPrepared = apiVersion ? parseAll({ text: apiVersion, replaceValues, multiQueryData }) : "no-api-version";
34987
- const typeNamePrepared = parseAll({ text: typeName, replaceValues, multiQueryData });
35202
+ const pluralPrepared = parseAll({ text: plural, replaceValues, multiQueryData });
34988
35203
  const prefillValuesRaw = multiQueryData[`req${prefillValuesRequestIndex}`];
34989
35204
  const prefillValues = pathToData ? getDataByPath({ prefillValuesRaw, pathToData }) : prefillValuesRaw;
34990
35205
  const prefillValuesWithForces = getPrefillValuesWithForces({ prefillValues, forcedKind, apiGroup, apiVersion });
@@ -35002,7 +35217,7 @@
35002
35217
  isCreate: false,
35003
35218
  type,
35004
35219
  apiGroupApiVersion: type === "builtin" ? "api/v1" : `${apiGroupPrepared}/${apiVersionPrepared}`,
35005
- typeName: typeNamePrepared,
35220
+ plural: pluralPrepared,
35006
35221
  designNewLayout: true,
35007
35222
  designNewLayoutHeight: height,
35008
35223
  openNotification: true,
@@ -35103,7 +35318,7 @@
35103
35318
  if (jsonRoot === void 0) {
35104
35319
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
35105
35320
  }
35106
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
35321
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
35107
35322
  const { data: arrayOfObjects, error: errorArrayOfObjects } = parseArrayOfAny$2(anythingForNow);
35108
35323
  if (!arrayOfObjects) {
35109
35324
  if (errorArrayOfObjects) {
@@ -35175,7 +35390,7 @@
35175
35390
  console.log(`Item Counter: ${id}: No root for json path`);
35176
35391
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
35177
35392
  }
35178
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
35393
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
35179
35394
  const { counter, error: errorArrayOfObjects } = getItemsInside$4(anythingForNow);
35180
35395
  if (errorArrayOfObjects) {
35181
35396
  console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
@@ -35232,7 +35447,7 @@
35232
35447
  console.log(`Key Counter: ${id}: No root for json path`);
35233
35448
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
35234
35449
  }
35235
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
35450
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
35236
35451
  const { counter, error: errorArrayOfObjects } = getItemsInside$3(anythingForNow);
35237
35452
  if (errorArrayOfObjects) {
35238
35453
  console.log(`Key Counter: ${id}: ${errorArrayOfObjects}`);
@@ -35612,7 +35827,7 @@
35612
35827
  if (jsonRoot === void 0) {
35613
35828
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
35614
35829
  }
35615
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
35830
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToLabels}`);
35616
35831
  const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny$1(anythingForNow);
35617
35832
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
35618
35833
  text: notificationSuccessMessage,
@@ -35887,7 +36102,7 @@
35887
36102
  if (jsonRoot === void 0) {
35888
36103
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
35889
36104
  }
35890
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
36105
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToLabels}`);
35891
36106
  const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny(anythingForNow);
35892
36107
  const linkPrefixPrepared = parseAll({ text: linkPrefix, replaceValues, multiQueryData });
35893
36108
  if (!labelsRaw) {
@@ -36157,7 +36372,7 @@
36157
36372
  console.log(`Item Counter: ${id}: No root for json path`);
36158
36373
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
36159
36374
  }
36160
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
36375
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
36161
36376
  const { counter, taints, error: errorArrayOfObjects } = getItemsInside$2(anythingForNow);
36162
36377
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
36163
36378
  text: notificationSuccessMessage,
@@ -36535,7 +36750,7 @@
36535
36750
  console.log(`Item Counter: ${id}: No root for json path`);
36536
36751
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
36537
36752
  }
36538
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
36753
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
36539
36754
  const { counter, tolerations, error: errorArrayOfObjects } = getItemsInside$1(anythingForNow);
36540
36755
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
36541
36756
  text: notificationSuccessMessage,
@@ -36816,7 +37031,7 @@
36816
37031
  console.log(`Item Counter: ${id}: No root for json path`);
36817
37032
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
36818
37033
  }
36819
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
37034
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
36820
37035
  const { counter, annotations, error: errorArrayOfObjects } = getItemsInside(anythingForNow);
36821
37036
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
36822
37037
  text: notificationSuccessMessage,
@@ -37989,7 +38204,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37989
38204
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
37990
38205
  id,
37991
38206
  baseprefix,
37992
- clusterNamePartOfUrl,
38207
+ cluster,
37993
38208
  wsUrl,
37994
38209
  pageSize,
37995
38210
  substractHeight,
@@ -38002,8 +38217,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38002
38217
  baseFactoryNamespacedBuiltinKey,
38003
38218
  baseFactoryClusterSceopedBuiltinKey,
38004
38219
  baseNamespaceFactoryKey,
38005
- baseNavigationPluralName,
38006
- baseNavigationSpecificName,
38220
+ baseNavigationPlural,
38221
+ baseNavigationName,
38007
38222
  ...props
38008
38223
  } = data;
38009
38224
  const theme = useTheme();
@@ -38012,10 +38227,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38012
38227
  acc[index.toString()] = value;
38013
38228
  return acc;
38014
38229
  }, {});
38015
- const clusterName = prepareTemplate({
38016
- template: clusterNamePartOfUrl,
38017
- replaceValues
38018
- });
38230
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
38019
38231
  const wsUrlPrepared = parseAll({ text: wsUrl, replaceValues, multiQueryData });
38020
38232
  const params = new URLSearchParams();
38021
38233
  if (limit) {
@@ -38032,7 +38244,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38032
38244
  }
38033
38245
  if (labelSelectorFull) {
38034
38246
  const root = multiQueryData[`req${labelSelectorFull.reqIndex}`];
38035
- const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root, labelSelectorFull.pathToLabels) : jp.query(root, `$${labelSelectorFull.pathToLabels}`)[0];
38247
+ const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root || {}, labelSelectorFull.pathToLabels) : jp.query(root || {}, `$${labelSelectorFull.pathToLabels}`)[0];
38036
38248
  const serializedLabels = serializeLabelsWithNoEncoding(value);
38037
38249
  if (serializedLabels.length > 0) params.set("labelSelector", serializedLabels);
38038
38250
  }
@@ -38059,7 +38271,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38059
38271
  {
38060
38272
  theme,
38061
38273
  baseprefix,
38062
- cluster: clusterName,
38274
+ cluster: clusterPrepared,
38063
38275
  wsUrl: wsUrlWithParams,
38064
38276
  pageSize,
38065
38277
  substractHeight: substractHeight || 340,
@@ -38068,8 +38280,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38068
38280
  baseFactoryNamespacedBuiltinKey,
38069
38281
  baseFactoryClusterSceopedBuiltinKey,
38070
38282
  baseNamespaceFactoryKey,
38071
- baseNavigationPluralName,
38072
- baseNavigationSpecificName,
38283
+ baseNavigationPlural,
38284
+ baseNavigationName,
38073
38285
  ...props
38074
38286
  }
38075
38287
  ),
@@ -38077,55 +38289,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38077
38289
  ] });
38078
38290
  };
38079
38291
 
38080
- const getKinds = async ({ clusterName }) => {
38081
- const result = await axios.get(`/api/clusters/${clusterName}/openapi-bff/search/kinds/getKinds`);
38082
- return result.data;
38083
- };
38084
-
38085
- const parseK8sVersion$1 = (raw) => {
38086
- const m = /^v(?<major>\d+)(?:(?<stage>alpha|beta)(?<stageNum>\d+)?)?$/i.exec(raw ?? "");
38087
- if (!m?.groups) return { rank: 0, major: -1, stageNum: -1 };
38088
- const stage = (m.groups.stage ?? "").toLowerCase();
38089
- const major = Number(m.groups.major);
38090
- const stageNum = m.groups.stageNum ? Number(m.groups.stageNum) : 0;
38091
- const rank = stage === "" ? 3 : stage === "beta" ? 2 : 1;
38092
- return { rank, major, stageNum };
38093
- };
38094
- const versionToken$1 = (e) => e.version || (e.groupVersion?.split("/").pop() ?? "");
38095
- const compareK8sVersionDesc$1 = (a, b) => {
38096
- const pa = parseK8sVersion$1(versionToken$1(a));
38097
- const pb = parseK8sVersion$1(versionToken$1(b));
38098
- return pb.rank - pa.rank || pb.major - pa.major || pb.stageNum - pa.stageNum;
38099
- };
38100
- const orderVersions = (versions) => {
38101
- const preferredIdx = versions.findIndex((v) => v.preferred === true);
38102
- if (preferredIdx >= 0) {
38103
- const preferred = versions[preferredIdx];
38104
- const rest = versions.filter((_, i) => i !== preferredIdx).slice().sort(compareK8sVersionDesc$1);
38105
- return [preferred, ...rest];
38106
- }
38107
- return versions.slice().sort(compareK8sVersionDesc$1);
38108
- };
38109
- const getSortedKindsAll = (index) => {
38110
- const counts = index.items.reduce(
38111
- (acc, item) => ({ ...acc, [item.kind]: (acc[item.kind] ?? 0) + 1 }),
38112
- {}
38113
- );
38114
- const rows = index.items.flatMap((item) => {
38115
- const ordered = orderVersions(item.versions);
38116
- return ordered.map((v) => ({
38117
- group: item.group,
38118
- kind: item.kind,
38119
- // clone to drop Readonly<> without changing fields (incl. preferred)
38120
- version: { ...v },
38121
- ...counts[item.kind] > 1 ? { notUnique: true } : {}
38122
- }));
38123
- });
38124
- return rows.sort(
38125
- (a, b) => a.kind.localeCompare(b.kind, void 0, { sensitivity: "base" }) || a.group.localeCompare(b.group, void 0, { sensitivity: "base" })
38126
- );
38127
- };
38128
-
38129
38292
  const parseApiVersion = (apiVersion) => {
38130
38293
  const parts = apiVersion.trim().split("/");
38131
38294
  return parts.length === 1 ? { group: "", version: parts[0] } : { group: parts[0], version: parts[1] };
@@ -38201,6 +38364,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38201
38364
  forcedRelatedValuePath,
38202
38365
  rawObjectToFindLabel,
38203
38366
  jsonPathToArrayOfRefs,
38367
+ forcedNamespace,
38204
38368
  theme,
38205
38369
  baseprefix,
38206
38370
  cluster,
@@ -38212,8 +38376,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38212
38376
  baseFactoriesMapping
38213
38377
  }) => {
38214
38378
  let forcedName;
38379
+ let objectNamespace;
38215
38380
  if (keysToForcedLabel && rawObjectToFindLabel) {
38216
- forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel, keysToForcedLabel) : jp.query(rawObjectToFindLabel, `$${keysToForcedLabel}`)[0];
38381
+ forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel || {}, keysToForcedLabel) : jp.query(rawObjectToFindLabel || {}, `$${keysToForcedLabel}`)[0];
38217
38382
  }
38218
38383
  if (forcedRelatedValuePath && rawObjectToFindLabel) {
38219
38384
  try {
@@ -38225,17 +38390,25 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38225
38390
  );
38226
38391
  const relatedPath = forcedRelatedValuePath && ownerRefPathSegs ? resolveFormPath$1(forcedRelatedValuePath, ownerRefPathSegs) : void 0;
38227
38392
  if (relatedPath) {
38228
- forcedName = _$1.get(rawObjectToFindLabel, relatedPath);
38393
+ forcedName = _$1.get(rawObjectToFindLabel || {}, relatedPath);
38229
38394
  }
38230
38395
  } catch {
38231
38396
  }
38232
38397
  }
38398
+ if (rawObjectToFindLabel) {
38399
+ try {
38400
+ const defaultFetched = _$1.get(rawObjectToFindLabel || {}, ["metadata", "namespace"]);
38401
+ const socketFetched = _$1.get(rawObjectToFindLabel || {}, ["items", 0, "metadata", "namespace"]);
38402
+ objectNamespace = socketFetched || defaultFetched;
38403
+ } catch {
38404
+ }
38405
+ }
38233
38406
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
38234
38407
  ResourceLink,
38235
38408
  {
38236
38409
  kind: reference.kind,
38237
38410
  apiVersion: reference.apiVersion,
38238
- namespace: reference.namespace,
38411
+ namespace: forcedNamespace || reference.namespace || objectNamespace,
38239
38412
  forcedName,
38240
38413
  name: reference.name,
38241
38414
  theme,
@@ -38260,18 +38433,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38260
38433
  forcedRelatedValuePath,
38261
38434
  rawObjectToFindLabel,
38262
38435
  jsonPathToArrayOfRefs,
38436
+ forcedNamespace,
38263
38437
  baseFactoryNamespacedAPIKey,
38264
38438
  baseFactoryClusterSceopedAPIKey,
38265
38439
  baseFactoryNamespacedBuiltinKey,
38266
38440
  baseFactoryClusterSceopedBuiltinKey,
38267
- baseNavigationPluralName,
38268
- baseNavigationSpecificName,
38441
+ baseNavigationPlural,
38442
+ baseNavigationName,
38269
38443
  listFlexProps
38270
38444
  }) => {
38271
38445
  const [kindIndex, setKindIndex] = K.useState();
38272
38446
  const [kindsWithVersion, setKindWithVersion] = K.useState();
38273
38447
  K.useEffect(() => {
38274
- getKinds({ clusterName: cluster }).then((data) => {
38448
+ getKinds({ cluster }).then((data) => {
38275
38449
  setKindIndex(data);
38276
38450
  setKindWithVersion(getSortedKindsAll(data));
38277
38451
  }).catch((error) => {
@@ -38280,10 +38454,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38280
38454
  }, [cluster]);
38281
38455
  const { data: navigationDataArr } = useK8sSmartResource({
38282
38456
  cluster,
38283
- group: "front.in-cloud.io",
38284
- version: "v1alpha1",
38285
- plural: baseNavigationPluralName,
38286
- fieldSelector: `metadata.name=${baseNavigationSpecificName}`
38457
+ apiGroup: "front.in-cloud.io",
38458
+ apiVersion: "v1alpha1",
38459
+ plural: baseNavigationPlural,
38460
+ fieldSelector: `metadata.name=${baseNavigationName}`
38287
38461
  });
38288
38462
  const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
38289
38463
  const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
@@ -38295,6 +38469,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38295
38469
  forcedRelatedValuePath,
38296
38470
  rawObjectToFindLabel,
38297
38471
  jsonPathToArrayOfRefs,
38472
+ forcedNamespace,
38298
38473
  theme,
38299
38474
  baseprefix,
38300
38475
  cluster,
@@ -38332,7 +38507,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38332
38507
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
38333
38508
  id,
38334
38509
  baseprefix,
38335
- clusterNamePartOfUrl,
38510
+ cluster,
38336
38511
  reqIndex,
38337
38512
  errorText,
38338
38513
  notArrayErrorText,
@@ -38343,12 +38518,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38343
38518
  keysToForcedLabel,
38344
38519
  forcedRelatedValuePath,
38345
38520
  jsonPathToArrayOfRefs,
38521
+ forcedApiVersion,
38522
+ forcedNamespace,
38346
38523
  baseFactoryNamespacedAPIKey,
38347
38524
  baseFactoryClusterSceopedAPIKey,
38348
38525
  baseFactoryNamespacedBuiltinKey,
38349
38526
  baseFactoryClusterSceopedBuiltinKey,
38350
- baseNavigationPluralName,
38351
- baseNavigationSpecificName,
38527
+ baseNavigationPlural,
38528
+ baseNavigationName,
38352
38529
  ...props
38353
38530
  } = data;
38354
38531
  const theme = useTheme();
@@ -38357,25 +38534,43 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38357
38534
  acc[index.toString()] = value;
38358
38535
  return acc;
38359
38536
  }, {});
38360
- const clusterName = prepareTemplate({
38361
- template: clusterNamePartOfUrl,
38537
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
38538
+ const preparedForcedApiVersion = forcedApiVersion ? forcedApiVersion.map(({ kind, apiVersion }) => ({
38539
+ kind: prepareTemplate({
38540
+ template: kind,
38541
+ replaceValues
38542
+ }),
38543
+ apiVersion: prepareTemplate({
38544
+ template: apiVersion,
38545
+ replaceValues
38546
+ })
38547
+ })) : void 0;
38548
+ const preparedForcedNamespace = forcedNamespace ? prepareTemplate({
38549
+ template: forcedNamespace,
38362
38550
  replaceValues
38363
- });
38551
+ }) : void 0;
38364
38552
  const jsonRoot = multiQueryData[`req${reqIndex}`];
38365
38553
  if (jsonRoot === void 0) {
38366
38554
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
38367
38555
  }
38368
- const refsArr = jp.query(jsonRoot, `$${jsonPathToArrayOfRefs}`)[0];
38556
+ const refsArr = jp.query(jsonRoot || {}, `$${jsonPathToArrayOfRefs}`).flat();
38369
38557
  if (!Array.isArray(refsArr)) {
38370
38558
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: notArrayErrorText });
38371
38559
  }
38372
38560
  if (refsArr.length === 0) {
38373
38561
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: emptyArrayErrorText });
38374
38562
  }
38375
- if (refsArr.some((el) => !isOwnerReference(el))) {
38563
+ const refsArrWithForcedApiVersion = refsArr.map((el) => {
38564
+ const forceFound = preparedForcedApiVersion?.find((force) => force.kind === el.kind);
38565
+ if (forceFound) {
38566
+ return { ...el, apiVersion: forceFound.apiVersion };
38567
+ }
38568
+ return el;
38569
+ });
38570
+ if (refsArrWithForcedApiVersion.some((el) => !isOwnerReference(el))) {
38376
38571
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: isNotRefsArrayErrorText });
38377
38572
  }
38378
- const guardedRefsArr = refsArr;
38573
+ const guardedRefsArr = refsArrWithForcedApiVersion;
38379
38574
  if (isMultiqueryLoading) {
38380
38575
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
38381
38576
  }
@@ -38385,18 +38580,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38385
38580
  {
38386
38581
  theme,
38387
38582
  baseprefix,
38388
- cluster: clusterName,
38583
+ cluster: clusterPrepared,
38389
38584
  refsArr: guardedRefsArr,
38390
38585
  keysToForcedLabel,
38391
38586
  forcedRelatedValuePath,
38392
38587
  jsonPathToArrayOfRefs,
38588
+ forcedNamespace: preparedForcedNamespace,
38393
38589
  rawObjectToFindLabel: jsonRoot,
38394
38590
  baseFactoryNamespacedAPIKey,
38395
38591
  baseFactoryClusterSceopedAPIKey,
38396
38592
  baseFactoryNamespacedBuiltinKey,
38397
38593
  baseFactoryClusterSceopedBuiltinKey,
38398
- baseNavigationPluralName,
38399
- baseNavigationSpecificName,
38594
+ baseNavigationPlural,
38595
+ baseNavigationName,
38400
38596
  listFlexProps,
38401
38597
  ...props
38402
38598
  }
@@ -38405,6 +38601,263 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38405
38601
  ] });
38406
38602
  };
38407
38603
 
38604
+ const Toggler = ({ data, children }) => {
38605
+ const {
38606
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38607
+ id,
38608
+ reqIndex,
38609
+ jsonPathToValue,
38610
+ criteria,
38611
+ notificationSuccessMessage,
38612
+ notificationSuccessMessageDescription,
38613
+ notificationErrorMessage,
38614
+ notificationErrorMessageDescription,
38615
+ containerStyle,
38616
+ endpoint,
38617
+ pathToValue,
38618
+ valueToSubmit
38619
+ } = data;
38620
+ const [api, contextHolder] = antd.notification.useNotification();
38621
+ const queryClient = reactQuery.useQueryClient();
38622
+ const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
38623
+ const partsOfUrl = usePartsOfUrl();
38624
+ if (isMultiQueryLoading) {
38625
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
38626
+ }
38627
+ if (isMultiQueryErrors) {
38628
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
38629
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
38630
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
38631
+ ] });
38632
+ }
38633
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
38634
+ acc[index.toString()] = value;
38635
+ return acc;
38636
+ }, {});
38637
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
38638
+ if (jsonRoot === void 0) {
38639
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
38640
+ }
38641
+ const valueToCompare = jp.query(jsonRoot || {}, `$${jsonPathToValue}`)[0];
38642
+ let valueToSwitch = false;
38643
+ if (criteria.type === "forSuccess") {
38644
+ if (criteria.operator === "exists") {
38645
+ valueToSwitch = valueToCompare !== void 0;
38646
+ }
38647
+ if (criteria.operator === "equals") {
38648
+ valueToSwitch = String(valueToCompare) === criteria.valueToCompare;
38649
+ }
38650
+ }
38651
+ if (criteria.type === "forError") {
38652
+ if (criteria.operator === "exists") {
38653
+ valueToSwitch = !valueToCompare;
38654
+ }
38655
+ if (criteria.operator === "equals") {
38656
+ valueToSwitch = String(valueToCompare) !== criteria.valueToCompare;
38657
+ }
38658
+ }
38659
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
38660
+ text: notificationSuccessMessage,
38661
+ replaceValues,
38662
+ multiQueryData
38663
+ }) : "Success";
38664
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
38665
+ text: notificationSuccessMessageDescription,
38666
+ replaceValues,
38667
+ multiQueryData
38668
+ }) : "Success";
38669
+ const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
38670
+ text: notificationErrorMessage,
38671
+ replaceValues,
38672
+ multiQueryData
38673
+ }) : "Success";
38674
+ const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
38675
+ text: notificationErrorMessageDescription,
38676
+ replaceValues,
38677
+ multiQueryData
38678
+ }) : "Success";
38679
+ const openNotificationSuccess = () => {
38680
+ api.success({
38681
+ message: notificationSuccessMessagePrepared,
38682
+ description: notificationSuccessMessageDescriptionPrepared,
38683
+ placement: "bottomRight"
38684
+ });
38685
+ };
38686
+ const openNotificationError = () => {
38687
+ api.error({
38688
+ message: notificationErrorMessagePrepared,
38689
+ description: notificationErrorMessageDescriptionPrepared,
38690
+ placement: "bottomRight"
38691
+ });
38692
+ };
38693
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
38694
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
38695
+ const toggleOn = () => {
38696
+ patchEntryWithReplaceOp({
38697
+ endpoint: endpointPrepared,
38698
+ pathToValue: pathToValuePrepared,
38699
+ body: valueToSubmit.onValue
38700
+ }).then(() => {
38701
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38702
+ openNotificationSuccess();
38703
+ }).catch((error) => {
38704
+ openNotificationError();
38705
+ console.error(error);
38706
+ });
38707
+ };
38708
+ const toggleOff = () => {
38709
+ if (valueToSubmit.offValue !== void 0) {
38710
+ patchEntryWithReplaceOp({
38711
+ endpoint: endpointPrepared,
38712
+ pathToValue: pathToValuePrepared,
38713
+ body: valueToSubmit.offValue
38714
+ }).then(() => {
38715
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38716
+ openNotificationSuccess();
38717
+ }).catch((error) => {
38718
+ openNotificationError();
38719
+ console.error(error);
38720
+ });
38721
+ }
38722
+ if (valueToSubmit.toRemoveWhenOff) {
38723
+ patchEntryWithDeleteOp({
38724
+ endpoint: endpointPrepared,
38725
+ pathToValue: pathToValuePrepared
38726
+ }).then(() => {
38727
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38728
+ openNotificationSuccess();
38729
+ }).catch((error) => {
38730
+ openNotificationError();
38731
+ console.error(error);
38732
+ });
38733
+ }
38734
+ };
38735
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
38736
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
38737
+ antd.Switch,
38738
+ {
38739
+ value: valueToSwitch,
38740
+ onChange: (checked) => {
38741
+ if (checked) {
38742
+ toggleOn();
38743
+ } else {
38744
+ toggleOff();
38745
+ }
38746
+ }
38747
+ }
38748
+ ),
38749
+ children,
38750
+ contextHolder
38751
+ ] });
38752
+ };
38753
+
38754
+ const TogglerSegmented = ({
38755
+ data,
38756
+ children
38757
+ }) => {
38758
+ const {
38759
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38760
+ id,
38761
+ reqIndex,
38762
+ jsonPathToValue,
38763
+ notificationSuccessMessage,
38764
+ notificationSuccessMessageDescription,
38765
+ notificationErrorMessage,
38766
+ notificationErrorMessageDescription,
38767
+ containerStyle,
38768
+ endpoint,
38769
+ pathToValue,
38770
+ possibleValues,
38771
+ valuesMap
38772
+ } = data;
38773
+ const [api, contextHolder] = antd.notification.useNotification();
38774
+ const queryClient = reactQuery.useQueryClient();
38775
+ const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
38776
+ const partsOfUrl = usePartsOfUrl();
38777
+ if (isMultiQueryLoading) {
38778
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
38779
+ }
38780
+ if (isMultiQueryErrors) {
38781
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
38782
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
38783
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
38784
+ ] });
38785
+ }
38786
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
38787
+ acc[index.toString()] = value;
38788
+ return acc;
38789
+ }, {});
38790
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
38791
+ if (jsonRoot === void 0) {
38792
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
38793
+ }
38794
+ const valueToCompare = jp.query(jsonRoot || {}, `$${jsonPathToValue}`)[0];
38795
+ const valueToSegmented = valuesMap?.find((el) => el.value === valueToCompare)?.renderedValue;
38796
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
38797
+ text: notificationSuccessMessage,
38798
+ replaceValues,
38799
+ multiQueryData
38800
+ }) : "Success";
38801
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
38802
+ text: notificationSuccessMessageDescription,
38803
+ replaceValues,
38804
+ multiQueryData
38805
+ }) : "Success";
38806
+ const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
38807
+ text: notificationErrorMessage,
38808
+ replaceValues,
38809
+ multiQueryData
38810
+ }) : "Success";
38811
+ const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
38812
+ text: notificationErrorMessageDescription,
38813
+ replaceValues,
38814
+ multiQueryData
38815
+ }) : "Success";
38816
+ const openNotificationSuccess = () => {
38817
+ api.success({
38818
+ message: notificationSuccessMessagePrepared,
38819
+ description: notificationSuccessMessageDescriptionPrepared,
38820
+ placement: "bottomRight"
38821
+ });
38822
+ };
38823
+ const openNotificationError = () => {
38824
+ api.error({
38825
+ message: notificationErrorMessagePrepared,
38826
+ description: notificationErrorMessageDescriptionPrepared,
38827
+ placement: "bottomRight"
38828
+ });
38829
+ };
38830
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
38831
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
38832
+ const onChange = (renderedValue) => {
38833
+ const valueFromMap = valuesMap?.find((el) => el.renderedValue === renderedValue)?.value;
38834
+ const valueToSend = valueFromMap || renderedValue;
38835
+ patchEntryWithReplaceOp({
38836
+ endpoint: endpointPrepared,
38837
+ pathToValue: pathToValuePrepared,
38838
+ body: valueToSend
38839
+ }).then(() => {
38840
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38841
+ openNotificationSuccess();
38842
+ }).catch((error) => {
38843
+ openNotificationError();
38844
+ console.error(error);
38845
+ });
38846
+ };
38847
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
38848
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
38849
+ antd.Segmented,
38850
+ {
38851
+ options: possibleValues,
38852
+ value: valueToSegmented || "~n~e~v~e~r",
38853
+ onChange: (value) => onChange(value)
38854
+ }
38855
+ ),
38856
+ children,
38857
+ contextHolder
38858
+ ] });
38859
+ };
38860
+
38408
38861
  const DynamicComponents = {
38409
38862
  DefaultDiv,
38410
38863
  antdText: AntdText,
@@ -38442,7 +38895,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38442
38895
  SecretBase64Plain,
38443
38896
  ResourceBadge,
38444
38897
  Events: Events$1,
38445
- OwnerRefs
38898
+ OwnerRefs,
38899
+ Toggler,
38900
+ TogglerSegmented
38446
38901
  };
38447
38902
 
38448
38903
  const prepareUrlsToFetchForDynamicRenderer = ({
@@ -38461,7 +38916,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38461
38916
  );
38462
38917
  };
38463
38918
 
38464
- const STRING_KEYS = ["cluster", "group", "version", "plural", "namespace", "fieldSelector", "labelSelector"];
38919
+ const STRING_KEYS = [
38920
+ "cluster",
38921
+ "apiGroup",
38922
+ "apiVersion",
38923
+ "plural",
38924
+ "namespace",
38925
+ "fieldSelector",
38926
+ "labelSelector"
38927
+ ];
38465
38928
  const DynamicRendererWithProviders = (props) => {
38466
38929
  const location = reactRouterDom.useLocation();
38467
38930
  const { urlsToFetch, dataToApplyToContext, theme, nodeTerminalDefaultProfile, disableEventBubbling } = props;
@@ -38513,7 +38976,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38513
38976
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
38514
38977
  DynamicRendererWithProviders,
38515
38978
  {
38516
- urlsToFetch: [],
38979
+ urlsToFetch: customProps.urlsToFetch || [],
38517
38980
  dataToApplyToContext: record,
38518
38981
  theme,
38519
38982
  disableEventBubbling: customProps.disableEventBubbling,
@@ -38533,6 +38996,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38533
38996
  }) => {
38534
38997
  if (possibleCustomTypeWithProps) {
38535
38998
  const { type, customProps } = possibleCustomTypeWithProps;
38999
+ if (type === "factory") {
39000
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TableFactory, { record, customProps, theme });
39001
+ }
38536
39002
  if (value === void 0 && possibleUndefinedValue) {
38537
39003
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ShortenedTextWithTooltip, { trimLength: possibleTrimLength, text: possibleUndefinedValue });
38538
39004
  }
@@ -38570,9 +39036,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38570
39036
  }
38571
39037
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TrimmedTags, { tags, trimLength: possibleTrimLength });
38572
39038
  }
38573
- if (type === "factory") {
38574
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TableFactory, { record, customProps, theme });
38575
- }
38576
39039
  }
38577
39040
  if (value === null) {
38578
39041
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "null" });
@@ -38753,13 +39216,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38753
39216
  domEvent.preventDefault();
38754
39217
  if (key === "edit") {
38755
39218
  navigate(
38756
- `${baseprefix}/${value.cluster}${value.namespace ? `/${value.namespace}` : ""}${value.syntheticProject ? `/${value.syntheticProject}` : ""}/${value.pathPrefix}/${value.apiGroupAndVersion}/${value.typeName}/${value.entryName}?backlink=${value.backlink}`
39219
+ `${baseprefix}/${value.cluster}${value.namespace ? `/${value.namespace}` : ""}${value.syntheticProject ? `/${value.syntheticProject}` : ""}/${value.pathPrefix}/${value.apiGroupAndVersion}/${value.plural}/${value.name}?backlink=${value.backlink}`
38757
39220
  );
38758
39221
  }
38759
39222
  if (key === "delete") {
38760
39223
  value.onDeleteHandle(
38761
- value.entryName,
38762
- `${value.deletePathPrefix}/${value.apiGroupAndVersion}${value.namespace ? `/namespaces/${value.namespace}` : ""}/${value.typeName}/${value.entryName}`
39224
+ value.name,
39225
+ `${value.deletePathPrefix}/${value.apiGroupAndVersion}${value.namespace ? `/namespaces/${value.namespace}` : ""}/${value.plural}/${value.name}`
38763
39226
  );
38764
39227
  }
38765
39228
  }
@@ -38860,8 +39323,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38860
39323
  selectData.onChange(
38861
39324
  selectedRowKeys,
38862
39325
  rows.map(({ internalDataForControls }) => ({
38863
- name: internalDataForControls.entryName,
38864
- endpoint: `${internalDataForControls.deletePathPrefix}/${internalDataForControls.apiGroupAndVersion}${internalDataForControls.namespace ? `/namespaces/${internalDataForControls.namespace}` : ""}/${internalDataForControls.typeName}/${internalDataForControls.entryName}`
39326
+ name: internalDataForControls.name,
39327
+ endpoint: `${internalDataForControls.deletePathPrefix}/${internalDataForControls.apiGroupAndVersion}${internalDataForControls.namespace ? `/namespaces/${internalDataForControls.namespace}` : ""}/${internalDataForControls.plural}/${internalDataForControls.name}`
38865
39328
  }))
38866
39329
  );
38867
39330
  }
@@ -38870,16 +39333,16 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38870
39333
  return {
38871
39334
  onClick: () => {
38872
39335
  if (pathToNavigate && recordKeysForNavigation) {
38873
- const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record, `$${recordKeysForNavigation}`)[0];
39336
+ const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record || {}, `$${recordKeysForNavigation}`)[0];
38874
39337
  let recordValueRawSecond = "";
38875
39338
  if (recordKeysForNavigationSecond) {
38876
- recordValueRawSecond = Array.isArray(recordKeysForNavigationSecond) ? lodashExports.get(record, recordKeysForNavigationSecond) : jp.query(record, `$${recordKeysForNavigationSecond}`)[0];
39339
+ recordValueRawSecond = Array.isArray(recordKeysForNavigationSecond) ? lodashExports.get(record, recordKeysForNavigationSecond) : jp.query(record || {}, `$${recordKeysForNavigationSecond}`)[0];
38877
39340
  } else {
38878
39341
  recordValueRawSecond = "no-second-record-keys";
38879
39342
  }
38880
39343
  let recordValueRawThird = "";
38881
39344
  if (recordKeysForNavigationThird) {
38882
- recordValueRawThird = Array.isArray(recordKeysForNavigationThird) ? lodashExports.get(record, recordKeysForNavigationThird) : jp.query(record, `$${recordKeysForNavigationThird}`)[0];
39345
+ recordValueRawThird = Array.isArray(recordKeysForNavigationThird) ? lodashExports.get(record, recordKeysForNavigationThird) : jp.query(record || {}, `$${recordKeysForNavigationThird}`)[0];
38883
39346
  } else {
38884
39347
  recordValueRawThird = "no-second-record-keys";
38885
39348
  }
@@ -38962,8 +39425,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38962
39425
  syntheticProject: dataForControls.syntheticProject,
38963
39426
  pathPrefix: dataForControls.pathPrefix,
38964
39427
  apiGroupAndVersion: dataForControls.apiVersion,
38965
- typeName: dataForControls.typeName,
38966
- entryName: el.metadata.name,
39428
+ plural: dataForControls.plural,
39429
+ name: el.metadata.name,
38967
39430
  namespace: el.metadata.namespace || void 0,
38968
39431
  backlink: dataForControls.backlink,
38969
39432
  deletePathPrefix: dataForControls.deletePathPrefix,
@@ -38984,7 +39447,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38984
39447
  dataSource = dataSource.map((el) => {
38985
39448
  const newFieldsForComplexJsonPath = {};
38986
39449
  customFields.forEach(({ dataIndex, jsonPath }) => {
38987
- const jpQueryResult = jp.query(el, `$${jsonPath}`);
39450
+ const jpQueryResult = jp.query(el || {}, `$${jsonPath}`);
38988
39451
  newFieldsForComplexJsonPath[dataIndex] = Array.isArray(jpQueryResult) && jpQueryResult.length === 1 ? jpQueryResult[0] : jpQueryResult;
38989
39452
  });
38990
39453
  if (typeof el === "object") {
@@ -39003,7 +39466,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39003
39466
  if (!el || typeof el !== "object" || Array.isArray(el)) {
39004
39467
  return;
39005
39468
  }
39006
- const mapValue = jp.query(el, `$${flatMapColumn.jsonPath}`)[0];
39469
+ const mapValue = jp.query(el || {}, `$${flatMapColumn.jsonPath}`)[0];
39007
39470
  if (mapValue && typeof mapValue === "object" && !Array.isArray(mapValue) && mapValue !== null) {
39008
39471
  const mapEntries = Object.entries(mapValue);
39009
39472
  if (mapEntries.length > 0) {
@@ -39045,8 +39508,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39045
39508
  synthetichProject: dataForControls.syntheticProject,
39046
39509
  pathPrefix: dataForControls.pathPrefix,
39047
39510
  apiGroupAndVersion: dataForControls.apiVersion,
39048
- typeName: dataForControls.typeName,
39049
- entryName: el.metadata.name,
39511
+ plural: dataForControls.plural,
39512
+ name: el.metadata.name,
39050
39513
  namespace: el.metadata.namespace || void 0,
39051
39514
  backlink: dataForControls.backlink,
39052
39515
  deletePathPrefix: dataForControls.deletePathPrefix,
@@ -39091,18 +39554,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39091
39554
  const [isLoading, setIsLoading] = K.useState(false);
39092
39555
  const [isError, setIsError] = K.useState(false);
39093
39556
  const updatePermission = usePermissions({
39094
- group: dataForControls?.apiGroup,
39095
- resource: dataForControls?.resource || "",
39557
+ apiGroup: dataForControls?.apiGroup,
39558
+ plural: dataForControls?.plural || "",
39096
39559
  namespace,
39097
- clusterName: cluster,
39560
+ cluster,
39098
39561
  verb: "update",
39099
39562
  refetchInterval: false
39100
39563
  });
39101
39564
  const deletePermission = usePermissions({
39102
- group: dataForControls?.apiGroup,
39103
- resource: dataForControls?.resource || "",
39565
+ apiGroup: dataForControls?.apiGroup,
39566
+ plural: dataForControls?.plural || "",
39104
39567
  namespace,
39105
- clusterName: cluster,
39568
+ cluster,
39106
39569
  verb: "delete",
39107
39570
  refetchInterval: false
39108
39571
  });
@@ -39110,7 +39573,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39110
39573
  setIsError(void 0);
39111
39574
  setIsLoading(true);
39112
39575
  const payload = {
39113
- clusterName: cluster,
39576
+ cluster,
39114
39577
  customizationId,
39115
39578
  tableMappingsReplaceValues,
39116
39579
  forceDefaultAdditionalPrinterColumns,
@@ -39153,7 +39616,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39153
39616
  cluster: dataForControls.cluster,
39154
39617
  syntheticProject: dataForControls.syntheticProject,
39155
39618
  pathPrefix: !dataForControls.apiGroup || dataForControls.apiGroup.length === 0 ? "forms/builtin" : "forms/apis",
39156
- typeName: dataForControls.resource,
39619
+ plural: dataForControls.plural,
39157
39620
  apiVersion: !dataForControls.apiGroup || dataForControls.apiGroup.length === 0 ? dataForControls.apiVersion : `${dataForControls.apiGroup}/${dataForControls.apiVersion}`,
39158
39621
  backlink: encodeURIComponent(fullPath),
39159
39622
  onDeleteHandle: dataForControlsInternal.onDeleteHandle,
@@ -39187,808 +39650,236 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39187
39650
  );
39188
39651
  };
39189
39652
 
39190
- /**
39191
- * lodash (Custom Build) <https://lodash.com/>
39192
- * Build: `lodash modularize exports="npm" -o ./`
39193
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
39194
- * Released under MIT license <https://lodash.com/license>
39195
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
39196
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
39197
- */
39653
+ function _defineProperty$1(obj, key, value) {
39654
+ if (key in obj) {
39655
+ Object.defineProperty(obj, key, {
39656
+ value: value,
39657
+ enumerable: true,
39658
+ configurable: true,
39659
+ writable: true
39660
+ });
39661
+ } else {
39662
+ obj[key] = value;
39663
+ }
39198
39664
 
39199
- /** Used as the `TypeError` message for "Functions" methods. */
39200
- var FUNC_ERROR_TEXT = 'Expected a function';
39665
+ return obj;
39666
+ }
39201
39667
 
39202
- /** Used as references for various `Number` constants. */
39203
- var NAN = 0 / 0;
39668
+ function ownKeys$1(object, enumerableOnly) {
39669
+ var keys = Object.keys(object);
39204
39670
 
39205
- /** `Object#toString` result references. */
39206
- var symbolTag = '[object Symbol]';
39671
+ if (Object.getOwnPropertySymbols) {
39672
+ var symbols = Object.getOwnPropertySymbols(object);
39673
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
39674
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
39675
+ });
39676
+ keys.push.apply(keys, symbols);
39677
+ }
39207
39678
 
39208
- /** Used to match leading and trailing whitespace. */
39209
- var reTrim = /^\s+|\s+$/g;
39679
+ return keys;
39680
+ }
39210
39681
 
39211
- /** Used to detect bad signed hexadecimal string values. */
39212
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
39682
+ function _objectSpread2$1(target) {
39683
+ for (var i = 1; i < arguments.length; i++) {
39684
+ var source = arguments[i] != null ? arguments[i] : {};
39213
39685
 
39214
- /** Used to detect binary string values. */
39215
- var reIsBinary = /^0b[01]+$/i;
39686
+ if (i % 2) {
39687
+ ownKeys$1(Object(source), true).forEach(function (key) {
39688
+ _defineProperty$1(target, key, source[key]);
39689
+ });
39690
+ } else if (Object.getOwnPropertyDescriptors) {
39691
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
39692
+ } else {
39693
+ ownKeys$1(Object(source)).forEach(function (key) {
39694
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39695
+ });
39696
+ }
39697
+ }
39216
39698
 
39217
- /** Used to detect octal string values. */
39218
- var reIsOctal = /^0o[0-7]+$/i;
39699
+ return target;
39700
+ }
39219
39701
 
39220
- /** Built-in method references without a dependency on `root`. */
39221
- var freeParseInt = parseInt;
39702
+ function _objectWithoutPropertiesLoose(source, excluded) {
39703
+ if (source == null) return {};
39704
+ var target = {};
39705
+ var sourceKeys = Object.keys(source);
39706
+ var key, i;
39222
39707
 
39223
- /** Detect free variable `global` from Node.js. */
39224
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
39708
+ for (i = 0; i < sourceKeys.length; i++) {
39709
+ key = sourceKeys[i];
39710
+ if (excluded.indexOf(key) >= 0) continue;
39711
+ target[key] = source[key];
39712
+ }
39225
39713
 
39226
- /** Detect free variable `self`. */
39227
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
39714
+ return target;
39715
+ }
39228
39716
 
39229
- /** Used as a reference to the global object. */
39230
- var root = freeGlobal || freeSelf || Function('return this')();
39717
+ function _objectWithoutProperties(source, excluded) {
39718
+ if (source == null) return {};
39231
39719
 
39232
- /** Used for built-in method references. */
39233
- var objectProto = Object.prototype;
39720
+ var target = _objectWithoutPropertiesLoose(source, excluded);
39234
39721
 
39235
- /**
39236
- * Used to resolve the
39237
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
39238
- * of values.
39239
- */
39240
- var objectToString = objectProto.toString;
39722
+ var key, i;
39241
39723
 
39242
- /* Built-in method references for those with the same name as other `lodash` methods. */
39243
- var nativeMax = Math.max,
39244
- nativeMin = Math.min;
39724
+ if (Object.getOwnPropertySymbols) {
39725
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
39245
39726
 
39246
- /**
39247
- * Gets the timestamp of the number of milliseconds that have elapsed since
39248
- * the Unix epoch (1 January 1970 00:00:00 UTC).
39249
- *
39250
- * @static
39251
- * @memberOf _
39252
- * @since 2.4.0
39253
- * @category Date
39254
- * @returns {number} Returns the timestamp.
39255
- * @example
39256
- *
39257
- * _.defer(function(stamp) {
39258
- * console.log(_.now() - stamp);
39259
- * }, _.now());
39260
- * // => Logs the number of milliseconds it took for the deferred invocation.
39261
- */
39262
- var now = function() {
39263
- return root.Date.now();
39264
- };
39727
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
39728
+ key = sourceSymbolKeys[i];
39729
+ if (excluded.indexOf(key) >= 0) continue;
39730
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
39731
+ target[key] = source[key];
39732
+ }
39733
+ }
39265
39734
 
39266
- /**
39267
- * Creates a debounced function that delays invoking `func` until after `wait`
39268
- * milliseconds have elapsed since the last time the debounced function was
39269
- * invoked. The debounced function comes with a `cancel` method to cancel
39270
- * delayed `func` invocations and a `flush` method to immediately invoke them.
39271
- * Provide `options` to indicate whether `func` should be invoked on the
39272
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
39273
- * with the last arguments provided to the debounced function. Subsequent
39274
- * calls to the debounced function return the result of the last `func`
39275
- * invocation.
39276
- *
39277
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
39278
- * invoked on the trailing edge of the timeout only if the debounced function
39279
- * is invoked more than once during the `wait` timeout.
39280
- *
39281
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
39282
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
39283
- *
39284
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
39285
- * for details over the differences between `_.debounce` and `_.throttle`.
39286
- *
39287
- * @static
39288
- * @memberOf _
39289
- * @since 0.1.0
39290
- * @category Function
39291
- * @param {Function} func The function to debounce.
39292
- * @param {number} [wait=0] The number of milliseconds to delay.
39293
- * @param {Object} [options={}] The options object.
39294
- * @param {boolean} [options.leading=false]
39295
- * Specify invoking on the leading edge of the timeout.
39296
- * @param {number} [options.maxWait]
39297
- * The maximum time `func` is allowed to be delayed before it's invoked.
39298
- * @param {boolean} [options.trailing=true]
39299
- * Specify invoking on the trailing edge of the timeout.
39300
- * @returns {Function} Returns the new debounced function.
39301
- * @example
39302
- *
39303
- * // Avoid costly calculations while the window size is in flux.
39304
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
39305
- *
39306
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
39307
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
39308
- * 'leading': true,
39309
- * 'trailing': false
39310
- * }));
39311
- *
39312
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
39313
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
39314
- * var source = new EventSource('/stream');
39315
- * jQuery(source).on('message', debounced);
39316
- *
39317
- * // Cancel the trailing debounced invocation.
39318
- * jQuery(window).on('popstate', debounced.cancel);
39319
- */
39320
- function debounce(func, wait, options) {
39321
- var lastArgs,
39322
- lastThis,
39323
- maxWait,
39324
- result,
39325
- timerId,
39326
- lastCallTime,
39327
- lastInvokeTime = 0,
39328
- leading = false,
39329
- maxing = false,
39330
- trailing = true;
39735
+ return target;
39736
+ }
39331
39737
 
39332
- if (typeof func != 'function') {
39333
- throw new TypeError(FUNC_ERROR_TEXT);
39334
- }
39335
- wait = toNumber(wait) || 0;
39336
- if (isObject$2(options)) {
39337
- leading = !!options.leading;
39338
- maxing = 'maxWait' in options;
39339
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
39340
- trailing = 'trailing' in options ? !!options.trailing : trailing;
39341
- }
39738
+ function _slicedToArray(arr, i) {
39739
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
39740
+ }
39342
39741
 
39343
- function invokeFunc(time) {
39344
- var args = lastArgs,
39345
- thisArg = lastThis;
39742
+ function _arrayWithHoles(arr) {
39743
+ if (Array.isArray(arr)) return arr;
39744
+ }
39346
39745
 
39347
- lastArgs = lastThis = undefined;
39348
- lastInvokeTime = time;
39349
- result = func.apply(thisArg, args);
39350
- return result;
39351
- }
39746
+ function _iterableToArrayLimit(arr, i) {
39747
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
39748
+ var _arr = [];
39749
+ var _n = true;
39750
+ var _d = false;
39751
+ var _e = undefined;
39352
39752
 
39353
- function leadingEdge(time) {
39354
- // Reset any `maxWait` timer.
39355
- lastInvokeTime = time;
39356
- // Start the timer for the trailing edge.
39357
- timerId = setTimeout(timerExpired, wait);
39358
- // Invoke the leading edge.
39359
- return leading ? invokeFunc(time) : result;
39753
+ try {
39754
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
39755
+ _arr.push(_s.value);
39756
+
39757
+ if (i && _arr.length === i) break;
39758
+ }
39759
+ } catch (err) {
39760
+ _d = true;
39761
+ _e = err;
39762
+ } finally {
39763
+ try {
39764
+ if (!_n && _i["return"] != null) _i["return"]();
39765
+ } finally {
39766
+ if (_d) throw _e;
39767
+ }
39360
39768
  }
39361
39769
 
39362
- function remainingWait(time) {
39363
- var timeSinceLastCall = time - lastCallTime,
39364
- timeSinceLastInvoke = time - lastInvokeTime,
39365
- result = wait - timeSinceLastCall;
39770
+ return _arr;
39771
+ }
39366
39772
 
39367
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
39368
- }
39773
+ function _unsupportedIterableToArray(o, minLen) {
39774
+ if (!o) return;
39775
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
39776
+ var n = Object.prototype.toString.call(o).slice(8, -1);
39777
+ if (n === "Object" && o.constructor) n = o.constructor.name;
39778
+ if (n === "Map" || n === "Set") return Array.from(o);
39779
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
39780
+ }
39369
39781
 
39370
- function shouldInvoke(time) {
39371
- var timeSinceLastCall = time - lastCallTime,
39372
- timeSinceLastInvoke = time - lastInvokeTime;
39782
+ function _arrayLikeToArray(arr, len) {
39783
+ if (len == null || len > arr.length) len = arr.length;
39373
39784
 
39374
- // Either this is the first call, activity has stopped and we're at the
39375
- // trailing edge, the system time has gone backwards and we're treating
39376
- // it as the trailing edge, or we've hit the `maxWait` limit.
39377
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
39378
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
39379
- }
39785
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
39380
39786
 
39381
- function timerExpired() {
39382
- var time = now();
39383
- if (shouldInvoke(time)) {
39384
- return trailingEdge(time);
39385
- }
39386
- // Restart the timer.
39387
- timerId = setTimeout(timerExpired, remainingWait(time));
39787
+ return arr2;
39788
+ }
39789
+
39790
+ function _nonIterableRest() {
39791
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
39792
+ }
39793
+
39794
+ function _defineProperty(obj, key, value) {
39795
+ if (key in obj) {
39796
+ Object.defineProperty(obj, key, {
39797
+ value: value,
39798
+ enumerable: true,
39799
+ configurable: true,
39800
+ writable: true
39801
+ });
39802
+ } else {
39803
+ obj[key] = value;
39388
39804
  }
39389
39805
 
39390
- function trailingEdge(time) {
39391
- timerId = undefined;
39806
+ return obj;
39807
+ }
39392
39808
 
39393
- // Only invoke if we have `lastArgs` which means `func` has been
39394
- // debounced at least once.
39395
- if (trailing && lastArgs) {
39396
- return invokeFunc(time);
39397
- }
39398
- lastArgs = lastThis = undefined;
39399
- return result;
39809
+ function ownKeys(object, enumerableOnly) {
39810
+ var keys = Object.keys(object);
39811
+
39812
+ if (Object.getOwnPropertySymbols) {
39813
+ var symbols = Object.getOwnPropertySymbols(object);
39814
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
39815
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
39816
+ });
39817
+ keys.push.apply(keys, symbols);
39400
39818
  }
39401
39819
 
39402
- function cancel() {
39403
- if (timerId !== undefined) {
39404
- clearTimeout(timerId);
39820
+ return keys;
39821
+ }
39822
+
39823
+ function _objectSpread2(target) {
39824
+ for (var i = 1; i < arguments.length; i++) {
39825
+ var source = arguments[i] != null ? arguments[i] : {};
39826
+
39827
+ if (i % 2) {
39828
+ ownKeys(Object(source), true).forEach(function (key) {
39829
+ _defineProperty(target, key, source[key]);
39830
+ });
39831
+ } else if (Object.getOwnPropertyDescriptors) {
39832
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
39833
+ } else {
39834
+ ownKeys(Object(source)).forEach(function (key) {
39835
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39836
+ });
39405
39837
  }
39406
- lastInvokeTime = 0;
39407
- lastArgs = lastCallTime = lastThis = timerId = undefined;
39408
39838
  }
39409
39839
 
39410
- function flush() {
39411
- return timerId === undefined ? result : trailingEdge(now());
39840
+ return target;
39841
+ }
39842
+
39843
+ function compose$1() {
39844
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
39845
+ fns[_key] = arguments[_key];
39412
39846
  }
39413
39847
 
39414
- function debounced() {
39415
- var time = now(),
39416
- isInvoking = shouldInvoke(time);
39848
+ return function (x) {
39849
+ return fns.reduceRight(function (y, f) {
39850
+ return f(y);
39851
+ }, x);
39852
+ };
39853
+ }
39417
39854
 
39418
- lastArgs = arguments;
39419
- lastThis = this;
39420
- lastCallTime = time;
39855
+ function curry$1(fn) {
39856
+ return function curried() {
39857
+ var _this = this;
39421
39858
 
39422
- if (isInvoking) {
39423
- if (timerId === undefined) {
39424
- return leadingEdge(lastCallTime);
39425
- }
39426
- if (maxing) {
39427
- // Handle invocations in a tight loop.
39428
- timerId = setTimeout(timerExpired, wait);
39429
- return invokeFunc(lastCallTime);
39430
- }
39431
- }
39432
- if (timerId === undefined) {
39433
- timerId = setTimeout(timerExpired, wait);
39859
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
39860
+ args[_key2] = arguments[_key2];
39434
39861
  }
39435
- return result;
39436
- }
39437
- debounced.cancel = cancel;
39438
- debounced.flush = flush;
39439
- return debounced;
39862
+
39863
+ return args.length >= fn.length ? fn.apply(this, args) : function () {
39864
+ for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
39865
+ nextArgs[_key3] = arguments[_key3];
39866
+ }
39867
+
39868
+ return curried.apply(_this, [].concat(args, nextArgs));
39869
+ };
39870
+ };
39440
39871
  }
39441
39872
 
39442
- /**
39443
- * Checks if `value` is the
39444
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
39445
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
39446
- *
39447
- * @static
39448
- * @memberOf _
39449
- * @since 0.1.0
39450
- * @category Lang
39451
- * @param {*} value The value to check.
39452
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
39453
- * @example
39454
- *
39455
- * _.isObject({});
39456
- * // => true
39457
- *
39458
- * _.isObject([1, 2, 3]);
39459
- * // => true
39460
- *
39461
- * _.isObject(_.noop);
39462
- * // => true
39463
- *
39464
- * _.isObject(null);
39465
- * // => false
39466
- */
39467
39873
  function isObject$2(value) {
39468
- var type = typeof value;
39469
- return !!value && (type == 'object' || type == 'function');
39874
+ return {}.toString.call(value).includes('Object');
39470
39875
  }
39471
39876
 
39472
- /**
39473
- * Checks if `value` is object-like. A value is object-like if it's not `null`
39474
- * and has a `typeof` result of "object".
39475
- *
39476
- * @static
39477
- * @memberOf _
39478
- * @since 4.0.0
39479
- * @category Lang
39480
- * @param {*} value The value to check.
39481
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
39482
- * @example
39483
- *
39484
- * _.isObjectLike({});
39485
- * // => true
39486
- *
39487
- * _.isObjectLike([1, 2, 3]);
39488
- * // => true
39489
- *
39490
- * _.isObjectLike(_.noop);
39491
- * // => false
39492
- *
39493
- * _.isObjectLike(null);
39494
- * // => false
39495
- */
39496
- function isObjectLike(value) {
39497
- return !!value && typeof value == 'object';
39877
+ function isEmpty$1(obj) {
39878
+ return !Object.keys(obj).length;
39498
39879
  }
39499
39880
 
39500
- /**
39501
- * Checks if `value` is classified as a `Symbol` primitive or object.
39502
- *
39503
- * @static
39504
- * @memberOf _
39505
- * @since 4.0.0
39506
- * @category Lang
39507
- * @param {*} value The value to check.
39508
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
39509
- * @example
39510
- *
39511
- * _.isSymbol(Symbol.iterator);
39512
- * // => true
39513
- *
39514
- * _.isSymbol('abc');
39515
- * // => false
39516
- */
39517
- function isSymbol(value) {
39518
- return typeof value == 'symbol' ||
39519
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
39520
- }
39521
-
39522
- /**
39523
- * Converts `value` to a number.
39524
- *
39525
- * @static
39526
- * @memberOf _
39527
- * @since 4.0.0
39528
- * @category Lang
39529
- * @param {*} value The value to process.
39530
- * @returns {number} Returns the number.
39531
- * @example
39532
- *
39533
- * _.toNumber(3.2);
39534
- * // => 3.2
39535
- *
39536
- * _.toNumber(Number.MIN_VALUE);
39537
- * // => 5e-324
39538
- *
39539
- * _.toNumber(Infinity);
39540
- * // => Infinity
39541
- *
39542
- * _.toNumber('3.2');
39543
- * // => 3.2
39544
- */
39545
- function toNumber(value) {
39546
- if (typeof value == 'number') {
39547
- return value;
39548
- }
39549
- if (isSymbol(value)) {
39550
- return NAN;
39551
- }
39552
- if (isObject$2(value)) {
39553
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
39554
- value = isObject$2(other) ? (other + '') : other;
39555
- }
39556
- if (typeof value != 'string') {
39557
- return value === 0 ? value : +value;
39558
- }
39559
- value = value.replace(reTrim, '');
39560
- var isBinary = reIsBinary.test(value);
39561
- return (isBinary || reIsOctal.test(value))
39562
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
39563
- : (reIsBadHex.test(value) ? NAN : +value);
39564
- }
39565
-
39566
- var lodash_debounce = debounce;
39567
-
39568
- const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
39569
-
39570
- function useUnmount(func) {
39571
- const funcRef = K.useRef(func);
39572
- funcRef.current = func;
39573
- K.useEffect(
39574
- () => () => {
39575
- funcRef.current();
39576
- },
39577
- []
39578
- );
39579
- }
39580
-
39581
- // src/useDebounceCallback/useDebounceCallback.ts
39582
- function useDebounceCallback(func, delay = 500, options) {
39583
- const debouncedFunc = K.useRef();
39584
- useUnmount(() => {
39585
- if (debouncedFunc.current) {
39586
- debouncedFunc.current.cancel();
39587
- }
39588
- });
39589
- const debounced = K.useMemo(() => {
39590
- const debouncedFuncInstance = debounce$1(func, delay, options);
39591
- const wrappedFunc = (...args) => {
39592
- return debouncedFuncInstance(...args);
39593
- };
39594
- wrappedFunc.cancel = () => {
39595
- debouncedFuncInstance.cancel();
39596
- };
39597
- wrappedFunc.isPending = () => {
39598
- return !!debouncedFunc.current;
39599
- };
39600
- wrappedFunc.flush = () => {
39601
- return debouncedFuncInstance.flush();
39602
- };
39603
- return wrappedFunc;
39604
- }, [func, delay, options]);
39605
- K.useEffect(() => {
39606
- debouncedFunc.current = debounce$1(func, delay, options);
39607
- }, [func, delay, options]);
39608
- return debounced;
39609
- }
39610
-
39611
- function floorToDecimal(num, decimalPlaces) {
39612
- const factor = 10 ** decimalPlaces;
39613
- return Math.floor(num * factor) / factor;
39614
- }
39615
- const parseQuotaValue = (key, val) => {
39616
- let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
39617
- if (key === "cpu") {
39618
- if (val.endsWith("m")) {
39619
- numericValue /= 1e3;
39620
- }
39621
- return floorToDecimal(numericValue, 1);
39622
- }
39623
- if (val.endsWith("m")) {
39624
- numericValue /= 1e3;
39625
- } else if (val.endsWith("k")) {
39626
- numericValue /= 1e6;
39627
- } else if (val.endsWith("M")) {
39628
- numericValue /= 1e3;
39629
- } else if (val.endsWith("G")) {
39630
- numericValue /= 1;
39631
- } else if (val.endsWith("T")) {
39632
- numericValue *= 1e3;
39633
- } else if (val.endsWith("Ki")) {
39634
- numericValue /= 1024;
39635
- numericValue /= 1e6;
39636
- } else if (val.endsWith("Mi")) {
39637
- numericValue /= 1e3;
39638
- numericValue /= 1e3;
39639
- } else if (/^\d+(\.\d+)?$/.test(val)) {
39640
- numericValue /= 1e9;
39641
- } else {
39642
- throw new Error("Invalid value");
39643
- }
39644
- return floorToDecimal(numericValue, 1);
39645
- };
39646
- const parseQuotaValueCpu = (val) => {
39647
- if (typeof val === "string") {
39648
- let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
39649
- if (val.endsWith("m")) {
39650
- numericValue /= 1e3;
39651
- }
39652
- return floorToDecimal(numericValue, 1);
39653
- }
39654
- return 0;
39655
- };
39656
- const parseQuotaValueMemoryAndStorage = (val) => {
39657
- if (typeof val === "string") {
39658
- let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
39659
- if (val.endsWith("k")) {
39660
- numericValue /= 1e6;
39661
- } else if (val.endsWith("m")) {
39662
- numericValue /= 1e3;
39663
- } else if (val.endsWith("M")) {
39664
- numericValue /= 1e3;
39665
- } else if (val.endsWith("G")) {
39666
- numericValue /= 1;
39667
- } else if (val.endsWith("T")) {
39668
- numericValue *= 1e3;
39669
- } else if (val.endsWith("P")) {
39670
- numericValue *= 1e6;
39671
- } else if (val.endsWith("E")) {
39672
- numericValue *= 1e9;
39673
- } else if (val.endsWith("Ki")) {
39674
- numericValue *= 1024 / 1e9;
39675
- } else if (val.endsWith("Mi")) {
39676
- numericValue /= 1048.576;
39677
- } else if (val.endsWith("Gi")) {
39678
- numericValue *= 1.073741824;
39679
- } else if (val.endsWith("Ti")) {
39680
- numericValue *= 1.099511628;
39681
- } else if (val.endsWith("Pi")) {
39682
- numericValue *= 1.125899907;
39683
- } else if (val.endsWith("Ei")) {
39684
- numericValue *= 1.152921505;
39685
- } else if (val === "0") {
39686
- return 0;
39687
- } else {
39688
- throw new Error("Invalid value");
39689
- }
39690
- return floorToDecimal(numericValue, 1);
39691
- }
39692
- return 0;
39693
- };
39694
-
39695
- const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
39696
- let paths = [];
39697
- if (typeof obj !== "object" || obj === null) {
39698
- return paths;
39699
- }
39700
- if (obj[targetKey] === targetValue) {
39701
- paths.push([...currentPath]);
39702
- }
39703
- for (const key in obj) {
39704
- if (obj.hasOwnProperty(key)) {
39705
- const value = obj[key];
39706
- if (typeof value === "object" && value !== null) {
39707
- const newPath = [...currentPath, key];
39708
- const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
39709
- paths = paths.concat(subPaths);
39710
- }
39711
- }
39712
- }
39713
- return paths;
39714
- };
39715
- const normalizeValuesForQuotasToNumber = (object, properties) => {
39716
- const newObject = _$1.cloneDeep(object);
39717
- const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
39718
- const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
39719
- memoryPaths.forEach((path) => {
39720
- const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
39721
- const value = _$1.get(newObject, cleanPath);
39722
- if (value || value === 0) {
39723
- _$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
39724
- }
39725
- });
39726
- cpuPaths.forEach((path) => {
39727
- const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
39728
- const value = _$1.get(newObject, cleanPath);
39729
- if (value || value === 0) {
39730
- _$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
39731
- }
39732
- });
39733
- return newObject;
39734
- };
39735
-
39736
- const getAllPathsFromObj = (obj, prefix = []) => {
39737
- const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
39738
- return entries.flatMap(([key, value]) => {
39739
- const currentPath = [...prefix, key];
39740
- return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
39741
- });
39742
- };
39743
-
39744
- const getPrefixSubarrays = (arr) => {
39745
- return arr.map((_, index) => arr.slice(0, index + 1));
39746
- };
39747
-
39748
- const deepMerge = (a, b) => {
39749
- const result = { ...a };
39750
- for (const key of Object.keys(b)) {
39751
- const aVal = a[key];
39752
- const bVal = b[key];
39753
- if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
39754
- result[key] = deepMerge(aVal, bVal);
39755
- } else {
39756
- result[key] = bVal;
39757
- }
39758
- }
39759
- return result;
39760
- };
39761
-
39762
- function _defineProperty$1(obj, key, value) {
39763
- if (key in obj) {
39764
- Object.defineProperty(obj, key, {
39765
- value: value,
39766
- enumerable: true,
39767
- configurable: true,
39768
- writable: true
39769
- });
39770
- } else {
39771
- obj[key] = value;
39772
- }
39773
-
39774
- return obj;
39775
- }
39776
-
39777
- function ownKeys$1(object, enumerableOnly) {
39778
- var keys = Object.keys(object);
39779
-
39780
- if (Object.getOwnPropertySymbols) {
39781
- var symbols = Object.getOwnPropertySymbols(object);
39782
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
39783
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
39784
- });
39785
- keys.push.apply(keys, symbols);
39786
- }
39787
-
39788
- return keys;
39789
- }
39790
-
39791
- function _objectSpread2$1(target) {
39792
- for (var i = 1; i < arguments.length; i++) {
39793
- var source = arguments[i] != null ? arguments[i] : {};
39794
-
39795
- if (i % 2) {
39796
- ownKeys$1(Object(source), true).forEach(function (key) {
39797
- _defineProperty$1(target, key, source[key]);
39798
- });
39799
- } else if (Object.getOwnPropertyDescriptors) {
39800
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
39801
- } else {
39802
- ownKeys$1(Object(source)).forEach(function (key) {
39803
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39804
- });
39805
- }
39806
- }
39807
-
39808
- return target;
39809
- }
39810
-
39811
- function _objectWithoutPropertiesLoose(source, excluded) {
39812
- if (source == null) return {};
39813
- var target = {};
39814
- var sourceKeys = Object.keys(source);
39815
- var key, i;
39816
-
39817
- for (i = 0; i < sourceKeys.length; i++) {
39818
- key = sourceKeys[i];
39819
- if (excluded.indexOf(key) >= 0) continue;
39820
- target[key] = source[key];
39821
- }
39822
-
39823
- return target;
39824
- }
39825
-
39826
- function _objectWithoutProperties(source, excluded) {
39827
- if (source == null) return {};
39828
-
39829
- var target = _objectWithoutPropertiesLoose(source, excluded);
39830
-
39831
- var key, i;
39832
-
39833
- if (Object.getOwnPropertySymbols) {
39834
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
39835
-
39836
- for (i = 0; i < sourceSymbolKeys.length; i++) {
39837
- key = sourceSymbolKeys[i];
39838
- if (excluded.indexOf(key) >= 0) continue;
39839
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
39840
- target[key] = source[key];
39841
- }
39842
- }
39843
-
39844
- return target;
39845
- }
39846
-
39847
- function _slicedToArray(arr, i) {
39848
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
39849
- }
39850
-
39851
- function _arrayWithHoles(arr) {
39852
- if (Array.isArray(arr)) return arr;
39853
- }
39854
-
39855
- function _iterableToArrayLimit(arr, i) {
39856
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
39857
- var _arr = [];
39858
- var _n = true;
39859
- var _d = false;
39860
- var _e = undefined;
39861
-
39862
- try {
39863
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
39864
- _arr.push(_s.value);
39865
-
39866
- if (i && _arr.length === i) break;
39867
- }
39868
- } catch (err) {
39869
- _d = true;
39870
- _e = err;
39871
- } finally {
39872
- try {
39873
- if (!_n && _i["return"] != null) _i["return"]();
39874
- } finally {
39875
- if (_d) throw _e;
39876
- }
39877
- }
39878
-
39879
- return _arr;
39880
- }
39881
-
39882
- function _unsupportedIterableToArray(o, minLen) {
39883
- if (!o) return;
39884
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
39885
- var n = Object.prototype.toString.call(o).slice(8, -1);
39886
- if (n === "Object" && o.constructor) n = o.constructor.name;
39887
- if (n === "Map" || n === "Set") return Array.from(o);
39888
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
39889
- }
39890
-
39891
- function _arrayLikeToArray(arr, len) {
39892
- if (len == null || len > arr.length) len = arr.length;
39893
-
39894
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
39895
-
39896
- return arr2;
39897
- }
39898
-
39899
- function _nonIterableRest() {
39900
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
39901
- }
39902
-
39903
- function _defineProperty(obj, key, value) {
39904
- if (key in obj) {
39905
- Object.defineProperty(obj, key, {
39906
- value: value,
39907
- enumerable: true,
39908
- configurable: true,
39909
- writable: true
39910
- });
39911
- } else {
39912
- obj[key] = value;
39913
- }
39914
-
39915
- return obj;
39916
- }
39917
-
39918
- function ownKeys(object, enumerableOnly) {
39919
- var keys = Object.keys(object);
39920
-
39921
- if (Object.getOwnPropertySymbols) {
39922
- var symbols = Object.getOwnPropertySymbols(object);
39923
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
39924
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
39925
- });
39926
- keys.push.apply(keys, symbols);
39927
- }
39928
-
39929
- return keys;
39930
- }
39931
-
39932
- function _objectSpread2(target) {
39933
- for (var i = 1; i < arguments.length; i++) {
39934
- var source = arguments[i] != null ? arguments[i] : {};
39935
-
39936
- if (i % 2) {
39937
- ownKeys(Object(source), true).forEach(function (key) {
39938
- _defineProperty(target, key, source[key]);
39939
- });
39940
- } else if (Object.getOwnPropertyDescriptors) {
39941
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
39942
- } else {
39943
- ownKeys(Object(source)).forEach(function (key) {
39944
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39945
- });
39946
- }
39947
- }
39948
-
39949
- return target;
39950
- }
39951
-
39952
- function compose$1() {
39953
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
39954
- fns[_key] = arguments[_key];
39955
- }
39956
-
39957
- return function (x) {
39958
- return fns.reduceRight(function (y, f) {
39959
- return f(y);
39960
- }, x);
39961
- };
39962
- }
39963
-
39964
- function curry$1(fn) {
39965
- return function curried() {
39966
- var _this = this;
39967
-
39968
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
39969
- args[_key2] = arguments[_key2];
39970
- }
39971
-
39972
- return args.length >= fn.length ? fn.apply(this, args) : function () {
39973
- for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
39974
- nextArgs[_key3] = arguments[_key3];
39975
- }
39976
-
39977
- return curried.apply(_this, [].concat(args, nextArgs));
39978
- };
39979
- };
39980
- }
39981
-
39982
- function isObject$1(value) {
39983
- return {}.toString.call(value).includes('Object');
39984
- }
39985
-
39986
- function isEmpty$1(obj) {
39987
- return !Object.keys(obj).length;
39988
- }
39989
-
39990
- function isFunction(value) {
39991
- return typeof value === 'function';
39881
+ function isFunction(value) {
39882
+ return typeof value === 'function';
39992
39883
  }
39993
39884
 
39994
39885
  function hasOwnProperty(object, property) {
@@ -39996,7 +39887,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39996
39887
  }
39997
39888
 
39998
39889
  function validateChanges(initial, changes) {
39999
- if (!isObject$1(changes)) errorHandler$1('changeType');
39890
+ if (!isObject$2(changes)) errorHandler$1('changeType');
40000
39891
  if (Object.keys(changes).some(function (field) {
40001
39892
  return !hasOwnProperty(initial, field);
40002
39893
  })) errorHandler$1('changeField');
@@ -40008,15 +39899,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
40008
39899
  }
40009
39900
 
40010
39901
  function validateHandler(handler) {
40011
- if (!(isFunction(handler) || isObject$1(handler))) errorHandler$1('handlerType');
40012
- if (isObject$1(handler) && Object.values(handler).some(function (_handler) {
39902
+ if (!(isFunction(handler) || isObject$2(handler))) errorHandler$1('handlerType');
39903
+ if (isObject$2(handler) && Object.values(handler).some(function (_handler) {
40013
39904
  return !isFunction(_handler);
40014
39905
  })) errorHandler$1('handlersType');
40015
39906
  }
40016
39907
 
40017
39908
  function validateInitial(initial) {
40018
39909
  if (!initial) errorHandler$1('initialIsRequired');
40019
- if (!isObject$1(initial)) errorHandler$1('initialType');
39910
+ if (!isObject$2(initial)) errorHandler$1('initialType');
40020
39911
  if (isEmpty$1(initial)) errorHandler$1('initialContent');
40021
39912
  }
40022
39913
 
@@ -40116,7 +40007,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
40116
40007
  };
40117
40008
  }
40118
40009
 
40119
- function isObject(value) {
40010
+ function isObject$1(value) {
40120
40011
  return {}.toString.call(value).includes('Object');
40121
40012
  }
40122
40013
 
@@ -40128,7 +40019,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
40128
40019
 
40129
40020
  function validateConfig(config) {
40130
40021
  if (!config) errorHandler('configIsRequired');
40131
- if (!isObject(config)) errorHandler('configType');
40022
+ if (!isObject$1(config)) errorHandler('configType');
40132
40023
 
40133
40024
  if (config.urls) {
40134
40025
  informAboutDeprecation();
@@ -47199,71 +47090,832 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47199
47090
  }
47200
47091
  }
47201
47092
 
47202
- function parseOptions(options) {
47203
- const prettyErrors = options.prettyErrors !== false;
47204
- const lineCounter = options.lineCounter || (prettyErrors && new LineCounter()) || null;
47205
- return { lineCounter, prettyErrors };
47093
+ function parseOptions(options) {
47094
+ const prettyErrors = options.prettyErrors !== false;
47095
+ const lineCounter = options.lineCounter || (prettyErrors && new LineCounter()) || null;
47096
+ return { lineCounter, prettyErrors };
47097
+ }
47098
+ /** Parse an input string into a single YAML.Document */
47099
+ function parseDocument(source, options = {}) {
47100
+ const { lineCounter, prettyErrors } = parseOptions(options);
47101
+ const parser = new Parser(lineCounter?.addNewLine);
47102
+ const composer = new Composer(options);
47103
+ // `doc` is always set by compose.end(true) at the very latest
47104
+ let doc = null;
47105
+ for (const _doc of composer.compose(parser.parse(source), true, source.length)) {
47106
+ if (!doc)
47107
+ doc = _doc;
47108
+ else if (doc.options.logLevel !== 'silent') {
47109
+ doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));
47110
+ break;
47111
+ }
47112
+ }
47113
+ if (prettyErrors && lineCounter) {
47114
+ doc.errors.forEach(prettifyError(source, lineCounter));
47115
+ doc.warnings.forEach(prettifyError(source, lineCounter));
47116
+ }
47117
+ return doc;
47118
+ }
47119
+ function parse(src, reviver, options) {
47120
+ let _reviver = undefined;
47121
+ const doc = parseDocument(src, options);
47122
+ if (!doc)
47123
+ return null;
47124
+ doc.warnings.forEach(warning => warn(doc.options.logLevel, warning));
47125
+ if (doc.errors.length > 0) {
47126
+ if (doc.options.logLevel !== 'silent')
47127
+ throw doc.errors[0];
47128
+ else
47129
+ doc.errors = [];
47130
+ }
47131
+ return doc.toJS(Object.assign({ reviver: _reviver }, options));
47132
+ }
47133
+ function stringify(value, replacer, options) {
47134
+ let _replacer = null;
47135
+ if (typeof replacer === 'function' || Array.isArray(replacer)) {
47136
+ _replacer = replacer;
47137
+ }
47138
+ else if (options === undefined && replacer) {
47139
+ options = replacer;
47140
+ }
47141
+ if (typeof options === 'string')
47142
+ options = options.length;
47143
+ if (typeof options === 'number') {
47144
+ const indent = Math.round(options);
47145
+ options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
47146
+ }
47147
+ if (value === undefined) {
47148
+ const { keepUndefined } = options ?? replacer ?? {};
47149
+ if (!keepUndefined)
47150
+ return undefined;
47151
+ }
47152
+ if (isDocument(value) && !_replacer)
47153
+ return value.toString(options);
47154
+ return new Document$1(value, _replacer, options).toString(options);
47155
+ }
47156
+
47157
+ const BorderRadiusContainer$1 = styled.div`
47158
+ height: ${({ $designNewLayoutHeight }) => $designNewLayoutHeight ? `${$designNewLayoutHeight}px` : "75vh"};
47159
+ border: 1px solid ${({ $colorBorder }) => $colorBorder};
47160
+ border-radius: 8px;
47161
+ padding: 2px;
47162
+ box-sizing: border-box;
47163
+
47164
+ .monaco-editor,
47165
+ .overflow-guard {
47166
+ border-radius: 8px;
47167
+ }
47168
+ `;
47169
+ const ControlsRowContainer$1 = styled.div`
47170
+ margin-top: 10px;
47171
+ display: flex;
47172
+ align-items: center;
47173
+ background-color: ${({ $bgColor, $designNewLayout }) => $designNewLayout ? $bgColor : "initial"};
47174
+ border-radius: 8px;
47175
+ padding: 4px;
47176
+ `;
47177
+ const BigText$1 = styled.div`
47178
+ font-size: 16px;
47179
+ line-height: 24px;
47180
+ `;
47181
+ const Styled$k = {
47182
+ BorderRadiusContainer: BorderRadiusContainer$1,
47183
+ ControlsRowContainer: ControlsRowContainer$1,
47184
+ BigText: BigText$1
47185
+ };
47186
+
47187
+ const NOTIFICATION_KEY = "yaml-data-changed";
47188
+ const YamlEditorSingleton = ({
47189
+ theme,
47190
+ cluster,
47191
+ prefillValuesSchema,
47192
+ isNameSpaced,
47193
+ isCreate,
47194
+ type,
47195
+ apiGroupApiVersion,
47196
+ plural,
47197
+ backlink,
47198
+ designNewLayout,
47199
+ designNewLayoutHeight,
47200
+ openNotification,
47201
+ readOnly = false
47202
+ }) => {
47203
+ const { token } = antd.theme.useToken();
47204
+ const navigate = reactRouterDom.useNavigate();
47205
+ const [api, contextHolder] = antd.notification.useNotification();
47206
+ const [yamlData, setYamlData] = K.useState("");
47207
+ const [isLoading, setIsLoading] = K.useState(false);
47208
+ const [error, setError] = K.useState();
47209
+ const initialPrefillYamlRef = K.useRef(null);
47210
+ const latestPrefillYamlRef = K.useRef(null);
47211
+ const firstLoadRef = K.useRef(true);
47212
+ const handleReload = K.useCallback(() => {
47213
+ api.destroy(NOTIFICATION_KEY);
47214
+ const nextYaml = latestPrefillYamlRef.current ?? initialPrefillYamlRef.current;
47215
+ if (nextYaml !== null) {
47216
+ setYamlData(nextYaml);
47217
+ }
47218
+ }, [api]);
47219
+ const openNotificationYamlChanged = K.useCallback(() => {
47220
+ const btn = /* @__PURE__ */ jsxRuntimeExports.jsx(
47221
+ antd.Button,
47222
+ {
47223
+ type: "primary",
47224
+ size: "small",
47225
+ onClick: () => {
47226
+ handleReload();
47227
+ },
47228
+ children: "Reload"
47229
+ }
47230
+ );
47231
+ api.info({
47232
+ key: NOTIFICATION_KEY,
47233
+ message: "Data changed",
47234
+ description: "The source data has been updated. Reload to apply the latest changes (will discard your edits).",
47235
+ btn,
47236
+ placement: "bottomRight",
47237
+ duration: 30
47238
+ });
47239
+ }, [api, handleReload]);
47240
+ K.useEffect(() => {
47241
+ if (prefillValuesSchema === void 0) return;
47242
+ const nextYaml = stringify(prefillValuesSchema);
47243
+ if (firstLoadRef.current) {
47244
+ initialPrefillYamlRef.current = nextYaml;
47245
+ latestPrefillYamlRef.current = nextYaml;
47246
+ setYamlData(nextYaml);
47247
+ firstLoadRef.current = false;
47248
+ return;
47249
+ }
47250
+ if (nextYaml !== latestPrefillYamlRef.current) {
47251
+ openNotificationYamlChanged();
47252
+ }
47253
+ latestPrefillYamlRef.current = nextYaml;
47254
+ }, [prefillValuesSchema, openNotificationYamlChanged]);
47255
+ const onSubmit = () => {
47256
+ setIsLoading(true);
47257
+ setError(void 0);
47258
+ const currentValues = parse(yamlData);
47259
+ const { namespace } = currentValues.metadata;
47260
+ const { name } = currentValues.metadata;
47261
+ const body = currentValues;
47262
+ const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${plural}/${isCreate ? "" : name}`;
47263
+ if (isCreate) {
47264
+ createNewEntry({ endpoint, body }).then((res) => {
47265
+ console.log(res);
47266
+ if (backlink) {
47267
+ navigate(backlink);
47268
+ }
47269
+ setIsLoading(false);
47270
+ if (openNotification) {
47271
+ api.success({
47272
+ message: "Created successfully",
47273
+ description: "Entry was created",
47274
+ placement: "topRight"
47275
+ });
47276
+ }
47277
+ }).catch((error2) => {
47278
+ console.log("Form submit error", error2);
47279
+ setIsLoading(false);
47280
+ setError(error2);
47281
+ });
47282
+ } else {
47283
+ updateEntry({ endpoint, body }).then((res) => {
47284
+ console.log(res);
47285
+ if (backlink) {
47286
+ navigate(backlink);
47287
+ }
47288
+ setIsLoading(false);
47289
+ if (openNotification) {
47290
+ api.success({
47291
+ message: "Updated successfully",
47292
+ description: "Entry was updated",
47293
+ placement: "bottomRight"
47294
+ });
47295
+ }
47296
+ }).catch((error2) => {
47297
+ console.log("Form submit error", error2);
47298
+ setIsLoading(false);
47299
+ setError(error2);
47300
+ });
47301
+ }
47302
+ };
47303
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
47304
+ contextHolder,
47305
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $designNewLayoutHeight: designNewLayoutHeight, $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47306
+ Ft,
47307
+ {
47308
+ defaultLanguage: "yaml",
47309
+ width: "100%",
47310
+ height: designNewLayoutHeight || "75vh",
47311
+ value: yamlData,
47312
+ onChange: (value) => {
47313
+ if (!readOnly) {
47314
+ setYamlData(value || "");
47315
+ }
47316
+ },
47317
+ theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
47318
+ options: {
47319
+ theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
47320
+ readOnly
47321
+ }
47322
+ }
47323
+ ) }),
47324
+ !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.ControlsRowContainer, { $bgColor: token.colorPrimaryBg, $designNewLayout: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: designNewLayout ? 10 : 16, align: "center", children: [
47325
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
47326
+ backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: () => navigate(backlink), children: "Cancel" }),
47327
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: handleReload, children: "Reload" })
47328
+ ] }) }),
47329
+ error && /* @__PURE__ */ jsxRuntimeExports.jsxs(
47330
+ antd.Modal,
47331
+ {
47332
+ open: !!error,
47333
+ onOk: () => setError(void 0),
47334
+ onCancel: () => setError(void 0),
47335
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BigText, { children: "Error!" }) }),
47336
+ cancelButtonProps: { style: { display: "none" } },
47337
+ children: [
47338
+ "An error has occurred: ",
47339
+ error?.response?.data?.message
47340
+ ]
47341
+ }
47342
+ )
47343
+ ] });
47344
+ };
47345
+
47346
+ /**
47347
+ * lodash (Custom Build) <https://lodash.com/>
47348
+ * Build: `lodash modularize exports="npm" -o ./`
47349
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
47350
+ * Released under MIT license <https://lodash.com/license>
47351
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
47352
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
47353
+ */
47354
+
47355
+ /** Used as the `TypeError` message for "Functions" methods. */
47356
+ var FUNC_ERROR_TEXT = 'Expected a function';
47357
+
47358
+ /** Used as references for various `Number` constants. */
47359
+ var NAN = 0 / 0;
47360
+
47361
+ /** `Object#toString` result references. */
47362
+ var symbolTag = '[object Symbol]';
47363
+
47364
+ /** Used to match leading and trailing whitespace. */
47365
+ var reTrim = /^\s+|\s+$/g;
47366
+
47367
+ /** Used to detect bad signed hexadecimal string values. */
47368
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
47369
+
47370
+ /** Used to detect binary string values. */
47371
+ var reIsBinary = /^0b[01]+$/i;
47372
+
47373
+ /** Used to detect octal string values. */
47374
+ var reIsOctal = /^0o[0-7]+$/i;
47375
+
47376
+ /** Built-in method references without a dependency on `root`. */
47377
+ var freeParseInt = parseInt;
47378
+
47379
+ /** Detect free variable `global` from Node.js. */
47380
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
47381
+
47382
+ /** Detect free variable `self`. */
47383
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
47384
+
47385
+ /** Used as a reference to the global object. */
47386
+ var root = freeGlobal || freeSelf || Function('return this')();
47387
+
47388
+ /** Used for built-in method references. */
47389
+ var objectProto = Object.prototype;
47390
+
47391
+ /**
47392
+ * Used to resolve the
47393
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
47394
+ * of values.
47395
+ */
47396
+ var objectToString = objectProto.toString;
47397
+
47398
+ /* Built-in method references for those with the same name as other `lodash` methods. */
47399
+ var nativeMax = Math.max,
47400
+ nativeMin = Math.min;
47401
+
47402
+ /**
47403
+ * Gets the timestamp of the number of milliseconds that have elapsed since
47404
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
47405
+ *
47406
+ * @static
47407
+ * @memberOf _
47408
+ * @since 2.4.0
47409
+ * @category Date
47410
+ * @returns {number} Returns the timestamp.
47411
+ * @example
47412
+ *
47413
+ * _.defer(function(stamp) {
47414
+ * console.log(_.now() - stamp);
47415
+ * }, _.now());
47416
+ * // => Logs the number of milliseconds it took for the deferred invocation.
47417
+ */
47418
+ var now = function() {
47419
+ return root.Date.now();
47420
+ };
47421
+
47422
+ /**
47423
+ * Creates a debounced function that delays invoking `func` until after `wait`
47424
+ * milliseconds have elapsed since the last time the debounced function was
47425
+ * invoked. The debounced function comes with a `cancel` method to cancel
47426
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
47427
+ * Provide `options` to indicate whether `func` should be invoked on the
47428
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
47429
+ * with the last arguments provided to the debounced function. Subsequent
47430
+ * calls to the debounced function return the result of the last `func`
47431
+ * invocation.
47432
+ *
47433
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
47434
+ * invoked on the trailing edge of the timeout only if the debounced function
47435
+ * is invoked more than once during the `wait` timeout.
47436
+ *
47437
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
47438
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
47439
+ *
47440
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
47441
+ * for details over the differences between `_.debounce` and `_.throttle`.
47442
+ *
47443
+ * @static
47444
+ * @memberOf _
47445
+ * @since 0.1.0
47446
+ * @category Function
47447
+ * @param {Function} func The function to debounce.
47448
+ * @param {number} [wait=0] The number of milliseconds to delay.
47449
+ * @param {Object} [options={}] The options object.
47450
+ * @param {boolean} [options.leading=false]
47451
+ * Specify invoking on the leading edge of the timeout.
47452
+ * @param {number} [options.maxWait]
47453
+ * The maximum time `func` is allowed to be delayed before it's invoked.
47454
+ * @param {boolean} [options.trailing=true]
47455
+ * Specify invoking on the trailing edge of the timeout.
47456
+ * @returns {Function} Returns the new debounced function.
47457
+ * @example
47458
+ *
47459
+ * // Avoid costly calculations while the window size is in flux.
47460
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
47461
+ *
47462
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
47463
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
47464
+ * 'leading': true,
47465
+ * 'trailing': false
47466
+ * }));
47467
+ *
47468
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
47469
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
47470
+ * var source = new EventSource('/stream');
47471
+ * jQuery(source).on('message', debounced);
47472
+ *
47473
+ * // Cancel the trailing debounced invocation.
47474
+ * jQuery(window).on('popstate', debounced.cancel);
47475
+ */
47476
+ function debounce(func, wait, options) {
47477
+ var lastArgs,
47478
+ lastThis,
47479
+ maxWait,
47480
+ result,
47481
+ timerId,
47482
+ lastCallTime,
47483
+ lastInvokeTime = 0,
47484
+ leading = false,
47485
+ maxing = false,
47486
+ trailing = true;
47487
+
47488
+ if (typeof func != 'function') {
47489
+ throw new TypeError(FUNC_ERROR_TEXT);
47490
+ }
47491
+ wait = toNumber(wait) || 0;
47492
+ if (isObject(options)) {
47493
+ leading = !!options.leading;
47494
+ maxing = 'maxWait' in options;
47495
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
47496
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
47497
+ }
47498
+
47499
+ function invokeFunc(time) {
47500
+ var args = lastArgs,
47501
+ thisArg = lastThis;
47502
+
47503
+ lastArgs = lastThis = undefined;
47504
+ lastInvokeTime = time;
47505
+ result = func.apply(thisArg, args);
47506
+ return result;
47507
+ }
47508
+
47509
+ function leadingEdge(time) {
47510
+ // Reset any `maxWait` timer.
47511
+ lastInvokeTime = time;
47512
+ // Start the timer for the trailing edge.
47513
+ timerId = setTimeout(timerExpired, wait);
47514
+ // Invoke the leading edge.
47515
+ return leading ? invokeFunc(time) : result;
47516
+ }
47517
+
47518
+ function remainingWait(time) {
47519
+ var timeSinceLastCall = time - lastCallTime,
47520
+ timeSinceLastInvoke = time - lastInvokeTime,
47521
+ result = wait - timeSinceLastCall;
47522
+
47523
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
47524
+ }
47525
+
47526
+ function shouldInvoke(time) {
47527
+ var timeSinceLastCall = time - lastCallTime,
47528
+ timeSinceLastInvoke = time - lastInvokeTime;
47529
+
47530
+ // Either this is the first call, activity has stopped and we're at the
47531
+ // trailing edge, the system time has gone backwards and we're treating
47532
+ // it as the trailing edge, or we've hit the `maxWait` limit.
47533
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
47534
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
47535
+ }
47536
+
47537
+ function timerExpired() {
47538
+ var time = now();
47539
+ if (shouldInvoke(time)) {
47540
+ return trailingEdge(time);
47541
+ }
47542
+ // Restart the timer.
47543
+ timerId = setTimeout(timerExpired, remainingWait(time));
47544
+ }
47545
+
47546
+ function trailingEdge(time) {
47547
+ timerId = undefined;
47548
+
47549
+ // Only invoke if we have `lastArgs` which means `func` has been
47550
+ // debounced at least once.
47551
+ if (trailing && lastArgs) {
47552
+ return invokeFunc(time);
47553
+ }
47554
+ lastArgs = lastThis = undefined;
47555
+ return result;
47556
+ }
47557
+
47558
+ function cancel() {
47559
+ if (timerId !== undefined) {
47560
+ clearTimeout(timerId);
47561
+ }
47562
+ lastInvokeTime = 0;
47563
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
47564
+ }
47565
+
47566
+ function flush() {
47567
+ return timerId === undefined ? result : trailingEdge(now());
47568
+ }
47569
+
47570
+ function debounced() {
47571
+ var time = now(),
47572
+ isInvoking = shouldInvoke(time);
47573
+
47574
+ lastArgs = arguments;
47575
+ lastThis = this;
47576
+ lastCallTime = time;
47577
+
47578
+ if (isInvoking) {
47579
+ if (timerId === undefined) {
47580
+ return leadingEdge(lastCallTime);
47581
+ }
47582
+ if (maxing) {
47583
+ // Handle invocations in a tight loop.
47584
+ timerId = setTimeout(timerExpired, wait);
47585
+ return invokeFunc(lastCallTime);
47586
+ }
47587
+ }
47588
+ if (timerId === undefined) {
47589
+ timerId = setTimeout(timerExpired, wait);
47590
+ }
47591
+ return result;
47592
+ }
47593
+ debounced.cancel = cancel;
47594
+ debounced.flush = flush;
47595
+ return debounced;
47596
+ }
47597
+
47598
+ /**
47599
+ * Checks if `value` is the
47600
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
47601
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
47602
+ *
47603
+ * @static
47604
+ * @memberOf _
47605
+ * @since 0.1.0
47606
+ * @category Lang
47607
+ * @param {*} value The value to check.
47608
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
47609
+ * @example
47610
+ *
47611
+ * _.isObject({});
47612
+ * // => true
47613
+ *
47614
+ * _.isObject([1, 2, 3]);
47615
+ * // => true
47616
+ *
47617
+ * _.isObject(_.noop);
47618
+ * // => true
47619
+ *
47620
+ * _.isObject(null);
47621
+ * // => false
47622
+ */
47623
+ function isObject(value) {
47624
+ var type = typeof value;
47625
+ return !!value && (type == 'object' || type == 'function');
47626
+ }
47627
+
47628
+ /**
47629
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
47630
+ * and has a `typeof` result of "object".
47631
+ *
47632
+ * @static
47633
+ * @memberOf _
47634
+ * @since 4.0.0
47635
+ * @category Lang
47636
+ * @param {*} value The value to check.
47637
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
47638
+ * @example
47639
+ *
47640
+ * _.isObjectLike({});
47641
+ * // => true
47642
+ *
47643
+ * _.isObjectLike([1, 2, 3]);
47644
+ * // => true
47645
+ *
47646
+ * _.isObjectLike(_.noop);
47647
+ * // => false
47648
+ *
47649
+ * _.isObjectLike(null);
47650
+ * // => false
47651
+ */
47652
+ function isObjectLike(value) {
47653
+ return !!value && typeof value == 'object';
47654
+ }
47655
+
47656
+ /**
47657
+ * Checks if `value` is classified as a `Symbol` primitive or object.
47658
+ *
47659
+ * @static
47660
+ * @memberOf _
47661
+ * @since 4.0.0
47662
+ * @category Lang
47663
+ * @param {*} value The value to check.
47664
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
47665
+ * @example
47666
+ *
47667
+ * _.isSymbol(Symbol.iterator);
47668
+ * // => true
47669
+ *
47670
+ * _.isSymbol('abc');
47671
+ * // => false
47672
+ */
47673
+ function isSymbol(value) {
47674
+ return typeof value == 'symbol' ||
47675
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
47676
+ }
47677
+
47678
+ /**
47679
+ * Converts `value` to a number.
47680
+ *
47681
+ * @static
47682
+ * @memberOf _
47683
+ * @since 4.0.0
47684
+ * @category Lang
47685
+ * @param {*} value The value to process.
47686
+ * @returns {number} Returns the number.
47687
+ * @example
47688
+ *
47689
+ * _.toNumber(3.2);
47690
+ * // => 3.2
47691
+ *
47692
+ * _.toNumber(Number.MIN_VALUE);
47693
+ * // => 5e-324
47694
+ *
47695
+ * _.toNumber(Infinity);
47696
+ * // => Infinity
47697
+ *
47698
+ * _.toNumber('3.2');
47699
+ * // => 3.2
47700
+ */
47701
+ function toNumber(value) {
47702
+ if (typeof value == 'number') {
47703
+ return value;
47704
+ }
47705
+ if (isSymbol(value)) {
47706
+ return NAN;
47707
+ }
47708
+ if (isObject(value)) {
47709
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
47710
+ value = isObject(other) ? (other + '') : other;
47711
+ }
47712
+ if (typeof value != 'string') {
47713
+ return value === 0 ? value : +value;
47714
+ }
47715
+ value = value.replace(reTrim, '');
47716
+ var isBinary = reIsBinary.test(value);
47717
+ return (isBinary || reIsOctal.test(value))
47718
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
47719
+ : (reIsBadHex.test(value) ? NAN : +value);
47720
+ }
47721
+
47722
+ var lodash_debounce = debounce;
47723
+
47724
+ const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
47725
+
47726
+ function useUnmount(func) {
47727
+ const funcRef = K.useRef(func);
47728
+ funcRef.current = func;
47729
+ K.useEffect(
47730
+ () => () => {
47731
+ funcRef.current();
47732
+ },
47733
+ []
47734
+ );
47735
+ }
47736
+
47737
+ // src/useDebounceCallback/useDebounceCallback.ts
47738
+ function useDebounceCallback(func, delay = 500, options) {
47739
+ const debouncedFunc = K.useRef();
47740
+ useUnmount(() => {
47741
+ if (debouncedFunc.current) {
47742
+ debouncedFunc.current.cancel();
47743
+ }
47744
+ });
47745
+ const debounced = K.useMemo(() => {
47746
+ const debouncedFuncInstance = debounce$1(func, delay, options);
47747
+ const wrappedFunc = (...args) => {
47748
+ return debouncedFuncInstance(...args);
47749
+ };
47750
+ wrappedFunc.cancel = () => {
47751
+ debouncedFuncInstance.cancel();
47752
+ };
47753
+ wrappedFunc.isPending = () => {
47754
+ return !!debouncedFunc.current;
47755
+ };
47756
+ wrappedFunc.flush = () => {
47757
+ return debouncedFuncInstance.flush();
47758
+ };
47759
+ return wrappedFunc;
47760
+ }, [func, delay, options]);
47761
+ K.useEffect(() => {
47762
+ debouncedFunc.current = debounce$1(func, delay, options);
47763
+ }, [func, delay, options]);
47764
+ return debounced;
47765
+ }
47766
+
47767
+ function floorToDecimal(num, decimalPlaces) {
47768
+ const factor = 10 ** decimalPlaces;
47769
+ return Math.floor(num * factor) / factor;
47206
47770
  }
47207
- /** Parse an input string into a single YAML.Document */
47208
- function parseDocument(source, options = {}) {
47209
- const { lineCounter, prettyErrors } = parseOptions(options);
47210
- const parser = new Parser(lineCounter?.addNewLine);
47211
- const composer = new Composer(options);
47212
- // `doc` is always set by compose.end(true) at the very latest
47213
- let doc = null;
47214
- for (const _doc of composer.compose(parser.parse(source), true, source.length)) {
47215
- if (!doc)
47216
- doc = _doc;
47217
- else if (doc.options.logLevel !== 'silent') {
47218
- doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));
47219
- break;
47220
- }
47771
+ const parseQuotaValue = (key, val) => {
47772
+ let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
47773
+ if (key === "cpu") {
47774
+ if (val.endsWith("m")) {
47775
+ numericValue /= 1e3;
47221
47776
  }
47222
- if (prettyErrors && lineCounter) {
47223
- doc.errors.forEach(prettifyError(source, lineCounter));
47224
- doc.warnings.forEach(prettifyError(source, lineCounter));
47777
+ return floorToDecimal(numericValue, 1);
47778
+ }
47779
+ if (val.endsWith("m")) {
47780
+ numericValue /= 1e3;
47781
+ } else if (val.endsWith("k")) {
47782
+ numericValue /= 1e6;
47783
+ } else if (val.endsWith("M")) {
47784
+ numericValue /= 1e3;
47785
+ } else if (val.endsWith("G")) {
47786
+ numericValue /= 1;
47787
+ } else if (val.endsWith("T")) {
47788
+ numericValue *= 1e3;
47789
+ } else if (val.endsWith("Ki")) {
47790
+ numericValue /= 1024;
47791
+ numericValue /= 1e6;
47792
+ } else if (val.endsWith("Mi")) {
47793
+ numericValue /= 1e3;
47794
+ numericValue /= 1e3;
47795
+ } else if (/^\d+(\.\d+)?$/.test(val)) {
47796
+ numericValue /= 1e9;
47797
+ } else {
47798
+ throw new Error("Invalid value");
47799
+ }
47800
+ return floorToDecimal(numericValue, 1);
47801
+ };
47802
+ const parseQuotaValueCpu = (val) => {
47803
+ if (typeof val === "string") {
47804
+ let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
47805
+ if (val.endsWith("m")) {
47806
+ numericValue /= 1e3;
47225
47807
  }
47226
- return doc;
47227
- }
47228
- function parse(src, reviver, options) {
47229
- let _reviver = undefined;
47230
- const doc = parseDocument(src, options);
47231
- if (!doc)
47232
- return null;
47233
- doc.warnings.forEach(warning => warn(doc.options.logLevel, warning));
47234
- if (doc.errors.length > 0) {
47235
- if (doc.options.logLevel !== 'silent')
47236
- throw doc.errors[0];
47237
- else
47238
- doc.errors = [];
47808
+ return floorToDecimal(numericValue, 1);
47809
+ }
47810
+ return 0;
47811
+ };
47812
+ const parseQuotaValueMemoryAndStorage = (val) => {
47813
+ if (typeof val === "string") {
47814
+ let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
47815
+ if (val.endsWith("k")) {
47816
+ numericValue /= 1e6;
47817
+ } else if (val.endsWith("m")) {
47818
+ numericValue /= 1e3;
47819
+ } else if (val.endsWith("M")) {
47820
+ numericValue /= 1e3;
47821
+ } else if (val.endsWith("G")) {
47822
+ numericValue /= 1;
47823
+ } else if (val.endsWith("T")) {
47824
+ numericValue *= 1e3;
47825
+ } else if (val.endsWith("P")) {
47826
+ numericValue *= 1e6;
47827
+ } else if (val.endsWith("E")) {
47828
+ numericValue *= 1e9;
47829
+ } else if (val.endsWith("Ki")) {
47830
+ numericValue *= 1024 / 1e9;
47831
+ } else if (val.endsWith("Mi")) {
47832
+ numericValue /= 1048.576;
47833
+ } else if (val.endsWith("Gi")) {
47834
+ numericValue *= 1.073741824;
47835
+ } else if (val.endsWith("Ti")) {
47836
+ numericValue *= 1.099511628;
47837
+ } else if (val.endsWith("Pi")) {
47838
+ numericValue *= 1.125899907;
47839
+ } else if (val.endsWith("Ei")) {
47840
+ numericValue *= 1.152921505;
47841
+ } else if (val === "0") {
47842
+ return 0;
47843
+ } else {
47844
+ throw new Error("Invalid value");
47239
47845
  }
47240
- return doc.toJS(Object.assign({ reviver: _reviver }, options));
47241
- }
47242
- function stringify(value, replacer, options) {
47243
- let _replacer = null;
47244
- if (typeof replacer === 'function' || Array.isArray(replacer)) {
47245
- _replacer = replacer;
47846
+ return floorToDecimal(numericValue, 1);
47847
+ }
47848
+ return 0;
47849
+ };
47850
+
47851
+ const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
47852
+ let paths = [];
47853
+ if (typeof obj !== "object" || obj === null) {
47854
+ return paths;
47855
+ }
47856
+ if (obj[targetKey] === targetValue) {
47857
+ paths.push([...currentPath]);
47858
+ }
47859
+ for (const key in obj) {
47860
+ if (obj.hasOwnProperty(key)) {
47861
+ const value = obj[key];
47862
+ if (typeof value === "object" && value !== null) {
47863
+ const newPath = [...currentPath, key];
47864
+ const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
47865
+ paths = paths.concat(subPaths);
47866
+ }
47246
47867
  }
47247
- else if (options === undefined && replacer) {
47248
- options = replacer;
47868
+ }
47869
+ return paths;
47870
+ };
47871
+ const normalizeValuesForQuotasToNumber = (object, properties) => {
47872
+ const newObject = _$1.cloneDeep(object);
47873
+ const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
47874
+ const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
47875
+ memoryPaths.forEach((path) => {
47876
+ const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
47877
+ const value = _$1.get(newObject || {}, cleanPath);
47878
+ if (value || value === 0) {
47879
+ _$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
47249
47880
  }
47250
- if (typeof options === 'string')
47251
- options = options.length;
47252
- if (typeof options === 'number') {
47253
- const indent = Math.round(options);
47254
- options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
47881
+ });
47882
+ cpuPaths.forEach((path) => {
47883
+ const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
47884
+ const value = _$1.get(newObject || {}, cleanPath);
47885
+ if (value || value === 0) {
47886
+ _$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
47255
47887
  }
47256
- if (value === undefined) {
47257
- const { keepUndefined } = options ?? replacer ?? {};
47258
- if (!keepUndefined)
47259
- return undefined;
47888
+ });
47889
+ return newObject;
47890
+ };
47891
+
47892
+ const getAllPathsFromObj = (obj, prefix = []) => {
47893
+ const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
47894
+ return entries.flatMap(([key, value]) => {
47895
+ const currentPath = [...prefix, key];
47896
+ return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
47897
+ });
47898
+ };
47899
+
47900
+ const getPrefixSubarrays = (arr) => {
47901
+ return arr.map((_, index) => arr.slice(0, index + 1));
47902
+ };
47903
+
47904
+ const deepMerge = (a, b) => {
47905
+ const result = { ...a };
47906
+ for (const key of Object.keys(b)) {
47907
+ const aVal = a[key];
47908
+ const bVal = b[key];
47909
+ if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
47910
+ result[key] = deepMerge(aVal, bVal);
47911
+ } else {
47912
+ result[key] = bVal;
47260
47913
  }
47261
- if (isDocument(value) && !_replacer)
47262
- return value.toString(options);
47263
- return new Document$1(value, _replacer, options).toString(options);
47264
- }
47914
+ }
47915
+ return result;
47916
+ };
47265
47917
 
47266
- const BorderRadiusContainer$1 = styled.div`
47918
+ const BorderRadiusContainer = styled.div`
47267
47919
  height: 100%;
47268
47920
  border: 1px solid ${({ $colorBorder }) => $colorBorder};
47269
47921
  border-radius: 8px;
@@ -47274,8 +47926,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47274
47926
  border-radius: 8px;
47275
47927
  }
47276
47928
  `;
47277
- const Styled$k = {
47278
- BorderRadiusContainer: BorderRadiusContainer$1
47929
+ const Styled$j = {
47930
+ BorderRadiusContainer
47279
47931
  };
47280
47932
 
47281
47933
  const YamlEditor = ({ theme, currentValues, onChange, editorUri }) => {
@@ -47321,7 +47973,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47321
47973
  }
47322
47974
  }
47323
47975
  }, [yamlData, editorUri]);
47324
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47976
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47325
47977
  Ft,
47326
47978
  {
47327
47979
  language: "yaml",
@@ -47377,165 +48029,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47377
48029
  ) });
47378
48030
  };
47379
48031
 
47380
- const BorderRadiusContainer = styled.div`
47381
- height: ${({ $designNewLayoutHeight }) => $designNewLayoutHeight ? `${$designNewLayoutHeight}px` : "75vh"};
47382
- border: 1px solid ${({ $colorBorder }) => $colorBorder};
47383
- border-radius: 8px;
47384
- padding: 2px;
47385
- box-sizing: border-box;
47386
-
47387
- .monaco-editor,
47388
- .overflow-guard {
47389
- border-radius: 8px;
47390
- }
47391
- `;
47392
- const ControlsRowContainer$1 = styled.div`
47393
- margin-top: 10px;
47394
- display: flex;
47395
- align-items: center;
47396
- background-color: ${({ $bgColor, $designNewLayout }) => $designNewLayout ? $bgColor : "initial"};
47397
- border-radius: 8px;
47398
- padding: 4px;
47399
- `;
47400
- const BigText$1 = styled.div`
47401
- font-size: 16px;
47402
- line-height: 24px;
47403
- `;
47404
- const Styled$j = {
47405
- BorderRadiusContainer,
47406
- ControlsRowContainer: ControlsRowContainer$1,
47407
- BigText: BigText$1
47408
- };
47409
-
47410
- const YamlEditorSingleton = ({
47411
- theme,
47412
- cluster,
47413
- prefillValuesSchema,
47414
- isNameSpaced,
47415
- isCreate,
47416
- type,
47417
- apiGroupApiVersion,
47418
- typeName,
47419
- backlink,
47420
- designNewLayout,
47421
- designNewLayoutHeight,
47422
- openNotification,
47423
- readOnly = false
47424
- }) => {
47425
- const { token } = antd.theme.useToken();
47426
- const navigate = reactRouterDom.useNavigate();
47427
- const [api, contextHolder] = antd.notification.useNotification();
47428
- const [yamlData, setYamlData] = K.useState("");
47429
- const [isLoading, setIsLoading] = K.useState(false);
47430
- const [error, setError] = K.useState();
47431
- const initialPrefillYamlRef = K.useRef(null);
47432
- const latestPrefillYamlRef = K.useRef(null);
47433
- K.useEffect(() => {
47434
- if (prefillValuesSchema === void 0) return;
47435
- const nextYaml = stringify(prefillValuesSchema);
47436
- if (initialPrefillYamlRef.current === null) {
47437
- initialPrefillYamlRef.current = nextYaml;
47438
- setYamlData(nextYaml);
47439
- }
47440
- latestPrefillYamlRef.current = nextYaml;
47441
- }, [prefillValuesSchema]);
47442
- const handleReload = () => {
47443
- const nextYaml = latestPrefillYamlRef.current ?? initialPrefillYamlRef.current;
47444
- if (nextYaml !== null) {
47445
- setYamlData(nextYaml);
47446
- }
47447
- };
47448
- const onSubmit = () => {
47449
- setIsLoading(true);
47450
- setError(void 0);
47451
- const currentValues = parse(yamlData);
47452
- const { namespace } = currentValues.metadata;
47453
- const { name } = currentValues.metadata;
47454
- const body = currentValues;
47455
- const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${typeName}/${isCreate ? "" : name}`;
47456
- if (isCreate) {
47457
- createNewEntry({ endpoint, body }).then((res) => {
47458
- console.log(res);
47459
- if (backlink) {
47460
- navigate(backlink);
47461
- }
47462
- setIsLoading(false);
47463
- if (openNotification) {
47464
- api.success({
47465
- message: "Created successfully",
47466
- description: "Entry was created",
47467
- placement: "topRight"
47468
- });
47469
- }
47470
- }).catch((error2) => {
47471
- console.log("Form submit error", error2);
47472
- setIsLoading(false);
47473
- setError(error2);
47474
- });
47475
- } else {
47476
- updateEntry({ endpoint, body }).then((res) => {
47477
- console.log(res);
47478
- if (backlink) {
47479
- navigate(backlink);
47480
- }
47481
- setIsLoading(false);
47482
- if (openNotification) {
47483
- api.success({
47484
- message: "Updated successfully",
47485
- description: "Entry was updated",
47486
- placement: "bottomRight"
47487
- });
47488
- }
47489
- }).catch((error2) => {
47490
- console.log("Form submit error", error2);
47491
- setIsLoading(false);
47492
- setError(error2);
47493
- });
47494
- }
47495
- };
47496
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
47497
- contextHolder,
47498
- /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.BorderRadiusContainer, { $designNewLayoutHeight: designNewLayoutHeight, $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47499
- Ft,
47500
- {
47501
- defaultLanguage: "yaml",
47502
- width: "100%",
47503
- height: designNewLayoutHeight || "75vh",
47504
- value: yamlData,
47505
- onChange: (value) => {
47506
- if (!readOnly) {
47507
- setYamlData(value || "");
47508
- }
47509
- },
47510
- theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
47511
- options: {
47512
- theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
47513
- readOnly
47514
- }
47515
- }
47516
- ) }),
47517
- !readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.ControlsRowContainer, { $bgColor: token.colorPrimaryBg, $designNewLayout: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: designNewLayout ? 10 : 16, align: "center", children: [
47518
- /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
47519
- backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: () => navigate(backlink), children: "Cancel" }),
47520
- /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: handleReload, children: "Reload" })
47521
- ] }) }),
47522
- error && /* @__PURE__ */ jsxRuntimeExports.jsxs(
47523
- antd.Modal,
47524
- {
47525
- open: !!error,
47526
- onOk: () => setError(void 0),
47527
- onCancel: () => setError(void 0),
47528
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.BigText, { children: "Error!" }) }),
47529
- cancelButtonProps: { style: { display: "none" } },
47530
- children: [
47531
- "An error has occurred: ",
47532
- error?.response?.data?.message
47533
- ]
47534
- }
47535
- )
47536
- ] });
47537
- };
47538
-
47539
48032
  const getStringByName = (name) => {
47540
48033
  if (typeof name === "string") {
47541
48034
  return name;
@@ -47599,7 +48092,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47599
48092
  const onValuesChangeCallBack = useOnValuesChangeCallback();
47600
48093
  const isTouchedPeristed = useIsTouchedPersisted();
47601
48094
  const updateTouched = useUpdateIsTouchedPersisted();
47602
- const { clusterName, namespace, syntheticProject, entryName } = urlParams;
48095
+ const { cluster, namespace, syntheticProject, name: entryName } = urlParams;
47603
48096
  const form = antd.Form.useFormInstance();
47604
48097
  const fieldValue = antd.Form.useWatch(name === "nodeName" ? "nodeNameBecauseOfSuddenBug" : name, form);
47605
48098
  const fixedName = name === "nodeName" ? "nodeNameBecauseOfSuddenBug" : name;
@@ -47652,7 +48145,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47652
48145
  }, [relatedPath, form, arrName, fixedName, relatedFieldValue, onValuesChangeCallBack, isTouchedPeristed]);
47653
48146
  const uri = prepareTemplate({
47654
48147
  template: customProps.valueUri,
47655
- replaceValues: { clusterName, namespace, syntheticProject, relatedFieldValue, entryName }
48148
+ replaceValues: { cluster, namespace, syntheticProject, relatedFieldValue, name: entryName }
47656
48149
  });
47657
48150
  const {
47658
48151
  data: optionsObj,
@@ -47670,9 +48163,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47670
48163
  if (isErrorOptionsObj && (!customProps.relatedValuePath || customProps.relatedValuePath && !!relatedFieldValue)) {
47671
48164
  return /* @__PURE__ */ jsxRuntimeExports.jsx(HeightContainer, { $height: 64, children: "Error" });
47672
48165
  }
47673
- const items = !isErrorOptionsObj && !isLoadingOptionsObj && optionsObj ? _$1.get(optionsObj, ["items"]) : [];
48166
+ const items = !isErrorOptionsObj && !isLoadingOptionsObj && optionsObj ? _$1.get(optionsObj || {}, ["items"]) : [];
47674
48167
  const filteredItems = customProps.criteria ? items.filter((item) => {
47675
- const objValue = Array.isArray(customProps.criteria?.keysToValue) ? _$1.get(item, customProps.criteria?.keysToValue || []) : jp.query(item, `$${customProps.criteria?.keysToValue}`)[0];
48168
+ const objValue = Array.isArray(customProps.criteria?.keysToValue) ? _$1.get(item || {}, customProps.criteria?.keysToValue || []) : jp.query(item || {}, `$${customProps.criteria?.keysToValue}`)[0];
47676
48169
  if (customProps.criteria?.type === "equals") {
47677
48170
  return objValue === customProps.criteria?.value;
47678
48171
  }
@@ -47680,18 +48173,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47680
48173
  }) : items;
47681
48174
  const itemForPrefilledValue = customProps.criteria?.keepPrefilled !== false ? items.find((item) => {
47682
48175
  if (Array.isArray(customProps.keysToValue)) {
47683
- return _$1.get(item, customProps.keysToValue) === fieldValue;
48176
+ return _$1.get(item || {}, customProps.keysToValue) === fieldValue;
47684
48177
  }
47685
- return jp.query(item, `$${customProps.keysToValue}`)[0] === fieldValue;
48178
+ return jp.query(item || {}, `$${customProps.keysToValue}`)[0] === fieldValue;
47686
48179
  }) : void 0;
47687
48180
  const filteredItemsAndPrefilledValue = itemForPrefilledValue ? [itemForPrefilledValue, ...filteredItems] : filteredItems;
47688
48181
  const options = Array.isArray(filteredItemsAndPrefilledValue) ? filteredItemsAndPrefilledValue.map((item) => {
47689
- const value = Array.isArray(customProps.keysToValue) ? _$1.get(item, customProps.keysToValue) : jp.query(item, `$${customProps.keysToValue}`)[0];
48182
+ const value = Array.isArray(customProps.keysToValue) ? _$1.get(item || {}, customProps.keysToValue) : jp.query(item || {}, `$${customProps.keysToValue}`)[0];
47690
48183
  let label = "";
47691
48184
  if (customProps.keysToLabel) {
47692
- label = Array.isArray(customProps.keysToLabel) ? _$1.get(item, customProps.keysToLabel) : jp.query(item, `$${customProps.keysToLabel}`)[0];
48185
+ label = Array.isArray(customProps.keysToLabel) ? _$1.get(item || {}, customProps.keysToLabel) : jp.query(item || {}, `$${customProps.keysToLabel}`)[0];
47693
48186
  } else {
47694
- label = Array.isArray(customProps.keysToValue) ? _$1.get(item, customProps.keysToValue) : jp.query(item, `$${customProps.keysToValue}`)[0];
48187
+ label = Array.isArray(customProps.keysToValue) ? _$1.get(item || {}, customProps.keysToValue) : jp.query(item || {}, `$${customProps.keysToValue}`)[0];
47695
48188
  }
47696
48189
  return {
47697
48190
  value,
@@ -47751,7 +48244,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47751
48244
  keysToValue,
47752
48245
  logic
47753
48246
  }) => {
47754
- const dirtyValue = Array.isArray(keysToValue) ? _$1.get(valueObj, keysToValue) : jp.query(valueObj, `$${keysToValue}`)[0];
48247
+ const dirtyValue = Array.isArray(keysToValue) ? _$1.get(valueObj || {}, keysToValue) : jp.query(valueObj || {}, `$${keysToValue}`)[0];
47755
48248
  if (logic === "cpuLike") {
47756
48249
  return parseQuotaValueCpu(dirtyValue);
47757
48250
  }
@@ -47950,47 +48443,47 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47950
48443
  urlParams,
47951
48444
  onRemoveByMinus
47952
48445
  }) => {
47953
- const { clusterName, namespace, syntheticProject, entryName } = urlParams;
48446
+ const { cluster, namespace, syntheticProject, name: entryName } = urlParams;
47954
48447
  const minMaxAndStep = isEdit ? customProps.edit : customProps.add;
47955
48448
  const minValueUri = minMaxAndStep.min.type === "resourceValue" ? prepareTemplate({
47956
48449
  template: minMaxAndStep.min.valueUri,
47957
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48450
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47958
48451
  }) : void 0;
47959
48452
  const minSubstractFirstValueUri = minMaxAndStep.min.type === "substractResourceValues" ? prepareTemplate({
47960
48453
  template: minMaxAndStep.min.firstValueUri,
47961
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48454
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47962
48455
  }) : void 0;
47963
48456
  const minSubstractSecondValueUri = minMaxAndStep.min.type === "substractResourceValues" ? prepareTemplate({
47964
48457
  template: minMaxAndStep.min.secondValueUri,
47965
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48458
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47966
48459
  }) : void 0;
47967
48460
  const minAddFirstValueUri = minMaxAndStep.min.type === "addResourceValues" ? prepareTemplate({
47968
48461
  template: minMaxAndStep.min.firstValueUri,
47969
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48462
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47970
48463
  }) : void 0;
47971
48464
  const minAddSecondValueUri = minMaxAndStep.min.type === "addResourceValues" ? prepareTemplate({
47972
48465
  template: minMaxAndStep.min.secondValueUri,
47973
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48466
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47974
48467
  }) : void 0;
47975
48468
  const maxValueUri = minMaxAndStep.max.type === "resourceValue" ? prepareTemplate({
47976
48469
  template: minMaxAndStep.max.valueUri,
47977
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48470
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47978
48471
  }) : void 0;
47979
48472
  const maxSubstractFirstValueUri = minMaxAndStep.max.type === "substractResourceValues" ? prepareTemplate({
47980
48473
  template: minMaxAndStep.max.firstValueUri,
47981
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48474
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47982
48475
  }) : void 0;
47983
48476
  const maxSubstractSecondValueUri = minMaxAndStep.max.type === "substractResourceValues" ? prepareTemplate({
47984
48477
  template: minMaxAndStep.max.secondValueUri,
47985
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48478
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47986
48479
  }) : void 0;
47987
48480
  const maxAddFirstValueUri = minMaxAndStep.max.type === "addResourceValues" ? prepareTemplate({
47988
48481
  template: minMaxAndStep.max.firstValueUri,
47989
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48482
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47990
48483
  }) : void 0;
47991
48484
  const maxAddSecondValueUri = minMaxAndStep.max.type === "addResourceValues" ? prepareTemplate({
47992
48485
  template: minMaxAndStep.max.secondValueUri,
47993
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48486
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47994
48487
  }) : void 0;
47995
48488
  const {
47996
48489
  data: minValueObj,
@@ -49832,8 +50325,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49832
50325
  isCreate,
49833
50326
  type,
49834
50327
  apiGroupApiVersion,
49835
- kindName,
49836
- typeName,
50328
+ kind,
50329
+ plural,
49837
50330
  backlink,
49838
50331
  designNewLayout,
49839
50332
  designNewLayoutHeight
@@ -49868,8 +50361,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49868
50361
  const yamlToValuesAbortRef = K.useRef(null);
49869
50362
  const isAnyFieldFocusedRef = K.useRef(false);
49870
50363
  const editorUri = K.useMemo(
49871
- () => `inmemory://openapi-ui/${cluster}/${apiGroupApiVersion}/${type}/${typeName}/${kindName}${isCreate ? "/create" : "/edit"}.yaml`,
49872
- [cluster, apiGroupApiVersion, type, typeName, kindName, isCreate]
50364
+ () => `inmemory://openapi-ui/${cluster}/${apiGroupApiVersion}/${type}/${plural}/${kind}${isCreate ? "/create" : "/edit"}.yaml`,
50365
+ [cluster, apiGroupApiVersion, type, plural, kind, isCreate]
49873
50366
  );
49874
50367
  K.useEffect(() => {
49875
50368
  valuesToYamlReqId.current++;
@@ -49887,19 +50380,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49887
50380
  setYamlValues(void 0);
49888
50381
  }, [editorUri]);
49889
50382
  const createPermission = usePermissions({
49890
- group: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
49891
- resource: urlParamsForPermissions.typeName || "",
50383
+ apiGroup: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
50384
+ plural: urlParamsForPermissions.plural || "",
49892
50385
  namespace: isNameSpaced ? namespaceFromFormData : void 0,
49893
- clusterName: cluster,
50386
+ cluster,
49894
50387
  verb: "create",
49895
50388
  refetchInterval: false,
49896
50389
  enabler: isCreate === true
49897
50390
  });
49898
50391
  const updatePermission = usePermissions({
49899
- group: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
49900
- resource: urlParamsForPermissions.typeName || "",
50392
+ apiGroup: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
50393
+ plural: urlParamsForPermissions.plural || "",
49901
50394
  namespace: isNameSpaced ? namespaceFromFormData : void 0,
49902
- clusterName: cluster,
50395
+ cluster,
49903
50396
  verb: "update",
49904
50397
  refetchInterval: false,
49905
50398
  enabler: isCreate !== true
@@ -49929,7 +50422,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49929
50422
  payload
49930
50423
  ).then(({ data }) => {
49931
50424
  const body = data;
49932
- const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${typeName}/${isCreate ? "" : name}`;
50425
+ const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${plural}/${isCreate ? "" : name}`;
49933
50426
  if (isCreate) {
49934
50427
  createNewEntry({ endpoint, body }).then((res) => {
49935
50428
  console.log(res);
@@ -49987,7 +50480,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49987
50480
  const allValues2 = {};
49988
50481
  if (isCreate) {
49989
50482
  _$1.set(allValues2, ["apiVersion"], apiGroupApiVersion === "api/v1" ? "v1" : apiGroupApiVersion);
49990
- _$1.set(allValues2, ["kind"], kindName);
50483
+ _$1.set(allValues2, ["kind"], kind);
49991
50484
  }
49992
50485
  if (formsPrefills) {
49993
50486
  formsPrefills.spec.values.forEach(({ path, value }) => {
@@ -50007,7 +50500,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50007
50500
  }
50008
50501
  const sorted = Object.fromEntries(Object.entries(allValues2).sort(([a], [b]) => a.localeCompare(b)));
50009
50502
  return sorted;
50010
- }, [formsPrefills, prefillValueNamespaceOnly, isCreate, apiGroupApiVersion, kindName, normalizedPrefill]);
50503
+ }, [formsPrefills, prefillValueNamespaceOnly, isCreate, apiGroupApiVersion, kind, normalizedPrefill]);
50011
50504
  const prefillTemplates = K.useMemo(() => {
50012
50505
  const templates = [];
50013
50506
  if (formsPrefills?.spec?.values?.length) {
@@ -50378,7 +50871,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50378
50871
  return true;
50379
50872
  });
50380
50873
  setExpandedKeys([...uniqueKeys]);
50381
- }, [apiGroupApiVersion, formsPrefills, prefillValuesSchema, type, typeName]);
50874
+ }, [apiGroupApiVersion, formsPrefills, prefillValuesSchema, type, plural]);
50382
50875
  K.useEffect(() => {
50383
50876
  if (!initialValues) return;
50384
50877
  setProperties((prev) => {
@@ -50637,7 +51130,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50637
51130
  setIsLoading(true);
50638
51131
  const payload = {
50639
51132
  data,
50640
- clusterName: cluster,
51133
+ cluster,
50641
51134
  customizationId
50642
51135
  };
50643
51136
  axios.post(`/api/clusters/${cluster}/openapi-bff/forms/formPrepare/prepareFormProps`, payload).then(({ data: data2 }) => {
@@ -50656,10 +51149,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50656
51149
  expandedPaths: data2.expandedPaths || [],
50657
51150
  persistedPaths: data2.persistedPaths || [],
50658
51151
  sortPaths: data2.sortPaths,
50659
- kindName: data2.kindName || "",
51152
+ kind: data2.kind || "",
50660
51153
  formPrefills: data2.formPrefills,
50661
51154
  namespacesData: data2.namespacesData
50662
51155
  });
51156
+ setIsError(void 0);
50663
51157
  }
50664
51158
  }).catch((e) => {
50665
51159
  setIsError(e.message);
@@ -50681,7 +51175,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50681
51175
  type: data.type,
50682
51176
  isNameSpaced: isNamespaced,
50683
51177
  apiGroupApiVersion: data.type === "builtin" ? "api/v1" : `${data.apiGroup}/${data.apiVersion}`,
50684
- typeName: data.typeName,
51178
+ plural: data.plural,
50685
51179
  backlink,
50686
51180
  designNewLayout,
50687
51181
  designNewLayoutHeight
@@ -50717,8 +51211,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50717
51211
  type: data.type,
50718
51212
  isNameSpaced: isNamespaced ? preparedData.namespacesData : false,
50719
51213
  apiGroupApiVersion: data.type === "builtin" ? "api/v1" : `${data.apiGroup}/${data.apiVersion}`,
50720
- kindName: preparedData.kindName,
50721
- typeName: data.typeName,
51214
+ kind: preparedData.kind,
51215
+ plural: data.plural,
50722
51216
  backlink,
50723
51217
  designNewLayout,
50724
51218
  designNewLayoutHeight
@@ -50809,11 +51303,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50809
51303
  }
50810
51304
 
50811
51305
  const AddEditFormModal = ({
50812
- clusterName,
51306
+ cluster,
50813
51307
  baseApiGroup,
50814
51308
  baseApiVersion,
50815
- mpResourceName,
50816
- mpResourceKind,
51309
+ marketplacePlural,
51310
+ marketplaceKind,
50817
51311
  isOpen,
50818
51312
  setIsOpen,
50819
51313
  setError,
@@ -50829,7 +51323,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50829
51323
  type: "direct",
50830
51324
  apiGroup: "",
50831
51325
  apiVersion: "",
50832
- typeName: "",
51326
+ plural: "",
50833
51327
  pathToNav: "",
50834
51328
  tags: [],
50835
51329
  disabled: false,
@@ -50838,10 +51332,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50838
51332
  const onSubmit = (values) => {
50839
51333
  if (typeof isOpen === "boolean") {
50840
51334
  createNewEntry({
50841
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}`,
51335
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${marketplacePlural}`,
50842
51336
  body: {
50843
51337
  apiVersion: `${baseApiGroup}/${baseApiVersion}`,
50844
- kind: mpResourceKind,
51338
+ kind: marketplaceKind,
50845
51339
  metadata: {
50846
51340
  name: v4()
50847
51341
  },
@@ -50858,10 +51352,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50858
51352
  return;
50859
51353
  }
50860
51354
  updateEntry({
50861
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}/${isOpen.metadata.name}`,
51355
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${marketplacePlural}/${isOpen.metadata.name}`,
50862
51356
  body: {
50863
51357
  apiVersion: `${baseApiGroup}/${baseApiVersion}`,
50864
- kind: mpResourceKind,
51358
+ kind: marketplaceKind,
50865
51359
  metadata: {
50866
51360
  name: isOpen.metadata.name,
50867
51361
  resourceVersion: isOpen.metadata.resourceVersion
@@ -50907,7 +51401,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50907
51401
  ) }),
50908
51402
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter API group", name: "apiGroup", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type === "direct" || type === "built-in" }) }),
50909
51403
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter API version", name: "apiVersion", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type === "direct" }) }),
50910
- /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter resource type", name: "typeName", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type === "direct" }) }),
51404
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter resource type", name: "plural", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type === "direct" }) }),
50911
51405
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter path", name: "pathToNav", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type !== "direct" }) }),
50912
51406
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Tags", name: "tags", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50913
51407
  antd.Select,
@@ -50926,11 +51420,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50926
51420
  };
50927
51421
 
50928
51422
  const getPathToNav = ({
50929
- clusterName,
51423
+ cluster,
50930
51424
  namespace,
50931
51425
  type,
50932
51426
  pathToNav,
50933
- typeName,
51427
+ plural,
50934
51428
  apiGroup,
50935
51429
  apiVersion,
50936
51430
  baseprefix
@@ -50940,19 +51434,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50940
51434
  return pathToNav;
50941
51435
  }
50942
51436
  if (type === "crd") {
50943
- return `/${baseprefix}/${clusterName}/${namespace}/crd-table/${apiGroup}/${apiVersion}/${apiExtensionVersion}/${typeName}`;
51437
+ return `/${baseprefix}/${cluster}/${namespace}/crd-table/${apiGroup}/${apiVersion}/${apiExtensionVersion}/${plural}`;
50944
51438
  }
50945
51439
  if (type === "nonCrd") {
50946
- return `/${baseprefix}/${clusterName}/${namespace}/api-table/${apiGroup}/${apiVersion}/${typeName}`;
51440
+ return `/${baseprefix}/${cluster}/${namespace}/api-table/${apiGroup}/${apiVersion}/${plural}`;
50947
51441
  }
50948
- return `/${baseprefix}/${clusterName}/${namespace}/builtin-table/${typeName}`;
51442
+ return `/${baseprefix}/${cluster}/${namespace}/builtin-table/${plural}`;
50949
51443
  };
50950
51444
  const getCreatePathToNav = ({
50951
- clusterName,
51445
+ cluster,
50952
51446
  namespace,
50953
51447
  type,
50954
51448
  pathToNav,
50955
- typeName,
51449
+ plural,
50956
51450
  apiGroup,
50957
51451
  apiVersion,
50958
51452
  baseprefix
@@ -50961,12 +51455,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50961
51455
  return pathToNav;
50962
51456
  }
50963
51457
  if (type === "crd") {
50964
- return `/${baseprefix}/${clusterName}/${namespace}/forms/crds/${apiGroup}/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
51458
+ return `/${baseprefix}/${cluster}/${namespace}/forms/crds/${apiGroup}/${apiVersion}/${plural}?backlink=${window.location.pathname}`;
50965
51459
  }
50966
51460
  if (type === "nonCrd") {
50967
- return `/${baseprefix}/${clusterName}/${namespace}/forms/apis/${apiGroup}/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
51461
+ return `/${baseprefix}/${cluster}/${namespace}/forms/apis/${apiGroup}/${apiVersion}/${plural}?backlink=${window.location.pathname}`;
50968
51462
  }
50969
- return `/${baseprefix}/${clusterName}/${namespace}/forms/builtin/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
51463
+ return `/${baseprefix}/${cluster}/${namespace}/forms/builtin/${apiVersion}/${plural}?backlink=${window.location.pathname}`;
50970
51464
  };
50971
51465
 
50972
51466
  const CustomCard$4 = styled(antd.Card)`
@@ -51056,11 +51550,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51056
51550
  description,
51057
51551
  name,
51058
51552
  icon,
51059
- clusterName,
51553
+ cluster,
51060
51554
  namespace,
51061
51555
  type,
51062
51556
  pathToNav,
51063
- typeName,
51557
+ plural,
51064
51558
  apiGroup,
51065
51559
  apiVersion,
51066
51560
  tags,
@@ -51082,29 +51576,29 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51082
51576
  decodedIcon = "Can't decode";
51083
51577
  }
51084
51578
  const navigateUrl = addedMode || standalone ? getPathToNav({
51085
- clusterName,
51579
+ cluster,
51086
51580
  namespace,
51087
51581
  type,
51088
51582
  pathToNav,
51089
- typeName,
51583
+ plural,
51090
51584
  apiGroup,
51091
51585
  apiVersion,
51092
51586
  baseprefix
51093
51587
  }) : getCreatePathToNav({
51094
- clusterName,
51588
+ cluster,
51095
51589
  namespace,
51096
51590
  type,
51097
51591
  pathToNav,
51098
- typeName,
51592
+ plural,
51099
51593
  apiGroup,
51100
51594
  apiVersion,
51101
51595
  baseprefix
51102
51596
  });
51103
51597
  const { data: k8sList, error: k8sListError } = useK8sSmartResource({
51104
- cluster: clusterName || "",
51598
+ cluster,
51105
51599
  namespace,
51106
- group: apiGroup,
51107
- version: apiVersion || "",
51600
+ apiGroup,
51601
+ apiVersion: apiVersion || "",
51108
51602
  plural: type,
51109
51603
  isEnabled: Boolean(apiVersion && addedMode && type !== "direct")
51110
51604
  });
@@ -51215,12 +51709,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51215
51709
  };
51216
51710
 
51217
51711
  const MarketPlace = ({
51218
- clusterName,
51712
+ cluster,
51219
51713
  namespace,
51220
51714
  baseApiGroup,
51221
51715
  baseApiVersion,
51222
- mpResourceName,
51223
- mpResourceKind,
51716
+ marketplacePlural,
51717
+ marketplaceKind,
51224
51718
  baseprefix,
51225
51719
  standalone,
51226
51720
  forceAddedMode,
@@ -51241,30 +51735,29 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51241
51735
  isLoading,
51242
51736
  error
51243
51737
  } = useK8sSmartResource({
51244
- cluster: clusterName || "",
51245
- group: baseApiGroup,
51246
- version: baseApiVersion,
51247
- plural: mpResourceName,
51248
- isEnabled: Boolean(clusterName !== void 0)
51738
+ cluster,
51739
+ apiGroup: baseApiGroup,
51740
+ apiVersion: baseApiVersion,
51741
+ plural: marketplacePlural
51249
51742
  });
51250
51743
  const createPermission = usePermissions({
51251
- group: baseApiGroup,
51252
- resource: mpResourceName,
51253
- clusterName: clusterName || "",
51744
+ apiGroup: baseApiGroup,
51745
+ plural: marketplacePlural,
51746
+ cluster,
51254
51747
  verb: "create",
51255
51748
  refetchInterval: false
51256
51749
  });
51257
51750
  const updatePermission = usePermissions({
51258
- group: baseApiGroup,
51259
- resource: mpResourceName,
51260
- clusterName: clusterName || "",
51751
+ apiGroup: baseApiGroup,
51752
+ plural: marketplacePlural,
51753
+ cluster,
51261
51754
  verb: "update",
51262
51755
  refetchInterval: false
51263
51756
  });
51264
51757
  const deletePermission = usePermissions({
51265
- group: baseApiGroup,
51266
- resource: mpResourceName,
51267
- clusterName: clusterName || "",
51758
+ apiGroup: baseApiGroup,
51759
+ plural: marketplacePlural,
51760
+ cluster,
51268
51761
  verb: "delete",
51269
51762
  refetchInterval: false
51270
51763
  });
@@ -51351,8 +51844,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51351
51844
  }
51352
51845
  ),
51353
51846
  /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: 22, wrap: true, children: [
51354
- clusterName && namespace && filteredAndSortedData.map(
51355
- ({ name, description, icon, type, pathToNav, typeName, apiGroup, apiVersion, tags, disabled }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
51847
+ namespace && filteredAndSortedData.map(
51848
+ ({ name, description, icon, type, pathToNav, plural, apiGroup, apiVersion, tags, disabled }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
51356
51849
  MarketplaceCard,
51357
51850
  {
51358
51851
  baseprefix,
@@ -51361,11 +51854,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51361
51854
  icon,
51362
51855
  isEditMode,
51363
51856
  name,
51364
- clusterName,
51857
+ cluster,
51365
51858
  namespace,
51366
51859
  type,
51367
51860
  pathToNav,
51368
- typeName,
51861
+ plural,
51369
51862
  apiGroup,
51370
51863
  apiVersion,
51371
51864
  tags,
@@ -51395,11 +51888,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51395
51888
  isAddEditOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
51396
51889
  AddEditFormModal,
51397
51890
  {
51398
- clusterName,
51891
+ cluster,
51399
51892
  baseApiGroup,
51400
51893
  baseApiVersion,
51401
- mpResourceName,
51402
- mpResourceKind,
51894
+ marketplacePlural,
51895
+ marketplaceKind,
51403
51896
  isOpen: isAddEditOpen,
51404
51897
  setError: setCreateUpdateError,
51405
51898
  setIsOpen: setIsAddEditOpen,
@@ -51412,7 +51905,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51412
51905
  {
51413
51906
  name: isDeleteOpen.name,
51414
51907
  onClose: () => setIsDeleteOpen(false),
51415
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}/${isDeleteOpen.name}`
51908
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${marketplacePlural}/${isDeleteOpen.name}`
51416
51909
  }
51417
51910
  )
51418
51911
  ] });
@@ -51531,14 +52024,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51531
52024
  ActionMenuPlaceholder};
51532
52025
 
51533
52026
  const ProjectInfoCard = ({
51534
- clusterName,
52027
+ cluster,
51535
52028
  namespace,
51536
52029
  baseApiGroup,
51537
52030
  baseApiVersion,
51538
52031
  baseProjectApiGroup,
51539
52032
  baseProjectVersion,
51540
- mpResourceName,
51541
- projectResourceName,
52033
+ marketplacePlural,
52034
+ projectPlural,
51542
52035
  baseprefix,
51543
52036
  accessGroups,
51544
52037
  showZeroResources,
@@ -51550,45 +52043,43 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51550
52043
  isLoading: marketplaceIsLoading
51551
52044
  // error: marketplaceError,
51552
52045
  } = useK8sSmartResource({
51553
- cluster: clusterName || "",
51554
- group: baseApiGroup,
51555
- version: baseApiVersion,
51556
- plural: mpResourceName,
51557
- isEnabled: Boolean(clusterName !== void 0)
52046
+ cluster,
52047
+ apiGroup: baseApiGroup,
52048
+ apiVersion: baseApiVersion,
52049
+ plural: marketplacePlural
51558
52050
  });
51559
52051
  const {
51560
52052
  data: projectArr,
51561
52053
  isLoading,
51562
52054
  error
51563
52055
  } = useK8sSmartResource({
51564
- cluster: clusterName || "",
51565
- group: baseProjectApiGroup,
51566
- version: baseProjectVersion,
51567
- plural: projectResourceName,
51568
- fieldSelector: `metadata.name=${namespace}`,
51569
- isEnabled: Boolean(clusterName !== void 0)
52056
+ cluster,
52057
+ apiGroup: baseProjectApiGroup,
52058
+ apiVersion: baseProjectVersion,
52059
+ plural: projectPlural,
52060
+ fieldSelector: `metadata.name=${namespace}`
51570
52061
  });
51571
52062
  const project = projectArr && projectArr.items && projectArr.items.length > 0 ? projectArr.items[0] : void 0;
51572
52063
  const [isDeleteModalOpen, setIsDeleteModalOpen] = K.useState(false);
51573
52064
  const updatePermission = usePermissions({
51574
- group: baseProjectApiGroup,
51575
- resource: projectResourceName,
51576
- clusterName: clusterName || "",
52065
+ apiGroup: baseProjectApiGroup,
52066
+ plural: projectPlural,
52067
+ cluster,
51577
52068
  verb: "update",
51578
52069
  refetchInterval: false
51579
52070
  });
51580
52071
  const deletePermission = usePermissions({
51581
- group: baseProjectApiGroup,
51582
- resource: projectResourceName,
51583
- clusterName: clusterName || "",
52072
+ apiGroup: baseProjectApiGroup,
52073
+ plural: projectPlural,
52074
+ cluster,
51584
52075
  verb: "delete",
51585
52076
  refetchInterval: false
51586
52077
  });
51587
52078
  const openUpdate = K.useCallback(() => {
51588
52079
  navigate(
51589
- `/${baseprefix}/${clusterName}/forms/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectResourceName}/${namespace}?backlink=${baseprefix}/clusters/${clusterName}`
52080
+ `/${baseprefix}/${cluster}/forms/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectPlural}/${namespace}?backlink=${baseprefix}/clusters/${cluster}`
51590
52081
  );
51591
- }, [baseprefix, clusterName, namespace, baseProjectApiGroup, baseProjectVersion, projectResourceName, navigate]);
52082
+ }, [baseprefix, cluster, namespace, baseProjectApiGroup, baseProjectVersion, projectPlural, navigate]);
51592
52083
  if (isLoading) {
51593
52084
  return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {});
51594
52085
  }
@@ -51617,7 +52108,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51617
52108
  /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 12, $samespace: true }),
51618
52109
  /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: 22, wrap: true, children: [
51619
52110
  marketplaceIsLoading && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {}),
51620
- clusterName && namespace && marketplacePanels?.items.map(({ spec }) => spec).sort().map(({ name, description, icon, type, pathToNav, typeName, apiGroup, apiVersion, tags, disabled }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
52111
+ namespace && marketplacePanels?.items.map(({ spec }) => spec).sort().map(({ name, description, icon, type, pathToNav, plural, apiGroup, apiVersion, tags, disabled }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
51621
52112
  MarketplaceCard,
51622
52113
  {
51623
52114
  baseprefix,
@@ -51626,11 +52117,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51626
52117
  icon,
51627
52118
  isEditMode: false,
51628
52119
  name,
51629
- clusterName,
52120
+ cluster,
51630
52121
  namespace,
51631
52122
  type,
51632
52123
  pathToNav,
51633
- typeName,
52124
+ plural,
51634
52125
  apiGroup,
51635
52126
  apiVersion,
51636
52127
  tags,
@@ -51646,9 +52137,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51646
52137
  name: project.metadata.name,
51647
52138
  onClose: () => {
51648
52139
  setIsDeleteModalOpen(false);
51649
- navigate(`${baseprefix}/clusters/${clusterName}`);
52140
+ navigate(`${baseprefix}/clusters/${cluster}`);
51650
52141
  },
51651
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectResourceName}/${project.metadata.name}`
52142
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectPlural}/${project.metadata.name}`
51652
52143
  }
51653
52144
  )
51654
52145
  ] });
@@ -52444,14 +52935,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52444
52935
  ] });
52445
52936
  };
52446
52937
 
52447
- const kindByGvr = (entries) => (gvr) => {
52448
- const [group = "", v = "", resource = ""] = gvr.split("~", 3);
52449
- const norm = (s) => s.trim();
52450
- const kinds = entries.filter((e) => norm(e.group) === norm(group) && e.version.version === v && e.version.resource === resource).map((e) => e.kind);
52451
- const uniq = Array.from(new Set(kinds));
52452
- return uniq.length === 1 ? uniq[0] : void 0;
52453
- };
52454
-
52455
52938
  const SelectTag = styled(antd.Tag)`
52456
52939
  margin-inline-end: 4px;
52457
52940
  padding: 4px 6px;
@@ -53191,14 +53674,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53191
53674
  baseFactoryNamespacedBuiltinKey,
53192
53675
  baseFactoryClusterSceopedBuiltinKey,
53193
53676
  baseNamespaceFactoryKey,
53194
- baseNavigationPluralName,
53195
- baseNavigationSpecificName
53677
+ baseNavigationPlural,
53678
+ baseNavigationName
53196
53679
  }) => {
53197
53680
  const { token } = antd.theme.useToken();
53198
53681
  const [kindIndex, setKindIndex] = K.useState();
53199
53682
  const [kindsWithVersion, setKindWithVersion] = K.useState();
53200
53683
  K.useEffect(() => {
53201
- getKinds({ clusterName: cluster }).then((data) => {
53684
+ getKinds({ cluster }).then((data) => {
53202
53685
  setKindIndex(data);
53203
53686
  setKindWithVersion(getSortedKindsAll(data));
53204
53687
  }).catch((error) => {
@@ -53207,10 +53690,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53207
53690
  }, [cluster]);
53208
53691
  const { data: navigationDataArr } = useK8sSmartResource({
53209
53692
  cluster,
53210
- group: "front.in-cloud.io",
53211
- version: "v1alpha1",
53212
- plural: baseNavigationPluralName,
53213
- fieldSelector: `metadata.name=${baseNavigationSpecificName}`
53693
+ apiGroup: "front.in-cloud.io",
53694
+ apiVersion: "v1alpha1",
53695
+ plural: baseNavigationPlural,
53696
+ fieldSelector: `metadata.name=${baseNavigationName}`
53214
53697
  });
53215
53698
  const [isPaused, setIsPaused] = K.useState(false);
53216
53699
  const pausedRef = K.useRef(isPaused);
@@ -53554,44 +54037,44 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53554
54037
  };
53555
54038
 
53556
54039
  const filterIfApiInstanceNamespaceScoped = async ({
54040
+ cluster,
53557
54041
  namespace,
53558
- data,
53559
54042
  apiGroup,
53560
54043
  apiVersion,
53561
- clusterName
54044
+ data
53562
54045
  }) => {
53563
54046
  const payload = {
54047
+ cluster,
53564
54048
  namespace,
53565
- data,
53566
54049
  apiGroup,
53567
54050
  apiVersion,
53568
- clusterName
54051
+ data
53569
54052
  };
53570
54053
  const result = await axios.post(
53571
- `/api/clusters/${clusterName}/openapi-bff/scopes/filterScopes/filterIfApiNamespaceScoped`,
54054
+ `/api/clusters/${cluster}/openapi-bff/scopes/filterScopes/filterIfApiNamespaceScoped`,
53572
54055
  payload
53573
54056
  );
53574
54057
  return result.data;
53575
54058
  };
53576
54059
  const filterIfBuiltInInstanceNamespaceScoped = async ({
54060
+ cluster,
53577
54061
  namespace,
53578
- data,
53579
- clusterName
54062
+ data
53580
54063
  }) => {
53581
54064
  const payload = {
54065
+ cluster,
53582
54066
  namespace,
53583
- data,
53584
- clusterName
54067
+ data
53585
54068
  };
53586
54069
  const result = await axios.post(
53587
- `/api/clusters/${clusterName}/openapi-bff/scopes/filterScopes/filterIfBuiltInNamespaceScoped`,
54070
+ `/api/clusters/${cluster}/openapi-bff/scopes/filterScopes/filterIfBuiltInNamespaceScoped`,
53588
54071
  payload
53589
54072
  );
53590
54073
  return result.data;
53591
54074
  };
53592
54075
 
53593
54076
  const getGroupsByCategory = async ({
53594
- clusterName,
54077
+ cluster,
53595
54078
  apiGroupListData,
53596
54079
  builtinResourceTypesData,
53597
54080
  namespace,
@@ -53603,7 +54086,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53603
54086
  const filteredBuiltinData = await filterIfBuiltInInstanceNamespaceScoped({
53604
54087
  namespace,
53605
54088
  data: builtinResourceTypesData,
53606
- clusterName
54089
+ cluster
53607
54090
  });
53608
54091
  return { crdGroups, nonCrdGroups, builtinGroups: filteredBuiltinData, apiExtensionVersion };
53609
54092
  };
@@ -53718,12 +54201,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53718
54201
  };
53719
54202
 
53720
54203
  const getApiResources = async ({
53721
- clusterName,
54204
+ cluster,
53722
54205
  namespace,
53723
54206
  apiGroup,
53724
54207
  apiVersion,
53725
- typeName,
53726
- specificName,
54208
+ plural,
54209
+ name,
53727
54210
  labels,
53728
54211
  fields,
53729
54212
  limit
@@ -53740,27 +54223,27 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53740
54223
  }
53741
54224
  const searchParams = params.toString();
53742
54225
  return axios.get(
53743
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${typeName}${specificName ? `/${specificName}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
54226
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${plural}${name ? `/${name}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
53744
54227
  );
53745
54228
  };
53746
54229
  const getApiResourceSingle = async ({
53747
- clusterName,
54230
+ cluster,
53748
54231
  namespace,
53749
54232
  apiGroup,
53750
54233
  apiVersion,
53751
- typeName,
53752
- entryName
54234
+ plural,
54235
+ name
53753
54236
  }) => {
53754
54237
  return axios.get(
53755
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${typeName}/${entryName}`
54238
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${plural}/${name}`
53756
54239
  );
53757
54240
  };
53758
54241
 
53759
54242
  const getBuiltinResources = async ({
53760
- clusterName,
54243
+ cluster,
53761
54244
  namespace,
53762
- typeName,
53763
- specificName,
54245
+ plural,
54246
+ name,
53764
54247
  labels,
53765
54248
  fields,
53766
54249
  limit
@@ -53777,105 +54260,101 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53777
54260
  }
53778
54261
  const searchParams = params.toString();
53779
54262
  return axios.get(
53780
- `/api/clusters/${clusterName}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${typeName}${specificName ? `/${specificName}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
54263
+ `/api/clusters/${cluster}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${plural}${name ? `/${name}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
53781
54264
  );
53782
54265
  };
53783
54266
  const getBuiltinResourceSingle = async ({
53784
- clusterName,
54267
+ cluster,
53785
54268
  namespace,
53786
- typeName,
53787
- entryName
54269
+ plural,
54270
+ name
53788
54271
  }) => {
53789
54272
  return axios.get(
53790
- `/api/clusters/${clusterName}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${typeName}/${entryName}`
54273
+ `/api/clusters/${cluster}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${plural}/${name}`
53791
54274
  );
53792
54275
  };
53793
54276
 
53794
54277
  const getCrdResources = async ({
53795
- clusterName,
54278
+ cluster,
53796
54279
  namespace,
53797
54280
  apiGroup,
53798
54281
  apiVersion,
53799
54282
  crdName
53800
54283
  }) => {
53801
54284
  return axios.get(
53802
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}`
54285
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}`
53803
54286
  );
53804
54287
  };
53805
54288
  const getCrdResourceSingle = async ({
53806
- clusterName,
54289
+ cluster,
53807
54290
  namespace,
53808
54291
  apiGroup,
53809
54292
  apiVersion,
53810
54293
  crdName,
53811
- entryName
54294
+ name
53812
54295
  }) => {
53813
54296
  return axios.get(
53814
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}/${entryName}`
54297
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}/${name}`
53815
54298
  );
53816
54299
  };
53817
54300
 
53818
- const getApiResourceTypes = async ({ clusterName }) => {
53819
- return axios.get(`/api/clusters/${clusterName}/k8s/apis/`);
54301
+ const getApiResourceTypes = async ({ cluster }) => {
54302
+ return axios.get(`/api/clusters/${cluster}/k8s/apis/`);
53820
54303
  };
53821
54304
  const getApiResourceTypesByApiGroup = async ({
53822
- clusterName,
54305
+ cluster,
53823
54306
  apiGroup,
53824
54307
  apiVersion
53825
54308
  }) => {
53826
- return axios.get(`/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}/`);
54309
+ return axios.get(`/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}/`);
53827
54310
  };
53828
54311
 
53829
- const getBuiltinResourceTypes = async ({
53830
- clusterName
53831
- }) => {
53832
- return axios.get(`/api/clusters/${clusterName}/k8s/api/v1`);
54312
+ const getBuiltinResourceTypes = async ({ cluster }) => {
54313
+ return axios.get(`/api/clusters/${cluster}/k8s/api/v1`);
53833
54314
  };
53834
54315
 
53835
54316
  const getCrdData = async ({
53836
- clusterName,
54317
+ cluster,
53837
54318
  apiExtensionVersion,
53838
54319
  crdName
53839
54320
  }) => {
53840
54321
  return axios.get(
53841
- `/api/clusters/${clusterName}/k8s/apis/apiextensions.k8s.io/${apiExtensionVersion}/customresourcedefinitions/${crdName}`
54322
+ `/api/clusters/${cluster}/k8s/apis/apiextensions.k8s.io/${apiExtensionVersion}/customresourcedefinitions/${crdName}`
53842
54323
  );
53843
54324
  };
53844
54325
 
53845
- const getSwagger = async ({
53846
- clusterName
53847
- }) => {
53848
- return axios.get(`/api/clusters/${clusterName}/openapi-bff/swagger/swagger/${clusterName}`);
54326
+ const getSwagger = async ({ cluster }) => {
54327
+ return axios.get(`/api/clusters/${cluster}/openapi-bff/swagger/swagger/${cluster}`);
53849
54328
  };
53850
54329
 
53851
54330
  const checkIfApiInstanceNamespaceScoped = async ({
53852
- typeName,
54331
+ plural,
53853
54332
  apiGroup,
53854
54333
  apiVersion,
53855
- clusterName
54334
+ cluster
53856
54335
  }) => {
53857
54336
  const payload = {
53858
- typeName,
54337
+ plural,
53859
54338
  apiGroup,
53860
54339
  apiVersion,
53861
- clusterName
54340
+ cluster
53862
54341
  };
53863
54342
  const { data } = await axios.post(
53864
- `/api/clusters/${clusterName}/openapi-bff/scopes/checkScopes/checkIfApiNamespaceScoped`,
54343
+ `/api/clusters/${cluster}/openapi-bff/scopes/checkScopes/checkIfApiNamespaceScoped`,
53865
54344
  payload
53866
54345
  );
53867
54346
  return data;
53868
54347
  };
53869
54348
  const checkIfBuiltInInstanceNamespaceScoped = async ({
53870
- typeName,
53871
- clusterName
54349
+ plural,
54350
+ cluster
53872
54351
  }) => {
53873
54352
  const payload = {
53874
- typeName,
53875
- clusterName
54353
+ plural,
54354
+ cluster
53876
54355
  };
53877
54356
  const { data } = await axios.post(
53878
- `/api/clusters/${clusterName}/openapi-bff/scopes/checkScopes/checkIfBuiltInNamespaceScoped`,
54357
+ `/api/clusters/${cluster}/openapi-bff/scopes/checkScopes/checkIfBuiltInNamespaceScoped`,
53879
54358
  payload
53880
54359
  );
53881
54360
  return data;
@@ -53890,12 +54369,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53890
54369
  };
53891
54370
 
53892
54371
  const useApiResources = ({
53893
- clusterName,
54372
+ cluster,
53894
54373
  namespace,
53895
54374
  apiGroup,
53896
54375
  apiVersion,
53897
- typeName,
53898
- specificName,
54376
+ plural,
54377
+ name,
53899
54378
  labels,
53900
54379
  fields,
53901
54380
  limit,
@@ -53903,26 +54382,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53903
54382
  isEnabled
53904
54383
  }) => {
53905
54384
  return reactQuery.useQuery({
53906
- queryKey: [
53907
- "useApiResources",
53908
- clusterName,
53909
- namespace,
53910
- apiGroup,
53911
- apiVersion,
53912
- typeName,
53913
- specificName,
53914
- labels,
53915
- fields,
53916
- limit
53917
- ],
54385
+ queryKey: ["useApiResources", cluster, namespace, apiGroup, apiVersion, plural, name, labels, fields, limit],
53918
54386
  queryFn: async () => {
53919
54387
  const response = await getApiResources({
53920
- clusterName,
54388
+ cluster,
53921
54389
  namespace,
53922
54390
  apiGroup,
53923
54391
  apiVersion,
53924
- typeName,
53925
- specificName,
54392
+ plural,
54393
+ name,
53926
54394
  labels,
53927
54395
  fields,
53928
54396
  limit
@@ -53938,33 +54406,33 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53938
54406
  });
53939
54407
  };
53940
54408
  const useApiResourceSingle = ({
53941
- clusterName,
54409
+ cluster,
53942
54410
  namespace,
53943
54411
  apiGroup,
53944
54412
  apiVersion,
53945
- typeName,
53946
- entryName,
54413
+ plural,
54414
+ name,
53947
54415
  refetchInterval
53948
54416
  }) => {
53949
54417
  return reactQuery.useQuery({
53950
- queryKey: ["useApiResourceSingle", clusterName, namespace, apiGroup, apiVersion, typeName, entryName],
54418
+ queryKey: ["useApiResourceSingle", cluster, namespace, apiGroup, apiVersion, plural, name],
53951
54419
  queryFn: async () => (await getApiResourceSingle({
53952
- clusterName,
54420
+ cluster,
53953
54421
  namespace,
53954
54422
  apiGroup,
53955
54423
  apiVersion,
53956
- typeName,
53957
- entryName
54424
+ plural,
54425
+ name
53958
54426
  })).data,
53959
54427
  refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
53960
54428
  });
53961
54429
  };
53962
54430
 
53963
54431
  const useBuiltinResources = ({
53964
- clusterName,
54432
+ cluster,
53965
54433
  namespace,
53966
- typeName,
53967
- specificName,
54434
+ plural,
54435
+ name,
53968
54436
  labels,
53969
54437
  fields,
53970
54438
  limit,
@@ -53972,13 +54440,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53972
54440
  isEnabled
53973
54441
  }) => {
53974
54442
  return reactQuery.useQuery({
53975
- queryKey: ["useBuiltinResourceType", clusterName, namespace, typeName, specificName, labels, fields, limit],
54443
+ queryKey: ["useBuiltinResourceType", cluster, namespace, plural, name, labels, fields, limit],
53976
54444
  queryFn: async () => {
53977
54445
  const response = await getBuiltinResources({
53978
- clusterName,
54446
+ cluster,
53979
54447
  namespace,
53980
- typeName,
53981
- specificName,
54448
+ plural,
54449
+ name,
53982
54450
  labels,
53983
54451
  fields,
53984
54452
  limit
@@ -53994,21 +54462,21 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53994
54462
  });
53995
54463
  };
53996
54464
  const useBuiltinResourceSingle = ({
53997
- clusterName,
54465
+ cluster,
53998
54466
  namespace,
53999
- typeName,
54000
- entryName,
54467
+ plural,
54468
+ name,
54001
54469
  refetchInterval
54002
54470
  }) => {
54003
54471
  return reactQuery.useQuery({
54004
- queryKey: ["useBuiltinResourceSingle", clusterName, namespace, typeName, entryName],
54005
- queryFn: async () => (await getBuiltinResourceSingle({ clusterName, namespace, typeName, entryName })).data,
54472
+ queryKey: ["useBuiltinResourceSingle", cluster, namespace, plural, name],
54473
+ queryFn: async () => (await getBuiltinResourceSingle({ cluster, namespace, plural, name })).data,
54006
54474
  refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
54007
54475
  });
54008
54476
  };
54009
54477
 
54010
54478
  const useCrdResources = ({
54011
- clusterName,
54479
+ cluster,
54012
54480
  namespace,
54013
54481
  apiGroup,
54014
54482
  apiVersion,
@@ -54017,10 +54485,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54017
54485
  isEnabled
54018
54486
  }) => {
54019
54487
  return reactQuery.useQuery({
54020
- queryKey: ["useCrdResources", clusterName, namespace, apiGroup, apiVersion, crdName],
54488
+ queryKey: ["useCrdResources", cluster, namespace, apiGroup, apiVersion, crdName],
54021
54489
  queryFn: async () => {
54022
54490
  const response = await getCrdResources({
54023
- clusterName,
54491
+ cluster,
54024
54492
  namespace,
54025
54493
  apiGroup,
54026
54494
  apiVersion,
@@ -54037,33 +54505,33 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54037
54505
  });
54038
54506
  };
54039
54507
  const useCrdResourceSingle = ({
54040
- clusterName,
54508
+ cluster,
54041
54509
  namespace,
54042
54510
  apiGroup,
54043
54511
  apiVersion,
54044
54512
  crdName,
54045
- entryName,
54513
+ name,
54046
54514
  refetchInterval
54047
54515
  }) => {
54048
54516
  return reactQuery.useQuery({
54049
- queryKey: ["useCrdResourceSingle", clusterName, namespace, apiGroup, apiVersion, crdName, entryName],
54517
+ queryKey: ["useCrdResourceSingle", cluster, namespace, apiGroup, apiVersion, crdName, name],
54050
54518
  queryFn: async () => (await getCrdResourceSingle({
54051
- clusterName,
54519
+ cluster,
54052
54520
  namespace,
54053
54521
  apiGroup,
54054
54522
  apiVersion,
54055
54523
  crdName,
54056
- entryName
54524
+ name
54057
54525
  })).data,
54058
54526
  refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
54059
54527
  });
54060
54528
  };
54061
54529
 
54062
- const useApisResourceTypes = ({ clusterName }) => {
54530
+ const useApisResourceTypes = ({ cluster }) => {
54063
54531
  return reactQuery.useQuery({
54064
- queryKey: ["useApisResourceTypes", clusterName],
54532
+ queryKey: ["useApisResourceTypes", cluster],
54065
54533
  queryFn: async () => {
54066
- const response = await getApiResourceTypes({ clusterName });
54534
+ const response = await getApiResourceTypes({ cluster });
54067
54535
  const data = JSON.parse(JSON.stringify(response.data));
54068
54536
  if (data.metadata?.resourceVersion) {
54069
54537
  delete data.metadata.resourceVersion;
@@ -54074,15 +54542,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54074
54542
  });
54075
54543
  };
54076
54544
  const useApiResourceTypesByGroup = ({
54077
- clusterName,
54545
+ cluster,
54078
54546
  apiGroup,
54079
54547
  apiVersion
54080
54548
  }) => {
54081
54549
  return reactQuery.useQuery({
54082
- queryKey: ["useApiResourceTypesByGroup", clusterName, apiGroup, apiVersion],
54550
+ queryKey: ["useApiResourceTypesByGroup", cluster, apiGroup, apiVersion],
54083
54551
  queryFn: async () => {
54084
54552
  const response = await getApiResourceTypesByApiGroup({
54085
- clusterName,
54553
+ cluster,
54086
54554
  apiGroup,
54087
54555
  apiVersion
54088
54556
  });
@@ -54096,11 +54564,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54096
54564
  });
54097
54565
  };
54098
54566
 
54099
- const useBuiltinResourceTypes = ({ clusterName }) => {
54567
+ const useBuiltinResourceTypes = ({ cluster }) => {
54100
54568
  return reactQuery.useQuery({
54101
- queryKey: ["useBuiltinResourceTypes", clusterName],
54569
+ queryKey: ["useBuiltinResourceTypes", cluster],
54102
54570
  queryFn: async () => {
54103
- const response = await getBuiltinResourceTypes({ clusterName });
54571
+ const response = await getBuiltinResourceTypes({ cluster });
54104
54572
  const data = JSON.parse(JSON.stringify(response.data));
54105
54573
  if (data.metadata?.resourceVersion) {
54106
54574
  delete data.metadata.resourceVersion;
@@ -54112,15 +54580,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54112
54580
  };
54113
54581
 
54114
54582
  const useCrdData = ({
54115
- clusterName,
54583
+ cluster,
54116
54584
  apiExtensionVersion,
54117
54585
  crdName
54118
54586
  }) => {
54119
54587
  return reactQuery.useQuery({
54120
- queryKey: ["useCrdData", clusterName, apiExtensionVersion, crdName],
54588
+ queryKey: ["useCrdData", cluster, apiExtensionVersion, crdName],
54121
54589
  queryFn: async () => {
54122
54590
  const response = await getCrdData({
54123
- clusterName,
54591
+ cluster,
54124
54592
  apiExtensionVersion,
54125
54593
  crdName
54126
54594
  });
@@ -54271,7 +54739,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54271
54739
  exports.useK8sSmartResource = useK8sSmartResource;
54272
54740
  exports.useK8sVerbs = useK8sVerbs;
54273
54741
  exports.useListWatch = useListWatch;
54742
+ exports.useManyK8sSmartResource = useManyK8sSmartResource;
54274
54743
  exports.usePermissions = usePermissions;
54744
+ exports.useSmartResourceParams = useSmartResourceParams;
54275
54745
 
54276
54746
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
54277
54747