@prorobotech/openapi-k8s-toolkit 1.4.0-alpha.21 → 1.4.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-BIeCsSQi.mjs → index-C3GT20Hj.mjs} +115 -69
- package/dist/{index-BIeCsSQi.mjs.map → index-C3GT20Hj.mjs.map} +1 -1
- package/dist/{index-CVP6M61v.mjs → index-oRwnOGcM.mjs} +2 -2
- package/dist/{index-CVP6M61v.mjs.map → index-oRwnOGcM.mjs.map} +1 -1
- package/dist/openapi-k8s-toolkit.es.js +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +113 -67
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/BlackholeForm/organisms/BlackholeForm/helpers/prefills.d.ts +6 -3
- package/dist/types/hooks/useApiResource.d.ts +2 -1
- package/dist/types/hooks/useApisResourceTypes.d.ts +4 -2
- package/dist/types/hooks/useBuiltinResource.d.ts +2 -1
- package/dist/types/hooks/useBuiltinResourceTypes.d.ts +2 -1
- package/dist/types/hooks/useK8sSmartResource/useSmartResourceParams.d.ts +3 -2
- package/dist/types/hooks/useResourceScope/useResourceScope.d.ts +2 -1
- package/dist/types/localTypes/bff/form.d.ts +1 -0
- package/dist/types/localTypes/clusterList.d.ts +3 -2
- package/package.json +1 -1
|
@@ -9565,8 +9565,13 @@
|
|
|
9565
9565
|
return data;
|
|
9566
9566
|
};
|
|
9567
9567
|
|
|
9568
|
-
const useSmartResourceParams = ({
|
|
9568
|
+
const useSmartResourceParams = ({
|
|
9569
|
+
cluster,
|
|
9570
|
+
namespace,
|
|
9571
|
+
enabler
|
|
9572
|
+
}) => {
|
|
9569
9573
|
const [searchParams] = reactRouterDom.useSearchParams();
|
|
9574
|
+
const clusterPrepared = cluster ?? "";
|
|
9570
9575
|
const rawEntries = React$1.useMemo(() => {
|
|
9571
9576
|
const raw = searchParams.get("resources");
|
|
9572
9577
|
if (!raw) return [];
|
|
@@ -9574,19 +9579,20 @@
|
|
|
9574
9579
|
const [apiGroup = "", apiVersion = "", plural = ""] = entry.split("/");
|
|
9575
9580
|
const normalizedGroup = apiGroup === "builtin" || apiGroup === "" ? void 0 : apiGroup;
|
|
9576
9581
|
return {
|
|
9577
|
-
cluster,
|
|
9582
|
+
cluster: clusterPrepared,
|
|
9578
9583
|
plural,
|
|
9579
9584
|
apiGroup: normalizedGroup,
|
|
9580
9585
|
apiVersion
|
|
9581
9586
|
};
|
|
9582
9587
|
}).filter((e) => Boolean(e.plural));
|
|
9583
|
-
}, [searchParams,
|
|
9588
|
+
}, [searchParams, clusterPrepared]);
|
|
9584
9589
|
const scopeQueries = reactQuery.useQueries({
|
|
9585
9590
|
queries: rawEntries.map((e) => {
|
|
9586
9591
|
const isApi = Boolean(e.apiGroup);
|
|
9592
|
+
const scopeEnabler = Boolean((enabler ?? true) && e.cluster && e.plural && (!isApi || e.apiVersion));
|
|
9587
9593
|
return {
|
|
9588
9594
|
queryKey: ["resource-scope", e.cluster, isApi ? e.apiGroup : "builtin", e.apiVersion ?? "", e.plural],
|
|
9589
|
-
enabled:
|
|
9595
|
+
enabled: scopeEnabler,
|
|
9590
9596
|
queryFn: () => {
|
|
9591
9597
|
if (isApi) {
|
|
9592
9598
|
return checkIfApiInstanceNamespaceScoped({
|
|
@@ -43793,8 +43799,7 @@
|
|
|
43793
43799
|
const body = currentValues;
|
|
43794
43800
|
const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${plural}/${isCreate ? "" : name}`;
|
|
43795
43801
|
if (isCreate) {
|
|
43796
|
-
createNewEntry({ endpoint, body }).then((
|
|
43797
|
-
console.log(res);
|
|
43802
|
+
createNewEntry({ endpoint, body }).then(() => {
|
|
43798
43803
|
if (backlink) {
|
|
43799
43804
|
navigate(backlink);
|
|
43800
43805
|
}
|
|
@@ -43812,8 +43817,7 @@
|
|
|
43812
43817
|
setError(error2);
|
|
43813
43818
|
});
|
|
43814
43819
|
} else {
|
|
43815
|
-
updateEntry({ endpoint, body }).then((
|
|
43816
|
-
console.log(res);
|
|
43820
|
+
updateEntry({ endpoint, body }).then(() => {
|
|
43817
43821
|
if (backlink) {
|
|
43818
43822
|
navigate(backlink);
|
|
43819
43823
|
}
|
|
@@ -44099,8 +44103,7 @@
|
|
|
44099
44103
|
let flattenArrayOfUnknown = [];
|
|
44100
44104
|
try {
|
|
44101
44105
|
flattenArrayOfUnknown = flattenOnce$3(value);
|
|
44102
|
-
} catch
|
|
44103
|
-
console.log(e);
|
|
44106
|
+
} catch {
|
|
44104
44107
|
return { error: "Error while flattening" };
|
|
44105
44108
|
}
|
|
44106
44109
|
if (isRecordArray(flattenArrayOfUnknown)) {
|
|
@@ -44169,8 +44172,7 @@
|
|
|
44169
44172
|
let flattenArrayOfUnknown = [];
|
|
44170
44173
|
try {
|
|
44171
44174
|
flattenArrayOfUnknown = flattenOnce$2(value);
|
|
44172
|
-
} catch
|
|
44173
|
-
console.log(e);
|
|
44175
|
+
} catch {
|
|
44174
44176
|
return { error: "Error while flattening" };
|
|
44175
44177
|
}
|
|
44176
44178
|
return { counter: flattenArrayOfUnknown.length };
|
|
@@ -44206,13 +44208,11 @@
|
|
|
44206
44208
|
}, {});
|
|
44207
44209
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
44208
44210
|
if (jsonRoot === void 0) {
|
|
44209
|
-
console.log(`Item Counter: ${id}: No root for json path`);
|
|
44210
44211
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
44211
44212
|
}
|
|
44212
44213
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
44213
44214
|
const { counter, error: errorArrayOfObjects } = getItemCounterItemsInside(anythingForNow);
|
|
44214
44215
|
if (errorArrayOfObjects) {
|
|
44215
|
-
console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
|
|
44216
44216
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
44217
44217
|
}
|
|
44218
44218
|
const parsedText = parseAll({ text, replaceValues, multiQueryData });
|
|
@@ -44263,13 +44263,11 @@
|
|
|
44263
44263
|
}, {});
|
|
44264
44264
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
44265
44265
|
if (jsonRoot === void 0) {
|
|
44266
|
-
console.log(`Key Counter: ${id}: No root for json path`);
|
|
44267
44266
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
44268
44267
|
}
|
|
44269
44268
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
|
|
44270
44269
|
const { counter, error: errorArrayOfObjects } = getKeyCounterItemsInside(anythingForNow);
|
|
44271
44270
|
if (errorArrayOfObjects) {
|
|
44272
|
-
console.log(`Key Counter: ${id}: ${errorArrayOfObjects}`);
|
|
44273
44271
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
44274
44272
|
}
|
|
44275
44273
|
const parsedText = parseAll({ text, replaceValues, multiQueryData });
|
|
@@ -44491,7 +44489,6 @@
|
|
|
44491
44489
|
const [key, value] = label.split("=");
|
|
44492
44490
|
result[key] = value || "";
|
|
44493
44491
|
});
|
|
44494
|
-
console.log(JSON.stringify(result));
|
|
44495
44492
|
setIsLoading(true);
|
|
44496
44493
|
setError(void 0);
|
|
44497
44494
|
patchEntryWithReplaceOp({ endpoint, pathToValue, body: result }).then(() => {
|
|
@@ -44627,7 +44624,6 @@
|
|
|
44627
44624
|
}, [open, form]);
|
|
44628
44625
|
const submit = () => {
|
|
44629
44626
|
form.validateFields().then(() => {
|
|
44630
|
-
console.log(JSON.stringify(taints));
|
|
44631
44627
|
setIsLoading(true);
|
|
44632
44628
|
setError(void 0);
|
|
44633
44629
|
patchEntryWithReplaceOp({ endpoint, pathToValue, body: taints }).then(() => {
|
|
@@ -44780,7 +44776,6 @@
|
|
|
44780
44776
|
}, [open, form]);
|
|
44781
44777
|
const submit = () => {
|
|
44782
44778
|
form.validateFields().then(() => {
|
|
44783
|
-
console.log(JSON.stringify(tolerations));
|
|
44784
44779
|
setIsLoading(true);
|
|
44785
44780
|
setError(void 0);
|
|
44786
44781
|
patchEntryWithReplaceOp({ endpoint, pathToValue, body: tolerations }).then(() => {
|
|
@@ -44981,7 +44976,6 @@
|
|
|
44981
44976
|
annotations.forEach(({ key, value }) => {
|
|
44982
44977
|
result[key] = value || "";
|
|
44983
44978
|
});
|
|
44984
|
-
console.log(JSON.stringify(result));
|
|
44985
44979
|
setIsLoading(true);
|
|
44986
44980
|
setError(void 0);
|
|
44987
44981
|
patchEntryWithReplaceOp({ endpoint, pathToValue, body: result }).then(() => {
|
|
@@ -45492,10 +45486,8 @@
|
|
|
45492
45486
|
};
|
|
45493
45487
|
if (!labelsRaw) {
|
|
45494
45488
|
if (errorArrayOfObjects) {
|
|
45495
|
-
console.log(errorArrayOfObjects);
|
|
45496
45489
|
return renderErrorFallback();
|
|
45497
45490
|
}
|
|
45498
|
-
console.log("Not a valid data structure");
|
|
45499
45491
|
return renderErrorFallback();
|
|
45500
45492
|
}
|
|
45501
45493
|
const labels = Object.entries(labelsRaw).map(([key, value]) => `${key}=${value}`).join(",");
|
|
@@ -45574,8 +45566,7 @@
|
|
|
45574
45566
|
let flattenArrayOfUnknown = [];
|
|
45575
45567
|
try {
|
|
45576
45568
|
flattenArrayOfUnknown = flattenOnce$1(value);
|
|
45577
|
-
} catch
|
|
45578
|
-
console.log(e);
|
|
45569
|
+
} catch {
|
|
45579
45570
|
return { error: "Error while flattening" };
|
|
45580
45571
|
}
|
|
45581
45572
|
return { counter: flattenArrayOfUnknown.length, taints: filterTaintLikes(flattenArrayOfUnknown) };
|
|
@@ -45646,7 +45637,6 @@
|
|
|
45646
45637
|
}
|
|
45647
45638
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
45648
45639
|
if (jsonRoot === void 0) {
|
|
45649
|
-
console.log(`Item Counter: ${id}: No root for json path`);
|
|
45650
45640
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: errorText });
|
|
45651
45641
|
}
|
|
45652
45642
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
@@ -45674,7 +45664,6 @@
|
|
|
45674
45664
|
});
|
|
45675
45665
|
};
|
|
45676
45666
|
if (errorArrayOfObjects) {
|
|
45677
|
-
console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
|
|
45678
45667
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
45679
45668
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
45680
45669
|
errorText,
|
|
@@ -45789,8 +45778,7 @@
|
|
|
45789
45778
|
let flattenArrayOfUnknown = [];
|
|
45790
45779
|
try {
|
|
45791
45780
|
flattenArrayOfUnknown = flattenOnce(value);
|
|
45792
|
-
} catch
|
|
45793
|
-
console.log(e);
|
|
45781
|
+
} catch {
|
|
45794
45782
|
return { error: "Error while flattening" };
|
|
45795
45783
|
}
|
|
45796
45784
|
return { counter: flattenArrayOfUnknown.length, tolerations: filterTolerations(flattenArrayOfUnknown) };
|
|
@@ -45863,7 +45851,6 @@
|
|
|
45863
45851
|
}
|
|
45864
45852
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
45865
45853
|
if (jsonRoot === void 0) {
|
|
45866
|
-
console.log(`Item Counter: ${id}: No root for json path`);
|
|
45867
45854
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
|
|
45868
45855
|
}
|
|
45869
45856
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
@@ -45891,7 +45878,6 @@
|
|
|
45891
45878
|
});
|
|
45892
45879
|
};
|
|
45893
45880
|
if (errorArrayOfObjects) {
|
|
45894
|
-
console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
|
|
45895
45881
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
45896
45882
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
45897
45883
|
errorText,
|
|
@@ -46055,7 +46041,6 @@
|
|
|
46055
46041
|
}
|
|
46056
46042
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
46057
46043
|
if (jsonRoot === void 0) {
|
|
46058
|
-
console.log(`Item Counter: ${id}: No root for json path`);
|
|
46059
46044
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
|
|
46060
46045
|
}
|
|
46061
46046
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
|
|
@@ -46083,7 +46068,6 @@
|
|
|
46083
46068
|
});
|
|
46084
46069
|
};
|
|
46085
46070
|
if (errorArrayOfObjects) {
|
|
46086
|
-
console.log(`Item Counter: ${id}: ${errorArrayOfObjects}`);
|
|
46087
46071
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
46088
46072
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { align: "center", gap: 8, children: [
|
|
46089
46073
|
errorText,
|
|
@@ -78394,7 +78378,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78394
78378
|
}, {});
|
|
78395
78379
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
78396
78380
|
if (jsonRoot === void 0) {
|
|
78397
|
-
console.log(`Item Counter: No root for json path`);
|
|
78398
78381
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
78399
78382
|
}
|
|
78400
78383
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToObj}`);
|
|
@@ -78422,7 +78405,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78422
78405
|
});
|
|
78423
78406
|
};
|
|
78424
78407
|
if (errorArrayOfObjects) {
|
|
78425
|
-
console.log(`Item Counter: ${errorArrayOfObjects}`);
|
|
78426
78408
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
78427
78409
|
contextHolder,
|
|
78428
78410
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -78505,9 +78487,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78505
78487
|
return acc;
|
|
78506
78488
|
}, {});
|
|
78507
78489
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
78508
|
-
if (jsonRoot === void 0) {
|
|
78509
|
-
console.log(`Item Counter: No root for json path`);
|
|
78510
|
-
}
|
|
78511
78490
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
78512
78491
|
const { taints, error: errorArrayOfObjects } = getTaintsItemsInside(anythingForNow);
|
|
78513
78492
|
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
@@ -78533,7 +78512,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78533
78512
|
});
|
|
78534
78513
|
};
|
|
78535
78514
|
if (errorArrayOfObjects) {
|
|
78536
|
-
console.log(`Item Counter: ${errorArrayOfObjects}`);
|
|
78537
78515
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
78538
78516
|
contextHolder,
|
|
78539
78517
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -78617,7 +78595,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78617
78595
|
}, {});
|
|
78618
78596
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
78619
78597
|
if (jsonRoot === void 0) {
|
|
78620
|
-
console.log(`Item Counter: No root for json path`);
|
|
78621
78598
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
78622
78599
|
}
|
|
78623
78600
|
const anythingForNow = jp.query(jsonRoot || {}, `$${jsonPathToArray}`);
|
|
@@ -78645,7 +78622,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78645
78622
|
});
|
|
78646
78623
|
};
|
|
78647
78624
|
if (errorArrayOfObjects) {
|
|
78648
|
-
console.log(`Item Counter: ${errorArrayOfObjects}`);
|
|
78649
78625
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
78650
78626
|
contextHolder,
|
|
78651
78627
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -78848,7 +78824,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78848
78824
|
}
|
|
78849
78825
|
const jsonRoot = multiQueryData[`req${counter.props.reqIndex}`];
|
|
78850
78826
|
if (jsonRoot === void 0) {
|
|
78851
|
-
console.log(`Counter: ${id}: No root for json path`);
|
|
78852
78827
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
78853
78828
|
Styled$p.Card,
|
|
78854
78829
|
{
|
|
@@ -78882,7 +78857,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
78882
78857
|
const anythingForNow = jp.query(jsonRoot || {}, `$${path}`);
|
|
78883
78858
|
const { counter: counterToDisplay, error: errorParsingCounter } = counter.type === "item" ? getItemCounterItemsInside(anythingForNow) : getKeyCounterItemsInside(anythingForNow);
|
|
78884
78859
|
if (errorParsingCounter) {
|
|
78885
|
-
console.log(`Counter: ${id}: ${errorParsingCounter}`);
|
|
78886
78860
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
78887
78861
|
Styled$p.Card,
|
|
78888
78862
|
{
|
|
@@ -81469,7 +81443,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
81469
81443
|
}
|
|
81470
81444
|
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
81471
81445
|
if (jsonRoot === void 0) {
|
|
81472
|
-
console.log(`Volumes: ${id}: No root for json path`);
|
|
81473
81446
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: containerStyle, children: errorText });
|
|
81474
81447
|
}
|
|
81475
81448
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
@@ -85444,6 +85417,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
85444
85417
|
const result = [...realizedPrefix, newIndex, ...w.slice(arrayPath.length + 1)];
|
|
85445
85418
|
return result;
|
|
85446
85419
|
};
|
|
85420
|
+
const getConcretePathsForNewArrayItem = (templates, arrayPath, newIndex) => templates.filter((tpl) => templateMatchesArray(tpl, arrayPath)).map((tpl) => buildConcretePathForNewItem(tpl, arrayPath, newIndex));
|
|
85447
85421
|
const scrubLiteralWildcardKeys = (input) => {
|
|
85448
85422
|
if (Array.isArray(input)) return input.map(scrubLiteralWildcardKeys);
|
|
85449
85423
|
if (_$1.isPlainObject(input)) {
|
|
@@ -85641,7 +85615,15 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
85641
85615
|
return value;
|
|
85642
85616
|
});
|
|
85643
85617
|
};
|
|
85644
|
-
const
|
|
85618
|
+
const exactPersistedPaths = React$1.useMemo(
|
|
85619
|
+
() => (persistedPaths || []).filter((path) => !path.some((seg) => seg === "*")),
|
|
85620
|
+
[persistedPaths]
|
|
85621
|
+
);
|
|
85622
|
+
const persistedWildcardTemplates = React$1.useMemo(
|
|
85623
|
+
() => (persistedPaths || []).filter((path) => path.some((seg) => seg === "*")).map((path) => ({ wildcardPath: sanitizeWildcardPath(path) })),
|
|
85624
|
+
[persistedPaths]
|
|
85625
|
+
);
|
|
85626
|
+
const [persistedKeys, setPersistedKeys] = React$1.useState(exactPersistedPaths);
|
|
85645
85627
|
const [resolvedHiddenPaths, setResolvedHiddenPaths] = React$1.useState([]);
|
|
85646
85628
|
const blockedPathsRef = React$1.useRef(/* @__PURE__ */ new Set());
|
|
85647
85629
|
const manualBlockedPathsRef = React$1.useRef(/* @__PURE__ */ new Set());
|
|
@@ -85715,8 +85697,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
85715
85697
|
const body = data;
|
|
85716
85698
|
const endpoint = `/api/clusters/${cluster}/k8s/${type === "builtin" ? "" : "apis/"}${apiGroupApiVersion}${isNameSpaced ? `/namespaces/${namespace}` : ""}/${plural}/${isCreate ? "" : name}`;
|
|
85717
85699
|
if (isCreate) {
|
|
85718
|
-
createNewEntry({ endpoint, body }).then((
|
|
85719
|
-
console.log(res);
|
|
85700
|
+
createNewEntry({ endpoint, body }).then(() => {
|
|
85720
85701
|
if (resolvedBacklink) {
|
|
85721
85702
|
navigate(resolvedBacklink);
|
|
85722
85703
|
}
|
|
@@ -85730,8 +85711,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
85730
85711
|
setError(error2);
|
|
85731
85712
|
});
|
|
85732
85713
|
} else {
|
|
85733
|
-
updateEntry({ endpoint, body }).then((
|
|
85734
|
-
console.log(res);
|
|
85714
|
+
updateEntry({ endpoint, body }).then(() => {
|
|
85735
85715
|
if (resolvedBacklink) {
|
|
85736
85716
|
navigate(resolvedBacklink);
|
|
85737
85717
|
}
|
|
@@ -85828,6 +85808,29 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
85828
85808
|
},
|
|
85829
85809
|
[form, prefillTemplates]
|
|
85830
85810
|
);
|
|
85811
|
+
const applyPersistedForNewArrayItem = React$1.useCallback(
|
|
85812
|
+
(arrayPath, newIndex) => {
|
|
85813
|
+
const concretePaths = getConcretePathsForNewArrayItem(
|
|
85814
|
+
persistedWildcardTemplates,
|
|
85815
|
+
arrayPath,
|
|
85816
|
+
newIndex
|
|
85817
|
+
);
|
|
85818
|
+
if (!concretePaths.length) return;
|
|
85819
|
+
setPersistedKeys((prev) => {
|
|
85820
|
+
const seen = new Set(prev.map((x) => JSON.stringify(x)));
|
|
85821
|
+
const merged = [...prev];
|
|
85822
|
+
concretePaths.forEach((path) => {
|
|
85823
|
+
const key = JSON.stringify(path);
|
|
85824
|
+
if (!seen.has(key)) {
|
|
85825
|
+
seen.add(key);
|
|
85826
|
+
merged.push(path);
|
|
85827
|
+
}
|
|
85828
|
+
});
|
|
85829
|
+
return merged;
|
|
85830
|
+
});
|
|
85831
|
+
},
|
|
85832
|
+
[persistedWildcardTemplates]
|
|
85833
|
+
);
|
|
85831
85834
|
const hiddenWildcardTemplates = React$1.useMemo(() => {
|
|
85832
85835
|
const raw = hiddenPaths ?? [];
|
|
85833
85836
|
raw.forEach((p, i) => wdbg(`#${i}`, p));
|
|
@@ -85864,7 +85867,26 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
85864
85867
|
}
|
|
85865
85868
|
return merged;
|
|
85866
85869
|
});
|
|
85867
|
-
|
|
85870
|
+
const persistedResolved = expandWildcardTemplates(
|
|
85871
|
+
persistedWildcardTemplates.map((tpl) => tpl.wildcardPath),
|
|
85872
|
+
initialValues,
|
|
85873
|
+
{
|
|
85874
|
+
includeMissingFinalForWildcard: true
|
|
85875
|
+
}
|
|
85876
|
+
);
|
|
85877
|
+
setPersistedKeys((prev) => {
|
|
85878
|
+
const seen = new Set(prev.map((x) => JSON.stringify(x)));
|
|
85879
|
+
const merged = [...prev];
|
|
85880
|
+
for (const p of persistedResolved) {
|
|
85881
|
+
const k = JSON.stringify(p);
|
|
85882
|
+
if (!seen.has(k)) {
|
|
85883
|
+
seen.add(k);
|
|
85884
|
+
merged.push(p);
|
|
85885
|
+
}
|
|
85886
|
+
}
|
|
85887
|
+
return merged;
|
|
85888
|
+
});
|
|
85889
|
+
}, [initialValues, hiddenWildcardTemplates, expandedWildcardTemplates, persistedWildcardTemplates]);
|
|
85868
85890
|
const resolvedHiddenStringPaths = React$1.useMemo(
|
|
85869
85891
|
() => resolvedHiddenPaths.map(toStringPath),
|
|
85870
85892
|
[resolvedHiddenPaths]
|
|
@@ -86006,6 +86028,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86006
86028
|
}
|
|
86007
86029
|
blockedPathsRef.current.delete(JSON.stringify(itemPath));
|
|
86008
86030
|
applyPrefillForNewArrayItem(arrayPath, i);
|
|
86031
|
+
applyPersistedForNewArrayItem(arrayPath, i);
|
|
86009
86032
|
}
|
|
86010
86033
|
}
|
|
86011
86034
|
}
|
|
@@ -86018,6 +86041,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86018
86041
|
const arrayPath = JSON.parse(k);
|
|
86019
86042
|
for (let i = prevLen; i < newLen; i++) {
|
|
86020
86043
|
applyPrefillForNewArrayItem(arrayPath, i);
|
|
86044
|
+
applyPersistedForNewArrayItem(arrayPath, i);
|
|
86021
86045
|
}
|
|
86022
86046
|
}
|
|
86023
86047
|
}
|
|
@@ -86036,6 +86060,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86036
86060
|
persistedKeys,
|
|
86037
86061
|
debouncedPostValuesToYaml,
|
|
86038
86062
|
applyPrefillForNewArrayItem,
|
|
86063
|
+
applyPersistedForNewArrayItem,
|
|
86039
86064
|
hiddenWildcardTemplates,
|
|
86040
86065
|
expandedWildcardTemplates
|
|
86041
86066
|
]
|
|
@@ -86137,7 +86162,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86137
86162
|
const prev = prevInitialValues.current;
|
|
86138
86163
|
if (!_$1.isEqual(prev, initialValues)) {
|
|
86139
86164
|
if (initialValues) {
|
|
86140
|
-
console.log("fired initial values", initialValues);
|
|
86141
86165
|
onValuesChangeCallback(initialValues);
|
|
86142
86166
|
}
|
|
86143
86167
|
prevInitialValues.current = initialValues;
|
|
@@ -86308,7 +86332,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86308
86332
|
});
|
|
86309
86333
|
};
|
|
86310
86334
|
const onPersistUnmark = (value) => {
|
|
86311
|
-
console.log(value);
|
|
86312
86335
|
setPersistedKeys([...persistedKeys.filter((arr) => JSON.stringify(arr) !== JSON.stringify(value))]);
|
|
86313
86336
|
};
|
|
86314
86337
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -86453,6 +86476,13 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86453
86476
|
plural: "customformsoverrides",
|
|
86454
86477
|
isEnabled: Boolean(cluster && forcingCustomization.baseApiGroup && forcingCustomization.baseApiVersion)
|
|
86455
86478
|
});
|
|
86479
|
+
const { data: prefillsData, isLoading: prefillsLoading } = useK8sSmartResource({
|
|
86480
|
+
cluster,
|
|
86481
|
+
apiGroup: forcingCustomization.baseApiGroup,
|
|
86482
|
+
apiVersion: forcingCustomization.baseApiVersion,
|
|
86483
|
+
plural: "customformsprefills",
|
|
86484
|
+
isEnabled: Boolean(cluster && forcingCustomization.baseApiGroup && forcingCustomization.baseApiVersion)
|
|
86485
|
+
});
|
|
86456
86486
|
const { data: mappingData, isLoading: mappingLoading } = useK8sSmartResource({
|
|
86457
86487
|
cluster,
|
|
86458
86488
|
apiGroup: forcingCustomization.baseApiGroup,
|
|
@@ -86488,20 +86518,28 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86488
86518
|
const hasForcedMatchingOverride = Boolean(
|
|
86489
86519
|
forcedCustomizationId && overridesData?.items?.some((item) => item?.spec?.customizationId === forcedCustomizationId)
|
|
86490
86520
|
);
|
|
86491
|
-
const
|
|
86521
|
+
const hasMatchingPrefill = Boolean(
|
|
86522
|
+
customizationId && prefillsData?.items?.some((item) => item?.spec?.customizationId === customizationId)
|
|
86523
|
+
);
|
|
86524
|
+
const hasForcedMatchingPrefill = Boolean(
|
|
86525
|
+
forcedCustomizationId && prefillsData?.items?.some((item) => item?.spec?.customizationId === forcedCustomizationId)
|
|
86526
|
+
);
|
|
86527
|
+
const isResolutionReady = !customizationId || !overridesLoading && !prefillsLoading && !mappingLoading;
|
|
86492
86528
|
const resolvedCustomizationId = isResolutionReady ? hasMatchingOverride ? customizationId : hasForcedMatchingOverride ? forcedCustomizationId : forcingCustomization.fallbackId : void 0;
|
|
86529
|
+
const resolvedCustomizationIdPrefill = isResolutionReady ? hasMatchingPrefill ? customizationId : hasForcedMatchingPrefill ? forcedCustomizationId : forcingCustomization.fallbackId : void 0;
|
|
86493
86530
|
React$1.useEffect(() => {
|
|
86494
86531
|
if (!cluster) {
|
|
86495
86532
|
setIsLoading(false);
|
|
86496
86533
|
return;
|
|
86497
86534
|
}
|
|
86498
86535
|
if (!isResolutionReady) return;
|
|
86499
|
-
if (customizationId && !resolvedCustomizationId) return;
|
|
86536
|
+
if (customizationId && (!resolvedCustomizationId || !resolvedCustomizationIdPrefill)) return;
|
|
86500
86537
|
setIsLoading(true);
|
|
86501
86538
|
const payload = {
|
|
86502
86539
|
data,
|
|
86503
86540
|
cluster,
|
|
86504
|
-
customizationId: resolvedCustomizationId
|
|
86541
|
+
customizationId: resolvedCustomizationId,
|
|
86542
|
+
customizationIdPrefill: resolvedCustomizationIdPrefill
|
|
86505
86543
|
};
|
|
86506
86544
|
axios.post(`/api/clusters/${cluster}/openapi-bff/forms/formPrepare/prepareFormProps`, payload).then(({ data: data2 }) => {
|
|
86507
86545
|
if (data2.isNamespaced) {
|
|
@@ -86509,7 +86547,6 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86509
86547
|
}
|
|
86510
86548
|
if (data2.result === "error") {
|
|
86511
86549
|
setIsError(data2.error);
|
|
86512
|
-
console.warn(data2.error);
|
|
86513
86550
|
if (data2.forceViewMode) {
|
|
86514
86551
|
applyForceViewMode(data2.forceViewMode);
|
|
86515
86552
|
} else {
|
|
@@ -86540,6 +86577,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
86540
86577
|
data,
|
|
86541
86578
|
customizationId,
|
|
86542
86579
|
resolvedCustomizationId,
|
|
86580
|
+
resolvedCustomizationIdPrefill,
|
|
86543
86581
|
isResolutionReady,
|
|
86544
86582
|
fallbackToManualMode,
|
|
86545
86583
|
applyForceViewMode
|
|
@@ -90912,7 +90950,8 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
90912
90950
|
apiVersion,
|
|
90913
90951
|
plural,
|
|
90914
90952
|
name,
|
|
90915
|
-
refetchInterval
|
|
90953
|
+
refetchInterval,
|
|
90954
|
+
enabler
|
|
90916
90955
|
}) => {
|
|
90917
90956
|
return reactQuery.useQuery({
|
|
90918
90957
|
queryKey: ["useApiResourceSingle", cluster, namespace, apiGroup, apiVersion, plural, name],
|
|
@@ -90924,7 +90963,8 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
90924
90963
|
plural,
|
|
90925
90964
|
name
|
|
90926
90965
|
})).data,
|
|
90927
|
-
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
|
|
90966
|
+
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3,
|
|
90967
|
+
enabled: enabler ?? true
|
|
90928
90968
|
});
|
|
90929
90969
|
};
|
|
90930
90970
|
|
|
@@ -90966,12 +91006,14 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
90966
91006
|
namespace,
|
|
90967
91007
|
plural,
|
|
90968
91008
|
name,
|
|
90969
|
-
refetchInterval
|
|
91009
|
+
refetchInterval,
|
|
91010
|
+
enabler
|
|
90970
91011
|
}) => {
|
|
90971
91012
|
return reactQuery.useQuery({
|
|
90972
91013
|
queryKey: ["useBuiltinResourceSingle", cluster, namespace, plural, name],
|
|
90973
91014
|
queryFn: async () => (await getBuiltinResourceSingle({ cluster, namespace, plural, name })).data,
|
|
90974
|
-
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3
|
|
91015
|
+
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 5e3,
|
|
91016
|
+
enabled: enabler ?? true
|
|
90975
91017
|
});
|
|
90976
91018
|
};
|
|
90977
91019
|
|
|
@@ -91027,7 +91069,7 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
91027
91069
|
});
|
|
91028
91070
|
};
|
|
91029
91071
|
|
|
91030
|
-
const useApisResourceTypes = ({ cluster }) => {
|
|
91072
|
+
const useApisResourceTypes = ({ cluster, enabler }) => {
|
|
91031
91073
|
return reactQuery.useQuery({
|
|
91032
91074
|
queryKey: ["useApisResourceTypes", cluster],
|
|
91033
91075
|
queryFn: async () => {
|
|
@@ -91038,13 +91080,15 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
91038
91080
|
}
|
|
91039
91081
|
return data;
|
|
91040
91082
|
},
|
|
91041
|
-
refetchInterval: 5e3
|
|
91083
|
+
refetchInterval: 5e3,
|
|
91084
|
+
enabled: enabler ?? true
|
|
91042
91085
|
});
|
|
91043
91086
|
};
|
|
91044
91087
|
const useApiResourceTypesByGroup = ({
|
|
91045
91088
|
cluster,
|
|
91046
91089
|
apiGroup,
|
|
91047
|
-
apiVersion
|
|
91090
|
+
apiVersion,
|
|
91091
|
+
enabler
|
|
91048
91092
|
}) => {
|
|
91049
91093
|
return reactQuery.useQuery({
|
|
91050
91094
|
queryKey: ["useApiResourceTypesByGroup", cluster, apiGroup, apiVersion],
|
|
@@ -91060,11 +91104,12 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
91060
91104
|
}
|
|
91061
91105
|
return data;
|
|
91062
91106
|
},
|
|
91063
|
-
refetchInterval: 5e3
|
|
91107
|
+
refetchInterval: 5e3,
|
|
91108
|
+
enabled: enabler ?? true
|
|
91064
91109
|
});
|
|
91065
91110
|
};
|
|
91066
91111
|
|
|
91067
|
-
const useBuiltinResourceTypes = ({ cluster }) => {
|
|
91112
|
+
const useBuiltinResourceTypes = ({ cluster, enabler }) => {
|
|
91068
91113
|
return reactQuery.useQuery({
|
|
91069
91114
|
queryKey: ["useBuiltinResourceTypes", cluster],
|
|
91070
91115
|
queryFn: async () => {
|
|
@@ -91075,7 +91120,8 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
91075
91120
|
}
|
|
91076
91121
|
return data;
|
|
91077
91122
|
},
|
|
91078
|
-
refetchInterval: 5e3
|
|
91123
|
+
refetchInterval: 5e3,
|
|
91124
|
+
enabled: enabler ?? true
|
|
91079
91125
|
});
|
|
91080
91126
|
};
|
|
91081
91127
|
|
|
@@ -91102,9 +91148,9 @@ Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
|
91102
91148
|
});
|
|
91103
91149
|
};
|
|
91104
91150
|
|
|
91105
|
-
const useResourceScope = ({ plural, cluster, apiGroup, apiVersion }) => {
|
|
91151
|
+
const useResourceScope = ({ plural, cluster, apiGroup, apiVersion, enabler }) => {
|
|
91106
91152
|
const computedResourceType = apiGroup ? "api" : "builtin";
|
|
91107
|
-
const enabled = Boolean(cluster) && Boolean(plural) && (computedResourceType === "builtin" || Boolean(apiVersion));
|
|
91153
|
+
const enabled = (enabler ?? true) && Boolean(cluster) && Boolean(plural) && (computedResourceType === "builtin" || Boolean(apiVersion));
|
|
91108
91154
|
return reactQuery.useQuery({
|
|
91109
91155
|
queryKey: ["resource-scope", computedResourceType, cluster, plural, apiGroup, apiVersion],
|
|
91110
91156
|
enabled,
|