forked from knative/client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make productivity oncall schedule visible to community (knative#443)
* this is to create tools/infra oncall.html which will be accessible to OSS community. * Fix whitespaces * remove static mapping * remove static mapping
- Loading branch information
1 parent
bf7e4dd
commit 25878c0
Showing
1 changed file
with
61 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,61 @@ | ||
<!DOCTYPE html> | ||
<!-- To "deploy": gsutil cp -Z oncall.html gs://knative-infra-oncall/ --> | ||
<html> | ||
<script> | ||
// extracted/modified from kubernetes/test-infra/test-infra/maintenance/oncall.html | ||
function get(uri, callback) { | ||
if (uri[0] === '/') { | ||
// Matches /bucket/file/path -> [..., "bucket", "file/path"] | ||
var groups = uri.match(/([^/:]+)\/(.*)/); | ||
var bucket = groups[1], path = groups[2]; | ||
var url = 'https://www.googleapis.com/storage/v1/b/' + bucket + '/o/' + encodeURIComponent(path) + '?alt=media'; | ||
} else { | ||
var url = uri; | ||
} | ||
var req = new XMLHttpRequest(); | ||
req.open('GET', url); | ||
req.onload = function(resp) { | ||
callback(req); | ||
} | ||
req.send(); | ||
} | ||
|
||
function build_table(req) { | ||
var data = req.response; | ||
var oncall = JSON.parse(data).Oncall; | ||
var keys = Object.keys(oncall).sort(); | ||
|
||
var html = '' | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var person = oncall[key]; | ||
html += '<h2>' + key + ': '; | ||
//construct HTML content | ||
if (person) { | ||
html += '<a href="https://github.com/' + person + '">'; | ||
html += person + '<img src="https://github.com/' + person + '.png?size=125"></a>'; | ||
} else { | ||
html += 'None' | ||
} | ||
html += '</h2>'; | ||
} | ||
|
||
// trivial XSS, but storage.googleapis.com is even more trivial XSS! | ||
document.getElementById('oncall').innerHTML = html; | ||
document.getElementById('updated').innerText = req.getResponseHeader('date'); | ||
} | ||
|
||
get('oncall.json', build_table); | ||
</script> | ||
<title>Knative Tools/Infra Oncall Rotation</title> | ||
<style> | ||
body { background-color: #eee; padding-left: 30%; } | ||
img { padding-left: 10px; max-width: 125px; } | ||
</style> | ||
<body> | ||
<h1>Knative Tools/Infra Oncall Rotation</h1> | ||
<p>Updated: <span id="updated">Never</span></a> | ||
<div id="oncall">Loading...</div> | ||
<sub><a href="https://storage.googleapis.com/knative-infra-oncall/oncall.json">data source</a></sub> | ||
</body> | ||
</html> |