add dashboard for testing
All checks were successful
CI for GGS-CRON / build-docker (push) Successful in 1m38s
CI for GGS-CRON / build-and-test (push) Successful in 3m22s

This commit is contained in:
Pakin 2025-08-11 17:38:45 +07:00
parent cae03f0e30
commit 8e5421ed17
5 changed files with 100 additions and 8 deletions

58
public/index.html Normal file
View file

@ -0,0 +1,58 @@
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css"
integrity="sha384-X38yfunGUhNzHpBaEBsWLO+A0HDYOQi8ufWDkZ0k9e0eXz/tH3II7uKZ9msv++Ls"
crossorigin="anonymous"
/>
</head>
<body>
<script src="scripts/test.js"></script>
<div class="pure-g">
<div class="pure-u-1-2">
<h1>Heartbeat</h1>
<button
class="pure-button pure-button-primary"
onclick="getHeartBeatInfo()"
>
Info
</button>
<h1>Sync Price Slot (THA)</h1>
<button
class="pure-button pure-button-primary"
onclick="getSyncPriceInfo()"
>
Info
</button>
<button
class="pure-button pure-button-primary"
onclick="setSyncPriceRunTest()"
>
Test
</button>
<button
class="pure-button pure-button-primary"
onclick="setSyncPriceRunNow()"
>
Run Now
</button>
</div>
<div class="pure-u-1-2" style="background-color: aliceblue">
<!-- show output -->
<h1>Output</h1>
<textarea
id="output"
cols="100"
rows="45"
readonly
style="resize: none"
></textarea>
</div>
</div>
</body>
</html>

24
public/scripts/test.js Normal file
View file

@ -0,0 +1,24 @@
console.log("Hello, World!");
function sendToOutput(message){
document.getElementById("output").value += message + "\n";
}
function getHeartBeatInfo(){
fetch("http://localhost:36530/heartbeat/info").then(response => response.json()).then(data => sendToOutput(JSON.stringify(data)));
}
// Sync Price Slot Command Shortcuts
//
//
function getSyncPriceInfo(){
fetch("http://localhost:36530/syncProfilePriceSlotSheet/info").then(response => response.json()).then(data => sendToOutput(JSON.stringify(data)));
}
function setSyncPriceRunTest(){
fetch("http://localhost:36530/syncProfilePriceSlotSheet/run/test").then(response => response.json()).then(data => sendToOutput(JSON.stringify(data)));
}
function setSyncPriceRunNow(){
fetch("http://localhost:36530/syncProfilePriceSlotSheet/run/now").then(response => response.json()).then(data => sendToOutput(JSON.stringify(data)));
}