Streaming Transfers (#4548)

This commit is contained in:
Matthew Penner 2022-11-14 18:25:07 -07:00 committed by GitHub
parent 032e4f2e31
commit df2402b54f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 106 deletions

View file

@ -7,19 +7,19 @@ const TransferListener = () => {
const getServer = ServerContext.useStoreActions((actions) => actions.server.getServer);
const setServerFromState = ServerContext.useStoreActions((actions) => actions.server.setServerFromState);
// Listen for the transfer status event so we can update the state of the server.
// Listen for the transfer status event, so we can update the state of the server.
useWebsocketEvent(SocketEvent.TRANSFER_STATUS, (status: string) => {
if (status === 'starting') {
if (status === 'pending' || status === 'processing') {
setServerFromState((s) => ({ ...s, isTransferring: true }));
return;
}
if (status === 'failure') {
if (status === 'failed') {
setServerFromState((s) => ({ ...s, isTransferring: false }));
return;
}
if (status !== 'success') {
if (status !== 'completed') {
return;
}

View file

@ -76,13 +76,6 @@ export default () => {
case 'failure':
terminal.writeln(TERMINAL_PRELUDE + 'Transfer has failed.\u001b[0m');
return;
// Sent by the source node whenever the server was archived successfully.
case 'archive':
terminal.writeln(
TERMINAL_PRELUDE +
'Server has been archived successfully, attempting connection to target node..\u001b[0m'
);
}
};