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

@@ -39,6 +39,7 @@ export class FusionHelpdeskDialog extends Component {
errorCode: "",
replyEmail: user.login || "",
attachments: [],
isCritical: false,
capturing: false,
submitting: false,
error: "",
@@ -147,6 +148,38 @@ export class FusionHelpdeskDialog extends Component {
return groups.filter((g) => g.tickets.length);
}
// KPI stats — same source as the section list so counts always agree
// with what the user sees scrolling below. "Open" rolls Critical + Open
// groups together (anything not folded); "Closed" is the Solved bucket.
get ticketStats() {
const t = this.state.tickets;
const critical = t.filter((x) => x.group === "critical").length;
const open = t.filter((x) => x.group === "critical" || x.group === "open").length;
const closed = t.filter((x) => x.group === "solved").length;
return { total: t.length, open, closed, critical };
}
// Colour pill class per ticket. Critical priority shows as a dedicated red
// pill alongside the stage pill (rendered in the template), so this only
// needs to map the stage name to a hue. Match on substring (lowercased) so
// a renamed "Resolved" / "Done" stage on central still maps to green.
pillClass(t) {
const s = (t.stage || "").toLowerCase();
if (s.includes("cancel")) return "o_fhd_pill o_fhd_pill_cancelled";
if (s.includes("solv") || s.includes("done") || s.includes("resolv")) {
return "o_fhd_pill o_fhd_pill_solved";
}
if (s === "new") return "o_fhd_pill o_fhd_pill_new";
if (s.includes("progress") || s.includes("test") || s.includes("hold")) {
return "o_fhd_pill o_fhd_pill_progress";
}
return "o_fhd_pill"; // unknown stage falls back to neutral chip
}
isCriticalRow(t) {
return t.priority === "2" || t.priority === "3";
}
// ==================================================================
// My Tickets — thread
// ==================================================================
@@ -369,6 +402,7 @@ export class FusionHelpdeskDialog extends Component {
description: this.state.description || "",
error_code: this.state.kind === "bug" ? this.state.errorCode || "" : "",
reply_email: (this.state.replyEmail || "").trim(),
is_critical: !!this.state.isCritical,
attachments: this.state.attachments.map((a) => ({
name: a.name,
mimetype: a.mimetype,
@@ -390,6 +424,7 @@ export class FusionHelpdeskDialog extends Component {
this.state.description = "";
this.state.errorCode = "";
this.state.attachments = [];
this.state.isCritical = false;
}
} catch (err) {
console.error("fusion_helpdesk: submit failed", err);