39 lines
923 B
React
39 lines
923 B
React
|
import { useState } from "react";
|
||
|
import { Initiator } from "qualiteer/web-clients";
|
||
|
|
||
|
const cmd = `node other.js`;
|
||
|
export default function Test() {
|
||
|
const [job, setJob] = useState({ log: ["INTRO"] });
|
||
|
|
||
|
function onLog(d) {
|
||
|
const j = { ...job };
|
||
|
j.log.push(d);
|
||
|
setJob(j);
|
||
|
}
|
||
|
|
||
|
async function startJob() {
|
||
|
console.log("Wanting to start");
|
||
|
const url = "https://Qualiteer.elijahparker3.repl.co";
|
||
|
// Create an initiator and make a job request
|
||
|
const primary = new Initiator(url);
|
||
|
const job = { command: cmd };
|
||
|
await primary.newJob(job, onLog, () =>
|
||
|
console.log("Primary Job Concluded")
|
||
|
);
|
||
|
console.log("Started");
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<div className="test">
|
||
|
<h1>vv Info vv </h1>
|
||
|
<button onClick={startJob}>Start</button>
|
||
|
{job.log.map((l, i) => (
|
||
|
<div className="line" key={i}>
|
||
|
{l}
|
||
|
<br />
|
||
|
</div>
|
||
|
))}
|
||
|
</div>
|
||
|
);
|
||
|
}
|