Spaces:
Paused
Paused
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Flare Admin UI</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> | |
</head> | |
<body class="p-4"> | |
<div class="container"> | |
<h1 class="mb-4">🔥 Flare Admin UI</h1> | |
<!-- Login Panel --> | |
<div class="card mb-3"> | |
<div class="card-header">Login</div> | |
<div class="card-body"> | |
<input type="text" id="login-username" class="form-control mb-2" placeholder="Username"> | |
<input type="password" id="login-password" class="form-control mb-2" placeholder="Password"> | |
<button class="btn btn-primary" onclick="login()">Login</button> | |
<div id="login-result" class="mt-2"></div> | |
</div> | |
</div> | |
<!-- Config Panel --> | |
<div class="card mb-3"> | |
<div class="card-header">Config</div> | |
<div class="card-body"> | |
<button class="btn btn-info mb-2" onclick="getConfig()">Load Config</button> | |
<textarea id="config-json" class="form-control mb-2" rows="6" placeholder="Config JSON"></textarea> | |
<button class="btn btn-success" onclick="updateConfig()">Update Config</button> | |
<div id="config-result" class="mt-2"></div> | |
</div> | |
</div> | |
<!-- Project Panel --> | |
<div class="card mb-3"> | |
<div class="card-header">Projects</div> | |
<div class="card-body"> | |
<button class="btn btn-info mb-2" onclick="listProjects()">List Projects</button> | |
<textarea id="projects-json" class="form-control mb-2" rows="6" placeholder="Projects JSON"></textarea> | |
<input type="text" id="new-project-name" class="form-control mb-2" placeholder="New Project Name"> | |
<button class="btn btn-primary mb-2" onclick="addProject()">Add Project</button> | |
<div id="project-result" class="mt-2"></div> | |
</div> | |
</div> | |
<!-- Spark Panel --> | |
<div class="card mb-3"> | |
<div class="card-header">Spark</div> | |
<div class="card-body"> | |
<button class="btn btn-info" onclick="sparkProjectList()">Get Spark Project List</button> | |
<div id="spark-result" class="mt-2"></div> | |
</div> | |
</div> | |
<!-- Test Panel --> | |
<div class="card mb-3"> | |
<div class="card-header">Test Runner</div> | |
<div class="card-body"> | |
<button class="btn btn-warning" onclick="runTests()">Run All Tests</button> | |
<div id="test-result" class="mt-2"></div> | |
</div> | |
</div> | |
</div> | |
<script> | |
const apiBase = ''; | |
function login() { | |
const username = document.getElementById('login-username').value; | |
const password = document.getElementById('login-password').value; | |
fetch(`${apiBase}/auth/login`, { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ username, password }) | |
}) | |
.then(res => res.json()) | |
.then(data => document.getElementById('login-result').innerText = data.message || JSON.stringify(data)) | |
.catch(err => console.error(err)); | |
} | |
function getConfig() { | |
fetch(`${apiBase}/config/get`) | |
.then(res => res.json()) | |
.then(data => document.getElementById('config-json').value = JSON.stringify(data, null, 2)) | |
.catch(err => console.error(err)); | |
} | |
function updateConfig() { | |
const config = JSON.parse(document.getElementById('config-json').value); | |
fetch(`${apiBase}/config/update`, { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify(config) | |
}) | |
.then(res => res.json()) | |
.then(data => document.getElementById('config-result').innerText = data.message || JSON.stringify(data)) | |
.catch(err => console.error(err)); | |
} | |
function listProjects() { | |
fetch(`${apiBase}/project/list`) | |
.then(res => res.json()) | |
.then(data => document.getElementById('projects-json').value = JSON.stringify(data, null, 2)) | |
.catch(err => console.error(err)); | |
} | |
function addProject() { | |
const project_name = document.getElementById('new-project-name').value; | |
fetch(`${apiBase}/project/add`, { | |
method: 'POST', | |
headers: { 'Content-Type': 'application/json' }, | |
body: JSON.stringify({ project_name }) | |
}) | |
.then(res => res.json()) | |
.then(data => document.getElementById('project-result').innerText = data.message || JSON.stringify(data)) | |
.catch(err => console.error(err)); | |
} | |
function sparkProjectList() { | |
fetch(`${apiBase}/spark/project_list`) | |
.then(res => res.json()) | |
.then(data => document.getElementById('spark-result').innerText = JSON.stringify(data, null, 2)) | |
.catch(err => console.error(err)); | |
} | |
function runTests() { | |
fetch(`${apiBase}/test/run`, { method: 'POST' }) | |
.then(res => res.json()) | |
.then(data => document.getElementById('test-result').innerText = data.message || JSON.stringify(data)) | |
.catch(err => console.error(err)); | |
} | |
</script> | |
</body> | |
</html> | |