@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.6 → 1.1.0-alpha.8
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 +78 -11
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +78 -11
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/YamlEditorSingleton/utils.d.ts +10 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +2 -0
- package/dist/types/hooks/useListThenWatch/types.d.ts +5 -1
- package/dist/types/hooks/useListThenWatch/useListWatch.d.ts +1 -0
- package/dist/types/localTypes/bff/table.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8457,6 +8457,7 @@ const useListWatch = ({
|
|
|
8457
8457
|
const [lastError, setLastError] = useState(void 0);
|
|
8458
8458
|
const [isPaused, setIsPaused] = useState(paused);
|
|
8459
8459
|
const [isRemoveIgnored, setIsRemoveIgnored] = useState(ignoreRemove);
|
|
8460
|
+
const [hasInitial, setHasInitial] = useState(false);
|
|
8460
8461
|
const queryRef = useRef(query);
|
|
8461
8462
|
const wsRef = useRef(null);
|
|
8462
8463
|
const connectingRef = useRef(false);
|
|
@@ -8641,6 +8642,7 @@ const useListWatch = ({
|
|
|
8641
8642
|
setHasMore(false);
|
|
8642
8643
|
anchorRVRef.current = void 0;
|
|
8643
8644
|
haveAnchorRef.current = false;
|
|
8645
|
+
setHasInitial(false);
|
|
8644
8646
|
}
|
|
8645
8647
|
if (enabledRef.current) reconnect();
|
|
8646
8648
|
}
|
|
@@ -8659,6 +8661,7 @@ const useListWatch = ({
|
|
|
8659
8661
|
dispatch({ type: "RESET", items: [] });
|
|
8660
8662
|
setContToken(void 0);
|
|
8661
8663
|
setHasMore(false);
|
|
8664
|
+
setHasInitial(false);
|
|
8662
8665
|
}
|
|
8663
8666
|
if (prevId !== nextId) {
|
|
8664
8667
|
anchorRVRef.current = void 0;
|
|
@@ -8687,6 +8690,11 @@ const useListWatch = ({
|
|
|
8687
8690
|
(console[level] || console.log).call(console, "[useListWatch][server]", msg);
|
|
8688
8691
|
return;
|
|
8689
8692
|
}
|
|
8693
|
+
if (frame.type === "INITIAL_ERROR") {
|
|
8694
|
+
const msg = frame.message;
|
|
8695
|
+
setErrorSafe(msg);
|
|
8696
|
+
return;
|
|
8697
|
+
}
|
|
8690
8698
|
if (frame.type === "INITIAL") {
|
|
8691
8699
|
dispatch({ type: "RESET", items: frame.items });
|
|
8692
8700
|
setContToken(frame.continue);
|
|
@@ -8699,6 +8707,7 @@ const useListWatch = ({
|
|
|
8699
8707
|
anchorRVRef.current = snapshotRV;
|
|
8700
8708
|
haveAnchorRef.current = true;
|
|
8701
8709
|
}
|
|
8710
|
+
setHasInitial(true);
|
|
8702
8711
|
return;
|
|
8703
8712
|
}
|
|
8704
8713
|
if (frame.type === "PAGE") {
|
|
@@ -8776,6 +8785,7 @@ const useListWatch = ({
|
|
|
8776
8785
|
suppressErrorsRef.current = true;
|
|
8777
8786
|
anchorRVRef.current = void 0;
|
|
8778
8787
|
haveAnchorRef.current = false;
|
|
8788
|
+
setHasInitial(false);
|
|
8779
8789
|
resIdRef.current = resId;
|
|
8780
8790
|
queryRef.current = query;
|
|
8781
8791
|
if (enabledRef.current) reconnect();
|
|
@@ -8860,6 +8870,7 @@ const useListWatch = ({
|
|
|
8860
8870
|
continueToken,
|
|
8861
8871
|
status,
|
|
8862
8872
|
lastError,
|
|
8873
|
+
hasInitial,
|
|
8863
8874
|
setPaused: setIsPaused,
|
|
8864
8875
|
setIgnoreRemove: setIsRemoveIgnored,
|
|
8865
8876
|
sendScroll,
|
|
@@ -8957,7 +8968,7 @@ const useK8sSmartResource = ({
|
|
|
8957
8968
|
const watchEnabled = Boolean(
|
|
8958
8969
|
cluster && cluster.length > 0 && isEnabled && canList && canWatch && !verbsLoading && !verbsIsError
|
|
8959
8970
|
);
|
|
8960
|
-
const { state, status, lastError } = useListWatch({
|
|
8971
|
+
const { state, status, hasInitial, lastError } = useListWatch({
|
|
8961
8972
|
wsUrl: `/api/clusters/${cluster}/openapi-bff-ws/listThenWatch/listWatchWs`,
|
|
8962
8973
|
paused: false,
|
|
8963
8974
|
ignoreRemove: false,
|
|
@@ -8982,7 +8993,7 @@ const useK8sSmartResource = ({
|
|
|
8982
8993
|
[watchEnabled, state, mapListWatchState]
|
|
8983
8994
|
);
|
|
8984
8995
|
const used = !isEnabled ? "disabled" : verbsLoading ? "verbs-loading" : verbsIsError ? "verbs-error" : watchEnabled ? "watch" : restEnabled ? "list" : "disabled";
|
|
8985
|
-
const isLoading = isEnabled && verbsLoading || used === "watch" && status === "connecting" || used === "list" && restLoading;
|
|
8996
|
+
const isLoading = isEnabled && verbsLoading || used === "watch" && status === "connecting" || used === "watch" && status === "open" && !hasInitial || used === "list" && restLoading;
|
|
8986
8997
|
let error;
|
|
8987
8998
|
if (verbsIsError) error = verbsErrorObj;
|
|
8988
8999
|
else if (used === "watch" && status === "closed" && lastError) error = lastError;
|
|
@@ -34408,7 +34419,7 @@ const EnrichedTable$1 = ({
|
|
|
34408
34419
|
JSON.stringify(fetchedDataError)
|
|
34409
34420
|
] });
|
|
34410
34421
|
}
|
|
34411
|
-
const dataFromOneOfHooks = fetchedData || fetchedDataSocket
|
|
34422
|
+
const dataFromOneOfHooks = fetchedData || fetchedDataSocket;
|
|
34412
34423
|
const items = Array.isArray(pathToItems) ? _$1.get(dataFromOneOfHooks, pathToItems) : jp.query(dataFromOneOfHooks, `$${pathToItems}`)[0];
|
|
34413
34424
|
if (!items) {
|
|
34414
34425
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
@@ -34710,6 +34721,37 @@ const PodLogs$1 = ({
|
|
|
34710
34721
|
] });
|
|
34711
34722
|
};
|
|
34712
34723
|
|
|
34724
|
+
const getDataByPath = ({
|
|
34725
|
+
prefillValuesRaw,
|
|
34726
|
+
pathToData
|
|
34727
|
+
}) => {
|
|
34728
|
+
return Array.isArray(pathToData) ? _$1.get(prefillValuesRaw, pathToData) : jp.query(prefillValuesRaw, `$${pathToData}`)[0];
|
|
34729
|
+
};
|
|
34730
|
+
const getPrefillValuesWithForces = ({
|
|
34731
|
+
prefillValues,
|
|
34732
|
+
forcedKind,
|
|
34733
|
+
apiGroup,
|
|
34734
|
+
apiVersion
|
|
34735
|
+
}) => {
|
|
34736
|
+
if (!forcedKind) {
|
|
34737
|
+
return prefillValues;
|
|
34738
|
+
}
|
|
34739
|
+
const newValues = { ...prefillValues };
|
|
34740
|
+
if (typeof newValues === "object" && newValues !== null) {
|
|
34741
|
+
if ("kind" in newValues) {
|
|
34742
|
+
delete newValues.kind;
|
|
34743
|
+
}
|
|
34744
|
+
if ("apiVersion" in newValues) {
|
|
34745
|
+
delete newValues.apiVersion;
|
|
34746
|
+
}
|
|
34747
|
+
}
|
|
34748
|
+
return {
|
|
34749
|
+
kind: forcedKind,
|
|
34750
|
+
apiVersion: `${apiGroup ? `${apiGroup}/` : ""}${apiVersion}`,
|
|
34751
|
+
...newValues
|
|
34752
|
+
};
|
|
34753
|
+
};
|
|
34754
|
+
|
|
34713
34755
|
const YamlEditorSingleton$1 = ({
|
|
34714
34756
|
data,
|
|
34715
34757
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -34725,7 +34767,9 @@ const YamlEditorSingleton$1 = ({
|
|
|
34725
34767
|
apiGroup,
|
|
34726
34768
|
apiVersion,
|
|
34727
34769
|
typeName,
|
|
34770
|
+
forcedKind,
|
|
34728
34771
|
prefillValuesRequestIndex,
|
|
34772
|
+
pathToData,
|
|
34729
34773
|
substractHeight,
|
|
34730
34774
|
...props
|
|
34731
34775
|
} = data;
|
|
@@ -34751,7 +34795,9 @@ const YamlEditorSingleton$1 = ({
|
|
|
34751
34795
|
const apiGroupPrepared = apiGroup ? parseAll({ text: apiGroup, replaceValues, multiQueryData }) : "no-api-group";
|
|
34752
34796
|
const apiVersionPrepared = apiVersion ? parseAll({ text: apiVersion, replaceValues, multiQueryData }) : "no-api-version";
|
|
34753
34797
|
const typeNamePrepared = parseAll({ text: typeName, replaceValues, multiQueryData });
|
|
34754
|
-
const
|
|
34798
|
+
const prefillValuesRaw = multiQueryData[`req${prefillValuesRequestIndex}`];
|
|
34799
|
+
const prefillValues = pathToData ? getDataByPath({ prefillValuesRaw, pathToData }) : prefillValuesRaw;
|
|
34800
|
+
const prefillValuesWithForces = getPrefillValuesWithForces({ prefillValues, forcedKind, apiGroup, apiVersion });
|
|
34755
34801
|
if (isMultiqueryLoading) {
|
|
34756
34802
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
34757
34803
|
}
|
|
@@ -34761,7 +34807,7 @@ const YamlEditorSingleton$1 = ({
|
|
|
34761
34807
|
{
|
|
34762
34808
|
cluster: clusterPrepared,
|
|
34763
34809
|
theme,
|
|
34764
|
-
prefillValuesSchema:
|
|
34810
|
+
prefillValuesSchema: prefillValuesWithForces,
|
|
34765
34811
|
isNameSpaced,
|
|
34766
34812
|
isCreate: false,
|
|
34767
34813
|
type,
|
|
@@ -36157,10 +36203,15 @@ const EditModal$1 = ({
|
|
|
36157
36203
|
...restField,
|
|
36158
36204
|
name: [name, "operator"],
|
|
36159
36205
|
rules: [
|
|
36160
|
-
{
|
|
36161
|
-
|
|
36162
|
-
|
|
36163
|
-
|
|
36206
|
+
({ getFieldValue }) => ({
|
|
36207
|
+
validator(_, v) {
|
|
36208
|
+
const nameV = getFieldValue(["tolerations", name, "key"]);
|
|
36209
|
+
if ((nameV === "nameV" || !nameV) && (!v || v !== "Exists")) {
|
|
36210
|
+
return Promise.reject(new Error("Operator must be Exists when `key` is empty"));
|
|
36211
|
+
}
|
|
36212
|
+
return Promise.resolve();
|
|
36213
|
+
}
|
|
36214
|
+
})
|
|
36164
36215
|
],
|
|
36165
36216
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36166
36217
|
Select,
|
|
@@ -38564,6 +38615,7 @@ const EnrichedTableProvider = ({
|
|
|
38564
38615
|
setIsError(void 0);
|
|
38565
38616
|
setIsLoading(true);
|
|
38566
38617
|
const payload = {
|
|
38618
|
+
clusterName: cluster,
|
|
38567
38619
|
customizationId,
|
|
38568
38620
|
tableMappingsReplaceValues,
|
|
38569
38621
|
forceDefaultAdditionalPrinterColumns,
|
|
@@ -46881,9 +46933,23 @@ const YamlEditorSingleton = ({
|
|
|
46881
46933
|
const [yamlData, setYamlData] = useState("");
|
|
46882
46934
|
const [isLoading, setIsLoading] = useState(false);
|
|
46883
46935
|
const [error, setError] = useState();
|
|
46936
|
+
const initialPrefillYamlRef = useRef(null);
|
|
46937
|
+
const latestPrefillYamlRef = useRef(null);
|
|
46884
46938
|
useEffect(() => {
|
|
46885
|
-
|
|
46939
|
+
if (prefillValuesSchema === void 0) return;
|
|
46940
|
+
const nextYaml = stringify(prefillValuesSchema);
|
|
46941
|
+
if (initialPrefillYamlRef.current === null) {
|
|
46942
|
+
initialPrefillYamlRef.current = nextYaml;
|
|
46943
|
+
setYamlData(nextYaml);
|
|
46944
|
+
}
|
|
46945
|
+
latestPrefillYamlRef.current = nextYaml;
|
|
46886
46946
|
}, [prefillValuesSchema]);
|
|
46947
|
+
const handleReload = () => {
|
|
46948
|
+
const nextYaml = latestPrefillYamlRef.current ?? initialPrefillYamlRef.current;
|
|
46949
|
+
if (nextYaml !== null) {
|
|
46950
|
+
setYamlData(nextYaml);
|
|
46951
|
+
}
|
|
46952
|
+
};
|
|
46887
46953
|
const onSubmit = () => {
|
|
46888
46954
|
setIsLoading(true);
|
|
46889
46955
|
setError(void 0);
|
|
@@ -46955,7 +47021,8 @@ const YamlEditorSingleton = ({
|
|
|
46955
47021
|
) }),
|
|
46956
47022
|
!readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.ControlsRowContainer, { $bgColor: token.colorPrimaryBg, $designNewLayout: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { gap: designNewLayout ? 10 : 16, align: "center", children: [
|
|
46957
47023
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
|
|
46958
|
-
backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => navigate(backlink), children: "Cancel" })
|
|
47024
|
+
backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => navigate(backlink), children: "Cancel" }),
|
|
47025
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: handleReload, children: "Reload" })
|
|
46959
47026
|
] }) }),
|
|
46960
47027
|
error && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
46961
47028
|
Modal,
|