feat: implement contrast improvements, pre/post dedup MSDP chart, Azure/OCI PDF label, and live troubleshooting crawler
This commit is contained in:
+28
-17
@@ -152,13 +152,14 @@ def generate_mitigation_pdf(jobs_list, filter_name="Consolidated"):
|
||||
pdf.set_fill_color(30, 38, 64)
|
||||
pdf.set_font('Helvetica', 'B', 8)
|
||||
pdf.set_text_color(255, 255, 255)
|
||||
pdf.cell(15, 6, 'Job ID', 1, 0, 'C', True)
|
||||
pdf.cell(32, 6, 'Cliente', 1, 0, 'L', True)
|
||||
pdf.cell(35, 6, 'Politica', 1, 0, 'L', True)
|
||||
pdf.cell(15, 6, 'Erro', 1, 0, 'C', True)
|
||||
pdf.cell(28, 6, 'Resolucao Rerun', 1, 0, 'C', True)
|
||||
pdf.cell(20, 6, 'Mitigacao', 1, 0, 'C', True)
|
||||
pdf.cell(45, 6, 'Acao Registrada', 1, 1, 'L', True)
|
||||
pdf.cell(14, 6, 'Job ID', 1, 0, 'C', True)
|
||||
pdf.cell(16, 6, 'Infra/Cloud', 1, 0, 'C', True)
|
||||
pdf.cell(26, 6, 'Cliente', 1, 0, 'L', True)
|
||||
pdf.cell(30, 6, 'Politica', 1, 0, 'L', True)
|
||||
pdf.cell(12, 6, 'Erro', 1, 0, 'C', True)
|
||||
pdf.cell(24, 6, 'Resolucao Rerun', 1, 0, 'C', True)
|
||||
pdf.cell(18, 6, 'Mitigacao', 1, 0, 'C', True)
|
||||
pdf.cell(50, 6, 'Acao Registrada', 1, 1, 'L', True)
|
||||
|
||||
# Table Rows formatting
|
||||
pdf.set_font('Helvetica', '', 7.5)
|
||||
@@ -175,27 +176,37 @@ def generate_mitigation_pdf(jobs_list, filter_name="Consolidated"):
|
||||
action = clean_str(j.get('action_taken'), 'Nenhuma nota registrada.')
|
||||
|
||||
# String safety trims
|
||||
if len(client) > 20: client = client[:18] + '..'
|
||||
if len(policy) > 20: policy = policy[:18] + '..'
|
||||
if len(action) > 30: action = action[:28] + '..'
|
||||
if len(client) > 16: client = client[:14] + '..'
|
||||
if len(policy) > 18: policy = policy[:16] + '..'
|
||||
if len(action) > 34: action = action[:32] + '..'
|
||||
|
||||
# Resolve Infra / Cloud based on Primary Server name
|
||||
srv = clean_str(j.get('primary_server'), '').lower()
|
||||
if 'srvpalcvnbu01' in srv:
|
||||
infra = 'Azure'
|
||||
elif 'srvpalcocinbupri01' in srv:
|
||||
infra = 'OCI'
|
||||
else:
|
||||
infra = 'Outro'
|
||||
|
||||
# Row alternating colors
|
||||
if fill_row:
|
||||
pdf.set_fill_color(241, 245, 249)
|
||||
else:
|
||||
pdf.set_fill_color(255, 255, 255)
|
||||
|
||||
pdf.cell(15, 6, str(jid), 1, 0, 'C', True)
|
||||
pdf.cell(32, 6, client, 1, 0, 'L', True)
|
||||
pdf.cell(35, 6, policy, 1, 0, 'L', True)
|
||||
pdf.cell(15, 6, str(code), 1, 0, 'C', True)
|
||||
pdf.cell(14, 6, str(jid), 1, 0, 'C', True)
|
||||
pdf.cell(16, 6, infra, 1, 0, 'C', True)
|
||||
pdf.cell(26, 6, client, 1, 0, 'L', True)
|
||||
pdf.cell(30, 6, policy, 1, 0, 'L', True)
|
||||
pdf.cell(12, 6, str(code), 1, 0, 'C', True)
|
||||
|
||||
# Write rerun status with semantic colors
|
||||
if reex == 'Reexecutado':
|
||||
pdf.set_text_color(0, 150, 60) # Green text
|
||||
else:
|
||||
pdf.set_text_color(255, 75, 75) # Red text
|
||||
pdf.cell(28, 6, reex, 1, 0, 'C', True)
|
||||
pdf.cell(24, 6, reex, 1, 0, 'C', True)
|
||||
|
||||
# Set action status background color
|
||||
pdf.set_text_color(30, 41, 59)
|
||||
@@ -205,14 +216,14 @@ def generate_mitigation_pdf(jobs_list, filter_name="Consolidated"):
|
||||
pdf.set_fill_color(255, 235, 180) # Soft yellow cell
|
||||
else:
|
||||
pdf.set_fill_color(255, 210, 210) # Soft red cell
|
||||
pdf.cell(20, 6, status, 1, 0, 'C', True)
|
||||
pdf.cell(18, 6, status, 1, 0, 'C', True)
|
||||
|
||||
# Action notes column
|
||||
if fill_row:
|
||||
pdf.set_fill_color(241, 245, 249)
|
||||
else:
|
||||
pdf.set_fill_color(255, 255, 255)
|
||||
pdf.cell(45, 6, action, 1, 1, 'L', True)
|
||||
pdf.cell(50, 6, action, 1, 1, 'L', True)
|
||||
|
||||
fill_row = not fill_row
|
||||
|
||||
|
||||
Reference in New Issue
Block a user