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