Merge pull request #1735 from danielyxie/dev

tail box can rerun scripts
This commit is contained in:
hydroflame 2021-11-17 17:33:58 -05:00 committed by GitHub
commit cd8da81c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 createStyles from "@mui/styles/createStyles";
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
import { workerScripts } from "../../Netscript/WorkerScripts";
import { startWorkerScript } from "../../NetscriptWorker";
import { GetServer } from "../../Server/AllServers";
let layerCounter = 0;
@ -89,7 +92,12 @@ function LogWindow(props: IProps): React.ReactElement {
function kill(): void {
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 {
@ -134,7 +142,8 @@ function LogWindow(props: IProps): React.ReactElement {
</Typography>
<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>
</Box>
</Box>