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