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