Compare commits
2 Commits
4dcbe78abf
...
af196529f8
| Author | SHA1 | Date | |
|---|---|---|---|
| af196529f8 | |||
| 901159ae2d |
17
package-lock.json
generated
17
package-lock.json
generated
@@ -31,7 +31,6 @@
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"globals": "^16.4.0",
|
||||
"husky": "^9.1.7",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^30.2.0",
|
||||
"jest-environment-jsdom": "^30.2.0",
|
||||
@@ -5544,22 +5543,6 @@
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/husky": {
|
||||
"version": "9.1.7",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
|
||||
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"husky": "bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/typicode"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint src test",
|
||||
"preview": "vite preview",
|
||||
"test": "jest",
|
||||
"prepare": "husky"
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@neodrag/react": "^2.3.1",
|
||||
@@ -35,7 +34,6 @@
|
||||
"eslint-plugin-react-hooks": "^5.2.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"globals": "^16.4.0",
|
||||
"husky": "^9.1.7",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^30.2.0",
|
||||
"jest-environment-jsdom": "^30.2.0",
|
||||
|
||||
@@ -98,6 +98,11 @@ University within the Software Project course.
|
||||
color: white;
|
||||
}
|
||||
|
||||
.stop {
|
||||
background-color: red;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.restartExperiment{
|
||||
background-color: red;
|
||||
color: white;
|
||||
|
||||
@@ -8,6 +8,7 @@ import styles from './MonitoringPage.module.css';
|
||||
import useProgramStore from "../../utils/programStore";
|
||||
import {
|
||||
nextPhase,
|
||||
stopExperiment,
|
||||
useExperimentLogger,
|
||||
useStatusLogger,
|
||||
pauseExperiment,
|
||||
@@ -144,7 +145,7 @@ function useExperimentLogic() {
|
||||
}
|
||||
}, [setProgramState]);
|
||||
|
||||
const handleControlAction = async (action: "pause" | "play" | "nextPhase") => {
|
||||
const handleControlAction = async (action: "pause" | "play" | "nextPhase" | "stop") => {
|
||||
try {
|
||||
setLoading(true);
|
||||
switch (action) {
|
||||
@@ -159,6 +160,9 @@ function useExperimentLogic() {
|
||||
case "nextPhase":
|
||||
await nextPhase();
|
||||
break;
|
||||
case "stop":
|
||||
await stopExperiment();
|
||||
break;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
@@ -226,7 +230,7 @@ function ControlPanel({
|
||||
}: {
|
||||
loading: boolean,
|
||||
isPlaying: boolean,
|
||||
onAction: (a: "pause" | "play" | "nextPhase") => void,
|
||||
onAction: (a: "pause" | "play" | "nextPhase" | "stop") => void,
|
||||
onReset: () => void
|
||||
}) {
|
||||
return (
|
||||
@@ -256,6 +260,12 @@ function ControlPanel({
|
||||
onClick={onReset}
|
||||
disabled={loading}
|
||||
>⟲</button>
|
||||
|
||||
<button
|
||||
className={styles.stop}
|
||||
onClick={() => onAction("stop")}
|
||||
disabled={loading}
|
||||
>⏹</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -32,6 +32,12 @@ export async function nextPhase(): Promise<void> {
|
||||
sendAPICall(type, context)
|
||||
}
|
||||
|
||||
export async function stopExperiment(): Promise<void> {
|
||||
const type = "stop"
|
||||
const context = ""
|
||||
sendAPICall(type, context)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends an API call to the CB for going to pause experiment
|
||||
|
||||
Reference in New Issue
Block a user