]> git.ipfire.org Git - suricata-reporter.git/commitdiff
generator: Show a note when there have been no alerts
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Sep 2025 11:04:27 +0000 (11:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Sep 2025 11:14:37 +0000 (11:14 +0000)
It seems to make more sense to explicitely show this instead of
generating reports that only have a title page.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/suricata-report-generator.in

index fbc317bb16dca92c5e0a005623b98fbc3fc7aa61..7913a4e8468ea30ebd019e67f48f8d21a4089a53 100644 (file)
@@ -107,6 +107,16 @@ class ReportGenerator(object):
                )
                self.styles.add(small)
 
+               # Add a light styling for notes
+               note = reportlab.lib.styles.ParagraphStyle(
+                       name        = "Note",
+                       parent      = self.styles["Centered"],
+                       textColor   = reportlab.lib.colors.grey,
+                       spaceBefore = 1 * cm,
+                       spaceAfter  = 1 * cm,
+               )
+               self.styles.add(note)
+
        def generate(self, output, year, month, week, day):
                """
                        Generates a PDF report.
@@ -380,11 +390,6 @@ class ReportGenerator(object):
                                ),
                        ))
 
-               # Skip if we have found no data
-               if len(rows) == 1:
-                       log.debug("Skipping %s, because we don't have any data" % date)
-                       return
-
                # Add a headline
                elements.append(
                        reportlab.platypus.Paragraph(
@@ -393,6 +398,18 @@ class ReportGenerator(object):
                        )
                )
 
+               # Just add a note if there have not been any alerts
+               if not i:
+                       elements.append(
+                               reportlab.platypus.Paragraph(
+                                       _("No Alerts Have Been Reported"),
+                                       self.styles["Note"],
+                               ),
+                       )
+
+                       # Done
+                       return
+
                # Create the table
                table = reportlab.platypus.Table(rows,
                        # Set the widths of the rows