| 664 | return table_html |
| 665 | |
| 666 | def generate_html_table_netkb(self, file_path): |
| 667 | table_html = '<table class="styled-table"><thead><tr>' |
| 668 | try: |
| 669 | with open(file_path, 'r', encoding='utf-8') as file: |
| 670 | reader = csv.reader(file) |
| 671 | headers = next(reader) |
| 672 | for header in headers: |
| 673 | table_html += f'<th>{header}</th>' |
| 674 | table_html += '</tr></thead><tbody>' |
| 675 | for row in reader: |
| 676 | row_class = "blue-row" if '0' in row[3] else "" |
| 677 | table_html += f'<tr class="{row_class}">' |
| 678 | for cell in row: |
| 679 | cell_class = "" |
| 680 | if "success" in cell: |
| 681 | cell_class = "green bold" |
| 682 | elif "failed" in cell: |
| 683 | cell_class = "red bold" |
| 684 | elif cell.strip() == "": |
| 685 | cell_class = "grey" |
| 686 | table_html += f'<td class="{cell_class}">{cell}</td>' |
| 687 | table_html += '</tr>' |
| 688 | table_html += '</tbody></table>' |
| 689 | except Exception as e: |
| 690 | self.logger.error(f"Error in generate_html_table_netkb: {e}") |
| 691 | return table_html |
| 692 | |
| 693 | |
| 694 | def serve_netkb_data(self, handler): |