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

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 (64) hide show
  1. package/dist/openapi-k8s-toolkit.es.js +1909 -1460
  2. package/dist/openapi-k8s-toolkit.es.js.map +1 -1
  3. package/dist/openapi-k8s-toolkit.umd.js +1908 -1457
  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/types.d.ts +63 -18
  42. package/dist/types/hooks/useApiResource.d.ts +8 -8
  43. package/dist/types/hooks/useApisResourceTypes.d.ts +4 -4
  44. package/dist/types/hooks/useBuiltinResource.d.ts +8 -8
  45. package/dist/types/hooks/useBuiltinResourceTypes.d.ts +2 -2
  46. package/dist/types/hooks/useCrdData.d.ts +2 -2
  47. package/dist/types/hooks/useCrdResource.d.ts +5 -5
  48. package/dist/types/hooks/useK8sSmartResource/index.d.ts +4 -0
  49. package/dist/types/hooks/useK8sSmartResource/useK8sSmartResource.d.ts +28 -0
  50. package/dist/types/hooks/{useK8sSmartResource.d.ts → useK8sSmartResource/useK8sSmartResourceWithoutKinds.d.ts} +4 -4
  51. package/dist/types/hooks/useK8sSmartResource/useManyK8sSmartResource.d.ts +17 -0
  52. package/dist/types/hooks/useK8sSmartResource/useSmartResourceParams.d.ts +9 -0
  53. package/dist/types/hooks/usePermissions.d.ts +4 -4
  54. package/dist/types/index.d.ts +1 -1
  55. package/dist/types/localTypes/bff/form.d.ts +5 -5
  56. package/dist/types/localTypes/bff/scopes.d.ts +6 -6
  57. package/dist/types/localTypes/bff/table.d.ts +2 -2
  58. package/dist/types/localTypes/form.d.ts +2 -2
  59. package/dist/types/localTypes/marketplace.d.ts +1 -1
  60. package/dist/types/utils/getGroupsByCategory/getGroupsByCategory.d.ts +2 -2
  61. package/dist/types/utils/tableLocations/tableLocations.d.ts +5 -5
  62. package/package.json +1 -1
  63. /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/index.d.ts +0 -0
  64. /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
  }
@@ -33985,7 +34182,7 @@
33985
34182
  if (jsonRoot === void 0 && customFallback) {
33986
34183
  return customFallback;
33987
34184
  }
33988
- const results = jp.query(jsonRoot, `$${jsonPathExpr}`);
34185
+ const results = jp.query(jsonRoot || {}, `$${jsonPathExpr}`);
33989
34186
  if (results.length === 0 || results[0] == null || results[0] === void 0) {
33990
34187
  if (customFallback) {
33991
34188
  return customFallback;
@@ -34178,21 +34375,15 @@
34178
34375
  data,
34179
34376
  children
34180
34377
  }) => {
34181
- const { id, clusterNamePartOfUrl, namespacePartOfUrl, accessGroups, ...props } = data;
34378
+ const { id, cluster, namespace, accessGroups, ...props } = data;
34182
34379
  const { data: multiQueryData, isError, errors } = useMultiQuery();
34183
34380
  const partsOfUrl = usePartsOfUrl();
34184
34381
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
34185
34382
  acc[index.toString()] = value;
34186
34383
  return acc;
34187
34384
  }, {});
34188
- const clusterName = prepareTemplate({
34189
- template: clusterNamePartOfUrl,
34190
- replaceValues
34191
- });
34192
- const namespace = prepareTemplate({
34193
- template: namespacePartOfUrl,
34194
- replaceValues
34195
- });
34385
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34386
+ const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
34196
34387
  const parsedAccessGroups = accessGroups.map(
34197
34388
  (accessGroup) => parseAll({ text: accessGroup, replaceValues, multiQueryData })
34198
34389
  );
@@ -34202,7 +34393,7 @@
34202
34393
  /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34203
34394
  ] });
34204
34395
  }
34205
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ProjectInfoCard, { clusterName, namespace, accessGroups: parsedAccessGroups, ...props, children });
34396
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ProjectInfoCard, { cluster: clusterPrepared, namespace: namespacePrepared, accessGroups: parsedAccessGroups, ...props, children });
34206
34397
  };
34207
34398
 
34208
34399
  const MarketplaceCard$1 = ({
@@ -34210,21 +34401,22 @@
34210
34401
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
34211
34402
  children
34212
34403
  }) => {
34213
- const { id, clusterNamePartOfUrl, namespacePartOfUrl, ...props } = data;
34404
+ const { id, cluster, namespace, ...props } = data;
34405
+ const { data: multiQueryData, isError, errors } = useMultiQuery();
34214
34406
  const partsOfUrl = usePartsOfUrl();
34215
34407
  const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
34216
34408
  acc[index.toString()] = value;
34217
34409
  return acc;
34218
34410
  }, {});
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 });
34411
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34412
+ const namespacePrepared = parseAll({ text: namespace, replaceValues, multiQueryData });
34413
+ if (isError) {
34414
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
34415
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
34416
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
34417
+ ] });
34418
+ }
34419
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MarketPlace, { cluster: clusterPrepared, namespace: namespacePrepared, ...props });
34228
34420
  };
34229
34421
 
34230
34422
  const ContentCard = ({
@@ -34352,7 +34544,7 @@
34352
34544
  };
34353
34545
 
34354
34546
  const checkPermission = async ({
34355
- clusterName,
34547
+ cluster,
34356
34548
  body
34357
34549
  }) => {
34358
34550
  const data = JSON.stringify({
@@ -34360,15 +34552,15 @@
34360
34552
  kind: "SelfSubjectAccessReview",
34361
34553
  spec: {
34362
34554
  resourceAttributes: {
34363
- ...body.group ? { group: body.group } : {},
34364
- resource: body.resource,
34555
+ ...body.apiGroup ? { group: body.apiGroup } : {},
34556
+ resource: body.plural,
34365
34557
  verb: body.verb,
34366
34558
  ...body.namespace ? { namespace: body.namespace } : {},
34367
34559
  ...body.name ? { name: body.name } : {}
34368
34560
  }
34369
34561
  }
34370
34562
  });
34371
- return axios.post(`/api/clusters/${clusterName}/k8s/apis/authorization.k8s.io/v1/selfsubjectaccessreviews`, data, {
34563
+ return axios.post(`/api/clusters/${cluster}/k8s/apis/authorization.k8s.io/v1/selfsubjectaccessreviews`, data, {
34372
34564
  method: "POST",
34373
34565
  headers: {
34374
34566
  "Content-Type": "application/json"
@@ -34377,23 +34569,23 @@
34377
34569
  };
34378
34570
 
34379
34571
  const usePermissions = ({
34380
- clusterName,
34572
+ cluster,
34381
34573
  namespace,
34382
- group,
34383
- resource,
34574
+ apiGroup,
34575
+ plural,
34384
34576
  verb,
34385
34577
  name,
34386
34578
  refetchInterval,
34387
34579
  enabler
34388
34580
  }) => {
34389
34581
  return reactQuery.useQuery({
34390
- queryKey: ["usePermissions", clusterName, namespace, group, resource, verb, name],
34582
+ queryKey: ["usePermissions", cluster, namespace, apiGroup, plural, verb, name],
34391
34583
  queryFn: async () => (await checkPermission({
34392
- clusterName,
34584
+ cluster,
34393
34585
  body: {
34394
34586
  namespace,
34395
- group,
34396
- resource,
34587
+ apiGroup,
34588
+ plural,
34397
34589
  verb
34398
34590
  }
34399
34591
  })).data,
@@ -34410,7 +34602,7 @@
34410
34602
  baseprefix,
34411
34603
  namespace,
34412
34604
  syntheticProject,
34413
- typeName,
34605
+ plural,
34414
34606
  inside,
34415
34607
  fullPath
34416
34608
  }) => {
@@ -34419,7 +34611,7 @@
34419
34611
  const backlink = getBackLinkToTable({
34420
34612
  fullPath
34421
34613
  });
34422
- return `${mainRoute}/forms/builtin/v1/${typeName}?backlink=${backlink}`;
34614
+ return `${mainRoute}/forms/builtin/v1/${plural}?backlink=${backlink}`;
34423
34615
  };
34424
34616
  const getLinkToApiForm = ({
34425
34617
  cluster,
@@ -34428,7 +34620,7 @@
34428
34620
  syntheticProject,
34429
34621
  apiGroup,
34430
34622
  apiVersion,
34431
- typeName,
34623
+ plural,
34432
34624
  inside,
34433
34625
  fullPath
34434
34626
  }) => {
@@ -34437,7 +34629,7 @@
34437
34629
  const backlink = getBackLinkToTable({
34438
34630
  fullPath
34439
34631
  });
34440
- return `${mainRoute}/forms/apis/${apiGroup}/${apiVersion}/${typeName}?backlink=${backlink}`;
34632
+ return `${mainRoute}/forms/apis/${apiGroup}/${apiVersion}/${plural}?backlink=${backlink}`;
34441
34633
  };
34442
34634
  const getLinkToForm = ({
34443
34635
  apiGroup,
@@ -34484,7 +34676,8 @@
34484
34676
  fetchUrl,
34485
34677
  k8sResourceToFetch,
34486
34678
  pathToItems,
34487
- clusterNamePartOfUrl,
34679
+ additionalReqsDataToEachItem,
34680
+ cluster,
34488
34681
  labelSelector,
34489
34682
  labelSelectorFull,
34490
34683
  fieldSelector,
@@ -34500,36 +34693,33 @@
34500
34693
  acc[index.toString()] = value;
34501
34694
  return acc;
34502
34695
  }, {});
34503
- const clusterName = prepareTemplate({
34504
- template: clusterNamePartOfUrl,
34505
- replaceValues
34506
- });
34696
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34507
34697
  const namespacePrepared = namespace ? parseAll({ text: namespace, replaceValues, multiQueryData }) : void 0;
34508
34698
  const k8sResourcePrePrepared = k8sResource ? {
34509
34699
  apiGroup: k8sResource.apiGroup ? parseAll({ text: k8sResource.apiGroup, replaceValues, multiQueryData }) : void 0,
34510
34700
  apiVersion: parseAll({ text: k8sResource.apiVersion, replaceValues, multiQueryData }),
34511
- resource: parseAll({ text: k8sResource.resource, replaceValues, multiQueryData })
34701
+ plural: parseAll({ text: k8sResource.plural, replaceValues, multiQueryData })
34512
34702
  } : void 0;
34513
- const k8sResourcePrepared = k8sResourcePrePrepared?.apiGroup === "-" ? { apiVersion: k8sResourcePrePrepared.apiVersion, resource: k8sResourcePrePrepared.resource } : k8sResourcePrePrepared;
34703
+ const k8sResourcePrepared = k8sResourcePrePrepared?.apiGroup === "-" ? { apiVersion: k8sResourcePrePrepared.apiVersion, plural: k8sResourcePrePrepared.plural } : k8sResourcePrePrepared;
34514
34704
  const dataForControlsPrepared = dataForControls ? {
34515
- cluster: clusterName,
34705
+ cluster: clusterPrepared,
34516
34706
  syntheticProject: dataForControls.syntheticProject ? parseAll({ text: dataForControls.syntheticProject, replaceValues, multiQueryData }) : void 0,
34517
- resource: parseAll({ text: dataForControls.resource, replaceValues, multiQueryData }),
34707
+ plural: parseAll({ text: dataForControls.plural, replaceValues, multiQueryData }),
34518
34708
  apiGroup: dataForControls.apiGroup ? parseAll({ text: dataForControls.apiGroup, replaceValues, multiQueryData }) : void 0,
34519
34709
  apiVersion: parseAll({ text: dataForControls.apiVersion, replaceValues, multiQueryData })
34520
34710
  } : void 0;
34521
34711
  const createPermission = usePermissions({
34522
- group: dataForControlsPrepared?.apiGroup,
34523
- resource: dataForControlsPrepared?.resource || "",
34712
+ apiGroup: dataForControlsPrepared?.apiGroup,
34713
+ plural: dataForControlsPrepared?.plural || "",
34524
34714
  namespace: namespacePrepared,
34525
- clusterName,
34715
+ cluster: clusterPrepared,
34526
34716
  verb: "create",
34527
34717
  refetchInterval: false
34528
34718
  });
34529
34719
  const fetchUrlPrepared = fetchUrl ? parseAll({ text: fetchUrl, replaceValues, multiQueryData }) : void 0;
34530
34720
  const k8sResourceToFetchPrepared = k8sResourceToFetch ? {
34531
- group: k8sResourceToFetch.group ? parseAll({ text: k8sResourceToFetch.group, replaceValues, multiQueryData }) : void 0,
34532
- version: parseAll({ text: k8sResourceToFetch.version, replaceValues, multiQueryData }),
34721
+ apiGroup: k8sResourceToFetch.apiGroup ? parseAll({ text: k8sResourceToFetch.apiGroup, replaceValues, multiQueryData }) : void 0,
34722
+ apiVersion: parseAll({ text: k8sResourceToFetch.apiVersion, replaceValues, multiQueryData }),
34533
34723
  plural: parseAll({ text: k8sResourceToFetch.plural, replaceValues, multiQueryData }),
34534
34724
  namespace: k8sResourceToFetch.namespace ? parseAll({ text: k8sResourceToFetch.namespace, replaceValues, multiQueryData }) : void 0
34535
34725
  } : void 0;
@@ -34545,7 +34735,7 @@
34545
34735
  }
34546
34736
  if (labelSelectorFull) {
34547
34737
  const root = multiQueryData[`req${labelSelectorFull.reqIndex}`];
34548
- const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root, labelSelectorFull.pathToLabels) : jp.query(root, `$${labelSelectorFull.pathToLabels}`)[0];
34738
+ const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root || {}, labelSelectorFull.pathToLabels) : jp.query(root || {}, `$${labelSelectorFull.pathToLabels}`)[0];
34549
34739
  const serializedLabels = serializeLabelsWithNoEncoding$1(value);
34550
34740
  if (serializedLabels.length > 0) sParams.set("labelSelector", serializedLabels);
34551
34741
  }
@@ -34576,10 +34766,10 @@
34576
34766
  isLoading: isFetchedDataSocketLoading,
34577
34767
  error: fetchedDataSocketError
34578
34768
  } = useK8sSmartResource({
34579
- cluster: clusterName || "",
34769
+ cluster: clusterPrepared || "",
34580
34770
  namespace: k8sResourceToFetchPrepared?.namespace,
34581
- group: k8sResourceToFetchPrepared?.group,
34582
- version: k8sResourceToFetchPrepared?.version || "",
34771
+ apiGroup: k8sResourceToFetchPrepared?.apiGroup,
34772
+ apiVersion: k8sResourceToFetchPrepared?.apiVersion || "",
34583
34773
  plural: k8sResourceToFetchPrepared?.plural || "",
34584
34774
  fieldSelector: sParams.get("fieldSelector") || void 0,
34585
34775
  labelSelector: sParams.get("labelSelector") || void 0,
@@ -34609,14 +34799,20 @@
34609
34799
  JSON.stringify(fetchedDataError)
34610
34800
  ] });
34611
34801
  }
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
- ] });
34802
+ const dataFromOneOfHooks = fetchedData || fetchedDataSocket || {};
34803
+ const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks || {}, pathToItems) : jp.query(dataFromOneOfHooks || {}, `$${pathToItems}`)[0];
34804
+ const itemsAlwaysArr = Array.isArray(items) ? items : [];
34805
+ let additionalReqsData = [];
34806
+ if (additionalReqsDataToEachItem) {
34807
+ additionalReqsDataToEachItem.forEach((item) => {
34808
+ additionalReqsData?.push(multiQueryData[`req${item}`]);
34809
+ });
34619
34810
  }
34811
+ additionalReqsData = additionalReqsData.length > 0 ? additionalReqsData : void 0;
34812
+ const itemsAlwaysArrWithAdditionalData = itemsAlwaysArr.map((el) => ({
34813
+ ...el,
34814
+ ...additionalReqsData ? { additionalReqsData } : {}
34815
+ }));
34620
34816
  const clearSelected = () => {
34621
34817
  setSelectedRowKeys([]);
34622
34818
  setSelectedRowsData([]);
@@ -34630,10 +34826,10 @@
34630
34826
  EnrichedTableProvider,
34631
34827
  {
34632
34828
  tableMappingsReplaceValues: replaceValues,
34633
- cluster: clusterName,
34829
+ cluster: clusterPrepared,
34634
34830
  namespace: namespacePrepared,
34635
34831
  theme,
34636
- dataItems: items,
34832
+ dataItems: itemsAlwaysArrWithAdditionalData,
34637
34833
  tableProps: {
34638
34834
  borderless: true,
34639
34835
  paginationPosition: ["bottomRight"],
@@ -34664,13 +34860,13 @@
34664
34860
  type: "primary",
34665
34861
  onClick: () => {
34666
34862
  const url = getLinkToForm({
34667
- cluster: clusterName,
34863
+ cluster: clusterPrepared,
34668
34864
  baseprefix,
34669
34865
  namespace: namespacePrepared,
34670
34866
  syntheticProject: params.syntheticProject,
34671
34867
  apiGroup: dataForControlsPrepared.apiGroup,
34672
34868
  apiVersion: dataForControlsPrepared.apiVersion,
34673
- typeName: dataForControlsPrepared.resource,
34869
+ plural: dataForControlsPrepared.plural,
34674
34870
  fullPath
34675
34871
  });
34676
34872
  navigate(url);
@@ -34751,7 +34947,7 @@
34751
34947
  } = useK8sSmartResource({
34752
34948
  cluster: clusterPrepared,
34753
34949
  namespace: namespacePrepared,
34754
- version: "v1",
34950
+ apiVersion: "v1",
34755
34951
  plural: "pods",
34756
34952
  fieldSelector: `metadata.name=${podNamePrepared}`,
34757
34953
  isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
@@ -34870,7 +35066,7 @@
34870
35066
  } = useK8sSmartResource({
34871
35067
  cluster: clusterPrepared,
34872
35068
  namespace: namespacePrepared,
34873
- version: "v1",
35069
+ apiVersion: "v1",
34874
35070
  plural: "pods",
34875
35071
  fieldSelector: `metadata.name=${podNamePrepared}`,
34876
35072
  isEnabled: clusterPrepared !== void 0 && namespacePrepared !== void 0 && podNamePrepared !== void 0
@@ -34915,7 +35111,7 @@
34915
35111
  prefillValuesRaw,
34916
35112
  pathToData
34917
35113
  }) => {
34918
- return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw, pathToData) : jp.query(prefillValuesRaw, `$${pathToData}`)[0];
35114
+ return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw || {}, pathToData) : jp.query(prefillValuesRaw || {}, `$${pathToData}`)[0];
34919
35115
  };
34920
35116
  const getPrefillValuesWithForces = ({
34921
35117
  prefillValues,
@@ -34956,7 +35152,7 @@
34956
35152
  type,
34957
35153
  apiGroup,
34958
35154
  apiVersion,
34959
- typeName,
35155
+ plural,
34960
35156
  forcedKind,
34961
35157
  prefillValuesRequestIndex,
34962
35158
  pathToData,
@@ -34984,7 +35180,7 @@
34984
35180
  const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
34985
35181
  const apiGroupPrepared = apiGroup ? parseAll({ text: apiGroup, replaceValues, multiQueryData }) : "no-api-group";
34986
35182
  const apiVersionPrepared = apiVersion ? parseAll({ text: apiVersion, replaceValues, multiQueryData }) : "no-api-version";
34987
- const typeNamePrepared = parseAll({ text: typeName, replaceValues, multiQueryData });
35183
+ const pluralPrepared = parseAll({ text: plural, replaceValues, multiQueryData });
34988
35184
  const prefillValuesRaw = multiQueryData[`req${prefillValuesRequestIndex}`];
34989
35185
  const prefillValues = pathToData ? getDataByPath({ prefillValuesRaw, pathToData }) : prefillValuesRaw;
34990
35186
  const prefillValuesWithForces = getPrefillValuesWithForces({ prefillValues, forcedKind, apiGroup, apiVersion });
@@ -35002,7 +35198,7 @@
35002
35198
  isCreate: false,
35003
35199
  type,
35004
35200
  apiGroupApiVersion: type === "builtin" ? "api/v1" : `${apiGroupPrepared}/${apiVersionPrepared}`,
35005
- typeName: typeNamePrepared,
35201
+ plural: pluralPrepared,
35006
35202
  designNewLayout: true,
35007
35203
  designNewLayoutHeight: height,
35008
35204
  openNotification: true,
@@ -35103,7 +35299,7 @@
35103
35299
  if (jsonRoot === void 0) {
35104
35300
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
35105
35301
  }
35106
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
35302
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
35107
35303
  const { data: arrayOfObjects, error: errorArrayOfObjects } = parseArrayOfAny$2(anythingForNow);
35108
35304
  if (!arrayOfObjects) {
35109
35305
  if (errorArrayOfObjects) {
@@ -35175,7 +35371,7 @@
35175
35371
  console.log(`Item Counter: ${id}: No root for json path`);
35176
35372
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
35177
35373
  }
35178
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
35374
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
35179
35375
  const { counter, error: errorArrayOfObjects } = getItemsInside$4(anythingForNow);
35180
35376
  if (errorArrayOfObjects) {
35181
35377
  console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
@@ -35232,7 +35428,7 @@
35232
35428
  console.log(`Key Counter: ${id}: No root for json path`);
35233
35429
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
35234
35430
  }
35235
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
35431
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
35236
35432
  const { counter, error: errorArrayOfObjects } = getItemsInside$3(anythingForNow);
35237
35433
  if (errorArrayOfObjects) {
35238
35434
  console.log(`Key Counter: ${id}: ${errorArrayOfObjects}`);
@@ -35612,7 +35808,7 @@
35612
35808
  if (jsonRoot === void 0) {
35613
35809
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
35614
35810
  }
35615
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
35811
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToLabels}`);
35616
35812
  const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny$1(anythingForNow);
35617
35813
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
35618
35814
  text: notificationSuccessMessage,
@@ -35887,7 +36083,7 @@
35887
36083
  if (jsonRoot === void 0) {
35888
36084
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
35889
36085
  }
35890
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToLabels}`);
36086
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToLabels}`);
35891
36087
  const { data: labelsRaw, error: errorArrayOfObjects } = parseArrayOfAny(anythingForNow);
35892
36088
  const linkPrefixPrepared = parseAll({ text: linkPrefix, replaceValues, multiQueryData });
35893
36089
  if (!labelsRaw) {
@@ -36157,7 +36353,7 @@
36157
36353
  console.log(`Item Counter: ${id}: No root for json path`);
36158
36354
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
36159
36355
  }
36160
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
36356
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
36161
36357
  const { counter, taints, error: errorArrayOfObjects } = getItemsInside$2(anythingForNow);
36162
36358
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
36163
36359
  text: notificationSuccessMessage,
@@ -36535,7 +36731,7 @@
36535
36731
  console.log(`Item Counter: ${id}: No root for json path`);
36536
36732
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
36537
36733
  }
36538
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToArray}`);
36734
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
36539
36735
  const { counter, tolerations, error: errorArrayOfObjects } = getItemsInside$1(anythingForNow);
36540
36736
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
36541
36737
  text: notificationSuccessMessage,
@@ -36816,7 +37012,7 @@
36816
37012
  console.log(`Item Counter: ${id}: No root for json path`);
36817
37013
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
36818
37014
  }
36819
- const anythingForNow = jp.query(jsonRoot, `$${jsonPathToObj}`);
37015
+ const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
36820
37016
  const { counter, annotations, error: errorArrayOfObjects } = getItemsInside(anythingForNow);
36821
37017
  const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
36822
37018
  text: notificationSuccessMessage,
@@ -37989,7 +38185,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
37989
38185
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
37990
38186
  id,
37991
38187
  baseprefix,
37992
- clusterNamePartOfUrl,
38188
+ cluster,
37993
38189
  wsUrl,
37994
38190
  pageSize,
37995
38191
  substractHeight,
@@ -38002,8 +38198,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38002
38198
  baseFactoryNamespacedBuiltinKey,
38003
38199
  baseFactoryClusterSceopedBuiltinKey,
38004
38200
  baseNamespaceFactoryKey,
38005
- baseNavigationPluralName,
38006
- baseNavigationSpecificName,
38201
+ baseNavigationPlural,
38202
+ baseNavigationName,
38007
38203
  ...props
38008
38204
  } = data;
38009
38205
  const theme = useTheme();
@@ -38012,10 +38208,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38012
38208
  acc[index.toString()] = value;
38013
38209
  return acc;
38014
38210
  }, {});
38015
- const clusterName = prepareTemplate({
38016
- template: clusterNamePartOfUrl,
38017
- replaceValues
38018
- });
38211
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
38019
38212
  const wsUrlPrepared = parseAll({ text: wsUrl, replaceValues, multiQueryData });
38020
38213
  const params = new URLSearchParams();
38021
38214
  if (limit) {
@@ -38032,7 +38225,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38032
38225
  }
38033
38226
  if (labelSelectorFull) {
38034
38227
  const root = multiQueryData[`req${labelSelectorFull.reqIndex}`];
38035
- const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root, labelSelectorFull.pathToLabels) : jp.query(root, `$${labelSelectorFull.pathToLabels}`)[0];
38228
+ const value = Array.isArray(labelSelectorFull.pathToLabels) ? _$1.get(root || {}, labelSelectorFull.pathToLabels) : jp.query(root || {}, `$${labelSelectorFull.pathToLabels}`)[0];
38036
38229
  const serializedLabels = serializeLabelsWithNoEncoding(value);
38037
38230
  if (serializedLabels.length > 0) params.set("labelSelector", serializedLabels);
38038
38231
  }
@@ -38059,7 +38252,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38059
38252
  {
38060
38253
  theme,
38061
38254
  baseprefix,
38062
- cluster: clusterName,
38255
+ cluster: clusterPrepared,
38063
38256
  wsUrl: wsUrlWithParams,
38064
38257
  pageSize,
38065
38258
  substractHeight: substractHeight || 340,
@@ -38068,8 +38261,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38068
38261
  baseFactoryNamespacedBuiltinKey,
38069
38262
  baseFactoryClusterSceopedBuiltinKey,
38070
38263
  baseNamespaceFactoryKey,
38071
- baseNavigationPluralName,
38072
- baseNavigationSpecificName,
38264
+ baseNavigationPlural,
38265
+ baseNavigationName,
38073
38266
  ...props
38074
38267
  }
38075
38268
  ),
@@ -38077,55 +38270,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38077
38270
  ] });
38078
38271
  };
38079
38272
 
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
38273
  const parseApiVersion = (apiVersion) => {
38130
38274
  const parts = apiVersion.trim().split("/");
38131
38275
  return parts.length === 1 ? { group: "", version: parts[0] } : { group: parts[0], version: parts[1] };
@@ -38201,6 +38345,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38201
38345
  forcedRelatedValuePath,
38202
38346
  rawObjectToFindLabel,
38203
38347
  jsonPathToArrayOfRefs,
38348
+ forcedNamespace,
38204
38349
  theme,
38205
38350
  baseprefix,
38206
38351
  cluster,
@@ -38212,8 +38357,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38212
38357
  baseFactoriesMapping
38213
38358
  }) => {
38214
38359
  let forcedName;
38360
+ let objectNamespace;
38215
38361
  if (keysToForcedLabel && rawObjectToFindLabel) {
38216
- forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel, keysToForcedLabel) : jp.query(rawObjectToFindLabel, `$${keysToForcedLabel}`)[0];
38362
+ forcedName = Array.isArray(keysToForcedLabel) ? _$1.get(rawObjectToFindLabel || {}, keysToForcedLabel) : jp.query(rawObjectToFindLabel || {}, `$${keysToForcedLabel}`)[0];
38217
38363
  }
38218
38364
  if (forcedRelatedValuePath && rawObjectToFindLabel) {
38219
38365
  try {
@@ -38225,17 +38371,25 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38225
38371
  );
38226
38372
  const relatedPath = forcedRelatedValuePath && ownerRefPathSegs ? resolveFormPath$1(forcedRelatedValuePath, ownerRefPathSegs) : void 0;
38227
38373
  if (relatedPath) {
38228
- forcedName = _$1.get(rawObjectToFindLabel, relatedPath);
38374
+ forcedName = _$1.get(rawObjectToFindLabel || {}, relatedPath);
38229
38375
  }
38230
38376
  } catch {
38231
38377
  }
38232
38378
  }
38379
+ if (rawObjectToFindLabel) {
38380
+ try {
38381
+ const defaultFetched = _$1.get(rawObjectToFindLabel || {}, ["metadata", "namespace"]);
38382
+ const socketFetched = _$1.get(rawObjectToFindLabel || {}, ["items", 0, "metadata", "namespace"]);
38383
+ objectNamespace = socketFetched || defaultFetched;
38384
+ } catch {
38385
+ }
38386
+ }
38233
38387
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
38234
38388
  ResourceLink,
38235
38389
  {
38236
38390
  kind: reference.kind,
38237
38391
  apiVersion: reference.apiVersion,
38238
- namespace: reference.namespace,
38392
+ namespace: forcedNamespace || reference.namespace || objectNamespace,
38239
38393
  forcedName,
38240
38394
  name: reference.name,
38241
38395
  theme,
@@ -38260,18 +38414,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38260
38414
  forcedRelatedValuePath,
38261
38415
  rawObjectToFindLabel,
38262
38416
  jsonPathToArrayOfRefs,
38417
+ forcedNamespace,
38263
38418
  baseFactoryNamespacedAPIKey,
38264
38419
  baseFactoryClusterSceopedAPIKey,
38265
38420
  baseFactoryNamespacedBuiltinKey,
38266
38421
  baseFactoryClusterSceopedBuiltinKey,
38267
- baseNavigationPluralName,
38268
- baseNavigationSpecificName,
38422
+ baseNavigationPlural,
38423
+ baseNavigationName,
38269
38424
  listFlexProps
38270
38425
  }) => {
38271
38426
  const [kindIndex, setKindIndex] = K.useState();
38272
38427
  const [kindsWithVersion, setKindWithVersion] = K.useState();
38273
38428
  K.useEffect(() => {
38274
- getKinds({ clusterName: cluster }).then((data) => {
38429
+ getKinds({ cluster }).then((data) => {
38275
38430
  setKindIndex(data);
38276
38431
  setKindWithVersion(getSortedKindsAll(data));
38277
38432
  }).catch((error) => {
@@ -38280,10 +38435,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38280
38435
  }, [cluster]);
38281
38436
  const { data: navigationDataArr } = useK8sSmartResource({
38282
38437
  cluster,
38283
- group: "front.in-cloud.io",
38284
- version: "v1alpha1",
38285
- plural: baseNavigationPluralName,
38286
- fieldSelector: `metadata.name=${baseNavigationSpecificName}`
38438
+ apiGroup: "front.in-cloud.io",
38439
+ apiVersion: "v1alpha1",
38440
+ plural: baseNavigationPlural,
38441
+ fieldSelector: `metadata.name=${baseNavigationName}`
38287
38442
  });
38288
38443
  const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
38289
38444
  const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
@@ -38295,6 +38450,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38295
38450
  forcedRelatedValuePath,
38296
38451
  rawObjectToFindLabel,
38297
38452
  jsonPathToArrayOfRefs,
38453
+ forcedNamespace,
38298
38454
  theme,
38299
38455
  baseprefix,
38300
38456
  cluster,
@@ -38332,7 +38488,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38332
38488
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
38333
38489
  id,
38334
38490
  baseprefix,
38335
- clusterNamePartOfUrl,
38491
+ cluster,
38336
38492
  reqIndex,
38337
38493
  errorText,
38338
38494
  notArrayErrorText,
@@ -38343,12 +38499,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38343
38499
  keysToForcedLabel,
38344
38500
  forcedRelatedValuePath,
38345
38501
  jsonPathToArrayOfRefs,
38502
+ forcedApiVersion,
38503
+ forcedNamespace,
38346
38504
  baseFactoryNamespacedAPIKey,
38347
38505
  baseFactoryClusterSceopedAPIKey,
38348
38506
  baseFactoryNamespacedBuiltinKey,
38349
38507
  baseFactoryClusterSceopedBuiltinKey,
38350
- baseNavigationPluralName,
38351
- baseNavigationSpecificName,
38508
+ baseNavigationPlural,
38509
+ baseNavigationName,
38352
38510
  ...props
38353
38511
  } = data;
38354
38512
  const theme = useTheme();
@@ -38357,25 +38515,43 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38357
38515
  acc[index.toString()] = value;
38358
38516
  return acc;
38359
38517
  }, {});
38360
- const clusterName = prepareTemplate({
38361
- template: clusterNamePartOfUrl,
38518
+ const clusterPrepared = parseAll({ text: cluster, replaceValues, multiQueryData });
38519
+ const preparedForcedApiVersion = forcedApiVersion ? forcedApiVersion.map(({ kind, apiVersion }) => ({
38520
+ kind: prepareTemplate({
38521
+ template: kind,
38522
+ replaceValues
38523
+ }),
38524
+ apiVersion: prepareTemplate({
38525
+ template: apiVersion,
38526
+ replaceValues
38527
+ })
38528
+ })) : void 0;
38529
+ const preparedForcedNamespace = forcedNamespace ? prepareTemplate({
38530
+ template: forcedNamespace,
38362
38531
  replaceValues
38363
- });
38532
+ }) : void 0;
38364
38533
  const jsonRoot = multiQueryData[`req${reqIndex}`];
38365
38534
  if (jsonRoot === void 0) {
38366
38535
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
38367
38536
  }
38368
- const refsArr = jp.query(jsonRoot, `$${jsonPathToArrayOfRefs}`)[0];
38537
+ const refsArr = jp.query(jsonRoot || {}, `$${jsonPathToArrayOfRefs}`).flat();
38369
38538
  if (!Array.isArray(refsArr)) {
38370
38539
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: notArrayErrorText });
38371
38540
  }
38372
38541
  if (refsArr.length === 0) {
38373
38542
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: emptyArrayErrorText });
38374
38543
  }
38375
- if (refsArr.some((el) => !isOwnerReference(el))) {
38544
+ const refsArrWithForcedApiVersion = refsArr.map((el) => {
38545
+ const forceFound = preparedForcedApiVersion?.find((force) => force.kind === el.kind);
38546
+ if (forceFound) {
38547
+ return { ...el, apiVersion: forceFound.apiVersion };
38548
+ }
38549
+ return el;
38550
+ });
38551
+ if (refsArrWithForcedApiVersion.some((el) => !isOwnerReference(el))) {
38376
38552
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: isNotRefsArrayErrorText });
38377
38553
  }
38378
- const guardedRefsArr = refsArr;
38554
+ const guardedRefsArr = refsArrWithForcedApiVersion;
38379
38555
  if (isMultiqueryLoading) {
38380
38556
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
38381
38557
  }
@@ -38385,18 +38561,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38385
38561
  {
38386
38562
  theme,
38387
38563
  baseprefix,
38388
- cluster: clusterName,
38564
+ cluster: clusterPrepared,
38389
38565
  refsArr: guardedRefsArr,
38390
38566
  keysToForcedLabel,
38391
38567
  forcedRelatedValuePath,
38392
38568
  jsonPathToArrayOfRefs,
38569
+ forcedNamespace: preparedForcedNamespace,
38393
38570
  rawObjectToFindLabel: jsonRoot,
38394
38571
  baseFactoryNamespacedAPIKey,
38395
38572
  baseFactoryClusterSceopedAPIKey,
38396
38573
  baseFactoryNamespacedBuiltinKey,
38397
38574
  baseFactoryClusterSceopedBuiltinKey,
38398
- baseNavigationPluralName,
38399
- baseNavigationSpecificName,
38575
+ baseNavigationPlural,
38576
+ baseNavigationName,
38400
38577
  listFlexProps,
38401
38578
  ...props
38402
38579
  }
@@ -38405,6 +38582,263 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38405
38582
  ] });
38406
38583
  };
38407
38584
 
38585
+ const Toggler = ({ data, children }) => {
38586
+ const {
38587
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38588
+ id,
38589
+ reqIndex,
38590
+ jsonPathToValue,
38591
+ criteria,
38592
+ notificationSuccessMessage,
38593
+ notificationSuccessMessageDescription,
38594
+ notificationErrorMessage,
38595
+ notificationErrorMessageDescription,
38596
+ containerStyle,
38597
+ endpoint,
38598
+ pathToValue,
38599
+ valueToSubmit
38600
+ } = data;
38601
+ const [api, contextHolder] = antd.notification.useNotification();
38602
+ const queryClient = reactQuery.useQueryClient();
38603
+ const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
38604
+ const partsOfUrl = usePartsOfUrl();
38605
+ if (isMultiQueryLoading) {
38606
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
38607
+ }
38608
+ if (isMultiQueryErrors) {
38609
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
38610
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
38611
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
38612
+ ] });
38613
+ }
38614
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
38615
+ acc[index.toString()] = value;
38616
+ return acc;
38617
+ }, {});
38618
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
38619
+ if (jsonRoot === void 0) {
38620
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
38621
+ }
38622
+ const valueToCompare = jp.query(jsonRoot || {}, `$${jsonPathToValue}`)[0];
38623
+ let valueToSwitch = false;
38624
+ if (criteria.type === "forSuccess") {
38625
+ if (criteria.operator === "exists") {
38626
+ valueToSwitch = valueToCompare !== void 0;
38627
+ }
38628
+ if (criteria.operator === "equals") {
38629
+ valueToSwitch = String(valueToCompare) === criteria.valueToCompare;
38630
+ }
38631
+ }
38632
+ if (criteria.type === "forError") {
38633
+ if (criteria.operator === "exists") {
38634
+ valueToSwitch = !valueToCompare;
38635
+ }
38636
+ if (criteria.operator === "equals") {
38637
+ valueToSwitch = String(valueToCompare) !== criteria.valueToCompare;
38638
+ }
38639
+ }
38640
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
38641
+ text: notificationSuccessMessage,
38642
+ replaceValues,
38643
+ multiQueryData
38644
+ }) : "Success";
38645
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
38646
+ text: notificationSuccessMessageDescription,
38647
+ replaceValues,
38648
+ multiQueryData
38649
+ }) : "Success";
38650
+ const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
38651
+ text: notificationErrorMessage,
38652
+ replaceValues,
38653
+ multiQueryData
38654
+ }) : "Success";
38655
+ const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
38656
+ text: notificationErrorMessageDescription,
38657
+ replaceValues,
38658
+ multiQueryData
38659
+ }) : "Success";
38660
+ const openNotificationSuccess = () => {
38661
+ api.success({
38662
+ message: notificationSuccessMessagePrepared,
38663
+ description: notificationSuccessMessageDescriptionPrepared,
38664
+ placement: "bottomRight"
38665
+ });
38666
+ };
38667
+ const openNotificationError = () => {
38668
+ api.error({
38669
+ message: notificationErrorMessagePrepared,
38670
+ description: notificationErrorMessageDescriptionPrepared,
38671
+ placement: "bottomRight"
38672
+ });
38673
+ };
38674
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
38675
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
38676
+ const toggleOn = () => {
38677
+ patchEntryWithReplaceOp({
38678
+ endpoint: endpointPrepared,
38679
+ pathToValue: pathToValuePrepared,
38680
+ body: valueToSubmit.onValue
38681
+ }).then(() => {
38682
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38683
+ openNotificationSuccess();
38684
+ }).catch((error) => {
38685
+ openNotificationError();
38686
+ console.error(error);
38687
+ });
38688
+ };
38689
+ const toggleOff = () => {
38690
+ if (valueToSubmit.offValue !== void 0) {
38691
+ patchEntryWithReplaceOp({
38692
+ endpoint: endpointPrepared,
38693
+ pathToValue: pathToValuePrepared,
38694
+ body: valueToSubmit.offValue
38695
+ }).then(() => {
38696
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38697
+ openNotificationSuccess();
38698
+ }).catch((error) => {
38699
+ openNotificationError();
38700
+ console.error(error);
38701
+ });
38702
+ }
38703
+ if (valueToSubmit.toRemoveWhenOff) {
38704
+ patchEntryWithDeleteOp({
38705
+ endpoint: endpointPrepared,
38706
+ pathToValue: pathToValuePrepared
38707
+ }).then(() => {
38708
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38709
+ openNotificationSuccess();
38710
+ }).catch((error) => {
38711
+ openNotificationError();
38712
+ console.error(error);
38713
+ });
38714
+ }
38715
+ };
38716
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
38717
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
38718
+ antd.Switch,
38719
+ {
38720
+ value: valueToSwitch,
38721
+ onChange: (checked) => {
38722
+ if (checked) {
38723
+ toggleOn();
38724
+ } else {
38725
+ toggleOff();
38726
+ }
38727
+ }
38728
+ }
38729
+ ),
38730
+ children,
38731
+ contextHolder
38732
+ ] });
38733
+ };
38734
+
38735
+ const TogglerSegmented = ({
38736
+ data,
38737
+ children
38738
+ }) => {
38739
+ const {
38740
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38741
+ id,
38742
+ reqIndex,
38743
+ jsonPathToValue,
38744
+ notificationSuccessMessage,
38745
+ notificationSuccessMessageDescription,
38746
+ notificationErrorMessage,
38747
+ notificationErrorMessageDescription,
38748
+ containerStyle,
38749
+ endpoint,
38750
+ pathToValue,
38751
+ possibleValues,
38752
+ valuesMap
38753
+ } = data;
38754
+ const [api, contextHolder] = antd.notification.useNotification();
38755
+ const queryClient = reactQuery.useQueryClient();
38756
+ const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
38757
+ const partsOfUrl = usePartsOfUrl();
38758
+ if (isMultiQueryLoading) {
38759
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
38760
+ }
38761
+ if (isMultiQueryErrors) {
38762
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
38763
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
38764
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
38765
+ ] });
38766
+ }
38767
+ const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
38768
+ acc[index.toString()] = value;
38769
+ return acc;
38770
+ }, {});
38771
+ const jsonRoot = multiQueryData[`req${reqIndex}`];
38772
+ if (jsonRoot === void 0) {
38773
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
38774
+ }
38775
+ const valueToCompare = jp.query(jsonRoot || {}, `$${jsonPathToValue}`)[0];
38776
+ const valueToSegmented = valuesMap?.find((el) => el.value === valueToCompare)?.renderedValue;
38777
+ const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
38778
+ text: notificationSuccessMessage,
38779
+ replaceValues,
38780
+ multiQueryData
38781
+ }) : "Success";
38782
+ const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
38783
+ text: notificationSuccessMessageDescription,
38784
+ replaceValues,
38785
+ multiQueryData
38786
+ }) : "Success";
38787
+ const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
38788
+ text: notificationErrorMessage,
38789
+ replaceValues,
38790
+ multiQueryData
38791
+ }) : "Success";
38792
+ const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
38793
+ text: notificationErrorMessageDescription,
38794
+ replaceValues,
38795
+ multiQueryData
38796
+ }) : "Success";
38797
+ const openNotificationSuccess = () => {
38798
+ api.success({
38799
+ message: notificationSuccessMessagePrepared,
38800
+ description: notificationSuccessMessageDescriptionPrepared,
38801
+ placement: "bottomRight"
38802
+ });
38803
+ };
38804
+ const openNotificationError = () => {
38805
+ api.error({
38806
+ message: notificationErrorMessagePrepared,
38807
+ description: notificationErrorMessageDescriptionPrepared,
38808
+ placement: "bottomRight"
38809
+ });
38810
+ };
38811
+ const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
38812
+ const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
38813
+ const onChange = (renderedValue) => {
38814
+ const valueFromMap = valuesMap?.find((el) => el.renderedValue === renderedValue)?.value;
38815
+ const valueToSend = valueFromMap || renderedValue;
38816
+ patchEntryWithReplaceOp({
38817
+ endpoint: endpointPrepared,
38818
+ pathToValue: pathToValuePrepared,
38819
+ body: valueToSend
38820
+ }).then(() => {
38821
+ queryClient.invalidateQueries({ queryKey: ["multi"] });
38822
+ openNotificationSuccess();
38823
+ }).catch((error) => {
38824
+ openNotificationError();
38825
+ console.error(error);
38826
+ });
38827
+ };
38828
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
38829
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
38830
+ antd.Segmented,
38831
+ {
38832
+ options: possibleValues,
38833
+ value: valueToSegmented || "~n~e~v~e~r",
38834
+ onChange: (value) => onChange(value)
38835
+ }
38836
+ ),
38837
+ children,
38838
+ contextHolder
38839
+ ] });
38840
+ };
38841
+
38408
38842
  const DynamicComponents = {
38409
38843
  DefaultDiv,
38410
38844
  antdText: AntdText,
@@ -38442,7 +38876,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38442
38876
  SecretBase64Plain,
38443
38877
  ResourceBadge,
38444
38878
  Events: Events$1,
38445
- OwnerRefs
38879
+ OwnerRefs,
38880
+ Toggler,
38881
+ TogglerSegmented
38446
38882
  };
38447
38883
 
38448
38884
  const prepareUrlsToFetchForDynamicRenderer = ({
@@ -38461,7 +38897,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38461
38897
  );
38462
38898
  };
38463
38899
 
38464
- const STRING_KEYS = ["cluster", "group", "version", "plural", "namespace", "fieldSelector", "labelSelector"];
38900
+ const STRING_KEYS = [
38901
+ "cluster",
38902
+ "apiGroup",
38903
+ "apiVersion",
38904
+ "plural",
38905
+ "namespace",
38906
+ "fieldSelector",
38907
+ "labelSelector"
38908
+ ];
38465
38909
  const DynamicRendererWithProviders = (props) => {
38466
38910
  const location = reactRouterDom.useLocation();
38467
38911
  const { urlsToFetch, dataToApplyToContext, theme, nodeTerminalDefaultProfile, disableEventBubbling } = props;
@@ -38513,7 +38957,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38513
38957
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
38514
38958
  DynamicRendererWithProviders,
38515
38959
  {
38516
- urlsToFetch: [],
38960
+ urlsToFetch: customProps.urlsToFetch || [],
38517
38961
  dataToApplyToContext: record,
38518
38962
  theme,
38519
38963
  disableEventBubbling: customProps.disableEventBubbling,
@@ -38533,6 +38977,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38533
38977
  }) => {
38534
38978
  if (possibleCustomTypeWithProps) {
38535
38979
  const { type, customProps } = possibleCustomTypeWithProps;
38980
+ if (type === "factory") {
38981
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TableFactory, { record, customProps, theme });
38982
+ }
38536
38983
  if (value === void 0 && possibleUndefinedValue) {
38537
38984
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ShortenedTextWithTooltip, { trimLength: possibleTrimLength, text: possibleUndefinedValue });
38538
38985
  }
@@ -38570,9 +39017,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38570
39017
  }
38571
39018
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TrimmedTags, { tags, trimLength: possibleTrimLength });
38572
39019
  }
38573
- if (type === "factory") {
38574
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TableFactory, { record, customProps, theme });
38575
- }
38576
39020
  }
38577
39021
  if (value === null) {
38578
39022
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "null" });
@@ -38753,13 +39197,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38753
39197
  domEvent.preventDefault();
38754
39198
  if (key === "edit") {
38755
39199
  navigate(
38756
- `${baseprefix}/${value.cluster}${value.namespace ? `/${value.namespace}` : ""}${value.syntheticProject ? `/${value.syntheticProject}` : ""}/${value.pathPrefix}/${value.apiGroupAndVersion}/${value.typeName}/${value.entryName}?backlink=${value.backlink}`
39200
+ `${baseprefix}/${value.cluster}${value.namespace ? `/${value.namespace}` : ""}${value.syntheticProject ? `/${value.syntheticProject}` : ""}/${value.pathPrefix}/${value.apiGroupAndVersion}/${value.plural}/${value.name}?backlink=${value.backlink}`
38757
39201
  );
38758
39202
  }
38759
39203
  if (key === "delete") {
38760
39204
  value.onDeleteHandle(
38761
- value.entryName,
38762
- `${value.deletePathPrefix}/${value.apiGroupAndVersion}${value.namespace ? `/namespaces/${value.namespace}` : ""}/${value.typeName}/${value.entryName}`
39205
+ value.name,
39206
+ `${value.deletePathPrefix}/${value.apiGroupAndVersion}${value.namespace ? `/namespaces/${value.namespace}` : ""}/${value.plural}/${value.name}`
38763
39207
  );
38764
39208
  }
38765
39209
  }
@@ -38860,8 +39304,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38860
39304
  selectData.onChange(
38861
39305
  selectedRowKeys,
38862
39306
  rows.map(({ internalDataForControls }) => ({
38863
- name: internalDataForControls.entryName,
38864
- endpoint: `${internalDataForControls.deletePathPrefix}/${internalDataForControls.apiGroupAndVersion}${internalDataForControls.namespace ? `/namespaces/${internalDataForControls.namespace}` : ""}/${internalDataForControls.typeName}/${internalDataForControls.entryName}`
39307
+ name: internalDataForControls.name,
39308
+ endpoint: `${internalDataForControls.deletePathPrefix}/${internalDataForControls.apiGroupAndVersion}${internalDataForControls.namespace ? `/namespaces/${internalDataForControls.namespace}` : ""}/${internalDataForControls.plural}/${internalDataForControls.name}`
38865
39309
  }))
38866
39310
  );
38867
39311
  }
@@ -38870,16 +39314,16 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38870
39314
  return {
38871
39315
  onClick: () => {
38872
39316
  if (pathToNavigate && recordKeysForNavigation) {
38873
- const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record, `$${recordKeysForNavigation}`)[0];
39317
+ const recordValueRaw = Array.isArray(recordKeysForNavigation) ? lodashExports.get(record, recordKeysForNavigation) : jp.query(record || {}, `$${recordKeysForNavigation}`)[0];
38874
39318
  let recordValueRawSecond = "";
38875
39319
  if (recordKeysForNavigationSecond) {
38876
- recordValueRawSecond = Array.isArray(recordKeysForNavigationSecond) ? lodashExports.get(record, recordKeysForNavigationSecond) : jp.query(record, `$${recordKeysForNavigationSecond}`)[0];
39320
+ recordValueRawSecond = Array.isArray(recordKeysForNavigationSecond) ? lodashExports.get(record, recordKeysForNavigationSecond) : jp.query(record || {}, `$${recordKeysForNavigationSecond}`)[0];
38877
39321
  } else {
38878
39322
  recordValueRawSecond = "no-second-record-keys";
38879
39323
  }
38880
39324
  let recordValueRawThird = "";
38881
39325
  if (recordKeysForNavigationThird) {
38882
- recordValueRawThird = Array.isArray(recordKeysForNavigationThird) ? lodashExports.get(record, recordKeysForNavigationThird) : jp.query(record, `$${recordKeysForNavigationThird}`)[0];
39326
+ recordValueRawThird = Array.isArray(recordKeysForNavigationThird) ? lodashExports.get(record, recordKeysForNavigationThird) : jp.query(record || {}, `$${recordKeysForNavigationThird}`)[0];
38883
39327
  } else {
38884
39328
  recordValueRawThird = "no-second-record-keys";
38885
39329
  }
@@ -38962,8 +39406,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38962
39406
  syntheticProject: dataForControls.syntheticProject,
38963
39407
  pathPrefix: dataForControls.pathPrefix,
38964
39408
  apiGroupAndVersion: dataForControls.apiVersion,
38965
- typeName: dataForControls.typeName,
38966
- entryName: el.metadata.name,
39409
+ plural: dataForControls.plural,
39410
+ name: el.metadata.name,
38967
39411
  namespace: el.metadata.namespace || void 0,
38968
39412
  backlink: dataForControls.backlink,
38969
39413
  deletePathPrefix: dataForControls.deletePathPrefix,
@@ -38984,7 +39428,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
38984
39428
  dataSource = dataSource.map((el) => {
38985
39429
  const newFieldsForComplexJsonPath = {};
38986
39430
  customFields.forEach(({ dataIndex, jsonPath }) => {
38987
- const jpQueryResult = jp.query(el, `$${jsonPath}`);
39431
+ const jpQueryResult = jp.query(el || {}, `$${jsonPath}`);
38988
39432
  newFieldsForComplexJsonPath[dataIndex] = Array.isArray(jpQueryResult) && jpQueryResult.length === 1 ? jpQueryResult[0] : jpQueryResult;
38989
39433
  });
38990
39434
  if (typeof el === "object") {
@@ -39003,7 +39447,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39003
39447
  if (!el || typeof el !== "object" || Array.isArray(el)) {
39004
39448
  return;
39005
39449
  }
39006
- const mapValue = jp.query(el, `$${flatMapColumn.jsonPath}`)[0];
39450
+ const mapValue = jp.query(el || {}, `$${flatMapColumn.jsonPath}`)[0];
39007
39451
  if (mapValue && typeof mapValue === "object" && !Array.isArray(mapValue) && mapValue !== null) {
39008
39452
  const mapEntries = Object.entries(mapValue);
39009
39453
  if (mapEntries.length > 0) {
@@ -39045,8 +39489,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39045
39489
  synthetichProject: dataForControls.syntheticProject,
39046
39490
  pathPrefix: dataForControls.pathPrefix,
39047
39491
  apiGroupAndVersion: dataForControls.apiVersion,
39048
- typeName: dataForControls.typeName,
39049
- entryName: el.metadata.name,
39492
+ plural: dataForControls.plural,
39493
+ name: el.metadata.name,
39050
39494
  namespace: el.metadata.namespace || void 0,
39051
39495
  backlink: dataForControls.backlink,
39052
39496
  deletePathPrefix: dataForControls.deletePathPrefix,
@@ -39091,18 +39535,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39091
39535
  const [isLoading, setIsLoading] = K.useState(false);
39092
39536
  const [isError, setIsError] = K.useState(false);
39093
39537
  const updatePermission = usePermissions({
39094
- group: dataForControls?.apiGroup,
39095
- resource: dataForControls?.resource || "",
39538
+ apiGroup: dataForControls?.apiGroup,
39539
+ plural: dataForControls?.plural || "",
39096
39540
  namespace,
39097
- clusterName: cluster,
39541
+ cluster,
39098
39542
  verb: "update",
39099
39543
  refetchInterval: false
39100
39544
  });
39101
39545
  const deletePermission = usePermissions({
39102
- group: dataForControls?.apiGroup,
39103
- resource: dataForControls?.resource || "",
39546
+ apiGroup: dataForControls?.apiGroup,
39547
+ plural: dataForControls?.plural || "",
39104
39548
  namespace,
39105
- clusterName: cluster,
39549
+ cluster,
39106
39550
  verb: "delete",
39107
39551
  refetchInterval: false
39108
39552
  });
@@ -39110,7 +39554,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39110
39554
  setIsError(void 0);
39111
39555
  setIsLoading(true);
39112
39556
  const payload = {
39113
- clusterName: cluster,
39557
+ cluster,
39114
39558
  customizationId,
39115
39559
  tableMappingsReplaceValues,
39116
39560
  forceDefaultAdditionalPrinterColumns,
@@ -39153,7 +39597,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39153
39597
  cluster: dataForControls.cluster,
39154
39598
  syntheticProject: dataForControls.syntheticProject,
39155
39599
  pathPrefix: !dataForControls.apiGroup || dataForControls.apiGroup.length === 0 ? "forms/builtin" : "forms/apis",
39156
- typeName: dataForControls.resource,
39600
+ plural: dataForControls.plural,
39157
39601
  apiVersion: !dataForControls.apiGroup || dataForControls.apiGroup.length === 0 ? dataForControls.apiVersion : `${dataForControls.apiGroup}/${dataForControls.apiVersion}`,
39158
39602
  backlink: encodeURIComponent(fullPath),
39159
39603
  onDeleteHandle: dataForControlsInternal.onDeleteHandle,
@@ -39187,808 +39631,236 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39187
39631
  );
39188
39632
  };
39189
39633
 
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
- */
39634
+ function _defineProperty$1(obj, key, value) {
39635
+ if (key in obj) {
39636
+ Object.defineProperty(obj, key, {
39637
+ value: value,
39638
+ enumerable: true,
39639
+ configurable: true,
39640
+ writable: true
39641
+ });
39642
+ } else {
39643
+ obj[key] = value;
39644
+ }
39198
39645
 
39199
- /** Used as the `TypeError` message for "Functions" methods. */
39200
- var FUNC_ERROR_TEXT = 'Expected a function';
39646
+ return obj;
39647
+ }
39201
39648
 
39202
- /** Used as references for various `Number` constants. */
39203
- var NAN = 0 / 0;
39649
+ function ownKeys$1(object, enumerableOnly) {
39650
+ var keys = Object.keys(object);
39204
39651
 
39205
- /** `Object#toString` result references. */
39206
- var symbolTag = '[object Symbol]';
39652
+ if (Object.getOwnPropertySymbols) {
39653
+ var symbols = Object.getOwnPropertySymbols(object);
39654
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
39655
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
39656
+ });
39657
+ keys.push.apply(keys, symbols);
39658
+ }
39207
39659
 
39208
- /** Used to match leading and trailing whitespace. */
39209
- var reTrim = /^\s+|\s+$/g;
39660
+ return keys;
39661
+ }
39210
39662
 
39211
- /** Used to detect bad signed hexadecimal string values. */
39212
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
39663
+ function _objectSpread2$1(target) {
39664
+ for (var i = 1; i < arguments.length; i++) {
39665
+ var source = arguments[i] != null ? arguments[i] : {};
39213
39666
 
39214
- /** Used to detect binary string values. */
39215
- var reIsBinary = /^0b[01]+$/i;
39667
+ if (i % 2) {
39668
+ ownKeys$1(Object(source), true).forEach(function (key) {
39669
+ _defineProperty$1(target, key, source[key]);
39670
+ });
39671
+ } else if (Object.getOwnPropertyDescriptors) {
39672
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
39673
+ } else {
39674
+ ownKeys$1(Object(source)).forEach(function (key) {
39675
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39676
+ });
39677
+ }
39678
+ }
39216
39679
 
39217
- /** Used to detect octal string values. */
39218
- var reIsOctal = /^0o[0-7]+$/i;
39680
+ return target;
39681
+ }
39219
39682
 
39220
- /** Built-in method references without a dependency on `root`. */
39221
- var freeParseInt = parseInt;
39683
+ function _objectWithoutPropertiesLoose(source, excluded) {
39684
+ if (source == null) return {};
39685
+ var target = {};
39686
+ var sourceKeys = Object.keys(source);
39687
+ var key, i;
39222
39688
 
39223
- /** Detect free variable `global` from Node.js. */
39224
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
39689
+ for (i = 0; i < sourceKeys.length; i++) {
39690
+ key = sourceKeys[i];
39691
+ if (excluded.indexOf(key) >= 0) continue;
39692
+ target[key] = source[key];
39693
+ }
39225
39694
 
39226
- /** Detect free variable `self`. */
39227
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
39695
+ return target;
39696
+ }
39228
39697
 
39229
- /** Used as a reference to the global object. */
39230
- var root = freeGlobal || freeSelf || Function('return this')();
39698
+ function _objectWithoutProperties(source, excluded) {
39699
+ if (source == null) return {};
39231
39700
 
39232
- /** Used for built-in method references. */
39233
- var objectProto = Object.prototype;
39701
+ var target = _objectWithoutPropertiesLoose(source, excluded);
39234
39702
 
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;
39703
+ var key, i;
39241
39704
 
39242
- /* Built-in method references for those with the same name as other `lodash` methods. */
39243
- var nativeMax = Math.max,
39244
- nativeMin = Math.min;
39705
+ if (Object.getOwnPropertySymbols) {
39706
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
39245
39707
 
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
- };
39708
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
39709
+ key = sourceSymbolKeys[i];
39710
+ if (excluded.indexOf(key) >= 0) continue;
39711
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
39712
+ target[key] = source[key];
39713
+ }
39714
+ }
39265
39715
 
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;
39716
+ return target;
39717
+ }
39331
39718
 
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
- }
39719
+ function _slicedToArray(arr, i) {
39720
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
39721
+ }
39342
39722
 
39343
- function invokeFunc(time) {
39344
- var args = lastArgs,
39345
- thisArg = lastThis;
39723
+ function _arrayWithHoles(arr) {
39724
+ if (Array.isArray(arr)) return arr;
39725
+ }
39346
39726
 
39347
- lastArgs = lastThis = undefined;
39348
- lastInvokeTime = time;
39349
- result = func.apply(thisArg, args);
39350
- return result;
39351
- }
39727
+ function _iterableToArrayLimit(arr, i) {
39728
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
39729
+ var _arr = [];
39730
+ var _n = true;
39731
+ var _d = false;
39732
+ var _e = undefined;
39352
39733
 
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;
39734
+ try {
39735
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
39736
+ _arr.push(_s.value);
39737
+
39738
+ if (i && _arr.length === i) break;
39739
+ }
39740
+ } catch (err) {
39741
+ _d = true;
39742
+ _e = err;
39743
+ } finally {
39744
+ try {
39745
+ if (!_n && _i["return"] != null) _i["return"]();
39746
+ } finally {
39747
+ if (_d) throw _e;
39748
+ }
39360
39749
  }
39361
39750
 
39362
- function remainingWait(time) {
39363
- var timeSinceLastCall = time - lastCallTime,
39364
- timeSinceLastInvoke = time - lastInvokeTime,
39365
- result = wait - timeSinceLastCall;
39751
+ return _arr;
39752
+ }
39366
39753
 
39367
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
39368
- }
39754
+ function _unsupportedIterableToArray(o, minLen) {
39755
+ if (!o) return;
39756
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
39757
+ var n = Object.prototype.toString.call(o).slice(8, -1);
39758
+ if (n === "Object" && o.constructor) n = o.constructor.name;
39759
+ if (n === "Map" || n === "Set") return Array.from(o);
39760
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
39761
+ }
39369
39762
 
39370
- function shouldInvoke(time) {
39371
- var timeSinceLastCall = time - lastCallTime,
39372
- timeSinceLastInvoke = time - lastInvokeTime;
39763
+ function _arrayLikeToArray(arr, len) {
39764
+ if (len == null || len > arr.length) len = arr.length;
39373
39765
 
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
- }
39766
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
39380
39767
 
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));
39768
+ return arr2;
39769
+ }
39770
+
39771
+ function _nonIterableRest() {
39772
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
39773
+ }
39774
+
39775
+ function _defineProperty(obj, key, value) {
39776
+ if (key in obj) {
39777
+ Object.defineProperty(obj, key, {
39778
+ value: value,
39779
+ enumerable: true,
39780
+ configurable: true,
39781
+ writable: true
39782
+ });
39783
+ } else {
39784
+ obj[key] = value;
39388
39785
  }
39389
39786
 
39390
- function trailingEdge(time) {
39391
- timerId = undefined;
39787
+ return obj;
39788
+ }
39392
39789
 
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;
39790
+ function ownKeys(object, enumerableOnly) {
39791
+ var keys = Object.keys(object);
39792
+
39793
+ if (Object.getOwnPropertySymbols) {
39794
+ var symbols = Object.getOwnPropertySymbols(object);
39795
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
39796
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
39797
+ });
39798
+ keys.push.apply(keys, symbols);
39400
39799
  }
39401
39800
 
39402
- function cancel() {
39403
- if (timerId !== undefined) {
39404
- clearTimeout(timerId);
39801
+ return keys;
39802
+ }
39803
+
39804
+ function _objectSpread2(target) {
39805
+ for (var i = 1; i < arguments.length; i++) {
39806
+ var source = arguments[i] != null ? arguments[i] : {};
39807
+
39808
+ if (i % 2) {
39809
+ ownKeys(Object(source), true).forEach(function (key) {
39810
+ _defineProperty(target, key, source[key]);
39811
+ });
39812
+ } else if (Object.getOwnPropertyDescriptors) {
39813
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
39814
+ } else {
39815
+ ownKeys(Object(source)).forEach(function (key) {
39816
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39817
+ });
39405
39818
  }
39406
- lastInvokeTime = 0;
39407
- lastArgs = lastCallTime = lastThis = timerId = undefined;
39408
39819
  }
39409
39820
 
39410
- function flush() {
39411
- return timerId === undefined ? result : trailingEdge(now());
39821
+ return target;
39822
+ }
39823
+
39824
+ function compose$1() {
39825
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
39826
+ fns[_key] = arguments[_key];
39412
39827
  }
39413
39828
 
39414
- function debounced() {
39415
- var time = now(),
39416
- isInvoking = shouldInvoke(time);
39829
+ return function (x) {
39830
+ return fns.reduceRight(function (y, f) {
39831
+ return f(y);
39832
+ }, x);
39833
+ };
39834
+ }
39417
39835
 
39418
- lastArgs = arguments;
39419
- lastThis = this;
39420
- lastCallTime = time;
39836
+ function curry$1(fn) {
39837
+ return function curried() {
39838
+ var _this = this;
39421
39839
 
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);
39840
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
39841
+ args[_key2] = arguments[_key2];
39434
39842
  }
39435
- return result;
39436
- }
39437
- debounced.cancel = cancel;
39438
- debounced.flush = flush;
39439
- return debounced;
39843
+
39844
+ return args.length >= fn.length ? fn.apply(this, args) : function () {
39845
+ for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
39846
+ nextArgs[_key3] = arguments[_key3];
39847
+ }
39848
+
39849
+ return curried.apply(_this, [].concat(args, nextArgs));
39850
+ };
39851
+ };
39440
39852
  }
39441
39853
 
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
39854
  function isObject$2(value) {
39468
- var type = typeof value;
39469
- return !!value && (type == 'object' || type == 'function');
39855
+ return {}.toString.call(value).includes('Object');
39470
39856
  }
39471
39857
 
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';
39858
+ function isEmpty$1(obj) {
39859
+ return !Object.keys(obj).length;
39498
39860
  }
39499
39861
 
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';
39862
+ function isFunction(value) {
39863
+ return typeof value === 'function';
39992
39864
  }
39993
39865
 
39994
39866
  function hasOwnProperty(object, property) {
@@ -39996,7 +39868,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
39996
39868
  }
39997
39869
 
39998
39870
  function validateChanges(initial, changes) {
39999
- if (!isObject$1(changes)) errorHandler$1('changeType');
39871
+ if (!isObject$2(changes)) errorHandler$1('changeType');
40000
39872
  if (Object.keys(changes).some(function (field) {
40001
39873
  return !hasOwnProperty(initial, field);
40002
39874
  })) errorHandler$1('changeField');
@@ -40008,15 +39880,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
40008
39880
  }
40009
39881
 
40010
39882
  function validateHandler(handler) {
40011
- if (!(isFunction(handler) || isObject$1(handler))) errorHandler$1('handlerType');
40012
- if (isObject$1(handler) && Object.values(handler).some(function (_handler) {
39883
+ if (!(isFunction(handler) || isObject$2(handler))) errorHandler$1('handlerType');
39884
+ if (isObject$2(handler) && Object.values(handler).some(function (_handler) {
40013
39885
  return !isFunction(_handler);
40014
39886
  })) errorHandler$1('handlersType');
40015
39887
  }
40016
39888
 
40017
39889
  function validateInitial(initial) {
40018
39890
  if (!initial) errorHandler$1('initialIsRequired');
40019
- if (!isObject$1(initial)) errorHandler$1('initialType');
39891
+ if (!isObject$2(initial)) errorHandler$1('initialType');
40020
39892
  if (isEmpty$1(initial)) errorHandler$1('initialContent');
40021
39893
  }
40022
39894
 
@@ -40116,7 +39988,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
40116
39988
  };
40117
39989
  }
40118
39990
 
40119
- function isObject(value) {
39991
+ function isObject$1(value) {
40120
39992
  return {}.toString.call(value).includes('Object');
40121
39993
  }
40122
39994
 
@@ -40128,7 +40000,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
40128
40000
 
40129
40001
  function validateConfig(config) {
40130
40002
  if (!config) errorHandler('configIsRequired');
40131
- if (!isObject(config)) errorHandler('configType');
40003
+ if (!isObject$1(config)) errorHandler('configType');
40132
40004
 
40133
40005
  if (config.urls) {
40134
40006
  informAboutDeprecation();
@@ -47199,71 +47071,832 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47199
47071
  }
47200
47072
  }
47201
47073
 
47202
- function parseOptions(options) {
47203
- const prettyErrors = options.prettyErrors !== false;
47204
- const lineCounter = options.lineCounter || (prettyErrors && new LineCounter()) || null;
47205
- return { lineCounter, prettyErrors };
47074
+ function parseOptions(options) {
47075
+ const prettyErrors = options.prettyErrors !== false;
47076
+ const lineCounter = options.lineCounter || (prettyErrors && new LineCounter()) || null;
47077
+ return { lineCounter, prettyErrors };
47078
+ }
47079
+ /** Parse an input string into a single YAML.Document */
47080
+ function parseDocument(source, options = {}) {
47081
+ const { lineCounter, prettyErrors } = parseOptions(options);
47082
+ const parser = new Parser(lineCounter?.addNewLine);
47083
+ const composer = new Composer(options);
47084
+ // `doc` is always set by compose.end(true) at the very latest
47085
+ let doc = null;
47086
+ for (const _doc of composer.compose(parser.parse(source), true, source.length)) {
47087
+ if (!doc)
47088
+ doc = _doc;
47089
+ else if (doc.options.logLevel !== 'silent') {
47090
+ doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));
47091
+ break;
47092
+ }
47093
+ }
47094
+ if (prettyErrors && lineCounter) {
47095
+ doc.errors.forEach(prettifyError(source, lineCounter));
47096
+ doc.warnings.forEach(prettifyError(source, lineCounter));
47097
+ }
47098
+ return doc;
47099
+ }
47100
+ function parse(src, reviver, options) {
47101
+ let _reviver = undefined;
47102
+ const doc = parseDocument(src, options);
47103
+ if (!doc)
47104
+ return null;
47105
+ doc.warnings.forEach(warning => warn(doc.options.logLevel, warning));
47106
+ if (doc.errors.length > 0) {
47107
+ if (doc.options.logLevel !== 'silent')
47108
+ throw doc.errors[0];
47109
+ else
47110
+ doc.errors = [];
47111
+ }
47112
+ return doc.toJS(Object.assign({ reviver: _reviver }, options));
47113
+ }
47114
+ function stringify(value, replacer, options) {
47115
+ let _replacer = null;
47116
+ if (typeof replacer === 'function' || Array.isArray(replacer)) {
47117
+ _replacer = replacer;
47118
+ }
47119
+ else if (options === undefined && replacer) {
47120
+ options = replacer;
47121
+ }
47122
+ if (typeof options === 'string')
47123
+ options = options.length;
47124
+ if (typeof options === 'number') {
47125
+ const indent = Math.round(options);
47126
+ options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };
47127
+ }
47128
+ if (value === undefined) {
47129
+ const { keepUndefined } = options ?? replacer ?? {};
47130
+ if (!keepUndefined)
47131
+ return undefined;
47132
+ }
47133
+ if (isDocument(value) && !_replacer)
47134
+ return value.toString(options);
47135
+ return new Document$1(value, _replacer, options).toString(options);
47136
+ }
47137
+
47138
+ const BorderRadiusContainer$1 = styled.div`
47139
+ height: ${({ $designNewLayoutHeight }) => $designNewLayoutHeight ? `${$designNewLayoutHeight}px` : "75vh"};
47140
+ border: 1px solid ${({ $colorBorder }) => $colorBorder};
47141
+ border-radius: 8px;
47142
+ padding: 2px;
47143
+ box-sizing: border-box;
47144
+
47145
+ .monaco-editor,
47146
+ .overflow-guard {
47147
+ border-radius: 8px;
47148
+ }
47149
+ `;
47150
+ const ControlsRowContainer$1 = styled.div`
47151
+ margin-top: 10px;
47152
+ display: flex;
47153
+ align-items: center;
47154
+ background-color: ${({ $bgColor, $designNewLayout }) => $designNewLayout ? $bgColor : "initial"};
47155
+ border-radius: 8px;
47156
+ padding: 4px;
47157
+ `;
47158
+ const BigText$1 = styled.div`
47159
+ font-size: 16px;
47160
+ line-height: 24px;
47161
+ `;
47162
+ const Styled$k = {
47163
+ BorderRadiusContainer: BorderRadiusContainer$1,
47164
+ ControlsRowContainer: ControlsRowContainer$1,
47165
+ BigText: BigText$1
47166
+ };
47167
+
47168
+ const NOTIFICATION_KEY = "yaml-data-changed";
47169
+ const YamlEditorSingleton = ({
47170
+ theme,
47171
+ cluster,
47172
+ prefillValuesSchema,
47173
+ isNameSpaced,
47174
+ isCreate,
47175
+ type,
47176
+ apiGroupApiVersion,
47177
+ plural,
47178
+ backlink,
47179
+ designNewLayout,
47180
+ designNewLayoutHeight,
47181
+ openNotification,
47182
+ readOnly = false
47183
+ }) => {
47184
+ const { token } = antd.theme.useToken();
47185
+ const navigate = reactRouterDom.useNavigate();
47186
+ const [api, contextHolder] = antd.notification.useNotification();
47187
+ const [yamlData, setYamlData] = K.useState("");
47188
+ const [isLoading, setIsLoading] = K.useState(false);
47189
+ const [error, setError] = K.useState();
47190
+ const initialPrefillYamlRef = K.useRef(null);
47191
+ const latestPrefillYamlRef = K.useRef(null);
47192
+ const firstLoadRef = K.useRef(true);
47193
+ const handleReload = K.useCallback(() => {
47194
+ api.destroy(NOTIFICATION_KEY);
47195
+ const nextYaml = latestPrefillYamlRef.current ?? initialPrefillYamlRef.current;
47196
+ if (nextYaml !== null) {
47197
+ setYamlData(nextYaml);
47198
+ }
47199
+ }, [api]);
47200
+ const openNotificationYamlChanged = K.useCallback(() => {
47201
+ const btn = /* @__PURE__ */ jsxRuntimeExports.jsx(
47202
+ antd.Button,
47203
+ {
47204
+ type: "primary",
47205
+ size: "small",
47206
+ onClick: () => {
47207
+ handleReload();
47208
+ },
47209
+ children: "Reload"
47210
+ }
47211
+ );
47212
+ api.info({
47213
+ key: NOTIFICATION_KEY,
47214
+ message: "Data changed",
47215
+ description: "The source data has been updated. Reload to apply the latest changes (will discard your edits).",
47216
+ btn,
47217
+ placement: "bottomRight",
47218
+ duration: 30
47219
+ });
47220
+ }, [api, handleReload]);
47221
+ K.useEffect(() => {
47222
+ if (prefillValuesSchema === void 0) return;
47223
+ const nextYaml = stringify(prefillValuesSchema);
47224
+ if (firstLoadRef.current) {
47225
+ initialPrefillYamlRef.current = nextYaml;
47226
+ latestPrefillYamlRef.current = nextYaml;
47227
+ setYamlData(nextYaml);
47228
+ firstLoadRef.current = false;
47229
+ return;
47230
+ }
47231
+ if (nextYaml !== latestPrefillYamlRef.current) {
47232
+ openNotificationYamlChanged();
47233
+ }
47234
+ latestPrefillYamlRef.current = nextYaml;
47235
+ }, [prefillValuesSchema, openNotificationYamlChanged]);
47236
+ const onSubmit = () => {
47237
+ setIsLoading(true);
47238
+ setError(void 0);
47239
+ const currentValues = parse(yamlData);
47240
+ const { namespace } = currentValues.metadata;
47241
+ const { name } = currentValues.metadata;
47242
+ const body = currentValues;
47243
+ const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${plural}/${isCreate ? "" : name}`;
47244
+ if (isCreate) {
47245
+ createNewEntry({ endpoint, body }).then((res) => {
47246
+ console.log(res);
47247
+ if (backlink) {
47248
+ navigate(backlink);
47249
+ }
47250
+ setIsLoading(false);
47251
+ if (openNotification) {
47252
+ api.success({
47253
+ message: "Created successfully",
47254
+ description: "Entry was created",
47255
+ placement: "topRight"
47256
+ });
47257
+ }
47258
+ }).catch((error2) => {
47259
+ console.log("Form submit error", error2);
47260
+ setIsLoading(false);
47261
+ setError(error2);
47262
+ });
47263
+ } else {
47264
+ updateEntry({ 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: "Updated successfully",
47273
+ description: "Entry was updated",
47274
+ placement: "bottomRight"
47275
+ });
47276
+ }
47277
+ }).catch((error2) => {
47278
+ console.log("Form submit error", error2);
47279
+ setIsLoading(false);
47280
+ setError(error2);
47281
+ });
47282
+ }
47283
+ };
47284
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
47285
+ contextHolder,
47286
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $designNewLayoutHeight: designNewLayoutHeight, $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47287
+ Ft,
47288
+ {
47289
+ defaultLanguage: "yaml",
47290
+ width: "100%",
47291
+ height: designNewLayoutHeight || "75vh",
47292
+ value: yamlData,
47293
+ onChange: (value) => {
47294
+ if (!readOnly) {
47295
+ setYamlData(value || "");
47296
+ }
47297
+ },
47298
+ theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
47299
+ options: {
47300
+ theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
47301
+ readOnly
47302
+ }
47303
+ }
47304
+ ) }),
47305
+ !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: [
47306
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
47307
+ backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: () => navigate(backlink), children: "Cancel" }),
47308
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: handleReload, children: "Reload" })
47309
+ ] }) }),
47310
+ error && /* @__PURE__ */ jsxRuntimeExports.jsxs(
47311
+ antd.Modal,
47312
+ {
47313
+ open: !!error,
47314
+ onOk: () => setError(void 0),
47315
+ onCancel: () => setError(void 0),
47316
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BigText, { children: "Error!" }) }),
47317
+ cancelButtonProps: { style: { display: "none" } },
47318
+ children: [
47319
+ "An error has occurred: ",
47320
+ error?.response?.data?.message
47321
+ ]
47322
+ }
47323
+ )
47324
+ ] });
47325
+ };
47326
+
47327
+ /**
47328
+ * lodash (Custom Build) <https://lodash.com/>
47329
+ * Build: `lodash modularize exports="npm" -o ./`
47330
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
47331
+ * Released under MIT license <https://lodash.com/license>
47332
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
47333
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
47334
+ */
47335
+
47336
+ /** Used as the `TypeError` message for "Functions" methods. */
47337
+ var FUNC_ERROR_TEXT = 'Expected a function';
47338
+
47339
+ /** Used as references for various `Number` constants. */
47340
+ var NAN = 0 / 0;
47341
+
47342
+ /** `Object#toString` result references. */
47343
+ var symbolTag = '[object Symbol]';
47344
+
47345
+ /** Used to match leading and trailing whitespace. */
47346
+ var reTrim = /^\s+|\s+$/g;
47347
+
47348
+ /** Used to detect bad signed hexadecimal string values. */
47349
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
47350
+
47351
+ /** Used to detect binary string values. */
47352
+ var reIsBinary = /^0b[01]+$/i;
47353
+
47354
+ /** Used to detect octal string values. */
47355
+ var reIsOctal = /^0o[0-7]+$/i;
47356
+
47357
+ /** Built-in method references without a dependency on `root`. */
47358
+ var freeParseInt = parseInt;
47359
+
47360
+ /** Detect free variable `global` from Node.js. */
47361
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
47362
+
47363
+ /** Detect free variable `self`. */
47364
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
47365
+
47366
+ /** Used as a reference to the global object. */
47367
+ var root = freeGlobal || freeSelf || Function('return this')();
47368
+
47369
+ /** Used for built-in method references. */
47370
+ var objectProto = Object.prototype;
47371
+
47372
+ /**
47373
+ * Used to resolve the
47374
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
47375
+ * of values.
47376
+ */
47377
+ var objectToString = objectProto.toString;
47378
+
47379
+ /* Built-in method references for those with the same name as other `lodash` methods. */
47380
+ var nativeMax = Math.max,
47381
+ nativeMin = Math.min;
47382
+
47383
+ /**
47384
+ * Gets the timestamp of the number of milliseconds that have elapsed since
47385
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
47386
+ *
47387
+ * @static
47388
+ * @memberOf _
47389
+ * @since 2.4.0
47390
+ * @category Date
47391
+ * @returns {number} Returns the timestamp.
47392
+ * @example
47393
+ *
47394
+ * _.defer(function(stamp) {
47395
+ * console.log(_.now() - stamp);
47396
+ * }, _.now());
47397
+ * // => Logs the number of milliseconds it took for the deferred invocation.
47398
+ */
47399
+ var now = function() {
47400
+ return root.Date.now();
47401
+ };
47402
+
47403
+ /**
47404
+ * Creates a debounced function that delays invoking `func` until after `wait`
47405
+ * milliseconds have elapsed since the last time the debounced function was
47406
+ * invoked. The debounced function comes with a `cancel` method to cancel
47407
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
47408
+ * Provide `options` to indicate whether `func` should be invoked on the
47409
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
47410
+ * with the last arguments provided to the debounced function. Subsequent
47411
+ * calls to the debounced function return the result of the last `func`
47412
+ * invocation.
47413
+ *
47414
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
47415
+ * invoked on the trailing edge of the timeout only if the debounced function
47416
+ * is invoked more than once during the `wait` timeout.
47417
+ *
47418
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
47419
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
47420
+ *
47421
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
47422
+ * for details over the differences between `_.debounce` and `_.throttle`.
47423
+ *
47424
+ * @static
47425
+ * @memberOf _
47426
+ * @since 0.1.0
47427
+ * @category Function
47428
+ * @param {Function} func The function to debounce.
47429
+ * @param {number} [wait=0] The number of milliseconds to delay.
47430
+ * @param {Object} [options={}] The options object.
47431
+ * @param {boolean} [options.leading=false]
47432
+ * Specify invoking on the leading edge of the timeout.
47433
+ * @param {number} [options.maxWait]
47434
+ * The maximum time `func` is allowed to be delayed before it's invoked.
47435
+ * @param {boolean} [options.trailing=true]
47436
+ * Specify invoking on the trailing edge of the timeout.
47437
+ * @returns {Function} Returns the new debounced function.
47438
+ * @example
47439
+ *
47440
+ * // Avoid costly calculations while the window size is in flux.
47441
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
47442
+ *
47443
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
47444
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
47445
+ * 'leading': true,
47446
+ * 'trailing': false
47447
+ * }));
47448
+ *
47449
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
47450
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
47451
+ * var source = new EventSource('/stream');
47452
+ * jQuery(source).on('message', debounced);
47453
+ *
47454
+ * // Cancel the trailing debounced invocation.
47455
+ * jQuery(window).on('popstate', debounced.cancel);
47456
+ */
47457
+ function debounce(func, wait, options) {
47458
+ var lastArgs,
47459
+ lastThis,
47460
+ maxWait,
47461
+ result,
47462
+ timerId,
47463
+ lastCallTime,
47464
+ lastInvokeTime = 0,
47465
+ leading = false,
47466
+ maxing = false,
47467
+ trailing = true;
47468
+
47469
+ if (typeof func != 'function') {
47470
+ throw new TypeError(FUNC_ERROR_TEXT);
47471
+ }
47472
+ wait = toNumber(wait) || 0;
47473
+ if (isObject(options)) {
47474
+ leading = !!options.leading;
47475
+ maxing = 'maxWait' in options;
47476
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
47477
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
47478
+ }
47479
+
47480
+ function invokeFunc(time) {
47481
+ var args = lastArgs,
47482
+ thisArg = lastThis;
47483
+
47484
+ lastArgs = lastThis = undefined;
47485
+ lastInvokeTime = time;
47486
+ result = func.apply(thisArg, args);
47487
+ return result;
47488
+ }
47489
+
47490
+ function leadingEdge(time) {
47491
+ // Reset any `maxWait` timer.
47492
+ lastInvokeTime = time;
47493
+ // Start the timer for the trailing edge.
47494
+ timerId = setTimeout(timerExpired, wait);
47495
+ // Invoke the leading edge.
47496
+ return leading ? invokeFunc(time) : result;
47497
+ }
47498
+
47499
+ function remainingWait(time) {
47500
+ var timeSinceLastCall = time - lastCallTime,
47501
+ timeSinceLastInvoke = time - lastInvokeTime,
47502
+ result = wait - timeSinceLastCall;
47503
+
47504
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
47505
+ }
47506
+
47507
+ function shouldInvoke(time) {
47508
+ var timeSinceLastCall = time - lastCallTime,
47509
+ timeSinceLastInvoke = time - lastInvokeTime;
47510
+
47511
+ // Either this is the first call, activity has stopped and we're at the
47512
+ // trailing edge, the system time has gone backwards and we're treating
47513
+ // it as the trailing edge, or we've hit the `maxWait` limit.
47514
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
47515
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
47516
+ }
47517
+
47518
+ function timerExpired() {
47519
+ var time = now();
47520
+ if (shouldInvoke(time)) {
47521
+ return trailingEdge(time);
47522
+ }
47523
+ // Restart the timer.
47524
+ timerId = setTimeout(timerExpired, remainingWait(time));
47525
+ }
47526
+
47527
+ function trailingEdge(time) {
47528
+ timerId = undefined;
47529
+
47530
+ // Only invoke if we have `lastArgs` which means `func` has been
47531
+ // debounced at least once.
47532
+ if (trailing && lastArgs) {
47533
+ return invokeFunc(time);
47534
+ }
47535
+ lastArgs = lastThis = undefined;
47536
+ return result;
47537
+ }
47538
+
47539
+ function cancel() {
47540
+ if (timerId !== undefined) {
47541
+ clearTimeout(timerId);
47542
+ }
47543
+ lastInvokeTime = 0;
47544
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
47545
+ }
47546
+
47547
+ function flush() {
47548
+ return timerId === undefined ? result : trailingEdge(now());
47549
+ }
47550
+
47551
+ function debounced() {
47552
+ var time = now(),
47553
+ isInvoking = shouldInvoke(time);
47554
+
47555
+ lastArgs = arguments;
47556
+ lastThis = this;
47557
+ lastCallTime = time;
47558
+
47559
+ if (isInvoking) {
47560
+ if (timerId === undefined) {
47561
+ return leadingEdge(lastCallTime);
47562
+ }
47563
+ if (maxing) {
47564
+ // Handle invocations in a tight loop.
47565
+ timerId = setTimeout(timerExpired, wait);
47566
+ return invokeFunc(lastCallTime);
47567
+ }
47568
+ }
47569
+ if (timerId === undefined) {
47570
+ timerId = setTimeout(timerExpired, wait);
47571
+ }
47572
+ return result;
47573
+ }
47574
+ debounced.cancel = cancel;
47575
+ debounced.flush = flush;
47576
+ return debounced;
47577
+ }
47578
+
47579
+ /**
47580
+ * Checks if `value` is the
47581
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
47582
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
47583
+ *
47584
+ * @static
47585
+ * @memberOf _
47586
+ * @since 0.1.0
47587
+ * @category Lang
47588
+ * @param {*} value The value to check.
47589
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
47590
+ * @example
47591
+ *
47592
+ * _.isObject({});
47593
+ * // => true
47594
+ *
47595
+ * _.isObject([1, 2, 3]);
47596
+ * // => true
47597
+ *
47598
+ * _.isObject(_.noop);
47599
+ * // => true
47600
+ *
47601
+ * _.isObject(null);
47602
+ * // => false
47603
+ */
47604
+ function isObject(value) {
47605
+ var type = typeof value;
47606
+ return !!value && (type == 'object' || type == 'function');
47607
+ }
47608
+
47609
+ /**
47610
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
47611
+ * and has a `typeof` result of "object".
47612
+ *
47613
+ * @static
47614
+ * @memberOf _
47615
+ * @since 4.0.0
47616
+ * @category Lang
47617
+ * @param {*} value The value to check.
47618
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
47619
+ * @example
47620
+ *
47621
+ * _.isObjectLike({});
47622
+ * // => true
47623
+ *
47624
+ * _.isObjectLike([1, 2, 3]);
47625
+ * // => true
47626
+ *
47627
+ * _.isObjectLike(_.noop);
47628
+ * // => false
47629
+ *
47630
+ * _.isObjectLike(null);
47631
+ * // => false
47632
+ */
47633
+ function isObjectLike(value) {
47634
+ return !!value && typeof value == 'object';
47635
+ }
47636
+
47637
+ /**
47638
+ * Checks if `value` is classified as a `Symbol` primitive or object.
47639
+ *
47640
+ * @static
47641
+ * @memberOf _
47642
+ * @since 4.0.0
47643
+ * @category Lang
47644
+ * @param {*} value The value to check.
47645
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
47646
+ * @example
47647
+ *
47648
+ * _.isSymbol(Symbol.iterator);
47649
+ * // => true
47650
+ *
47651
+ * _.isSymbol('abc');
47652
+ * // => false
47653
+ */
47654
+ function isSymbol(value) {
47655
+ return typeof value == 'symbol' ||
47656
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
47657
+ }
47658
+
47659
+ /**
47660
+ * Converts `value` to a number.
47661
+ *
47662
+ * @static
47663
+ * @memberOf _
47664
+ * @since 4.0.0
47665
+ * @category Lang
47666
+ * @param {*} value The value to process.
47667
+ * @returns {number} Returns the number.
47668
+ * @example
47669
+ *
47670
+ * _.toNumber(3.2);
47671
+ * // => 3.2
47672
+ *
47673
+ * _.toNumber(Number.MIN_VALUE);
47674
+ * // => 5e-324
47675
+ *
47676
+ * _.toNumber(Infinity);
47677
+ * // => Infinity
47678
+ *
47679
+ * _.toNumber('3.2');
47680
+ * // => 3.2
47681
+ */
47682
+ function toNumber(value) {
47683
+ if (typeof value == 'number') {
47684
+ return value;
47685
+ }
47686
+ if (isSymbol(value)) {
47687
+ return NAN;
47688
+ }
47689
+ if (isObject(value)) {
47690
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
47691
+ value = isObject(other) ? (other + '') : other;
47692
+ }
47693
+ if (typeof value != 'string') {
47694
+ return value === 0 ? value : +value;
47695
+ }
47696
+ value = value.replace(reTrim, '');
47697
+ var isBinary = reIsBinary.test(value);
47698
+ return (isBinary || reIsOctal.test(value))
47699
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
47700
+ : (reIsBadHex.test(value) ? NAN : +value);
47701
+ }
47702
+
47703
+ var lodash_debounce = debounce;
47704
+
47705
+ const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
47706
+
47707
+ function useUnmount(func) {
47708
+ const funcRef = K.useRef(func);
47709
+ funcRef.current = func;
47710
+ K.useEffect(
47711
+ () => () => {
47712
+ funcRef.current();
47713
+ },
47714
+ []
47715
+ );
47716
+ }
47717
+
47718
+ // src/useDebounceCallback/useDebounceCallback.ts
47719
+ function useDebounceCallback(func, delay = 500, options) {
47720
+ const debouncedFunc = K.useRef();
47721
+ useUnmount(() => {
47722
+ if (debouncedFunc.current) {
47723
+ debouncedFunc.current.cancel();
47724
+ }
47725
+ });
47726
+ const debounced = K.useMemo(() => {
47727
+ const debouncedFuncInstance = debounce$1(func, delay, options);
47728
+ const wrappedFunc = (...args) => {
47729
+ return debouncedFuncInstance(...args);
47730
+ };
47731
+ wrappedFunc.cancel = () => {
47732
+ debouncedFuncInstance.cancel();
47733
+ };
47734
+ wrappedFunc.isPending = () => {
47735
+ return !!debouncedFunc.current;
47736
+ };
47737
+ wrappedFunc.flush = () => {
47738
+ return debouncedFuncInstance.flush();
47739
+ };
47740
+ return wrappedFunc;
47741
+ }, [func, delay, options]);
47742
+ K.useEffect(() => {
47743
+ debouncedFunc.current = debounce$1(func, delay, options);
47744
+ }, [func, delay, options]);
47745
+ return debounced;
47746
+ }
47747
+
47748
+ function floorToDecimal(num, decimalPlaces) {
47749
+ const factor = 10 ** decimalPlaces;
47750
+ return Math.floor(num * factor) / factor;
47206
47751
  }
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
- }
47752
+ const parseQuotaValue = (key, val) => {
47753
+ let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
47754
+ if (key === "cpu") {
47755
+ if (val.endsWith("m")) {
47756
+ numericValue /= 1e3;
47221
47757
  }
47222
- if (prettyErrors && lineCounter) {
47223
- doc.errors.forEach(prettifyError(source, lineCounter));
47224
- doc.warnings.forEach(prettifyError(source, lineCounter));
47758
+ return floorToDecimal(numericValue, 1);
47759
+ }
47760
+ if (val.endsWith("m")) {
47761
+ numericValue /= 1e3;
47762
+ } else if (val.endsWith("k")) {
47763
+ numericValue /= 1e6;
47764
+ } else if (val.endsWith("M")) {
47765
+ numericValue /= 1e3;
47766
+ } else if (val.endsWith("G")) {
47767
+ numericValue /= 1;
47768
+ } else if (val.endsWith("T")) {
47769
+ numericValue *= 1e3;
47770
+ } else if (val.endsWith("Ki")) {
47771
+ numericValue /= 1024;
47772
+ numericValue /= 1e6;
47773
+ } else if (val.endsWith("Mi")) {
47774
+ numericValue /= 1e3;
47775
+ numericValue /= 1e3;
47776
+ } else if (/^\d+(\.\d+)?$/.test(val)) {
47777
+ numericValue /= 1e9;
47778
+ } else {
47779
+ throw new Error("Invalid value");
47780
+ }
47781
+ return floorToDecimal(numericValue, 1);
47782
+ };
47783
+ const parseQuotaValueCpu = (val) => {
47784
+ if (typeof val === "string") {
47785
+ let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
47786
+ if (val.endsWith("m")) {
47787
+ numericValue /= 1e3;
47225
47788
  }
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 = [];
47789
+ return floorToDecimal(numericValue, 1);
47790
+ }
47791
+ return 0;
47792
+ };
47793
+ const parseQuotaValueMemoryAndStorage = (val) => {
47794
+ if (typeof val === "string") {
47795
+ let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
47796
+ if (val.endsWith("k")) {
47797
+ numericValue /= 1e6;
47798
+ } else if (val.endsWith("m")) {
47799
+ numericValue /= 1e3;
47800
+ } else if (val.endsWith("M")) {
47801
+ numericValue /= 1e3;
47802
+ } else if (val.endsWith("G")) {
47803
+ numericValue /= 1;
47804
+ } else if (val.endsWith("T")) {
47805
+ numericValue *= 1e3;
47806
+ } else if (val.endsWith("P")) {
47807
+ numericValue *= 1e6;
47808
+ } else if (val.endsWith("E")) {
47809
+ numericValue *= 1e9;
47810
+ } else if (val.endsWith("Ki")) {
47811
+ numericValue *= 1024 / 1e9;
47812
+ } else if (val.endsWith("Mi")) {
47813
+ numericValue /= 1048.576;
47814
+ } else if (val.endsWith("Gi")) {
47815
+ numericValue *= 1.073741824;
47816
+ } else if (val.endsWith("Ti")) {
47817
+ numericValue *= 1.099511628;
47818
+ } else if (val.endsWith("Pi")) {
47819
+ numericValue *= 1.125899907;
47820
+ } else if (val.endsWith("Ei")) {
47821
+ numericValue *= 1.152921505;
47822
+ } else if (val === "0") {
47823
+ return 0;
47824
+ } else {
47825
+ throw new Error("Invalid value");
47239
47826
  }
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;
47827
+ return floorToDecimal(numericValue, 1);
47828
+ }
47829
+ return 0;
47830
+ };
47831
+
47832
+ const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
47833
+ let paths = [];
47834
+ if (typeof obj !== "object" || obj === null) {
47835
+ return paths;
47836
+ }
47837
+ if (obj[targetKey] === targetValue) {
47838
+ paths.push([...currentPath]);
47839
+ }
47840
+ for (const key in obj) {
47841
+ if (obj.hasOwnProperty(key)) {
47842
+ const value = obj[key];
47843
+ if (typeof value === "object" && value !== null) {
47844
+ const newPath = [...currentPath, key];
47845
+ const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
47846
+ paths = paths.concat(subPaths);
47847
+ }
47246
47848
  }
47247
- else if (options === undefined && replacer) {
47248
- options = replacer;
47849
+ }
47850
+ return paths;
47851
+ };
47852
+ const normalizeValuesForQuotasToNumber = (object, properties) => {
47853
+ const newObject = _$1.cloneDeep(object);
47854
+ const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
47855
+ const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
47856
+ memoryPaths.forEach((path) => {
47857
+ const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
47858
+ const value = _$1.get(newObject || {}, cleanPath);
47859
+ if (value || value === 0) {
47860
+ _$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
47249
47861
  }
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 };
47862
+ });
47863
+ cpuPaths.forEach((path) => {
47864
+ const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
47865
+ const value = _$1.get(newObject || {}, cleanPath);
47866
+ if (value || value === 0) {
47867
+ _$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
47255
47868
  }
47256
- if (value === undefined) {
47257
- const { keepUndefined } = options ?? replacer ?? {};
47258
- if (!keepUndefined)
47259
- return undefined;
47869
+ });
47870
+ return newObject;
47871
+ };
47872
+
47873
+ const getAllPathsFromObj = (obj, prefix = []) => {
47874
+ const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
47875
+ return entries.flatMap(([key, value]) => {
47876
+ const currentPath = [...prefix, key];
47877
+ return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
47878
+ });
47879
+ };
47880
+
47881
+ const getPrefixSubarrays = (arr) => {
47882
+ return arr.map((_, index) => arr.slice(0, index + 1));
47883
+ };
47884
+
47885
+ const deepMerge = (a, b) => {
47886
+ const result = { ...a };
47887
+ for (const key of Object.keys(b)) {
47888
+ const aVal = a[key];
47889
+ const bVal = b[key];
47890
+ if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
47891
+ result[key] = deepMerge(aVal, bVal);
47892
+ } else {
47893
+ result[key] = bVal;
47260
47894
  }
47261
- if (isDocument(value) && !_replacer)
47262
- return value.toString(options);
47263
- return new Document$1(value, _replacer, options).toString(options);
47264
- }
47895
+ }
47896
+ return result;
47897
+ };
47265
47898
 
47266
- const BorderRadiusContainer$1 = styled.div`
47899
+ const BorderRadiusContainer = styled.div`
47267
47900
  height: 100%;
47268
47901
  border: 1px solid ${({ $colorBorder }) => $colorBorder};
47269
47902
  border-radius: 8px;
@@ -47274,8 +47907,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47274
47907
  border-radius: 8px;
47275
47908
  }
47276
47909
  `;
47277
- const Styled$k = {
47278
- BorderRadiusContainer: BorderRadiusContainer$1
47910
+ const Styled$j = {
47911
+ BorderRadiusContainer
47279
47912
  };
47280
47913
 
47281
47914
  const YamlEditor = ({ theme, currentValues, onChange, editorUri }) => {
@@ -47321,7 +47954,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47321
47954
  }
47322
47955
  }
47323
47956
  }, [yamlData, editorUri]);
47324
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47957
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47325
47958
  Ft,
47326
47959
  {
47327
47960
  language: "yaml",
@@ -47377,165 +48010,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47377
48010
  ) });
47378
48011
  };
47379
48012
 
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
48013
  const getStringByName = (name) => {
47540
48014
  if (typeof name === "string") {
47541
48015
  return name;
@@ -47599,7 +48073,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47599
48073
  const onValuesChangeCallBack = useOnValuesChangeCallback();
47600
48074
  const isTouchedPeristed = useIsTouchedPersisted();
47601
48075
  const updateTouched = useUpdateIsTouchedPersisted();
47602
- const { clusterName, namespace, syntheticProject, entryName } = urlParams;
48076
+ const { cluster, namespace, syntheticProject, name: entryName } = urlParams;
47603
48077
  const form = antd.Form.useFormInstance();
47604
48078
  const fieldValue = antd.Form.useWatch(name === "nodeName" ? "nodeNameBecauseOfSuddenBug" : name, form);
47605
48079
  const fixedName = name === "nodeName" ? "nodeNameBecauseOfSuddenBug" : name;
@@ -47652,7 +48126,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47652
48126
  }, [relatedPath, form, arrName, fixedName, relatedFieldValue, onValuesChangeCallBack, isTouchedPeristed]);
47653
48127
  const uri = prepareTemplate({
47654
48128
  template: customProps.valueUri,
47655
- replaceValues: { clusterName, namespace, syntheticProject, relatedFieldValue, entryName }
48129
+ replaceValues: { cluster, namespace, syntheticProject, relatedFieldValue, name: entryName }
47656
48130
  });
47657
48131
  const {
47658
48132
  data: optionsObj,
@@ -47670,9 +48144,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47670
48144
  if (isErrorOptionsObj && (!customProps.relatedValuePath || customProps.relatedValuePath && !!relatedFieldValue)) {
47671
48145
  return /* @__PURE__ */ jsxRuntimeExports.jsx(HeightContainer, { $height: 64, children: "Error" });
47672
48146
  }
47673
- const items = !isErrorOptionsObj && !isLoadingOptionsObj && optionsObj ? _$1.get(optionsObj, ["items"]) : [];
48147
+ const items = !isErrorOptionsObj && !isLoadingOptionsObj && optionsObj ? _$1.get(optionsObj || {}, ["items"]) : [];
47674
48148
  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];
48149
+ const objValue = Array.isArray(customProps.criteria?.keysToValue) ? _$1.get(item || {}, customProps.criteria?.keysToValue || []) : jp.query(item || {}, `$${customProps.criteria?.keysToValue}`)[0];
47676
48150
  if (customProps.criteria?.type === "equals") {
47677
48151
  return objValue === customProps.criteria?.value;
47678
48152
  }
@@ -47680,18 +48154,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47680
48154
  }) : items;
47681
48155
  const itemForPrefilledValue = customProps.criteria?.keepPrefilled !== false ? items.find((item) => {
47682
48156
  if (Array.isArray(customProps.keysToValue)) {
47683
- return _$1.get(item, customProps.keysToValue) === fieldValue;
48157
+ return _$1.get(item || {}, customProps.keysToValue) === fieldValue;
47684
48158
  }
47685
- return jp.query(item, `$${customProps.keysToValue}`)[0] === fieldValue;
48159
+ return jp.query(item || {}, `$${customProps.keysToValue}`)[0] === fieldValue;
47686
48160
  }) : void 0;
47687
48161
  const filteredItemsAndPrefilledValue = itemForPrefilledValue ? [itemForPrefilledValue, ...filteredItems] : filteredItems;
47688
48162
  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];
48163
+ const value = Array.isArray(customProps.keysToValue) ? _$1.get(item || {}, customProps.keysToValue) : jp.query(item || {}, `$${customProps.keysToValue}`)[0];
47690
48164
  let label = "";
47691
48165
  if (customProps.keysToLabel) {
47692
- label = Array.isArray(customProps.keysToLabel) ? _$1.get(item, customProps.keysToLabel) : jp.query(item, `$${customProps.keysToLabel}`)[0];
48166
+ label = Array.isArray(customProps.keysToLabel) ? _$1.get(item || {}, customProps.keysToLabel) : jp.query(item || {}, `$${customProps.keysToLabel}`)[0];
47693
48167
  } else {
47694
- label = Array.isArray(customProps.keysToValue) ? _$1.get(item, customProps.keysToValue) : jp.query(item, `$${customProps.keysToValue}`)[0];
48168
+ label = Array.isArray(customProps.keysToValue) ? _$1.get(item || {}, customProps.keysToValue) : jp.query(item || {}, `$${customProps.keysToValue}`)[0];
47695
48169
  }
47696
48170
  return {
47697
48171
  value,
@@ -47751,7 +48225,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47751
48225
  keysToValue,
47752
48226
  logic
47753
48227
  }) => {
47754
- const dirtyValue = Array.isArray(keysToValue) ? _$1.get(valueObj, keysToValue) : jp.query(valueObj, `$${keysToValue}`)[0];
48228
+ const dirtyValue = Array.isArray(keysToValue) ? _$1.get(valueObj || {}, keysToValue) : jp.query(valueObj || {}, `$${keysToValue}`)[0];
47755
48229
  if (logic === "cpuLike") {
47756
48230
  return parseQuotaValueCpu(dirtyValue);
47757
48231
  }
@@ -47950,47 +48424,47 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
47950
48424
  urlParams,
47951
48425
  onRemoveByMinus
47952
48426
  }) => {
47953
- const { clusterName, namespace, syntheticProject, entryName } = urlParams;
48427
+ const { cluster, namespace, syntheticProject, name: entryName } = urlParams;
47954
48428
  const minMaxAndStep = isEdit ? customProps.edit : customProps.add;
47955
48429
  const minValueUri = minMaxAndStep.min.type === "resourceValue" ? prepareTemplate({
47956
48430
  template: minMaxAndStep.min.valueUri,
47957
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48431
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47958
48432
  }) : void 0;
47959
48433
  const minSubstractFirstValueUri = minMaxAndStep.min.type === "substractResourceValues" ? prepareTemplate({
47960
48434
  template: minMaxAndStep.min.firstValueUri,
47961
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48435
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47962
48436
  }) : void 0;
47963
48437
  const minSubstractSecondValueUri = minMaxAndStep.min.type === "substractResourceValues" ? prepareTemplate({
47964
48438
  template: minMaxAndStep.min.secondValueUri,
47965
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48439
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47966
48440
  }) : void 0;
47967
48441
  const minAddFirstValueUri = minMaxAndStep.min.type === "addResourceValues" ? prepareTemplate({
47968
48442
  template: minMaxAndStep.min.firstValueUri,
47969
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48443
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47970
48444
  }) : void 0;
47971
48445
  const minAddSecondValueUri = minMaxAndStep.min.type === "addResourceValues" ? prepareTemplate({
47972
48446
  template: minMaxAndStep.min.secondValueUri,
47973
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48447
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47974
48448
  }) : void 0;
47975
48449
  const maxValueUri = minMaxAndStep.max.type === "resourceValue" ? prepareTemplate({
47976
48450
  template: minMaxAndStep.max.valueUri,
47977
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48451
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47978
48452
  }) : void 0;
47979
48453
  const maxSubstractFirstValueUri = minMaxAndStep.max.type === "substractResourceValues" ? prepareTemplate({
47980
48454
  template: minMaxAndStep.max.firstValueUri,
47981
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48455
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47982
48456
  }) : void 0;
47983
48457
  const maxSubstractSecondValueUri = minMaxAndStep.max.type === "substractResourceValues" ? prepareTemplate({
47984
48458
  template: minMaxAndStep.max.secondValueUri,
47985
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48459
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47986
48460
  }) : void 0;
47987
48461
  const maxAddFirstValueUri = minMaxAndStep.max.type === "addResourceValues" ? prepareTemplate({
47988
48462
  template: minMaxAndStep.max.firstValueUri,
47989
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48463
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47990
48464
  }) : void 0;
47991
48465
  const maxAddSecondValueUri = minMaxAndStep.max.type === "addResourceValues" ? prepareTemplate({
47992
48466
  template: minMaxAndStep.max.secondValueUri,
47993
- replaceValues: { clusterName, namespace, syntheticProject, entryName }
48467
+ replaceValues: { cluster, namespace, syntheticProject, name: entryName }
47994
48468
  }) : void 0;
47995
48469
  const {
47996
48470
  data: minValueObj,
@@ -49832,8 +50306,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49832
50306
  isCreate,
49833
50307
  type,
49834
50308
  apiGroupApiVersion,
49835
- kindName,
49836
- typeName,
50309
+ kind,
50310
+ plural,
49837
50311
  backlink,
49838
50312
  designNewLayout,
49839
50313
  designNewLayoutHeight
@@ -49868,8 +50342,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49868
50342
  const yamlToValuesAbortRef = K.useRef(null);
49869
50343
  const isAnyFieldFocusedRef = K.useRef(false);
49870
50344
  const editorUri = K.useMemo(
49871
- () => `inmemory://openapi-ui/${cluster}/${apiGroupApiVersion}/${type}/${typeName}/${kindName}${isCreate ? "/create" : "/edit"}.yaml`,
49872
- [cluster, apiGroupApiVersion, type, typeName, kindName, isCreate]
50345
+ () => `inmemory://openapi-ui/${cluster}/${apiGroupApiVersion}/${type}/${plural}/${kind}${isCreate ? "/create" : "/edit"}.yaml`,
50346
+ [cluster, apiGroupApiVersion, type, plural, kind, isCreate]
49873
50347
  );
49874
50348
  K.useEffect(() => {
49875
50349
  valuesToYamlReqId.current++;
@@ -49887,19 +50361,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49887
50361
  setYamlValues(void 0);
49888
50362
  }, [editorUri]);
49889
50363
  const createPermission = usePermissions({
49890
- group: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
49891
- resource: urlParamsForPermissions.typeName || "",
50364
+ apiGroup: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
50365
+ plural: urlParamsForPermissions.plural || "",
49892
50366
  namespace: isNameSpaced ? namespaceFromFormData : void 0,
49893
- clusterName: cluster,
50367
+ cluster,
49894
50368
  verb: "create",
49895
50369
  refetchInterval: false,
49896
50370
  enabler: isCreate === true
49897
50371
  });
49898
50372
  const updatePermission = usePermissions({
49899
- group: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
49900
- resource: urlParamsForPermissions.typeName || "",
50373
+ apiGroup: type === "builtin" ? void 0 : urlParamsForPermissions.apiGroup ? urlParamsForPermissions.apiGroup : "",
50374
+ plural: urlParamsForPermissions.plural || "",
49901
50375
  namespace: isNameSpaced ? namespaceFromFormData : void 0,
49902
- clusterName: cluster,
50376
+ cluster,
49903
50377
  verb: "update",
49904
50378
  refetchInterval: false,
49905
50379
  enabler: isCreate !== true
@@ -49929,7 +50403,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49929
50403
  payload
49930
50404
  ).then(({ data }) => {
49931
50405
  const body = data;
49932
- const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${typeName}/${isCreate ? "" : name}`;
50406
+ const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${plural}/${isCreate ? "" : name}`;
49933
50407
  if (isCreate) {
49934
50408
  createNewEntry({ endpoint, body }).then((res) => {
49935
50409
  console.log(res);
@@ -49987,7 +50461,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
49987
50461
  const allValues2 = {};
49988
50462
  if (isCreate) {
49989
50463
  _$1.set(allValues2, ["apiVersion"], apiGroupApiVersion === "api/v1" ? "v1" : apiGroupApiVersion);
49990
- _$1.set(allValues2, ["kind"], kindName);
50464
+ _$1.set(allValues2, ["kind"], kind);
49991
50465
  }
49992
50466
  if (formsPrefills) {
49993
50467
  formsPrefills.spec.values.forEach(({ path, value }) => {
@@ -50007,7 +50481,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50007
50481
  }
50008
50482
  const sorted = Object.fromEntries(Object.entries(allValues2).sort(([a], [b]) => a.localeCompare(b)));
50009
50483
  return sorted;
50010
- }, [formsPrefills, prefillValueNamespaceOnly, isCreate, apiGroupApiVersion, kindName, normalizedPrefill]);
50484
+ }, [formsPrefills, prefillValueNamespaceOnly, isCreate, apiGroupApiVersion, kind, normalizedPrefill]);
50011
50485
  const prefillTemplates = K.useMemo(() => {
50012
50486
  const templates = [];
50013
50487
  if (formsPrefills?.spec?.values?.length) {
@@ -50378,7 +50852,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50378
50852
  return true;
50379
50853
  });
50380
50854
  setExpandedKeys([...uniqueKeys]);
50381
- }, [apiGroupApiVersion, formsPrefills, prefillValuesSchema, type, typeName]);
50855
+ }, [apiGroupApiVersion, formsPrefills, prefillValuesSchema, type, plural]);
50382
50856
  K.useEffect(() => {
50383
50857
  if (!initialValues) return;
50384
50858
  setProperties((prev) => {
@@ -50637,7 +51111,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50637
51111
  setIsLoading(true);
50638
51112
  const payload = {
50639
51113
  data,
50640
- clusterName: cluster,
51114
+ cluster,
50641
51115
  customizationId
50642
51116
  };
50643
51117
  axios.post(`/api/clusters/${cluster}/openapi-bff/forms/formPrepare/prepareFormProps`, payload).then(({ data: data2 }) => {
@@ -50656,10 +51130,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50656
51130
  expandedPaths: data2.expandedPaths || [],
50657
51131
  persistedPaths: data2.persistedPaths || [],
50658
51132
  sortPaths: data2.sortPaths,
50659
- kindName: data2.kindName || "",
51133
+ kind: data2.kind || "",
50660
51134
  formPrefills: data2.formPrefills,
50661
51135
  namespacesData: data2.namespacesData
50662
51136
  });
51137
+ setIsError(void 0);
50663
51138
  }
50664
51139
  }).catch((e) => {
50665
51140
  setIsError(e.message);
@@ -50681,7 +51156,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50681
51156
  type: data.type,
50682
51157
  isNameSpaced: isNamespaced,
50683
51158
  apiGroupApiVersion: data.type === "builtin" ? "api/v1" : `${data.apiGroup}/${data.apiVersion}`,
50684
- typeName: data.typeName,
51159
+ plural: data.plural,
50685
51160
  backlink,
50686
51161
  designNewLayout,
50687
51162
  designNewLayoutHeight
@@ -50717,8 +51192,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50717
51192
  type: data.type,
50718
51193
  isNameSpaced: isNamespaced ? preparedData.namespacesData : false,
50719
51194
  apiGroupApiVersion: data.type === "builtin" ? "api/v1" : `${data.apiGroup}/${data.apiVersion}`,
50720
- kindName: preparedData.kindName,
50721
- typeName: data.typeName,
51195
+ kind: preparedData.kind,
51196
+ plural: data.plural,
50722
51197
  backlink,
50723
51198
  designNewLayout,
50724
51199
  designNewLayoutHeight
@@ -50809,11 +51284,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50809
51284
  }
50810
51285
 
50811
51286
  const AddEditFormModal = ({
50812
- clusterName,
51287
+ cluster,
50813
51288
  baseApiGroup,
50814
51289
  baseApiVersion,
50815
- mpResourceName,
50816
- mpResourceKind,
51290
+ marketplacePlural,
51291
+ marketplaceKind,
50817
51292
  isOpen,
50818
51293
  setIsOpen,
50819
51294
  setError,
@@ -50829,7 +51304,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50829
51304
  type: "direct",
50830
51305
  apiGroup: "",
50831
51306
  apiVersion: "",
50832
- typeName: "",
51307
+ plural: "",
50833
51308
  pathToNav: "",
50834
51309
  tags: [],
50835
51310
  disabled: false,
@@ -50838,10 +51313,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50838
51313
  const onSubmit = (values) => {
50839
51314
  if (typeof isOpen === "boolean") {
50840
51315
  createNewEntry({
50841
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}`,
51316
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${marketplacePlural}`,
50842
51317
  body: {
50843
51318
  apiVersion: `${baseApiGroup}/${baseApiVersion}`,
50844
- kind: mpResourceKind,
51319
+ kind: marketplaceKind,
50845
51320
  metadata: {
50846
51321
  name: v4()
50847
51322
  },
@@ -50858,10 +51333,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50858
51333
  return;
50859
51334
  }
50860
51335
  updateEntry({
50861
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}/${isOpen.metadata.name}`,
51336
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${marketplacePlural}/${isOpen.metadata.name}`,
50862
51337
  body: {
50863
51338
  apiVersion: `${baseApiGroup}/${baseApiVersion}`,
50864
- kind: mpResourceKind,
51339
+ kind: marketplaceKind,
50865
51340
  metadata: {
50866
51341
  name: isOpen.metadata.name,
50867
51342
  resourceVersion: isOpen.metadata.resourceVersion
@@ -50907,7 +51382,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50907
51382
  ) }),
50908
51383
  /* @__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
51384
  /* @__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" }) }),
51385
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter resource type", name: "plural", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type === "direct" }) }),
50911
51386
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Enter path", name: "pathToNav", children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Input, { disabled: type !== "direct" }) }),
50912
51387
  /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Form.Item, { label: "Tags", name: "tags", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50913
51388
  antd.Select,
@@ -50926,11 +51401,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50926
51401
  };
50927
51402
 
50928
51403
  const getPathToNav = ({
50929
- clusterName,
51404
+ cluster,
50930
51405
  namespace,
50931
51406
  type,
50932
51407
  pathToNav,
50933
- typeName,
51408
+ plural,
50934
51409
  apiGroup,
50935
51410
  apiVersion,
50936
51411
  baseprefix
@@ -50940,19 +51415,19 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50940
51415
  return pathToNav;
50941
51416
  }
50942
51417
  if (type === "crd") {
50943
- return `/${baseprefix}/${clusterName}/${namespace}/crd-table/${apiGroup}/${apiVersion}/${apiExtensionVersion}/${typeName}`;
51418
+ return `/${baseprefix}/${cluster}/${namespace}/crd-table/${apiGroup}/${apiVersion}/${apiExtensionVersion}/${plural}`;
50944
51419
  }
50945
51420
  if (type === "nonCrd") {
50946
- return `/${baseprefix}/${clusterName}/${namespace}/api-table/${apiGroup}/${apiVersion}/${typeName}`;
51421
+ return `/${baseprefix}/${cluster}/${namespace}/api-table/${apiGroup}/${apiVersion}/${plural}`;
50947
51422
  }
50948
- return `/${baseprefix}/${clusterName}/${namespace}/builtin-table/${typeName}`;
51423
+ return `/${baseprefix}/${cluster}/${namespace}/builtin-table/${plural}`;
50949
51424
  };
50950
51425
  const getCreatePathToNav = ({
50951
- clusterName,
51426
+ cluster,
50952
51427
  namespace,
50953
51428
  type,
50954
51429
  pathToNav,
50955
- typeName,
51430
+ plural,
50956
51431
  apiGroup,
50957
51432
  apiVersion,
50958
51433
  baseprefix
@@ -50961,12 +51436,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
50961
51436
  return pathToNav;
50962
51437
  }
50963
51438
  if (type === "crd") {
50964
- return `/${baseprefix}/${clusterName}/${namespace}/forms/crds/${apiGroup}/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
51439
+ return `/${baseprefix}/${cluster}/${namespace}/forms/crds/${apiGroup}/${apiVersion}/${plural}?backlink=${window.location.pathname}`;
50965
51440
  }
50966
51441
  if (type === "nonCrd") {
50967
- return `/${baseprefix}/${clusterName}/${namespace}/forms/apis/${apiGroup}/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
51442
+ return `/${baseprefix}/${cluster}/${namespace}/forms/apis/${apiGroup}/${apiVersion}/${plural}?backlink=${window.location.pathname}`;
50968
51443
  }
50969
- return `/${baseprefix}/${clusterName}/${namespace}/forms/builtin/${apiVersion}/${typeName}?backlink=${window.location.pathname}`;
51444
+ return `/${baseprefix}/${cluster}/${namespace}/forms/builtin/${apiVersion}/${plural}?backlink=${window.location.pathname}`;
50970
51445
  };
50971
51446
 
50972
51447
  const CustomCard$4 = styled(antd.Card)`
@@ -51056,11 +51531,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51056
51531
  description,
51057
51532
  name,
51058
51533
  icon,
51059
- clusterName,
51534
+ cluster,
51060
51535
  namespace,
51061
51536
  type,
51062
51537
  pathToNav,
51063
- typeName,
51538
+ plural,
51064
51539
  apiGroup,
51065
51540
  apiVersion,
51066
51541
  tags,
@@ -51082,29 +51557,29 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51082
51557
  decodedIcon = "Can't decode";
51083
51558
  }
51084
51559
  const navigateUrl = addedMode || standalone ? getPathToNav({
51085
- clusterName,
51560
+ cluster,
51086
51561
  namespace,
51087
51562
  type,
51088
51563
  pathToNav,
51089
- typeName,
51564
+ plural,
51090
51565
  apiGroup,
51091
51566
  apiVersion,
51092
51567
  baseprefix
51093
51568
  }) : getCreatePathToNav({
51094
- clusterName,
51569
+ cluster,
51095
51570
  namespace,
51096
51571
  type,
51097
51572
  pathToNav,
51098
- typeName,
51573
+ plural,
51099
51574
  apiGroup,
51100
51575
  apiVersion,
51101
51576
  baseprefix
51102
51577
  });
51103
51578
  const { data: k8sList, error: k8sListError } = useK8sSmartResource({
51104
- cluster: clusterName || "",
51579
+ cluster,
51105
51580
  namespace,
51106
- group: apiGroup,
51107
- version: apiVersion || "",
51581
+ apiGroup,
51582
+ apiVersion: apiVersion || "",
51108
51583
  plural: type,
51109
51584
  isEnabled: Boolean(apiVersion && addedMode && type !== "direct")
51110
51585
  });
@@ -51215,12 +51690,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51215
51690
  };
51216
51691
 
51217
51692
  const MarketPlace = ({
51218
- clusterName,
51693
+ cluster,
51219
51694
  namespace,
51220
51695
  baseApiGroup,
51221
51696
  baseApiVersion,
51222
- mpResourceName,
51223
- mpResourceKind,
51697
+ marketplacePlural,
51698
+ marketplaceKind,
51224
51699
  baseprefix,
51225
51700
  standalone,
51226
51701
  forceAddedMode,
@@ -51241,30 +51716,29 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51241
51716
  isLoading,
51242
51717
  error
51243
51718
  } = useK8sSmartResource({
51244
- cluster: clusterName || "",
51245
- group: baseApiGroup,
51246
- version: baseApiVersion,
51247
- plural: mpResourceName,
51248
- isEnabled: Boolean(clusterName !== void 0)
51719
+ cluster,
51720
+ apiGroup: baseApiGroup,
51721
+ apiVersion: baseApiVersion,
51722
+ plural: marketplacePlural
51249
51723
  });
51250
51724
  const createPermission = usePermissions({
51251
- group: baseApiGroup,
51252
- resource: mpResourceName,
51253
- clusterName: clusterName || "",
51725
+ apiGroup: baseApiGroup,
51726
+ plural: marketplacePlural,
51727
+ cluster,
51254
51728
  verb: "create",
51255
51729
  refetchInterval: false
51256
51730
  });
51257
51731
  const updatePermission = usePermissions({
51258
- group: baseApiGroup,
51259
- resource: mpResourceName,
51260
- clusterName: clusterName || "",
51732
+ apiGroup: baseApiGroup,
51733
+ plural: marketplacePlural,
51734
+ cluster,
51261
51735
  verb: "update",
51262
51736
  refetchInterval: false
51263
51737
  });
51264
51738
  const deletePermission = usePermissions({
51265
- group: baseApiGroup,
51266
- resource: mpResourceName,
51267
- clusterName: clusterName || "",
51739
+ apiGroup: baseApiGroup,
51740
+ plural: marketplacePlural,
51741
+ cluster,
51268
51742
  verb: "delete",
51269
51743
  refetchInterval: false
51270
51744
  });
@@ -51351,8 +51825,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51351
51825
  }
51352
51826
  ),
51353
51827
  /* @__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(
51828
+ namespace && filteredAndSortedData.map(
51829
+ ({ name, description, icon, type, pathToNav, plural, apiGroup, apiVersion, tags, disabled }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
51356
51830
  MarketplaceCard,
51357
51831
  {
51358
51832
  baseprefix,
@@ -51361,11 +51835,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51361
51835
  icon,
51362
51836
  isEditMode,
51363
51837
  name,
51364
- clusterName,
51838
+ cluster,
51365
51839
  namespace,
51366
51840
  type,
51367
51841
  pathToNav,
51368
- typeName,
51842
+ plural,
51369
51843
  apiGroup,
51370
51844
  apiVersion,
51371
51845
  tags,
@@ -51395,11 +51869,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51395
51869
  isAddEditOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
51396
51870
  AddEditFormModal,
51397
51871
  {
51398
- clusterName,
51872
+ cluster,
51399
51873
  baseApiGroup,
51400
51874
  baseApiVersion,
51401
- mpResourceName,
51402
- mpResourceKind,
51875
+ marketplacePlural,
51876
+ marketplaceKind,
51403
51877
  isOpen: isAddEditOpen,
51404
51878
  setError: setCreateUpdateError,
51405
51879
  setIsOpen: setIsAddEditOpen,
@@ -51412,7 +51886,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51412
51886
  {
51413
51887
  name: isDeleteOpen.name,
51414
51888
  onClose: () => setIsDeleteOpen(false),
51415
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${mpResourceName}/${isDeleteOpen.name}`
51889
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseApiGroup}/${baseApiVersion}/${marketplacePlural}/${isDeleteOpen.name}`
51416
51890
  }
51417
51891
  )
51418
51892
  ] });
@@ -51531,14 +52005,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51531
52005
  ActionMenuPlaceholder};
51532
52006
 
51533
52007
  const ProjectInfoCard = ({
51534
- clusterName,
52008
+ cluster,
51535
52009
  namespace,
51536
52010
  baseApiGroup,
51537
52011
  baseApiVersion,
51538
52012
  baseProjectApiGroup,
51539
52013
  baseProjectVersion,
51540
- mpResourceName,
51541
- projectResourceName,
52014
+ marketplacePlural,
52015
+ projectPlural,
51542
52016
  baseprefix,
51543
52017
  accessGroups,
51544
52018
  showZeroResources,
@@ -51550,45 +52024,43 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51550
52024
  isLoading: marketplaceIsLoading
51551
52025
  // error: marketplaceError,
51552
52026
  } = useK8sSmartResource({
51553
- cluster: clusterName || "",
51554
- group: baseApiGroup,
51555
- version: baseApiVersion,
51556
- plural: mpResourceName,
51557
- isEnabled: Boolean(clusterName !== void 0)
52027
+ cluster,
52028
+ apiGroup: baseApiGroup,
52029
+ apiVersion: baseApiVersion,
52030
+ plural: marketplacePlural
51558
52031
  });
51559
52032
  const {
51560
52033
  data: projectArr,
51561
52034
  isLoading,
51562
52035
  error
51563
52036
  } = useK8sSmartResource({
51564
- cluster: clusterName || "",
51565
- group: baseProjectApiGroup,
51566
- version: baseProjectVersion,
51567
- plural: projectResourceName,
51568
- fieldSelector: `metadata.name=${namespace}`,
51569
- isEnabled: Boolean(clusterName !== void 0)
52037
+ cluster,
52038
+ apiGroup: baseProjectApiGroup,
52039
+ apiVersion: baseProjectVersion,
52040
+ plural: projectPlural,
52041
+ fieldSelector: `metadata.name=${namespace}`
51570
52042
  });
51571
52043
  const project = projectArr && projectArr.items && projectArr.items.length > 0 ? projectArr.items[0] : void 0;
51572
52044
  const [isDeleteModalOpen, setIsDeleteModalOpen] = K.useState(false);
51573
52045
  const updatePermission = usePermissions({
51574
- group: baseProjectApiGroup,
51575
- resource: projectResourceName,
51576
- clusterName: clusterName || "",
52046
+ apiGroup: baseProjectApiGroup,
52047
+ plural: projectPlural,
52048
+ cluster,
51577
52049
  verb: "update",
51578
52050
  refetchInterval: false
51579
52051
  });
51580
52052
  const deletePermission = usePermissions({
51581
- group: baseProjectApiGroup,
51582
- resource: projectResourceName,
51583
- clusterName: clusterName || "",
52053
+ apiGroup: baseProjectApiGroup,
52054
+ plural: projectPlural,
52055
+ cluster,
51584
52056
  verb: "delete",
51585
52057
  refetchInterval: false
51586
52058
  });
51587
52059
  const openUpdate = K.useCallback(() => {
51588
52060
  navigate(
51589
- `/${baseprefix}/${clusterName}/forms/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectResourceName}/${namespace}?backlink=${baseprefix}/clusters/${clusterName}`
52061
+ `/${baseprefix}/${cluster}/forms/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectPlural}/${namespace}?backlink=${baseprefix}/clusters/${cluster}`
51590
52062
  );
51591
- }, [baseprefix, clusterName, namespace, baseProjectApiGroup, baseProjectVersion, projectResourceName, navigate]);
52063
+ }, [baseprefix, cluster, namespace, baseProjectApiGroup, baseProjectVersion, projectPlural, navigate]);
51592
52064
  if (isLoading) {
51593
52065
  return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {});
51594
52066
  }
@@ -51617,7 +52089,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51617
52089
  /* @__PURE__ */ jsxRuntimeExports.jsx(Spacer$1, { $space: 12, $samespace: true }),
51618
52090
  /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: 22, wrap: true, children: [
51619
52091
  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(
52092
+ namespace && marketplacePanels?.items.map(({ spec }) => spec).sort().map(({ name, description, icon, type, pathToNav, plural, apiGroup, apiVersion, tags, disabled }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
51621
52093
  MarketplaceCard,
51622
52094
  {
51623
52095
  baseprefix,
@@ -51626,11 +52098,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51626
52098
  icon,
51627
52099
  isEditMode: false,
51628
52100
  name,
51629
- clusterName,
52101
+ cluster,
51630
52102
  namespace,
51631
52103
  type,
51632
52104
  pathToNav,
51633
- typeName,
52105
+ plural,
51634
52106
  apiGroup,
51635
52107
  apiVersion,
51636
52108
  tags,
@@ -51646,9 +52118,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
51646
52118
  name: project.metadata.name,
51647
52119
  onClose: () => {
51648
52120
  setIsDeleteModalOpen(false);
51649
- navigate(`${baseprefix}/clusters/${clusterName}`);
52121
+ navigate(`${baseprefix}/clusters/${cluster}`);
51650
52122
  },
51651
- endpoint: `/api/clusters/${clusterName}/k8s/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectResourceName}/${project.metadata.name}`
52123
+ endpoint: `/api/clusters/${cluster}/k8s/apis/${baseProjectApiGroup}/${baseProjectVersion}/${projectPlural}/${project.metadata.name}`
51652
52124
  }
51653
52125
  )
51654
52126
  ] });
@@ -52444,14 +52916,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
52444
52916
  ] });
52445
52917
  };
52446
52918
 
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
52919
  const SelectTag = styled(antd.Tag)`
52456
52920
  margin-inline-end: 4px;
52457
52921
  padding: 4px 6px;
@@ -53191,14 +53655,14 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53191
53655
  baseFactoryNamespacedBuiltinKey,
53192
53656
  baseFactoryClusterSceopedBuiltinKey,
53193
53657
  baseNamespaceFactoryKey,
53194
- baseNavigationPluralName,
53195
- baseNavigationSpecificName
53658
+ baseNavigationPlural,
53659
+ baseNavigationName
53196
53660
  }) => {
53197
53661
  const { token } = antd.theme.useToken();
53198
53662
  const [kindIndex, setKindIndex] = K.useState();
53199
53663
  const [kindsWithVersion, setKindWithVersion] = K.useState();
53200
53664
  K.useEffect(() => {
53201
- getKinds({ clusterName: cluster }).then((data) => {
53665
+ getKinds({ cluster }).then((data) => {
53202
53666
  setKindIndex(data);
53203
53667
  setKindWithVersion(getSortedKindsAll(data));
53204
53668
  }).catch((error) => {
@@ -53207,10 +53671,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53207
53671
  }, [cluster]);
53208
53672
  const { data: navigationDataArr } = useK8sSmartResource({
53209
53673
  cluster,
53210
- group: "front.in-cloud.io",
53211
- version: "v1alpha1",
53212
- plural: baseNavigationPluralName,
53213
- fieldSelector: `metadata.name=${baseNavigationSpecificName}`
53674
+ apiGroup: "front.in-cloud.io",
53675
+ apiVersion: "v1alpha1",
53676
+ plural: baseNavigationPlural,
53677
+ fieldSelector: `metadata.name=${baseNavigationName}`
53214
53678
  });
53215
53679
  const [isPaused, setIsPaused] = K.useState(false);
53216
53680
  const pausedRef = K.useRef(isPaused);
@@ -53554,44 +54018,44 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53554
54018
  };
53555
54019
 
53556
54020
  const filterIfApiInstanceNamespaceScoped = async ({
54021
+ cluster,
53557
54022
  namespace,
53558
- data,
53559
54023
  apiGroup,
53560
54024
  apiVersion,
53561
- clusterName
54025
+ data
53562
54026
  }) => {
53563
54027
  const payload = {
54028
+ cluster,
53564
54029
  namespace,
53565
- data,
53566
54030
  apiGroup,
53567
54031
  apiVersion,
53568
- clusterName
54032
+ data
53569
54033
  };
53570
54034
  const result = await axios.post(
53571
- `/api/clusters/${clusterName}/openapi-bff/scopes/filterScopes/filterIfApiNamespaceScoped`,
54035
+ `/api/clusters/${cluster}/openapi-bff/scopes/filterScopes/filterIfApiNamespaceScoped`,
53572
54036
  payload
53573
54037
  );
53574
54038
  return result.data;
53575
54039
  };
53576
54040
  const filterIfBuiltInInstanceNamespaceScoped = async ({
54041
+ cluster,
53577
54042
  namespace,
53578
- data,
53579
- clusterName
54043
+ data
53580
54044
  }) => {
53581
54045
  const payload = {
54046
+ cluster,
53582
54047
  namespace,
53583
- data,
53584
- clusterName
54048
+ data
53585
54049
  };
53586
54050
  const result = await axios.post(
53587
- `/api/clusters/${clusterName}/openapi-bff/scopes/filterScopes/filterIfBuiltInNamespaceScoped`,
54051
+ `/api/clusters/${cluster}/openapi-bff/scopes/filterScopes/filterIfBuiltInNamespaceScoped`,
53588
54052
  payload
53589
54053
  );
53590
54054
  return result.data;
53591
54055
  };
53592
54056
 
53593
54057
  const getGroupsByCategory = async ({
53594
- clusterName,
54058
+ cluster,
53595
54059
  apiGroupListData,
53596
54060
  builtinResourceTypesData,
53597
54061
  namespace,
@@ -53603,7 +54067,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53603
54067
  const filteredBuiltinData = await filterIfBuiltInInstanceNamespaceScoped({
53604
54068
  namespace,
53605
54069
  data: builtinResourceTypesData,
53606
- clusterName
54070
+ cluster
53607
54071
  });
53608
54072
  return { crdGroups, nonCrdGroups, builtinGroups: filteredBuiltinData, apiExtensionVersion };
53609
54073
  };
@@ -53718,12 +54182,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53718
54182
  };
53719
54183
 
53720
54184
  const getApiResources = async ({
53721
- clusterName,
54185
+ cluster,
53722
54186
  namespace,
53723
54187
  apiGroup,
53724
54188
  apiVersion,
53725
- typeName,
53726
- specificName,
54189
+ plural,
54190
+ name,
53727
54191
  labels,
53728
54192
  fields,
53729
54193
  limit
@@ -53740,27 +54204,27 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53740
54204
  }
53741
54205
  const searchParams = params.toString();
53742
54206
  return axios.get(
53743
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${typeName}${specificName ? `/${specificName}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
54207
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${plural}${name ? `/${name}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
53744
54208
  );
53745
54209
  };
53746
54210
  const getApiResourceSingle = async ({
53747
- clusterName,
54211
+ cluster,
53748
54212
  namespace,
53749
54213
  apiGroup,
53750
54214
  apiVersion,
53751
- typeName,
53752
- entryName
54215
+ plural,
54216
+ name
53753
54217
  }) => {
53754
54218
  return axios.get(
53755
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${typeName}/${entryName}`
54219
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${plural}/${name}`
53756
54220
  );
53757
54221
  };
53758
54222
 
53759
54223
  const getBuiltinResources = async ({
53760
- clusterName,
54224
+ cluster,
53761
54225
  namespace,
53762
- typeName,
53763
- specificName,
54226
+ plural,
54227
+ name,
53764
54228
  labels,
53765
54229
  fields,
53766
54230
  limit
@@ -53777,105 +54241,101 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53777
54241
  }
53778
54242
  const searchParams = params.toString();
53779
54243
  return axios.get(
53780
- `/api/clusters/${clusterName}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${typeName}${specificName ? `/${specificName}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
54244
+ `/api/clusters/${cluster}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${plural}${name ? `/${name}` : ""}${searchParams.length > 0 ? `?${searchParams}` : ""}`
53781
54245
  );
53782
54246
  };
53783
54247
  const getBuiltinResourceSingle = async ({
53784
- clusterName,
54248
+ cluster,
53785
54249
  namespace,
53786
- typeName,
53787
- entryName
54250
+ plural,
54251
+ name
53788
54252
  }) => {
53789
54253
  return axios.get(
53790
- `/api/clusters/${clusterName}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${typeName}/${entryName}`
54254
+ `/api/clusters/${cluster}/k8s/api/v1${namespace ? `/namespaces/${namespace}` : ""}/${plural}/${name}`
53791
54255
  );
53792
54256
  };
53793
54257
 
53794
54258
  const getCrdResources = async ({
53795
- clusterName,
54259
+ cluster,
53796
54260
  namespace,
53797
54261
  apiGroup,
53798
54262
  apiVersion,
53799
54263
  crdName
53800
54264
  }) => {
53801
54265
  return axios.get(
53802
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}`
54266
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}`
53803
54267
  );
53804
54268
  };
53805
54269
  const getCrdResourceSingle = async ({
53806
- clusterName,
54270
+ cluster,
53807
54271
  namespace,
53808
54272
  apiGroup,
53809
54273
  apiVersion,
53810
54274
  crdName,
53811
- entryName
54275
+ name
53812
54276
  }) => {
53813
54277
  return axios.get(
53814
- `/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}/${entryName}`
54278
+ `/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}${namespace ? `/namespaces/${namespace}` : ""}/${crdName}/${name}`
53815
54279
  );
53816
54280
  };
53817
54281
 
53818
- const getApiResourceTypes = async ({ clusterName }) => {
53819
- return axios.get(`/api/clusters/${clusterName}/k8s/apis/`);
54282
+ const getApiResourceTypes = async ({ cluster }) => {
54283
+ return axios.get(`/api/clusters/${cluster}/k8s/apis/`);
53820
54284
  };
53821
54285
  const getApiResourceTypesByApiGroup = async ({
53822
- clusterName,
54286
+ cluster,
53823
54287
  apiGroup,
53824
54288
  apiVersion
53825
54289
  }) => {
53826
- return axios.get(`/api/clusters/${clusterName}/k8s/apis/${apiGroup}/${apiVersion}/`);
54290
+ return axios.get(`/api/clusters/${cluster}/k8s/apis/${apiGroup}/${apiVersion}/`);
53827
54291
  };
53828
54292
 
53829
- const getBuiltinResourceTypes = async ({
53830
- clusterName
53831
- }) => {
53832
- return axios.get(`/api/clusters/${clusterName}/k8s/api/v1`);
54293
+ const getBuiltinResourceTypes = async ({ cluster }) => {
54294
+ return axios.get(`/api/clusters/${cluster}/k8s/api/v1`);
53833
54295
  };
53834
54296
 
53835
54297
  const getCrdData = async ({
53836
- clusterName,
54298
+ cluster,
53837
54299
  apiExtensionVersion,
53838
54300
  crdName
53839
54301
  }) => {
53840
54302
  return axios.get(
53841
- `/api/clusters/${clusterName}/k8s/apis/apiextensions.k8s.io/${apiExtensionVersion}/customresourcedefinitions/${crdName}`
54303
+ `/api/clusters/${cluster}/k8s/apis/apiextensions.k8s.io/${apiExtensionVersion}/customresourcedefinitions/${crdName}`
53842
54304
  );
53843
54305
  };
53844
54306
 
53845
- const getSwagger = async ({
53846
- clusterName
53847
- }) => {
53848
- return axios.get(`/api/clusters/${clusterName}/openapi-bff/swagger/swagger/${clusterName}`);
54307
+ const getSwagger = async ({ cluster }) => {
54308
+ return axios.get(`/api/clusters/${cluster}/openapi-bff/swagger/swagger/${cluster}`);
53849
54309
  };
53850
54310
 
53851
54311
  const checkIfApiInstanceNamespaceScoped = async ({
53852
- typeName,
54312
+ plural,
53853
54313
  apiGroup,
53854
54314
  apiVersion,
53855
- clusterName
54315
+ cluster
53856
54316
  }) => {
53857
54317
  const payload = {
53858
- typeName,
54318
+ plural,
53859
54319
  apiGroup,
53860
54320
  apiVersion,
53861
- clusterName
54321
+ cluster
53862
54322
  };
53863
54323
  const { data } = await axios.post(
53864
- `/api/clusters/${clusterName}/openapi-bff/scopes/checkScopes/checkIfApiNamespaceScoped`,
54324
+ `/api/clusters/${cluster}/openapi-bff/scopes/checkScopes/checkIfApiNamespaceScoped`,
53865
54325
  payload
53866
54326
  );
53867
54327
  return data;
53868
54328
  };
53869
54329
  const checkIfBuiltInInstanceNamespaceScoped = async ({
53870
- typeName,
53871
- clusterName
54330
+ plural,
54331
+ cluster
53872
54332
  }) => {
53873
54333
  const payload = {
53874
- typeName,
53875
- clusterName
54334
+ plural,
54335
+ cluster
53876
54336
  };
53877
54337
  const { data } = await axios.post(
53878
- `/api/clusters/${clusterName}/openapi-bff/scopes/checkScopes/checkIfBuiltInNamespaceScoped`,
54338
+ `/api/clusters/${cluster}/openapi-bff/scopes/checkScopes/checkIfBuiltInNamespaceScoped`,
53879
54339
  payload
53880
54340
  );
53881
54341
  return data;
@@ -53890,12 +54350,12 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53890
54350
  };
53891
54351
 
53892
54352
  const useApiResources = ({
53893
- clusterName,
54353
+ cluster,
53894
54354
  namespace,
53895
54355
  apiGroup,
53896
54356
  apiVersion,
53897
- typeName,
53898
- specificName,
54357
+ plural,
54358
+ name,
53899
54359
  labels,
53900
54360
  fields,
53901
54361
  limit,
@@ -53903,26 +54363,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53903
54363
  isEnabled
53904
54364
  }) => {
53905
54365
  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
- ],
54366
+ queryKey: ["useApiResources", cluster, namespace, apiGroup, apiVersion, plural, name, labels, fields, limit],
53918
54367
  queryFn: async () => {
53919
54368
  const response = await getApiResources({
53920
- clusterName,
54369
+ cluster,
53921
54370
  namespace,
53922
54371
  apiGroup,
53923
54372
  apiVersion,
53924
- typeName,
53925
- specificName,
54373
+ plural,
54374
+ name,
53926
54375
  labels,
53927
54376
  fields,
53928
54377
  limit
@@ -53938,33 +54387,33 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53938
54387
  });
53939
54388
  };
53940
54389
  const useApiResourceSingle = ({
53941
- clusterName,
54390
+ cluster,
53942
54391
  namespace,
53943
54392
  apiGroup,
53944
54393
  apiVersion,
53945
- typeName,
53946
- entryName,
54394
+ plural,
54395
+ name,
53947
54396
  refetchInterval
53948
54397
  }) => {
53949
54398
  return reactQuery.useQuery({
53950
- queryKey: ["useApiResourceSingle", clusterName, namespace, apiGroup, apiVersion, typeName, entryName],
54399
+ queryKey: ["useApiResourceSingle", cluster, namespace, apiGroup, apiVersion, plural, name],
53951
54400
  queryFn: async () => (await getApiResourceSingle({
53952
- clusterName,
54401
+ cluster,
53953
54402
  namespace,
53954
54403
  apiGroup,
53955
54404
  apiVersion,
53956
- typeName,
53957
- entryName
54405
+ plural,
54406
+ name
53958
54407
  })).data,
53959
54408
  refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
53960
54409
  });
53961
54410
  };
53962
54411
 
53963
54412
  const useBuiltinResources = ({
53964
- clusterName,
54413
+ cluster,
53965
54414
  namespace,
53966
- typeName,
53967
- specificName,
54415
+ plural,
54416
+ name,
53968
54417
  labels,
53969
54418
  fields,
53970
54419
  limit,
@@ -53972,13 +54421,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53972
54421
  isEnabled
53973
54422
  }) => {
53974
54423
  return reactQuery.useQuery({
53975
- queryKey: ["useBuiltinResourceType", clusterName, namespace, typeName, specificName, labels, fields, limit],
54424
+ queryKey: ["useBuiltinResourceType", cluster, namespace, plural, name, labels, fields, limit],
53976
54425
  queryFn: async () => {
53977
54426
  const response = await getBuiltinResources({
53978
- clusterName,
54427
+ cluster,
53979
54428
  namespace,
53980
- typeName,
53981
- specificName,
54429
+ plural,
54430
+ name,
53982
54431
  labels,
53983
54432
  fields,
53984
54433
  limit
@@ -53994,21 +54443,21 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
53994
54443
  });
53995
54444
  };
53996
54445
  const useBuiltinResourceSingle = ({
53997
- clusterName,
54446
+ cluster,
53998
54447
  namespace,
53999
- typeName,
54000
- entryName,
54448
+ plural,
54449
+ name,
54001
54450
  refetchInterval
54002
54451
  }) => {
54003
54452
  return reactQuery.useQuery({
54004
- queryKey: ["useBuiltinResourceSingle", clusterName, namespace, typeName, entryName],
54005
- queryFn: async () => (await getBuiltinResourceSingle({ clusterName, namespace, typeName, entryName })).data,
54453
+ queryKey: ["useBuiltinResourceSingle", cluster, namespace, plural, name],
54454
+ queryFn: async () => (await getBuiltinResourceSingle({ cluster, namespace, plural, name })).data,
54006
54455
  refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
54007
54456
  });
54008
54457
  };
54009
54458
 
54010
54459
  const useCrdResources = ({
54011
- clusterName,
54460
+ cluster,
54012
54461
  namespace,
54013
54462
  apiGroup,
54014
54463
  apiVersion,
@@ -54017,10 +54466,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54017
54466
  isEnabled
54018
54467
  }) => {
54019
54468
  return reactQuery.useQuery({
54020
- queryKey: ["useCrdResources", clusterName, namespace, apiGroup, apiVersion, crdName],
54469
+ queryKey: ["useCrdResources", cluster, namespace, apiGroup, apiVersion, crdName],
54021
54470
  queryFn: async () => {
54022
54471
  const response = await getCrdResources({
54023
- clusterName,
54472
+ cluster,
54024
54473
  namespace,
54025
54474
  apiGroup,
54026
54475
  apiVersion,
@@ -54037,33 +54486,33 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54037
54486
  });
54038
54487
  };
54039
54488
  const useCrdResourceSingle = ({
54040
- clusterName,
54489
+ cluster,
54041
54490
  namespace,
54042
54491
  apiGroup,
54043
54492
  apiVersion,
54044
54493
  crdName,
54045
- entryName,
54494
+ name,
54046
54495
  refetchInterval
54047
54496
  }) => {
54048
54497
  return reactQuery.useQuery({
54049
- queryKey: ["useCrdResourceSingle", clusterName, namespace, apiGroup, apiVersion, crdName, entryName],
54498
+ queryKey: ["useCrdResourceSingle", cluster, namespace, apiGroup, apiVersion, crdName, name],
54050
54499
  queryFn: async () => (await getCrdResourceSingle({
54051
- clusterName,
54500
+ cluster,
54052
54501
  namespace,
54053
54502
  apiGroup,
54054
54503
  apiVersion,
54055
54504
  crdName,
54056
- entryName
54505
+ name
54057
54506
  })).data,
54058
54507
  refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
54059
54508
  });
54060
54509
  };
54061
54510
 
54062
- const useApisResourceTypes = ({ clusterName }) => {
54511
+ const useApisResourceTypes = ({ cluster }) => {
54063
54512
  return reactQuery.useQuery({
54064
- queryKey: ["useApisResourceTypes", clusterName],
54513
+ queryKey: ["useApisResourceTypes", cluster],
54065
54514
  queryFn: async () => {
54066
- const response = await getApiResourceTypes({ clusterName });
54515
+ const response = await getApiResourceTypes({ cluster });
54067
54516
  const data = JSON.parse(JSON.stringify(response.data));
54068
54517
  if (data.metadata?.resourceVersion) {
54069
54518
  delete data.metadata.resourceVersion;
@@ -54074,15 +54523,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54074
54523
  });
54075
54524
  };
54076
54525
  const useApiResourceTypesByGroup = ({
54077
- clusterName,
54526
+ cluster,
54078
54527
  apiGroup,
54079
54528
  apiVersion
54080
54529
  }) => {
54081
54530
  return reactQuery.useQuery({
54082
- queryKey: ["useApiResourceTypesByGroup", clusterName, apiGroup, apiVersion],
54531
+ queryKey: ["useApiResourceTypesByGroup", cluster, apiGroup, apiVersion],
54083
54532
  queryFn: async () => {
54084
54533
  const response = await getApiResourceTypesByApiGroup({
54085
- clusterName,
54534
+ cluster,
54086
54535
  apiGroup,
54087
54536
  apiVersion
54088
54537
  });
@@ -54096,11 +54545,11 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54096
54545
  });
54097
54546
  };
54098
54547
 
54099
- const useBuiltinResourceTypes = ({ clusterName }) => {
54548
+ const useBuiltinResourceTypes = ({ cluster }) => {
54100
54549
  return reactQuery.useQuery({
54101
- queryKey: ["useBuiltinResourceTypes", clusterName],
54550
+ queryKey: ["useBuiltinResourceTypes", cluster],
54102
54551
  queryFn: async () => {
54103
- const response = await getBuiltinResourceTypes({ clusterName });
54552
+ const response = await getBuiltinResourceTypes({ cluster });
54104
54553
  const data = JSON.parse(JSON.stringify(response.data));
54105
54554
  if (data.metadata?.resourceVersion) {
54106
54555
  delete data.metadata.resourceVersion;
@@ -54112,15 +54561,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54112
54561
  };
54113
54562
 
54114
54563
  const useCrdData = ({
54115
- clusterName,
54564
+ cluster,
54116
54565
  apiExtensionVersion,
54117
54566
  crdName
54118
54567
  }) => {
54119
54568
  return reactQuery.useQuery({
54120
- queryKey: ["useCrdData", clusterName, apiExtensionVersion, crdName],
54569
+ queryKey: ["useCrdData", cluster, apiExtensionVersion, crdName],
54121
54570
  queryFn: async () => {
54122
54571
  const response = await getCrdData({
54123
- clusterName,
54572
+ cluster,
54124
54573
  apiExtensionVersion,
54125
54574
  crdName
54126
54575
  });
@@ -54271,7 +54720,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
54271
54720
  exports.useK8sSmartResource = useK8sSmartResource;
54272
54721
  exports.useK8sVerbs = useK8sVerbs;
54273
54722
  exports.useListWatch = useListWatch;
54723
+ exports.useManyK8sSmartResource = useManyK8sSmartResource;
54274
54724
  exports.usePermissions = usePermissions;
54725
+ exports.useSmartResourceParams = useSmartResourceParams;
54275
54726
 
54276
54727
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
54277
54728