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