Add checkboxes to select sections

This CL allows exclude sections from the log by unckecking checkboxes
for each section before loading a file.

Bug: 967800
Change-Id: I4e1a9d0fbb8909d6135207f80365c0e793dc1010
diff --git a/process_log.js b/process_log.js
index 1c680e2..063c268 100644
--- a/process_log.js
+++ b/process_log.js
@@ -580,12 +580,19 @@
 
 /**
  * @param {Array<Array<Object>>} logs
- * @param {Array<Object>} log
+ * @param {Array<Array<Object>>} logHolder
+ * @param {String} id
  * @private
  */
-function addLog(logs, log) {
-  if (!log || log.length <= 0)
+function addLog(logs, logHolder, id) {
+  const log = logHolder[id];
+  if (!log || log.length <= 0) {
     return;
+  }
+  const logCheckboxes = document.getElementById('logCheckboxes');
+  if (!logCheckboxes.querySelector('#' + id).checked) {
+    return;
+  }
   logs.push(log);
 }
 
@@ -600,11 +607,11 @@
   var mergedLog = [];
   // merge all log types together...
   var logs = [];
-  addLog(logs, logHolder.netlog);
-  addLog(logs, logHolder.brillolog);
-  addLog(logs, logHolder.networkEventLog);
-  addLog(logs, logHolder.syslog);
-  addLog(logs, logHolder.androidlog);
+  addLog(logs, logHolder, 'androidlog');
+  addLog(logs, logHolder, 'brillolog');
+  addLog(logs, logHolder, 'netlog');
+  addLog(logs, logHolder, 'networkEventLog');
+  addLog(logs, logHolder, 'syslog');
 
   while (logs.length > 0) {
     var logIdx;
diff --git a/service_states.html b/service_states.html
index c8e1e24..df80d42 100644
--- a/service_states.html
+++ b/service_states.html
@@ -24,10 +24,29 @@
   <body>
     <h1>Chrome OS, Brillo and Android Network Log Processor</h1>
     <div id="file-load-instructions">
-    <p>Please select a log for processing.  Supported files are Chrome OS
+      <p>Please select a log for processing.  Supported files are Chrome OS
          system logs and Chrome OS net.log files, Brillo net.log files and
          Android bugreport and logcat files. </p>
-    <input type="file" id="file_name">
+      <div id="logCheckboxes">
+        <p>Log sections to include:</p>
+        <div>
+          <input type="checkbox" id="androidlog" checked>
+          <label>Android</label>
+        </div>
+        <div>
+          <input type="checkbox" id="brillolog" checked>
+          <label>Brillo</label></div>
+        <div>
+          <input type="checkbox" id="netlog" checked>
+          <label>net.log</label></div>
+        <div>
+          <input type="checkbox" id="networkEventLog" checked>
+          <label>network_event_log</label></div>
+        <div>
+          <input type="checkbox" id="syslog" checked>
+          <label>syslog</label></div>
+      </div>
+      <input type="file" id="file_name">
     </div>
     <div class="managers">
     </div>
diff --git a/service_summary.css b/service_summary.css
index efd7d31..04d333b 100644
--- a/service_summary.css
+++ b/service_summary.css
@@ -22,6 +22,10 @@
 .error { background-color: #FF5050; }
 .user { background-color: #a0c0ff; }
 
+#logCheckboxes {
+  margin-bottom: 20px;
+}
+
 .legend {
   font-family: 'Arial';
   font-size: 13px;