apps: Make sections collapsible

This change modifies the log processor page such that different sections
can be collapsed, which makes it easier to navigate sections.

BUG=chromium:928557
TEST=Page sections can now be collapsed and expanded.

Change-Id: If72d1e8676deeea8a9538e5627dcee7ac96e3bd7
diff --git a/process_log.js b/process_log.js
index 3e11747..8e7695f 100644
--- a/process_log.js
+++ b/process_log.js
@@ -201,13 +201,30 @@
   console.log('inside log summary!');
   var manager = document.getElementsByClassName('managers');
   var logHeader = document.createElement('h2');
-  logHeader.innerText = 'Log Summary';
+  var summaryLink = document.createElement('a');
+  summaryLink.href = '#';
+  summaryLink.innerText = 'Log Summary';
+  summaryLink.addEventListener('click', function(event) {
+    event.preventDefault();
+    this.classList.toggle('active');
+    var content = document.getElementById('summary');
+    if (content.style.display === 'block') {
+      content.style.display = 'none';
+    } else {
+      content.style.display = 'block';
+    }
+  });
+  logHeader.appendChild(summaryLink);
   manager[0].appendChild(logHeader);
+  var summary = document.createElement('div');
+  summary.id = 'summary';
+  summary.style.display = 'block';
   var timeInfo = document.createElement('p');
   timeInfo.innerText = 'Total Log Time: ' +
       logHelper.formatElapsedMS(
           logSummary.logEndTime - logSummary.logStartTime);
-  manager[0].appendChild(timeInfo);
+  summary.appendChild(timeInfo);
+  manager[0].appendChild(summary);
   var activeServiceLabel = 'Active Service ';
   var managers = logSummary.managers;
   for (var i = 0; i < managers.length; i++) {
@@ -348,9 +365,9 @@
 
     console.log('manager notes check: ', managers[i].notes);
 
-    stateGraph.createGraph(manager[0], managers[i]);
+    stateGraph.createGraph(summary, managers[i]);
 
-    manager[0].appendChild(mInfo);
+    summary.appendChild(mInfo);
   }
 }
 
@@ -377,8 +394,24 @@
   var managers = logSummary.managers;
   var manager = document.getElementsByClassName('managers');
   var managerHeader = document.createElement('h2');
-  managerHeader.innerText = 'Managers';
+  var managerLink = document.createElement('a');
+  managerLink.href = '#';
+  managerLink.innerText = 'Managers';
+  managerLink.addEventListener('click', function(event) {
+    event.preventDefault();
+    this.classList.toggle('active');
+    var content = document.getElementById('managers');
+    if (content.style.display === 'block') {
+      content.style.display = 'none';
+    } else {
+      content.style.display = 'block';
+    }
+  });
+  managerHeader.appendChild(managerLink);
+
   var managerOL = document.createElement('ol');
+  managerOL.id = 'managers';
+  managerOL.style.display = 'block';
   manager[0].appendChild(managerHeader);
   var li;
   for (var i = 0; i < managers.length; i++) {
@@ -549,8 +582,28 @@
   if (mergedLog.length == 0) {
     return;
   }
+  var manager = document.getElementsByClassName('managers');
   var logTextHeader = document.createElement('h2');
-  logTextHeader.innerText = 'Merged Log View';
+  manager[0].appendChild(logTextHeader);
+  var logTextLink = document.createElement('a');
+  logTextLink.href = '#';
+  logTextLink.innerText = 'Merged Log View';
+  logTextLink.addEventListener('click', function(event) {
+    event.preventDefault();
+    this.classList.toggle('active');
+    var content = document.getElementById('logText');
+    if (content.style.display === 'block') {
+      content.style.display = 'none';
+    } else {
+      content.style.display = 'block';
+    }
+  });
+  logTextHeader.appendChild(logTextLink);
+
+  var logText = document.createElement('div');
+  logText.id = 'logText';
+  logText.style.display = 'block';
+
   var logTextHolder;
   var fileLabel;
   var logTextHolder2;
@@ -583,10 +636,9 @@
     } else {
       logTextHolder.appendChild(logTextHolder2);
     }
-    logTextHeader.appendChild(logTextHolder);
+    logText.appendChild(logTextHolder);
   }
-  var manager = document.getElementsByClassName('managers');
-  manager[0].appendChild(logTextHeader);
+  logTextHeader.appendChild(logText);
 }
 
 /**