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.
5 var TaskLog = (function() {
8 var nextTaskLogSeq = 1;
11 function observeTaskLog() {
12 chrome.send('observeTaskLog');
16 * Handles per-task log event.
17 * @param {Object} taskLog a dictionary containing 'duration',
18 * 'task_description', 'result_description' and 'details'.
20 TaskLog.onTaskLogRecorded = function(taskLog) {
21 var details = document.createElement('td');
22 details.classList.add('task-log-details');
24 var label = document.createElement('label');
25 details.appendChild(label);
27 var collapseCheck = document.createElement('input');
28 collapseCheck.setAttribute('type', 'checkbox');
29 collapseCheck.classList.add('task-log-collapse-check');
30 label.appendChild(collapseCheck);
32 var ul = document.createElement('ul');
33 for (var i = 0; i < taskLog.details.length; ++i)
34 ul.appendChild(createElementFromText('li', taskLog.details[i]));
35 label.appendChild(ul);
37 var tr = document.createElement('tr');
38 tr.appendChild(createElementFromText(
39 'td', taskLog.duration, {'class': 'task-log-duration'}));
40 tr.appendChild(createElementFromText(
41 'td', taskLog.task_description, {'class': 'task-log-description'}));
42 tr.appendChild(createElementFromText(
43 'td', taskLog.result_description, {'class': 'task-log-result'}));
44 tr.appendChild(details);
46 $('task-log-entries').appendChild(tr);
50 * Get initial sync service values and set listeners to get updated values.
56 document.addEventListener('DOMContentLoaded', main);