tail box can rerun scripts

This commit is contained in:
Olivier Gagnon 2021-11-17 17:33:44 -05:00
parent ef781a0627
commit eb381c7c73
4 changed files with 25 additions and 16 deletions

22
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -11,6 +11,9 @@ import { ResizableBox } from "react-resizable";
import makeStyles from "@mui/styles/makeStyles"; import makeStyles from "@mui/styles/makeStyles";
import createStyles from "@mui/styles/createStyles"; import createStyles from "@mui/styles/createStyles";
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos"; import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
import { workerScripts } from "../../Netscript/WorkerScripts";
import { startWorkerScript } from "../../NetscriptWorker";
import { GetServer } from "../../Server/AllServers";
let layerCounter = 0; let layerCounter = 0;
@ -89,7 +92,12 @@ function LogWindow(props: IProps): React.ReactElement {
function kill(): void { function kill(): void {
killWorkerScript(props.script, props.script.server, true); killWorkerScript(props.script, props.script.server, true);
props.onClose(); }
function run(): void {
const server = GetServer(props.script.server);
if (server === null) return;
startWorkerScript(props.script, server);
} }
function updateLayer(): void { function updateLayer(): void {
@ -134,7 +142,8 @@ function LogWindow(props: IProps): React.ReactElement {
</Typography> </Typography>
<Box position="absolute" right={0}> <Box position="absolute" right={0}>
<Button onClick={kill}>Kill Script</Button> {!workerScripts.has(props.script.pid) && <Button onClick={run}>Run</Button>}
{workerScripts.has(props.script.pid) && <Button onClick={kill}>Kill</Button>}
<Button onClick={props.onClose}>Close</Button> <Button onClick={props.onClose}>Close</Button>
</Box> </Box>
</Box> </Box>