Spaces:
Building
Building
Update static/index.html
Browse files- static/index.html +35 -228
static/index.html
CHANGED
@@ -2,244 +2,51 @@
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
-
<title>Flare Admin
|
6 |
-
<link
|
7 |
-
<
|
|
|
8 |
</head>
|
9 |
-
<body
|
10 |
-
<div class="container">
|
11 |
-
<h1
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<
|
16 |
-
<
|
17 |
-
|
18 |
-
<input type="password" id="login-password" class="form-control mb-2" placeholder="Password">
|
19 |
-
<button class="btn btn-primary btn-block" onclick="login()">Login</button>
|
20 |
-
<div id="login-result" class="mt-2 text-danger"></div>
|
21 |
-
</div>
|
22 |
</div>
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
<ul class="nav nav-tabs mb-3" role="tablist">
|
27 |
-
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#config" role="tab">Config</a></li>
|
28 |
-
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#projects" role="tab">Projects</a></li>
|
29 |
-
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#spark" role="tab">Spark</a></li>
|
30 |
-
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#test" role="tab">Test</a></li>
|
31 |
-
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#admin" role="tab">Admin Tools</a></li>
|
32 |
-
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#api" role="tab">API Definitions</a></li>
|
33 |
-
</ul>
|
34 |
-
|
35 |
-
<div class="tab-content">
|
36 |
-
<!-- Config Tab -->
|
37 |
-
<div class="tab-pane fade show active" id="config" role="tabpanel">
|
38 |
-
<form>
|
39 |
-
<div class="form-group">
|
40 |
-
<label for="work-mode">Work Mode</label>
|
41 |
-
<select id="work-mode" class="form-control" onchange="toggleCloudToken()">
|
42 |
-
<option value="hfcloud">hfcloud</option>
|
43 |
-
<option value="cloud">cloud</option>
|
44 |
-
<option value="on-premise">on-premise</option>
|
45 |
-
</select>
|
46 |
-
</div>
|
47 |
-
<div class="form-group">
|
48 |
-
<label for="cloud-token">Cloud Token</label>
|
49 |
-
<input type="text" id="cloud-token" class="form-control">
|
50 |
-
</div>
|
51 |
-
<button type="button" class="btn btn-info mb-2" onclick="getConfig()">Load Config</button>
|
52 |
-
<button type="button" class="btn btn-success mb-2" onclick="updateConfig()">Update Config</button>
|
53 |
-
<div id="config-result" class="mt-2"></div>
|
54 |
-
</form>
|
55 |
-
</div>
|
56 |
-
|
57 |
-
<!-- Projects Tab -->
|
58 |
-
<div class="tab-pane fade" id="projects" role="tabpanel">
|
59 |
-
<button class="btn btn-info mb-2" onclick="listProjects()">Refresh Project List</button>
|
60 |
-
<div class="form-group">
|
61 |
-
<label for="project-select">Select Project</label>
|
62 |
-
<select id="project-select" class="form-control" onchange="loadProjectDetails()">
|
63 |
-
<option value="">-- Select a project --</option>
|
64 |
-
</select>
|
65 |
-
</div>
|
66 |
-
<div id="project-details" class="mt-3 d-none">
|
67 |
-
<h5>Project Details</h5>
|
68 |
-
<div id="project-info"></div>
|
69 |
-
<button class="btn btn-success mt-2" onclick="saveProject()">Save Changes</button>
|
70 |
-
<button class="btn btn-warning mt-2" onclick="publishProject()">Publish Version</button>
|
71 |
-
</div>
|
72 |
-
<div id="project-result" class="mt-2"></div>
|
73 |
-
</div>
|
74 |
-
|
75 |
-
<!-- Spark Tab -->
|
76 |
-
<div class="tab-pane fade" id="spark" role="tabpanel">
|
77 |
-
<button class="btn btn-info mb-2" onclick="sparkProjectList()">Get Spark Project List</button>
|
78 |
-
<div id="spark-table" class="table-responsive">
|
79 |
-
<table class="table table-bordered">
|
80 |
-
<thead>
|
81 |
-
<tr>
|
82 |
-
<th>Project</th>
|
83 |
-
<th>Version</th>
|
84 |
-
<th>Enabled</th>
|
85 |
-
<th>Status</th>
|
86 |
-
<th>Last Accessed</th>
|
87 |
-
</tr>
|
88 |
-
</thead>
|
89 |
-
<tbody id="spark-body">
|
90 |
-
<!-- Spark rows here -->
|
91 |
-
</tbody>
|
92 |
-
</table>
|
93 |
-
</div>
|
94 |
-
<div id="spark-result" class="mt-2"></div>
|
95 |
-
</div>
|
96 |
-
|
97 |
-
<!-- Test Tab -->
|
98 |
-
<div class="tab-pane fade" id="test" role="tabpanel">
|
99 |
-
<button class="btn btn-warning mb-2" onclick="runTests()">Run All Tests</button>
|
100 |
-
<div id="test-result" class="mt-2"></div>
|
101 |
-
</div>
|
102 |
-
|
103 |
-
<!-- Admin Tools Tab -->
|
104 |
-
<div class="tab-pane fade" id="admin" role="tabpanel">
|
105 |
-
<button class="btn btn-danger mb-2" onclick="seedTestData()">Seed Test Data</button>
|
106 |
-
<button class="btn btn-danger mb-2" onclick="clearAllProjects()">Clear All Projects</button>
|
107 |
-
<div id="admin-result" class="mt-2"></div>
|
108 |
-
</div>
|
109 |
-
|
110 |
-
<!-- API Definitions Tab -->
|
111 |
-
<div class="tab-pane fade" id="api" role="tabpanel">
|
112 |
-
<button class="btn btn-info mb-2" onclick="listApis()">Refresh API List</button>
|
113 |
-
<button class="btn btn-success mb-2" onclick="addApi()">+ Add API</button>
|
114 |
-
<div id="api-table" class="table-responsive">
|
115 |
-
<table class="table table-bordered">
|
116 |
-
<thead>
|
117 |
-
<tr>
|
118 |
-
<th>API Name</th>
|
119 |
-
<th>URL</th>
|
120 |
-
<th>Method</th>
|
121 |
-
<th>Actions</th>
|
122 |
-
</tr>
|
123 |
-
</thead>
|
124 |
-
<tbody id="api-body">
|
125 |
-
<!-- API rows here -->
|
126 |
-
</tbody>
|
127 |
-
</table>
|
128 |
-
</div>
|
129 |
-
<div id="api-result" class="mt-2"></div>
|
130 |
-
</div>
|
131 |
-
</div>
|
132 |
</div>
|
133 |
-
</div>
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
<div class="modal-header">
|
140 |
-
<h5 class="modal-title" id="intentModalLabel">Edit Intent</h5>
|
141 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
142 |
-
<span aria-hidden="true">×</span>
|
143 |
-
</button>
|
144 |
-
</div>
|
145 |
-
<div class="modal-body">
|
146 |
-
<input type="hidden" id="intent-project-name">
|
147 |
-
<input type="hidden" id="intent-name">
|
148 |
-
<div class="form-group">
|
149 |
-
<label for="intent-action">Action (API)</label>
|
150 |
-
<input type="text" id="intent-action" class="form-control">
|
151 |
-
</div>
|
152 |
-
<div class="form-group">
|
153 |
-
<label for="intent-fallback">Fallback Error Message</label>
|
154 |
-
<input type="text" id="intent-fallback" class="form-control">
|
155 |
-
</div>
|
156 |
-
<div class="form-group">
|
157 |
-
<label for="intent-prompt">Humanization Prompt</label>
|
158 |
-
<textarea id="intent-prompt" class="form-control"></textarea>
|
159 |
-
</div>
|
160 |
-
<div class="form-group">
|
161 |
-
<label for="intent-examples">Examples (comma-separated)</label>
|
162 |
-
<input type="text" id="intent-examples" class="form-control">
|
163 |
-
</div>
|
164 |
-
<div class="form-group">
|
165 |
-
<label>Parameters</label>
|
166 |
-
<button class="btn btn-sm btn-success ml-2" onclick="addParameterRow()">+ Add Parameter</button>
|
167 |
-
<table class="table table-sm mt-2">
|
168 |
-
<thead>
|
169 |
-
<tr>
|
170 |
-
<th>Name</th>
|
171 |
-
<th>Type</th>
|
172 |
-
<th>Regex</th>
|
173 |
-
<th>Validation Message</th>
|
174 |
-
<th>Actions</th>
|
175 |
-
</tr>
|
176 |
-
</thead>
|
177 |
-
<tbody id="parameter-body">
|
178 |
-
<!-- parameter rows -->
|
179 |
-
</tbody>
|
180 |
-
</table>
|
181 |
-
</div>
|
182 |
-
</div>
|
183 |
-
<div class="modal-footer">
|
184 |
-
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
185 |
-
<button type="button" class="btn btn-primary" onclick="saveIntent()">Save Changes</button>
|
186 |
-
</div>
|
187 |
</div>
|
188 |
-
</div>
|
189 |
-
</div>
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
<
|
197 |
-
</div>
|
198 |
-
<div class="modal-body">
|
199 |
-
<input type="text" id="intentNameInput" class="form-control mb-2" placeholder="Intent Name">
|
200 |
-
<input type="text" id="apiNameInput" class="form-control mb-2" placeholder="API Name">
|
201 |
-
<input type="text" id="apiUrlInput" class="form-control mb-2" placeholder="API URL">
|
202 |
-
<select id="apiMethodSelect" class="form-control mb-2">
|
203 |
-
<option value="GET">GET</option>
|
204 |
-
<option value="POST">POST</option>
|
205 |
-
</select>
|
206 |
-
</div>
|
207 |
-
<div class="modal-footer">
|
208 |
-
<button type="button" class="btn btn-primary" onclick="addIntent()">Save</button>
|
209 |
-
</div>
|
210 |
</div>
|
211 |
-
</div>
|
212 |
</div>
|
213 |
|
214 |
-
<!--
|
215 |
-
<div
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
<div class="modal-body">
|
222 |
-
<select id="baseVersionSelect" class="form-control">
|
223 |
-
<!-- Populated dynamically -->
|
224 |
-
</select>
|
225 |
-
</div>
|
226 |
-
<div class="modal-footer">
|
227 |
-
<button type="button" class="btn btn-success" onclick="createNewVersion()">Create</button>
|
228 |
-
</div>
|
229 |
-
</div>
|
230 |
-
</div>
|
231 |
-
</div>
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
<script src="js/config.js"></script>
|
237 |
-
<script src="js/project.js"></script>
|
238 |
-
<script src="js/spark.js"></script>
|
239 |
-
<script src="js/test.js"></script>
|
240 |
-
<script src="js/admin.js"></script>
|
241 |
-
<script src="js/api.js"></script>
|
242 |
-
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
243 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
|
244 |
</body>
|
245 |
</html>
|
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
+
<title>Flare Project Admin</title>
|
6 |
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
7 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
|
8 |
+
<script src="project.js" defer></script>
|
9 |
</head>
|
10 |
+
<body>
|
11 |
+
<div class="container mt-4">
|
12 |
+
<h1>Flare Project Admin Panel</h1>
|
13 |
+
|
14 |
+
<div class="mb-3">
|
15 |
+
<button class="btn btn-success" id="newProjectBtn">+ New Project</button>
|
16 |
+
<button class="btn btn-primary" id="newVersionBtn">+ New Version</button>
|
17 |
+
<button class="btn btn-secondary" id="saveChangesBtn">Save Project</button>
|
18 |
+
<button class="btn btn-warning" id="publishVersionBtn">Publish Version</button>
|
|
|
|
|
|
|
|
|
19 |
</div>
|
20 |
|
21 |
+
<div id="projectDetails" class="mb-4">
|
22 |
+
<!-- Project details will be injected here -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
</div>
|
|
|
24 |
|
25 |
+
<div>
|
26 |
+
<h3>Intents</h3>
|
27 |
+
<button class="btn btn-outline-primary mb-2" id="addIntentBtn">+ Add Intent / API</button>
|
28 |
+
<!-- Intents list will be injected by JS -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
</div>
|
|
|
|
|
30 |
|
31 |
+
<div>
|
32 |
+
<h3>Spark Project List</h3>
|
33 |
+
<ul id="sparkProjectList" class="list-group mb-4">
|
34 |
+
<!-- Spark projects will be listed here -->
|
35 |
+
</ul>
|
36 |
+
<button class="btn btn-info" onclick="loadSparkProjects()">Get Spark Project List</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
</div>
|
|
|
38 |
</div>
|
39 |
|
40 |
+
<!-- Include modals -->
|
41 |
+
<div id="modals">
|
42 |
+
<!-- Add/Edit API Modal -->
|
43 |
+
<!-- (addIntentModal.html content here) -->
|
44 |
+
|
45 |
+
<!-- New Project Modal (if used) -->
|
46 |
+
<!-- (newProjectModal.html content here) -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
<!-- New Version Modal -->
|
49 |
+
<!-- (newVersionModal.html content here) -->
|
50 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
</body>
|
52 |
</html>
|