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

Side by Side Diff: appengine/findit/templates/crash/crash_config.html

Issue 1852383002: [Findit] Integrate with Fracas through Pub/Sub. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <head>
3 <meta charset="utf-8">
4 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></sc ript>
mimee 2016/04/07 23:43:09 This might just be a sample internal page, but jqu
stgao 2016/04/08 01:14:08 We prefer jquery over native javascript functions
mimee 2016/04/08 15:36:03 The alternative is to put script on bottom because
stgao 2016/04/11 20:32:19 Ah, I see. But if we move all scripts to the end o
5 <link rel="stylesheet" href="/common.css"></link>
6 <title>Crash Configuration</title>
7 <script>
8 var crash = {};
9 crash.fracas = {{ fracas | tojson | safe }};
10
11 function getJsonOfTextarea(textId) {
12 return JSON.parse($('#' + textId).val());
13 }
14
15 function getStringFromJson(json) {
16 return JSON.stringify(json, null, ' ');
17 }
18
19 function save(e) {
20 var newConfig = {
21 'fracas': getJsonOfTextarea('fracas'),
22 };
23 $.post('/crash/config', { data: JSON.stringify(newConfig) }).done(function () {
24 window.location.reload(); // Reload after successful saving.
25 }).fail(function(xhr) {
26 // Replace the whole page with errors from server side.
27 document.body.outerHTML = xhr.responseText;
28 });
29 e.preventDefault();
30 }
31
32 $(document).ready(function() {
33 $('#save-button').click(save);
34 $('#fracas').val(getStringFromJson(crash.fracas));
35 });
36 </script>
37 </head>
38 <body>
39 <h3>Crash Configuration</h3>
40 <div>
41 Settings for Fracas:<br>
42 <textarea id="fracas" rows="20" cols="80"></textarea>
43 </div>
44 <button type="submit" id="save-button">Save</button>
45 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698