Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <head> |
| 3 <title>Fracas result feedback</title> | 3 <title>Fracas result feedback</title> |
| 4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
| 5 <link rel="stylesheet" href="/common.css"> | 5 <link rel="stylesheet" href="/common.css"> |
| 6 <style> | 6 <style> |
| 7 .error { | 7 .error { |
| 8 color: #ffffff; | 8 color: #ffffff; |
| 9 background-color: #e98080; | 9 background-color: #e98080; |
| 10 border-color: #a77272; | 10 border-color: #a77272; |
| 11 } | 11 } |
| 12 .triage-area { | |
| 13 border-radius: 7px; | |
| 14 display: inline-block; | |
| 15 } | |
| 16 .triage, .triaged { | |
| 17 display: block; | |
| 18 float: left; | |
| 19 vertical-align: middle; | |
| 20 } | |
|
stgao
2016/06/30 17:16:40
How about putting these to the common.css as they
Sharu Jiang
2016/07/01 22:05:49
Done.
| |
| 21 .triage { | |
| 22 background-color: #e5e5e5; | |
| 23 cursor: pointer; | |
| 24 } | |
| 25 .triaged { | |
| 26 cursor: default; | |
| 27 } | |
| 28 .correct { | |
| 29 border-top: solid 1px; | |
| 30 border-bottom: solid 1px; | |
| 31 border-left: solid 1px; | |
| 32 border-top-left-radius: 7px; | |
| 33 border-bottom-left-radius: 7px; | |
| 34 padding-left: 10px; | |
| 35 padding-right: 10px; | |
| 36 margin: auto; | |
| 37 } | |
| 38 .incorrect { | |
| 39 border: solid 1px; | |
| 40 padding-left: 10px; | |
| 41 padding-right: 10px; | |
| 42 } | |
| 43 .unsure { | |
| 44 border-top: solid 1px; | |
| 45 border-bottom: solid 1px; | |
| 46 border-right: solid 1px; | |
| 47 border-top-right-radius: 7px; | |
| 48 border-bottom-right-radius: 7px; | |
| 49 padding-left: 10px; | |
| 50 padding-right: 14px; | |
| 51 } | |
| 52 .correct:hover, .correct.triaged { | |
| 53 background-color: #8fdf5f; | |
| 54 } | |
| 55 .incorrect:hover, .incorrect.triaged { | |
| 56 background-color: #e98080; | |
| 57 } | |
| 58 .unsure:hover, .unsure.triaged { | |
| 59 background-color: #FFD700; | |
| 60 } | |
| 61 .not-display, .hidden-row { | |
| 62 display: none; | |
| 63 } | |
| 12 </style> | 64 </style> |
| 13 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js "></script> | 65 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js "></script> |
| 14 <script> | 66 <script> |
| 67 var analysis_completed = '{{analysis_completed}}' == 'True'; | |
| 68 var analysis_failed = '{{analysis_failed}}' == 'True'; | |
| 69 var analysis_correct = {{analysis_correct | tojson | safe}}; | |
| 70 var regression_range = {{regression_range | tojson | safe}}; | |
| 71 var suspected_cls = {{suspected_cls | tojson | safe}}; | |
| 72 var suspected_project = '{{suspected_project}}' | |
|
stgao
2016/06/30 17:16:40
style nit: no ending ";".
Sharu Jiang
2016/07/01 22:05:49
Done.
| |
| 73 var suspected_components = {{suspected_components | tojson | safe}}; | |
| 74 var culprit_regression_range = {{culprit_regression_range | tojson | safe}}; | |
| 75 var culprit_cls = {{culprit_cls | tojson | safe}}; | |
| 76 | |
| 77 for (i = 0; i < culprit_cls.length; i++) { | |
| 78 culprit_cls[i] = culprit_cls[i]['url']; | |
|
stgao
2016/06/30 17:16:40
Why this is needed?
Sharu Jiang
2016/07/01 22:05:49
culprit_cls has a lot of information, like 'author
| |
| 79 } | |
| 80 | |
| 81 var culprit_project = '{{culprit_project}}'; | |
| 82 var culprit_components = {{culprit_components | tojson | safe}}; | |
| 83 var note = '{{note}}'; | |
| 84 | |
| 85 | |
| 15 function createUrl(base_url, parameters) { | 86 function createUrl(base_url, parameters) { |
| 16 var params = []; | 87 var params = []; |
| 17 for(var key in parameters) { | 88 for(var key in parameters) { |
| 18 if (parameters[key] != undefined) { | 89 if (parameters[key] != undefined) { |
| 19 params.push(key + '=' + parameters[key]); | 90 params.push(key + '=' + parameters[key]); |
| 20 } | 91 } |
| 21 } | 92 } |
| 22 | 93 |
| 23 if (params.length == 0) { | 94 if (params.length == 0) { |
| 24 return base_url; | 95 return base_url; |
| 25 } else { | 96 } else { |
| 26 return base_url + '?' + params.join('&'); | 97 return base_url + '?' + params.join('&'); |
| 27 } | 98 } |
| 28 } | 99 } |
| 29 | 100 |
| 101 | |
| 30 function constructMonorailUrl() { | 102 function constructMonorailUrl() { |
| 31 var parameters = {}; | 103 var parameters = {}; |
| 32 parameters.status = 'Unconfirmed'; | 104 parameters.status = 'Unconfirmed'; |
| 33 parameters.labels = 'Pri-2,Restrict-View-Google'; | 105 parameters.labels = 'Pri-2,Restrict-View-Google'; |
| 34 parameters.components = 'Tools>Test>Findit'; | 106 parameters.components = 'Tools>Test>Findit'; |
| 35 parameters.summary = encodeURIComponent('[Findit] Findit bug or feature'); | 107 parameters.summary = encodeURIComponent('[Findit] Findit bug or feature'); |
| 36 parameters.comment = encodeURIComponent( | 108 parameters.comment = encodeURIComponent( |
| 37 'Signature: {{signature}}\nVersion: {{version}}\n' + | 109 'Signature: {{signature}}\nVersion: {{version}}\n' + |
| 38 'Channel: {{channel}}\nPlatform: {{platform}}\n\n' + | 110 'Channel: {{channel}}\nPlatform: {{platform}}\n\n' + |
| 39 'Findit result: ' + window.location.href + | 111 'Findit result: ' + window.location.href + |
| 40 '\n\nWhat is the bug or feature?'); | 112 '\n\nWhat is the bug or feature?'); |
| 41 return createUrl('https://code.google.com/p/chromium/issues/entry', | 113 return createUrl('https://code.google.com/p/chromium/issues/entry', |
| 42 parameters); | 114 parameters); |
| 43 } | 115 } |
| 44 | 116 |
| 117 | |
| 118 function getCulpritPropertyNameForResult(result) { | |
| 119 if (result.match('^suspected')) | |
| 120 return result.replace('suspected', 'culprit'); | |
| 121 | |
| 122 return 'culprit_' + result; | |
| 123 } | |
| 124 | |
| 125 | |
| 126 function triageAnalysisResult(e) { | |
| 127 var target = $(this); | |
| 128 if (target.hasClass('triaged')) | |
| 129 return; | |
| 130 | |
| 131 var new_analysis = {}; | |
| 132 var update = {}; | |
| 133 var result = target.attr('result_property'); | |
| 134 var culprit_result = getCulpritPropertyNameForResult(result) | |
| 135 if (target.hasClass('incorrect')) { | |
| 136 var triage_status = 1; | |
| 137 } else if (target.hasClass('correct')) { | |
| 138 var triage_status = 2; | |
| 139 update[culprit_result] = window[result]; | |
| 140 } else if (target.hasClass('unsure')) { | |
| 141 var triage_status = 3; | |
| 142 } | |
| 143 update[result + '_triage_status'] = triage_status; | |
| 144 | |
| 145 $.getJSON('triage-fracas-analysis?key={{key}}&update=' + encodeURIComponen t(JSON.stringify(update)), function(data) { | |
| 146 if (data['success']) { | |
| 147 $(".triaged[result_property='" + result + "']").addClass('triage').rem oveClass('triaged'); | |
|
stgao
2016/06/30 17:16:40
style: use single quote ['] in JS code, but double
Sharu Jiang
2016/07/01 22:05:49
Done.
| |
| 148 target.addClass('triaged').removeClass('triage'); | |
| 149 if (triage_status == 2) { | |
| 150 $("form[result_property='" + result + "']").addClass('not-display'); | |
| 151 $('#' + culprit_result).val(update[culprit_result]); | |
| 152 } else { | |
| 153 $("form.not-display[result_property='" + result + "']").removeClass( 'not-display'); | |
| 154 } | |
| 155 } else { | |
| 156 alert('Failed to update datastore. Please refresh and try again.'); | |
|
stgao
2016/06/30 17:16:40
nit: it is unnecessary to mention datastore here.
Sharu Jiang
2016/07/01 22:05:49
Done.
| |
| 157 } | |
| 158 }).error(function(xhr) { | |
| 159 // Replace the whole page with errors from server side. | |
| 160 document.body.outerHTML = xhr.responseText; | |
| 161 }); | |
| 162 e.preventDefault(); | |
| 163 } | |
| 164 | |
| 165 | |
| 166 function saveCulprits(e) { | |
| 167 e.preventDefault(); | |
| 168 var update = {}; | |
| 169 var properties = ['culprit_regression_range', 'culprit_cls', 'culprit_proj ect', 'culprit_components', 'note'] | |
| 170 for (var i in properties) { | |
| 171 var value = $('#' + properties[i]).val() | |
| 172 if (value) { | |
| 173 update[properties[i]] = value; | |
| 174 } | |
| 175 } | |
| 176 $.getJSON('triage-fracas-analysis?key={{key}}&update=' + encodeURIComponen t(JSON.stringify(update)), function(data) { | |
| 177 if (!data['success']) { | |
| 178 alert('Failed to update datastore. Please refresh and try again.'); | |
| 179 } | |
| 180 }).error(function(xhr) { | |
| 181 // Replace the whole page with errors from server side. | |
| 182 document.body.outerHTML = xhr.responseText; | |
| 183 }); | |
| 184 } | |
| 185 | |
| 186 | |
| 45 $(document).ready(function() { | 187 $(document).ready(function() { |
| 46 $('#monorail-bug').attr('href', constructMonorailUrl()); | 188 $('#monorail-bug').attr('href', constructMonorailUrl()); |
| 189 $('.triage').click(triageAnalysisResult); | |
| 190 $.each(analysis_correct, function(result, triage_status) { | |
| 191 if (triage_status == 1) { | |
| 192 $(".incorrect[result_property='" + result + "']").addClass('triaged'). removeClass('triage'); | |
| 193 $("form.not-display[result_property='" + result + "']").removeClass('n ot-display'); | |
|
stgao
2016/06/30 17:16:40
Just an idea: can we use element id instead?
Sharu Jiang
2016/07/01 22:05:49
Done.
| |
| 194 } else if (triage_status == 2) { | |
| 195 $(".correct[result_property='" + result + "']").addClass('triaged').re moveClass('triage'); | |
| 196 $("form[result_property='" + result + "']").addClass('not-display'); | |
| 197 } else if (triage_status == 3) { | |
| 198 $(".unsure[result_property='" + result + "']").addClass('triaged').rem oveClass('triage'); | |
| 199 $("form.not-display[result_property='" + result + "']").removeClass('n ot-display'); | |
| 200 } | |
| 201 }); | |
| 202 $('#culprit_regression_range').val(culprit_regression_range); | |
| 203 $('#culprit_cls').val(culprit_cls); | |
| 204 $('#culprit_project').val(culprit_project); | |
| 205 $('#culprit_components').val(culprit_components); | |
| 206 $('#note').val(note); | |
| 207 $('#save-button').click(saveCulprits); | |
| 47 }) | 208 }) |
| 48 </script> | 209 </script> |
| 49 </head> | 210 </head> |
| 50 <body> | 211 <body> |
| 51 <div> | 212 <div> |
| 52 <b>Crash:</b> (<a href="#" id='monorail-bug'>File a Findit bug</a>) | 213 <b>Crash:</b> (<a href="#" id='monorail-bug'>File a Findit bug</a>) |
| 53 <br> | 214 <br> |
| 54 Signature: {{signature}}<br> | 215 Signature: {{signature}}<br> |
| 55 Version: <a href="https://chromium.googlesource.com/chromium/src.git/+/{{ver sion}}">{{version}}</a><br> | 216 Version: <a href="https://chromium.googlesource.com/chromium/src.git/+/{{ver sion}}">{{version}}</a><br> |
| 56 Channel: {{channel}}<br> | 217 Channel: {{channel}}<br> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 260 |
| 100 <div> | 261 <div> |
| 101 <br> | 262 <br> |
| 102 <b> Regression range: </b> | 263 <b> Regression range: </b> |
| 103 {% if regression_range %} | 264 {% if regression_range %} |
| 104 <a href="https://chromium.googlesource.com/chromium/src/+log/{{regression_ range[0]}}..{{regression_range[1]}}?pretty=fuller">{{regression_range[0]}} : {{r egression_range[1]}}</a> | 265 <a href="https://chromium.googlesource.com/chromium/src/+log/{{regression_ range[0]}}..{{regression_range[1]}}?pretty=fuller">{{regression_range[0]}} : {{r egression_range[1]}}</a> |
| 105 {% else %} | 266 {% else %} |
| 106 Not found | 267 Not found |
| 107 {% endif %} | 268 {% endif %} |
| 108 <br> | 269 <br> |
| 270 <div class="triage-area"> | |
| 271 <div class="triage correct" result_property="regression_range">Correct<img src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_satisfie d_black_24dp.png"/></div> | |
|
stgao
2016/06/30 17:16:40
I like the icon.
Sharu Jiang
2016/07/01 22:05:49
Thanks :)
| |
| 272 <div class="triage incorrect" result_property="regression_range">Incorrect <img src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_diss atisfied_black_24dp.png"/></div> | |
| 273 <div class="triage unsure" result_property="regression_range">Unsure<img s rc="https://www.gstatic.com/images/icons/material/system/1x/sentiment_neutral_bl ack_24dp.png"/></div> | |
| 274 <form class="not-display" result_property="regression_range"> | |
|
stgao
2016/06/30 17:16:40
Why a form is needed? This form is not used to sub
Sharu Jiang
2016/07/01 22:05:49
Done.
| |
| 275 <br><br>Culprit regression range: (e.g. 53.0.2749.0, 53.0.2750.0)<br> | |
| 276 <textarea id="culprit_regression_range" size="30" rows="1" cols="30"></t extarea> | |
| 277 </form> | |
| 278 </div> | |
| 109 <div> | 279 <div> |
| 110 | 280 |
| 111 <div> | 281 <div> |
| 112 <br><br> | |
| 113 {% if analysis_completed %} | 282 {% if analysis_completed %} |
| 283 <br><br> | |
| 114 {% if analysis_failed %} | 284 {% if analysis_failed %} |
| 115 <span class="error">No result because of some error in analysis!</span> | 285 <span class="error">No result because of some error in analysis!</span> |
| 116 {% else %} | 286 {% else %} |
| 117 <b> Suspected cls: </b> | 287 <b> Suspected cls: </b> |
| 118 {% if suspected_cls %} | 288 {% if suspected_cls %} |
| 119 <table id="suspected_cls_table"> | 289 <table id="suspected_cls_table"> |
| 120 <tr> | 290 <tr> |
| 121 <th>Suspected cls</th> | 291 <th>Suspected cls</th> |
| 122 <th>Score</th> | 292 <th>Score</th> |
| 123 <th>Reason</th> | 293 <th>Reason</th> |
| 124 </tr> | 294 </tr> |
| 125 <tbody> | 295 <tbody> |
| 126 {% for suspected_cl in suspected_cls %} | 296 {% for suspected_cl in suspected_cls %} |
| 127 <tr> | 297 <tr> |
| 128 <td align="center"> <a href={{suspected_cl.url}}>{{suspected_cl. revision}}</a> </td> | 298 <td align="center"> <a href={{suspected_cl.url}}>{{suspected_cl. revision}}</a> </td> |
| 129 <td align="center"> {{suspected_cl.confidence}} </td> | 299 <td align="center"> {{suspected_cl.confidence}} </td> |
| 130 <td align="left"><pre>{{suspected_cl.reason}}</pre></td> | 300 <td align="left"><pre>{{suspected_cl.reason}}</pre></td> |
| 131 </tr> | 301 </tr> |
| 132 {% endfor %} | 302 {% endfor %} |
| 133 </tbody> | 303 </tbody> |
| 134 </table> | 304 </table> |
| 135 {% else %} | 305 {% else %} |
| 136 Not found <br> | 306 Not found <br> |
| 137 {% endif %} | 307 {% endif %} |
| 138 {% endif %} | 308 {% endif %} |
| 139 {% endif %} | 309 {% endif %} |
| 310 <div class="triage-area"> | |
| 311 <div class="triage correct" result_property="suspected_cls">Correct<img sr c="https://www.gstatic.com/images/icons/material/system/1x/sentiment_satisfied_b lack_24dp.png"/></div> | |
| 312 <div class="triage incorrect" result_property="suspected_cls">Incorrect<im g src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_dissati sfied_black_24dp.png"/></div> | |
| 313 <div class="triage unsure" result_property="suspected_cls">Unsure<img src= "https://www.gstatic.com/images/icons/material/system/1x/sentiment_neutral_black _24dp.png"/></div> | |
| 314 <form class="not-display" result_property="suspected_cls"> | |
| 315 <br><br>Culprit suspected cls: (e.g. https://chromium.googlesource.com/ chromium/src/+/346a46f9cc4151e989b961d2d0429d16aeb49c14)<br> | |
| 316 <textarea id="culprit_cls" size="30" rows="1" cols="100"></textarea> | |
| 317 </form> | |
| 318 </div> | |
| 140 </div> | 319 </div> |
| 141 | 320 |
| 142 <div> | 321 <div> |
| 143 <br><br> | 322 <br><br> |
| 144 <b> Suspected project: </b> | 323 <b> Suspected project: </b> |
| 145 {% if suspected_project %} | 324 {% if suspected_project %} |
| 146 {{suspected_project}} | 325 {{suspected_project}} |
| 147 {% else %} | 326 {% else %} |
| 148 Not found | 327 Not found |
| 149 {% endif %} | 328 {% endif %} |
| 150 <br> | 329 <br> |
| 330 <div class="triage-area"> | |
| 331 <div class="triage correct" result_property="suspected_project">Correct<im g src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_satisfi ed_black_24dp.png"/></div> | |
| 332 <div class="triage incorrect" result_property="suspected_project">Incorrec t<img src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_dis satisfied_black_24dp.png"/></div> | |
| 333 <div class="triage unsure" result_property="suspected_project">Unsure<img src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_neutral_b lack_24dp.png"/></div> | |
| 334 <form class="not-display" result_property="suspected_project"> | |
| 335 <br><br>Culprit project: (e.g. chromium)<br> | |
| 336 <textarea id="culprit_project" size="30" rows="1"></textarea> | |
| 337 </form> | |
| 338 </div> | |
| 151 </div> | 339 </div> |
| 152 | 340 |
| 153 <div> | 341 <div> |
| 154 <br><br> | 342 <br><br> |
| 155 <b> Suspected components:</b> | 343 <b> Suspected components:</b> |
| 156 {% if suspected_components %} | 344 {% if suspected_components %} |
| 157 <br> | 345 <br> |
| 158 {% for component in suspected_components %} | 346 {% for component in suspected_components %} |
| 159 <li> | 347 <li> |
| 160 {{component}} | 348 {{component}} |
| 161 </li> | 349 </li> |
| 162 {% endfor %} | 350 {% endfor %} |
| 163 {% else %} | 351 {% else %} |
| 164 Not found <br> | 352 Not found <br> |
| 165 {% endif %} | 353 {% endif %} |
| 354 <div class="triage-area"> | |
| 355 <div class="triage correct" result_property="suspected_components">Correct <img src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_sati sfied_black_24dp.png"/></div> | |
| 356 <div class="triage incorrect" result_property="suspected_components">Incor rect<img src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_ dissatisfied_black_24dp.png"/></div> | |
| 357 <div class="triage unsure" result_property="suspected_components">Unsure<i mg src="https://www.gstatic.com/images/icons/material/system/1x/sentiment_neutra l_black_24dp.png"/></div> | |
| 358 <form class="not-display" result_property="suspected_components"> | |
| 359 <br><br>Culprit components: (e.g. Blink>API, Blink>DOM)<br> | |
| 360 <textarea id="culprit_components" rows="1"></textarea> | |
| 361 </form> | |
| 362 </div> | |
| 166 </div> | 363 </div> |
| 167 | 364 |
| 365 <div> | |
| 366 <form> | |
| 367 <br><br> | |
| 368 <b>Note:<br></b> | |
| 369 <textarea id="note" rows="5" cols="80"></textarea> | |
| 370 <br> | |
| 371 </form> | |
| 372 </div> | |
| 373 | |
| 374 <button type="submit" id="save-button">Save</button> | |
| 375 | |
| 376 <div> | |
| 377 <br><br> | |
| 378 {% if triage_history %} | |
| 379 Triage history: | |
| 380 <table> | |
| 381 <tr><th>When</th><th>Who</th><th>Property</th><th>Result</th></tr> | |
| 382 <tbody> | |
| 383 {% for triage_record in triage_history %} | |
| 384 <tr> | |
| 385 <td>{{triage_record.triage_time}}</td> | |
| 386 <td>{{triage_record.user_name}}</td> | |
| 387 <td>{{triage_record.result_property}}</td> | |
| 388 <td>{{triage_record.triage_status}}</td> | |
| 389 </tr> | |
| 390 {% endfor %} | |
| 391 </tbody> | |
| 392 </table> | |
| 393 {% endif %} | |
| 394 <div> | |
| 395 | |
| 168 </body> | 396 </body> |
| OLD | NEW |