Skip to content

Commit d0fd55d

Browse files
authored
Fixes after theme update (#279)
1 parent 7ad177c commit d0fd55d

File tree

3 files changed

+77
-68
lines changed

3 files changed

+77
-68
lines changed

doc/_static/status.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// in sync with list in status.rst
2+
// fixme: can this come from one source?
3+
var fedUrls = [
4+
"https://gke.mybinder.org",
5+
"https://ovh.mybinder.org",
6+
"https://notebooks.gesis.org/binder",
7+
];
8+
9+
// Use a dictionary to store the rows that should be updated
10+
var urlRows = {};
11+
fedUrls.forEach((url) => {
12+
document.querySelectorAll("tr").forEach((tr) => {
13+
if (tr.textContent.includes(url.replace("https://", ""))) {
14+
urlRows[url] = tr;
15+
}
16+
});
17+
});
18+
19+
fedUrls.forEach(async (url) => {
20+
var urlHealth = url + "/health";
21+
var urlPrefix = url.split("//")[1].split(".")[0];
22+
23+
// Query the endpoint and update health icon
24+
var row = urlRows[url];
25+
let [
26+
fieldUrl,
27+
fieldResponse,
28+
fieldRegistry,
29+
fieldHub,
30+
fieldPods,
31+
fieldQuota,
32+
] = row.querySelectorAll("td");
33+
try {
34+
let response = await fetch(urlHealth);
35+
let resp = await response.json();
36+
if (resp["ok"] == false) {
37+
setStatus(fieldResponse, "fail");
38+
} else {
39+
setStatus(fieldResponse, "success");
40+
}
41+
42+
let [respReg, respHub, respQuota] = resp["checks"];
43+
44+
if (respReg == false) {
45+
setStatus(fieldRegistry, "fail");
46+
} else {
47+
setStatus(fieldRegistry, "success");
48+
}
49+
50+
if (respHub == false) {
51+
setStatus(fieldHub, "fail");
52+
} else {
53+
setStatus(fieldHub, "success");
54+
}
55+
56+
fieldPods.textContent = `${respQuota["user_pods"]}/${respQuota["build_pods"]}`;
57+
fieldQuota.textContent = `${respQuota["quota"]}`;
58+
} catch (e) {
59+
setStatus(fieldResponse, "fail");
60+
}
61+
});
62+
63+
var setStatus = (td, kind) => {
64+
if (kind == "success") {
65+
td.textContent = "Success";
66+
td.style.color = "green";
67+
} else {
68+
td.textContent = "Fail";
69+
td.style.color = "red";
70+
}
71+
};

doc/about/status.rst

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -20,81 +20,19 @@ federation, along with the status of each. For more information about
2020
the BinderHub federation, who is in it, how to join it, etc, see
2121
`the mybinder federation page <https://mybinder.readthedocs.io/en/latest/about/federation.html>`_.
2222

23+
.. update fedUrls in _status/status.js
24+
2325
========================== ======== =============== ============== =============== =====
2426
URL Response Docker registry JupyterHub API User/Build Pods Quota
2527
========================== ======== =============== ============== =============== =====
2628
gke.mybinder.org
2729
ovh.mybinder.org
28-
notebooks.gesis.org
30+
notebooks.gesis.org/binder
2931
========================== ======== =============== ============== =============== =====
3032

3133
.. raw:: html
3234

33-
<script>
34-
var fedUrls = [
35-
"https://gke.mybinder.org",
36-
"https://ovh.mybinder.org",
37-
"https://notebooks.gesis.org/binder",
38-
]
39-
40-
// Use a dictionary to store the rows that should be updated
41-
var urlRows = {};
42-
fedUrls.forEach((url) => {
43-
document.querySelectorAll('tr').forEach((tr) => {
44-
if (tr.textContent.includes(url.replace('https://', ''))) {
45-
urlRows[url] = tr;
46-
};
47-
});
48-
});
49-
50-
fedUrls.forEach((url) => {
51-
var urlHealth = url + '/health'
52-
var urlPrefix = url.split('//')[1].split('.')[0]
53-
54-
// Query the endpoint and update health icon
55-
var row = urlRows[url];
56-
let [fieldUrl, fieldResponse, fieldRegistry, fieldHub, fieldPods, fieldQuota] = row.querySelectorAll('td')
57-
$.getJSON(urlHealth, {})
58-
.done((resp) => {
59-
if (resp['ok'] == false) {
60-
setStatus(fieldResponse, 'fail')
61-
} else {
62-
setStatus(fieldResponse, 'success')
63-
}
64-
65-
let [respReg, respHub, respQuota] = resp['checks']
66-
67-
if (respReg == false) {
68-
setStatus(fieldRegistry, 'fail')
69-
} else {
70-
setStatus(fieldRegistry, 'success')
71-
}
72-
73-
if (respHub == false) {
74-
setStatus(fieldHub, 'fail')
75-
} else {
76-
setStatus(fieldHub, 'success')
77-
}
78-
79-
fieldPods.textContent = `${respQuota['user_pods']}/${respQuota['build_pods']}`
80-
fieldQuota.textContent = `${respQuota['quota']}`
81-
})
82-
.fail((resp) => {
83-
setStatus(fieldResponse, 'fail')
84-
});
85-
})
86-
87-
var setStatus = (td, kind) => {
88-
if (kind == "success") {
89-
td.textContent = "Success";
90-
td.style.color = "green";
91-
} else {
92-
td.textContent = "Fail";
93-
td.style.color = "red";
94-
}
95-
}
96-
97-
</script>
35+
<script src="../_static/status.js" type="text/javascript"/>
9836
9937
10038
Running Binder sessions

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
"navbar_align": "left",
7676
"navbar_end": ["theme-switcher", "navbar-icon-links", "support-button"],
7777
"logo": {
78-
"image_light": "images/logo.png",
79-
"image_dark": "images/logo-dark.png",
78+
"image_light": "_static/images/logo.png",
79+
"image_dark": "_static/images/logo-dark.png",
8080
},
8181
}
8282

0 commit comments

Comments
 (0)