Updates
This commit is contained in:
parent
dcd7f022bd
commit
c4c2caa6f0
@ -36,7 +36,10 @@ export default function ServiceClusterServerViews({
|
|||||||
const viewRef = useRef<HTMLDivElement>(undefined);
|
const viewRef = useRef<HTMLDivElement>(undefined);
|
||||||
|
|
||||||
const { data } = useWebSocketEventHandler<WebSocketDataType>();
|
const { data } = useWebSocketEventHandler<WebSocketDataType>();
|
||||||
const { isIntersecting } = useIntersectionObserver({ elementRef: viewRef });
|
const { isIntersecting } = useIntersectionObserver({
|
||||||
|
elementRef: viewRef,
|
||||||
|
options: { rootMargin: "-200px", threshold: 0 },
|
||||||
|
});
|
||||||
|
|
||||||
const [ttyd, setTtyd] = useState<TtydInfoObject>();
|
const [ttyd, setTtyd] = useState<TtydInfoObject>();
|
||||||
|
|
||||||
@ -56,7 +59,7 @@ export default function ServiceClusterServerViews({
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ws?.socket || WsReqSentRef.current) {
|
if (!ws?.socket || WsReqSentRef.current || !isIntersecting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,11 +83,9 @@ export default function ServiceClusterServerViews({
|
|||||||
return function () {
|
return function () {
|
||||||
sendKillPort();
|
sendKillPort();
|
||||||
};
|
};
|
||||||
}, [ws, refresh]);
|
}, [ws, refresh, isIntersecting]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("log_cmd", log_cmd);
|
|
||||||
|
|
||||||
if (WsReqSentRef.current) {
|
if (WsReqSentRef.current) {
|
||||||
sendKillPort();
|
sendKillPort();
|
||||||
|
|
||||||
@ -125,7 +126,10 @@ export default function ServiceClusterServerViews({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ttyd?.port) return;
|
if (!ttyd?.port) return;
|
||||||
|
|
||||||
if (!isIntersecting) {
|
if (isIntersecting) {
|
||||||
|
WsReqSentRef.current = false;
|
||||||
|
setTtyd(undefined);
|
||||||
|
} else {
|
||||||
sendKillPort();
|
sendKillPort();
|
||||||
}
|
}
|
||||||
}, [isIntersecting]);
|
}, [isIntersecting]);
|
||||||
|
|||||||
@ -13,8 +13,6 @@ export default async function socketClientServiceServerLogs({
|
|||||||
const server = data?.server;
|
const server = data?.server;
|
||||||
const cmd = data?.cmd;
|
const cmd = data?.cmd;
|
||||||
|
|
||||||
console.log("cmd", cmd);
|
|
||||||
|
|
||||||
const ttyd = await grabTtydServerInfo({
|
const ttyd = await grabTtydServerInfo({
|
||||||
server,
|
server,
|
||||||
service,
|
service,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user