Skip to content

Commit 5867083

Browse files
os-zhuangclaude
andcommitted
fix(app-todo): re-model count-only dashboard tables as ListViews (#1719)
The `overdue_tasks_table` and `due_today` dashboard widgets were `type: 'table'` widgets bound to the `task_metrics` dataset selecting only the `task_count` count measure with no dimensions — a single summary row, not the per-record listing they intended. `objectstack validate`/`build` flagged both with the `table-count-only` warning. Per ADR-0017, model record listings as object-bound ListViews surfaced through app navigation (the same fix class as objectstack-ai/templates#27): - views: add a `due_today` grid ListView on `todo_task` filtered to `due_date = {today}` and incomplete; the `overdue` ListView already existed from the ADR-0021 Phase 2 report conversion. - app: point the existing "Overdue" / "Due Today" nav items at the views via `viewName`. - dashboard: drop the two table widgets; counts stay covered by the `overdue_tasks` / `completed_today` metric widgets. `objectstack validate` and `build` now pass with no warnings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent ad7046a commit 5867083

3 files changed

Lines changed: 33 additions & 21 deletions

File tree

examples/app-todo/src/apps/todo.app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export const TodoApp = App.create({
2121
children: [
2222
{ id: 'nav_all_tasks', type: 'object', objectName: 'todo_task', label: 'All Tasks', icon: 'list' },
2323
{ id: 'nav_my_tasks', type: 'object', objectName: 'todo_task', label: 'My Tasks', icon: 'user-check' },
24-
{ id: 'nav_overdue', type: 'object', objectName: 'todo_task', label: 'Overdue', icon: 'alert-circle' },
25-
{ id: 'nav_today', type: 'object', objectName: 'todo_task', label: 'Due Today', icon: 'calendar' },
24+
{ id: 'nav_overdue', type: 'object', objectName: 'todo_task', viewName: 'overdue', label: 'Overdue', icon: 'alert-circle' },
25+
{ id: 'nav_today', type: 'object', objectName: 'todo_task', viewName: 'due_today', label: 'Due Today', icon: 'calendar' },
2626
{ id: 'nav_upcoming', type: 'object', objectName: 'todo_task', label: 'Upcoming', icon: 'calendar-plus' },
2727
]
2828
},

examples/app-todo/src/dashboards/task.dashboard.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,11 @@ export const TaskDashboard: Dashboard = {
115115
options: { showLegend: true }
116116
},
117117

118-
// Row 4: Tables
119-
{
120-
id: 'overdue_tasks_table',
121-
title: 'Overdue Tasks',
122-
type: 'table',
123-
filter: { is_overdue: true, is_completed: false },
124-
dataset: 'task_metrics',
125-
values: ['task_count'],
126-
layout: { x: 0, y: 10, w: 6, h: 4 },
127-
},
128-
{
129-
id: 'due_today',
130-
title: 'Due Today',
131-
type: 'table',
132-
filter: { due_date: '{today}', is_completed: false },
133-
dataset: 'task_metrics',
134-
values: ['task_count'],
135-
layout: { x: 6, y: 10, w: 6, h: 4 },
136-
},
118+
// The former Row 4 count-only `table` widgets (`overdue_tasks_table`,
119+
// `due_today`) rendered a single summary row, not the record listing
120+
// they intended (#1719). Those listings live as ListViews on
121+
// `todo_task` (`overdue`, `due_today` — ADR-0017), reachable from the
122+
// app navigation; the `overdue_tasks` / `completed_today` metric
123+
// widgets above keep the counts.
137124
],
138125
};

examples/app-todo/src/views/task.view.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ const data = { provider: 'object' as const, object: 'todo_task' };
1111
* (no grouping / aggregation), which is a ListView concern, not analytics. It
1212
* is converted here to an `overdue` grid view filtered to incomplete, overdue
1313
* tasks — replacing the report entirely.
14+
*
15+
* Issue #1719: the dashboard's `overdue_tasks_table` / `due_today` widgets
16+
* were count-only `table` widgets on the `task_metrics` dataset — a single
17+
* summary row, not the record listing they intended. They are re-modelled
18+
* here as the `overdue` / `due_today` views, surfaced via app navigation;
19+
* the dashboard keeps the counts on its `metric` widgets.
1420
*/
1521
export const TaskViews = defineView({
1622
list: {
@@ -46,5 +52,24 @@ export const TaskViews = defineView({
4652
],
4753
sort: [{ field: 'due_date', order: 'asc' }],
4854
},
55+
56+
// Replaces the dashboard's count-only `due_today` table widget (#1719).
57+
due_today: {
58+
label: 'Due Today',
59+
type: 'grid',
60+
data,
61+
columns: [
62+
{ field: 'subject' },
63+
{ field: 'priority' },
64+
{ field: 'status' },
65+
{ field: 'owner' },
66+
{ field: 'category' },
67+
],
68+
filter: [
69+
{ field: 'due_date', operator: 'equals', value: '{today}' },
70+
{ field: 'is_completed', operator: 'equals', value: false },
71+
],
72+
sort: [{ field: 'priority', order: 'desc' }],
73+
},
4974
},
5075
});

0 commit comments

Comments
 (0)