-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
216 lines (202 loc) · 6.13 KB
/
Copy pathindex.html
File metadata and controls
216 lines (202 loc) · 6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Chap Servers</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
font-family: system-ui, sans-serif;
margin: 2rem auto;
padding: 0.5rem;
max-width: 700px;
line-height: 1.6;
}
h1 {
text-align: left;
color: #333;
}
hr {
margin: 2rem 0;
}
.server-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.server-item {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #ccc;
font-size: 16px;
padding: 0.5rem 0;
}
.server-item a {
color: #0066cc;
text-decoration: none;
font-weight: 500;
}
.server-item a:hover {
text-decoration: underline;
}
/* --- table styles --- */
table {
width: 100%;
border-collapse: collapse;
font-size: 0.95rem;
margin-top: 1rem;
}
th,
td {
padding: 0.6rem 0.5rem;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
font-weight: 600;
color: #333;
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.03em;
}
tr:last-child td {
border-bottom: none;
}
a {
color: #0066cc;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.status-dot {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #e74c3c; /* default red */
}
.status-dot.ok {
background: #2ecc71; /* green */
}
td.status-cell,
th.status-cell {
text-align: right;
}
</style>
</head>
<body>
<h1>Chap Servers 🌐</h1>
<p>
These servers are publicly available and can be used to connect to the
DHIS2 Modeling App. However, please note that you do so at your own risk.
<b>Do not upload or transmit any private or sensitive data.</b> All
servers are reset every Saturday at 01:00 CET, which results in approximately
15 minutes of downtime.
</p>
<hr />
<div>
<!-- Combined content starts here -->
<table>
<thead>
<tr>
<th>Name</th>
<th>Version</th>
<th>URL</th>
<th>OpenAPI</th>
<th>Logs</th>
<th class="status-cell">Status</th>
</tr>
</thead>
<tbody id="versions-body">
<!-- Rows will be injected by JavaScript -->
</tbody>
</table>
<div style="text-align: right; margin-top: 30px">
<a href="/logs/">all logs ➔</a>
</div>
<script>
const versions = [{ VERSION: "stable" }, { VERSION: "master" }];
const tbody = document.getElementById("versions-body");
function createRow(entry) {
const versionName = entry.VERSION;
const tr = document.createElement("tr");
const baseUrl = `${window.location.origin}/${versionName}`;
// Name
const nameTd = document.createElement("td");
nameTd.textContent = versionName;
tr.appendChild(nameTd);
// Version
const versionTd = document.createElement("td");
versionTd.textContent = "";
tr.appendChild(versionTd);
// URL cell
const urlTd = document.createElement("td");
const urlLink = document.createElement("a");
urlLink.href = baseUrl;
urlLink.textContent = baseUrl;
urlLink.target = "_blank";
urlLink.rel = "noopener noreferrer";
urlTd.appendChild(urlLink);
tr.appendChild(urlTd);
// OpenAPI link
const openApiTd = document.createElement("td");
const openApiLink = document.createElement("a");
openApiLink.href = `/${versionName}/openapi.json`;
openApiLink.textContent = "openapi.json";
openApiLink.target = "_blank";
openApiLink.rel = "noopener noreferrer";
openApiTd.appendChild(openApiLink);
tr.appendChild(openApiTd);
// Logs link
const logsTd = document.createElement("td");
const logsLink = document.createElement("a");
logsLink.href = `/logs/chap-core-${versionName}/`;
logsLink.target = "_blank";
logsLink.rel = "noopener noreferrer";
logsLink.textContent = "view logs";
logsTd.appendChild(logsLink);
tr.appendChild(logsTd);
// Status
const statusTd = document.createElement("td");
statusTd.className = "status-cell";
const statusDot = document.createElement("span");
statusDot.className = "status-dot";
statusDot.title = "Unknown / error";
statusTd.appendChild(statusDot);
tr.appendChild(statusTd);
// Fetch health
fetch(`/${versionName}/health`)
.then((response) => {
if (response.ok) {
statusDot.classList.add("ok");
statusDot.title = "OK (200)";
} else {
statusDot.classList.remove("ok");
statusDot.title = `Error (${response.status})`;
}
return response.ok ? response.json() : null;
})
.then((data) => {
if (data && typeof data.chap_core_version === "string") {
versionTd.textContent = data.chap_core_version;
} else {
versionTd.textContent = "";
}
})
.catch(() => {
statusDot.classList.remove("ok");
statusDot.title = "Error fetching health";
versionTd.textContent = "";
});
return tr;
}
versions.forEach((entry) => {
tbody.appendChild(createRow(entry));
});
</script>
<!-- Combined content ends here -->
</div>
</body>
</html>