Spaces:
Paused
Paused
dushyantsingh0 commited on
Commit ·
6b10adf
1
Parent(s): 47af5d9
backend stabilization
Browse files
api/v1/escalations.py
CHANGED
|
@@ -122,16 +122,32 @@ async def view_escalation_audit(
|
|
| 122 |
current_user: User = Depends(get_current_user),
|
| 123 |
db: AsyncSession = Depends(get_db)
|
| 124 |
) -> Any:
|
| 125 |
-
"""View audit trail of escalations and status changes."""
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
)
|
|
|
|
| 129 |
if current_user.role != UserRole.SC_ADMIN:
|
| 130 |
stmt = stmt.where(AuditLog.workspace_id == current_user.workspace_id)
|
| 131 |
|
| 132 |
stmt = stmt.offset(skip).limit(limit).order_by(AuditLog.created_at.desc())
|
| 133 |
result = await db.execute(stmt)
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
@router.get("/breaches/", dependencies=[Depends(require_roles(ALL_SC_ROLES))])
|
| 137 |
async def list_active_breaches(
|
|
|
|
| 122 |
current_user: User = Depends(get_current_user),
|
| 123 |
db: AsyncSession = Depends(get_db)
|
| 124 |
) -> Any:
|
| 125 |
+
"""View audit trail of escalations and status changes with ticket titles."""
|
| 126 |
+
from models.ticket import Ticket
|
| 127 |
+
|
| 128 |
+
stmt = (
|
| 129 |
+
select(AuditLog, Ticket.title.label("entity_title"))
|
| 130 |
+
.join(Ticket, AuditLog.entity_id == Ticket.id, isouter=True)
|
| 131 |
+
.where(
|
| 132 |
+
AuditLog.action.in_(["escalation", "status_change"]),
|
| 133 |
+
AuditLog.entity_type == "ticket"
|
| 134 |
+
)
|
| 135 |
)
|
| 136 |
+
|
| 137 |
if current_user.role != UserRole.SC_ADMIN:
|
| 138 |
stmt = stmt.where(AuditLog.workspace_id == current_user.workspace_id)
|
| 139 |
|
| 140 |
stmt = stmt.offset(skip).limit(limit).order_by(AuditLog.created_at.desc())
|
| 141 |
result = await db.execute(stmt)
|
| 142 |
+
|
| 143 |
+
# Process results to satisfy the Pydantic response model
|
| 144 |
+
logs = []
|
| 145 |
+
for row in result.all():
|
| 146 |
+
log = row[0]
|
| 147 |
+
log.entity_title = row[1]
|
| 148 |
+
logs.append(log)
|
| 149 |
+
|
| 150 |
+
return logs
|
| 151 |
|
| 152 |
@router.get("/breaches/", dependencies=[Depends(require_roles(ALL_SC_ROLES))])
|
| 153 |
async def list_active_breaches(
|
frontend/apps/internal/src/components/AnalyticsDashboard.module.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
.container {
|
| 2 |
padding: 32px;
|
| 3 |
-
background-color:
|
| 4 |
min-height: 100vh;
|
| 5 |
display: flex;
|
| 6 |
flex-direction: column;
|
|
@@ -13,14 +13,6 @@
|
|
| 13 |
to { opacity: 1; transform: translateY(0); }
|
| 14 |
}
|
| 15 |
|
| 16 |
-
/* 1. Universal Glassmorphism Utility */
|
| 17 |
-
.glass {
|
| 18 |
-
background: rgba(255, 255, 255, 0.7);
|
| 19 |
-
backdrop-filter: blur(16px);
|
| 20 |
-
border: 1px solid rgba(255, 255, 255, 0.4);
|
| 21 |
-
box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.05);
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
/* 2. Vitals Row */
|
| 25 |
.vitalsRow {
|
| 26 |
display: grid;
|
|
@@ -29,11 +21,11 @@
|
|
| 29 |
}
|
| 30 |
|
| 31 |
.vitalCard {
|
| 32 |
-
background: rgba(255, 255, 255, 0.
|
| 33 |
backdrop-filter: blur(24px);
|
| 34 |
-
border: 1px solid
|
| 35 |
box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.05);
|
| 36 |
-
border-radius:
|
| 37 |
padding: 24px;
|
| 38 |
display: flex;
|
| 39 |
align-items: center;
|
|
@@ -67,7 +59,7 @@
|
|
| 67 |
.vitalLabel {
|
| 68 |
font-size: 10px;
|
| 69 |
font-weight: 800;
|
| 70 |
-
color:
|
| 71 |
letter-spacing: 0.1em;
|
| 72 |
text-transform: uppercase;
|
| 73 |
}
|
|
@@ -75,7 +67,7 @@
|
|
| 75 |
.vitalValue {
|
| 76 |
font-size: 32px;
|
| 77 |
font-weight: 900;
|
| 78 |
-
color:
|
| 79 |
line-height: 1.1;
|
| 80 |
margin: 6px 0;
|
| 81 |
}
|
|
@@ -206,11 +198,11 @@
|
|
| 206 |
}
|
| 207 |
|
| 208 |
.gridCard {
|
| 209 |
-
background: rgba(255, 255, 255, 0.
|
| 210 |
backdrop-filter: blur(24px);
|
| 211 |
-
border: 1px solid
|
| 212 |
box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.05);
|
| 213 |
-
border-radius:
|
| 214 |
padding: 32px;
|
| 215 |
display: flex;
|
| 216 |
flex-direction: column;
|
|
@@ -301,11 +293,12 @@
|
|
| 301 |
text-transform: uppercase;
|
| 302 |
}
|
| 303 |
|
| 304 |
-
.
|
| 305 |
-
.
|
| 306 |
-
.
|
|
|
|
| 307 |
|
| 308 |
-
/*
|
| 309 |
.staffMeta {
|
| 310 |
display: flex;
|
| 311 |
flex-wrap: wrap;
|
|
@@ -316,18 +309,18 @@
|
|
| 316 |
display: flex;
|
| 317 |
align-items: center;
|
| 318 |
gap: 6px;
|
| 319 |
-
background:
|
| 320 |
padding: 6px 12px;
|
| 321 |
border-radius: 99px;
|
| 322 |
font-size: 10px;
|
| 323 |
font-weight: 800;
|
| 324 |
-
color:
|
| 325 |
}
|
| 326 |
|
| 327 |
.staffDot {
|
| 328 |
width: 6px;
|
| 329 |
height: 6px;
|
| 330 |
-
background:
|
| 331 |
border-radius: 50%;
|
| 332 |
box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
|
| 333 |
}
|
|
@@ -335,51 +328,73 @@
|
|
| 335 |
.moreStaff {
|
| 336 |
font-size: 10px;
|
| 337 |
font-weight: 700;
|
| 338 |
-
color:
|
| 339 |
padding: 6px;
|
| 340 |
}
|
| 341 |
|
| 342 |
-
|
| 343 |
-
.ledgerList {
|
| 344 |
display: flex;
|
| 345 |
flex-direction: column;
|
| 346 |
-
gap:
|
| 347 |
}
|
| 348 |
|
| 349 |
-
.
|
| 350 |
display: flex;
|
| 351 |
-
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
}
|
| 354 |
|
| 355 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
display: flex;
|
| 357 |
-
|
| 358 |
-
|
|
|
|
| 359 |
}
|
| 360 |
|
| 361 |
-
.
|
| 362 |
font-size: 10px;
|
| 363 |
-
font-weight:
|
| 364 |
-
color:
|
| 365 |
-
text-transform: uppercase;
|
| 366 |
-
letter-spacing: 0.05em;
|
| 367 |
-
background: #F1F5F9;
|
| 368 |
-
padding: 2px 8px;
|
| 369 |
-
border-radius: 4px;
|
| 370 |
}
|
| 371 |
|
| 372 |
-
.
|
| 373 |
font-size: 10px;
|
| 374 |
-
color:
|
| 375 |
-
font-weight: 600;
|
| 376 |
}
|
| 377 |
|
| 378 |
-
.
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
}
|
| 384 |
|
| 385 |
/* 8. Pulse Components */
|
|
@@ -470,6 +485,49 @@
|
|
| 470 |
}
|
| 471 |
|
| 472 |
/* Tooltip & Micro-interactions */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
.miniTrendContainer {
|
| 474 |
margin-left: auto;
|
| 475 |
}
|
|
|
|
| 1 |
.container {
|
| 2 |
padding: 32px;
|
| 3 |
+
background-color: var(--bg-dark);
|
| 4 |
min-height: 100vh;
|
| 5 |
display: flex;
|
| 6 |
flex-direction: column;
|
|
|
|
| 13 |
to { opacity: 1; transform: translateY(0); }
|
| 14 |
}
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
/* 2. Vitals Row */
|
| 17 |
.vitalsRow {
|
| 18 |
display: grid;
|
|
|
|
| 21 |
}
|
| 22 |
|
| 23 |
.vitalCard {
|
| 24 |
+
background: rgba(255, 255, 255, 0.5);
|
| 25 |
backdrop-filter: blur(24px);
|
| 26 |
+
border: 1px solid var(--border-subtle);
|
| 27 |
box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.05);
|
| 28 |
+
border-radius: var(--radius-lg);
|
| 29 |
padding: 24px;
|
| 30 |
display: flex;
|
| 31 |
align-items: center;
|
|
|
|
| 59 |
.vitalLabel {
|
| 60 |
font-size: 10px;
|
| 61 |
font-weight: 800;
|
| 62 |
+
color: var(--text-muted);
|
| 63 |
letter-spacing: 0.1em;
|
| 64 |
text-transform: uppercase;
|
| 65 |
}
|
|
|
|
| 67 |
.vitalValue {
|
| 68 |
font-size: 32px;
|
| 69 |
font-weight: 900;
|
| 70 |
+
color: var(--text-main);
|
| 71 |
line-height: 1.1;
|
| 72 |
margin: 6px 0;
|
| 73 |
}
|
|
|
|
| 198 |
}
|
| 199 |
|
| 200 |
.gridCard {
|
| 201 |
+
background: rgba(255, 255, 255, 0.5);
|
| 202 |
backdrop-filter: blur(24px);
|
| 203 |
+
border: 1px solid var(--border-subtle);
|
| 204 |
box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.05);
|
| 205 |
+
border-radius: var(--radius-lg);
|
| 206 |
padding: 32px;
|
| 207 |
display: flex;
|
| 208 |
flex-direction: column;
|
|
|
|
| 293 |
text-transform: uppercase;
|
| 294 |
}
|
| 295 |
|
| 296 |
+
/* 6. High-Intensity Colors */
|
| 297 |
+
.surge { background: #FEF2F2; color: var(--error); border: 1px solid #FEE2E2; }
|
| 298 |
+
.stable { background: #F0FDF4; color: var(--success); border: 1px solid #DCFCE7; }
|
| 299 |
+
.declining { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border-subtle); }
|
| 300 |
|
| 301 |
+
/* 7. Talent & Thermal Metadata */
|
| 302 |
.staffMeta {
|
| 303 |
display: flex;
|
| 304 |
flex-wrap: wrap;
|
|
|
|
| 309 |
display: flex;
|
| 310 |
align-items: center;
|
| 311 |
gap: 6px;
|
| 312 |
+
background: var(--bg-hover);
|
| 313 |
padding: 6px 12px;
|
| 314 |
border-radius: 99px;
|
| 315 |
font-size: 10px;
|
| 316 |
font-weight: 800;
|
| 317 |
+
color: var(--text-muted);
|
| 318 |
}
|
| 319 |
|
| 320 |
.staffDot {
|
| 321 |
width: 6px;
|
| 322 |
height: 6px;
|
| 323 |
+
background: var(--success);
|
| 324 |
border-radius: 50%;
|
| 325 |
box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
|
| 326 |
}
|
|
|
|
| 328 |
.moreStaff {
|
| 329 |
font-size: 10px;
|
| 330 |
font-weight: 700;
|
| 331 |
+
color: var(--text-dim);
|
| 332 |
padding: 6px;
|
| 333 |
}
|
| 334 |
|
| 335 |
+
.auditMiniList {
|
|
|
|
| 336 |
display: flex;
|
| 337 |
flex-direction: column;
|
| 338 |
+
gap: 12px;
|
| 339 |
}
|
| 340 |
|
| 341 |
+
.auditMiniItem {
|
| 342 |
display: flex;
|
| 343 |
+
gap: 16px;
|
| 344 |
+
padding: 12px;
|
| 345 |
+
background: var(--bg-panel);
|
| 346 |
+
border-radius: 12px;
|
| 347 |
+
cursor: pointer;
|
| 348 |
+
transition: all 0.2s ease;
|
| 349 |
+
border: 1px solid transparent;
|
| 350 |
}
|
| 351 |
|
| 352 |
+
.auditMiniItem:hover {
|
| 353 |
+
background: white;
|
| 354 |
+
border-color: rgba(124, 58, 237, 0.3);
|
| 355 |
+
transform: translateX(4px);
|
| 356 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
.auditMetaSide {
|
| 360 |
display: flex;
|
| 361 |
+
flex-direction: column;
|
| 362 |
+
flex-shrink: 0;
|
| 363 |
+
width: 50px;
|
| 364 |
}
|
| 365 |
|
| 366 |
+
.auditTime {
|
| 367 |
font-size: 10px;
|
| 368 |
+
font-weight: 800;
|
| 369 |
+
color: var(--text-main);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
}
|
| 371 |
|
| 372 |
+
.auditTimeSub {
|
| 373 |
font-size: 10px;
|
| 374 |
+
color: var(--text-muted);
|
|
|
|
| 375 |
}
|
| 376 |
|
| 377 |
+
.auditContentSide {
|
| 378 |
+
display: flex;
|
| 379 |
+
flex-direction: column;
|
| 380 |
+
gap: 4px;
|
| 381 |
+
min-width: 0;
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
.auditTitle {
|
| 385 |
+
font-size: 12px;
|
| 386 |
+
font-weight: 700;
|
| 387 |
+
color: var(--text-main);
|
| 388 |
+
white-space: nowrap;
|
| 389 |
+
overflow: hidden;
|
| 390 |
+
text-overflow: ellipsis;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
.auditAction {
|
| 394 |
+
font-size: 9px;
|
| 395 |
+
font-weight: 900;
|
| 396 |
+
color: var(--primary);
|
| 397 |
+
letter-spacing: 0.05em;
|
| 398 |
}
|
| 399 |
|
| 400 |
/* 8. Pulse Components */
|
|
|
|
| 485 |
}
|
| 486 |
|
| 487 |
/* Tooltip & Micro-interactions */
|
| 488 |
+
.chartTooltip {
|
| 489 |
+
position: absolute;
|
| 490 |
+
background: rgba(15, 23, 42, 0.95);
|
| 491 |
+
backdrop-filter: blur(8px);
|
| 492 |
+
padding: 10px 14px;
|
| 493 |
+
border-radius: 10px;
|
| 494 |
+
color: white;
|
| 495 |
+
pointer-events: none;
|
| 496 |
+
font-family: var(--font-mono);
|
| 497 |
+
z-index: 1000;
|
| 498 |
+
transform: translate(-50%, -100%);
|
| 499 |
+
border: 1px solid rgba(255, 255, 255, 0.15);
|
| 500 |
+
box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.4);
|
| 501 |
+
display: flex;
|
| 502 |
+
flex-direction: column;
|
| 503 |
+
gap: 4px;
|
| 504 |
+
white-space: nowrap;
|
| 505 |
+
transition: opacity 0.15s ease;
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
.tooltipDate {
|
| 509 |
+
font-size: 9px;
|
| 510 |
+
text-transform: uppercase;
|
| 511 |
+
color: #94A3B8;
|
| 512 |
+
letter-spacing: 0.08em;
|
| 513 |
+
font-weight: 700;
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
.tooltipValue {
|
| 517 |
+
font-size: 15px;
|
| 518 |
+
font-weight: 900;
|
| 519 |
+
display: flex;
|
| 520 |
+
align-items: baseline;
|
| 521 |
+
gap: 5px;
|
| 522 |
+
color: white;
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
.tooltipValue span {
|
| 526 |
+
font-size: 9px;
|
| 527 |
+
opacity: 0.7;
|
| 528 |
+
font-weight: 700;
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
.miniTrendContainer {
|
| 532 |
margin-left: auto;
|
| 533 |
}
|
frontend/apps/internal/src/components/AnalyticsDashboard.tsx
CHANGED
|
@@ -54,6 +54,9 @@ const AreaTrend = ({
|
|
| 54 |
height?: number,
|
| 55 |
staffNames?: string[]
|
| 56 |
}) => {
|
|
|
|
|
|
|
|
|
|
| 57 |
if (!data || data.length < 2) return <div style={{ height, background: 'rgba(255,255,255,0.02)', borderRadius: 8 }} />;
|
| 58 |
|
| 59 |
const width = 400;
|
|
@@ -79,8 +82,28 @@ const AreaTrend = ({
|
|
| 79 |
});
|
| 80 |
const maxVal = Math.max(...rawData, 1);
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
return (
|
| 83 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
<svg width="100%" height={height} viewBox={`0 0 ${width} ${height}`} preserveAspectRatio="none" style={{ overflow: 'visible' }}>
|
| 85 |
{staffNames.slice(0, 3).map((name, i) => (
|
| 86 |
<motion.path
|
|
@@ -117,6 +140,14 @@ const AreaTrend = ({
|
|
| 117 |
transition={{ repeat: Infinity, duration: 2, delay: i * 0.1 }}
|
| 118 |
/>
|
| 119 |
) : null)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
<motion.path
|
| 121 |
d={`M ${mainPoints} L ${width},${height} L 0,${height} Z`}
|
| 122 |
fill={`url(#gradient-${color.replace('#', '')})`}
|
|
@@ -131,6 +162,22 @@ const AreaTrend = ({
|
|
| 131 |
</linearGradient>
|
| 132 |
</defs>
|
| 133 |
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
</div>
|
| 135 |
);
|
| 136 |
};
|
|
@@ -153,7 +200,7 @@ const getCardInsight = (type: 'operational' | 'velocity' | 'thermal', data: any,
|
|
| 153 |
return "Synchronizing data cycles...";
|
| 154 |
};
|
| 155 |
|
| 156 |
-
export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspaceId, readOnly: _readOnly, onTicketSelect
|
| 157 |
const { stats, loading: statsLoading } = useDashboardStats(workspaceId);
|
| 158 |
const { daily, sla, staff, escalations, loading: reportsLoading } = useReports(workspaceId);
|
| 159 |
const { audit, loading: escLoading } = useEscalations(workspaceId);
|
|
@@ -335,10 +382,20 @@ export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspac
|
|
| 335 |
color="#F59E0B"
|
| 336 |
/>
|
| 337 |
<div className={styles.auditMiniList}>
|
| 338 |
-
{audit.slice(0,
|
| 339 |
-
<div
|
| 340 |
-
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
</div>
|
| 343 |
))}
|
| 344 |
</div>
|
|
|
|
| 54 |
height?: number,
|
| 55 |
staffNames?: string[]
|
| 56 |
}) => {
|
| 57 |
+
const [hoverIndex, setHoverIndex] = React.useState<number | null>(null);
|
| 58 |
+
const containerRef = React.useRef<HTMLDivElement>(null);
|
| 59 |
+
|
| 60 |
if (!data || data.length < 2) return <div style={{ height, background: 'rgba(255,255,255,0.02)', borderRadius: 8 }} />;
|
| 61 |
|
| 62 |
const width = 400;
|
|
|
|
| 82 |
});
|
| 83 |
const maxVal = Math.max(...rawData, 1);
|
| 84 |
|
| 85 |
+
const handleMouseMove = (e: React.MouseEvent) => {
|
| 86 |
+
if (!containerRef.current) return;
|
| 87 |
+
const rect = containerRef.current.getBoundingClientRect();
|
| 88 |
+
const x = e.clientX - rect.left;
|
| 89 |
+
const ratio = Math.max(0, Math.min(1, x / rect.width));
|
| 90 |
+
setHoverIndex(Math.round(ratio * (data.length - 1)));
|
| 91 |
+
};
|
| 92 |
+
|
| 93 |
+
const activePoint = hoverIndex !== null ? {
|
| 94 |
+
x: (hoverIndex / (data.length - 1)) * width,
|
| 95 |
+
y: height - (rawData[hoverIndex] / maxVal) * height,
|
| 96 |
+
data: data[hoverIndex]
|
| 97 |
+
} : null;
|
| 98 |
+
|
| 99 |
return (
|
| 100 |
+
<div
|
| 101 |
+
ref={containerRef}
|
| 102 |
+
className={styles.areaTrendWrapper}
|
| 103 |
+
style={{ height }}
|
| 104 |
+
onMouseMove={handleMouseMove}
|
| 105 |
+
onMouseLeave={() => setHoverIndex(null)}
|
| 106 |
+
>
|
| 107 |
<svg width="100%" height={height} viewBox={`0 0 ${width} ${height}`} preserveAspectRatio="none" style={{ overflow: 'visible' }}>
|
| 108 |
{staffNames.slice(0, 3).map((name, i) => (
|
| 109 |
<motion.path
|
|
|
|
| 140 |
transition={{ repeat: Infinity, duration: 2, delay: i * 0.1 }}
|
| 141 |
/>
|
| 142 |
) : null)}
|
| 143 |
+
|
| 144 |
+
{activePoint && (
|
| 145 |
+
<>
|
| 146 |
+
<line x1={activePoint.x} y1="0" x2={activePoint.x} y2={height} stroke={color} strokeWidth="1" strokeDasharray="4 2" opacity="0.4" />
|
| 147 |
+
<circle cx={activePoint.x} cy={activePoint.y} r="4" fill="white" stroke={color} strokeWidth="2" />
|
| 148 |
+
</>
|
| 149 |
+
)}
|
| 150 |
+
|
| 151 |
<motion.path
|
| 152 |
d={`M ${mainPoints} L ${width},${height} L 0,${height} Z`}
|
| 153 |
fill={`url(#gradient-${color.replace('#', '')})`}
|
|
|
|
| 162 |
</linearGradient>
|
| 163 |
</defs>
|
| 164 |
</svg>
|
| 165 |
+
|
| 166 |
+
{activePoint && (
|
| 167 |
+
<div
|
| 168 |
+
className={styles.chartTooltip}
|
| 169 |
+
style={{
|
| 170 |
+
left: `${(hoverIndex! / (data.length - 1)) * 100}%`,
|
| 171 |
+
top: activePoint.y - 12
|
| 172 |
+
}}
|
| 173 |
+
>
|
| 174 |
+
<div className={styles.tooltipDate}>{activePoint.data.label}</div>
|
| 175 |
+
<div className={styles.tooltipValue}>
|
| 176 |
+
{rawData[hoverIndex!].toFixed(0)}
|
| 177 |
+
<span>{valueKey.toUpperCase()}</span>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
)}
|
| 181 |
</div>
|
| 182 |
);
|
| 183 |
};
|
|
|
|
| 200 |
return "Synchronizing data cycles...";
|
| 201 |
};
|
| 202 |
|
| 203 |
+
export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspaceId, readOnly: _readOnly, onTicketSelect }) => {
|
| 204 |
const { stats, loading: statsLoading } = useDashboardStats(workspaceId);
|
| 205 |
const { daily, sla, staff, escalations, loading: reportsLoading } = useReports(workspaceId);
|
| 206 |
const { audit, loading: escLoading } = useEscalations(workspaceId);
|
|
|
|
| 382 |
color="#F59E0B"
|
| 383 |
/>
|
| 384 |
<div className={styles.auditMiniList}>
|
| 385 |
+
{audit.slice(0, 4).map((a: any) => (
|
| 386 |
+
<div
|
| 387 |
+
key={a.id}
|
| 388 |
+
className={styles.auditMiniItem}
|
| 389 |
+
onClick={() => onTicketSelect?.(a.entity_id)}
|
| 390 |
+
>
|
| 391 |
+
<div className={styles.auditMetaSide}>
|
| 392 |
+
<div className={styles.auditTime}>{new Date(a.created_at).toLocaleDateString([], { month: 'short', day: 'numeric' })}</div>
|
| 393 |
+
<div className={styles.auditTimeSub}>{new Date(a.created_at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</div>
|
| 394 |
+
</div>
|
| 395 |
+
<div className={styles.auditContentSide}>
|
| 396 |
+
<div className={styles.auditTitle}>{a.entity_title || `Ticket #${a.entity_id.slice(0,6)}`}</div>
|
| 397 |
+
<div className={styles.auditAction}>{a.action.replace('_', ' ').toUpperCase()}</div>
|
| 398 |
+
</div>
|
| 399 |
</div>
|
| 400 |
))}
|
| 401 |
</div>
|
schemas/escalation.py
CHANGED
|
@@ -38,6 +38,7 @@ class AuditLogResponse(BaseModel):
|
|
| 38 |
workspace_id: UUID
|
| 39 |
entity_type: str
|
| 40 |
entity_id: UUID
|
|
|
|
| 41 |
action: str
|
| 42 |
user_id: Optional[UUID] = None
|
| 43 |
old_value: Optional[dict] = None
|
|
|
|
| 38 |
workspace_id: UUID
|
| 39 |
entity_type: str
|
| 40 |
entity_id: UUID
|
| 41 |
+
entity_title: Optional[str] = None
|
| 42 |
action: str
|
| 43 |
user_id: Optional[UUID] = None
|
| 44 |
old_value: Optional[dict] = None
|