ui add
Browse files- server/app.py +54 -6
server/app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
|
|
|
| 3 |
from dataclasses import dataclass
|
| 4 |
import os
|
| 5 |
from typing import Any
|
|
@@ -89,12 +90,59 @@ def _build_step_response(session: RuntimeSession) -> StepResponse:
|
|
| 89 |
)
|
| 90 |
|
| 91 |
|
| 92 |
-
@app.get("/")
|
| 93 |
-
def
|
| 94 |
-
return
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
|
| 100 |
@app.get("/health")
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
from fastapi.responses import HTMLResponse
|
| 4 |
from dataclasses import dataclass
|
| 5 |
import os
|
| 6 |
from typing import Any
|
|
|
|
| 90 |
)
|
| 91 |
|
| 92 |
|
| 93 |
+
@app.get("/", response_class=HTMLResponse)
|
| 94 |
+
async def home():
|
| 95 |
+
return """
|
| 96 |
+
<html>
|
| 97 |
+
<head>
|
| 98 |
+
<title>CI/CD Debugger</title>
|
| 99 |
+
</head>
|
| 100 |
+
<body style="font-family: Arial; padding: 40px; background:#111; color:white;">
|
| 101 |
+
<h1>CI/CD Debugger Environment</h1>
|
| 102 |
+
|
| 103 |
+
<button onclick="reset()">Reset</button>
|
| 104 |
+
|
| 105 |
+
<br><br>
|
| 106 |
+
|
| 107 |
+
<select id="action">
|
| 108 |
+
<option>READ_LOGS</option>
|
| 109 |
+
<option>READ_FILE</option>
|
| 110 |
+
<option>RUN_STAGE</option>
|
| 111 |
+
<option>VALIDATE</option>
|
| 112 |
+
</select>
|
| 113 |
+
|
| 114 |
+
<button onclick="step()">Step</button>
|
| 115 |
+
|
| 116 |
+
<pre id="output" style="background:#222; padding:20px;"></pre>
|
| 117 |
+
|
| 118 |
+
<script>
|
| 119 |
+
async function reset(){
|
| 120 |
+
const res = await fetch('/reset', {method:'POST'});
|
| 121 |
+
const data = await res.json();
|
| 122 |
+
document.getElementById('output').textContent =
|
| 123 |
+
JSON.stringify(data, null, 2);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
async function step(){
|
| 127 |
+
const action = document.getElementById('action').value;
|
| 128 |
+
|
| 129 |
+
const res = await fetch('/step', {
|
| 130 |
+
method:'POST',
|
| 131 |
+
headers:{'Content-Type':'application/json'},
|
| 132 |
+
body: JSON.stringify({
|
| 133 |
+
action_type: action,
|
| 134 |
+
payload: {}
|
| 135 |
+
})
|
| 136 |
+
});
|
| 137 |
+
|
| 138 |
+
const data = await res.json();
|
| 139 |
+
document.getElementById('output').textContent =
|
| 140 |
+
JSON.stringify(data, null, 2);
|
| 141 |
+
}
|
| 142 |
+
</script>
|
| 143 |
+
</body>
|
| 144 |
+
</html>
|
| 145 |
+
"""
|
| 146 |
|
| 147 |
|
| 148 |
@app.get("/health")
|