-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtask.dashboard.ts
More file actions
125 lines (119 loc) · 4.79 KB
/
Copy pathtask.dashboard.ts
File metadata and controls
125 lines (119 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import type { Dashboard } from '@objectstack/spec/ui';
/**
* Task Overview dashboard.
*
* ADR-0021 Phase 2: every widget is bound to the `task_metrics` dataset
* (`dataset` + `dimensions` + `values`, measures/dimensions referenced BY NAME)
* so the numbers stay consistent with every other surface. The legacy inline
* query (`object` + `categoryField` + `valueField` + `aggregate` + `filter`) is
* retained side-by-side during the dual-form window — the reconciliation
* harness asserts the two forms return identical numbers before the inline
* form is removed (see scripts/analytics-reconcile). The widget `filter`
* doubles as the dataset-bound `runtimeFilter` (presentation scope).
*/
export const TaskDashboard: Dashboard = {
name: 'task_dashboard',
label: 'Task Overview',
description: 'Key task metrics and productivity overview',
widgets: [
// Row 1: Key Metrics
{
id: 'total_tasks',
title: 'Total Tasks',
type: 'metric',
dataset: 'task_metrics',
values: ['task_count'],
layout: { x: 0, y: 0, w: 3, h: 2 },
options: { color: '#3B82F6' }
},
{
id: 'completed_today',
title: 'Completed Today',
type: 'metric',
filter: { is_completed: true, completed_date: { $gte: '{today}' } },
dataset: 'task_metrics',
values: ['task_count'],
layout: { x: 3, y: 0, w: 3, h: 2 },
options: { color: '#10B981' }
},
{
id: 'overdue_tasks',
title: 'Overdue Tasks',
type: 'metric',
filter: { is_overdue: true, is_completed: false },
dataset: 'task_metrics',
values: ['task_count'],
layout: { x: 6, y: 0, w: 3, h: 2 },
options: { color: '#EF4444' }
},
{
id: 'completion_rate',
title: 'Completion Rate',
type: 'metric',
filter: { created_at: { $gte: '{current_week_start}' } },
dataset: 'task_metrics',
values: ['task_count'],
layout: { x: 9, y: 0, w: 3, h: 2 },
options: { suffix: '%', color: '#8B5CF6' }
},
// Row 2: Task Distribution
// chartConfig axis fields name the dataset's dimension/measure — query
// rows are keyed by measure NAME post-cutover (issue #1721).
{
id: 'tasks_by_status',
title: 'Tasks by Status',
type: 'pie',
filter: { is_completed: false },
dataset: 'task_metrics',
dimensions: ['status'],
values: ['task_count'],
chartConfig: { type: 'pie', xAxis: { field: 'status', showGridLines: true, logarithmic: false }, yAxis: [{ field: 'task_count', showGridLines: true, logarithmic: false }], showLegend: true, showDataLabels: false },
layout: { x: 0, y: 2, w: 6, h: 4 },
options: { showLegend: true }
},
{
id: 'tasks_by_priority',
title: 'Tasks by Priority',
type: 'bar',
filter: { is_completed: false },
dataset: 'task_metrics',
dimensions: ['priority'],
values: ['task_count'],
chartConfig: { type: 'bar', xAxis: { field: 'priority', showGridLines: true, logarithmic: false }, yAxis: [{ field: 'task_count', showGridLines: true, logarithmic: false }], showLegend: true, showDataLabels: false },
layout: { x: 6, y: 2, w: 6, h: 4 },
options: { horizontal: true }
},
// Row 3: Trends
{
id: 'weekly_task_completion',
title: 'Weekly Task Completion',
type: 'line',
filter: { is_completed: true, completed_date: { $gte: '{4_weeks_ago}' } },
dataset: 'task_metrics',
dimensions: ['completed_date'],
values: ['task_count'],
chartConfig: { type: 'line', xAxis: { field: 'completed_date', showGridLines: true, logarithmic: false }, yAxis: [{ field: 'task_count', showGridLines: true, logarithmic: false }], showLegend: true, showDataLabels: false },
layout: { x: 0, y: 6, w: 8, h: 4 },
options: { showDataLabels: true }
},
{
id: 'tasks_by_category',
title: 'Tasks by Category',
type: 'donut',
filter: { is_completed: false },
dataset: 'task_metrics',
dimensions: ['category'],
values: ['task_count'],
chartConfig: { type: 'donut', xAxis: { field: 'category', showGridLines: true, logarithmic: false }, yAxis: [{ field: 'task_count', showGridLines: true, logarithmic: false }], showLegend: true, showDataLabels: false },
layout: { x: 8, y: 6, w: 4, h: 4 },
options: { showLegend: true }
},
// The former Row 4 count-only `table` widgets (`overdue_tasks_table`,
// `due_today`) rendered a single summary row, not the record listing
// they intended (#1719). Those listings live as ListViews on
// `todo_task` (`overdue`, `due_today` — ADR-0017), reachable from the
// app navigation; the `overdue_tasks` / `completed_today` metric
// widgets above keep the counts.
],
};