The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
Archive + Trend graph
dduxc4b522524796
diff --git a/backend/app/controllers/dashboard.controller.go b/backend/app/controllers/dashboard.controller.goindex 74494948..baffd2d5 100644--- a/backend/app/controllers/dashboard.controller.go+++ b/backend/app/controllers/dashboard.controller.go@@ -23,7 +23,7 @@ func (d dashboardController) GetDashboardOverview(c *gin.Context) {start := now.Add(-24 * time.Hour)// Get last 10 issues in the last 24 hours- recentIssues, _, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, projectId, start, now, 1, 10, "last_seen", "")+ recentIssues, _, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, projectId, start, now, 1, 10, "last_seen", "", false)if err != nil {panic(err)}diff --git a/backend/app/controllers/exception_stack_trace.controller.go b/backend/app/controllers/exception_stack_trace.controller.goindex f6a5fa3b..50b6bc15 100644--- a/backend/app/controllers/exception_stack_trace.controller.go+++ b/backend/app/controllers/exception_stack_trace.controller.go@@ -13,12 +13,18 @@ import (type exceptionStackTraceController struct{}type ExceptionSearchRequest struct {- ProjectId string `json:"projectId"`- FromDate time.Time `json:"fromDate"`- ToDate time.Time `json:"toDate"`- OrderBy string `json:"orderBy"`- Pagination PaginationParams `json:"pagination"`- Search string `json:"search"`+ ProjectId string `json:"projectId"`+ FromDate time.Time `json:"fromDate"`+ ToDate time.Time `json:"toDate"`+ OrderBy string `json:"orderBy"`+ Pagination PaginationParams `json:"pagination"`+ Search string `json:"search"`+ IncludeArchived bool `json:"includeArchived"`+}++type ArchiveRequest struct {+ ProjectId string `json:"projectId"`+ Hashes []string `json:"hashes"`}type ExceptionDetailRequest struct {@@ -39,11 +45,37 @@ func (e exceptionStackTraceController) FindGrouppedExceptionStackTraces(c *gin.Creturn}- exceptions, total, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, request.ProjectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.Search)+ exceptions, total, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, request.ProjectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.Search, request.IncludeArchived)if err != nil {panic(err)}+ // Get hourly trends for all returned exception hashes (last 24 hours)+ if len(exceptions) > 0 {+ hashes := make([]string, len(exceptions))+ for i, ex := range exceptions {+ hashes[i] = ex.ExceptionHash+ }++ // Calculate 24-hour window+ now := time.Now()+ start24h := now.Add(-24 * time.Hour)++ trends, err := repositories.ExceptionStackTraceRepository.GetHourlyTrendForHashes(c, request.ProjectId, hashes, start24h, now)+ if err != nil {+ panic(err)+ }++ // Attach trends to each exception group+ for i := range exceptions {+ if trend, ok := trends[exceptions[i].ExceptionHash]; ok {+ exceptions[i].HourlyTrend = trend+ } else {+ exceptions[i].HourlyTrend = []models.ExceptionTrendPoint{}+ }+ }+ }+c.JSON(http.StatusOK, PaginatedResponse[models.ExceptionGroup]{Data: exceptions,Pagination: Pagination{@@ -89,4 +121,44 @@ func (e exceptionStackTraceController) FindByHash(c *gin.Context) {})}+func (e exceptionStackTraceController) ArchiveExceptions(c *gin.Context) {+ var request ArchiveRequest+ if err := c.ShouldBindJSON(&request); err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})+ return+ }++ if len(request.Hashes) == 0 {+ c.JSON(http.StatusBadRequest, gin.H{"error": "hashes array is required"})+ return+ }++ err := repositories.ExceptionStackTraceRepository.ArchiveByHashes(c, request.ProjectId, request.Hashes)+ if err != nil {+ panic(err)+ }++ c.JSON(http.StatusOK, gin.H{"archived": len(request.Hashes)})+}++func (e exceptionStackTraceController) UnarchiveExceptions(c *gin.Context) {+ var request ArchiveRequest+ if err := c.ShouldBindJSON(&request); err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})+ return+ }++ if len(request.Hashes) == 0 {+ c.JSON(http.StatusBadRequest, gin.H{"error": "hashes array is required"})+ return+ }++ err := repositories.ExceptionStackTraceRepository.UnarchiveByHashes(c, request.ProjectId, request.Hashes)+ if err != nil {+ panic(err)+ }++ c.JSON(http.StatusOK, gin.H{"unarchived": len(request.Hashes)})+}+var ExceptionStackTraceController = exceptionStackTraceController{}diff --git a/backend/app/controllers/routes.go b/backend/app/controllers/routes.goindex 61a0bfdb..60c97fca 100644--- a/backend/app/controllers/routes.go+++ b/backend/app/controllers/routes.go@@ -40,6 +40,8 @@ func RegisterControllers(router *gin.RouterGroup) {router.POST("/transactions/grouped", middleware.UseAppAuth, TransactionController.FindGroupedByEndpoint)router.POST("/transactions/endpoint", middleware.UseAppAuth, TransactionController.FindByEndpoint)router.POST("/exception-stack-traces", middleware.UseAppAuth, ExceptionStackTraceController.FindGrouppedExceptionStackTraces)+ router.POST("/exception-stack-traces/archive", middleware.UseAppAuth, ExceptionStackTraceController.ArchiveExceptions)+ router.POST("/exception-stack-traces/unarchive", middleware.UseAppAuth, ExceptionStackTraceController.UnarchiveExceptions)router.POST("/exception-stack-traces/:hash", middleware.UseAppAuth, ExceptionStackTraceController.FindByHash)// Authdiff --git a/backend/app/migrations/ch/0012_add_archived_exceptions.down.sql b/backend/app/migrations/ch/0012_add_archived_exceptions.down.sqlnew file mode 100644index 00000000..84c948ba--- /dev/null+++ b/backend/app/migrations/ch/0012_add_archived_exceptions.down.sql@@ -0,0 +1 @@+DROP TABLE IF EXISTS archived_exceptions;diff --git a/backend/app/migrations/ch/0012_add_archived_exceptions.up.sql b/backend/app/migrations/ch/0012_add_archived_exceptions.up.sqlnew file mode 100644index 00000000..529049f8--- /dev/null+++ b/backend/app/migrations/ch/0012_add_archived_exceptions.up.sql@@ -0,0 +1,6 @@+CREATE TABLE IF NOT EXISTS archived_exceptions (+ project_id String,+ exception_hash String,+ archived_at DateTime DEFAULT now()+) ENGINE = ReplacingMergeTree(archived_at)+ORDER BY (project_id, exception_hash);diff --git a/backend/app/models/exception_stack_trace.model.go b/backend/app/models/exception_stack_trace.model.goindex 08910f1a..a02d763c 100644--- a/backend/app/models/exception_stack_trace.model.go+++ b/backend/app/models/exception_stack_trace.model.go@@ -11,10 +11,16 @@ type ExceptionStackTrace struct {Scope map[string]string `json:"scope" ch:"scope"`}+type ExceptionTrendPoint struct {+ Timestamp time.Time `json:"timestamp"`+ Count uint64 `json:"count"`+}+type ExceptionGroup struct {- ExceptionHash string `json:"exceptionHash" ch:"exception_hash"`- StackTrace string `json:"stackTrace" ch:"stack_trace"`- LastSeen time.Time `json:"lastSeen" ch:"last_seen"`- FirstSeen time.Time `json:"firstSeen" ch:"first_seen"`- Count uint64 `json:"count" ch:"count"`+ ExceptionHash string `json:"exceptionHash" ch:"exception_hash"`+ StackTrace string `json:"stackTrace" ch:"stack_trace"`+ LastSeen time.Time `json:"lastSeen" ch:"last_seen"`+ FirstSeen time.Time `json:"firstSeen" ch:"first_seen"`+ Count uint64 `json:"count" ch:"count"`+ HourlyTrend []ExceptionTrendPoint `json:"hourlyTrend,omitempty"`}diff --git a/backend/app/repositories/exception_stack_trace.repository.go b/backend/app/repositories/exception_stack_trace.repository.goindex 2985fb9b..1a6ba0fa 100644--- a/backend/app/repositories/exception_stack_trace.repository.go+++ b/backend/app/repositories/exception_stack_trace.repository.go@@ -38,7 +38,7 @@ func (e *exceptionStackTraceRepository) CountBetween(ctx context.Context, projecreturn int64(count), err}-func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, search string) ([]models.ExceptionGroup, int64, error) {+func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, search string, includeArchived bool) ([]models.ExceptionGroup, int64, error) {offset := (page - 1) * pageSizeallowedOrderBy := map[string]bool{@@ -51,7 +51,7 @@ func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectorderBy = "count"}- // Build WHERE clause dynamically based on search+ // Build WHERE clause dynamically based on search and archive filterwhereClause := "project_id = ? AND recorded_at >= ? AND recorded_at <= ?"args := []interface{}{projectId, fromDate, toDate}@@ -60,6 +60,12 @@ func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectargs = append(args, search)}+ // Filter out archived exceptions unless includeArchived is true+ if !includeArchived {+ whereClause += " AND exception_hash NOT IN (SELECT exception_hash FROM archived_exceptions FINAL WHERE project_id = ?)"+ args = append(args, projectId)+ }+// Count unique hashes with search filtercountQuery := "SELECT uniq(exception_hash) FROM exception_stack_traces WHERE " + whereClausevar count uint64@@ -159,4 +165,81 @@ func (e *exceptionStackTraceRepository) CountByHour(ctx context.Context, projectreturn points, nil}+// GetHourlyTrendForHashes returns hourly counts for specific exception hashes+func (e *exceptionStackTraceRepository) GetHourlyTrendForHashes(ctx context.Context, projectId string, hashes []string, start, end time.Time) (map[string][]models.ExceptionTrendPoint, error) {+ if len(hashes) == 0 {+ return make(map[string][]models.ExceptionTrendPoint), nil+ }++ query := `SELECT+ exception_hash,+ toStartOfHour(recorded_at) as hour,+ count() as count+ FROM exception_stack_traces+ WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ? AND exception_hash IN (?)+ GROUP BY exception_hash, hour+ ORDER BY exception_hash, hour ASC`++ rows, err := (*chdb.Conn).Query(ctx, query, projectId, start, end, hashes)+ if err != nil {+ return nil, err+ }+ defer rows.Close()++ result := make(map[string][]models.ExceptionTrendPoint)+ for rows.Next() {+ var hash string+ var point models.ExceptionTrendPoint+ if err := rows.Scan(&hash, &point.Timestamp, &point.Count); err != nil {+ return nil, err+ }+ result[hash] = append(result[hash], point)+ }++ return result, nil+}++// ArchiveByHashes archives exceptions by their hashes+func (e *exceptionStackTraceRepository) ArchiveByHashes(ctx context.Context, projectId string, hashes []string) error {+ if len(hashes) == 0 {+ return nil+ }++ batch, err := (*chdb.Conn).PrepareBatch(ctx, "INSERT INTO archived_exceptions (project_id, exception_hash)")+ if err != nil {+ return err+ }++ for _, hash := range hashes {+ if err := batch.Append(projectId, hash); err != nil {+ return err+ }+ }++ return batch.Send()+}++// UnarchiveByHashes removes exceptions from the archive+func (e *exceptionStackTraceRepository) UnarchiveByHashes(ctx context.Context, projectId string, hashes []string) error {+ if len(hashes) == 0 {+ return nil+ }++ // In ClickHouse, we use ALTER TABLE DELETE for removing rows+ query := "ALTER TABLE archived_exceptions DELETE WHERE project_id = ? AND exception_hash IN (?)"+ return (*chdb.Conn).Exec(ctx, query, projectId, hashes)+}++// IsArchived checks if a specific exception hash is archived+func (e *exceptionStackTraceRepository) IsArchived(ctx context.Context, projectId string, hash string) (bool, error) {+ var count uint64+ err := (*chdb.Conn).QueryRow(ctx,+ "SELECT count() FROM archived_exceptions FINAL WHERE project_id = ? AND exception_hash = ?",+ projectId, hash).Scan(&count)+ if err != nil {+ return false, err+ }+ return count > 0, nil+}+var ExceptionStackTraceRepository = exceptionStackTraceRepository{}diff --git a/frontend/src/lib/components/issue-trend-chart.svelte b/frontend/src/lib/components/issue-trend-chart.sveltenew file mode 100644index 00000000..c1294a21--- /dev/null+++ b/frontend/src/lib/components/issue-trend-chart.svelte@@ -0,0 +1,106 @@+<script lang="ts">+ import * as Tooltip from "$lib/components/ui/tooltip";++ type TrendPoint = { timestamp: string; count: number };++ let { trend = [] }: {+ trend: TrendPoint[];+ } = $props();++ // Always 24 hours+ const HOURS = 24;+ const SCALE_MAX = 10; // Visual scale max - bars are relative to this++ // Build 24-hour data array, filling gaps with 0+ const hourlyData = $derived(() => {+ const now = new Date();+ const result: { hour: Date; count: number }[] = [];++ // Create a map of hour -> count from trend data+ const trendMap = new Map<string, number>();+ for (const point of trend) {+ const date = new Date(point.timestamp);+ const key = `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getHours()}`;+ trendMap.set(key, (trendMap.get(key) || 0) + point.count);+ }++ // Generate last 24 hours+ for (let i = HOURS - 1; i >= 0; i--) {+ const hour = new Date(now);+ hour.setMinutes(0, 0, 0);+ hour.setHours(hour.getHours() - i);+ const key = `${hour.getFullYear()}-${hour.getMonth()}-${hour.getDate()}-${hour.getHours()}`;+ result.push({+ hour,+ count: trendMap.get(key) || 0+ });+ }++ return result;+ });++ // Actual max from data+ const actualMax = $derived(() => {+ return Math.max(...hourlyData().map(d => d.count), 0);+ });++ // Scale max - at least SCALE_MAX, or higher if data exceeds it+ const scaleMax = $derived(() => {+ return Math.max(SCALE_MAX, actualMax());+ });++ // Dashed line position as percentage from bottom (actual max relative to scale max)+ const linePositionPct = $derived(() => {+ if (actualMax() === 0) return 0;+ return (actualMax() / scaleMax()) * 100;+ });+</script>++<div class="relative h-7 w-44 flex-shrink-0">+ <!-- Solid bottom line -->+ <div class="absolute left-0 right-7 bottom-0 border-t border-muted-foreground/40"></div>++ <!-- Dashed line at actual max -->+ {#if actualMax() > 0}+ <div+ class="absolute left-0 right-7 h-[1px]"+ style="bottom: {linePositionPct()}%; background: repeating-linear-gradient(to right, var(--muted-foreground) 0, var(--muted-foreground) 4px, transparent 4px, transparent 7px); opacity: 0.5;"+ ></div>+ <!-- Max count label -->+ <span+ class="absolute right-1 text-[10px] w-[20px] text-muted-foreground tabular-nums"+ style="bottom: calc({linePositionPct()}% - 6px);"+ >+ {actualMax() > 999 ? (actualMax()/1000).toFixed(1) + "k" : actualMax()}+ </span>+ {/if}++ <!-- Bars container -->+ <div class="absolute inset-0 right-7 flex items-end gap-[1px]">+ {#each hourlyData() as point, i (i)}+ {@const heightPct = scaleMax() > 0 ? (point.count / scaleMax()) * 100 : 0}+ {@const hasEvents = point.count > 0}+ <Tooltip.Root>+ <Tooltip.Trigger class="flex-1 h-full flex items-end justify-center">+ <div+ class="w-full max-w-[4px] rounded-[1px] transition-colors {hasEvents ? 'hover:opacity-80' : ''}"+ style="height: {Math.max(2, heightPct)}%;{hasEvents ? ' background-color: var(--sidebar-accent);' : ''}"+ ></div>+ </Tooltip.Trigger>+ <Tooltip.Content side="top" class="py-2 px-3 !animate-none !transition-none">+ <div class="font-medium text-sm">{point.count} {point.count === 1 ? 'Event' : 'Events'}</div>+ <div class="text-muted-foreground text-xs">+ {point.hour.toLocaleString(undefined, {+ month: 'short',+ day: 'numeric',+ year: 'numeric',+ hour: 'numeric',+ minute: '2-digit',+ timeZoneName: 'short'+ })}+ </div>+ </Tooltip.Content>+ </Tooltip.Root>+ {/each}+ </div>+</div>diff --git a/frontend/src/lib/components/ui/checkbox/checkbox.svelte b/frontend/src/lib/components/ui/checkbox/checkbox.sveltenew file mode 100644index 00000000..846ae591--- /dev/null+++ b/frontend/src/lib/components/ui/checkbox/checkbox.svelte@@ -0,0 +1,69 @@+<script lang="ts">+ import { Checkbox as CheckboxPrimitive } from "bits-ui";+ import CheckIcon from "@lucide/svelte/icons/check";+ import MinusIcon from "@lucide/svelte/icons/minus";+ import { cn } from "$lib/utils.js";++ type CheckedState = boolean | "indeterminate";++ let {+ ref = $bindable(null),+ checked = $bindable<CheckedState>(false),+ onCheckedChange,+ class: className,+ disabled = false,+ ...restProps+ }: {+ ref?: HTMLButtonElement | null;+ checked?: CheckedState;+ onCheckedChange?: (checked: CheckedState) => void;+ class?: string;+ disabled?: boolean;+ "aria-label"?: string;+ } = $props();++ // Split checked state into checked and indeterminate for bits-ui+ const isChecked = $derived(checked === true);+ const isIndeterminate = $derived(checked === "indeterminate");++ function handleCheckedChange(value: boolean) {+ const newState: CheckedState = value;+ checked = newState;+ onCheckedChange?.(newState);+ }++ function handleIndeterminateChange(value: boolean) {+ if (value) {+ checked = "indeterminate";+ onCheckedChange?.("indeterminate");+ }+ }+</script>++<CheckboxPrimitive.Root+ bind:ref+ checked={isChecked}+ indeterminate={isIndeterminate}+ onCheckedChange={handleCheckedChange}+ onIndeterminateChange={handleIndeterminateChange}+ {disabled}+ class={cn(+ "peer size-4 shrink-0 rounded-[4px] border border-input bg-background shadow-sm transition-colors",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ "disabled:cursor-not-allowed disabled:opacity-50",+ "data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground",+ "data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground",+ className+ )}+ {...restProps}+>+ {#snippet children({ checked: isOn, indeterminate })}+ <span class="flex items-center justify-center text-current">+ {#if indeterminate}+ <MinusIcon class="size-3" />+ {:else if isOn}+ <CheckIcon class="size-3" />+ {/if}+ </span>+ {/snippet}+</CheckboxPrimitive.Root>diff --git a/frontend/src/lib/components/ui/checkbox/index.ts b/frontend/src/lib/components/ui/checkbox/index.tsnew file mode 100644index 00000000..396cf9cb--- /dev/null+++ b/frontend/src/lib/components/ui/checkbox/index.ts@@ -0,0 +1 @@+export { default as Checkbox } from "./checkbox.svelte";diff --git a/frontend/src/lib/components/ui/tooltip/tooltip-content.svelte b/frontend/src/lib/components/ui/tooltip/tooltip-content.svelteindex 2f938067..ef046969 100644--- a/frontend/src/lib/components/ui/tooltip/tooltip-content.svelte+++ b/frontend/src/lib/components/ui/tooltip/tooltip-content.svelte@@ -27,7 +27,7 @@{sideOffset}{side}class={cn(- "bg-white text-foreground shadow-[0_0_12px_rgba(0,0,0,0.15)] dark:bg-foreground dark:text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-[220px] origin-(--bits-tooltip-content-transform-origin) rounded-sm px-3 py-2 text-xs",+ "bg-white text-foreground shadow-[0_2px_16px_rgba(0,0,0,0.25)] dark:bg-foreground dark:text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-[220px] origin-(--bits-tooltip-content-transform-origin) rounded-sm px-3 py-2 text-xs",className)}{...restProps}diff --git a/frontend/src/routes/issues/+page.svelte b/frontend/src/routes/issues/+page.svelteindex b14f490e..d1b8ec64 100644--- a/frontend/src/routes/issues/+page.svelte+++ b/frontend/src/routes/issues/+page.svelte@@ -7,7 +7,15 @@import { Button } from "$lib/components/ui/button";import * as Select from "$lib/components/ui/select";import { Skeleton } from "$lib/components/ui/skeleton";+ import { Checkbox } from "$lib/components/ui/checkbox";import { projectsState } from '$lib/state/projects.svelte';+ import IssueTrendChart from '$lib/components/issue-trend-chart.svelte';+ import Archive from "@lucide/svelte/icons/archive";++ type ExceptionTrendPoint = {+ timestamp: string;+ count: number;+ };type ExceptionGroup = {exceptionHash: string;@@ -15,18 +23,27 @@lastSeen: string;firstSeen: string;count: number;+ hourlyTrend: ExceptionTrendPoint[];};let exceptions = $state<ExceptionGroup[]>([]);let loading = $state(true);let error = $state('');+ let archiving = $state(false);// Pagination Statelet page = $state(1);let pageSize = $state(10);let total = $state(0);let totalPages = $state(0);- let selectedCount = $state(0); // For row selection tracking++ // Selection State+ let selectedHashes = $state<Set<string>>(new Set());++ // Derived selection states+ const selectedCount = $derived(selectedHashes.size);+ const allSelected = $derived(exceptions.length > 0 && selectedHashes.size === exceptions.length);+ const someSelected = $derived(selectedHashes.size > 0 && selectedHashes.size < exceptions.length);// Filterslet searchQuery = $state('');@@ -50,6 +67,7 @@const daysBackLabel = $derived(daysOptions.find(o => o.value === daysBack)?.label ?? "Select period");const pageSizeLabel = $derived(pageSizeOptions.find(o => o.value === pageSize.toString())?.label ?? pageSize.toString());+async function loadData() {loading = true;error = '';@@ -67,7 +85,8 @@page: page,pageSize: pageSize},- search: searchQuery.trim()+ search: searchQuery.trim(),+ includeArchived: false};const response = await api.post('/exception-stack-traces', requestBody, { projectId: projectsState.currentProjectId ?? undefined });@@ -76,6 +95,9 @@total = response.pagination.total;totalPages = response.pagination.totalPages;+ // Clear selection when data changes+ selectedHashes = new Set();+} catch (e: any) {console.error(e);error = e.message || 'Failed to load data';@@ -84,12 +106,6 @@}}- // $effect(() => {- // if (page || daysBack) {- // loadData();- // }- // });-function handlePageChange(newPage: number) {if (newPage >= 1 && newPage <= totalPages) {page = newPage;@@ -99,7 +115,7 @@function handlePageSizeChange(newPageSize: string) {pageSize = parseInt(newPageSize);- page = 1; // Reset to first page when changing page size+ page = 1;loadData();}@@ -109,11 +125,54 @@function handleSearchInput() {if (searchTimeout) clearTimeout(searchTimeout);searchTimeout = setTimeout(() => {- page = 1; // Reset to page 1 on new search+ page = 1;loadData();}, 300);}+ // Selection handlers+ function toggleSelectAll() {+ if (allSelected) {+ selectedHashes = new Set();+ } else {+ selectedHashes = new Set(exceptions.map(e => e.exceptionHash));+ }+ }++ function toggleSelect(hash: string) {+ const newSet = new Set(selectedHashes);+ if (newSet.has(hash)) {+ newSet.delete(hash);+ } else {+ newSet.add(hash);+ }+ selectedHashes = newSet;+ }++ function isSelected(hash: string): boolean {+ return selectedHashes.has(hash);+ }++ // Archive handler+ async function archiveSelected() {+ if (selectedHashes.size === 0) return;++ archiving = true;+ try {+ await api.post('/exception-stack-traces/archive', {+ hashes: Array.from(selectedHashes)+ }, { projectId: projectsState.currentProjectId ?? undefined });++ selectedHashes = new Set();+ await loadData();+ } catch (e: any) {+ console.error('Archive failed:', e);+ error = e.message || 'Failed to archive issues';+ } finally {+ archiving = false;+ }+ }+onMount(() => {loadData();});@@ -152,50 +211,105 @@</div></div>+ <!-- Archive Toolbar - shown when items selected -->+ {#if selectedCount > 0}+ <div class="flex items-center gap-3 p-3 bg-muted/50 border rounded-lg animate-in fade-in slide-in-from-top-1 duration-200">+ <span class="text-sm font-medium">{selectedCount} issue{selectedCount === 1 ? '' : 's'} selected</span>+ <Button+ variant="outline"+ size="sm"+ onclick={archiveSelected}+ disabled={archiving}+ class="gap-1.5"+ >+ <Archive class="h-4 w-4" />+ {archiving ? 'Archiving...' : 'Archive'}+ </Button>+ <Button+ variant="ghost"+ size="sm"+ onclick={() => selectedHashes = new Set()}+ >+ Clear selection+ </Button>+ </div>+ {/if}+<div class="rounded-md border overflow-hidden"><Table.Root><Table.Header><Table.Row>- <Table.Head class="w-[30px]"></Table.Head>+ <Table.Head class="w-[40px] pl-4">+ <Checkbox+ checked={allSelected ? true : someSelected ? "indeterminate" : false}+ onCheckedChange={toggleSelectAll}+ aria-label="Select all"+ />+ </Table.Head><Table.Head>Issue</Table.Head>- <Table.Head class="w-[100px]">Count</Table.Head>- <Table.Head class="w-[200px]">Last Seen</Table.Head>+ <Table.Head class="w-[190px]">Trend</Table.Head>+ <Table.Head class="w-[80px] text-right">Events</Table.Head>+ <Table.Head class="w-[180px]">Last Seen</Table.Head></Table.Row></Table.Header><Table.Body>{#if loading}{#each Array(5) as _}<Table.Row>- <Table.Cell><Skeleton class="h-4 w-[30px]" /></Table.Cell>+ <Table.Cell class="pl-4"><Skeleton class="h-4 w-4" /></Table.Cell><Table.Cell><Skeleton class="h-4 w-[250px]" /></Table.Cell>- <Table.Cell><Skeleton class="h-4 w-[40px]" /></Table.Cell>- <Table.Cell><Skeleton class="h-4 w-[150px]" /></Table.Cell>+ <Table.Cell><Skeleton class="h-7 w-[176px]" /></Table.Cell>+ <Table.Cell><Skeleton class="h-4 w-[40px] ml-auto" /></Table.Cell>+ <Table.Cell><Skeleton class="h-4 w-[120px]" /></Table.Cell></Table.Row>{/each}{:else if error}<Table.Row>- <Table.Cell colspan={4} class="h-24 text-center text-red-500">+ <Table.Cell colspan={5} class="h-24 text-center text-red-500">{error}</Table.Cell></Table.Row>{:else if exceptions.length === 0}<Table.Row>- <Table.Cell colspan={4} class="h-24 text-center">+ <Table.Cell colspan={5} class="h-24 text-center text-muted-foreground">No issues found.</Table.Cell></Table.Row>{:else}- {#each exceptions as exception}+ {#each exceptions as exception (exception.exceptionHash)}<Table.Row- class="cursor-pointer hover:bg-muted/50"- onclick={() => goto(`/issues/${exception.exceptionHash}`)}+ class="cursor-pointer hover:bg-muted/50 group"+ data-state={isSelected(exception.exceptionHash) ? "selected" : undefined}>- <Table.Cell class="font-medium truncate max-w-[30px]"></Table.Cell>- <Table.Cell class="truncate" title={exception.stackTrace}>- {exception.stackTrace.split('\n')[0]}+ <Table.Cell class="pl-4" onclick={(e) => e.stopPropagation()}>+ <Checkbox+ checked={isSelected(exception.exceptionHash)}+ onCheckedChange={() => toggleSelect(exception.exceptionHash)}+ aria-label="Select row"+ />+ </Table.Cell>+ <Table.Cell+ class="font-mono text-sm truncate max-w-[400px]"+ title={exception.stackTrace}+ onclick={() => goto(`/issues/${exception.exceptionHash}`)}+ >+ <span class="text-foreground">{exception.stackTrace.split('\n')[0]}</span>+ </Table.Cell>+ <Table.Cell onclick={() => goto(`/issues/${exception.exceptionHash}`)}>+ <IssueTrendChart trend={exception.hourlyTrend || []} />+ </Table.Cell>+ <Table.Cell+ class="text-right tabular-nums font-medium"+ onclick={() => goto(`/issues/${exception.exceptionHash}`)}+ >+ {exception.count.toLocaleString()}+ </Table.Cell>+ <Table.Cell+ class="text-muted-foreground"+ onclick={() => goto(`/issues/${exception.exceptionHash}`)}+ >+ {new Date(exception.lastSeen).toLocaleString()}</Table.Cell>- <Table.Cell>{exception.count}</Table.Cell>- <Table.Cell>{new Date(exception.lastSeen).toLocaleString()}</Table.Cell></Table.Row>{/each}{/if}@@ -206,7 +320,11 @@<!-- Pagination Footer --><div class="flex items-center justify-between px-2"><div class="flex-1 text-sm text-muted-foreground">- {selectedCount} of {total} row(s) selected.+ {#if selectedCount > 0}+ {selectedCount} of {total} row(s) selected.+ {:else}+ {total} issue{total === 1 ? '' : 's'} total+ {/if}</div><div class="flex items-center space-x-6 lg:space-x-8"><div class="flex items-center space-x-2">