Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 var TaskLog = (function() { | |
| 6 'use strict'; | |
| 7 | |
| 8 var nextTaskLogSeq = 1; | |
| 9 var TaskLog = {}; | |
| 10 | |
| 11 function observeTaskLog() { | |
| 12 chrome.send('observeTaskLog'); | |
| 13 } | |
| 14 | |
| 15 /** | |
| 16 * Handles per-task log event. | |
| 17 * @param {Object} taskLog a dictionary containing 'duration', | |
| 18 * 'task_description', 'result_description' and 'details'. | |
| 19 */ | |
| 20 TaskLog.onTaskLogRecorded = function(taskLog) { | |
| 21 var itemContainer = $('task-log-entries'); | |
| 22 var tr = document.createElement('tr'); | |
| 23 tr.appendChild(createElementFromText( | |
|
peria
2014/06/02 02:37:16
Could you move these "tr.appendChild" lines to #45
tzik
2014/06/02 05:17:02
Done.
| |
| 24 'td', taskLog.duration, {'class': 'task-log-duration'})); | |
| 25 tr.appendChild(createElementFromText( | |
| 26 'td', taskLog.task_description, {'class': 'task-log-description'})); | |
| 27 tr.appendChild(createElementFromText( | |
| 28 'td', taskLog.result_description, {'class': 'task-log-result'})); | |
| 29 | |
| 30 var details = document.createElement('td'); | |
| 31 details.classList.add('task-log-details'); | |
| 32 | |
| 33 var label = document.createElement('label'); | |
| 34 details.appendChild(label); | |
| 35 | |
| 36 var collapseCheck = document.createElement('input'); | |
| 37 collapseCheck.setAttribute('type', 'checkbox'); | |
| 38 collapseCheck.classList.add('task-log-collapse-check'); | |
| 39 label.appendChild(collapseCheck); | |
| 40 | |
| 41 var ul = document.createElement('ul'); | |
| 42 for (var i = 0; i < taskLog.details.length; ++i) | |
| 43 ul.appendChild(createElementFromText('li', taskLog.details[i])); | |
| 44 label.appendChild(ul); | |
| 45 | |
| 46 tr.appendChild(details); | |
| 47 | |
| 48 itemContainer.appendChild(tr); | |
| 49 } | |
| 50 | |
| 51 /** | |
| 52 * Get initial sync service values and set listeners to get updated values. | |
| 53 */ | |
| 54 function main() { | |
| 55 observeTaskLog(); | |
| 56 } | |
| 57 | |
| 58 document.addEventListener('DOMContentLoaded', main); | |
| 59 return TaskLog; | |
| 60 })(); | |
| OLD | NEW |