From 0f57781ca21cbc70e3631ae0a454512dd23777fb Mon Sep 17 00:00:00 2001
From: Julian Labus <julian@labus-online.de>
Date: Fri, 1 May 2020 17:50:32 +0200
Subject: [PATCH] app: add bootloader images to table view

---
 app.js     | 10 ++++++++++
 index.html |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/app.js b/app.js
index 7a1fce3..7943548 100644
--- a/app.js
+++ b/app.js
@@ -1020,6 +1020,9 @@ var firmwarewizard = function() {
     $('#firmwareTableBody').innerHTML = '';
 
     var initializeRevHTML = function(rev) {
+      if (bootloaderRevBranchDict[rev.branch] === undefined) {
+        bootloaderRevBranchDict[rev.branch] = document.createElement('span');
+      }
       if (upgradeRevBranchDict[rev.branch] === undefined) {
         upgradeRevBranchDict[rev.branch] = document.createElement('span');
       }
@@ -1047,6 +1050,11 @@ var firmwarewizard = function() {
         factoryRevBranchDict[rev.branch].appendChild(a);
         factoryRevBranchDict[rev.branch].appendChild(textNodeEnd);
         show = true;
+      } else if (rev.type == 'bootloader') {
+        bootloaderRevBranchDict[rev.branch].appendChild(textNodeStart);
+        bootloaderRevBranchDict[rev.branch].appendChild(a);
+        bootloaderRevBranchDict[rev.branch].appendChild(textNodeEnd);
+        show = true;
       }
     };
 
@@ -1077,6 +1085,7 @@ var firmwarewizard = function() {
         var revisions = sortByRevision(images[vendor][model]);
         var upgradeRevBranchDict = {};
         var factoryRevBranchDict = {};
+        var bootloaderRevBranchDict = {};
         var show = false;
 
         revisions.forEach(initializeRevHTML);
@@ -1096,6 +1105,7 @@ var firmwarewizard = function() {
         tdModel.innerText = model;
         tr.appendChild(tdModel);
 
+        tr.appendChild(createRevTd(bootloaderRevBranchDict));
         tr.appendChild(createRevTd(factoryRevBranchDict));
         tr.appendChild(createRevTd(upgradeRevBranchDict));
 
diff --git a/index.html b/index.html
index 4b49c2b..fd2a22f 100644
--- a/index.html
+++ b/index.html
@@ -111,13 +111,14 @@
           <tr>
             <th>Hersteller</th>
             <th>Modell</th>
+            <th>Bootloader-Image</th>
             <th>Erstinstallation</th>
             <th>Upgrade</th>
           </tr>
         </thead>
         <tbody id="firmwareTableBody">
           <tr>
-            <td colspan="4">Loading...</td>
+            <td colspan="5">Loading...</td>
           </tr>
         </tbody>
       </table>
-- 
GitLab