-
Notifications
You must be signed in to change notification settings - Fork 23
/
status.html
181 lines (167 loc) · 5.95 KB
/
status.html
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
---
title: Deployment status
layout: page
no_edit_link: true
---
<div class="container">
<div class="status">
<h1>Current versions</h1>
<table>
<thead>
<tr>
<th>Kind</th>
<th>Version name</th>
<th>Version code</th>
<th><span title="Estimation based on recent status requests">Users online (estimated)</span></th>
<th>% (estimated)</th>
</tr>
</thead>
<tbody id="versions-body"></tbody>
<tfoot>
<tr>
<td>Total</td>
<td></td>
<td></td>
<td id="versions-total">0</td>
<td></td>
</tr>
</tfoot>
</table>
<div id="message-div">
<h1>Current message</h1>
<table>
<thead>
<tr><th>Message</th><th>Message id</th><th>Icon</th><th>URL</th><th>Condition</th></tr>
</thead>
<tbody>
<tr>
<td id="message-text"></td>
<td id="message-id"></td>
<td id="message-icon"></td>
<td id="message-link"></td>
<td id="message-condition"></td>
</tr>
</tbody>
</table>
</div>
<div>
<h1>Older versions and source code</h1>
Former releases of c:geo and their source code can be found on <a href="https://github.com/cgeo/cgeo/releases" target="_top">c:geo GitHub release page</a>.
</div>
<div id="gc-div">
<h1>GC membership information</h1>
Premium membership user ratio: <span id="gc-premium">unknown</span>.
</div>
<div id="connectors-div">
<h1>Connectors information</h1>
<table>
<thead>
<tr>
<th>Connector</th>
<th># Users</th>
<th>% Users</th>
</tr>
</thead>
<tbody id="connectors-body"></tbody>
<tfoot>
<tr>
<td>Total</td>
<td id="connectors-total">0</td>
<td></td>
</tr>
</tfoot>
</table>
</div>
<script type="text/javascript">
function updateVersions() {
$.getJSON( "https://status.cgeo.org/api/count/by-kind",
function(versions) {
var total = 0;
versions.map(function(v) { total += v.count; });
var items = [];
versions.map(function(v) {
var line = [];
if (v.url)
line.push('<td><a href="' + v.url + '">' + v.name + '</a></td>');
else
line.push("<td>" + v.name + "</td>");
line.push("<td>" + (v.versionName || "") + "</td>");
line.push("<td>" + (v.versionCode || "") + "</td>");
line.push("<td>" + v.count + "</td>");
line.push("<td>" + ((100 * v.count / total).toFixed(1)) + "%</td>");
items.push("<tr>" + line.join("") + "</tr>");
});
$("#versions-body").html(items.join("\n"));
$("#versions-total").text(total);
});
window.setTimeout(updateVersions, 30000);
}
function updateMessage() {
$.getJSON("https://status.cgeo.org/api/message", function(data) {
var msg = data.message;
if (msg) {
$("#message-text").text(msg.message);
$("#message-id").text(msg.message_id ? msg.message_id : "");
if (msg.icon) {
var url = "https://status.cgeo.org/assets/icons/" + msg.icon + ".png";
$("#message-icon").html('<img src="' + url + '"/>');
} else
$("#message-icon").text("");
$("#message-link").html(msg.url ? '<a href="' + msg.url + '">Link</a>' : "");
$("#message-condition").text(msg.condition ? msg.condition : "");
$("#message-div").show();
} else {
$("#message-div").hide();
}
});
window.setTimeout(updateMessage, 30000);
};
function updateGCMembership() {
$.getJSON("https://status.cgeo.org/api/count/by-gc-membership",
function(data) {
var total = data["basic"] + data["premium"];
if (total == 0) {
$("#gc-div").hide();
$("#gc-premium").text("unknown");
} else {
var ratio = Math.round(1000 * data["premium"] / total) / 10;
$("#gc-premium").text(ratio + "% (out of " + total + " users)");
$("#gc-div").show();
}
});
window.setTimeout(updateGCMembership, 30000);
};
function updateConnectorsStat() {
$.getJSON("https://status.cgeo.org/api/count/by-connector",
function(data) {
var items = [];
var total = data["_withinfo"] + data["_noinfo"];
// Sort data by amount of users
var sortedData = Object.keys(data).map(function(key) {
return [key, data[key]];
});
sortedData.sort(function(first, second) {
return second[1] - first[1];
});
for (var [key, value] of sortedData) {
if (key.startsWith("_")) {
continue;
}
var line = [];
line.push("<td>" + (key || "(empty)") + "</td>");
line.push("<td>" + (value || "") + "</td>");
line.push("<td>" + ((100 * value / total).toFixed(1)) + "%</td>");
items.push("<tr>" + line.join("") + "</tr>");
}
$("#connectors-body").html(items.join("\n"));
$("#connectors-total").text(total);
});
window.setTimeout(updateConnectorsStat, 30000);
}
updateVersions();
updateMessage();
updateGCMembership();
updateConnectorsStat();
</script>
</div>
</div>