-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from jaimergp/open-gpu-server
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function loadOpenStatusJSON (url, callback) { | ||
var xobj = new XMLHttpRequest() | ||
xobj.overrideMimeType('application/json') | ||
xobj.open('GET', url, true) | ||
xobj.onreadystatechange = function () { | ||
if (xobj.readyState === 4 && xobj.status === 200) { | ||
// Required use of an anonymous callback as .open will NOT return a value | ||
// but simply returns undefined in asynchronous mode | ||
callback(xobj.responseText) | ||
} | ||
} | ||
xobj.send(null) | ||
} | ||
|
||
function displayOpenGPUServerStatus (reportText) { | ||
var report = JSON.parse(reportText) | ||
var div = document.getElementById('open-gpu-server-status') | ||
|
||
if (report.status === 'operational') { | ||
div.className = 'status operational' | ||
div.innerHTML = 'All Systems Operational' | ||
} else { | ||
div.className = 'status degraded performance' | ||
div.innerHTML = report.status | ||
} | ||
} | ||
|
||
var url = 'https://api.openstatus.dev/public/status/open-gpu-server' | ||
loadOpenStatusJSON(url, displayOpenGPUServerStatus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters