ciyidogan commited on
Commit
d791964
·
verified ·
1 Parent(s): 568cafb

Upload index.html

Browse files
Files changed (1) hide show
  1. static/index.html +134 -0
static/index.html ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Flare Admin UI</title>
6
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
7
+ </head>
8
+ <body class="p-4">
9
+ <div class="container">
10
+ <h1 class="mb-4">🔥 Flare Admin UI</h1>
11
+
12
+ <!-- Login Panel -->
13
+ <div class="card mb-3">
14
+ <div class="card-header">Login</div>
15
+ <div class="card-body">
16
+ <input type="text" id="login-username" class="form-control mb-2" placeholder="Username">
17
+ <input type="password" id="login-password" class="form-control mb-2" placeholder="Password">
18
+ <button class="btn btn-primary" onclick="login()">Login</button>
19
+ <div id="login-result" class="mt-2"></div>
20
+ </div>
21
+ </div>
22
+
23
+ <!-- Config Panel -->
24
+ <div class="card mb-3">
25
+ <div class="card-header">Config</div>
26
+ <div class="card-body">
27
+ <button class="btn btn-info mb-2" onclick="getConfig()">Load Config</button>
28
+ <textarea id="config-json" class="form-control mb-2" rows="6" placeholder="Config JSON"></textarea>
29
+ <button class="btn btn-success" onclick="updateConfig()">Update Config</button>
30
+ <div id="config-result" class="mt-2"></div>
31
+ </div>
32
+ </div>
33
+
34
+ <!-- Project Panel -->
35
+ <div class="card mb-3">
36
+ <div class="card-header">Projects</div>
37
+ <div class="card-body">
38
+ <button class="btn btn-info mb-2" onclick="listProjects()">List Projects</button>
39
+ <textarea id="projects-json" class="form-control mb-2" rows="6" placeholder="Projects JSON"></textarea>
40
+ <input type="text" id="new-project-name" class="form-control mb-2" placeholder="New Project Name">
41
+ <button class="btn btn-primary mb-2" onclick="addProject()">Add Project</button>
42
+ <div id="project-result" class="mt-2"></div>
43
+ </div>
44
+ </div>
45
+
46
+ <!-- Spark Panel -->
47
+ <div class="card mb-3">
48
+ <div class="card-header">Spark</div>
49
+ <div class="card-body">
50
+ <button class="btn btn-info" onclick="sparkProjectList()">Get Spark Project List</button>
51
+ <div id="spark-result" class="mt-2"></div>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- Test Panel -->
56
+ <div class="card mb-3">
57
+ <div class="card-header">Test Runner</div>
58
+ <div class="card-body">
59
+ <button class="btn btn-warning" onclick="runTests()">Run All Tests</button>
60
+ <div id="test-result" class="mt-2"></div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+
65
+ <script>
66
+ const apiBase = '';
67
+
68
+ function login() {
69
+ const username = document.getElementById('login-username').value;
70
+ const password = document.getElementById('login-password').value;
71
+ fetch(`${apiBase}/auth/login`, {
72
+ method: 'POST',
73
+ headers: { 'Content-Type': 'application/json' },
74
+ body: JSON.stringify({ username, password })
75
+ })
76
+ .then(res => res.json())
77
+ .then(data => document.getElementById('login-result').innerText = data.message || JSON.stringify(data))
78
+ .catch(err => console.error(err));
79
+ }
80
+
81
+ function getConfig() {
82
+ fetch(`${apiBase}/config/get`)
83
+ .then(res => res.json())
84
+ .then(data => document.getElementById('config-json').value = JSON.stringify(data, null, 2))
85
+ .catch(err => console.error(err));
86
+ }
87
+
88
+ function updateConfig() {
89
+ const config = JSON.parse(document.getElementById('config-json').value);
90
+ fetch(`${apiBase}/config/update`, {
91
+ method: 'POST',
92
+ headers: { 'Content-Type': 'application/json' },
93
+ body: JSON.stringify(config)
94
+ })
95
+ .then(res => res.json())
96
+ .then(data => document.getElementById('config-result').innerText = data.message || JSON.stringify(data))
97
+ .catch(err => console.error(err));
98
+ }
99
+
100
+ function listProjects() {
101
+ fetch(`${apiBase}/project/list`)
102
+ .then(res => res.json())
103
+ .then(data => document.getElementById('projects-json').value = JSON.stringify(data, null, 2))
104
+ .catch(err => console.error(err));
105
+ }
106
+
107
+ function addProject() {
108
+ const project_name = document.getElementById('new-project-name').value;
109
+ fetch(`${apiBase}/project/add`, {
110
+ method: 'POST',
111
+ headers: { 'Content-Type': 'application/json' },
112
+ body: JSON.stringify({ project_name })
113
+ })
114
+ .then(res => res.json())
115
+ .then(data => document.getElementById('project-result').innerText = data.message || JSON.stringify(data))
116
+ .catch(err => console.error(err));
117
+ }
118
+
119
+ function sparkProjectList() {
120
+ fetch(`${apiBase}/spark/project_list`)
121
+ .then(res => res.json())
122
+ .then(data => document.getElementById('spark-result').innerText = JSON.stringify(data, null, 2))
123
+ .catch(err => console.error(err));
124
+ }
125
+
126
+ function runTests() {
127
+ fetch(`${apiBase}/test/run`, { method: 'POST' })
128
+ .then(res => res.json())
129
+ .then(data => document.getElementById('test-result').innerText = data.message || JSON.stringify(data))
130
+ .catch(err => console.error(err));
131
+ }
132
+ </script>
133
+ </body>
134
+ </html>