feat(fusion_helpdesk): Critical flag, KPI cards, colored stage pills

Three coordinated changes on top of the section grouping:

1. **Mark as Critical** — a red chip on the New tab sets priority='3'
   when submitted. The central post-create hook auto-applies a "Critical"
   helpdesk.tag (shipped via fusion_helpdesk_central data XML, noupdate=1
   so support can recolor without losing it on upgrade), giving support
   a kanban-groupable signal that doesn't rely on remembering what
   priority='3' means. Scoped to in-app-channel tickets only, so a
   support agent manually setting Urgent on their own ticket isn't
   silently tagged.

2. **KPI cards above the sections** — Total / Open / Closed / Critical
   in a 4-up grid (auto-collapses to 2x2 under 540px). Each card uses
   its own saturated gradient so it reads on both light and dark mode —
   the dialog backdrop is irrelevant because the gradient brings its
   own background. Counts are computed in JS from state.tickets so they
   always match what's rendered below.

3. **Colored stage pills** — red Critical, green Solved, dark-yellow New,
   orange Cancelled, blue for In Progress / Testing / On Hold. Critical
   priority gets a *separate* red pill alongside the stage pill so you
   keep stage info even on escalated tickets. Stage matching is
   substring-based (lowercased) so a renamed "Resolved" or "Done" stage
   on central still maps to the green pill.

Tests cover the new is_critical=True → priority='3' wiring and the
default omission so SLA / stage defaults keep working for normal
tickets. Bumps fusion_helpdesk to 19.0.1.7.0 and
fusion_helpdesk_central to 19.0.1.2.0. End-to-end smoke test verified
live: priority=3 + x_fc_client_label triggers the Critical tag.
This commit is contained in:
gsinghpal
2026-05-27 11:21:11 -04:00
parent 3e5ced1655
commit d7ec91b0f1
10 changed files with 300 additions and 10 deletions

View File

@@ -49,6 +49,27 @@ class TestBuildTicketVals(TransactionCase):
self.assertEqual(vals['partner_name'], 'Jane')
self.assertIn('Feature Request', vals['name'])
def test_is_critical_sets_urgent_priority(self):
# The "Mark as Critical" toggle on the dialog turns into priority='3'
# in the create vals — that's the load-bearing signal both for the
# inbox's Critical bucket AND the central auto-tag.
vals = build_ticket_vals(
kind='bug', subject='X', body_html='<p>b</p>', team_id=1,
client_label='ENTECH', reporter_name='X', reporter_email='x@x.com',
company_name='X Inc', is_critical=True,
)
self.assertEqual(vals.get('priority'), '3')
def test_is_critical_default_omits_priority(self):
# Default path must NOT set priority so the central stage / SLA default
# keeps working — only the explicit toggle escalates.
vals = build_ticket_vals(
kind='bug', subject='X', body_html='<p>b</p>', team_id=1,
client_label='ENTECH', reporter_name='X', reporter_email='x@x.com',
company_name='X Inc',
)
self.assertNotIn('priority', vals)
@tagged('post_install', '-at_install', 'fusion_helpdesk')
class TestScopeDomain(TransactionCase):