staff portal: handle more edge cases in column definitions
authorGalen Charlton <gmc@equinoxOLI.org>
Tue, 3 Aug 2021 15:44:40 +0000 (11:44 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Wed, 1 Sep 2021 18:42:30 +0000 (14:42 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/splash.component.ts

index eace52b..82e395b 100644 (file)
@@ -35,14 +35,22 @@ export class StaffSplashComponent implements OnInit {
                 // sequences
                 tmpPortalEntries.forEach((col) => {
                     if (col !== undefined) {
-                        this.portalEntries.push(col);
-                        col.forEach((entry) => {
+                        const filtered = col.filter(x => x !== undefined);
+                        this.portalEntries.push(filtered);
+                        filtered.forEach((entry) => {
                             if (entry.entry_type() === 'header') {
                                 this.portalHeaders[this.portalEntries.length - 1] = entry;
                             }
                         });
                     }
                 });
+                // supply an empty header entry in case a column was
+                // defined without a header
+                this.portalEntries.forEach((col, i) => {
+                    if (this.portalHeaders.length <= i) {
+                        this.portalHeaders[i] = undefined;
+                    }
+                });
             }
         );
     }