Upload app.py
Browse files
app.py
CHANGED
|
@@ -355,7 +355,8 @@ def render_html_table(pivot: pd.DataFrame, categoria: str) -> str:
|
|
| 355 |
"""
|
| 356 |
for label, bg in zip(faixa_labels, faixa_header_bg):
|
| 357 |
html += (f' <th style="background:{bg};color:#ffffff !important;'
|
| 358 |
-
f'text-align:center;min-width:90px;
|
|
|
|
| 359 |
f'{label}<span class="sub-label">[uni]</span></th>\n')
|
| 360 |
|
| 361 |
html += ' <th class="th-total">TOTAL</th>\n </tr>\n </thead>\n <tbody>\n'
|
|
@@ -529,6 +530,8 @@ def atualizar_vista(categoria: str):
|
|
| 529 |
return tabela_html, kpi_html
|
| 530 |
|
| 531 |
# ββ CSS global ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
|
|
|
| 532 |
CSS = """
|
| 533 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
|
| 534 |
|
|
@@ -541,29 +544,14 @@ body, .gradio-container {
|
|
| 541 |
margin: 0 auto !important;
|
| 542 |
padding: 0 !important;
|
| 543 |
}
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
}
|
| 551 |
-
.app-header * {
|
| 552 |
-
color: #ffffff !important;
|
| 553 |
-
}
|
| 554 |
-
.app-header h1 {
|
| 555 |
-
margin: 0 0 6px;
|
| 556 |
-
font-size: 26px;
|
| 557 |
-
font-weight: 800;
|
| 558 |
-
letter-spacing: -0.3px;
|
| 559 |
-
color: #ffffff !important;
|
| 560 |
-
}
|
| 561 |
-
.app-header p {
|
| 562 |
-
margin: 0;
|
| 563 |
-
font-size: 13px;
|
| 564 |
-
font-weight: 400;
|
| 565 |
color: #ffffff !important;
|
| 566 |
-
|
| 567 |
}
|
| 568 |
.cat-selector label {
|
| 569 |
font-weight: 700 !important;
|
|
@@ -625,29 +613,62 @@ CATEGORIAS = ['EM CURSO', 'LICENCIAMENTO', 'FINALIZADO', 'GLOBAL']
|
|
| 625 |
DATA_REF = pd.Timestamp.today().strftime('%d/%m/%Y')
|
| 626 |
N_TOTAL = len(DF_GLOBAL)
|
| 627 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 628 |
with gr.Blocks(title="Dashboard SLA") as demo:
|
| 629 |
|
| 630 |
-
|
| 631 |
-
gr.HTML(f"""
|
| 632 |
-
<div class="app-header" style="
|
| 633 |
-
background: linear-gradient(135deg, #0D47A1 0%, #1565C0 50%, #1976D2 100%);
|
| 634 |
-
padding: 28px 36px 22px;
|
| 635 |
-
border-radius: 0 0 16px 16px;
|
| 636 |
-
margin-bottom: 24px;
|
| 637 |
-
box-shadow: 0 4px 20px rgba(13,71,161,0.25);
|
| 638 |
-
">
|
| 639 |
-
<h1 style="margin:0 0 6px;font-size:26px;font-weight:800;letter-spacing:-0.3px;
|
| 640 |
-
color:#ffffff !important;font-family:'Inter','Segoe UI',Arial,sans-serif;">
|
| 641 |
-
π Dashboard SLA β Acompanhamento de Tarefas
|
| 642 |
-
</h1>
|
| 643 |
-
<p style="margin:0;font-size:13px;font-weight:400;
|
| 644 |
-
color:#ffffff !important;opacity:0.92;
|
| 645 |
-
font-family:'Inter','Segoe UI',Arial,sans-serif;">
|
| 646 |
-
Controlo SLA por tipo de tarefa Β· DistribuiΓ§Γ£o por faixas de percentagem
|
| 647 |
-
Β· {N_TOTAL} registos Β· ReferΓͺncia: {DATA_REF}
|
| 648 |
-
</p>
|
| 649 |
-
</div>
|
| 650 |
-
""")
|
| 651 |
|
| 652 |
# ββ Selector de categoria ββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 653 |
with gr.Row():
|
|
|
|
| 355 |
"""
|
| 356 |
for label, bg in zip(faixa_labels, faixa_header_bg):
|
| 357 |
html += (f' <th style="background:{bg};color:#ffffff !important;'
|
| 358 |
+
f'text-align:center;min-width:90px;padding:11px 16px;font-weight:700;'
|
| 359 |
+
f'font-size:12px;text-transform:uppercase;letter-spacing:0.4px;">'
|
| 360 |
f'{label}<span class="sub-label">[uni]</span></th>\n')
|
| 361 |
|
| 362 |
html += ' <th class="th-total">TOTAL</th>\n </tr>\n </thead>\n <tbody>\n'
|
|
|
|
| 530 |
return tabela_html, kpi_html
|
| 531 |
|
| 532 |
# ββ CSS global ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 533 |
+
# NOTA: No Hugging Face Spaces o CSS externo pode ser sobreposto pelo tema.
|
| 534 |
+
# O header usa inline styles directamente no HTML para garantir cor branca.
|
| 535 |
CSS = """
|
| 536 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
|
| 537 |
|
|
|
|
| 544 |
margin: 0 auto !important;
|
| 545 |
padding: 0 !important;
|
| 546 |
}
|
| 547 |
+
/* Header β reforΓ§o via CSS (o inline style no HTML Γ© a fonte primΓ‘ria) */
|
| 548 |
+
.sla-header-wrap,
|
| 549 |
+
.sla-header-wrap *,
|
| 550 |
+
.sla-header-wrap h1,
|
| 551 |
+
.sla-header-wrap p,
|
| 552 |
+
.sla-header-wrap span {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 553 |
color: #ffffff !important;
|
| 554 |
+
-webkit-text-fill-color: #ffffff !important;
|
| 555 |
}
|
| 556 |
.cat-selector label {
|
| 557 |
font-weight: 700 !important;
|
|
|
|
| 613 |
DATA_REF = pd.Timestamp.today().strftime('%d/%m/%Y')
|
| 614 |
N_TOTAL = len(DF_GLOBAL)
|
| 615 |
|
| 616 |
+
# ββ Header HTML β cor branca garantida via 3 mecanismos simultΓ’neos:
|
| 617 |
+
# 1. style="" inline em cada elemento
|
| 618 |
+
# 2. -webkit-text-fill-color (sobrepΓ΅e alguns temas WebKit/Blink)
|
| 619 |
+
# 3. <font color> como fallback para parsers que removem style
|
| 620 |
+
HEADER_HTML = f"""
|
| 621 |
+
<style>
|
| 622 |
+
/* Especificidade mΓ‘xima para o header β funciona no Hugging Face Spaces */
|
| 623 |
+
div.sla-header-wrap {{
|
| 624 |
+
background: linear-gradient(135deg, #0D47A1 0%, #1565C0 50%, #1976D2 100%) !important;
|
| 625 |
+
padding: 28px 36px 22px !important;
|
| 626 |
+
border-radius: 0 0 16px 16px !important;
|
| 627 |
+
margin-bottom: 24px !important;
|
| 628 |
+
box-shadow: 0 4px 20px rgba(13,71,161,0.25) !important;
|
| 629 |
+
}}
|
| 630 |
+
div.sla-header-wrap h1 {{
|
| 631 |
+
margin: 0 0 6px !important;
|
| 632 |
+
font-size: 26px !important;
|
| 633 |
+
font-weight: 800 !important;
|
| 634 |
+
letter-spacing: -0.3px !important;
|
| 635 |
+
color: #ffffff !important;
|
| 636 |
+
-webkit-text-fill-color: #ffffff !important;
|
| 637 |
+
font-family: 'Inter', 'Segoe UI', Arial, sans-serif !important;
|
| 638 |
+
}}
|
| 639 |
+
div.sla-header-wrap p {{
|
| 640 |
+
margin: 0 !important;
|
| 641 |
+
font-size: 13px !important;
|
| 642 |
+
font-weight: 400 !important;
|
| 643 |
+
color: #ffffff !important;
|
| 644 |
+
-webkit-text-fill-color: #ffffff !important;
|
| 645 |
+
opacity: 0.92 !important;
|
| 646 |
+
font-family: 'Inter', 'Segoe UI', Arial, sans-serif !important;
|
| 647 |
+
}}
|
| 648 |
+
</style>
|
| 649 |
+
<div class="sla-header-wrap"
|
| 650 |
+
style="background:linear-gradient(135deg,#0D47A1 0%,#1565C0 50%,#1976D2 100%);
|
| 651 |
+
padding:28px 36px 22px;border-radius:0 0 16px 16px;
|
| 652 |
+
margin-bottom:24px;box-shadow:0 4px 20px rgba(13,71,161,0.25);">
|
| 653 |
+
<h1 style="margin:0 0 6px;font-size:26px;font-weight:800;letter-spacing:-0.3px;
|
| 654 |
+
color:#ffffff !important;-webkit-text-fill-color:#ffffff !important;
|
| 655 |
+
font-family:'Inter','Segoe UI',Arial,sans-serif;">
|
| 656 |
+
<font color="#ffffff">π Dashboard SLA β Acompanhamento de Tarefas</font>
|
| 657 |
+
</h1>
|
| 658 |
+
<p style="margin:0;font-size:13px;font-weight:400;opacity:0.92;
|
| 659 |
+
color:#ffffff !important;-webkit-text-fill-color:#ffffff !important;
|
| 660 |
+
font-family:'Inter','Segoe UI',Arial,sans-serif;">
|
| 661 |
+
<font color="#ffffff">
|
| 662 |
+
Controlo SLA por tipo de tarefa Β· DistribuiΓ§Γ£o por faixas de percentagem
|
| 663 |
+
Β· {N_TOTAL} registos Β· ReferΓͺncia: {DATA_REF}
|
| 664 |
+
</font>
|
| 665 |
+
</p>
|
| 666 |
+
</div>
|
| 667 |
+
"""
|
| 668 |
+
|
| 669 |
with gr.Blocks(title="Dashboard SLA") as demo:
|
| 670 |
|
| 671 |
+
gr.HTML(HEADER_HTML)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
|
| 673 |
# ββ Selector de categoria ββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 674 |
with gr.Row():
|