fix(striker-ui): add guess to ws errors in vnc conn

main^2
Tsu-ba-me 7 months ago
parent 99f7fd6498
commit 08ab5eacf8
  1. 17
      striker-ui/components/Display/FullSize.tsx

@ -46,6 +46,11 @@ const VncDisplay = dynamic(() => import('./VncDisplay'), { ssr: false });
// Unit: seconds
const DEFAULT_VNC_RECONNECT_TIMER_START = 10;
const MAP_TO_WSCODE_MSG: Record<number, string> = {
1000: 'in-use by another process?',
1006: 'destination is down?',
};
const buildServerVncUrl = (host: string, serverUuid: string) =>
`ws://${host}/ws/server/vnc/${serverUuid}`;
@ -172,13 +177,19 @@ const FullSize: FC<FullSizeProps> = ({
const { code: wscode, reason } = event;
let clientmsg = `ws: ${wscode}`;
let wsmsg = `ws: ${wscode}`;
const guess = MAP_TO_WSCODE_MSG[wscode];
if (guess) {
wsmsg += ` (${guess})`;
}
if (reason) {
clientmsg += `, ${reason}`;
wsmsg += `, ${reason}`;
}
setVncWsErrorMessage(clientmsg);
setVncWsErrorMessage(wsmsg);
const vncerror = buildCookieJar()[
`suiapi.vncerror.${serverUUID}`

Loading…
Cancel
Save