Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: appengine/isolate/templates/browse.html

Issue 1866753008: Add ability to linkify hashes on isolate server (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Fix content Noneness Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/isolate/model.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/isolate/templates/browse.html
diff --git a/appengine/isolate/templates/browse.html b/appengine/isolate/templates/browse.html
index b79202d9f283c646d6032d1a8b337f48372a1dc3..060869c17f8b1668ae2d355e3733e029c8e048dc 100644
--- a/appengine/isolate/templates/browse.html
+++ b/appengine/isolate/templates/browse.html
@@ -5,7 +5,7 @@
{% block headers %}
<style>
html, body {
- height: 100%;
+ height: 95%;
margin: 0;
width: 100%;
}
@@ -21,107 +21,15 @@
}
iframe.use_all_space {
margin: 0;
+ min-height: 80%;
overflow-y: hidden;
padding: 0;
width: 100%;
}
</style>
-
-{#
-TODO(maruel): Reenable once Web UI authentication is switched to OAuth2.
-<script type="text/javascript" src="third_party/pako/pako-0.2.3.min.js">
-</script>
-<script>
- if (typeof String.prototype.endsWith !== 'function') {
- String.prototype.endsWith = function(suffix) {
- return this.indexOf(suffix, this.length - suffix.length) !== -1;
- };
- }
-
- // Fetch the content, uncompress it if necessary, then write it to the iframe.
- function update() {
- var digest = encodeURIComponent(document.getElementById('digest').value);
- var namespace = encodeURIComponent(
- document.getElementById('namespace').value);
- var url = '/_ah/api/isolateservice/v1/retrieve';
- fetch(url, namespace, digest);
- // TODO(maruel): Add back once endpoint API is rewritten.
- //document.getElementById('generated_link').innerHTML = (
- // '<a href="' + url + '">Link to ' + digest + '</a>');
- }
-
- function ab2str(buf) {
- return String.fromCharCode.apply(null, new Uint8Array(buf));
- }
-
- function fetch(url, namespace, digest) {
- var xhr = new XMLHttpRequest();
- // TODO(maruel): Change back to a HTTP GET once endpoint API is rewritten.
- xhr.open('POST', url, true);
- xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
- var oauthToken = gapi.auth.getToken();
- xhr.setRequestHeader('Authorization', 'Bearer ' + oauthToken.access_token);
- xhr.responseType = 'arraybuffer';
- xhr.onload = function(e) {
- if (this.status == 200) {
- post_process_async(
- namespace, new Uint8Array(this.response), write_to_iframe);
- } else {
- alert(ab2str(this.response));
- }
- };
- xhr.send(JSON.stringify({namespace: {namespace:namespace}, digest: digest}));
- }
-
- function decompress_to_string_async(data, callback) {
- var bytes = pako.inflate(new Uint8Array(data));
- var bb = new Blob([bytes]);
- var f = new FileReader();
- f.onload = function(e) {
- callback(e.target.result);
- };
- f.readAsText(bb);
- }
-
- function post_process_async(namespace, data, callback) {
- // Note that -gzip is a misnomer, it's actually -deflate.
- if (namespace.endsWith('-gzip') || namespace.endsWith('-deflate')) {
- decompress_to_string_async(data, function(x) {
- // Now act as if the namespace was the default uncompressed one so
- // further processing can be done.
- post_process_async('default', x, callback);
- });
- return;
- }
- if (data[0] == 'P' && data[1] == 'K') {
- // TODO(maruel): Implement PKzip decoding to be able to list files?
- callback("Found a .zip file (" + data.length + " bytes)");
- return;
- }
- if (data[0] == '{') {
- // Assume a json file, pretty-print it.
- // TODO(maruel): Convert .isolated files to browsable file.
- // TODO(maruel): Catch exception and print data as-is in that case.
- var pretty = JSON.stringify(JSON.parse(data), null, 2);
- callback(pretty);
- return;
- }
- // Fallback.
- callback(data);
- }
-
- function write_to_iframe(data) {
- var ifrm = document.getElementById('content').contentDocument;
- ifrm.open();
- ifrm.write('<html><body><pre>' + data + '</pre></body></html>');
- ifrm.close();
- }
-</script>
-#}
{% endblock %}
-
{% block body %}
<h1>File browser</h1>
@@ -133,10 +41,9 @@ Enter the namespace and digest of an object:<br>
<br>
<input type=submit value="Load item"/><br>
</form>
-<p>
-<div id="generated_link"> </div>
-<p>
<hr>
-<div class="use_all_space monospace">{{content}}{# <iframe id="content" class="use_all_space" sandbox="allow-same-origin"></iframe>#}</div>
+<div id="iframe-entry"></div>
+<iframe id="content" class="use_all_space" sandbox="allow-same-origin allow-popups" src="/content?namespace={{namespace}}&digest={{digest}}">
+</iframe>
{% endblock %}
« no previous file with comments | « appengine/isolate/model.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698