@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.5 → 1.1.0-alpha.6
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.
|
@@ -8356,9 +8356,9 @@
|
|
|
8356
8356
|
}).toString()}`;
|
|
8357
8357
|
const { data, isError, isLoading, error } = useDirectUnknownResource({
|
|
8358
8358
|
uri,
|
|
8359
|
-
queryKey: ["k8s-verbs", group || "", version, plural],
|
|
8359
|
+
queryKey: ["k8s-verbs", cluster, group || "", version, plural],
|
|
8360
8360
|
refetchInterval: false,
|
|
8361
|
-
isEnabled
|
|
8361
|
+
isEnabled: Boolean(isEnabled && cluster && version && plural)
|
|
8362
8362
|
});
|
|
8363
8363
|
const verbs = data?.verbs || [];
|
|
8364
8364
|
const canList = verbs.includes("list");
|
|
@@ -8627,19 +8627,6 @@
|
|
|
8627
8627
|
wsRef.current = null;
|
|
8628
8628
|
connect();
|
|
8629
8629
|
}, [closeWS, connect, setStatusSafe]);
|
|
8630
|
-
K.useEffect(() => {
|
|
8631
|
-
if (!mountedRef.current) return;
|
|
8632
|
-
if (isEnabled) {
|
|
8633
|
-
connect();
|
|
8634
|
-
} else {
|
|
8635
|
-
if (reconnectTimerRef.current) {
|
|
8636
|
-
window.clearTimeout(reconnectTimerRef.current);
|
|
8637
|
-
reconnectTimerRef.current = null;
|
|
8638
|
-
}
|
|
8639
|
-
closeWS();
|
|
8640
|
-
setStatusSafe("closed");
|
|
8641
|
-
}
|
|
8642
|
-
}, [isEnabled, closeWS, connect, setStatusSafe]);
|
|
8643
8630
|
const setUrl = K.useCallback(
|
|
8644
8631
|
(next) => {
|
|
8645
8632
|
const changed = next !== urlRef.current;
|
|
@@ -8693,6 +8680,12 @@
|
|
|
8693
8680
|
return;
|
|
8694
8681
|
}
|
|
8695
8682
|
if (!frame) return;
|
|
8683
|
+
if (frame.type === "SERVER_LOG") {
|
|
8684
|
+
const level = frame.level || "info";
|
|
8685
|
+
const msg = frame.message;
|
|
8686
|
+
(console[level] || console.log).call(console, "[useListWatch][server]", msg);
|
|
8687
|
+
return;
|
|
8688
|
+
}
|
|
8696
8689
|
if (frame.type === "INITIAL") {
|
|
8697
8690
|
dispatch({ type: "RESET", items: frame.items });
|
|
8698
8691
|
setContToken(frame.continue);
|
|
@@ -8763,6 +8756,19 @@
|
|
|
8763
8756
|
K.useEffect(() => {
|
|
8764
8757
|
if (wsUrl !== urlRef.current) setUrl(wsUrl);
|
|
8765
8758
|
}, [wsUrl, setUrl]);
|
|
8759
|
+
K.useEffect(() => {
|
|
8760
|
+
if (!mountedRef.current) return;
|
|
8761
|
+
if (isEnabled) {
|
|
8762
|
+
connect();
|
|
8763
|
+
} else {
|
|
8764
|
+
if (reconnectTimerRef.current) {
|
|
8765
|
+
window.clearTimeout(reconnectTimerRef.current);
|
|
8766
|
+
reconnectTimerRef.current = null;
|
|
8767
|
+
}
|
|
8768
|
+
closeWS();
|
|
8769
|
+
setStatusSafe("closed");
|
|
8770
|
+
}
|
|
8771
|
+
}, [isEnabled, closeWS, connect, setStatusSafe]);
|
|
8766
8772
|
K.useEffect(() => {
|
|
8767
8773
|
if (resIdRef.current !== resId) {
|
|
8768
8774
|
clearErrorSafe();
|
|
@@ -8912,7 +8918,7 @@
|
|
|
8912
8918
|
group,
|
|
8913
8919
|
version,
|
|
8914
8920
|
plural,
|
|
8915
|
-
isEnabled
|
|
8921
|
+
isEnabled: Boolean(isEnabled && cluster && cluster.length > 0)
|
|
8916
8922
|
});
|
|
8917
8923
|
const listUri = buildListUri({
|
|
8918
8924
|
cluster,
|
|
@@ -8924,7 +8930,9 @@
|
|
|
8924
8930
|
labelSelector,
|
|
8925
8931
|
limit
|
|
8926
8932
|
});
|
|
8927
|
-
const restEnabled = Boolean(
|
|
8933
|
+
const restEnabled = Boolean(
|
|
8934
|
+
cluster && cluster.length > 0 && isEnabled && canList && !canWatch && !verbsLoading && !verbsIsError
|
|
8935
|
+
);
|
|
8928
8936
|
const {
|
|
8929
8937
|
data: restData,
|
|
8930
8938
|
isLoading: restLoading,
|
|
@@ -8945,7 +8953,9 @@
|
|
|
8945
8953
|
refetchInterval: listRefetchInterval,
|
|
8946
8954
|
isEnabled: restEnabled
|
|
8947
8955
|
});
|
|
8948
|
-
const watchEnabled = Boolean(
|
|
8956
|
+
const watchEnabled = Boolean(
|
|
8957
|
+
cluster && cluster.length > 0 && isEnabled && canList && canWatch && !verbsLoading && !verbsIsError
|
|
8958
|
+
);
|
|
8949
8959
|
const { state, status, lastError } = useListWatch({
|
|
8950
8960
|
wsUrl: `/api/clusters/${cluster}/openapi-bff-ws/listThenWatch/listWatchWs`,
|
|
8951
8961
|
paused: false,
|
|
@@ -50995,7 +51005,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
50995
51005
|
fieldSelector: `metadata.name=${namespace}`,
|
|
50996
51006
|
isEnabled: Boolean(clusterName !== void 0)
|
|
50997
51007
|
});
|
|
50998
|
-
const project = projectArr && projectArr.length > 0 ? projectArr[0] : void 0;
|
|
51008
|
+
const project = projectArr && projectArr.items && projectArr.items.length > 0 ? projectArr.items[0] : void 0;
|
|
50999
51009
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = K.useState(false);
|
|
51000
51010
|
const updatePermission = usePermissions({
|
|
51001
51011
|
group: baseProjectApiGroup,
|